@@ -235,14 +235,20 @@ void WaterRenderObjClass::setupJbaWaterShader(void)
235235
236236 Matrix4x4 curView;
237237 DX8Wrapper::_Get_DX8_Transform (D3DTS_VIEW, curView);
238- D3DXMatrixInverse (&inv, &det, (D3DXMATRIX*)&curView);
238+ D3DXMATRIX d3dCurView (
239+ curView[0 ][0 ], curView[0 ][1 ], curView[0 ][2 ], curView[0 ][3 ],
240+ curView[1 ][0 ], curView[1 ][1 ], curView[1 ][2 ], curView[1 ][3 ],
241+ curView[2 ][0 ], curView[2 ][1 ], curView[2 ][2 ], curView[2 ][3 ],
242+ curView[3 ][0 ], curView[3 ][1 ], curView[3 ][2 ], curView[3 ][3 ]
243+ );
244+ D3DXMatrixInverse (&inv, &det, &d3dCurView);
239245 D3DXMATRIX scale;
240246
241247 D3DXMatrixScaling (&scale, NOISE_REPEAT_FACTOR, NOISE_REPEAT_FACTOR,1 );
242248 D3DXMATRIX destMatrix = inv * scale;
243249 D3DXMatrixTranslation (&scale, m_riverVOrigin, m_riverVOrigin,0 );
244250 destMatrix = destMatrix*scale;
245- DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, *(Matrix4x4*)& destMatrix);
251+ DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, destMatrix);
246252
247253 }
248254 m_pDev->SetTextureStageState ( 0 , D3DTSS_MINFILTER, D3DTEXF_LINEAR );
@@ -1579,7 +1585,13 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo)
15791585 DX8Wrapper::_Get_DX8_Transform (D3DTS_VIEW, curView);
15801586
15811587 // get inverse of view matrix(= view to world matrix)
1582- D3DXMatrixInverse (&inv, &det, (D3DXMATRIX*)&curView);
1588+ D3DXMATRIX d3dCurView (
1589+ curView[0 ][0 ], curView[0 ][1 ], curView[0 ][2 ], curView[0 ][3 ],
1590+ curView[1 ][0 ], curView[1 ][1 ], curView[1 ][2 ], curView[1 ][3 ],
1591+ curView[2 ][0 ], curView[2 ][1 ], curView[2 ][2 ], curView[2 ][3 ],
1592+ curView[3 ][0 ], curView[3 ][1 ], curView[3 ][2 ], curView[3 ][3 ]
1593+ );
1594+ D3DXMatrixInverse (&inv, &det, &d3dCurView);
15831595
15841596 // create clipping matrix by inserting our plane equation into the 1st column
15851597 D3DXMatrixIdentity (&clipMatrix);
@@ -2964,14 +2976,20 @@ void WaterRenderObjClass::setupFlatWaterShader(void)
29642976
29652977 Matrix4x4 curView;
29662978 DX8Wrapper::_Get_DX8_Transform (D3DTS_VIEW, curView);
2967- D3DXMatrixInverse (&inv, &det, (D3DXMATRIX*)&curView);
2979+ D3DXMATRIX d3dCurView (
2980+ curView[0 ][0 ], curView[0 ][1 ], curView[0 ][2 ], curView[0 ][3 ],
2981+ curView[1 ][0 ], curView[1 ][1 ], curView[1 ][2 ], curView[1 ][3 ],
2982+ curView[2 ][0 ], curView[2 ][1 ], curView[2 ][2 ], curView[2 ][3 ],
2983+ curView[3 ][0 ], curView[3 ][1 ], curView[3 ][2 ], curView[3 ][3 ]
2984+ );
2985+ D3DXMatrixInverse (&inv, &det, &d3dCurView);
29682986 D3DXMATRIX scale;
29692987
29702988 D3DXMatrixScaling (&scale, NOISE_REPEAT_FACTOR, NOISE_REPEAT_FACTOR,1 );
29712989 D3DXMATRIX destMatrix = inv * scale;
29722990 D3DXMatrixTranslation (&scale, m_riverVOrigin, m_riverVOrigin,0 );
29732991 destMatrix = destMatrix*scale;
2974- DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, *(Matrix4x4*)& destMatrix);
2992+ DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, destMatrix);
29752993
29762994 }
29772995 m_pDev->SetTextureStageState ( 0 , D3DTSS_MINFILTER, D3DTEXF_LINEAR );
0 commit comments