add RageDisplay::DrawSymmetricQuadStrip
This commit is contained in:
@@ -834,6 +834,27 @@ void RageDisplay::DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, floa
|
|||||||
this->DrawLineStripInternal( v, iNumVerts, LineWidth );
|
this->DrawLineStripInternal( v, iNumVerts, LineWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draw a strip of:
|
||||||
|
*
|
||||||
|
* 0..1..2
|
||||||
|
* . /.\ .
|
||||||
|
* ./ . \.
|
||||||
|
* 3..4..5
|
||||||
|
* . /.\ .
|
||||||
|
* ./ . \.
|
||||||
|
* 6..7..8
|
||||||
|
*/
|
||||||
|
|
||||||
|
void RageDisplay::DrawSymmetricQuadStrip( const RageSpriteVertex v[], int iNumVerts )
|
||||||
|
{
|
||||||
|
ASSERT( iNumVerts >= 3 );
|
||||||
|
|
||||||
|
this->DrawSymmetricQuadStripInternal( v, iNumVerts );
|
||||||
|
|
||||||
|
StatsAddVerts( iNumVerts );
|
||||||
|
}
|
||||||
|
|
||||||
void RageDisplay::DrawCircle( const RageSpriteVertex &v, float radius )
|
void RageDisplay::DrawCircle( const RageSpriteVertex &v, float radius )
|
||||||
{
|
{
|
||||||
this->DrawCircleInternal( v, radius );
|
this->DrawCircleInternal( v, radius );
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ public:
|
|||||||
void DrawTriangles( const RageSpriteVertex v[], int iNumVerts );
|
void DrawTriangles( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawCompiledGeometry( const RageCompiledGeometry *p, int iMeshIndex, const vector<msMesh> &vMeshes );
|
void DrawCompiledGeometry( const RageCompiledGeometry *p, int iMeshIndex, const vector<msMesh> &vMeshes );
|
||||||
void DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
void DrawLineStrip( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
||||||
|
void DrawSymmetricQuadStrip( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawCircle( const RageSpriteVertex &v, float radius );
|
void DrawCircle( const RageSpriteVertex &v, float radius );
|
||||||
|
|
||||||
void DrawQuad( const RageSpriteVertex v[] ) { DrawQuads(v,4); } /* alias. upper-left, upper-right, lower-left, lower-right */
|
void DrawQuad( const RageSpriteVertex v[] ) { DrawQuads(v,4); } /* alias. upper-left, upper-right, lower-left, lower-right */
|
||||||
@@ -296,6 +297,7 @@ protected:
|
|||||||
virtual void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
virtual void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||||
virtual void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ) = 0;
|
virtual void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ) = 0;
|
||||||
virtual void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
virtual void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
||||||
|
virtual void DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
|
||||||
virtual void DrawCircleInternal( const RageSpriteVertex &v, float radius );
|
virtual void DrawCircleInternal( const RageSpriteVertex &v, float radius );
|
||||||
|
|
||||||
// return RString() if mode change was successful, an error message otherwise.
|
// return RString() if mode change was successful, an error message otherwise.
|
||||||
|
|||||||
@@ -989,6 +989,48 @@ void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RageDisplay_D3D::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], int iNumVerts )
|
||||||
|
{
|
||||||
|
int iNumPieces = (iNumVerts-3)/3;
|
||||||
|
int iNumTriangles = iNumPieces*4;
|
||||||
|
int iNumIndices = iNumTriangles*3;
|
||||||
|
|
||||||
|
// make a temporary index buffer
|
||||||
|
static vector<uint16_t> vIndices;
|
||||||
|
unsigned uOldSize = vIndices.size();
|
||||||
|
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices);
|
||||||
|
vIndices.resize( uNewSize );
|
||||||
|
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
|
||||||
|
{
|
||||||
|
// { 1, 3, 0 } { 1, 4, 3 } { 1, 5, 4 } { 1, 2, 5 }
|
||||||
|
vIndices[i*12+0] = i*3+1;
|
||||||
|
vIndices[i*12+1] = i*3+3;
|
||||||
|
vIndices[i*12+2] = i*3+0;
|
||||||
|
vIndices[i*12+3] = i*3+1;
|
||||||
|
vIndices[i*12+4] = i*3+4;
|
||||||
|
vIndices[i*12+5] = i*3+3;
|
||||||
|
vIndices[i*12+6] = i*3+1;
|
||||||
|
vIndices[i*12+7] = i*3+5;
|
||||||
|
vIndices[i*12+8] = i*3+4;
|
||||||
|
vIndices[i*12+9] = i*3+1;
|
||||||
|
vIndices[i*12+10] = i*3+2;
|
||||||
|
vIndices[i*12+11] = i*3+5;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
|
SendCurrentMatrices();
|
||||||
|
g_pd3dDevice->DrawIndexedPrimitiveUP(
|
||||||
|
D3DPT_TRIANGLELIST, // PrimitiveType
|
||||||
|
0, // MinIndex
|
||||||
|
iNumVerts, // NumVertices
|
||||||
|
iNumTriangles, // PrimitiveCount,
|
||||||
|
&vIndices[0], // pIndexData,
|
||||||
|
D3DFMT_INDEX16, // IndexDataFormat,
|
||||||
|
v, // pVertexStreamZeroData,
|
||||||
|
sizeof(RageSpriteVertex) // VertexStreamZeroStride
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void RageDisplay_D3D::DrawFanInternal( const RageSpriteVertex v[], int iNumVerts )
|
void RageDisplay_D3D::DrawFanInternal( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex );
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ protected:
|
|||||||
void DrawFanInternal( const RageSpriteVertex v[], int iNumVerts );
|
void DrawFanInternal( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawStripInternal( const RageSpriteVertex v[], int iNumVerts );
|
void DrawStripInternal( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts );
|
void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts );
|
||||||
|
void DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex );
|
void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex );
|
||||||
|
|
||||||
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut );
|
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut );
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ protected:
|
|||||||
void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ) { }
|
void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ) { }
|
||||||
void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ) { }
|
void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ) { }
|
||||||
void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { }
|
void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { }
|
||||||
|
void DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], int iNumVerts ) { }
|
||||||
|
|
||||||
VideoModeParams m_Params;
|
VideoModeParams m_Params;
|
||||||
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) { m_Params = p; return RString(); }
|
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ) { m_Params = p; return RString(); }
|
||||||
|
|||||||
@@ -1209,6 +1209,45 @@ void RageDisplay_OGL::DrawQuadStripInternal( const RageSpriteVertex v[], int iNu
|
|||||||
glDrawArrays( GL_QUAD_STRIP, 0, iNumVerts );
|
glDrawArrays( GL_QUAD_STRIP, 0, iNumVerts );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RageDisplay_OGL::DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], int iNumVerts )
|
||||||
|
{
|
||||||
|
int iNumPieces = (iNumVerts-3)/3;
|
||||||
|
int iNumTriangles = iNumPieces*4;
|
||||||
|
int iNumIndices = iNumTriangles*3;
|
||||||
|
|
||||||
|
// make a temporary index buffer
|
||||||
|
static vector<uint16_t> vIndices;
|
||||||
|
unsigned uOldSize = vIndices.size();
|
||||||
|
unsigned uNewSize = max(uOldSize,(unsigned)iNumIndices);
|
||||||
|
vIndices.resize( uNewSize );
|
||||||
|
for( uint16_t i=(uint16_t)uOldSize/12; i<(uint16_t)iNumPieces; i++ )
|
||||||
|
{
|
||||||
|
// { 1, 3, 0 } { 1, 4, 3 } { 1, 5, 4 } { 1, 2, 5 }
|
||||||
|
vIndices[i*12+0] = i*3+1;
|
||||||
|
vIndices[i*12+1] = i*3+3;
|
||||||
|
vIndices[i*12+2] = i*3+0;
|
||||||
|
vIndices[i*12+3] = i*3+1;
|
||||||
|
vIndices[i*12+4] = i*3+4;
|
||||||
|
vIndices[i*12+5] = i*3+3;
|
||||||
|
vIndices[i*12+6] = i*3+1;
|
||||||
|
vIndices[i*12+7] = i*3+5;
|
||||||
|
vIndices[i*12+8] = i*3+4;
|
||||||
|
vIndices[i*12+9] = i*3+1;
|
||||||
|
vIndices[i*12+10] = i*3+2;
|
||||||
|
vIndices[i*12+11] = i*3+5;
|
||||||
|
}
|
||||||
|
|
||||||
|
TurnOffHardwareVBO();
|
||||||
|
SendCurrentMatrices();
|
||||||
|
|
||||||
|
SetupVertices( v, iNumVerts );
|
||||||
|
glDrawElements(
|
||||||
|
GL_TRIANGLES,
|
||||||
|
iNumIndices,
|
||||||
|
GL_UNSIGNED_SHORT,
|
||||||
|
&vIndices[0] );
|
||||||
|
}
|
||||||
|
|
||||||
void RageDisplay_OGL::DrawFanInternal( const RageSpriteVertex v[], int iNumVerts )
|
void RageDisplay_OGL::DrawFanInternal( const RageSpriteVertex v[], int iNumVerts )
|
||||||
{
|
{
|
||||||
TurnOffHardwareVBO();
|
TurnOffHardwareVBO();
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ protected:
|
|||||||
void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts );
|
void DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts );
|
||||||
void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex );
|
void DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex );
|
||||||
void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
|
||||||
|
void DrawSymmetricQuadStripInternal( const RageSpriteVertex v[], int iNumVerts );
|
||||||
|
|
||||||
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut );
|
RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut );
|
||||||
RageSurface* CreateScreenshot();
|
RageSurface* CreateScreenshot();
|
||||||
|
|||||||
Reference in New Issue
Block a user