IMatrix INodeLight::GetProjectionMatrix(int i)
	{
		IMatrix invRot;
		//Spot
		/*invRot = GetRotationMatrix4x4();
		invRot.Inv(invRot);*/
		//Omni
		if (i==0)
		{
			invRot.MakeIdentity();
			invRot=AngleYToMatrix4x4(0);
		}else if (i==1)
		{
			invRot=AngleYToMatrix4x4(I_PIE);
		}else if (i==2)
		{
			invRot=AngleYToMatrix4x4(I_PIE/2.0);
		}else if (i==3)
		{
			invRot=AngleYToMatrix4x4(-I_PIE/2.0);
		}else if (i==4)
		{
			invRot=AngleXToMatrix4x4(I_PIE/2.0);
		}else if (i==5)
		{
			invRot=AngleXToMatrix4x4(-I_PIE/2.0);
		}
		IMatrix mat = GetPerspectiveMatrix(90,1,m_fRadius,0.01)*invRot*TranslationToMatrix(-GetPosition());
		return mat;
	}
Beispiel #2
0
/* gluLookAt.  The result is pre-multiplied to the matrix (M = L * M) instead of
 * post-multiplied. */
void RageDisplay::LoadLookAt(float fov, const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up)
{
	float aspect = GetVideoModeParams().fDisplayAspectRatio;
	g_ProjectionStack.LoadMatrix( GetPerspectiveMatrix(fov, aspect, 1, 1000) );
	/* Flip the Y coordinate, so positive numbers go down. */
	g_ProjectionStack.Scale(1, -1, 1);

	g_ViewStack.LoadMatrix(RageLookAt(Eye.x, Eye.y, Eye.z, At.x, At.y, At.z, Up.x, Up.y, Up.z));
}