SO3Engine
|
SO3Pass.cpp
Go to the documentation of this file.
52 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage("[WARNING] Could not find the texture file : " + tex_name);
122 if (!effects.empty() && (effects.find(Ogre::TextureUnitState::ET_ENVIRONMENT_MAP) != effectEnd))
127 if (!envMap && ((tex_name.find("ambient") != Ogre::String::npos) || (tex_name.find("lightmap") != Ogre::String::npos) || (tex_name.find("occlusion") != Ogre::String::npos) || (tex_name.find("_occ") != Ogre::String::npos)))
129 else if (!envMap && ((tex_name.find("diffuse") != Ogre::String::npos) || (tex_name.find("albedo") != Ogre::String::npos) || (tex_name.find("color") != Ogre::String::npos) || (tex_name.find("colour") != Ogre::String::npos)))
131 else if ((tex_name.find("normal") != Ogre::String::npos) || (tex_name.find("nrm") != Ogre::String::npos) || (tex_name.find("norm") != Ogre::String::npos) || (tex_name.find("_nm") != Ogre::String::npos) || (tex_name.find("_nmap") != Ogre::String::npos) || (tex_name.find("_ddn") != Ogre::String::npos))
133 else if ((tex_name.find("emissive") != Ogre::String::npos) || (tex_name.find("illum") != Ogre::String::npos))
135 else if ((tex_name.find("reflection_mask") != Ogre::String::npos) || (tex_name.find("refmask") != Ogre::String::npos))
137 else if (envMap || (tex_name.find("reflection") != Ogre::String::npos) || (tex_name.find("reflect") != Ogre::String::npos))
141 else if ((tex_name.find("specular") != Ogre::String::npos) || (tex_name.find("spec") != Ogre::String::npos))
167 //Ogre::RTShader::ShaderGenerator* shaderGen = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
171 bool isSupported = tech->isSupported() && ogrePass->hasVertexProgram() && ogrePass->hasFragmentProgram();
175 isSupported = tech->checkGPURules(errors) && tech->checkHardwareSupport(true, errors) && ogrePass->hasVertexProgram() && ogrePass->hasFragmentProgram();
183 if ((ogrePass->getIlluminationStage() == Ogre::IS_UNKNOWN) && (tech->getSchemeName() != "basic") && (tech->getSchemeName() != "basic_mat") && (!ogrePass->hasVertexProgram() || !ogrePass->hasFragmentProgram() || !isSupported || (!parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() && SRoot::getSingletonPtr()->GetSlicePlaneState())))
198 SShaderGenerator shaderRTSS(parentTechnique->GetOgreTechniquePointer(), ogrePass, SShaderGenerator::ShaderGeneratorRTSS, parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() || !SRoot::getSingletonPtr()->GetSlicePlaneState());
203 if (rendererName == "OpenGL ES 2.x Rendering Subsystem" || rendererName == "Metal Rendering Subsystem")
205 SShaderGeneratorUnified VPshader(parentTechnique->GetOgreTechniquePointer(), ogrePass, SShaderGenerator::ShaderGeneratorVP, parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() || !SRoot::getSingletonPtr()->GetSlicePlaneState());
206 MMechostr(MSKDEBUG, ">> Vertex Shader for material %s : %s\n", parentTechnique->GetParentMaterial()->GetName().c_str(), VPshader.GetShaderName().c_str());
209 SShaderGeneratorUnified FPshader(parentTechnique->GetOgreTechniquePointer(), ogrePass, SShaderGenerator::ShaderGeneratorFP, parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() || !SRoot::getSingletonPtr()->GetSlicePlaneState());
210 MMechostr(MSKDEBUG, ">> Fragment Shader for material %s : %s\n", parentTechnique->GetParentMaterial()->GetName().c_str(), FPshader.GetShaderName().c_str());
217 else if (rendererName == "Direct3D9 Rendering Subsystem" || rendererName == "Direct3D11 Rendering Subsystem" || rendererName == "OpenGL Rendering Subsystem" || rendererName == "Vulkan Rendering Subsystem")
219 SShaderGeneratorUnified VPshader(parentTechnique->GetOgreTechniquePointer(), ogrePass, SShaderGenerator::ShaderGeneratorVP, parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() || !SRoot::getSingletonPtr()->GetSlicePlaneState());
220 MMechostr(MSKDEBUG, ">> Vertex Shader for material %s : %s\n", parentTechnique->GetParentMaterial()->GetName().c_str(), VPshader.GetShaderName().c_str());
223 SShaderGeneratorUnified FPshader(parentTechnique->GetOgreTechniquePointer(), ogrePass, SShaderGenerator::ShaderGeneratorFP, parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() || !SRoot::getSingletonPtr()->GetSlicePlaneState());
224 MMechostr(MSKDEBUG, ">> Fragment Shader for material %s : %s\n", parentTechnique->GetParentMaterial()->GetName().c_str(), FPshader.GetShaderName().c_str());
232 SShaderGeneratorUnified VPshader(parentTechnique->GetOgreTechniquePointer(), ogrePass, SShaderGenerator::ShaderGeneratorVP, parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() || !SRoot::getSingletonPtr()->GetSlicePlaneState());
233 MMechostr(MSKDEBUG, ">> Vertex Shader for material %s : %s\n", parentTechnique->GetParentMaterial()->GetName().c_str(), VPshader.GetShaderName().c_str());
236 SShaderGeneratorUnified FPshader(parentTechnique->GetOgreTechniquePointer(), ogrePass, SShaderGenerator::ShaderGeneratorFP, parentTechnique->GetParentMaterial()->GetIgnoreSlicePlane() || !SRoot::getSingletonPtr()->GetSlicePlaneState());
237 MMechostr(MSKDEBUG, ">> Fragment Shader for material %s : %s\n", parentTechnique->GetParentMaterial()->GetName().c_str(), FPshader.GetShaderName().c_str());
445void SPass::SetTextureScrollAnimation(const unsigned int& textureUnit, const float& uSpeed, const float& vSpeed)
594 if ((texture != 0) /*&& (tmpTextureUnit->_getTexturePtr() != texture->getOgreTexturePointer())*/) // this test crash on deleted textures
675 if (!effects.empty() && (effects.find(Ogre::TextureUnitState::ET_ENVIRONMENT_MAP) != effectEnd))
680 if (!envMap && ((tex_name.find("ambient") != Ogre::String::npos) || (tex_name.find("lightmap") != Ogre::String::npos) || (tex_name.find("occlusion") != Ogre::String::npos) || (tex_name.find("_occ") != Ogre::String::npos)))
682 else if ((tex_name.find("normal") != Ogre::String::npos) || (tex_name.find("nrm") != Ogre::String::npos) || (tex_name.find("norm") != Ogre::String::npos) || (tex_name.find("_nm") != Ogre::String::npos) || (tex_name.find("_nmap") != Ogre::String::npos))
684 else if ((tex_name.find("emissive") != Ogre::String::npos) || (tex_name.find("illum") != Ogre::String::npos))
686 else if ((tex_name.find("reflection_mask") != Ogre::String::npos) || (tex_name.find("refmask") != Ogre::String::npos))
688 else if (envMap || (tex_name.find("reflection") != Ogre::String::npos) || (tex_name.find("reflect") != Ogre::String::npos))
692 else if ((tex_name.find("specular") != Ogre::String::npos) || (tex_name.find("spec") != Ogre::String::npos))
732 Ogre::GpuProgramParametersSharedPtr vertexProgramParameters = ogrePass->getVertexProgramParameters();
751void SPass::SetVertexProgramAutoParameter(const std::string& paramName, const Ogre::GpuProgramParameters::AutoConstantType& paramType, const size_t& paramExtraInfos)
755 Ogre::GpuProgramParametersSharedPtr vertexProgramParameters = ogrePass->getVertexProgramParameters();
765 Ogre::GpuProgramParametersSharedPtr vertexProgramParameters = ogrePass->getVertexProgramParameters();
766 const Ogre::GpuConstantDefinition* constantDefinition = vertexProgramParameters->_findNamedConstantDefinition(paramName);
777 vertexProgramParameters->setNamedConstant((paramName, Ogre::StringConverter::parseVector2(value));
780 vertexProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector3(value));
783 vertexProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector4(value));
790 vertexProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector2(value));
793 vertexProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector3(value));
796 vertexProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector4(value));
812 Ogre::GpuProgramParametersSharedPtr fragmentProgramParameters = ogrePass->getFragmentProgramParameters();
831void SPass::SetFragmentProgramAutoParameter(const std::string& paramName, const Ogre::GpuProgramParameters::AutoConstantType& paramType, const size_t& paramExtraInfos)
835 Ogre::GpuProgramParametersSharedPtr fragmentProgramParameters = ogrePass->getFragmentProgramParameters();
845 Ogre::GpuProgramParametersSharedPtr fragmentProgramParameters = ogrePass->getFragmentProgramParameters();
846 const Ogre::GpuConstantDefinition* constantDefinition = fragmentProgramParameters->_findNamedConstantDefinition(paramName);
857 fragmentProgramParameters->setNamedConstant((paramName, Ogre::StringConverter::parseVector2(value));
860 fragmentProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector3(value));
863 fragmentProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector4(value));
867 fragmentProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseReal(value));
870 fragmentProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector2(value));
873 fragmentProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector3(value));
876 fragmentProgramParameters->setNamedConstant(paramName, Ogre::StringConverter::parseVector4(value));
888 return static_cast<SPass::SceneBlendFactor>(static_cast<int>(ogrePass->getSourceBlendFactor()));
898 return static_cast<SPass::SceneBlendFactor>(static_cast<int>(ogrePass->getSourceBlendFactorAlpha()));
903 return static_cast<SPass::SceneBlendFactor>(static_cast<int>(ogrePass->getDestBlendFactorAlpha()));
906void SPass::SetSceneBlending(const SPass::SceneBlendFactor sourceFactor, const SPass::SceneBlendFactor destFactor)
914void SPass::SetSceneBlending(const SPass::SceneBlendFactor sourceFactor, const SPass::SceneBlendFactor destFactor, const SPass::SceneBlendFactor sourceFactorAlpha, const SPass::SceneBlendFactor destFactorAlpha)
916 ogrePass->setSeparateSceneBlending(static_cast<Ogre::SceneBlendFactor>(static_cast<int>(sourceFactor)),
926 return static_cast<SPass::SceneBlendOperation>(static_cast<int>(ogrePass->getSceneBlendingOperation()));
931 return static_cast<SPass::SceneBlendOperation>(static_cast<int>(ogrePass->getSceneBlendingOperationAlpha()));
934void SPass::SetSceneBlendingOperation(SPass::SceneBlendOperation op, SPass::SceneBlendOperation alphaOp)
936 ogrePass->setSeparateSceneBlendingOperation(static_cast<Ogre::SceneBlendOperation>(static_cast<int>(op)),
979void SPass::SetAlphaRejection(CompareFunction func, unsigned char value, bool alphaToCoverageEnabled)
981 ogrePass->setAlphaRejectSettings(static_cast<Ogre::CompareFunction>(static_cast<int>(func)), value, alphaToCoverageEnabled);
988 return static_cast<SPass::CompareFunction>(static_cast<int>(ogrePass->getAlphaRejectFunction()));
1092 pTex->setColourOperationEx(Ogre::LBX_BLEND_MANUAL, Ogre::LBS_TEXTURE, Ogre::LBS_CURRENT, Ogre::ColourValue::Black, Ogre::ColourValue::White, factor);
1095 Ogre::RTShader::ShaderGenerator* shaderGen = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
1096 Ogre::RTShader::RenderState* rs = shaderGen->getRenderState(Ogre::MSN_SHADERGEN, *(parentTechnique->GetOgreTechniquePointer()->getParent()), ogrePass->getIndex());
1100 Ogre::RTShader::SubRenderState* srs = rs->getSubRenderState(Ogre::RTShader::SRS_IMAGE_BASED_LIGHTING);
1334 parentTechnique->GetParentMaterial()->GetScene()->GetShadowManager()->UpdateShadowMaterial(parentTechnique->GetOgreTechniquePointer());
1339 SRoot::getSingletonPtr()->InvalidateGeneratedMaterial(parentTechnique->GetParentMaterial()->getOgreMaterialPointer().get());
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
static Ogre::ColourValue ScolToOgreColorRGBA(const int &scolColor)
Definition SO3ConversionTools.cpp:126
static int OgreToScolColorRGBA(const Ogre::ColourValue &ogreColor)
Definition SO3ConversionTools.cpp:115
Definition SO3DataScol.h:41
static void CleanUpGeneratedTechniques(Ogre::Material *mat)
Definition SO3Material.cpp:368
Ogre::MaterialPtr getOgreMaterialPointer()
Definition SO3Material.cpp:157
void SetTextureRotateAnimation(const unsigned int &textureUnit, const float &speed)
Definition SO3Pass.cpp:456
void SetVertexProgramParameter(const std::string ¶mName, const std::string &value)
Definition SO3Pass.cpp:761
void SetTextureRotate(const unsigned int &textureUnit, const float &radianAngle)
Definition SO3Pass.cpp:423
void SetTextureScrollAnimation(const unsigned int &textureUnit, const float &uSpeed, const float &vSpeed)
Definition SO3Pass.cpp:445
void RemoveTexture(const unsigned int &textureUnit)
Definition SO3Pass.cpp:1119
std::string GetTextureUnitNameByType(SShaderGenerator::ShaderMapType type)
Definition SO3Pass.cpp:1280
void SetTextureUnitColorBlendModeFactor(const unsigned int &textureUnit, float factor)
Definition SO3Pass.cpp:1084
void SetSelfIlluminationColor(const int &color)
Definition SO3Pass.cpp:536
void SetTextureVScroll(const unsigned int &textureUnit, const float &value)
Definition SO3Pass.cpp:357
std::string GetTextureName(const unsigned int &textureUnit)
Definition SO3Pass.cpp:305
const float GetTextureRotate(const unsigned int &textureUnit)
Definition SO3Pass.cpp:434
void SetVertexProgramAutoParameter(const std::string ¶mName, const Ogre::GpuProgramParameters::AutoConstantType ¶mType, const size_t ¶mExtraInfos)
Definition SO3Pass.cpp:751
float GetTextureUnitColorBlendModeFactor(const unsigned int &textureUnit)
Definition SO3Pass.cpp:1111
void SetSceneBlendingOperation(SceneBlendOperation op, SceneBlendOperation alphaOp)
Definition SO3Pass.cpp:934
STexture * GetTexture(const unsigned int &textureUnit)
Definition SO3Pass.cpp:645
int GetTextureUnitIndexByName(const std::string &texname)
Definition SO3Pass.cpp:300
void SetAlphaRejection(CompareFunction func, unsigned char value, bool alphaToCoverageEnabled=false)
Definition SO3Pass.cpp:979
SceneBlendFactor GetSourceBlendFactor() const
Definition SO3Pass.cpp:886
static std::string GetTextureUnitTypedName(Ogre::TextureUnitState *unit)
Definition SO3Pass.cpp:88
void SetTextureUScroll(const unsigned int &textureUnit, const float &value)
Definition SO3Pass.cpp:335
void SetSceneBlending(const SPass::SceneBlendFactor sourceFactor, const SPass::SceneBlendFactor destFactor)
Definition SO3Pass.cpp:906
void SetTextureUScale(const unsigned int &textureUnit, const float &value)
Definition SO3Pass.cpp:379
unsigned char GetAlphaRejectionValue() const
Definition SO3Pass.cpp:991
void SetTextureByType(STexture *tex, SShaderGenerator::ShaderMapType type)
Definition SO3Pass.cpp:1244
float GetTextureUScroll(const unsigned int &textureUnit)
Definition SO3Pass.cpp:346
float GetTextureUScale(const unsigned int &textureUnit)
Definition SO3Pass.cpp:390
int GetTextureUnitByType(SShaderGenerator::ShaderMapType type)
Definition SO3Pass.cpp:661
SceneBlendOperation GetSceneBlendingOperationAlpha() const
Definition SO3Pass.cpp:929
void SetFragmentProgramParameter(const std::string ¶mName, const std::string &value)
Definition SO3Pass.cpp:841
std::string GetTextureFileName(const unsigned int &textureUnit)
Definition SO3Pass.cpp:315
std::string GetTextureUnitName(const unsigned int &textureUnit)
Definition SO3Pass.cpp:287
void SetTextureVScale(const unsigned int &textureUnit, const float &value)
Definition SO3Pass.cpp:401
CompareFunction GetAlphaRejectionFunction() const
Definition SO3Pass.cpp:986
float GetTextureVScale(const unsigned int &textureUnit)
Definition SO3Pass.cpp:412
SceneBlendFactor GetSourceBlendFactorAlpha() const
Definition SO3Pass.cpp:896
void SetFragmentProgramAutoParameter(const std::string ¶mName, const Ogre::GpuProgramParameters::AutoConstantType ¶mType, const size_t ¶mExtraInfos)
Definition SO3Pass.cpp:831
float GetTextureVScroll(const unsigned int &textureUnit)
Definition SO3Pass.cpp:368
SceneBlendFactor GetDestBlendFactorAlpha() const
Definition SO3Pass.cpp:901
SceneBlendOperation GetSceneBlendingOperation() const
Definition SO3Pass.cpp:924
const Ogre::GpuNamedConstants GetFragmentProgramParameters()
Definition SO3Pass.cpp:806
void SetTexture(const unsigned int &textureUnit, STexture *texture, std::string name="")
Definition SO3Pass.cpp:585
const Ogre::GpuNamedConstants GetVertexProgramParameters()
Definition SO3Pass.cpp:726
static SShaderGenerator::ShaderMapType GetTextureUnitType(Ogre::TextureUnitState *unit)
Definition SO3Pass.cpp:115
void InvalidateGeneratedMaterial(Ogre::Material *mat)
Definition SO3Root.cpp:2350
Definition SO3Scene.h:125
STexture * CreateTexture(const std::string &groupname, const std::string &texname, const std::string &path, const int &w=0, const int &h=0)
Definition SO3Scene.cpp:1186
STexture * GetTexture(const std::string &groupName, const std::string &texName)
Definition SO3Scene.cpp:1280
std::string GetShaderName()
Definition SO3ShaderGenerator.cpp:669
virtual void ApplyShader()
Definition SO3ShaderGeneratorUnified.cpp:888
void UpdateShadowMaterial(Ogre::Technique *tech)
Definition SO3ShadowManager.cpp:237
Definition SO3Technique.h:42
Ogre::Technique * GetOgreTechniquePointer()
Definition SO3Technique.cpp:80
Definition SO3Texture.h:42
Ogre::TexturePtr getOgreTexturePointer()
Definition SO3Texture.cpp:157
Definition SO3DataScol.h:38
Generated by 1.9.8