Exemplo n.º 1
0
ccGLMatrix ccGLMatrix::Interpolate(float coef, const ccGLMatrix& glMat1, const ccGLMatrix& glMat2)
{
	//we compute the transformation matrix between glMat1 and glMat2
	ccGLMatrix invTrans1 = glMat1.inverse();
	ccGLMatrix m12 = invTrans1 * glMat2;

    CCVector3 axis,tr;
	float alpha;
	m12.getParameters(alpha,axis,tr);

	//we only have to interpolate the angle value
	alpha *= coef;
	//and the translation
	tr *= coef;

	//we build-up the resulting matrix
	m12.initFromParameters(alpha,axis,tr);

	//eventually we build-up resulting transformation
	return glMat1 * m12;
}