Esempio n. 1
0
	void Skeleton::generateBoneTransform( Matrix4* matVec , Matrix4 const& baseTrans , float* frames , float* weights , int num )
	{
		assert( mBaseBone->id == 0 );
		matVec[ 0 ] = baseTrans;

		int size = mBoneVec.size();
		for ( int i = 1 ; i < size ; ++i )
		{
			BoneNode* bone = mBoneVec[i];
			Matrix4& boneTrans = matVec[bone->id];
			bone->calcFrameTransform( boneTrans , frames , weights , num );
			TransformUntility::mul( boneTrans , boneTrans , matVec[ bone->parentId ] );
		}
	}
Esempio n. 2
0
	void Skeleton::generateBoneTransform( Matrix4* matVec , Matrix4 const& baseTrans , int frame , float fract )
	{
		assert( 0 <= fract && fract < 1.0f );

		//M( blend ) = M(motion) * M( base )

		assert( mBaseBone->id == 0 );
		matVec[ 0 ] = baseTrans;

		int size = mBoneVec.size();
		for ( int i = 1 ; i < size ; ++i )
		{
			BoneNode* bone = mBoneVec[i];
			Matrix4& boneTrans = matVec[bone->id];
			bone->calcFrameTransform( boneTrans , frame , frame + 1 , fract );
			TransformUntility::mul( boneTrans , boneTrans , matVec[ bone->parentId ] );
		}
	}
Esempio n. 3
0
	void Skeleton::generateInvLoacalTransform()
	{
		assert( mUseInvLocalTrans );

		std::vector< Matrix4 > globalTransVec;
		globalTransVec.resize( mBoneVec.size() );
		globalTransVec[0] = Matrix4::Identity();
		mBaseBone->invLocalTrans = Matrix4::Identity();

		assert( mBaseBone->id == 0 );
		int size = mBoneVec.size();
		for ( int i = 1 ; i < size ; ++i )
		{
			BoneNode* bone = mBoneVec[i];
			Matrix4 const& parentTrans = globalTransVec[ bone->parentId ];

			Matrix4& worldTrans = globalTransVec[ bone->id ];
			bone->calcFrameTransform( worldTrans , 0 );
			TransformUntility::mul( worldTrans , worldTrans , parentTrans );

			float det;
			bool result = worldTrans.inverseAffine( bone->invLocalTrans , det );
		}
	}