Added getInverse implementation to AnimationPath, and added #if guard
to Optimizer.cpp to all compilation on state optimizer when using VS7.
This commit is contained in:
@@ -46,4 +46,37 @@ bool AnimationPath::getMatrix(double time,Matrix& matrix)
|
||||
|
||||
bool AnimationPath::getInverse(double time,Matrix& matrix)
|
||||
{
|
||||
if (_timeKeyMap.empty()) return false;
|
||||
|
||||
TimeKeyMap::iterator second = _timeKeyMap.lower_bound(time);
|
||||
if (second==_timeKeyMap.begin())
|
||||
{
|
||||
second->second.getInverse(matrix);
|
||||
}
|
||||
else if (second!=_timeKeyMap.end())
|
||||
{
|
||||
TimeKeyMap::iterator first = second;
|
||||
--first;
|
||||
|
||||
// we have both a lower bound and the next item.
|
||||
|
||||
// deta_time = second.time - first.time
|
||||
double delta_time = second->first - first->first;
|
||||
|
||||
if (delta_time==0.0)
|
||||
first->second.getInverse(matrix);
|
||||
else
|
||||
{
|
||||
Key key;
|
||||
key.interpolate((time - first->first)/delta_time,
|
||||
first->second,
|
||||
second->second);
|
||||
key.getInverse(matrix);
|
||||
}
|
||||
}
|
||||
else // (second==_timeKeyMap.end())
|
||||
{
|
||||
_timeKeyMap.rbegin().base()->second.getInverse(matrix);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@ void Optimizer::optimize(osg::Node* node, unsigned int options)
|
||||
|
||||
if (options & SHARE_DUPLICATE_STATE)
|
||||
{
|
||||
#if !defined(WIN32) || defined(_STLPORT_VERSION)
|
||||
#if (defined(_MSC_VER) && _MSC_VER<13 && !defined(_STLPORT_VERSION))
|
||||
osg::notify(osg::INFO)<<"Warning: VisualStudio 6.0 build, unable to run state optimizer"<<std::endl;
|
||||
#else
|
||||
StateVisitor osv;
|
||||
node->accept(osv);
|
||||
osv.optimize();
|
||||
|
||||
Reference in New Issue
Block a user