Added support for osg_FrameNumber, osg_FrameTime, osg_ViewMatrix, osg_InverseViewMatrix

into SceneView, controlled via a setActiveUniforms(.) method.
This commit is contained in:
Robert Osfield
2005-05-05 12:30:54 +00:00
parent c4e2e85aa1
commit 2798d58a41
6 changed files with 88 additions and 8 deletions

View File

@@ -923,6 +923,25 @@ Uniform* StateSet::getUniform(const std::string& name)
else return 0;
}
Uniform* StateSet::getOrCreateUniform(const std::string& name, Uniform::Type type)
{
// for look for an appropriate uniform.
UniformList::iterator itr = _uniformList.find(name);
if (itr!=_uniformList.end() &&
itr->second.first->getType()==type)
{
return itr->second.first.get();
}
// no uniform found matching name so create it..
Uniform* uniform = new Uniform(name,type);
addUniform(uniform);
return uniform;
}
const Uniform* StateSet::getUniform(const std::string& name) const
{
UniformList::const_iterator itr = _uniformList.find(name);