some code updates, ogre animation still not working :(
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@837 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
e0e0bf3c1e
commit
998de54048
3
CREDITS
3
CREDITS
|
@ -26,6 +26,9 @@ Visual Studio 9 support, bugfixes.
|
|||
- Mark Sibly
|
||||
B3D-Loader, Assimp testing
|
||||
|
||||
- Jonathan Klein
|
||||
Ogre Loader
|
||||
|
||||
- Sebastian Hempel,
|
||||
PyAssimp (first version)
|
||||
Compile-Bugfixes for mingw, add enviroment for static library support in make.
|
||||
|
|
|
@ -193,6 +193,7 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
|||
|
||||
|
||||
CreateAssimpSkeleton(Bones, Animations);
|
||||
PutAnimationsInScene(Bones, Animations);
|
||||
//___________________________________________________________
|
||||
}
|
||||
|
||||
|
@ -212,8 +213,8 @@ void OgreImporter::SetupProperties(const Importer* pImp)
|
|||
void OgreImporter::ReadSubMesh(SubMesh &theSubMesh, XmlReader *Reader)
|
||||
{
|
||||
XmlRead(Reader);
|
||||
//TODO: maybe we have alsways just 1 faces and 1 geometry and always in this order. this loop will only work correct, wenn the order
|
||||
//of faces and geometry changed, and not if we habe more than one of one
|
||||
//TODO: maybe we have alsways just 1 faces and 1 geometry and always in this order. this loop will only work correct, when the order
|
||||
//of faces and geometry changed, and not if we have more than one of one
|
||||
while(Reader->getNodeName()==string("faces") || string(Reader->getNodeName())=="geometry" || Reader->getNodeName()==string("boneassignments"))
|
||||
{
|
||||
if(string(Reader->getNodeName())=="faces")//Read the face list
|
||||
|
@ -704,18 +705,15 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
|
|||
}
|
||||
|
||||
|
||||
void OgreImporter::CreateAssimpSkeleton(const std::vector<Bone> &Bones, const std::vector<Animation> &Animations) const
|
||||
void OgreImporter::CreateAssimpSkeleton(const std::vector<Bone> &Bones, const std::vector<Animation> &Animations)
|
||||
{
|
||||
const aiScene* const m_CurrentScene=this->m_CurrentScene;//make sure, that we can access but not change the scene
|
||||
|
||||
//-----------------skeleton is completly loaded, now put it in the assimp scene:-------------------------------
|
||||
|
||||
if(!m_CurrentScene->mRootNode)
|
||||
throw DeadlyImportError("No root node exists!!");
|
||||
if(0!=m_CurrentScene->mRootNode->mNumChildren)
|
||||
throw DeadlyImportError("Root Node already has childnodes!");
|
||||
|
||||
//--------------Createt the assimp bone hierarchy-----------------
|
||||
|
||||
//Createt the assimp bone hierarchy
|
||||
DefaultLogger::get()->debug("Root Bones");
|
||||
vector<aiNode*> RootBoneNodes;
|
||||
BOOST_FOREACH(Bone theBone, Bones)
|
||||
|
@ -729,14 +727,13 @@ void OgreImporter::CreateAssimpSkeleton(const std::vector<Bone> &Bones, const st
|
|||
m_CurrentScene->mRootNode->mNumChildren=RootBoneNodes.size();
|
||||
m_CurrentScene->mRootNode->mChildren=new aiNode*[RootBoneNodes.size()];
|
||||
memcpy(m_CurrentScene->mRootNode->mChildren, &RootBoneNodes[0], sizeof(aiNode*)*RootBoneNodes.size());
|
||||
//_______________________________________________________________
|
||||
}
|
||||
|
||||
|
||||
void OgreImporter::PutAnimationsInScene(const std::vector<Bone> &Bones, const std::vector<Animation> &Animations)
|
||||
{
|
||||
//-----------------Create the Assimp Animations --------------------
|
||||
if(Animations.size()>0)//Maybe the model had only a skeleton and no animations. (If it also has no skeleton, this function would'nt have benn called
|
||||
if(Animations.size()>0)//Maybe the model had only a skeleton and no animations. (If it also has no skeleton, this function would'nt have been called
|
||||
{
|
||||
m_CurrentScene->mNumAnimations=Animations.size();
|
||||
m_CurrentScene->mAnimations=new aiAnimation*[Animations.size()];
|
||||
|
|
|
@ -42,8 +42,8 @@ private:
|
|||
/// uses the bone data to convert a SubMesh into a aiMesh which will be created and returned
|
||||
aiMesh* CreateAssimpSubMesh(const SubMesh &theSubMesh, const std::vector<Bone>& Bones) const;
|
||||
|
||||
|
||||
void CreateAssimpSkeleton(const std::vector<Bone> &Bones, const std::vector<Animation> &Animations) const;
|
||||
//creates the aiskeleton in current scene
|
||||
void CreateAssimpSkeleton(const std::vector<Bone> &Bones, const std::vector<Animation> &Animations);
|
||||
|
||||
aiMaterial* LoadMaterial(const std::string MaterialName) const;
|
||||
|
||||
|
|
13
doc/dox.h
13
doc/dox.h
|
@ -1594,11 +1594,11 @@ Ogre importer is currently optimized for the Blender Ogre exporter, because that
|
|||
|
||||
@subsection what What will be loaded?
|
||||
|
||||
Mesh: Faces, Positions, Normals and one Uv pair. The Materialname will be used to load the material. No Bone-Assignments yet.
|
||||
Mesh: Faces, Positions, Normals and one Uv pair. 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
|
||||
have 1 technique and 1 pass in this technique. From there, the texturename (for 1 color- and 1 normalmap) will be loaded. Also, the
|
||||
materialname will be set.
|
||||
have 1 technique and 1 pass in this technique. From there, the texturename (for 1 color- and 1 normalmap) and the
|
||||
materialcolors (but not in custom materials) will be loaded. Also, the materialname will be set.
|
||||
|
||||
Skeleton: Skeleton with Bone hierarchy (Position and Rotation, but no Scaling in the skeleton is supported), names and transformations,
|
||||
animations with rotation, translation and scaling keys.
|
||||
|
@ -1633,4 +1633,11 @@ should read the custom material sektion in the Ogre Blender exporter Help File,
|
|||
can find in scripts/OgreImpoter/Assimp.tlp in the assimp source. If you don't set all values, don't worry, they will be ignored during import.
|
||||
|
||||
If you want more properties in custom materials, you can easily expand the ogre material loader, it will be just a few lines for each property.
|
||||
|
||||
@subsection todo Todo
|
||||
- Load colors in custom materials
|
||||
- extend custom and normal material loading
|
||||
- fix bone hierarchy bug
|
||||
- tes everything elaboratly
|
||||
- check for non existent animation keys (what happens if a one time not all bones have a key?)
|
||||
*/
|
Loading…
Reference in New Issue