Refactor: Trim trailing whitespace
This commit is contained in:
@@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
@@ -25,22 +25,22 @@ conditions are met:
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file SMDLoader.cpp
|
||||
* @brief Implementation of the SMD importer class
|
||||
/** @file SMDLoader.cpp
|
||||
* @brief Implementation of the SMD importer class
|
||||
*/
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static const aiImporterDesc desc = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"smd vta"
|
||||
"smd vta"
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -78,12 +78,12 @@ SMDImporter::SMDImporter()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
// Destructor, private as well
|
||||
SMDImporter::~SMDImporter()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool SMDImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool) const
|
||||
{
|
||||
// fixme: auto format detection
|
||||
@@ -101,7 +101,7 @@ const aiImporterDesc* SMDImporter::GetInfo () const
|
||||
// Setup configuration properties
|
||||
void SMDImporter::SetupProperties(const Importer* pImp)
|
||||
{
|
||||
// The
|
||||
// The
|
||||
// AI_CONFIG_IMPORT_SMD_KEYFRAME option overrides the
|
||||
// AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
|
||||
configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_SMD_KEYFRAME,-1);
|
||||
@@ -111,7 +111,7 @@ void SMDImporter::SetupProperties(const Importer* pImp)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
// Imports the given file into the given scene structure.
|
||||
void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
|
||||
{
|
||||
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
|
||||
@@ -279,7 +279,7 @@ void SMDImporter::CreateOutputMeshes()
|
||||
aaiFaces[(*iFace).iTexture].push_back((unsigned int)aszTextures.size()-1);
|
||||
}
|
||||
else aaiFaces[(*iFace).iTexture].push_back(iNum);
|
||||
}
|
||||
}
|
||||
|
||||
// now create the output meshes
|
||||
for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
|
||||
@@ -322,13 +322,13 @@ void SMDImporter::CreateOutputMeshes()
|
||||
pcMesh->mFaces[iFace].mIndices = new unsigned int[3];
|
||||
pcMesh->mFaces[iFace].mNumIndices = 3;
|
||||
|
||||
// fill the vertices
|
||||
// fill the vertices
|
||||
unsigned int iSrcFace = aaiFaces[i][iFace];
|
||||
SMD::Face& face = asTriangles[iSrcFace];
|
||||
|
||||
*pcVerts++ = face.avVertices[0].pos;
|
||||
*pcVerts++ = face.avVertices[1].pos;
|
||||
*pcVerts++ = face.avVertices[2].pos;
|
||||
*pcVerts++ = face.avVertices[2].pos;
|
||||
|
||||
// fill the normals
|
||||
*pcNormals++ = face.avVertices[0].nor;
|
||||
@@ -342,7 +342,7 @@ void SMDImporter::CreateOutputMeshes()
|
||||
*pcUVs++ = face.avVertices[1].uv;
|
||||
*pcUVs++ = face.avVertices[2].uv;
|
||||
}
|
||||
|
||||
|
||||
for (unsigned int iVert = 0; iVert < 3;++iVert)
|
||||
{
|
||||
float fSum = 0.0f;
|
||||
@@ -350,9 +350,9 @@ void SMDImporter::CreateOutputMeshes()
|
||||
{
|
||||
TempWeightListEntry& pairval = face.avVertices[iVert].aiBoneLinks[iBone];
|
||||
|
||||
// FIX: The second check is here just to make sure we won't
|
||||
// FIX: The second check is here just to make sure we won't
|
||||
// assign more than one weight to a single vertex index
|
||||
if (pairval.first >= asBones.size() ||
|
||||
if (pairval.first >= asBones.size() ||
|
||||
pairval.first == face.avVertices[iVert].iParentNode)
|
||||
{
|
||||
DefaultLogger::get()->error("[SMD/VTA] Bone index overflow. "
|
||||
@@ -364,8 +364,8 @@ void SMDImporter::CreateOutputMeshes()
|
||||
fSum += pairval.second;
|
||||
}
|
||||
// ******************************************************************
|
||||
// If the sum of all vertex weights is not 1.0 we must assign
|
||||
// the rest to the vertex' parent node. Well, at least the doc says
|
||||
// If the sum of all vertex weights is not 1.0 we must assign
|
||||
// the rest to the vertex' parent node. Well, at least the doc says
|
||||
// we should ...
|
||||
// FIX: We use 0.975 as limit, floating-point inaccuracies seem to
|
||||
// be very strong in some SMD exporters. Furthermore it is possible
|
||||
@@ -405,7 +405,7 @@ void SMDImporter::CreateOutputMeshes()
|
||||
iNum = 0;
|
||||
for (unsigned int iBone = 0; iBone < asBones.size();++iBone)
|
||||
if (!aaiBones[iBone].empty())++iNum;
|
||||
|
||||
|
||||
if (false && iNum)
|
||||
{
|
||||
pcMesh->mNumBones = iNum;
|
||||
@@ -489,7 +489,7 @@ void SMDImporter::CreateOutputNodes()
|
||||
// AddBoneChildren(pScene->mRootNode,(uint32_t)-1);
|
||||
|
||||
// if we have only one bone we can even remove the root node
|
||||
if (pScene->mFlags & AI_SCENE_FLAGS_INCOMPLETE &&
|
||||
if (pScene->mFlags & AI_SCENE_FLAGS_INCOMPLETE &&
|
||||
1 == pScene->mRootNode->mNumChildren)
|
||||
{
|
||||
aiNode* pcOldRoot = pScene->mRootNode;
|
||||
@@ -533,7 +533,7 @@ void SMDImporter::CreateOutputAnimations()
|
||||
anim->mTicksPerSecond = 25.0; // FIXME: is this correct?
|
||||
|
||||
aiNodeAnim** pp = anim->mChannels = new aiNodeAnim*[anim->mNumChannels];
|
||||
|
||||
|
||||
// now build valid keys
|
||||
unsigned int a = 0;
|
||||
for (std::vector<SMD::Bone>::const_iterator
|
||||
@@ -588,7 +588,7 @@ void SMDImporter::ComputeAbsoluteBoneTransformations()
|
||||
for (unsigned int i = 0; i < bone.sAnim.asKeys.size();++i)
|
||||
{
|
||||
double d = std::min(bone.sAnim.asKeys[i].dTime,dMin);
|
||||
if (d < dMin)
|
||||
if (d < dMin)
|
||||
{
|
||||
dMin = d;
|
||||
iIndex = i;
|
||||
@@ -603,12 +603,12 @@ void SMDImporter::ComputeAbsoluteBoneTransformations()
|
||||
for (unsigned int iBone = 0; iBone < asBones.size();++iBone)
|
||||
{
|
||||
SMD::Bone& bone = asBones[iBone];
|
||||
|
||||
|
||||
if (iParent == bone.iParent)
|
||||
{
|
||||
SMD::Bone& parentBone = asBones[iParent];
|
||||
|
||||
|
||||
|
||||
uint32_t iIndex = bone.sAnim.iFirstTimeKey;
|
||||
const aiMatrix4x4& mat = bone.sAnim.asKeys[iIndex].matrix;
|
||||
aiMatrix4x4& matOut = bone.sAnim.asKeys[iIndex].matrixAbsolute;
|
||||
@@ -624,7 +624,7 @@ void SMDImporter::ComputeAbsoluteBoneTransformations()
|
||||
++iParent;
|
||||
}
|
||||
|
||||
// Store the inverse of the absolute transformation matrix
|
||||
// Store the inverse of the absolute transformation matrix
|
||||
// of the first key as bone offset matrix
|
||||
for (iParent = 0; iParent < asBones.size();++iParent)
|
||||
{
|
||||
@@ -803,8 +803,8 @@ void SMDImporter::ParseVASection(const char* szCurrent,
|
||||
// "end\n" - Ends the "vertexanimation" section
|
||||
if (TokenMatch(szCurrent,"end",3))
|
||||
break;
|
||||
|
||||
// "time <n>\n"
|
||||
|
||||
// "time <n>\n"
|
||||
if (TokenMatch(szCurrent,"time",4))
|
||||
{
|
||||
// NOTE: The doc says that time values COULD be negative ...
|
||||
@@ -813,7 +813,7 @@ void SMDImporter::ParseVASection(const char* szCurrent,
|
||||
if(!ParseSignedInt(szCurrent,&szCurrent,iTime) || configFrameID != (unsigned int)iTime)break;
|
||||
SkipLine(szCurrent,&szCurrent);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if(0 == iCurIndex)
|
||||
{
|
||||
@@ -846,7 +846,7 @@ void SMDImporter::ParseSkeletonSection(const char* szCurrent,
|
||||
// "end\n" - Ends the skeleton section
|
||||
if (TokenMatch(szCurrent,"end",3))
|
||||
break;
|
||||
|
||||
|
||||
// "time <n>\n" - Specifies the current animation frame
|
||||
else if (TokenMatch(szCurrent,"time",4))
|
||||
{
|
||||
@@ -858,7 +858,7 @@ void SMDImporter::ParseSkeletonSection(const char* szCurrent,
|
||||
}
|
||||
else ParseSkeletonElement(szCurrent,&szCurrent,iTime);
|
||||
}
|
||||
*szCurrentOut = szCurrent;
|
||||
*szCurrentOut = szCurrent;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -1003,7 +1003,7 @@ void SMDImporter::ParseTriangle(const char* szCurrent,
|
||||
{
|
||||
asTriangles.push_back(SMD::Face());
|
||||
SMD::Face& face = asTriangles.back();
|
||||
|
||||
|
||||
if(!SkipSpaces(szCurrent,&szCurrent))
|
||||
{
|
||||
LogErrorNoThrow("Unexpected EOF/EOL while parsing a triangle");
|
||||
|
||||
Reference in New Issue
Block a user