|
Revision 13041, 1.9 kB
(checked in by robert, 14 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | #include <osg/NodeVisitor> |
|---|
| 16 | #include <osgAnimation/Bone> |
|---|
| 17 | #include <osgAnimation/UpdateBone> |
|---|
| 18 | |
|---|
| 19 | using namespace osgAnimation; |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | UpdateBone::UpdateBone(const std::string& name) : UpdateMatrixTransform(name) |
|---|
| 23 | { |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | UpdateBone::UpdateBone(const UpdateBone& apc,const osg::CopyOp& copyop) : osg::Object(apc,copyop), UpdateMatrixTransform(apc, copyop) |
|---|
| 27 | { |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | void UpdateBone::operator()(osg::Node* node, osg::NodeVisitor* nv) |
|---|
| 32 | { |
|---|
| 33 | if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR) |
|---|
| 34 | { |
|---|
| 35 | Bone* b = dynamic_cast<Bone*>(node); |
|---|
| 36 | if (!b) |
|---|
| 37 | { |
|---|
| 38 | OSG_WARN << "Warning: UpdateBone set on non-Bone object." << std::endl; |
|---|
| 39 | return; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | _transforms.update(); |
|---|
| 44 | const osg::Matrix& matrix = _transforms.getMatrix(); |
|---|
| 45 | b->setMatrix(matrix); |
|---|
| 46 | |
|---|
| 47 | Bone* parent = b->getBoneParent(); |
|---|
| 48 | if (parent) |
|---|
| 49 | b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace() * parent->getMatrixInSkeletonSpace()); |
|---|
| 50 | else |
|---|
| 51 | b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace()); |
|---|
| 52 | } |
|---|
| 53 | traverse(node,nv); |
|---|
| 54 | } |
|---|