void RageDisplay_D3D::DrawQuadStripInternal( const RageSpriteVertex v[], int iNumVerts ) { // there isn't a quad strip primitive in D3D, so we have to fake it with indexed triangles int iNumQuads = (iNumVerts-2)/2; int iNumTriangles = iNumQuads*2; 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/6; i<(uint16_t)iNumQuads; i++ ) { vIndices[i*6+0] = i*2+0; vIndices[i*6+1] = i*2+1; vIndices[i*6+2] = i*2+2; vIndices[i*6+3] = i*2+1; vIndices[i*6+4] = i*2+2; vIndices[i*6+5] = i*2+3; } g_pd3dDevice->SetFVF( 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::DrawTrianglesInternal( const RageSpriteVertex v[], int iNumVerts ) { g_pd3dDevice->SetFVF( D3DFVF_RageSpriteVertex ); SendCurrentMatrices(); g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLELIST, // PrimitiveType iNumVerts/3, // PrimitiveCount, v, // pVertexStreamZeroData, sizeof(RageSpriteVertex) ); }
void RageDisplay_D3D::DrawStripInternal( const RageSpriteVertex v[], int iNumVerts ) { g_pd3dDevice->SetVertexShader( D3DFVF_RageSpriteVertex ); SendCurrentMatrices(); g_pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLESTRIP, // PrimitiveType iNumVerts-2, // PrimitiveCount, v, // pVertexStreamZeroData, sizeof(RageSpriteVertex) ); }
void RageDisplay_D3D::DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ) { SendCurrentMatrices(); DWORD bLighting; g_pd3dDevice->GetRenderState( D3DRS_LIGHTING, &bLighting ); if( !bLighting ) { g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_TFACTOR ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR ); } p->Draw( iMeshIndex ); if( !bLighting ) { g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_CURRENT ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT ); } }
void RageDisplay_D3D::DrawCompiledGeometryInternal( const RageCompiledGeometry *p, int iMeshIndex ) { SendCurrentMatrices(); p->Draw( iMeshIndex ); }