Changeset 9737
- Timestamp:
- 02/09/09 23:56:21 (4 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 5 modified
-
examples/osganimationskinning/osganimationskinning.cpp (modified) (1 diff)
-
include/osgAnimation/RigGeometry (modified) (3 diffs)
-
include/osgAnimation/Timeline (modified) (2 diffs)
-
src/osgWrappers/osgAnimation/RigGeometry.cpp (modified) (6 diffs)
-
src/osgWrappers/osgAnimation/Timeline.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osganimationskinning/osganimationskinning.cpp
r9531 r9737 253 253 initVertexMap(root.get(), right0.get(), right1.get(), geom, src.get()); 254 254 255 geom->buildVertexSet();256 geom->buildTransformer(skelroot.get());257 258 255 // let's run ! 259 256 viewer.setSceneData( scene ); -
OpenSceneGraph/trunk/include/osgAnimation/RigGeometry
r9377 r9737 28 28 public: 29 29 30 RigGeometry(); 31 RigGeometry(const osg::Geometry& b); 32 RigGeometry(const RigGeometry& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); 33 34 META_Object(osgAnimation, RigGeometry); 35 36 void setInfluenceMap(osgAnimation::VertexInfluenceMap* vertexInfluenceMap) { _vertexInfluenceMap = vertexInfluenceMap; } 37 const osgAnimation::VertexInfluenceMap* getInfluenceMap() const { return _vertexInfluenceMap.get();} 38 osgAnimation::VertexInfluenceMap* getInfluenceMap() { return _vertexInfluenceMap.get();} 39 40 const Skeleton* getSkeleton() const; 41 Skeleton* getSkeleton(); 42 43 void setNeedToComputeMatrix(bool state) { _needToComputeMatrix = state;} 44 bool getNeedToComputeMatrix() const { return _needToComputeMatrix;} 45 46 void buildVertexSet(); 47 void buildTransformer(Skeleton* root); 48 void computeMatrixFromRootSkeleton(); 49 50 virtual void transformSoftwareMethod(); 51 const osgAnimation::VertexInfluenceSet& getVertexInfluenceSet() const { return _vertexInfluenceSet;} 52 53 const std::vector<osg::Vec3>& getPositionSource() const { return _positionSource;} 54 const std::vector<osg::Vec3>& getNormalSource() const { return _normalSource;} 55 56 protected: 57 58 std::vector<osg::Vec3> _positionSource; 59 std::vector<osg::Vec3> _normalSource; 60 61 osgAnimation::VertexInfluenceSet _vertexInfluenceSet; 62 osg::ref_ptr<osgAnimation::VertexInfluenceMap> _vertexInfluenceMap; 63 osgAnimation::TransformVertexFunctor _transformVertexes; 64 65 osg::Matrix _matrixFromSkeletonToGeometry; 66 osg::Matrix _invMatrixFromSkeletonToGeometry; 67 osg::observer_ptr<Skeleton> _root; 68 bool _needToComputeMatrix; 69 70 30 71 struct FindNearestParentSkeleton : public osg::NodeVisitor 31 72 { … … 74 115 * throw a subgraph. 75 116 */ 76 struct BuildVertexTransformerVisitor : public osg::NodeVisitor 117 struct BuildVertexTransformerVisitor : public osg::NodeVisitor 77 118 { 78 119 osg::ref_ptr<Skeleton> _root; … … 95 136 }; 96 137 97 98 RigGeometry(); 99 RigGeometry(const osg::Geometry& b); 100 RigGeometry(const RigGeometry& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); 101 102 virtual osg::Object* cloneType() const { return new RigGeometry(); } 103 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RigGeometry(*this,copyop); } 104 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RigGeometry*>(obj)!=NULL; } 105 virtual const char* libraryName() const { return "osgAnimation"; } 106 virtual const char* className() const { return "RigGeometry"; } 107 108 109 void setInfluenceMap(osgAnimation::VertexInfluenceMap* vertexInfluenceMap) { _vertexInfluenceMap = vertexInfluenceMap; } 110 const osgAnimation::VertexInfluenceMap* getInfluenceMap() const { return _vertexInfluenceMap.get();} 111 osgAnimation::VertexInfluenceMap* getInfluenceMap() { return _vertexInfluenceMap.get();} 112 void buildVertexSet(); 113 void buildTransformer(Skeleton* root); 114 void computeMatrixFromRootSkeleton(); 115 116 void setNeedToComputeMatrix(bool state) { _needToComputeMatrix = state;} 117 bool getNeedToComputeMatrix() const { return _needToComputeMatrix;} 118 119 const Skeleton* getSkeleton() const; 120 Skeleton* getSkeleton(); 121 virtual void transformSoftwareMethod(); 122 const osgAnimation::VertexInfluenceSet& getVertexInfluenceSet() const { return _vertexInfluenceSet;} 123 124 std::vector<osg::Vec3> _positionSource; 125 std::vector<osg::Vec3> _normalSource; 126 127 osgAnimation::VertexInfluenceSet _vertexInfluenceSet; 128 osg::ref_ptr<osgAnimation::VertexInfluenceMap> _vertexInfluenceMap; 129 osgAnimation::TransformVertexFunctor _transformVertexes; 130 131 osg::Matrix _matrixFromSkeletonToGeometry; 132 osg::Matrix _invMatrixFromSkeletonToGeometry; 133 osg::observer_ptr<Skeleton> _root; 134 bool _needToComputeMatrix; 135 136 }; 138 }; 137 139 138 140 } -
OpenSceneGraph/trunk/include/osgAnimation/Timeline
r9458 r9737 28 28 { 29 29 30 class Action : public virtualosg::Object31 { 32 public: 33 34 class Callback : public virtualosg::Object30 class Action : public osg::Object 31 { 32 public: 33 34 class Callback : public osg::Object 35 35 { 36 36 public: … … 163 163 164 164 165 class Timeline : public virtualosg::Object165 class Timeline : public osg::Object 166 166 { 167 167 protected: -
OpenSceneGraph/trunk/src/osgWrappers/osgAnimation/RigGeometry.cpp
r9402 r9737 12 12 13 13 #include <osg/CopyOp> 14 #include <osg/Drawable>15 #include <osg/Geode>16 14 #include <osg/Geometry> 17 #include <osg/NodeVisitor>18 15 #include <osg/Object> 19 #include <osg/ Transform>16 #include <osg/Vec3> 20 17 #include <osgAnimation/RigGeometry> 21 18 #include <osgAnimation/Skeleton> … … 85 82 "", 86 83 ""); 84 I_Method0(const osgAnimation::Skeleton *, getSkeleton, 85 Properties::NON_VIRTUAL, 86 __C5_Skeleton_P1__getSkeleton, 87 "", 88 ""); 89 I_Method0(osgAnimation::Skeleton *, getSkeleton, 90 Properties::NON_VIRTUAL, 91 __Skeleton_P1__getSkeleton, 92 "", 93 ""); 94 I_Method1(void, setNeedToComputeMatrix, IN, bool, state, 95 Properties::NON_VIRTUAL, 96 __void__setNeedToComputeMatrix__bool, 97 "", 98 ""); 99 I_Method0(bool, getNeedToComputeMatrix, 100 Properties::NON_VIRTUAL, 101 __bool__getNeedToComputeMatrix, 102 "", 103 ""); 87 104 I_Method0(void, buildVertexSet, 88 105 Properties::NON_VIRTUAL, … … 100 117 "", 101 118 ""); 102 I_Method1(void, setNeedToComputeMatrix, IN, bool, state,103 Properties::NON_VIRTUAL,104 __void__setNeedToComputeMatrix__bool,105 "",106 "");107 I_Method0(bool, getNeedToComputeMatrix,108 Properties::NON_VIRTUAL,109 __bool__getNeedToComputeMatrix,110 "",111 "");112 I_Method0(const osgAnimation::Skeleton *, getSkeleton,113 Properties::NON_VIRTUAL,114 __C5_Skeleton_P1__getSkeleton,115 "",116 "");117 I_Method0(osgAnimation::Skeleton *, getSkeleton,118 Properties::NON_VIRTUAL,119 __Skeleton_P1__getSkeleton,120 "",121 "");122 119 I_Method0(void, transformSoftwareMethod, 123 120 Properties::VIRTUAL, … … 130 127 "", 131 128 ""); 129 I_Method0(const std::vector< osg::Vec3 > &, getPositionSource, 130 Properties::NON_VIRTUAL, 131 __C5_std_vectorT1_osg_Vec3__R1__getPositionSource, 132 "", 133 ""); 134 I_Method0(const std::vector< osg::Vec3 > &, getNormalSource, 135 Properties::NON_VIRTUAL, 136 __C5_std_vectorT1_osg_Vec3__R1__getNormalSource, 137 "", 138 ""); 132 139 I_SimpleProperty(osgAnimation::VertexInfluenceMap *, InfluenceMap, 133 140 __osgAnimation_VertexInfluenceMap_P1__getInfluenceMap, … … 136 143 __bool__getNeedToComputeMatrix, 137 144 __void__setNeedToComputeMatrix__bool); 145 I_SimpleProperty(const std::vector< osg::Vec3 > &, NormalSource, 146 __C5_std_vectorT1_osg_Vec3__R1__getNormalSource, 147 0); 148 I_SimpleProperty(const std::vector< osg::Vec3 > &, PositionSource, 149 __C5_std_vectorT1_osg_Vec3__R1__getPositionSource, 150 0); 138 151 I_SimpleProperty(osgAnimation::Skeleton *, Skeleton, 139 152 __Skeleton_P1__getSkeleton, … … 142 155 __C5_osgAnimation_VertexInfluenceSet_R1__getVertexInfluenceSet, 143 156 0); 144 I_PublicMemberProperty(std::vector< osg::Vec3 >, _positionSource);145 I_PublicMemberProperty(std::vector< osg::Vec3 >, _normalSource);146 I_PublicMemberProperty(osgAnimation::VertexInfluenceSet, _vertexInfluenceSet);147 I_PublicMemberProperty(osg::ref_ptr< osgAnimation::VertexInfluenceMap >, _vertexInfluenceMap);148 I_PublicMemberProperty(osgAnimation::TransformVertexFunctor, _transformVertexes);149 I_PublicMemberProperty(osg::Matrix, _matrixFromSkeletonToGeometry);150 I_PublicMemberProperty(osg::Matrix, _invMatrixFromSkeletonToGeometry);151 I_PublicMemberProperty(osg::observer_ptr< osgAnimation::Skeleton >, _root);152 I_PublicMemberProperty(bool, _needToComputeMatrix);153 157 END_REFLECTOR 154 158 155 BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry::BuildVertexTransformerVisitor)156 I_DeclaringFile("osgAnimation/RigGeometry");157 I_BaseType(osg::NodeVisitor);158 I_Constructor1(IN, osgAnimation::Skeleton *, root,159 Properties::NON_EXPLICIT,160 ____BuildVertexTransformerVisitor__Skeleton_P1,161 "",162 "");163 I_Method0(const char *, libraryName,164 Properties::VIRTUAL,165 __C5_char_P1__libraryName,166 "return the library name/namespapce of the visitor's. ",167 "Should be defined by derived classes. ");168 I_Method0(const char *, className,169 Properties::VIRTUAL,170 __C5_char_P1__className,171 "return the name of the visitor's class type. ",172 "Should be defined by derived classes. ");173 I_Method1(void, apply, IN, osg::Geode &, node,174 Properties::VIRTUAL,175 __void__apply__osg_Geode_R1,176 "",177 "");178 I_PublicMemberProperty(osg::ref_ptr< osgAnimation::Skeleton >, _root);179 END_REFLECTOR180 181 BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry::FindNearestParentSkeleton)182 I_DeclaringFile("osgAnimation/RigGeometry");183 I_BaseType(osg::NodeVisitor);184 I_Constructor0(____FindNearestParentSkeleton,185 "",186 "");187 I_Method1(void, apply, IN, osg::Transform &, node,188 Properties::VIRTUAL,189 __void__apply__osg_Transform_R1,190 "",191 "");192 I_PublicMemberProperty(osg::ref_ptr< osgAnimation::Skeleton >, _root);193 END_REFLECTOR194 195 BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry::UpdateVertex)196 I_DeclaringFile("osgAnimation/RigGeometry");197 I_BaseType(osg::Drawable::UpdateCallback);198 I_Constructor0(____UpdateVertex,199 "",200 "");201 I_Method2(void, update, IN, osg::NodeVisitor *, x, IN, osg::Drawable *, drw,202 Properties::VIRTUAL,203 __void__update__osg_NodeVisitor_P1__osg_Drawable_P1,204 "do customized update code. ",205 "");206 END_REFLECTOR207 -
OpenSceneGraph/trunk/src/osgWrappers/osgAnimation/Timeline.cpp
r9461 r9737 29 29 BEGIN_OBJECT_REFLECTOR(osgAnimation::Action) 30 30 I_DeclaringFile("osgAnimation/Timeline"); 31 I_ VirtualBaseType(osg::Object);31 I_BaseType(osg::Object); 32 32 I_Method0(osg::Object *, cloneType, 33 33 Properties::VIRTUAL, … … 139 139 BEGIN_OBJECT_REFLECTOR(osgAnimation::Action::Callback) 140 140 I_DeclaringFile("osgAnimation/Timeline"); 141 I_ VirtualBaseType(osg::Object);141 I_BaseType(osg::Object); 142 142 I_Constructor0(____Callback, 143 143 "", … … 323 323 BEGIN_OBJECT_REFLECTOR(osgAnimation::Timeline) 324 324 I_DeclaringFile("osgAnimation/Timeline"); 325 I_ VirtualBaseType(osg::Object);325 I_BaseType(osg::Object); 326 326 I_Method0(osg::Object *, cloneType, 327 327 Properties::VIRTUAL,
