Commit 538d1a1e authored by hybrid's avatar hybrid

Remove unused function, simplify joints code.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3066 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 7b6640fd
...@@ -781,47 +781,36 @@ void COgreMeshFileLoader::composeObject(void) ...@@ -781,47 +781,36 @@ void COgreMeshFileLoader::composeObject(void)
} }
} }
#if 0
// currently not working correctly // currently not working correctly
for (u32 i=0; i<Skeleton.Animations.size(); ++i) for (u32 i=0; i<Skeleton.Animations.size(); ++i)
{ {
for (u32 j=0; j<Skeleton.Animations[i].Keyframes.size(); ++j) for (u32 j=0; j<Skeleton.Animations[i].Keyframes.size(); ++j)
{ {
ISkinnedMesh::SPositionKey* poskey = m->addPositionKey(m->getAllJoints()[Skeleton.Animations[i].Keyframes[j].BoneID]); #if 0
poskey->frame=Skeleton.Animations[i].Keyframes[j].Time; OgreKeyframe& frame = Skeleton.Animations[i].Keyframes[j];
poskey->position=Skeleton.Animations[i].Keyframes[j].Position; #ifdef IRR_OGRE_LOADER_DEBUG
ISkinnedMesh::SRotationKey* rotkey = m->addRotationKey(m->getAllJoints()[Skeleton.Animations[i].Keyframes[j].BoneID]); os::Printer::log("Time", core::stringc(frame.Time));
rotkey->frame=Skeleton.Animations[i].Keyframes[j].Time; os::Printer::log("Position", core::stringc(frame.Position.X)+" "+core::stringc(frame.Position.Y)+" "+core::stringc(frame.Position.Z));
rotkey->rotation=Skeleton.Animations[i].Keyframes[j].Orientation; os::Printer::log("Rotation quat", core::stringc(frame.Orientation.W)+" "+core::stringc(frame.Orientation.X)+" "+core::stringc(frame.Orientation.Y)+" "+core::stringc(frame.Orientation.Z));
ISkinnedMesh::SScaleKey* scalekey = m->addScaleKey(m->getAllJoints()[Skeleton.Animations[i].Keyframes[j].BoneID]); #endif
scalekey->frame=Skeleton.Animations[i].Keyframes[j].Time; ISkinnedMesh::SJoint* keyjoint = m->getAllJoints()[frame.BoneID];
scalekey->scale=Skeleton.Animations[i].Keyframes[j].Scale; ISkinnedMesh::SPositionKey* poskey = m->addPositionKey(keyjoint);
poskey->frame=frame.Time;
poskey->position=keyjoint->LocalMatrix.getTranslation()+frame.Position;
ISkinnedMesh::SRotationKey* rotkey = m->addRotationKey(keyjoint);
rotkey->frame=frame.Time;
rotkey->rotation=frame.Orientation+core::quaternion(keyjoint->LocalMatrix);
ISkinnedMesh::SScaleKey* scalekey = m->addScaleKey(keyjoint);
scalekey->frame=frame.Time;
scalekey->scale=frame.Scale;
#endif
} }
} }
#endif
m->finalize(); m->finalize();
} }
} }
core::stringc COgreMeshFileLoader::getTextureFileName(const core::stringc& texture,
core::stringc& model)
{
s32 idx = -1;
idx = model.findLast('/');
if (idx == -1)
idx = model.findLast('\\');
if (idx == -1)
return core::stringc();
core::stringc p = model.subString(0, idx+1);
p.append(texture);
return p;
}
void COgreMeshFileLoader::getMaterialToken(io::IReadFile* file, core::stringc& token, bool noNewLine) void COgreMeshFileLoader::getMaterialToken(io::IReadFile* file, core::stringc& token, bool noNewLine)
{ {
bool parseString=false; bool parseString=false;
...@@ -1366,8 +1355,8 @@ bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stri ...@@ -1366,8 +1355,8 @@ bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stri
readQuaternion(file, data, bone.Orientation); readQuaternion(file, data, bone.Orientation);
#ifdef IRR_OGRE_LOADER_DEBUG #ifdef IRR_OGRE_LOADER_DEBUG
os::Printer::log("Bone", bone.Name+" ("+core::stringc(bone.Handle)+")"); os::Printer::log("Bone", bone.Name+" ("+core::stringc(bone.Handle)+")");
// os::Printer::log("Position", core::stringc(bone.Position.X)+" "+core::stringc(bone.Position.Y)+" "+core::stringc(bone.Position.Z)); os::Printer::log("Position", core::stringc(bone.Position.X)+" "+core::stringc(bone.Position.Y)+" "+core::stringc(bone.Position.Z));
// os::Printer::log("Rotation quat", core::stringc(bone.Orientation.W)+" "+core::stringc(bone.Orientation.X)+" "+core::stringc(bone.Orientation.Y)+" "+core::stringc(bone.Orientation.Z)); os::Printer::log("Rotation quat", core::stringc(bone.Orientation.W)+" "+core::stringc(bone.Orientation.X)+" "+core::stringc(bone.Orientation.Y)+" "+core::stringc(bone.Orientation.Z));
// core::vector3df rot; // core::vector3df rot;
// bone.Orientation.toEuler(rot); // bone.Orientation.toEuler(rot);
// rot *= core::RADTODEG; // rot *= core::RADTODEG;
...@@ -1408,7 +1397,7 @@ bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stri ...@@ -1408,7 +1397,7 @@ bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stri
break; break;
case COGRE_ANIMATION_TRACK: case COGRE_ANIMATION_TRACK:
#ifdef IRR_OGRE_LOADER_DEBUG #ifdef IRR_OGRE_LOADER_DEBUG
// os::Printer::log("for Bone ", core::stringc(bone)); os::Printer::log("for Bone ", core::stringc(bone));
#endif #endif
readShort(file, data, &bone); // store current bone readShort(file, data, &bone); // store current bone
break; break;
......
...@@ -259,7 +259,6 @@ private: ...@@ -259,7 +259,6 @@ private:
void readPass(io::IReadFile* file, OgreTechnique& technique); void readPass(io::IReadFile* file, OgreTechnique& technique);
void loadMaterials(io::IReadFile* file); void loadMaterials(io::IReadFile* file);
bool loadSkeleton(io::IReadFile* meshFile, const core::stringc& name); bool loadSkeleton(io::IReadFile* meshFile, const core::stringc& name);
core::stringc getTextureFileName(const core::stringc& texture, core::stringc& model);
void clearMeshes(); void clearMeshes();
io::IFileSystem* FileSystem; io::IFileSystem* FileSystem;
......
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