Commit cce97d49 authored by hybrid's avatar hybrid

Some code cleaning.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1082 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 8bd01953
This diff is collapsed.
...@@ -76,16 +76,16 @@ private: ...@@ -76,16 +76,16 @@ private:
bool load(); bool load();
bool readChunkNODE(CSkinnedMesh::SJoint* InJoint); bool readChunkNODE(CSkinnedMesh::SJoint* InJoint);
bool readChunkMESH(CSkinnedMesh::SJoint* InJoint); bool readChunkMESH(CSkinnedMesh::SJoint* InJoint);
bool readChunkVRTS(CSkinnedMesh::SJoint* InJoint, scene::SSkinMeshBuffer *MeshBuffer, s32 Vertices_Start); bool readChunkVRTS(CSkinnedMesh::SJoint* InJoint);
bool readChunkTRIS(CSkinnedMesh::SJoint* InJoint, scene::SSkinMeshBuffer *MeshBuffer, u32 MeshBufferID, s32 Vertices_Start); bool readChunkTRIS(scene::SSkinMeshBuffer *MeshBuffer, u32 MeshBufferID, s32 Vertices_Start);
bool readChunkBONE(CSkinnedMesh::SJoint* InJoint); bool readChunkBONE(CSkinnedMesh::SJoint* InJoint);
bool readChunkKEYS(CSkinnedMesh::SJoint* InJoint); bool readChunkKEYS(CSkinnedMesh::SJoint* InJoint);
bool readChunkANIM(CSkinnedMesh::SJoint* InJoint); bool readChunkANIM();
bool readChunkTEXS(); bool readChunkTEXS();
bool readChunkBRUS(); bool readChunkBRUS();
core::stringc readString(); core::stringc readString();
core::stringc stripPathFromString(core::stringc string, bool returnPath=false); core::stringc stripPathFromString(core::stringc string, bool returnPath=false) const;
void readFloats(f32* vec, u32 count); void readFloats(f32* vec, u32 count);
core::array<SB3dChunk> B3dStack; core::array<SB3dChunk> B3dStack;
......
...@@ -372,8 +372,6 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file) ...@@ -372,8 +372,6 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
#endif #endif
pPtr += sizeof(MS3DJoint); pPtr += sizeof(MS3DJoint);
ISkinnedMesh::SJoint *jnt = AnimatedMesh->createJoint(); ISkinnedMesh::SJoint *jnt = AnimatedMesh->createJoint();
/* /*
...@@ -400,18 +398,16 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file) ...@@ -400,18 +398,16 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
jnt->LocalMatrix.setTranslation( jnt->LocalMatrix.setTranslation(
core::vector3df(pJoint->Translation[0], pJoint->Translation[1], pJoint->Translation[2]) ); core::vector3df(pJoint->Translation[0], pJoint->Translation[1], pJoint->Translation[2]) );
ParentNames.push_back( (c8*)pJoint->ParentName ); ParentNames.push_back( (c8*)pJoint->ParentName );
/*if (pJoint->NumRotationKeyframes || /*if (pJoint->NumRotationKeyframes ||
pJoint->NumTranslationKeyframes) pJoint->NumTranslationKeyframes)
HasAnimation = true;*/ HasAnimation = true;
*/
// get rotation keyframes // get rotation keyframes
for (j=0; j < pJoint->NumRotationKeyframes; ++j) const u16 numRotationKeyframes = pJoint->NumRotationKeyframes;
for (j=0; j < numRotationKeyframes; ++j)
{ {
MS3DKeyframe* kf = (MS3DKeyframe*)pPtr; MS3DKeyframe* kf = (MS3DKeyframe*)pPtr;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
...@@ -432,17 +428,11 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file) ...@@ -432,17 +428,11 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
tmpMatrix=jnt->LocalMatrix*tmpMatrix; tmpMatrix=jnt->LocalMatrix*tmpMatrix;
k->rotation = core::quaternion(tmpMatrix); k->rotation = core::quaternion(tmpMatrix);
//fix
//k->rotation = core::vector3df
// (kf->Parameter[0],//+pJoint->Rotation[0]*core::RADTODEG,
// kf->Parameter[1],//+pJoint->Rotation[1]*core::RADTODEG,
// kf->Parameter[2]);//+pJoint->Rotation[2]*core::RADTODEG);
} }
// get translation keyframes // get translation keyframes
for (j=0; j<pJoint->NumTranslationKeyframes; ++j) const u16 numTranslationKeyframes = pJoint->NumTranslationKeyframes;
for (j=0; j<numTranslationKeyframes; ++j)
{ {
MS3DKeyframe* kf = (MS3DKeyframe*)pPtr; MS3DKeyframe* kf = (MS3DKeyframe*)pPtr;
#ifdef __BIG_ENDIAN__ #ifdef __BIG_ENDIAN__
...@@ -459,8 +449,6 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file) ...@@ -459,8 +449,6 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
(kf->Parameter[0]+pJoint->Translation[0], (kf->Parameter[0]+pJoint->Translation[0],
kf->Parameter[1]+pJoint->Translation[1], kf->Parameter[1]+pJoint->Translation[1],
kf->Parameter[2]+pJoint->Translation[2]); kf->Parameter[2]+pJoint->Translation[2]);
} }
} }
...@@ -517,6 +505,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file) ...@@ -517,6 +505,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
break; break;
} }
} }
if (index == -1) if (index == -1)
{ {
s32 boneid = vertices[triangles[i].VertexIndices[j]].BoneID; s32 boneid = vertices[triangles[i].VertexIndices[j]].BoneID;
...@@ -584,10 +573,10 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file) ...@@ -584,10 +573,10 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
} }
core::stringc CMS3DMeshFileLoader::stripPathFromString(core::stringc string, bool returnPath) core::stringc CMS3DMeshFileLoader::stripPathFromString(const core::stringc& inString, bool returnPath) const
{ {
s32 slashIndex=string.findLast('/'); // forward slash s32 slashIndex=inString.findLast('/'); // forward slash
s32 backSlash=string.findLast('\\'); // back slash s32 backSlash=inString.findLast('\\'); // back slash
if (backSlash>slashIndex) slashIndex=backSlash; if (backSlash>slashIndex) slashIndex=backSlash;
...@@ -595,12 +584,12 @@ core::stringc CMS3DMeshFileLoader::stripPathFromString(core::stringc string, boo ...@@ -595,12 +584,12 @@ core::stringc CMS3DMeshFileLoader::stripPathFromString(core::stringc string, boo
if (returnPath) if (returnPath)
return core::stringc(); //no path to return return core::stringc(); //no path to return
else else
return string; return inString;
if (returnPath) if (returnPath)
return string.subString(0, slashIndex + 1); return inString.subString(0, slashIndex + 1);
else else
return string.subString(slashIndex+1, string.size() - (slashIndex+1)); return inString.subString(slashIndex+1, inString.size() - (slashIndex+1));
} }
......
...@@ -34,7 +34,7 @@ public: ...@@ -34,7 +34,7 @@ public:
private: private:
core::stringc stripPathFromString(core::stringc string, bool returnPath); core::stringc stripPathFromString(const core::stringc& inString, bool returnPath) const;
bool load(io::IReadFile* file); bool load(io::IReadFile* file);
video::IVideoDriver* Driver; video::IVideoDriver* Driver;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment