Ogre
- Animations without Scaling Key supported - when the model has more than 1 texcoord, the first one is loaded (instead of nothing) git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1178 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/5/head
parent
521088e134
commit
8c0d3a9a31
|
@ -424,7 +424,10 @@ void OgreImporter::ReadVertexBuffer(SubMesh &theSubMesh, XmlReader *Reader, unsi
|
||||||
DefaultLogger::get()->debug("reading texture coords");
|
DefaultLogger::get()->debug("reading texture coords");
|
||||||
}
|
}
|
||||||
if(theSubMesh.NumUvs>1)
|
if(theSubMesh.NumUvs>1)
|
||||||
DefaultLogger::get()->warn("too many texcoords (just 1 supported!), no texcoords will be loaded!");
|
{
|
||||||
|
DefaultLogger::get()->warn("too many texcoords (just 1 supported!), just the first texcoords will be loaded!");
|
||||||
|
theSubMesh.NumUvs=1;
|
||||||
|
}
|
||||||
//___________________________________________________________________
|
//___________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
|
@ -484,6 +487,11 @@ void OgreImporter::ReadVertexBuffer(SubMesh &theSubMesh, XmlReader *Reader, unsi
|
||||||
NewUv.x=GetAttribute<float>(Reader, "u");
|
NewUv.x=GetAttribute<float>(Reader, "u");
|
||||||
NewUv.y=GetAttribute<float>(Reader, "v")*(-1)+1;//flip the uv vertikal, blender exports them so!
|
NewUv.y=GetAttribute<float>(Reader, "v")*(-1)+1;//flip the uv vertikal, blender exports them so!
|
||||||
theSubMesh.Uvs.push_back(NewUv);
|
theSubMesh.Uvs.push_back(NewUv);
|
||||||
|
|
||||||
|
//skip all the following texcoords:
|
||||||
|
while(Reader->getNodeName()==string("texcoord"))
|
||||||
|
XmlRead(Reader);
|
||||||
|
continue;//don't read another line at the end of the loop
|
||||||
}
|
}
|
||||||
|
|
||||||
//Attribute could not be read
|
//Attribute could not be read
|
||||||
|
@ -762,35 +770,46 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
|
||||||
Keyframe NewKeyframe;
|
Keyframe NewKeyframe;
|
||||||
NewKeyframe.Time=GetAttribute<float>(SkeletonFile, "time");
|
NewKeyframe.Time=GetAttribute<float>(SkeletonFile, "time");
|
||||||
|
|
||||||
//Position:
|
//loop over the attributes:
|
||||||
XmlRead(SkeletonFile);
|
|
||||||
if(string("translate")!=SkeletonFile->getNodeName())
|
|
||||||
throw DeadlyImportError("translate node not first in keyframe");
|
|
||||||
NewKeyframe.Position.x=GetAttribute<float>(SkeletonFile, "x");
|
|
||||||
NewKeyframe.Position.y=GetAttribute<float>(SkeletonFile, "y");
|
|
||||||
NewKeyframe.Position.z=GetAttribute<float>(SkeletonFile, "z");
|
|
||||||
|
|
||||||
//Rotation:
|
while(true)
|
||||||
XmlRead(SkeletonFile);
|
{
|
||||||
if(string("rotate")!=SkeletonFile->getNodeName())
|
XmlRead(SkeletonFile);
|
||||||
throw DeadlyImportError("rotate is not second node in keyframe");
|
|
||||||
float RotationAngle=GetAttribute<float>(SkeletonFile, "angle");
|
|
||||||
aiVector3D RotationAxis;
|
|
||||||
XmlRead(SkeletonFile);
|
|
||||||
if(string("axis")!=SkeletonFile->getNodeName())
|
|
||||||
throw DeadlyImportError("No axis for keyframe rotation!");
|
|
||||||
RotationAxis.x=GetAttribute<float>(SkeletonFile, "x");
|
|
||||||
RotationAxis.y=GetAttribute<float>(SkeletonFile, "y");
|
|
||||||
RotationAxis.z=GetAttribute<float>(SkeletonFile, "z");
|
|
||||||
NewKeyframe.Rotation=aiQuaternion(RotationAxis, RotationAngle);
|
|
||||||
|
|
||||||
//Scaling:
|
//Position:
|
||||||
XmlRead(SkeletonFile);
|
if(string("translate")==SkeletonFile->getNodeName())
|
||||||
if(string("scale")!=SkeletonFile->getNodeName())
|
{
|
||||||
throw DeadlyImportError("no scalling key in keyframe!");
|
NewKeyframe.Position.x=GetAttribute<float>(SkeletonFile, "x");
|
||||||
NewKeyframe.Scaling.x=GetAttribute<float>(SkeletonFile, "x");
|
NewKeyframe.Position.y=GetAttribute<float>(SkeletonFile, "y");
|
||||||
NewKeyframe.Scaling.y=GetAttribute<float>(SkeletonFile, "y");
|
NewKeyframe.Position.z=GetAttribute<float>(SkeletonFile, "z");
|
||||||
NewKeyframe.Scaling.z=GetAttribute<float>(SkeletonFile, "z");
|
}
|
||||||
|
|
||||||
|
//Rotation:
|
||||||
|
else if(string("rotate")!=SkeletonFile->getNodeName())
|
||||||
|
{
|
||||||
|
float RotationAngle=GetAttribute<float>(SkeletonFile, "angle");
|
||||||
|
aiVector3D RotationAxis;
|
||||||
|
XmlRead(SkeletonFile);
|
||||||
|
if(string("axis")!=SkeletonFile->getNodeName())
|
||||||
|
throw DeadlyImportError("No axis for keyframe rotation!");
|
||||||
|
RotationAxis.x=GetAttribute<float>(SkeletonFile, "x");
|
||||||
|
RotationAxis.y=GetAttribute<float>(SkeletonFile, "y");
|
||||||
|
RotationAxis.z=GetAttribute<float>(SkeletonFile, "z");
|
||||||
|
NewKeyframe.Rotation=aiQuaternion(RotationAxis, RotationAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Scaling:
|
||||||
|
else if(string("scale")==SkeletonFile->getNodeName())
|
||||||
|
{
|
||||||
|
NewKeyframe.Scaling.x=GetAttribute<float>(SkeletonFile, "x");
|
||||||
|
NewKeyframe.Scaling.y=GetAttribute<float>(SkeletonFile, "y");
|
||||||
|
NewKeyframe.Scaling.z=GetAttribute<float>(SkeletonFile, "z");
|
||||||
|
}
|
||||||
|
|
||||||
|
//we suppose, that we read all attributes and this is a new keyframe or the end of the animation
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NewTrack.Keyframes.push_back(NewKeyframe);
|
NewTrack.Keyframes.push_back(NewKeyframe);
|
||||||
|
|
Loading…
Reference in New Issue