- Timestamp:
- 03/21/12 18:36:20 (15 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPresentation/AnimationMaterial.cpp
r12292 r13041 1 /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield 1 /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield 2 2 * 3 * This software is open source and may be redistributed and/or modified under 3 * This software is open source and may be redistributed and/or modified under 4 4 * the terms of the GNU General Public License (GPL) version 2.0. 5 5 * The full license is in LICENSE.txt file included with this distribution,. 6 * 6 * 7 7 * This software is distributed in the hope that it will be useful, 8 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 10 * include LICENSE.txt for more details. 11 11 */ … … 28 28 { 29 29 if (_timeControlPointMap.empty()) return false; 30 30 31 31 switch(_loopMode) 32 32 { … … 36 36 double fraction_part = modulated_time - floor(modulated_time); 37 37 if (fraction_part>0.5) fraction_part = 1.0-fraction_part; 38 38 39 39 time = getFirstTime()+(fraction_part*2.0) * getPeriod(); 40 40 break; … … 51 51 break; 52 52 } 53 54 53 54 55 55 56 56 TimeControlPointMap::const_iterator second = _timeControlPointMap.lower_bound(time); … … 62 62 { 63 63 TimeControlPointMap::const_iterator first = second; 64 --first; 65 64 --first; 65 66 66 // we have both a lower bound and the next item. 67 67 … … 74 74 { 75 75 interpolate(material,(time - first->first)/delta_time, *first->second, *second->second); 76 } 76 } 77 77 } 78 78 else // (second==_timeControlPointMap.end()) … … 158 158 void AnimationMaterialCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) 159 159 { 160 if (_animationMaterial.valid() && 161 nv->getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR && 160 if (_animationMaterial.valid() && 161 nv->getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR && 162 162 nv->getFrameStamp()) 163 163 { … … 174 174 } 175 175 update(*node); 176 177 } 178 } 179 176 177 } 178 } 179 180 180 // must call any nested node callbacks and continue subgraph traversal. 181 181 NodeCallback::traverse(node,nv); … … 221 221 return; 222 222 } 223 223 224 224 _pause = pause; 225 225 226 226 if (_firstTime==DBL_MAX) return; 227 227 228 228 if (_pause) 229 229 {
