move some code out of the header
This commit is contained in:
@@ -473,6 +473,23 @@ void RageDisplay::LoadMenuPerspective( float fovDegrees, float fVanishPointX, fl
|
|||||||
-fVanishPointX+SCREEN_CENTER_X, -fVanishPointY+SCREEN_CENTER_Y, 0,
|
-fVanishPointX+SCREEN_CENTER_X, -fVanishPointY+SCREEN_CENTER_Y, 0,
|
||||||
0.0f, 1.0f, 0.0f) );
|
0.0f, 1.0f, 0.0f) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float fDAR = GetVideoModeParams().fDisplayAspectRatio;
|
||||||
|
const float fOutputDAR = GetVideoModeParams().fOutputDisplayAspectRatio;
|
||||||
|
|
||||||
|
if( fOutputDAR != -1 && fabsf(fDAR-fOutputDAR) > 0.001f )
|
||||||
|
{
|
||||||
|
if( fOutputDAR > fDAR )
|
||||||
|
{
|
||||||
|
/* Letterboxed horizontally (showing widescreen on a regular monitor). */
|
||||||
|
float fYAdjust = fDAR / fOutputDAR;
|
||||||
|
g_ProjectionStack.Scale( 1, fYAdjust, 1 );
|
||||||
|
} else {
|
||||||
|
/* Letterboxed vertically (showing 4:3 on a widescreen monitor). */
|
||||||
|
float fXAdjust = fOutputDAR / fDAR;
|
||||||
|
g_ProjectionStack.Scale( fXAdjust, 1, 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -719,6 +736,41 @@ void RageDisplay::DrawCircle( const RageSpriteVertex &v, float radius )
|
|||||||
this->DrawCircleInternal( v, radius );
|
this->DrawCircleInternal( v, radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RageCompiledGeometry::~RageCompiledGeometry()
|
||||||
|
{
|
||||||
|
m_bNeedsNormals = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RageCompiledGeometry::Set( const vector<msMesh> &vMeshes, bool bNeedsNormals )
|
||||||
|
{
|
||||||
|
m_bNeedsNormals = bNeedsNormals;
|
||||||
|
|
||||||
|
size_t totalVerts = 0;
|
||||||
|
size_t totalTriangles = 0;
|
||||||
|
|
||||||
|
m_vMeshInfo.resize( vMeshes.size() );
|
||||||
|
for( unsigned i=0; i<vMeshes.size(); i++ )
|
||||||
|
{
|
||||||
|
const msMesh& mesh = vMeshes[i];
|
||||||
|
const vector<RageModelVertex> &Vertices = mesh.Vertices;
|
||||||
|
const vector<msTriangle> &Triangles = mesh.Triangles;
|
||||||
|
|
||||||
|
MeshInfo& meshInfo = m_vMeshInfo[i];
|
||||||
|
|
||||||
|
meshInfo.iVertexStart = totalVerts;
|
||||||
|
meshInfo.iVertexCount = Vertices.size();
|
||||||
|
meshInfo.iTriangleStart = totalTriangles;
|
||||||
|
meshInfo.iTriangleCount = Triangles.size();
|
||||||
|
|
||||||
|
totalVerts += Vertices.size();
|
||||||
|
totalTriangles += Triangles.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->Allocate( vMeshes );
|
||||||
|
|
||||||
|
Change( vMeshes );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
|
* Copyright (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -17,48 +17,17 @@ const int MAX_TEXTURE_UNITS = 2;
|
|||||||
class RageCompiledGeometry
|
class RageCompiledGeometry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~RageCompiledGeometry()
|
virtual ~RageCompiledGeometry();
|
||||||
{
|
|
||||||
m_bNeedsNormals = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Set( const vector<msMesh> &vMeshes, bool bNeedsNormals )
|
void Set( const vector<msMesh> &vMeshes, bool bNeedsNormals );
|
||||||
{
|
|
||||||
m_bNeedsNormals = bNeedsNormals;
|
|
||||||
|
|
||||||
size_t totalVerts = 0;
|
|
||||||
size_t totalTriangles = 0;
|
|
||||||
|
|
||||||
m_vMeshInfo.resize( vMeshes.size() );
|
|
||||||
for( unsigned i=0; i<vMeshes.size(); i++ )
|
|
||||||
{
|
|
||||||
const msMesh& mesh = vMeshes[i];
|
|
||||||
const vector<RageModelVertex> &Vertices = mesh.Vertices;
|
|
||||||
const vector<msTriangle> &Triangles = mesh.Triangles;
|
|
||||||
|
|
||||||
MeshInfo& meshInfo = m_vMeshInfo[i];
|
|
||||||
|
|
||||||
meshInfo.iVertexStart = totalVerts;
|
|
||||||
meshInfo.iVertexCount = Vertices.size();
|
|
||||||
meshInfo.iTriangleStart = totalTriangles;
|
|
||||||
meshInfo.iTriangleCount = Triangles.size();
|
|
||||||
|
|
||||||
totalVerts += Vertices.size();
|
|
||||||
totalTriangles += Triangles.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->Allocate( vMeshes );
|
|
||||||
|
|
||||||
Change( vMeshes );
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Allocate( const vector<msMesh> &vMeshes ) = 0; // allocate space
|
virtual void Allocate( const vector<msMesh> &vMeshes ) = 0; // allocate space
|
||||||
virtual void Change( const vector<msMesh> &vMeshes ) = 0; // new data must be the same size as was passed to Set()
|
virtual void Change( const vector<msMesh> &vMeshes ) = 0; // new data must be the same size as was passed to Set()
|
||||||
virtual void Draw( int iMeshIndex ) const = 0;
|
virtual void Draw( int iMeshIndex ) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
size_t GetTotalVertices() { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iVertexStart + m_vMeshInfo.back().iVertexCount; }
|
size_t GetTotalVertices() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iVertexStart + m_vMeshInfo.back().iVertexCount; }
|
||||||
size_t GetTotalTriangles() { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iTriangleStart + m_vMeshInfo.back().iTriangleCount; }
|
size_t GetTotalTriangles() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iTriangleStart + m_vMeshInfo.back().iTriangleCount; }
|
||||||
|
|
||||||
struct MeshInfo
|
struct MeshInfo
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user