void insert_face_into_mesh() { if (!m_inside_mesh_def) { // Begin the definition of the new mesh. m_builder.begin_mesh(m_mesh_name); m_inside_mesh_def = true; } // Insert the features into the mesh, updating index mappings as necessary. insert_vertices_into_mesh(); insert_vertex_normals_into_mesh(); insert_tex_coords_into_mesh(); // Translate feature indices from internal space to mesh space. translate_indices(m_face_vertex_indices, m_vertex_index_mapping); translate_indices(m_face_normal_indices, m_normal_index_mapping); translate_indices(m_face_tex_coord_indices, m_tex_coord_index_mapping); const size_t n = m_face_vertex_indices.size(); // Begin defining a new face. m_builder.begin_face(n); // Set face vertices. m_builder.set_face_vertices(&m_face_vertex_indices.front()); // Set face vertex normals (if any). if (m_face_normal_indices.size() == n) m_builder.set_face_vertex_normals(&m_face_normal_indices.front()); // Set face vertex texture coordinates (if any). if (m_face_tex_coord_indices.size() == n) m_builder.set_face_vertex_tex_coords(&m_face_tex_coord_indices.front()); // End defining the face. m_builder.end_face(); }
void insert_face_into_mesh() { // Begin a mesh definition if we're not already inside one. ensure_mesh_def(); // Insert the features into the mesh, updating index mappings as necessary. insert_vertices_into_mesh(); insert_vertex_normals_into_mesh(); insert_tex_coords_into_mesh(); // Translate feature indices from internal space to mesh space. translate_indices(m_face_vertex_indices, m_vertex_index_mapping); translate_indices(m_face_normal_indices, m_normal_index_mapping); translate_indices(m_face_tex_coord_indices, m_tex_coord_index_mapping); const size_t n = m_face_vertex_indices.size(); // Begin defining a new face. m_builder.begin_face(n); // Set face vertices. m_builder.set_face_vertices(&m_face_vertex_indices.front()); // Set face vertex normals (if any). if (m_face_normal_indices.size() == n) m_builder.set_face_vertex_normals(&m_face_normal_indices.front()); // Set face vertex texture coordinates (if any). if (m_face_tex_coord_indices.size() == n) m_builder.set_face_vertex_tex_coords(&m_face_tex_coord_indices.front()); // Set face material. m_builder.set_face_material(m_current_material_slot_index); // End defining the face. m_builder.end_face(); }