From c1f16726da5a0026e7b5769df95aa31e1843bbeb Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Sat, 24 Aug 2024 13:22:19 +0200 Subject: [PATCH] Main: MaterialSerializer - further reduce TextureEffect usage --- OgreMain/include/OgreMaterialSerializer.h | 4 ++-- OgreMain/src/OgreMaterialSerializer.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OgreMain/include/OgreMaterialSerializer.h b/OgreMain/include/OgreMaterialSerializer.h index 1deb2c6e906..e1c7e2f93a1 100644 --- a/OgreMain/include/OgreMaterialSerializer.h +++ b/OgreMain/include/OgreMaterialSerializer.h @@ -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(TextureUnitState::EnvMapType type); String convertFiltering(FilterOptions fo); diff --git a/OgreMain/src/OgreMaterialSerializer.cpp b/OgreMain/src/OgreMaterialSerializer.cpp index 29992758d45..b604ad58e06 100644 --- a/OgreMain/src/OgreMaterialSerializer.cpp +++ b/OgreMain/src/OgreMaterialSerializer.cpp @@ -1065,10 +1065,10 @@ namespace Ogre switch (ef.type) { case TextureUnitState::ET_ENVIRONMENT_MAP : - writeEnvironmentMapEffect(ef, pTex); + writeEnvironmentMapEffect((TextureUnitState::EnvMapType)ef.subtype); break; case TextureUnitState::ET_ROTATE : - writeRotationEffect(ef, pTex); + writeRotationEffect(ef.arg1); break; case TextureUnitState::ET_UVSCROLL : scrollAnimU = scrollAnimV = ef.arg1; @@ -1124,10 +1124,10 @@ namespace Ogre } //----------------------------------------------------------------------- - void MaterialSerializer::writeEnvironmentMapEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex) + void MaterialSerializer::writeEnvironmentMapEffect(TextureUnitState::EnvMapType type) { writeAttribute(4, "env_map"); - switch (effect.subtype) + switch (type) { case TextureUnitState::ENV_PLANAR: writeValue("planar"); @@ -1144,12 +1144,12 @@ namespace Ogre } } //----------------------------------------------------------------------- - 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)); } } //-----------------------------------------------------------------------