Skip to content

Commit 531dab3

Browse files
committed
Use Build_D3DXMATRIX helper in all remaining files
1 parent 6f40a0e commit 531dab3

File tree

6 files changed

+19
-114
lines changed

6 files changed

+19
-114
lines changed

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/W3DShaderManager.cpp

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,12 +1237,7 @@ Int ShroudTextureShader::set(Int stage)
12371237
Matrix4x4 curView;
12381238
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView);
12391239

1240-
D3DXMATRIX d3dCurView(
1241-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
1242-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
1243-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
1244-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
1245-
);
1240+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
12461241
D3DXMatrixInverse(&inv, &det, &d3dCurView);
12471242

12481243
D3DXMATRIX scale,offset;
@@ -1336,12 +1331,7 @@ Int FlatShroudTextureShader::set(Int stage)
13361331
Matrix4x4 curView;
13371332
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView);
13381333

1339-
D3DXMATRIX d3dCurView(
1340-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
1341-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
1342-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
1343-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
1344-
);
1334+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
13451335
D3DXMatrixInverse(&inv, &det, &d3dCurView);
13461336

13471337
D3DXMATRIX scale,offset;
@@ -1434,12 +1424,7 @@ Int MaskTextureShader::set(Int pass)
14341424
D3DXMATRIX inv;
14351425
float det;
14361426

1437-
D3DXMATRIX d3dCurView(
1438-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
1439-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
1440-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
1441-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
1442-
);
1427+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
14431428
D3DXMatrixInverse(&inv, &det, &d3dCurView);
14441429

14451430
D3DXMATRIX scale,offset,offsetTextureCenter;
@@ -1733,12 +1718,7 @@ Int TerrainShader2Stage::set(Int pass)
17331718
D3DXMATRIX inv;
17341719
float det;
17351720

1736-
D3DXMATRIX d3dCurView(
1737-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
1738-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
1739-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
1740-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
1741-
);
1721+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
17421722
D3DXMatrixInverse(&inv, &det, &d3dCurView);
17431723

17441724
if (W3DShaderManager::getCurrentShader() == W3DShaderManager::ST_TERRAIN_BASE_NOISE12)
@@ -2070,12 +2050,7 @@ Int TerrainShaderPixelShader::set(Int pass)
20702050

20712051
D3DXMATRIX inv;
20722052
float det;
2073-
D3DXMATRIX d3dCurView(
2074-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
2075-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
2076-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
2077-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
2078-
);
2053+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
20792054
D3DXMatrixInverse(&inv, &det, &d3dCurView);
20802055

20812056
DX8Wrapper::Set_DX8_Texture_Stage_State(2, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION);
@@ -2200,12 +2175,7 @@ Int CloudTextureShader::set(Int stage)
22002175
D3DXMATRIX inv;
22012176
float det;
22022177

2203-
D3DXMATRIX d3dCurView(
2204-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
2205-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
2206-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
2207-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
2208-
);
2178+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
22092179
D3DXMatrixInverse(&inv, &det, &d3dCurView);
22102180

22112181
D3DXMATRIX texTransform;
@@ -2340,12 +2310,7 @@ Int RoadShaderPixelShader::set(Int pass)
23402310

23412311
D3DXMATRIX inv;
23422312
float det;
2343-
D3DXMATRIX d3dCurView(
2344-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
2345-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
2346-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
2347-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
2348-
);
2313+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
23492314
D3DXMatrixInverse(&inv, &det, &d3dCurView);
23502315

23512316
if (TheGlobalData && TheGlobalData->m_trilinearTerrainTex)
@@ -2463,12 +2428,7 @@ Int RoadShader2Stage::set(Int pass)
24632428

24642429
D3DXMATRIX inv;
24652430
float det;
2466-
D3DXMATRIX d3dCurView(
2467-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
2468-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
2469-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
2470-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
2471-
);
2431+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
24722432
D3DXMatrixInverse(&inv, &det, &d3dCurView);
24732433

24742434
if (TheGlobalData && TheGlobalData->m_trilinearTerrainTex)
@@ -2531,12 +2491,7 @@ Int RoadShader2Stage::set(Int pass)
25312491

25322492
D3DXMATRIX inv;
25332493
float det;
2534-
D3DXMATRIX d3dCurView(
2535-
curView[0][0], curView[0][1], curView[0][2], curView[0][3],
2536-
curView[1][0], curView[1][1], curView[1][2], curView[1][3],
2537-
curView[2][0], curView[2][1], curView[2][2], curView[2][3],
2538-
curView[3][0], curView[3][1], curView[3][2], curView[3][3]
2539-
);
2494+
D3DXMATRIX d3dCurView = Build_D3DXMATRIX(curView);
25402495
D3DXMatrixInverse(&inv, &det, &d3dCurView);
25412496

25422497
if (TheGlobalData && TheGlobalData->m_trilinearTerrainTex)

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)