Beispiel #1
0
void NIFLoader::calculateTransform()
{
        // Calculate transform
        Matrix4 transform = Matrix4::IDENTITY;
        transform = Matrix4::getScale(vector) * transform;

        // Check whether we have to flip vertex winding.
        // We do have to, if we changed our right hand base.
        // We can test it by using the cross product from X and Y and see, if it is a non-negative
        // projection on Z. Actually it should be exactly Z, as we don't do non-uniform scaling yet,
        // but the test is cheap either way.
        Matrix3 m3;
        transform.extract3x3Matrix(m3);

        if (m3.GetColumn(0).crossProduct(m3.GetColumn(1)).dotProduct(m3.GetColumn(2)) < 0)
        {
        	mFlipVertexWinding = true;
        }

        mTransform = transform;
}
Beispiel #2
0
void DemoApplication::SmoothCamera::Reset (const Vector3& posit, const Quaternion& rotation)
{
	Matrix4 matrix;
	matrix.makeTransform (posit, Vector3 (1.0f, 1.0f, 1.0f), rotation);
	matrix = matrix.transpose();

	Matrix3 rot;
	matrix.extract3x3Matrix(rot);

	Radian rotX;
	Radian rotY;
	Radian rotZ;
	rot.ToEulerAnglesZYX (rotZ, rotY, rotX);

	m_cameraYawAngle = rotY;
	m_cameraPitchAngle = rotX;
	m_cameraTranslation = posit;
	ResetMatrix (&matrix[0][0]);

//	Matrix4 cameraMatrix;
//	InterplateMatrix (0.0f, cameraMatrix[0]);
}