Eliminate SCREEN_WIDTH/HEIGHT from RDisplay. It's up to the

user code to pass the desired camera space dimensions to
LoadMenuPerspective (normally done by Screen).  SDimensions.h
is high-level.
This commit is contained in:
Glenn Maynard
2005-12-29 18:33:03 +00:00
parent 118297bdd5
commit cdd516fd74
5 changed files with 19 additions and 18 deletions
+1 -1
View File
@@ -176,7 +176,7 @@ void ActorFrame::DrawPrimitives()
if( m_fFOV != -1 ) if( m_fFOV != -1 )
{ {
DISPLAY->CameraPushMatrix(); DISPLAY->CameraPushMatrix();
DISPLAY->LoadMenuPerspective( m_fFOV, m_fVanishX, m_fVanishY ); DISPLAY->LoadMenuPerspective( m_fFOV, SCREEN_WIDTH, SCREEN_HEIGHT, m_fVanishX, m_fVanishY );
} }
if( m_bOverrideLighting ) if( m_bOverrideLighting )
+1 -1
View File
@@ -799,7 +799,7 @@ void Player::DrawPrimitives()
float fCenterY = this->GetY()+(GRAY_ARROWS_Y_STANDARD+GRAY_ARROWS_Y_REVERSE)/2; float fCenterY = this->GetY()+(GRAY_ARROWS_Y_STANDARD+GRAY_ARROWS_Y_REVERSE)/2;
DISPLAY->LoadMenuPerspective( 45, SCALE(fSkew,0.f,1.f,this->GetX(),SCREEN_CENTER_X), fCenterY ); DISPLAY->LoadMenuPerspective( 45, SCREEN_WIDTH, SCREEN_HEIGHT, SCALE(fSkew,0.f,1.f,this->GetX(),SCREEN_CENTER_X), fCenterY );
if( m_pNoteField ) if( m_pNoteField )
{ {
+14 -15
View File
@@ -10,7 +10,6 @@
#include "RageSurfaceUtils_Zoom.h" #include "RageSurfaceUtils_Zoom.h"
#include "RageSurface.h" #include "RageSurface.h"
#include "Preference.h" #include "Preference.h"
#include "ScreenDimensions.h"
// //
// Statistics stuff // Statistics stuff
@@ -206,7 +205,7 @@ void RageDisplay::SetDefaultRenderStates()
SetBlendMode( BLEND_NORMAL ); SetBlendMode( BLEND_NORMAL );
SetTextureFiltering( true ); SetTextureFiltering( true );
SetZBias( 0 ); SetZBias( 0 );
LoadMenuPerspective(0, SCREEN_CENTER_X, SCREEN_CENTER_Y); // 0 FOV = ortho LoadMenuPerspective( 0, 640, 480, 320, 240 ); // 0 FOV = ortho
ChangeCentering(0,0,0,0); ChangeCentering(0,0,0,0);
} }
@@ -459,12 +458,12 @@ void RageDisplay::TextureTranslate( float x, float y )
} }
void RageDisplay::LoadMenuPerspective( float fovDegrees, float fVanishPointX, float fVanishPointY ) void RageDisplay::LoadMenuPerspective( float fovDegrees, float fWidth, float fHeight, float fVanishPointX, float fVanishPointY )
{ {
/* fovDegrees == 0 gives ortho projection. */ /* fovDegrees == 0 gives ortho projection. */
if( fovDegrees == 0 ) if( fovDegrees == 0 )
{ {
float left = 0, right = SCREEN_WIDTH, bottom = SCREEN_HEIGHT, top = 0; float left = 0, right = fWidth, bottom = fHeight, top = 0;
g_ProjectionStack.LoadMatrix( GetOrthoMatrix(left, right, bottom, top, -1000, +1000) ); g_ProjectionStack.LoadMatrix( GetOrthoMatrix(left, right, bottom, top, -1000, +1000) );
g_ViewStack.LoadIdentity(); g_ViewStack.LoadIdentity();
} }
@@ -473,29 +472,29 @@ void RageDisplay::LoadMenuPerspective( float fovDegrees, float fVanishPointX, fl
CLAMP( fovDegrees, 0.1f, 179.9f ); CLAMP( fovDegrees, 0.1f, 179.9f );
float fovRadians = fovDegrees / 180.f * PI; float fovRadians = fovDegrees / 180.f * PI;
float theta = fovRadians/2; float theta = fovRadians/2;
float fDistCameraFromImage = SCREEN_WIDTH/2 / tanf( theta ); float fDistCameraFromImage = fWidth/2 / tanf( theta );
fVanishPointX = SCALE( fVanishPointX, SCREEN_LEFT, SCREEN_RIGHT, SCREEN_RIGHT, SCREEN_LEFT ); fVanishPointX = SCALE( fVanishPointX, 0, fWidth, fWidth, 0 );
fVanishPointY = SCALE( fVanishPointY, SCREEN_TOP, SCREEN_BOTTOM, SCREEN_BOTTOM, SCREEN_TOP ); fVanishPointY = SCALE( fVanishPointY, 0, fHeight, fHeight, 0 );
fVanishPointX -= SCREEN_CENTER_X; fVanishPointX -= fWidth/2;
fVanishPointY -= SCREEN_CENTER_Y; fVanishPointY -= fHeight/2;
/* It's the caller's responsibility to push first. */ /* It's the caller's responsibility to push first. */
g_ProjectionStack.LoadMatrix( g_ProjectionStack.LoadMatrix(
GetFrustumMatrix( GetFrustumMatrix(
(fVanishPointX-SCREEN_WIDTH/2)/fDistCameraFromImage, (fVanishPointX-fWidth/2)/fDistCameraFromImage,
(fVanishPointX+SCREEN_WIDTH/2)/fDistCameraFromImage, (fVanishPointX+fWidth/2)/fDistCameraFromImage,
(fVanishPointY+SCREEN_HEIGHT/2)/fDistCameraFromImage, (fVanishPointY+fHeight/2)/fDistCameraFromImage,
(fVanishPointY-SCREEN_HEIGHT/2)/fDistCameraFromImage, (fVanishPointY-fHeight/2)/fDistCameraFromImage,
1, 1,
fDistCameraFromImage+1000 ) ); fDistCameraFromImage+1000 ) );
g_ViewStack.LoadMatrix( g_ViewStack.LoadMatrix(
RageLookAt( RageLookAt(
-fVanishPointX+SCREEN_CENTER_X, -fVanishPointY+SCREEN_CENTER_Y, fDistCameraFromImage, -fVanishPointX+fWidth/2, -fVanishPointY+fHeight/2, fDistCameraFromImage,
-fVanishPointX+SCREEN_CENTER_X, -fVanishPointY+SCREEN_CENTER_Y, 0, -fVanishPointX+fWidth/2, -fVanishPointY+fHeight/2, 0,
0.0f, 1.0f, 0.0f) ); 0.0f, 1.0f, 0.0f) );
} }
} }
+1 -1
View File
@@ -293,7 +293,7 @@ public:
/* Projection and View matrix stack functions. */ /* Projection and View matrix stack functions. */
void CameraPushMatrix(); void CameraPushMatrix();
void CameraPopMatrix(); void CameraPopMatrix();
void LoadMenuPerspective( float fovDegrees, float fVanishPointX, float fVanishPointY ); void LoadMenuPerspective( float fFOVDegrees, float fWidth, float fHeight, float fVanishPointX, float fVanishPointY );
void LoadLookAt( float fov, const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up ); void LoadLookAt( float fov, const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up );
/* Centering matrix */ /* Centering matrix */
+2
View File
@@ -59,6 +59,8 @@ bool Screen::SortMessagesByDelayRemaining(const Screen::QueuedScreenMessage &m1,
void Screen::Init() void Screen::Init()
{ {
SetFOV( 0 );
m_smSendOnPop = SM_None; m_smSendOnPop = SM_None;
ActorUtil::LoadAllCommandsFromName( *this, m_sName, "Screen" ); ActorUtil::LoadAllCommandsFromName( *this, m_sName, "Screen" );