Skip to content

Commit 9a7854f

Browse files
committed
Use Build_D3DXMATRIX helper in all remaining files
1 parent 3853297 commit 9a7854f

File tree

6 files changed

+11
-66
lines changed

6 files changed

+11
-66
lines changed

Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,12 +1331,7 @@ Int FlatShroudTextureShader::set(Int stage)
13311331
Matrix4x4 curView;
13321332
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView);
13331333

1334-
D3DXMATRIX d3dCurView(
1335-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
1336-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
1337-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
1338-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
1339-
);
1334+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
13401335
D3DXMatrixInverse(&inv, &det, &d3dCurView);
13411336

13421337
D3DXMATRIX scale,offset;

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -788,12 +788,7 @@ void LightMapTerrainTextureClass::Apply(unsigned int stage)
788788

789789
D3DXMATRIX inv;
790790
float det;
791-
D3DXMATRIX d3dCurView(
792-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
793-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
794-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
795-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
796-
);
791+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
797792
D3DXMatrixInverse(&inv, &det, &d3dCurView);
798793
D3DXMATRIX scale;
799794
D3DXMatrixScaling(&scale, STRETCH_FACTOR, STRETCH_FACTOR,1);

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,7 @@ void WaterRenderObjClass::setupJbaWaterShader(void)
235235

236236
Matrix4x4 curView;
237237
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, 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-
);
238+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
244239
D3DXMatrixInverse(&inv, &det, &d3dCurView);
245240
D3DXMATRIX scale;
246241

@@ -1585,12 +1580,7 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo)
15851580
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView);
15861581

15871582
//get inverse of view matrix(= view to world matrix)
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-
);
1583+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
15941584
D3DXMatrixInverse(&inv, &det, &d3dCurView);
15951585

15961586
//create clipping matrix by inserting our plane equation into the 1st column
@@ -2976,12 +2966,7 @@ void WaterRenderObjClass::setupFlatWaterShader(void)
29762966

29772967
Matrix4x4 curView;
29782968
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, 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-
);
2969+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
29852970
D3DXMatrixInverse(&inv, &det, &d3dCurView);
29862971
D3DXMATRIX scale;
29872972

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -716,12 +716,7 @@ void LightMapTerrainTextureClass::Apply(unsigned int stage)
716716

717717
D3DXMATRIX inv;
718718
float det;
719-
D3DXMATRIX d3dCurView(
720-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
721-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
722-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
723-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
724-
);
719+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
725720
D3DXMatrixInverse(&inv, &det, &d3dCurView);
726721
D3DXMATRIX scale;
727722
D3DXMatrixScaling(&scale, STRETCH_FACTOR, STRETCH_FACTOR,1);

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,7 @@ void WaterRenderObjClass::setupJbaWaterShader(void)
242242

243243
Matrix4x4 curView;
244244
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, 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-
);
245+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
251246
D3DXMatrixInverse(&inv, &det, &d3dCurView);
252247
D3DXMATRIX scale;
253248

@@ -1608,12 +1603,7 @@ void WaterRenderObjClass::Render(RenderInfoClass & rinfo)
16081603
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView);
16091604

16101605
//get inverse of view matrix(= view to world matrix)
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-
);
1606+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
16171607
D3DXMatrixInverse(&inv, &det, &d3dCurView);
16181608

16191609
//create clipping matrix by inserting our plane equation into the 1st column
@@ -3010,12 +3000,7 @@ void WaterRenderObjClass::setupFlatWaterShader(void)
30103000

30113001
Matrix4x4 curView;
30123002
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, 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-
);
3003+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
30193004
D3DXMatrixInverse(&inv, &det, &d3dCurView);
30203005
D3DXMATRIX scale;
30213006

GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/sortingrenderer.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -453,18 +453,8 @@ void SortingRendererClass::Flush_Sorting_Pool()
453453
memcpy(dest_verts, src_verts, sizeof(VertexFormatXYZNDUV2)*state->vertex_count);
454454
dest_verts += state->vertex_count;
455455

456-
D3DXMATRIX worldMat2(
457-
state->sorting_state.world[0][0], state->sorting_state.world[0][1], state->sorting_state.world[0][2], state->sorting_state.world[0][3],
458-
state->sorting_state.world[1][0], state->sorting_state.world[1][1], state->sorting_state.world[1][2], state->sorting_state.world[1][3],
459-
state->sorting_state.world[2][0], state->sorting_state.world[2][1], state->sorting_state.world[2][2], state->sorting_state.world[2][3],
460-
state->sorting_state.world[3][0], state->sorting_state.world[3][1], state->sorting_state.world[3][2], state->sorting_state.world[3][3]
461-
);
462-
D3DXMATRIX viewMat2(
463-
state->sorting_state.view[0][0], state->sorting_state.view[0][1], state->sorting_state.view[0][2], state->sorting_state.view[0][3],
464-
state->sorting_state.view[1][0], state->sorting_state.view[1][1], state->sorting_state.view[1][2], state->sorting_state.view[1][3],
465-
state->sorting_state.view[2][0], state->sorting_state.view[2][1], state->sorting_state.view[2][2], state->sorting_state.view[2][3],
466-
state->sorting_state.view[3][0], state->sorting_state.view[3][1], state->sorting_state.view[3][2], state->sorting_state.view[3][3]
467-
);
456+
D3DXMATRIX worldMat2 = Build_D3DXMATRIX(state->sorting_state.world);
457+
D3DXMATRIX viewMat2 = Build_D3DXMATRIX(state->sorting_state.view);
468458
D3DXMATRIX d3d_mtx=worldMat2*viewMat2;
469459
const Matrix4x4& mtx=(const Matrix4x4&)d3d_mtx;
470460

0 commit comments

Comments
 (0)