Ogre: small tweaks

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1253 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/merge
jonathanklein 2012-06-03 11:06:47 +00:00
parent 7384ce4005
commit 5b462d484b
3 changed files with 9 additions and 15 deletions

View File

@ -51,10 +51,6 @@ to make it shorter easier to maintain.
#include <sstream> #include <sstream>
using namespace std; using namespace std;
//#include "boost/format.hpp"
//#include "boost/foreach.hpp"
//using namespace boost;
#include "OgreImporter.hpp" #include "OgreImporter.hpp"
#include "irrXMLWrapper.h" #include "irrXMLWrapper.h"
#include "TinyFormatter.h" #include "TinyFormatter.h"

View File

@ -169,7 +169,7 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
Bones[ChildId].ParentId=ParentId; Bones[ChildId].ParentId=ParentId;
Bones[ParentId].Children.push_back(ChildId); Bones[ParentId].Children.push_back(ChildId);
XmlRead(SkeletonFile);//i once forget this line, which led to an endless loop, did i mentioned, that irrxml sucks?? XmlRead(SkeletonFile);//I once forget this line, which led to an endless loop, did i mentioned, that irrxml sucks??
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
@ -218,7 +218,7 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
//loop over the attributes: //loop over the attributes:
while(true) while(true) //will quit, if a Node is not a animationkey
{ {
XmlRead(SkeletonFile); XmlRead(SkeletonFile);
@ -268,12 +268,9 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
break; break;
} }
NewTrack.Keyframes.push_back(NewKeyframe); NewTrack.Keyframes.push_back(NewKeyframe);
//XmlRead(SkeletonFile);
} }
NewAnimation.Tracks.push_back(NewTrack); NewAnimation.Tracks.push_back(NewTrack);
} }
@ -295,7 +292,7 @@ void OgreImporter::CreateAssimpSkeleton(const std::vector<Bone> &Bones, const st
//Createt the assimp bone hierarchy //Createt the assimp bone hierarchy
vector<aiNode*> RootBoneNodes; vector<aiNode*> RootBoneNodes;
BOOST_FOREACH(Bone theBone, Bones) BOOST_FOREACH(const Bone &theBone, Bones)
{ {
if(-1==theBone.ParentId) //the bone is a root bone if(-1==theBone.ParentId) //the bone is a root bone
{ {
@ -304,7 +301,8 @@ void OgreImporter::CreateAssimpSkeleton(const std::vector<Bone> &Bones, const st
} }
} }
if (RootBoneNodes.size()) { if(RootBoneNodes.size() > 0)
{
m_CurrentScene->mRootNode->mNumChildren=RootBoneNodes.size(); m_CurrentScene->mRootNode->mNumChildren=RootBoneNodes.size();
m_CurrentScene->mRootNode->mChildren=new aiNode*[RootBoneNodes.size()]; m_CurrentScene->mRootNode->mChildren=new aiNode*[RootBoneNodes.size()];
memcpy(m_CurrentScene->mRootNode->mChildren, &RootBoneNodes[0], sizeof(aiNode*)*RootBoneNodes.size()); memcpy(m_CurrentScene->mRootNode->mChildren, &RootBoneNodes[0], sizeof(aiNode*)*RootBoneNodes.size());
@ -359,7 +357,7 @@ void OgreImporter::PutAnimationsInScene(const std::vector<Bone> &Bones, const st
aiMatrix4x4 PoseToKey= aiMatrix4x4 PoseToKey=
aiMatrix4x4::Translation(Animations[i].Tracks[j].Keyframes[k].Position, t3) //pos aiMatrix4x4::Translation(Animations[i].Tracks[j].Keyframes[k].Position, t3) //pos
* aiMatrix4x4(Animations[i].Tracks[j].Keyframes[k].Rotation.GetMatrix()) //rot * aiMatrix4x4(Animations[i].Tracks[j].Keyframes[k].Rotation.GetMatrix()) //rot
* aiMatrix4x4::Scaling(Animations[i].Tracks[j].Keyframes[k].Scaling, t2); //scale * aiMatrix4x4::Scaling(Animations[i].Tracks[j].Keyframes[k].Scaling, t2); //scale
//calculate the complete transformation from world space to bone space //calculate the complete transformation from world space to bone space

View File

@ -1427,11 +1427,11 @@ IFC support is new and considered experimental. Please report any bugs you may e
This section contains implementations notes for the OgreXML importer. This section contains implementations notes for the OgreXML importer.
@subsection overview Overview @subsection overview Overview
Ogre importer is currently optimized for the Blender Ogre exporter, because thats the only one that i use. You can find the Blender Ogre exporter at: http://www.ogre3d.org/forums/viewtopic.php?f=8&t=45922 Ogre importer is currently optimized for the Blender Ogre exporter, because thats the only one that I use. You can find the Blender Ogre exporter at: http://www.ogre3d.org/forums/viewtopic.php?f=8&t=45922
@subsection what What will be loaded? @subsection what What will be loaded?
Mesh: Faces, Positions, Normals and one Uv pair. The Materialname will be used to load the material. Mesh: Faces, Positions, Normals and all TexCoords. The Materialname will be used to load the material.
Material: The right material in the file will be searched, the importer should work with materials who Material: The right material in the file will be searched, the importer should work with materials who
have 1 technique and 1 pass in this technique. From there, the texturename (for 1 color- and 1 normalmap) and the have 1 technique and 1 pass in this technique. From there, the texturename (for 1 color- and 1 normalmap) and the
@ -1477,7 +1477,7 @@ Just look in OgreImporterMaterial.cpp
- Load colors in custom materials - Load colors in custom materials
- extend custom and normal material loading - extend custom and normal material loading
- fix bone hierarchy bug - fix bone hierarchy bug
- tes everything elaboratly - test everything elaboratly
- check for non existent animation keys (what happens if a one time not all bones have a key?) - check for non existent animation keys (what happens if a one time not all bones have a key?)
*/ */