mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 13:39:40 +00:00
RigGeometry optimization: optimize geometry optimization
This commit is contained in:
parent
254f01b89d
commit
8e6fd348d1
3 changed files with 6 additions and 11 deletions
|
@ -1092,8 +1092,7 @@ namespace NifOsg
|
|||
const std::vector<Nif::NiSkinData::VertWeight> &weights = data->bones[i].weights;
|
||||
for(size_t j = 0;j < weights.size();j++)
|
||||
{
|
||||
std::pair<unsigned short, float> indexWeight = std::make_pair(weights[j].vertex, weights[j].weight);
|
||||
influence.mWeights.insert(indexWeight);
|
||||
influence.mWeights.emplace_back(weights[j].vertex, weights[j].weight);
|
||||
}
|
||||
influence.mInvBindMatrix = data->bones[i].trafo.toMatrix();
|
||||
influence.mBoundSphere = osg::BoundingSpheref(data->bones[i].boundSphereCenter, data->bones[i].boundSphereRadius);
|
||||
|
|
|
@ -146,18 +146,14 @@ bool RigGeometry::initFromParentSkeleton(osg::NodeVisitor* nv)
|
|||
continue;
|
||||
}
|
||||
|
||||
mBoneSphereVector.emplace_back(bone, influencePair.second.mBoundSphere);
|
||||
|
||||
const BoneInfluence& bi = influencePair.second;
|
||||
mBoneSphereVector.emplace_back(bone, bi.mBoundSphere);
|
||||
|
||||
const std::map<unsigned short, float>& weights = influencePair.second.mWeights;
|
||||
for (std::map<unsigned short, float>::const_iterator weightIt = weights.begin(); weightIt != weights.end(); ++weightIt)
|
||||
for (auto& weightPair: bi.mWeights)
|
||||
{
|
||||
std::vector<BoneWeight>& vec = vertex2BoneMap[weightIt->first];
|
||||
std::vector<BoneWeight>& vec = vertex2BoneMap[weightPair.first];
|
||||
|
||||
BoneWeight b = std::make_pair(std::make_pair(bone, bi.mInvBindMatrix), weightIt->second);
|
||||
|
||||
vec.push_back(b);
|
||||
vec.emplace_back(std::make_pair(bone, bi.mInvBindMatrix), weightPair.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace SceneUtil
|
|||
osg::Matrixf mInvBindMatrix;
|
||||
osg::BoundingSpheref mBoundSphere;
|
||||
// <vertex index, weight>
|
||||
std::map<unsigned short, float> mWeights;
|
||||
std::vector<std::pair<unsigned short, float>> mWeights;
|
||||
};
|
||||
|
||||
struct InfluenceMap : public osg::Referenced
|
||||
|
|
Loading…
Reference in a new issue