shiny: fix GLSL texture units when shaders were disabled

actorid
scrawl 12 years ago
parent 8ef3edd416
commit 693eeabeca

@ -266,8 +266,6 @@ MapWindow::MapWindow(MWBase::WindowManager& parWindowManager, const std::string&
mGlobalMapRender = new MWRender::GlobalMap(cacheDir); mGlobalMapRender = new MWRender::GlobalMap(cacheDir);
mGlobalMapRender->render(); mGlobalMapRender->render();
mGlobalMapRender->exploreCell(0,0);
getWidget(mLocalMap, "LocalMap"); getWidget(mLocalMap, "LocalMap");
getWidget(mGlobalMap, "GlobalMap"); getWidget(mGlobalMap, "GlobalMap");
getWidget(mGlobalMapImage, "GlobalMapImage"); getWidget(mGlobalMapImage, "GlobalMapImage");

@ -70,3 +70,6 @@ endif()
link_directories(${CMAKE_CURRENT_BINARY_DIR}) link_directories(${CMAKE_CURRENT_BINARY_DIR})
set(SHINY_LIBRARY ${SHINY_LIBRARY} PARENT_SCOPE)
set(SHINY_OGREPLATFORM_LIBRARY ${SHINY_OGREPLATFORM_LIBRARY} PARENT_SCOPE)

@ -72,6 +72,8 @@ namespace sh
allowFixedFunction = retrieveValue<BooleanValue>(getProperty("allow_fixed_function"), NULL).get(); allowFixedFunction = retrieveValue<BooleanValue>(getProperty("allow_fixed_function"), NULL).get();
} }
bool useShaders = mShadersEnabled || !allowFixedFunction;
// get passes of the top-most parent // get passes of the top-most parent
PassVector passes = getPasses(); PassVector passes = getPasses();
if (passes.size() == 0) if (passes.size() == 0)
@ -91,7 +93,7 @@ namespace sh
// create or retrieve shaders // create or retrieve shaders
bool hasVertex = it->hasProperty("vertex_program"); bool hasVertex = it->hasProperty("vertex_program");
bool hasFragment = it->hasProperty("fragment_program"); bool hasFragment = it->hasProperty("fragment_program");
if (mShadersEnabled || !allowFixedFunction) if (useShaders)
{ {
it->setContext(context); it->setContext(context);
it->mShaderProperties.setContext(context); it->mShaderProperties.setContext(context);
@ -144,7 +146,7 @@ namespace sh
bool foundVertex = std::find(usedTextureSamplersVertex.begin(), usedTextureSamplersVertex.end(), texIt->getName()) != usedTextureSamplersVertex.end(); bool foundVertex = std::find(usedTextureSamplersVertex.begin(), usedTextureSamplersVertex.end(), texIt->getName()) != usedTextureSamplersVertex.end();
bool foundFragment = std::find(usedTextureSamplersFragment.begin(), usedTextureSamplersFragment.end(), texIt->getName()) != usedTextureSamplersFragment.end(); bool foundFragment = std::find(usedTextureSamplersFragment.begin(), usedTextureSamplersFragment.end(), texIt->getName()) != usedTextureSamplersFragment.end();
if ( (foundVertex || foundFragment) if ( (foundVertex || foundFragment)
|| (((!mShadersEnabled || (!hasVertex || !hasFragment)) && allowFixedFunction) && texIt->hasProperty("create_in_ffp") && retrieveValue<BooleanValue>(texIt->getProperty("create_in_ffp"), this).get())) || (((!useShaders || (!hasVertex || !hasFragment)) && allowFixedFunction) && texIt->hasProperty("create_in_ffp") && retrieveValue<BooleanValue>(texIt->getProperty("create_in_ffp"), this).get()))
{ {
boost::shared_ptr<TextureUnitState> texUnit = pass->createTextureUnitState (); boost::shared_ptr<TextureUnitState> texUnit = pass->createTextureUnitState ();
texIt->copyAll (texUnit.get(), context); texIt->copyAll (texUnit.get(), context);
@ -152,7 +154,7 @@ namespace sh
mTexUnits.push_back(texUnit); mTexUnits.push_back(texUnit);
// set texture unit indices (required by GLSL) // set texture unit indices (required by GLSL)
if (mShadersEnabled && ((hasVertex && foundVertex) || (hasFragment && foundFragment)) && mFactory->getCurrentLanguage () == Language_GLSL) if (useShaders && ((hasVertex && foundVertex) || (hasFragment && foundFragment)) && mFactory->getCurrentLanguage () == Language_GLSL)
{ {
pass->setTextureUnitIndex (foundVertex ? GPT_Vertex : GPT_Fragment, texIt->getName(), i); pass->setTextureUnitIndex (foundVertex ? GPT_Vertex : GPT_Fragment, texIt->getName(), i);

Loading…
Cancel
Save