Skip to content

Commit

Permalink
Main: MaterialSerializer - further reduce TextureEffect usage
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Aug 25, 2024
1 parent c0b6247 commit 371b4d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions OgreMain/include/OgreMaterialSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ namespace Ogre {
void writeLayerBlendOperationEx(const LayerBlendOperationEx op);
void writeLayerBlendSource(const LayerBlendSource lbs);

void writeRotationEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex);
void writeRotationEffect(float speed);
void writeTransformEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex);
void writeScrollEffect(float scrollAnimU, float scrollAnimV);
void writeEnvironmentMapEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex);
void writeEnvironmentMapEffect(int type);

String convertFiltering(FilterOptions fo);

Expand Down
25 changes: 14 additions & 11 deletions OgreMain/src/OgreMaterialSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,10 +1065,10 @@ namespace Ogre
switch (ef.type)
{
case TextureUnitState::ET_ENVIRONMENT_MAP :
writeEnvironmentMapEffect(ef, pTex);
writeEnvironmentMapEffect(ef.subtype);
break;
case TextureUnitState::ET_ROTATE :
writeRotationEffect(ef, pTex);
writeRotationEffect(ef.arg1);
break;
case TextureUnitState::ET_UVSCROLL :
scrollAnimU = scrollAnimV = ef.arg1;
Expand Down Expand Up @@ -1124,32 +1124,35 @@ namespace Ogre

}
//-----------------------------------------------------------------------
void MaterialSerializer::writeEnvironmentMapEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex)
void MaterialSerializer::writeEnvironmentMapEffect(int type)
{
writeAttribute(4, "env_map");
switch (effect.subtype)
switch (type)
{
case TextureUnitState::ENV_PLANAR:
case TEXCALC_ENVIRONMENT_MAP_PLANAR:
writeValue("planar");
break;
case TextureUnitState::ENV_CURVED:
case TEXCALC_ENVIRONMENT_MAP:
writeValue("spherical");
break;
case TextureUnitState::ENV_NORMAL:
case TEXCALC_ENVIRONMENT_MAP_NORMAL:
writeValue("cubic_normal");
break;
case TextureUnitState::ENV_REFLECTION:
case TEXCALC_ENVIRONMENT_MAP_REFLECTION:
writeValue("cubic_reflection");
break;
default:
OgreAssert(false, "Unknown environment map type");
break;
}
}
//-----------------------------------------------------------------------
void MaterialSerializer::writeRotationEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex)
void MaterialSerializer::writeRotationEffect(float speed)
{
if (effect.arg1)
if (speed)
{
writeAttribute(4, "rotate_anim");
writeValue(StringConverter::toString(effect.arg1));
writeValue(StringConverter::toString(speed));
}
}
//-----------------------------------------------------------------------
Expand Down

0 comments on commit 371b4d4

Please sign in to comment.