| 33 | } |
| 34 | |
| 35 | void Primitive::AddVertex( const PrimitiveVertex& vertex ) { |
| 36 | m_synced = false; |
| 37 | |
| 38 | auto vertice_count = m_vertices.size(); |
| 39 | |
| 40 | // Skip the duplicate search if this vertex is part of the first triangle. |
| 41 | if( vertice_count >= 3 ) { |
| 42 | for( std::size_t index = 0; index < vertice_count; ++index ) { |
| 43 | if( m_vertices[index] == vertex ) { |
| 44 | // Vertex already part of this primitive. Index it. |
| 45 | m_indices.push_back( static_cast<unsigned int>( index ) ); |
| 46 | |
| 47 | return; |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | m_indices.push_back( static_cast<unsigned int>( vertice_count ) ); |
| 53 | m_vertices.push_back( vertex ); |
| 54 | } |
| 55 | |
| 56 | void Primitive::AddTexture( PrimitiveTexture::Ptr texture ) { |
| 57 | m_textures.push_back( texture ); |
no test coverage detected