[fixed] in CSkinnedMesh may be bug...

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
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

[fixed] in CSkinnedMesh may be bug...

Post by gbox »

Code: Select all


void CSkinnedMesh::buildAll_LocalAnimatedMatrices()
{
	for (u32 i=0; i<AllJoints.size(); ++i)
	{
		SJoint *joint = AllJoints[i];

		//Could be faster:

		if (joint->UseAnimationFrom &&
			(joint->UseAnimationFrom->PositionKeys.size() ||
			 joint->UseAnimationFrom->ScaleKeys.size() ||
			 joint->UseAnimationFrom->RotationKeys.size() ))
		{
			joint->LocalAnimatedMatrix=joint->Animatedrotation.getMatrix();

			// --- joint->LocalAnimatedMatrix *= joint->Animatedrotation.getMatrix() ---
			f32 *m1 = joint->LocalAnimatedMatrix.pointer();
			core::vector3df &Pos = joint->Animatedposition;
			m1[0] += Pos.X*m1[3];
			m1[1] += Pos.Y*m1[3];
			m1[2] += Pos.Z*m1[3];
			m1[4] += Pos.X*m1[7];
			m1[5] += Pos.Y*m1[7];
			m1[6] += Pos.Z*m1[7];
			m1[8] += Pos.X*m1[11];
			m1[9] += Pos.Y*m1[11];
			m1[10] += Pos.Z*m1[11];
			m1[12] += Pos.X*m1[15];
			m1[13] += Pos.Y*m1[15];
			m1[14] += Pos.Z*m1[15];
			// -----------------------------------

			joint->GlobalSkinningSpace=false;

			if (joint->ScaleKeys.size())
			{
				/*
				core::matrix4 scaleMatrix;
				scaleMatrix.setScale(joint->Animatedscale);
				joint->LocalAnimatedMatrix *= scaleMatrix;
				*/

				// -------- joint->LocalAnimatedMatrix *= scaleMatrix -----------------
				f32 *m1 = joint->LocalAnimatedMatrix.pointer();
				m1[0] *= joint->Animatedscale.X;
				m1[1] *= joint->Animatedscale.X;
				m1[2] *= joint->Animatedscale.X;
				m1[3] *= joint->Animatedscale.X;
				m1[4] *= joint->Animatedscale.Y;
				m1[5] *= joint->Animatedscale.Y;
				m1[6] *= joint->Animatedscale.Y;
				m1[7] *= joint->Animatedscale.Y;
				m1[8] *= joint->Animatedscale.Z;
				m1[9] *= joint->Animatedscale.Z;
				m1[10] *= joint->Animatedscale.Z;
				m1[11] *= joint->Animatedscale.Z;
				m1[12] *= joint->Animatedscale.X; <-----[b]-what is this????????????[/b]
				// -----------------------------------

			}
		}
		else
		{
			joint->LocalAnimatedMatrix=joint->LocalMatrix;
		}
	}
}

m1[12] *= joint->Animatedscale.X;

what is this??
it may cause wrong result?!?
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

can you give more information as to what you think is wrong?

I just striped irrlicht's matrix product code for when the second matrix only has scale data. but I may have slipped up somewhere?
[url=irc://irc.freenode.net/irrlicht]irrlicht irc[/url] - corrodinggames.com
gbox
Posts: 37
Joined: Mon May 01, 2006 3:41 am
Location: jeonju, korea
Contact:

Post by gbox »

Code: Select all

f32 *m1 = joint->LocalAnimatedMatrix.pointer();
				m1[0] *= joint->Animatedscale.X;
				m1[1] *= joint->Animatedscale.X;
				m1[2] *= joint->Animatedscale.X;
				m1[3] *= joint->Animatedscale.X;
				m1[4] *= joint->Animatedscale.Y;
				m1[5] *= joint->Animatedscale.Y;
				m1[6] *= joint->Animatedscale.Y;
				m1[7] *= joint->Animatedscale.Y;
				m1[8] *= joint->Animatedscale.Z;
				m1[9] *= joint->Animatedscale.Z;
				m1[10] *= joint->Animatedscale.Z;
				m1[11] *= joint->Animatedscale.Z;
				//m1[12] *= joint->Animatedscale.X;
for scale
it may be modify like this?

i cant found any wrong result but it may go wrong....
http://cafe.naver.com/jcga

professor of Jelabukdo Game Engine Academy
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

your right, must have skipped up. thanks for finding it.

in the svn.
[url=irc://irc.freenode.net/irrlicht]irrlicht irc[/url] - corrodinggames.com
Post Reply