Changeset 13041 for OpenSceneGraph/trunk/src/osgManipulator/AntiSquish.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgManipulator/AntiSquish.cpp
r12076 r13041 24 24 AntiSquishCallback(AntiSquish* asq) : osg::NodeCallback(), _antiSquish(asq) {} 25 25 virtual ~AntiSquishCallback() {}; 26 26 27 27 virtual void operator() (osg::Node* node, osg::NodeVisitor* nv) 28 28 { … … 31 31 32 32 // Remove the last node which is the anti squish node itself. 33 np.pop_back(); 33 np.pop_back(); 34 34 35 35 // Get the accumulated modeling matrix. … … 77 77 _position(pat._position), 78 78 _usePosition(pat._usePosition), 79 _cachedLocalToWorld(pat._cachedLocalToWorld) 79 _cachedLocalToWorld(pat._cachedLocalToWorld) 80 80 { 81 81 } … … 88 88 { 89 89 osg::Vec3d t, s; 90 osg::Quat r, so; 90 osg::Quat r, so; 91 91 92 92 if (LTW == _cachedLocalToWorld && _dirty == false) … … 96 96 } 97 97 98 _cachedLocalToWorld = LTW; 98 _cachedLocalToWorld = LTW; 99 99 100 100 LTW.decompose(t, r, s, so); 101 101 102 102 // Let's take an average of the scale. 103 double av = (s[0] + s[1] + s[2])/3.0; 103 double av = (s[0] + s[1] + s[2])/3.0; 104 104 s[0] = av; s[1] = av; s[2]=av; 105 105 … … 111 111 112 112 osg::Matrix unsquished; 113 113 114 114 // 115 115 // Final Matrix: [-Pivot][SO]^[S][SO][R][T][Pivot][LOCALTOWORLD]^[position] … … 127 127 return osg::Matrix::identity(); 128 128 } 129 129 130 130 //SO^ 131 131 unsquished.postMult(invtmps); … … 181 181 flag = false; 182 182 return osg::Matrix::identity(); 183 } 183 } 184 184 185 185 flag = true; 186 186 _dirty = false; 187 return unsquished; 187 return unsquished; 188 188 } 189 189
