fix the whitespaces

pull/3042/head
iamAdrianIusca 2020-04-23 22:33:13 +03:00
parent 798f6cf083
commit f8024188f0
1 changed files with 10 additions and 6 deletions

View File

@ -73,7 +73,7 @@ bool LimitBoneWeightsProcess::IsActive(unsigned int pFlags) const {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void LimitBoneWeightsProcess::Execute(aiScene *pScene) void LimitBoneWeightsProcess::Execute( aiScene *pScene)
{ {
ASSIMP_LOG_DEBUG("LimitBoneWeightsProcess begin"); ASSIMP_LOG_DEBUG("LimitBoneWeightsProcess begin");
@ -93,7 +93,7 @@ void LimitBoneWeightsProcess::SetupProperties(const Importer *pImp) {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Unites identical vertices in the given mesh // Unites identical vertices in the given mesh
void LimitBoneWeightsProcess::ProcessMesh(aiMesh *pMesh) void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
{ {
if (!pMesh->HasBones()) if (!pMesh->HasBones())
return; return;
@ -104,9 +104,11 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh *pMesh)
WeightsPerVertex vertexWeights(pMesh->mNumVertices); WeightsPerVertex vertexWeights(pMesh->mNumVertices);
size_t maxVertexWeights = 0; size_t maxVertexWeights = 0;
for (unsigned int b = 0; b < pMesh->mNumBones; ++b) { for (unsigned int b = 0; b < pMesh->mNumBones; ++b)
{
const aiBone *bone = pMesh->mBones[b]; const aiBone *bone = pMesh->mBones[b];
for (unsigned int w = 0; w < bone->mNumWeights; ++w) { for (unsigned int w = 0; w < bone->mNumWeights; ++w)
{
const aiVertexWeight &vw = bone->mWeights[w]; const aiVertexWeight &vw = bone->mWeights[w];
vertexWeights[vw.mVertexId].push_back(Weight(b, vw.mWeight)); vertexWeights[vw.mVertexId].push_back(Weight(b, vw.mWeight));
maxVertexWeights = std::max(maxVertexWeights, vertexWeights[vw.mVertexId].size()); maxVertexWeights = std::max(maxVertexWeights, vertexWeights[vw.mVertexId].size());
@ -134,12 +136,14 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh *pMesh)
// and renormalize the weights // and renormalize the weights
float sum = 0.0f; float sum = 0.0f;
for (const Weight *it = vit->begin(); it != vit->end(); ++it) { for (const Weight *it = vit->begin(); it != vit->end(); ++it)
{
sum += it->mWeight; sum += it->mWeight;
} }
if (0.0f != sum) { if (0.0f != sum) {
const float invSum = 1.0f / sum; const float invSum = 1.0f / sum;
for (Weight *it = vit->begin(); it != vit->end(); ++it) { for (Weight *it = vit->begin(); it != vit->end(); ++it)
{
it->mWeight *= invSum; it->mWeight *= invSum;
} }
} }