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 MD5Loader.cpp
|
||||
* @brief Implementation of the MD5 importer class
|
||||
* @brief Implementation of the MD5 importer class
|
||||
*/
|
||||
|
||||
|
||||
@@ -87,12 +87,12 @@ MD5Importer::MD5Importer()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
// Destructor, private as well
|
||||
MD5Importer::~MD5Importer()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// 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 MD5Importer::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
||||
{
|
||||
const std::string extension = GetExtension(pFile);
|
||||
@@ -125,8 +125,8 @@ void MD5Importer::SetupProperties(const Importer* pImp)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void MD5Importer::InternReadFile( const std::string& pFile,
|
||||
// Imports the given file into the given scene structure.
|
||||
void MD5Importer::InternReadFile( const std::string& pFile,
|
||||
aiScene* _pScene, IOSystem* _pIOHandler)
|
||||
{
|
||||
pIOHandler = _pIOHandler;
|
||||
@@ -228,7 +228,7 @@ void MD5Importer::MakeDataUnique (MD5::MeshDesc& meshSrc)
|
||||
|
||||
// try to guess how much storage we'll need for new weights
|
||||
const float fWeightsPerVert = meshSrc.mWeights.size() / (float)iNewIndex;
|
||||
const unsigned int guess = (unsigned int)(fWeightsPerVert*iNewNum);
|
||||
const unsigned int guess = (unsigned int)(fWeightsPerVert*iNewNum);
|
||||
meshSrc.mWeights.reserve(guess + (guess >> 3)); // + 12.5% as buffer
|
||||
|
||||
for (FaceList::const_iterator iter = meshSrc.mFaces.begin(),iterEnd = meshSrc.mFaces.end();iter != iterEnd;++iter){
|
||||
@@ -270,11 +270,11 @@ void MD5Importer::AttachChilds_Mesh(int iParentID,aiNode* piParent, BoneList& bo
|
||||
aiNode* pc;
|
||||
// setup a new node
|
||||
*piParent->mChildren++ = pc = new aiNode();
|
||||
pc->mName = aiString(bones[i].mName);
|
||||
pc->mName = aiString(bones[i].mName);
|
||||
pc->mParent = piParent;
|
||||
|
||||
// get the transformation matrix from rotation and translational components
|
||||
aiQuaternion quat;
|
||||
aiQuaternion quat;
|
||||
MD5::ConvertQuaternion ( bones[i].mRotationQuat, quat );
|
||||
|
||||
// FIX to get to Assimp's quaternion conventions
|
||||
@@ -325,7 +325,7 @@ void MD5Importer::AttachChilds_Anim(int iParentID,aiNode* piParent, AnimBoneList
|
||||
aiNode* pc;
|
||||
// setup a new node
|
||||
*piParent->mChildren++ = pc = new aiNode();
|
||||
pc->mName = aiString(bones[i].mName);
|
||||
pc->mName = aiString(bones[i].mName);
|
||||
pc->mParent = piParent;
|
||||
|
||||
// get the corresponding animation channel and its first frame
|
||||
@@ -437,7 +437,7 @@ void MD5Importer::LoadMD5MeshFile ()
|
||||
MD5::WeightDesc& desc = meshSrc.mWeights[w];
|
||||
/* FIX for some invalid exporters */
|
||||
if (!(desc.mWeight < AI_MD5_WEIGHT_EPSILON && desc.mWeight >= -AI_MD5_WEIGHT_EPSILON ))
|
||||
++piCount[desc.mBone];
|
||||
++piCount[desc.mBone];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ void MD5Importer::LoadMD5MeshFile ()
|
||||
if (mesh->mNumBones) // just for safety
|
||||
{
|
||||
mesh->mBones = new aiBone*[mesh->mNumBones];
|
||||
for (unsigned int q = 0,h = 0; q < meshParser.mJoints.size();++q)
|
||||
for (unsigned int q = 0,h = 0; q < meshParser.mJoints.size();++q)
|
||||
{
|
||||
if (!piCount[q])continue;
|
||||
aiBone* p = mesh->mBones[h] = new aiBone();
|
||||
@@ -464,7 +464,7 @@ void MD5Importer::LoadMD5MeshFile ()
|
||||
// compute w-component of quaternion
|
||||
MD5::ConvertQuaternion( boneSrc.mRotationQuat, boneSrc.mRotationQuatConverted );
|
||||
}
|
||||
|
||||
|
||||
//unsigned int g = 0;
|
||||
pv = mesh->mVertices;
|
||||
for (MD5::VertexList::const_iterator iter = meshSrc.mVertices.begin();iter != meshSrc.mVertices.end();++iter,++pv) {
|
||||
@@ -490,7 +490,7 @@ void MD5Importer::LoadMD5MeshFile ()
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fNewWeight = desc.mWeight / fSum;
|
||||
const float fNewWeight = desc.mWeight / fSum;
|
||||
|
||||
// transform the local position into worldspace
|
||||
MD5::BoneDesc& boneSrc = meshParser.mJoints[desc.mBone];
|
||||
@@ -499,7 +499,7 @@ void MD5Importer::LoadMD5MeshFile ()
|
||||
// use the original weight to compute the vertex position
|
||||
// (some MD5s seem to depend on the invalid weight values ...)
|
||||
*pv += ((boneSrc.mPositionXYZ+v)* desc.mWeight);
|
||||
|
||||
|
||||
aiBone* bone = mesh->mBones[boneSrc.mMap];
|
||||
*bone->mWeights++ = aiVertexWeight((unsigned int)(pv-mesh->mVertices),fNewWeight);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ void MD5Importer::LoadMD5MeshFile ()
|
||||
// nnn_s.tga - specular map
|
||||
// nnn_d.tga - diffuse map
|
||||
if (meshSrc.mShader.length && !strchr(meshSrc.mShader.data,'.')) {
|
||||
|
||||
|
||||
aiString temp(meshSrc.mShader);
|
||||
temp.Append("_local.tga");
|
||||
mat->AddProperty(&temp,AI_MATKEY_TEXTURE_NORMALS(0));
|
||||
@@ -580,9 +580,9 @@ void MD5Importer::LoadMD5AnimFile ()
|
||||
MD5::MD5AnimParser animParser(parser.mSections);
|
||||
|
||||
// generate and fill the output animation
|
||||
if (animParser.mAnimatedBones.empty() || animParser.mFrames.empty() ||
|
||||
if (animParser.mAnimatedBones.empty() || animParser.mFrames.empty() ||
|
||||
animParser.mBaseFrames.size() != animParser.mAnimatedBones.size()) {
|
||||
|
||||
|
||||
DefaultLogger::get()->error("MD5ANIM: No frames or animated bones loaded");
|
||||
}
|
||||
else {
|
||||
@@ -619,7 +619,7 @@ void MD5Importer::LoadMD5AnimFile ()
|
||||
// Allow for empty frames
|
||||
if ((*iter2).iFlags != 0) {
|
||||
throw DeadlyImportError("MD5: Keyframe index is out of range");
|
||||
|
||||
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -721,7 +721,7 @@ void MD5Importer::LoadMD5CameraFile ()
|
||||
cuts.push_back(0);
|
||||
cuts.push_back(frames.size()-1);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
cuts.insert(cuts.begin(),0);
|
||||
|
||||
if (cuts.back() < frames.size()-1)
|
||||
@@ -731,10 +731,10 @@ void MD5Importer::LoadMD5CameraFile ()
|
||||
pScene->mNumAnimations = cuts.size()-1;
|
||||
aiAnimation** tmp = pScene->mAnimations = new aiAnimation*[pScene->mNumAnimations];
|
||||
for (std::vector<unsigned int>::const_iterator it = cuts.begin(); it != cuts.end()-1; ++it) {
|
||||
|
||||
|
||||
aiAnimation* anim = *tmp++ = new aiAnimation();
|
||||
anim->mName.length = ::sprintf(anim->mName.data,"anim%u_from_%u_to_%u",(unsigned int)(it-cuts.begin()),(*it),*(it+1));
|
||||
|
||||
|
||||
anim->mTicksPerSecond = cameraParser.fFrameRate;
|
||||
anim->mChannels = new aiNodeAnim*[anim->mNumChannels = 1];
|
||||
aiNodeAnim* nd = anim->mChannels[0] = new aiNodeAnim();
|
||||
|
||||
Reference in New Issue
Block a user