Skip to content

Commit 8138883

Browse files
committed
refactor(w3dshadermanager): Remove unused flat shroud texture shader
1 parent afd3801 commit 8138883

2 files changed

Lines changed: 0 additions & 97 deletions

File tree

‎Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DShaderManager.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class W3DShaderManager
7070
ST_FLAT_TERRAIN_BASE_NOISE1, //shader to apply base texture and cloud/noise 1.
7171
ST_FLAT_TERRAIN_BASE_NOISE2, //shader to apply base texture and cloud/noise 2.
7272
ST_FLAT_TERRAIN_BASE_NOISE12,//shader to apply base texture and both cloud/noise
73-
ST_FLAT_SHROUD_TEXTURE, //shader to apply shroud texture projection.
7473
ST_MAX
7574
};
7675

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

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,101 +1291,6 @@ void ShroudTextureShader::reset()
12911291
DX8Wrapper::Set_DX8_Texture_Stage_State(m_stageOfSet, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
12921292
}
12931293

1294-
///Shroud layer rendering shader
1295-
class FlatShroudTextureShader : public W3DShaderInterface
1296-
{
1297-
virtual Int set(Int pass) override; ///<setup shader for the specified rendering pass.
1298-
virtual Int init() override; ///<perform any one time initialization and validation
1299-
virtual void reset() override; ///<do any custom resetting necessary to bring W3D in sync.
1300-
Int m_stageOfSet;
1301-
} flatShroudTextureShader;
1302-
1303-
///List of different shroud shader implementations in order of preference
1304-
W3DShaderInterface *FlatShroudShaderList[]=
1305-
{
1306-
&flatShroudTextureShader,
1307-
nullptr
1308-
};
1309-
1310-
//#define SHROUD_STRETCH_FACTOR (1.0f/MAP_XY_FACTOR) //1 texel per heightmap cell width
1311-
1312-
Int FlatShroudTextureShader::init()
1313-
{
1314-
W3DShaders[W3DShaderManager::ST_FLAT_SHROUD_TEXTURE]=&flatShroudTextureShader;
1315-
W3DShadersPassCount[W3DShaderManager::ST_FLAT_SHROUD_TEXTURE]=1;
1316-
1317-
return TRUE;
1318-
}
1319-
1320-
//Setup a texture projection in the given stage that applies our shroud.
1321-
Int FlatShroudTextureShader::set(Int stage)
1322-
{
1323-
//force WW3D2 system to set it's states so it won't later overwrite our custom settings.
1324-
if (stage < 2)
1325-
Renderer::Set_Texture(stage, W3DShaderManager::getShaderTexture(stage));
1326-
else //stages larger than 1 are not supported by W3D so set them directly
1327-
DX8Wrapper::Set_DX8_Texture(stage, W3DShaderManager::getShaderTexture(stage)->Peek_D3D_Texture());
1328-
1329-
DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_COLORARG1, D3DTA_TEXTURE );
1330-
DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_COLORARG2, D3DTA_CURRENT );
1331-
DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_COLOROP, D3DTOP_MODULATE );
1332-
DX8Wrapper::Set_DX8_Texture_Stage_State( stage, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
1333-
//DX8Wrapper::Apply_Render_State_Changes();
1334-
1335-
DX8Wrapper::Set_DX8_Texture_Stage_State(stage, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION);
1336-
DX8Wrapper::Set_DX8_Texture_Stage_State(stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);
1337-
1338-
//We need to scale so shroud texel stretches over one full terrain cell. Each texel
1339-
//is 1/128 the size of full texture. (assuming 128x128 vid-mem texture).
1340-
W3DShroud *shroud;
1341-
if ((shroud=TheTerrainRenderObject->getShroud()) != nullptr)
1342-
{
1343-
///@todo: All this code really only need to be done once per camera/view. Find a way to optimize it out.
1344-
D3DXMATRIX curView;
1345-
DX8Wrapper::_Get_DX8_Transform(D3DTS_VIEW, curView);
1346-
1347-
D3DXMATRIX inv;
1348-
float det;
1349-
D3DXMatrixInverse(&inv, &det, &curView);
1350-
1351-
D3DXMATRIX scale,offset;
1352-
1353-
//We need to make all world coordinates be relative to the heightmap data origin since that
1354-
//is where the shroud begins.
1355-
1356-
float xoffset = 0;
1357-
float yoffset = 0;
1358-
Real width=shroud->getCellWidth();
1359-
Real height=shroud->getCellHeight();
1360-
1361-
if (TheTerrainRenderObject->getMap())
1362-
{
1363-
//subtract origin position from all coordinates. Origin is shifted by 1 cell width/height to allow for unused border texels.
1364-
xoffset = -(float)shroud->getDrawOriginX() + width;
1365-
yoffset = -(float)shroud->getDrawOriginY() + height;
1366-
}
1367-
1368-
D3DXMatrixTranslation(&offset, xoffset, yoffset,0);
1369-
1370-
width = 1.0f/(width*shroud->getTextureWidth());
1371-
height = 1.0f/(height*shroud->getTextureHeight());
1372-
D3DXMatrixScaling(&scale, width, height, 1);
1373-
curView = (inv * offset) * scale;
1374-
DX8Wrapper::_Set_DX8_Transform((D3DTRANSFORMSTATETYPE )(D3DTS_TEXTURE0+stage), curView);
1375-
}
1376-
m_stageOfSet=stage;
1377-
return TRUE;
1378-
}
1379-
1380-
void FlatShroudTextureShader::reset()
1381-
{
1382-
if (m_stageOfSet < MAX_TEXTURE_STAGES)
1383-
Renderer::Set_Texture(m_stageOfSet,nullptr);
1384-
DX8Wrapper::Set_DX8_Render_State(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
1385-
DX8Wrapper::Set_DX8_Texture_Stage_State(m_stageOfSet, D3DTSS_TEXCOORDINDEX, m_stageOfSet);
1386-
DX8Wrapper::Set_DX8_Texture_Stage_State(m_stageOfSet, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
1387-
}
1388-
13891294
///Mask layer rendering shader
13901295
class MaskTextureShader : public W3DShaderInterface
13911296
{
@@ -2574,7 +2479,6 @@ W3DShaderInterface **MasterShaderList[]=
25742479
{
25752480
TerrainShaderList,
25762481
ShroudShaderList,
2577-
FlatShroudShaderList,
25782482
RoadShaderList,
25792483
MaskShaderList,
25802484
CloudShaderList,

0 commit comments

Comments
 (0)