Avoid allocating vertex indices in obj exporter

This commit is contained in:
Hans Goudey 2023-01-18 18:44:15 -06:00
parent 37d5248b2a
commit 2a98a1c133
3 changed files with 3 additions and 3 deletions

View File

@ -348,7 +348,7 @@ void OBJWriter::write_poly_elements(FormatHandler &fh,
int prev_i = obj_mesh_data.remap_poly_index(idx - 1);
int i = obj_mesh_data.remap_poly_index(idx);
Vector<int> poly_vertex_indices = obj_mesh_data.calc_poly_vertex_indices(i);
Span<int> poly_vertex_indices = obj_mesh_data.calc_poly_vertex_indices(i);
Span<int> poly_uv_indices = obj_mesh_data.calc_poly_uv_indices(i);
Vector<int> poly_normal_indices = obj_mesh_data.calc_poly_normal_indices(i);

View File

@ -276,7 +276,7 @@ float3 OBJMesh::calc_vertex_coords(const int vert_index, const float global_scal
return r_coords;
}
Vector<int> OBJMesh::calc_poly_vertex_indices(const int poly_index) const
Span<int> OBJMesh::calc_poly_vertex_indices(const int poly_index) const
{
const MPoly &mpoly = mesh_polys_[poly_index];
return mesh_corner_verts_.slice(mpoly.loopstart, mpoly.totloop);

View File

@ -151,7 +151,7 @@ class OBJMesh : NonCopyable {
/**
* Calculate vertex indices of all vertices of the polygon at the given index.
*/
Vector<int> calc_poly_vertex_indices(int poly_index) const;
Span<int> calc_poly_vertex_indices(int poly_index) const;
/**
* Calculate UV vertex coordinates of an Object.
* Stores the coordinates and UV vertex indices in the member variables.