From ca224c81dd9fb238d011efbcdee932b874cc0320 Mon Sep 17 00:00:00 2001 From: Julien Valentin Date: Sun, 27 Aug 2017 02:14:12 +0200 Subject: [PATCH] replace VertexInfluence to BoneInfluenceList and VertexIndexWeight to IndexWeight fix in example --- .../osganimationhardware/osganimationhardware.cpp | 2 +- .../osganimationskinning/osganimationskinning.cpp | 6 +++--- include/osgAnimation/VertexInfluence | 14 +++++++------- src/osgAnimation/VertexInfluence.cpp | 6 +++--- src/osgPlugins/gles/AABBonBoneVisitor.cpp | 2 +- src/osgPlugins/gles/MostInfluencedGeometryByBone | 4 ++-- .../osgAnimation/ReaderWriter.cpp | 8 ++++---- .../serializers/osgAnimation/RigGeometry.cpp | 8 ++++---- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/osganimationhardware/osganimationhardware.cpp b/examples/osganimationhardware/osganimationhardware.cpp index afd56015c..74aacb7ba 100644 --- a/examples/osganimationhardware/osganimationhardware.cpp +++ b/examples/osganimationhardware/osganimationhardware.cpp @@ -145,7 +145,7 @@ struct SetupRigGeometry : public osg::NodeVisitor if (_hardware) { osgAnimation::RigGeometry* rig = dynamic_cast(&geom); if (rig) - rig->setRigTransformImplementation(new MyRigTransformHardware); + rig->setRigTransformImplementation(new osgAnimation::RigTransformHardware); } #if 0 diff --git a/examples/osganimationskinning/osganimationskinning.cpp b/examples/osganimationskinning/osganimationskinning.cpp index 7bfa9b017..bbf4614fb 100644 --- a/examples/osganimationskinning/osganimationskinning.cpp +++ b/examples/osganimationskinning/osganimationskinning.cpp @@ -146,11 +146,11 @@ void initVertexMap(osgAnimation::Bone* b0, float val = (*array)[i][0]; std::cout << val << std::endl; if (val >= -1.0f && val <= 0.0f) - (*vim)[b0->getName()].push_back(osgAnimation::VertexIndexWeight(i,1.0f)); + (*vim)[b0->getName()].push_back(osgAnimation::IndexWeight(i,1.0f)); else if ( val > 0.0f && val <= 1.0f) - (*vim)[b1->getName()].push_back(osgAnimation::VertexIndexWeight(i,1.0f)); + (*vim)[b1->getName()].push_back(osgAnimation::IndexWeight(i,1.0f)); else if ( val > 1.0f) - (*vim)[b2->getName()].push_back(osgAnimation::VertexIndexWeight(i,1.0f)); + (*vim)[b2->getName()].push_back(osgAnimation::IndexWeight(i,1.0f)); } geom->setInfluenceMap(vim); diff --git a/include/osgAnimation/VertexInfluence b/include/osgAnimation/VertexInfluence index 345b25db4..0b777e283 100644 --- a/include/osgAnimation/VertexInfluence +++ b/include/osgAnimation/VertexInfluence @@ -25,9 +25,9 @@ namespace osgAnimation { // first is vertex index, and second the weight, the - typedef std::pair VertexIndexWeight; - typedef std::vector VertexList; - class OSGANIMATION_EXPORT VertexInfluence : public VertexList + typedef std::pair IndexWeight; + typedef std::vector VertexList; + class OSGANIMATION_EXPORT BoneInfluenceList : public VertexList { public: const std::string& getName() const { return _name;} @@ -38,14 +38,14 @@ namespace osgAnimation std::string _name; }; - class VertexInfluenceMap : public std::map , public osg::Object + class VertexInfluenceMap : public std::map , public osg::Object { public: META_Object(osgAnimation, VertexInfluenceMap); VertexInfluenceMap() {} VertexInfluenceMap(const osgAnimation::VertexInfluenceMap& org, const osg::CopyOp& copyop): - std::map(org), + std::map(org), osg::Object(org, copyop) {} }; @@ -56,7 +56,7 @@ namespace osgAnimation class OSGANIMATION_EXPORT VertexInfluenceSet { public: - typedef std::vector BoneToVertexList; + typedef std::vector BoneToVertexList; class BoneWeight { @@ -95,7 +95,7 @@ namespace osgAnimation void buildUniqVertexGroupList(); /** return a list of unique VertexGroups and their influences**/ const UniqVertexGroupList& getUniqVertexGroupList() const { return _uniqVertexSetToBoneSet;} - void addVertexInfluence(const VertexInfluence& v); + void addVertexInfluence(const BoneInfluenceList& v); void buildVertex2BoneList(unsigned int numvertices); void clear(); diff --git a/src/osgAnimation/VertexInfluence.cpp b/src/osgAnimation/VertexInfluence.cpp index f5a983234..b1b10fa26 100644 --- a/src/osgAnimation/VertexInfluence.cpp +++ b/src/osgAnimation/VertexInfluence.cpp @@ -20,7 +20,7 @@ using namespace osgAnimation; -void VertexInfluenceSet::addVertexInfluence(const VertexInfluence& v) { _bone2Vertexes.push_back(v); } +void VertexInfluenceSet::addVertexInfluence(const BoneInfluenceList& v) { _bone2Vertexes.push_back(v); } const VertexInfluenceSet::VertIDToBoneWeightList& VertexInfluenceSet::getVertexToBoneList() const { return _vertex2Bones;} // this class manage VertexInfluence database by mesh // reference bones per vertex ... @@ -33,11 +33,11 @@ void VertexInfluenceSet::buildVertex2BoneList(unsigned int numvertices) for (BoneToVertexList::const_iterator it = _bone2Vertexes.begin(); it != _bone2Vertexes.end(); ++it) { - const VertexInfluence& vi = (*it); + const BoneInfluenceList& vi = (*it); int size = vi.size(); for (int i = 0; i < size; i++) { - VertexIndexWeight viw = vi[i]; + IndexWeight viw = vi[i]; int index = viw.first; float weight = viw.second; if (vi.getName().empty()){ diff --git a/src/osgPlugins/gles/AABBonBoneVisitor.cpp b/src/osgPlugins/gles/AABBonBoneVisitor.cpp index 0ea5302f7..5b3fc99dd 100644 --- a/src/osgPlugins/gles/AABBonBoneVisitor.cpp +++ b/src/osgPlugins/gles/AABBonBoneVisitor.cpp @@ -51,7 +51,7 @@ void ComputeAABBOnBoneVisitor::computeBoundingBoxOnBones() { osg::Vec3Array *vertices = dynamic_cast(rigGeometry->getVertexArray()); if(!vertices) continue; - osgAnimation::VertexInfluence vxtInf = (*itMap).second; + osgAnimation::BoneInfluenceList vxtInf = (*itMap).second; //Expand the boundingBox with each vertex for(unsigned int j = 0; j < vxtInf.size(); j++) { diff --git a/src/osgPlugins/gles/MostInfluencedGeometryByBone b/src/osgPlugins/gles/MostInfluencedGeometryByBone index 024d87ddb..a5e8c5e97 100644 --- a/src/osgPlugins/gles/MostInfluencedGeometryByBone +++ b/src/osgPlugins/gles/MostInfluencedGeometryByBone @@ -200,9 +200,9 @@ protected: BoneNameBoneMap::iterator bone_it = boneMap.find(vertexInfluencePair->first); if(bone_it == boneMap.end()) continue; osg::ref_ptr bone = bone_it->second; - const osgAnimation::VertexInfluence& vertexInfluence = (*vertexInfluencePair).second; + const osgAnimation::BoneInfluenceList& vertexInfluence = (*vertexInfluencePair).second; - for(osgAnimation::VertexInfluence::const_iterator vertexIndexWeight = vertexInfluence.begin(); vertexIndexWeight != vertexInfluence.end(); ++vertexIndexWeight) { + for(osgAnimation::BoneInfluenceList::const_iterator vertexIndexWeight = vertexInfluence.begin(); vertexIndexWeight != vertexInfluence.end(); ++vertexIndexWeight) { rigGeometryInfluenceByBoneMap[bone.get()][*rigGeometry].addWeight((*vertexIndexWeight).second); } } diff --git a/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp index add7f50fd..78824ad7c 100644 --- a/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp @@ -813,7 +813,7 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr) iteratorAdvanced = true; } - osgAnimation::VertexInfluence vi; + osgAnimation::BoneInfluenceList vi; vi.setName(name); vi.reserve(nbVertexes); for (int j = 0; j < nbVertexes; j++) @@ -827,7 +827,7 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr) fr += 2; iteratorAdvanced = true; } - vi.push_back(osgAnimation::VertexIndexWeight(index, weight)); + vi.push_back(osgAnimation::IndexWeight(index, weight)); } if (fr.matchSequence("}")) { @@ -863,8 +863,8 @@ bool RigGeometry_writeLocalData(const Object& obj, Output& fw) name = "Empty"; fw.indent() << "osgAnimation::VertexInfluence \"" << name << "\" " << it->second.size() << " {" << std::endl; fw.moveIn(); - const osgAnimation::VertexInfluence& vi = it->second; - for (osgAnimation::VertexInfluence::const_iterator itv = vi.begin(); itv != vi.end(); itv++) + const osgAnimation::BoneInfluenceList& vi = it->second; + for (osgAnimation::BoneInfluenceList::const_iterator itv = vi.begin(); itv != vi.end(); itv++) { fw.indent() << itv->first << " " << itv->second << std::endl; } diff --git a/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp b/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp index 7c25e0376..5259d1e95 100644 --- a/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp +++ b/src/osgWrappers/serializers/osgAnimation/RigGeometry.cpp @@ -20,7 +20,7 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& is.readWrappedString(name); viSize = is.readSize(); is >> is.BEGIN_BRACKET; - osgAnimation::VertexInfluence vi; + osgAnimation::BoneInfluenceList vi; vi.setName( name ); vi.reserve( viSize ); for ( unsigned int j=0; j> index >> weight; - vi.push_back( osgAnimation::VertexIndexWeight(index, weight) ); + vi.push_back( osgAnimation::IndexWeight(index, weight) ); } (*map)[name] = vi; is >> is.END_BRACKET; @@ -47,14 +47,14 @@ static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigG itr!=map->end(); ++itr ) { std::string name = itr->first; - const osgAnimation::VertexInfluence& vi = itr->second; + const osgAnimation::BoneInfluenceList& vi = itr->second; if ( name.empty() ) name = "Empty"; os << os.PROPERTY("VertexInfluence"); os.writeWrappedString(name); os.writeSize(vi.size()) ; os << os.BEGIN_BRACKET << std::endl; - for ( osgAnimation::VertexInfluence::const_iterator vitr=vi.begin(); + for ( osgAnimation::BoneInfluenceList::const_iterator vitr=vi.begin(); vitr != vi.end(); ++vitr ) { os << vitr->first << vitr->second << std::endl;