-
- first.SetFaceIndices( f1 );
-}
-
-void AtlasManager::StitchMesh( const MeshData& first,
- const MeshData& second,
- MeshData& out,
- bool optimize )
-{
- MeshData::VertexContainer v1 = first.GetVertices();
- MeshData::VertexContainer v2 = second.GetVertices();
- MeshData::FaceIndices f1 = first.GetFaces();
- MeshData::FaceIndices f2 = second.GetFaces();
-
- uint32_t vc1 = first.GetVertexCount();
- uint32_t vc2 = second.GetVertexCount();
-
- MeshData::VertexContainer vertices;
-
- MeshData::FaceIndices faces;
-
- MeshData::Vertex vertex;
-
- for ( uint32_t v = 0; v < vc1; ++v )
- {
- vertices.push_back( v1[ v ] );
- }
-
- for ( uint32_t v = 0; v < vc2; ++v )
- {
- vertices.push_back( v2[ v ] );
- }
-
- for ( uint32_t f = 0; f < f1.size(); ++f )
- {
- faces.push_back( f1[ f ] );
- }
-
- for ( uint32_t f = 0; f < f2.size(); ++f )
- {
- faces.push_back( f2[ f ] + vc1 );
- }
-
- if ( optimize )
- {
- MeshData::VertexContainer optimizedVertices;
- OptimizeVertices( vertices, faces, optimizedVertices );
- out.SetVertices( optimizedVertices );
- }
- else
- {
- out.SetVertices( vertices );
- }
-
- out.SetMaterial( first.GetMaterial() );
- out.SetFaceIndices( faces );