Updated TODO list.

Converted AnimationPath so it is now subclassed from osg::Transform::ComputeTransfromCallback()
so that it can be directly attached to the scene to move objects about.

Changed the osg::SateSet::setGlobalDefaults() so that is sets GL_DEPTH_TEST
to ON.

Added guards and creation of default helper classes in osgGLUT::Viewer and
osgUtil::SceneView so that sensible defaults are used when no settings
are used of osg::State/StateSet,osgUtil::RenderStage/RenderGraph/CullVisitor.
This commit is contained in:
Robert Osfield
2002-04-21 22:05:26 +00:00
parent a0cb66ed78
commit 9574ce97d2
7 changed files with 131 additions and 51 deletions

View File

@@ -1,4 +1,5 @@
#include <osg/AnimationPath>
#include <osg/NodeVisitor>
using namespace osg;
@@ -7,18 +8,18 @@ void AnimationPath::insert(double time,const Key& key)
_timeKeyMap[time] = key;
}
bool AnimationPath::getMatrix(double time,Matrix& matrix)
bool AnimationPath::getMatrix(double time,Matrix& matrix) const
{
if (_timeKeyMap.empty()) return false;
TimeKeyMap::iterator second = _timeKeyMap.lower_bound(time);
TimeKeyMap::const_iterator second = _timeKeyMap.lower_bound(time);
if (second==_timeKeyMap.begin())
{
second->second.getMatrix(matrix);
}
else if (second!=_timeKeyMap.end())
{
TimeKeyMap::iterator first = second;
TimeKeyMap::const_iterator first = second;
--first;
// we have both a lower bound and the next item.
@@ -44,18 +45,18 @@ bool AnimationPath::getMatrix(double time,Matrix& matrix)
return true;
}
bool AnimationPath::getInverse(double time,Matrix& matrix)
bool AnimationPath::getInverse(double time,Matrix& matrix) const
{
if (_timeKeyMap.empty()) return false;
TimeKeyMap::iterator second = _timeKeyMap.lower_bound(time);
TimeKeyMap::const_iterator second = _timeKeyMap.lower_bound(time);
if (second==_timeKeyMap.begin())
{
second->second.getInverse(matrix);
}
else if (second!=_timeKeyMap.end())
{
TimeKeyMap::iterator first = second;
TimeKeyMap::const_iterator first = second;
--first;
// we have both a lower bound and the next item.
@@ -80,3 +81,36 @@ bool AnimationPath::getInverse(double time,Matrix& matrix)
}
return true;
}
const bool AnimationPath::computeLocalToWorldMatrix(Matrix& matrix,const Transform*, NodeVisitor* nv) const
{
if (nv)
{
const osg::FrameStamp* fs = nv->getFrameStamp();
if (fs)
{
osg::Matrix localMatrix;
getMatrix(fs->getReferenceTime(),localMatrix);
matrix.preMult(localMatrix);
return true;
}
}
return false;
}
/** Get the transformation matrix which moves from world coords to local coords.*/
const bool AnimationPath::computeWorldToLocalMatrix(Matrix& matrix,const Transform* , NodeVisitor* nv) const
{
if (nv)
{
const osg::FrameStamp* fs = nv->getFrameStamp();
if (fs)
{
osg::Matrix localInverse;
getInverse(fs->getReferenceTime(),localInverse);
matrix.postMult(localInverse);
return true;
}
}
return false;
}