mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 22:53:53 +00:00
68 lines
1.7 KiB
C++
68 lines
1.7 KiB
C++
|
#include "OgreMaterialSerializer.hpp"
|
||
|
|
||
|
namespace sh
|
||
|
{
|
||
|
void OgreMaterialSerializer::reset()
|
||
|
{
|
||
|
mScriptContext.section = Ogre::MSS_NONE;
|
||
|
mScriptContext.material.setNull();
|
||
|
mScriptContext.technique = 0;
|
||
|
mScriptContext.pass = 0;
|
||
|
mScriptContext.textureUnit = 0;
|
||
|
mScriptContext.program.setNull();
|
||
|
mScriptContext.lineNo = 0;
|
||
|
mScriptContext.filename.clear();
|
||
|
mScriptContext.techLev = -1;
|
||
|
mScriptContext.passLev = -1;
|
||
|
mScriptContext.stateLev = -1;
|
||
|
}
|
||
|
|
||
|
bool OgreMaterialSerializer::setPassProperty (const std::string& param, std::string value, Ogre::Pass* pass)
|
||
|
{
|
||
|
reset();
|
||
|
|
||
|
mScriptContext.section = Ogre::MSS_PASS;
|
||
|
mScriptContext.pass = pass;
|
||
|
|
||
|
if (mPassAttribParsers.find (param) == mPassAttribParsers.end())
|
||
|
return false;
|
||
|
else
|
||
|
{
|
||
|
mPassAttribParsers.find(param)->second(value, mScriptContext);
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool OgreMaterialSerializer::setTextureUnitProperty (const std::string& param, std::string value, Ogre::TextureUnitState* t)
|
||
|
{
|
||
|
reset();
|
||
|
|
||
|
mScriptContext.section = Ogre::MSS_TEXTUREUNIT;
|
||
|
mScriptContext.textureUnit = t;
|
||
|
|
||
|
if (mTextureUnitAttribParsers.find (param) == mTextureUnitAttribParsers.end())
|
||
|
return false;
|
||
|
else
|
||
|
{
|
||
|
mTextureUnitAttribParsers.find(param)->second(value, mScriptContext);
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool OgreMaterialSerializer::setMaterialProperty (const std::string& param, std::string value, Ogre::MaterialPtr m)
|
||
|
{
|
||
|
reset();
|
||
|
|
||
|
mScriptContext.section = Ogre::MSS_MATERIAL;
|
||
|
mScriptContext.material = m;
|
||
|
|
||
|
if (mMaterialAttribParsers.find (param) == mMaterialAttribParsers.end())
|
||
|
return false;
|
||
|
else
|
||
|
{
|
||
|
mMaterialAttribParsers.find(param)->second(value, mScriptContext);
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
}
|