@@ -242,14 +242,20 @@ void WaterRenderObjClass::setupJbaWaterShader(void)
242242
243243 Matrix4x4 curView;
244244 DX8Wrapper::_Get_DX8_Transform (D3DTS_VIEW, curView);
245- D3DXMatrixInverse (&inv, &det, (D3DXMATRIX*)&curView);
245+ D3DXMATRIX d3dCurView (
246+ curView[0 ][0 ], curView[0 ][1 ], curView[0 ][2 ], curView[0 ][3 ],
247+ curView[1 ][0 ], curView[1 ][1 ], curView[1 ][2 ], curView[1 ][3 ],
248+ curView[2 ][0 ], curView[2 ][1 ], curView[2 ][2 ], curView[2 ][3 ],
249+ curView[3 ][0 ], curView[3 ][1 ], curView[3 ][2 ], curView[3 ][3 ]
250+ );
251+ D3DXMatrixInverse (&inv, &det, &d3dCurView);
246252 D3DXMATRIX scale;
247253
248254 D3DXMatrixScaling (&scale, NOISE_REPEAT_FACTOR, NOISE_REPEAT_FACTOR,1 );
249255 D3DXMATRIX destMatrix = inv * scale;
250256 D3DXMatrixTranslation (&scale, m_riverVOrigin, m_riverVOrigin,0 );
251257 destMatrix = destMatrix*scale;
252- DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, *(Matrix4x4*)& destMatrix);
258+ DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, destMatrix);
253259
254260 }
255261 m_pDev->SetTextureStageState ( 0 , D3DTSS_MINFILTER, D3DTEXF_LINEAR );
@@ -1602,7 +1608,13 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo)
16021608 DX8Wrapper::_Get_DX8_Transform (D3DTS_VIEW, curView);
16031609
16041610 // get inverse of view matrix(= view to world matrix)
1605- D3DXMatrixInverse (&inv, &det, (D3DXMATRIX*)&curView);
1611+ D3DXMATRIX d3dCurView (
1612+ curView[0 ][0 ], curView[0 ][1 ], curView[0 ][2 ], curView[0 ][3 ],
1613+ curView[1 ][0 ], curView[1 ][1 ], curView[1 ][2 ], curView[1 ][3 ],
1614+ curView[2 ][0 ], curView[2 ][1 ], curView[2 ][2 ], curView[2 ][3 ],
1615+ curView[3 ][0 ], curView[3 ][1 ], curView[3 ][2 ], curView[3 ][3 ]
1616+ );
1617+ D3DXMatrixInverse (&inv, &det, &d3dCurView);
16061618
16071619 // create clipping matrix by inserting our plane equation into the 1st column
16081620 D3DXMatrixIdentity (&clipMatrix);
@@ -2998,14 +3010,20 @@ void WaterRenderObjClass::setupFlatWaterShader(void)
29983010
29993011 Matrix4x4 curView;
30003012 DX8Wrapper::_Get_DX8_Transform (D3DTS_VIEW, curView);
3001- D3DXMatrixInverse (&inv, &det, (D3DXMATRIX*)&curView);
3013+ D3DXMATRIX d3dCurView (
3014+ curView[0 ][0 ], curView[0 ][1 ], curView[0 ][2 ], curView[0 ][3 ],
3015+ curView[1 ][0 ], curView[1 ][1 ], curView[1 ][2 ], curView[1 ][3 ],
3016+ curView[2 ][0 ], curView[2 ][1 ], curView[2 ][2 ], curView[2 ][3 ],
3017+ curView[3 ][0 ], curView[3 ][1 ], curView[3 ][2 ], curView[3 ][3 ]
3018+ );
3019+ D3DXMatrixInverse (&inv, &det, &d3dCurView);
30023020 D3DXMATRIX scale;
30033021
30043022 D3DXMatrixScaling (&scale, NOISE_REPEAT_FACTOR, NOISE_REPEAT_FACTOR,1 );
30053023 D3DXMATRIX destMatrix = inv * scale;
30063024 D3DXMatrixTranslation (&scale, m_riverVOrigin, m_riverVOrigin,0 );
30073025 destMatrix = destMatrix*scale;
3008- DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, *(Matrix4x4*)& destMatrix);
3026+ DX8Wrapper::_Set_DX8_Transform (D3DTS_TEXTURE2, destMatrix);
30093027
30103028 }
30113029 m_pDev->SetTextureStageState ( 0 , D3DTSS_MINFILTER, D3DTEXF_LINEAR );
0 commit comments