Move skinning code to SceneUtil

c++11
scrawl 10 years ago
parent 9246a668b9
commit eaa4316ff8

@ -39,7 +39,7 @@ add_component_dir (resource
) )
add_component_dir (sceneutil add_component_dir (sceneutil
clone attach lightmanager visitor util statesetupdater controller clone attach lightmanager visitor util statesetupdater controller skeleton riggeometry
) )
add_component_dir (nif add_component_dir (nif
@ -47,7 +47,7 @@ add_component_dir (nif
) )
add_component_dir (nifosg add_component_dir (nifosg
nifloader controller particle userdata skeleton riggeometry nifloader controller particle userdata
) )
#add_component_dir (nifcache #add_component_dir (nifcache

@ -41,11 +41,11 @@
#include <components/nif/node.hpp> #include <components/nif/node.hpp>
#include <components/sceneutil/util.hpp> #include <components/sceneutil/util.hpp>
#include <components/sceneutil/skeleton.hpp>
#include <components/sceneutil/riggeometry.hpp>
#include "particle.hpp" #include "particle.hpp"
#include "userdata.hpp" #include "userdata.hpp"
#include "skeleton.hpp"
#include "riggeometry.hpp"
namespace namespace
{ {
@ -279,7 +279,7 @@ namespace
for (osg::NodePath::iterator it = path.begin(); it != path.end(); ++it) for (osg::NodePath::iterator it = path.begin(); it != path.end(); ++it)
{ {
if (dynamic_cast<NifOsg::Skeleton*>(*it)) if (dynamic_cast<SceneUtil::Skeleton*>(*it))
{ {
path.erase(path.begin(), it+1); path.erase(path.begin(), it+1);
// the bone's transform in skeleton space // the bone's transform in skeleton space
@ -535,7 +535,7 @@ namespace NifOsg
osg::ref_ptr<TextKeyMapHolder> textkeys (new TextKeyMapHolder); osg::ref_ptr<TextKeyMapHolder> textkeys (new TextKeyMapHolder);
osg::ref_ptr<Skeleton> skel = new Skeleton; osg::ref_ptr<SceneUtil::Skeleton> skel = new SceneUtil::Skeleton;
handleNode(nifNode, skel, textureManager, true, std::map<int, int>(), 0, 0, false, &textkeys->mTextKeys); handleNode(nifNode, skel, textureManager, true, std::map<int, int>(), 0, 0, false, &textkeys->mTextKeys);
skel->getOrCreateUserDataContainer()->addUserObject(textkeys); skel->getOrCreateUserDataContainer()->addUserObject(textkeys);
@ -1168,13 +1168,13 @@ namespace NifOsg
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry); osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry);
triShapeToGeometry(triShape, geometry, geode, boundTextures, animflags); triShapeToGeometry(triShape, geometry, geode, boundTextures, animflags);
osg::ref_ptr<RigGeometry> rig(new RigGeometry); osg::ref_ptr<SceneUtil::RigGeometry> rig(new SceneUtil::RigGeometry);
rig->setSourceGeometry(geometry); rig->setSourceGeometry(geometry);
const Nif::NiSkinInstance *skin = triShape->skin.getPtr(); const Nif::NiSkinInstance *skin = triShape->skin.getPtr();
// Assign bone weights // Assign bone weights
osg::ref_ptr<RigGeometry::InfluenceMap> map (new RigGeometry::InfluenceMap); osg::ref_ptr<SceneUtil::RigGeometry::InfluenceMap> map (new SceneUtil::RigGeometry::InfluenceMap);
const Nif::NiSkinData *data = skin->data.getPtr(); const Nif::NiSkinData *data = skin->data.getPtr();
const Nif::NodeList &bones = skin->bones; const Nif::NodeList &bones = skin->bones;
@ -1182,7 +1182,7 @@ namespace NifOsg
{ {
std::string boneName = bones[i].getPtr()->name; std::string boneName = bones[i].getPtr()->name;
RigGeometry::BoneInfluence influence; SceneUtil::RigGeometry::BoneInfluence influence;
const std::vector<Nif::NiSkinData::VertWeight> &weights = data->bones[i].weights; const std::vector<Nif::NiSkinData::VertWeight> &weights = data->bones[i].weights;
//influence.mWeights.reserve(weights.size()); //influence.mWeights.reserve(weights.size());
for(size_t j = 0;j < weights.size();j++) for(size_t j = 0;j < weights.size();j++)

@ -12,7 +12,7 @@
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/nifosg/skeleton.hpp> #include <components/sceneutil/skeleton.hpp>
#include "visitor.hpp" #include "visitor.hpp"
@ -47,7 +47,7 @@ namespace SceneUtil
osg::ref_ptr<osg::Node> attach(osg::ref_ptr<osg::Node> toAttach, osg::Node *master, const std::string &filter, const std::string &attachNode) osg::ref_ptr<osg::Node> attach(osg::ref_ptr<osg::Node> toAttach, osg::Node *master, const std::string &filter, const std::string &attachNode)
{ {
if (dynamic_cast<NifOsg::Skeleton*>(toAttach.get())) if (dynamic_cast<SceneUtil::Skeleton*>(toAttach.get()))
{ {
osg::ref_ptr<osg::Group> handle = new osg::Group; osg::ref_ptr<osg::Group> handle = new osg::Group;

@ -11,7 +11,7 @@
#include <osg/io_utils> #include <osg/io_utils>
namespace NifOsg namespace SceneUtil
{ {
// TODO: make threadsafe for multiple cull threads // TODO: make threadsafe for multiple cull threads

@ -4,7 +4,7 @@
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/Matrixf> #include <osg/Matrixf>
namespace NifOsg namespace SceneUtil
{ {
class Skeleton; class Skeleton;

@ -5,7 +5,7 @@
#include <iostream> #include <iostream>
namespace NifOsg namespace SceneUtil
{ {
class InitBoneCacheVisitor : public osg::NodeVisitor class InitBoneCacheVisitor : public osg::NodeVisitor

@ -5,7 +5,7 @@
#include <memory> #include <memory>
namespace NifOsg namespace SceneUtil
{ {
// Defines a Bone hierarchy, used for updating of skeleton-space bone matrices. // Defines a Bone hierarchy, used for updating of skeleton-space bone matrices.
Loading…
Cancel
Save