[fixed] .x loader messing up frame hierarchy

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
jolindien
Posts: 16
Joined: Sun Jul 16, 2006 3:00 pm
Location: Lyon (France)

[fixed] .x loader messing up frame hierarchy

Post by jolindien »

hi guys, i think there's a bug in the .x loader, destroying the frame hierarchy.

in CXFileReader.cpp, bool CXFileReader::parseDataObject()

code is :

Code: Select all

if (objectName == "Frame")
   return parseDataObjectFrame(RootFrame);
else
and should be :

Code: Select all

if (objectName == "Frame")
{
     RootFrame.ChildFrames.push_back(SXFrame());
    return parseDataObjectFrame(RootFrame.ChildFrames[RootFrame.ChildFrames.size()-1]);
}
else
And in CXAnimationPlayer.cpp, void CXAnimationPlayer::addFacesToBuffer(s32 meshbuffernr, CXFileReader::SXMesh& mesh, s32 matnr, const CXFileReader::SXFrame& frame)

code is (no code, only comments):

Code: Select all

	// transform vertices and normals
	/*core::matrix4 mat = frame.LocalMatrix;
	mat.makeInverse();

	s32 vcnt = buf->Vertices.size();
	for (s32 u=0; u<vcnt; ++u)
	{
		mat.transformVect(buf->Vertices[u].Pos);
		mat.inverseRotateVect(buf->Vertices[u].Normal);
	}*/
and should be :

Code: Select all

	core::matrix4 mat = frame.GlobalMatrix;

	s32 vcnt = buf->Vertices.size();
	for (s32 u=0; u<vcnt; ++u)
	{
		mat.transformVect(buf->Vertices[u].Pos);
		mat.rotateVect(buf->Vertices[u].Normal);
	}
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

have you got a test mesh? this fix still doesn't work with my nested frame test mesh, but i guess it's something to do with animation
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply