mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 18:45:34 +00:00
4ea6d4aa01
Goals: - get rid of the mesh pre-transform (this requires supporting different bind matrices for each mesh) - bounding box should be relative to the bone the mesh is attached to, ideally we can then get rid of the expensive skeleton-based bounding boxes - update bone matrices in CullCallback instead of UpdateCallback Works OK, though the bounding boxes are not correct yet.
56 lines
1.3 KiB
C++
56 lines
1.3 KiB
C++
#ifndef OPENMW_COMPONENTS_NIFOSG_RIGGEOMETRY_H
|
|
#define OPENMW_COMPONENTS_NIFOSG_RIGGEOMETRY_H
|
|
|
|
#include <osg/Geometry>
|
|
#include <osg/Matrixf>
|
|
|
|
namespace NifOsg
|
|
{
|
|
|
|
class Skeleton;
|
|
class Bone;
|
|
|
|
class RigGeometry : public osg::Geometry
|
|
{
|
|
public:
|
|
RigGeometry();
|
|
RigGeometry(const RigGeometry& copy, const osg::CopyOp& copyop);
|
|
|
|
META_Object(NifOsg, RigGeometry)
|
|
|
|
struct BoneInfluence
|
|
{
|
|
osg::Matrixf mInvBindMatrix;
|
|
// <vertex index, weight>
|
|
std::map<short, float> mWeights;
|
|
};
|
|
|
|
|
|
struct InfluenceMap : public osg::Referenced
|
|
{
|
|
std::map<std::string, BoneInfluence> mMap;
|
|
};
|
|
|
|
void setInfluenceMap(osg::ref_ptr<InfluenceMap> influenceMap);
|
|
|
|
void setSourceGeometry(osg::ref_ptr<osg::Geometry> sourceGeom);
|
|
|
|
// Called automatically by our CullCallback
|
|
void update(osg::NodeVisitor* nv);
|
|
|
|
|
|
private:
|
|
osg::ref_ptr<osg::Geometry> mSourceGeometry;
|
|
osg::ref_ptr<Skeleton> mSkeleton;
|
|
|
|
osg::ref_ptr<InfluenceMap> mInfluenceMap;
|
|
|
|
typedef std::map<Bone*, BoneInfluence> ResolvedInfluenceMap;
|
|
ResolvedInfluenceMap mResolvedInfluenceMap;
|
|
|
|
bool initFromParentSkeleton(osg::NodeVisitor* nv);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|