-------------------------------------------------------------------------------------- Description: Creates a combined vertex declaration for base mesh and instance data. --------------------------------------------------------------------------------------
| 499 | // Creates a combined vertex declaration for base mesh and instance data. |
| 500 | // -------------------------------------------------------------------------------------- |
| 501 | void Tr2InstancedMesh::CreateVertexDeclaration() const |
| 502 | { |
| 503 | m_vertexDeclaration = Tr2EffectStateManager::UNINITIALIZED_DECLARATION; |
| 504 | m_instanceDeclaration = Tr2EffectStateManager::UNINITIALIZED_DECLARATION; |
| 505 | |
| 506 | if( !Tr2Renderer::IsResourceCreationAllowed() ) |
| 507 | { |
| 508 | return; |
| 509 | } |
| 510 | |
| 511 | if( !GetInstanceGeometryResource() || !GetInstanceGeometryResource()->IsInstanceDataReady() ) |
| 512 | { |
| 513 | return; |
| 514 | } |
| 515 | |
| 516 | const unsigned declaration = GetInstanceGeometryResource()->GetInstanceBufferVertexDeclaration( m_instanceMeshIndex ); |
| 517 | m_instanceDeclaration = declaration; |
| 518 | |
| 519 | if( declaration == Tr2EffectStateManager::UNINITIALIZED_DECLARATION ) |
| 520 | { |
| 521 | return; |
| 522 | } |
| 523 | Tr2VertexDefinition instanceVD; |
| 524 | if( !Tr2EffectStateManager::GetVertexDeclarationElements( declaration, instanceVD ) ) |
| 525 | { |
| 526 | return; |
| 527 | } |
| 528 | Tr2VertexDefinition meshVD; |
| 529 | if( GetMeshVertexDeclaration( GetGeometryResource(), m_meshIndex, meshVD ) ) |
| 530 | { |
| 531 | m_vertexDeclaration = MergeVertexDeclarations( meshVD, instanceVD ); |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | unsigned int Tr2InstancedMesh::GetVertexDeclaration() const |
| 536 | { |
nothing calls this directly
no test coverage detected