-------------------------------------------------------------------------------------- Description: Invalidates vertex buffer, prepares instance data for a new vertex format, ensures vertex declaration matches the layout provided, and that all attributes come from stream 0. --------------------------------------------------------------------------------------
| 128 | // come from stream 0. |
| 129 | // -------------------------------------------------------------------------------------- |
| 130 | void Tr2DirectInstanceData::SetLayout( const Tr2VertexDefinition& layout ) |
| 131 | { |
| 132 | m_vertexBuffer = Tr2BufferAL(); |
| 133 | m_stride = 0; |
| 134 | m_count = 0; |
| 135 | for( auto it = layout.m_items.begin(); it != layout.m_items.end(); ++it ) |
| 136 | { |
| 137 | if( it->m_stream != 0 ) |
| 138 | { |
| 139 | CCP_LOGERR( "Tr2DirectInstanceData: vertex layout needs to reference stream 0 only" ); |
| 140 | return; |
| 141 | } |
| 142 | m_stride = std::max( m_stride, it->m_offset + layout.GetDataTypeSizeInBytes( it->m_dataType ) ); |
| 143 | } |
| 144 | m_layout = layout; |
| 145 | m_vertexDeclaration = Tr2EffectStateManager::GetVertexDeclarationHandle( m_layout ); |
| 146 | } |
| 147 | |
| 148 | // -------------------------------------------------------------------------------------- |
| 149 | // Description: |
no test coverage detected