1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-26 02:38:04 +00:00

Add some comments

This commit is contained in:
scrawl 2015-04-21 20:42:50 +02:00
parent 10644544ab
commit 102eadf91c
2 changed files with 13 additions and 5 deletions

View File

@ -10,6 +10,9 @@ namespace SceneUtil
class Skeleton; class Skeleton;
class Bone; class Bone;
/// @brief Mesh skinning implementation.
/// @note A RigGeometry may be attached directly to a Skeleton, or somewhere below a Skeleton.
/// Note though that the RigGeometry ignores any transforms below the Skeleton, so the attachment point is not that important.
class RigGeometry : public osg::Geometry class RigGeometry : public osg::Geometry
{ {
public: public:
@ -25,7 +28,6 @@ namespace SceneUtil
std::map<short, float> mWeights; std::map<short, float> mWeights;
}; };
struct InfluenceMap : public osg::Referenced struct InfluenceMap : public osg::Referenced
{ {
std::map<std::string, BoneInfluence> mMap; std::map<std::string, BoneInfluence> mMap;

View File

@ -8,8 +8,8 @@
namespace SceneUtil namespace SceneUtil
{ {
// Defines a Bone hierarchy, used for updating of skeleton-space bone matrices. /// @brief Defines a Bone hierarchy, used for updating of skeleton-space bone matrices.
// To prevent unnecessary updates, only bones that are used for skinning will be added to this hierarchy. /// @note To prevent unnecessary updates, only bones that are used for skinning will be added to this hierarchy.
class Bone class Bone
{ {
public: public:
@ -22,6 +22,7 @@ namespace SceneUtil
std::vector<Bone*> mChildren; std::vector<Bone*> mChildren;
/// Update the skeleton-space matrix of this bone and all its children.
void update(const osg::Matrixf* parentMatrixInSkeletonSpace); void update(const osg::Matrixf* parentMatrixInSkeletonSpace);
private: private:
@ -29,16 +30,21 @@ namespace SceneUtil
void operator=(const Bone&); void operator=(const Bone&);
}; };
/// @brief Handles the bone matrices for any number of child RigGeometries.
/// @par Bones should be created as osg::MatrixTransform children of the skeleton.
/// To be a referenced by a RigGeometry, a bone needs to have a unique name.
class Skeleton : public osg::Group class Skeleton : public osg::Group
{ {
public: public:
Skeleton(); Skeleton();
Skeleton(const Skeleton& copy, const osg::CopyOp& copyop); Skeleton(const Skeleton& copy, const osg::CopyOp& copyop);
Bone* getBone(const std::string& name);
META_Node(NifOsg, Skeleton) META_Node(NifOsg, Skeleton)
/// Retrieve a bone by name.
Bone* getBone(const std::string& name);
/// Request an update of bone matrices. May be a no-op if already updated in this frame.
void updateBoneMatrices(osg::NodeVisitor* nv); void updateBoneMatrices(osg::NodeVisitor* nv);
private: private: