|
发表于 2003-12-31 13:53:00
|
显示全部楼层
Re:成功的编译了引擎部分,但是为什么没找到包含gl.h的文
是我搞错了,渲染的一块的OPENGL我确实没找到,不过找到了D3D的部分。下面的是几段代码
void CShaderAPIDX8: rawMesh( IMeshDX8* pMesh )
{
if ( ShaderUtil()->GetConfig().m_bSuppressRendering )
return;
m_pRenderMesh = pMesh;
SetVertexDecl( m_pRenderMesh->GetVertexFormat(), m_pRenderMesh->HasColorMesh() );
CommitStateChanges();
Assert( m_pRenderMesh && m_pMaterial );
m_pMaterial->DrawMesh( m_pRenderMesh );
m_pRenderMesh = NULL;
}
void CMeshDX8::RenderPass()
{
VPROF( "CMeshDX8::RenderPass" );
MEASURE_TIMED_STAT( MATERIAL_SYSTEM_STATS_DRAW_INDEXED_PRIMITIVE );
HRESULT hr;
Assert( m_Type != MATERIAL_HETEROGENOUS );
for( int iPrim=0; iPrim < s_nPrims; iPrim++ )
{
CPrimList *pPrim = &s_pPrims[iPrim];
if (pPrim->m_NumIndices == 0)
continue;
if (m_Type == MATERIAL_POINTS)
{
RECORD_COMMAND( DX8_DRAW_PRIMITIVE, 3 );
RECORD_INT( m_Mode );
RECORD_INT( s_FirstVertex );
RECORD_INT( pPrim->m_NumIndices );
// (For point lists, we don't actually fill in indices, but we treat it as
// though there are indices for the list up until here).
hr = D3DDevice()->DrawPrimitive( m_Mode, s_FirstVertex, pPrim->m_NumIndices );
MaterialSystemStats()->IncrementCountedStat(MATERIAL_SYSTEM_STATS_NUM_PRIMITIVES, pPrim->m_NumIndices );
}
else
{
int numPrimitives = NumPrimitives( s_NumVertices, pPrim->m_NumIndices );
#ifdef CHECK_INDICES_NOT_RIGHT_NOW_NO_LINELIST_SUPPORT_WHICH_MAKES_THIS_PAINFUL_FOR_DEBUG_MODE
// g_pLastVertex - this is the current vertex buffer
// g_pLastColorMesh - this is the curent color mesh, if there is one.
// g_pLastIndex - this is the current index buffer.
// vertoffset : m_FirstIndex
Assert( m_Mode == D3DPT_TRIANGLELIST || m_Mode == D3DPT_TRIANGLESTRIP );
Assert( pPrim->m_FirstIndex >= 0 && pPrim->m_FirstIndex < g_pLastIndex->IndexCount() );
int i;
for( i = 0; i < 2; i++ )
{
CVertexBuffer *pMesh;
if( i == 0 )
{
pMesh = g_pLastVertex;
Assert( pMesh );
}
else
{
if( !g_pLastColorMesh )
{
continue;
}
pMesh = g_pLastColorMesh->m_pVertexBuffer;
if( !pMesh )
{
continue;
}
}
Assert( s_FirstVertex >= 0 &&
s_FirstVertex + m_FirstIndex < pMesh->VertexCount() );
int numIndices = 0;
if( m_Mode == D3DPT_TRIANGLELIST )
{
numIndices = numPrimitives * 3;
}
else if( m_Mode == D3DPT_TRIANGLESTRIP )
{
numIndices = numPrimitives + 2;
}
else
{
Assert( 0 );
}
int j;
for( j = 0; j < numIndices; j++ )
{
int index = g_pLastIndex->GetShadowIndex( j + pPrim->m_FirstIndex );
Assert( index >= s_FirstVertex );
Assert( index < s_FirstVertex + s_NumVertices );
}
}
#endif // CHECK_INDICES
RECORD_COMMAND( DX8_DRAW_INDEXED_PRIMITIVE, 6 );
RECORD_INT( m_Mode );
RECORD_INT( s_FirstVertex );
RECORD_INT( m_FirstIndex );
RECORD_INT( s_NumVertices );
RECORD_INT( pPrim->m_FirstIndex );
RECORD_INT( numPrimitives );
MaterialSystemStats()->IncrementCountedStat(MATERIAL_SYSTEM_STATS_NUM_PRIMITIVES, numPrimitives );
{
VPROF( "D3DDevice()->DrawIndexedPrimitive" );
hr = D3DDevice()->DrawIndexedPrimitive( m_Mode, m_FirstIndex, s_FirstVertex,
s_NumVertices, pPrim->m_FirstIndex, numPrimitives );
}
}
Assert( !FAILED(hr) );
}
MaterialSystemStats()->IncrementCountedStat(MATERIAL_SYSTEM_STATS_NUM_INDEX_PRIMITIVE_CALLS, 1 );
} |
|