Refactored EngineTextureMapping into enum class

dev
Tomasz Kapuściński 2022-01-18 20:14:07 +01:00
parent 68a222e03a
commit a1ea633a3e
5 changed files with 20 additions and 20 deletions

View File

@ -1181,7 +1181,7 @@ void CEngine::ChangeTextureMapping(int objRank, const Material& mat, int state,
int nb = p4->vertices.size();
if (mode == ENG_TEX_MAPPING_X)
if (mode == EngineTextureMapping::X)
{
for (int i = 0; i < nb; i++)
{
@ -1189,7 +1189,7 @@ void CEngine::ChangeTextureMapping(int objRank, const Material& mat, int state,
p4->vertices[i].uv.y = p4->vertices[i].position.y * av + bv;
}
}
else if (mode == ENG_TEX_MAPPING_Y)
else if (mode == EngineTextureMapping::Y)
{
for (int i = 0; i < nb; i++)
{
@ -1197,7 +1197,7 @@ void CEngine::ChangeTextureMapping(int objRank, const Material& mat, int state,
p4->vertices[i].uv.y = p4->vertices[i].position.z * av + bv;
}
}
else if (mode == ENG_TEX_MAPPING_Z)
else if (mode == EngineTextureMapping::Z)
{
for (int i = 0; i < nb; i++)
{
@ -1205,21 +1205,21 @@ void CEngine::ChangeTextureMapping(int objRank, const Material& mat, int state,
p4->vertices[i].uv.y = p4->vertices[i].position.y * av + bv;
}
}
else if (mode == ENG_TEX_MAPPING_1X)
else if (mode == EngineTextureMapping::ONE_X)
{
for (int i = 0; i < nb; i++)
{
p4->vertices[i].uv.x = p4->vertices[i].position.x * au + bu;
}
}
else if (mode == ENG_TEX_MAPPING_1Y)
else if (mode == EngineTextureMapping::ONE_Y)
{
for (int i = 0; i < nb; i++)
{
p4->vertices[i].uv.y = p4->vertices[i].position.y * au + bu;
}
}
else if (mode == ENG_TEX_MAPPING_1Z)
else if (mode == EngineTextureMapping::ONE_Z)
{
for (int i = 0; i < nb; i++)
{

View File

@ -424,14 +424,14 @@ struct EngineGroundMark
* \enum EngineTextureMapping
* \brief Type of texture mapping
*/
enum EngineTextureMapping
enum class EngineTextureMapping
{
ENG_TEX_MAPPING_X = 1,
ENG_TEX_MAPPING_Y = 2,
ENG_TEX_MAPPING_Z = 3,
ENG_TEX_MAPPING_1X = 4,
ENG_TEX_MAPPING_1Y = 5,
ENG_TEX_MAPPING_1Z = 6
X = 1,
Y = 2,
Z = 3,
ONE_X = 4,
ONE_Y = 5,
ONE_Z = 6
};

View File

@ -407,10 +407,10 @@ void CAutoPortico::UpdateTrackMapping(float left, float right)
if(m_object->GetTeam() == 0) teamStr = "";
m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART1, "objects/lemt.png"+teamStr, "",
Gfx::ENG_TEX_MAPPING_X,
Gfx::EngineTextureMapping::X,
right, 8.0f, 8.0f, 192.0f, 256.0f);
m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART2, "objects/lemt.png"+teamStr, "",
Gfx::ENG_TEX_MAPPING_X,
Gfx::EngineTextureMapping::X,
left, 8.0f, 8.0f, 192.0f, 256.0f);
}

View File

@ -1991,21 +1991,21 @@ void CMotionVehicle::UpdateTrackMapping(float left, float right, ObjectType type
if (type == OBJECT_MOBILEdr)
{
m_engine->TrackTextureMapping(rRank, mat, Gfx::ENG_RSTATE_PART1, "objects/drawer.png"+teamStr, "",
Gfx::ENG_TEX_MAPPING_X,
Gfx::EngineTextureMapping::X,
right, 1.0f, 8.0f, 192.0f, 256.0f);
m_engine->TrackTextureMapping(lRank, mat, Gfx::ENG_RSTATE_PART2, "objects/drawer.png"+teamStr, "",
Gfx::ENG_TEX_MAPPING_X,
Gfx::EngineTextureMapping::X,
left, 1.0f, 8.0f, 192.0f, 256.0f);
}
else
{
m_engine->TrackTextureMapping(rRank, mat, Gfx::ENG_RSTATE_PART1, "objects/lemt.png"+teamStr, "",
Gfx::ENG_TEX_MAPPING_X,
Gfx::EngineTextureMapping::X,
right, 1.0f, 8.0f, 192.0f, 256.0f);
m_engine->TrackTextureMapping(lRank, mat, Gfx::ENG_RSTATE_PART2, "objects/lemt.png"+teamStr, "",
Gfx::ENG_TEX_MAPPING_X,
Gfx::EngineTextureMapping::X,
left, 1.0f, 8.0f, 192.0f, 256.0f);
}

View File

@ -2044,7 +2044,7 @@ void COldObject::UpdateEnergyMapping()
if(GetTeam() == 0) teamStr = "";
m_engine->ChangeTextureMapping(m_objectPart[0].object,
mat, Gfx::ENG_RSTATE_PART3, "objects/lemt.png"+teamStr, "",
Gfx::ENG_TEX_MAPPING_1Y,
Gfx::EngineTextureMapping::ONE_Y,
au, bu, 1.0f, 0.0f);
}