|
|
|
@ -244,12 +244,9 @@ namespace Resource
|
|
|
|
|
|
|
|
|
|
void SceneManager::recreateShaders(osg::ref_ptr<osg::Node> node)
|
|
|
|
|
{
|
|
|
|
|
Shader::ShaderVisitor shaderVisitor(*mShaderManager.get(), *mImageManager, "objects_vertex.glsl", "objects_fragment.glsl");
|
|
|
|
|
shaderVisitor.setForceShaders(mForceShaders);
|
|
|
|
|
shaderVisitor.setClampLighting(mClampLighting);
|
|
|
|
|
shaderVisitor.setForcePerPixelLighting(mForcePerPixelLighting);
|
|
|
|
|
shaderVisitor.setAllowedToModifyStateSets(false);
|
|
|
|
|
node->accept(shaderVisitor);
|
|
|
|
|
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor(createShaderVisitor());
|
|
|
|
|
shaderVisitor->setAllowedToModifyStateSets(false);
|
|
|
|
|
node->accept(*shaderVisitor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SceneManager::setClampLighting(bool clamp)
|
|
|
|
@ -516,16 +513,8 @@ namespace Resource
|
|
|
|
|
SetFilterSettingsControllerVisitor setFilterSettingsControllerVisitor(mMinFilter, mMagFilter, mMaxAnisotropy);
|
|
|
|
|
loaded->accept(setFilterSettingsControllerVisitor);
|
|
|
|
|
|
|
|
|
|
Shader::ShaderVisitor shaderVisitor(*mShaderManager.get(), *mImageManager, "objects_vertex.glsl", "objects_fragment.glsl");
|
|
|
|
|
shaderVisitor.setForceShaders(mForceShaders);
|
|
|
|
|
shaderVisitor.setClampLighting(mClampLighting);
|
|
|
|
|
shaderVisitor.setForcePerPixelLighting(mForcePerPixelLighting);
|
|
|
|
|
shaderVisitor.setAutoUseNormalMaps(mAutoUseNormalMaps);
|
|
|
|
|
shaderVisitor.setNormalMapPattern(mNormalMapPattern);
|
|
|
|
|
shaderVisitor.setNormalHeightMapPattern(mNormalHeightMapPattern);
|
|
|
|
|
shaderVisitor.setAutoUseSpecularMaps(mAutoUseSpecularMaps);
|
|
|
|
|
shaderVisitor.setSpecularMapPattern(mSpecularMapPattern);
|
|
|
|
|
loaded->accept(shaderVisitor);
|
|
|
|
|
osg::ref_ptr<Shader::ShaderVisitor> shaderVisitor (createShaderVisitor());
|
|
|
|
|
loaded->accept(*shaderVisitor);
|
|
|
|
|
|
|
|
|
|
// share state
|
|
|
|
|
// do this before optimizing so the optimizer will be able to combine nodes more aggressively
|
|
|
|
@ -748,4 +737,18 @@ namespace Resource
|
|
|
|
|
stats->setAttribute(frameNumber, "Node Instance", mInstanceCache->getCacheSize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Shader::ShaderVisitor *SceneManager::createShaderVisitor()
|
|
|
|
|
{
|
|
|
|
|
Shader::ShaderVisitor* shaderVisitor = new Shader::ShaderVisitor(*mShaderManager.get(), *mImageManager, "objects_vertex.glsl", "objects_fragment.glsl");
|
|
|
|
|
shaderVisitor->setForceShaders(mForceShaders);
|
|
|
|
|
shaderVisitor->setClampLighting(mClampLighting);
|
|
|
|
|
shaderVisitor->setForcePerPixelLighting(mForcePerPixelLighting);
|
|
|
|
|
shaderVisitor->setAutoUseNormalMaps(mAutoUseNormalMaps);
|
|
|
|
|
shaderVisitor->setNormalMapPattern(mNormalMapPattern);
|
|
|
|
|
shaderVisitor->setNormalHeightMapPattern(mNormalHeightMapPattern);
|
|
|
|
|
shaderVisitor->setAutoUseSpecularMaps(mAutoUseSpecularMaps);
|
|
|
|
|
shaderVisitor->setSpecularMapPattern(mSpecularMapPattern);
|
|
|
|
|
return shaderVisitor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|