Ran script to remove trailing spaces and tabs
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/* -*-c++-*-
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -26,11 +26,11 @@ const VertexInfluenceSet::VertexIndexToBoneWeightMap& VertexInfluenceSet::getVer
|
||||
void VertexInfluenceSet::buildVertex2BoneList()
|
||||
{
|
||||
_vertex2Bones.clear();
|
||||
for (BoneToVertexList::const_iterator it = _bone2Vertexes.begin(); it != _bone2Vertexes.end(); ++it)
|
||||
for (BoneToVertexList::const_iterator it = _bone2Vertexes.begin(); it != _bone2Vertexes.end(); ++it)
|
||||
{
|
||||
const VertexInfluence& vi = (*it);
|
||||
int size = vi.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
VertexIndexWeight viw = vi[i];
|
||||
int index = viw.first;
|
||||
@@ -49,11 +49,11 @@ void VertexInfluenceSet::buildVertex2BoneList()
|
||||
float sum = 0;
|
||||
for (int i = 0; i < size; i++)
|
||||
sum += bones[i].getWeight();
|
||||
if (sum < 1e-4)
|
||||
if (sum < 1e-4)
|
||||
{
|
||||
OSG_WARN << "VertexInfluenceSet::buildVertex2BoneList warning the vertex " << it->first << " seems to have 0 weight, skip normalize for this vertex" << std::endl;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
float mult = 1.0/sum;
|
||||
for (int i = 0; i < size; i++)
|
||||
@@ -67,8 +67,8 @@ void VertexInfluenceSet::buildVertex2BoneList()
|
||||
// sort by name and weight
|
||||
struct SortByNameAndWeight : public std::less<VertexInfluenceSet::BoneWeight>
|
||||
{
|
||||
bool operator()(const VertexInfluenceSet::BoneWeight& b0,
|
||||
const VertexInfluenceSet::BoneWeight& b1) const
|
||||
bool operator()(const VertexInfluenceSet::BoneWeight& b0,
|
||||
const VertexInfluenceSet::BoneWeight& b1) const
|
||||
{
|
||||
if (b0.getBoneName() < b1.getBoneName())
|
||||
return true;
|
||||
@@ -82,8 +82,8 @@ struct SortByNameAndWeight : public std::less<VertexInfluenceSet::BoneWeight>
|
||||
|
||||
struct SortByBoneWeightList : public std::less<VertexInfluenceSet::BoneWeightList>
|
||||
{
|
||||
bool operator()(const VertexInfluenceSet::BoneWeightList& b0,
|
||||
const VertexInfluenceSet::BoneWeightList& b1) const
|
||||
bool operator()(const VertexInfluenceSet::BoneWeightList& b0,
|
||||
const VertexInfluenceSet::BoneWeightList& b1) const
|
||||
{
|
||||
if (b0.size() < b1.size())
|
||||
return true;
|
||||
@@ -91,7 +91,7 @@ struct SortByBoneWeightList : public std::less<VertexInfluenceSet::BoneWeightLis
|
||||
return false;
|
||||
|
||||
int size = b0.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
bool result = SortByNameAndWeight()(b0[i], b1[i]);
|
||||
if (result)
|
||||
@@ -105,7 +105,7 @@ struct SortByBoneWeightList : public std::less<VertexInfluenceSet::BoneWeightLis
|
||||
|
||||
void VertexInfluenceSet::clear()
|
||||
{
|
||||
_bone2Vertexes.clear();
|
||||
_bone2Vertexes.clear();
|
||||
_uniqVertexSetToBoneSet.clear();
|
||||
}
|
||||
|
||||
@@ -116,14 +116,14 @@ void VertexInfluenceSet::buildUniqVertexSetToBoneSetList()
|
||||
typedef std::map<BoneWeightList,UniqVertexSetToBoneSet, SortByBoneWeightList> UnifyBoneGroup;
|
||||
UnifyBoneGroup unifyBuffer;
|
||||
|
||||
for (VertexIndexToBoneWeightMap::iterator it = _vertex2Bones.begin(); it != _vertex2Bones.end(); ++it)
|
||||
for (VertexIndexToBoneWeightMap::iterator it = _vertex2Bones.begin(); it != _vertex2Bones.end(); ++it)
|
||||
{
|
||||
BoneWeightList bones = it->second;
|
||||
int vertexIndex = it->first;
|
||||
|
||||
// sort the vector to have a consistent key
|
||||
std::sort(bones.begin(), bones.end(), SortByNameAndWeight());
|
||||
|
||||
|
||||
// we use the vector<BoneWeight> as key to differentiate group
|
||||
UnifyBoneGroup::iterator result = unifyBuffer.find(bones);
|
||||
if (result == unifyBuffer.end())
|
||||
@@ -132,7 +132,7 @@ void VertexInfluenceSet::buildUniqVertexSetToBoneSetList()
|
||||
}
|
||||
|
||||
_uniqVertexSetToBoneSet.reserve(unifyBuffer.size());
|
||||
for (UnifyBoneGroup::iterator it = unifyBuffer.begin(); it != unifyBuffer.end(); ++it)
|
||||
for (UnifyBoneGroup::iterator it = unifyBuffer.begin(); it != unifyBuffer.end(); ++it)
|
||||
{
|
||||
_uniqVertexSetToBoneSet.push_back(it->second);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user