revert s/VertexIndexWeight/IndexWeight/

This commit is contained in:
Julien Valentin
2017-08-31 13:30:24 +02:00
parent 0926bb783d
commit 068a032dac
8 changed files with 22 additions and 26 deletions

View File

@@ -65,7 +65,7 @@ void RigTransformHardware::computeMatrixPaletteUniform(const osg::Matrix& transf
}
void createVertexAttribList(RigTransformHardware& rig,const std::vector<std::vector<IndexWeight> > &perVertexInfluences,RigTransformHardware::BoneWeightAttribList & boneWeightAttribArrays);
void createVertexAttribList(RigTransformHardware& rig,const std::vector<std::vector<VertexIndexWeight> > &perVertexInfluences,RigTransformHardware::BoneWeightAttribList & boneWeightAttribArrays);
//
// create vertex attribute by 2 bones
@@ -76,7 +76,7 @@ void createVertexAttribList(RigTransformHardware& rig,const std::vector<std::ve
// than the 4 bones using two vertex attributes
//
typedef std::vector<std::vector<IndexWeight> > PerVertexInfList;
typedef std::vector<std::vector<VertexIndexWeight> > PerVertexInfList;
void createVertexAttribList(RigTransformHardware& rig,
const PerVertexInfList & perVertexInfluences,
RigTransformHardware::BoneWeightAttribList& boneWeightAttribArrays)
@@ -172,7 +172,7 @@ bool RigTransformHardware::buildPalette(const BoneMap&boneMap ,const RigGeometry
BoneNamePaletteIndex::iterator boneName2PaletteIndex;
// init temp vertex attribute data
std::vector<std::vector<IndexWeight> > perVertexInfluences;
std::vector<IndexWeightList > perVertexInfluences;
perVertexInfluences.resize(_nbVertexes);
unsigned int paletteindex;
@@ -203,14 +203,14 @@ bool RigTransformHardware::buildPalette(const BoneMap&boneMap ,const RigGeometry
}
for(IndexWeightList::const_iterator infit = boneinflist.begin(); infit!=boneinflist.end(); ++infit)
{
const IndexWeight& iw = *infit;
const VertexIndexWeight& iw = *infit;
const unsigned int &index = iw.getIndex();
const float &weight = iw.getWeight();
IndexWeightList & iwlist=perVertexInfluences[index];
if(fabs(weight) > 1e-4) // don't use bone with weight too small
{
iwlist.push_back(IndexWeight(paletteindex,weight));
iwlist.push_back(VertexIndexWeight(paletteindex,weight));
}
else
{

View File

@@ -67,7 +67,7 @@ void RigTransformSoftware::buildMinimumUpdateSet( const BoneMap&boneMap, const R
Bone* bone = bmit->second.get();
for(IndexWeightList::const_iterator infit=inflist.begin(); infit!=inflist.end(); ++infit)
{
const IndexWeight &iw = *infit;
const VertexIndexWeight &iw = *infit;
const unsigned int &index = iw.getIndex();
float weight = iw.getWeight();

View File

@@ -38,7 +38,7 @@ void VertexInfluenceMap::normalize(unsigned int numvert) {
for(VertexInfluenceMap::iterator mapit=this->begin(); mapit!=this->end(); ++mapit) {
IndexWeightList &curvecinf=mapit->second;
for(IndexWeightList::iterator curinf=curvecinf.begin(); curinf!=curvecinf.end(); ++curinf) {
IndexWeight& inf=*curinf;
VertexIndexWeight& inf=*curinf;
localstore[inf.first].first+=inf.second;
localstore[inf.first].second.push_back(&inf.second);
@@ -70,7 +70,7 @@ void VertexInfluenceMap::cullInfluenceCountPerVertex(unsigned int numbonepervert
const std::string& bonename=mapit->first;
IndexWeightList &curvecinf=mapit->second;
for(IndexWeightList::iterator curinf=curvecinf.begin(); curinf!=curvecinf.end(); ++curinf) {
IndexWeight& inf=*curinf;
VertexIndexWeight& inf=*curinf;
if( bonename.empty()) {
OSG_WARN << "VertexInfluenceSet::buildVertex2BoneList warning vertex " << inf.first << " is not assigned to a bone" << std::endl;
}
@@ -90,14 +90,14 @@ void VertexInfluenceMap::cullInfluenceCountPerVertex(unsigned int numbonepervert
sum=1.0f/sum;
for(BoneWeightOrdered::iterator bwit=bwset.begin(); bwit!=bwset.end(); ++bwit) {
VertexInfluence & inf= (*this)[bwit->getBoneName()];
inf.push_back(IndexWeight(mapit->first, bwit->getWeight()*sum));
inf.push_back(VertexIndexWeight(mapit->first, bwit->getWeight()*sum));
inf.setName(bwit->getBoneName());
}
}
}else{
for(BoneWeightOrdered::iterator bwit=bwset.begin(); bwit!=bwset.end(); ++bwit) {
VertexInfluence & inf= (*this)[bwit->getBoneName()];
inf.push_back(IndexWeight(mapit->first,bwit->getWeight()));
inf.push_back(VertexIndexWeight(mapit->first,bwit->getWeight()));
inf.setName(bwit->getBoneName());
}
@@ -114,14 +114,13 @@ void VertexInfluenceMap::computePerVertexInfluenceList(std::vector<BoneWeightLis
{
const IndexWeightList& inflist = it->second;
if (it->first.empty()) {
OSG_WARN << "RigTransformSoftware::VertexInfluenceMap contains unamed bone IndexWeightList" << std::endl;
OSG_WARN << "VertexInfluenceMap::computePerVertexInfluenceList contains unamed bone IndexWeightList" << std::endl;
}
for(IndexWeightList::const_iterator infit=inflist.begin(); infit!=inflist.end(); ++infit)
{
const IndexWeight &iw = *infit;
const VertexIndexWeight &iw = *infit;
const unsigned int &index = iw.getIndex();
float weight = iw.getWeight();
vertex2Bones[index].push_back(BoneWeight(it->first, weight));;
}
}
@@ -173,12 +172,9 @@ void VertexInfluenceMap::computeMinimalVertexGroupList(std::vector<VertexGroup>&
unsigned int vertexID=0;
for (std::vector<BoneWeightList>::iterator it = vertex2Bones.begin(); it != vertex2Bones.end(); ++it,++vertexID)
{
BoneWeightList &boneweightlist = *it;//->second;
//int vertexIndex = it->first;
BoneWeightList &boneweightlist = *it;
// sort the vector to have a consistent key
std::sort(boneweightlist.begin(), boneweightlist.end(), SortByNameAndWeight());
// we use the vector<BoneWeight> as key to differentiate group
UnifyBoneGroup::iterator result = unifyBuffer.find(boneweightlist);
if (result == unifyBuffer.end())

View File

@@ -827,7 +827,7 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr)
fr += 2;
iteratorAdvanced = true;
}
vi.push_back(osgAnimation::IndexWeight(index, weight));
vi.push_back(osgAnimation::VertexIndexWeight(index, weight));
}
if (fr.matchSequence("}"))
{

View File

@@ -27,7 +27,7 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry&
int index = 0;
float weight = 0.0f;
is >> index >> weight;
vi.push_back( osgAnimation::IndexWeight(index, weight) );
vi.push_back( osgAnimation::VertexIndexWeight(index, weight) );
}
(*map)[bonename] = vi;
is >> is.END_BRACKET;