Skip to content

Commit

Permalink
Samples: get shadergenerator from singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Jan 31, 2025
1 parent 1ded2ef commit 84b4bea
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
13 changes: 4 additions & 9 deletions Samples/Common/include/Sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ namespace OgreBites
}
};

#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
Sample() : mShaderGenerator(0)
#else
Sample()
#endif
{
#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
#endif

mRoot = Ogre::Root::getSingletonPtr();
mWindow = 0;
mSceneMgr = 0;
Expand Down Expand Up @@ -283,11 +283,6 @@ namespace OgreBites
bool mContentSetup; // whether or not scene was created
#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
Ogre::RTShader::ShaderGenerator* mShaderGenerator; // The Shader generator instance.
public:
void setShaderGenerator(Ogre::RTShader::ShaderGenerator* shaderGenerator)
{
mShaderGenerator = shaderGenerator;
}
#endif
private:
// VisualTest fields
Expand Down
3 changes: 0 additions & 3 deletions Samples/Common/include/SampleContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ namespace OgreBites

// test system capabilities against sample requirements
s->testCapabilities(mRoot->getRenderSystem()->getCapabilities());
#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
s->setShaderGenerator(mShaderGenerator);
#endif
s->_setup(this); // start new sample
}

Expand Down
1 change: 0 additions & 1 deletion Samples/Emscripten/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,5 @@ void Context::setup() {
addInputListener(this);

mCurrentSample = new Sample_Character();
mCurrentSample->setShaderGenerator(mShaderGenerator);
mCurrentSample->_setup(this);
}

0 comments on commit 84b4bea

Please sign in to comment.