MCPcopy Create free account
hub / github.com/crownengine/crown / parse_geometry

Function parse_geometry

src/resource/mesh_obj.cpp:159–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157 }
158
159 static s32 parse_geometry(Geometry &g, const ufbx_mesh *mesh)
160 {
161 size_t num_indices = 0;
162 for (size_t i = 0; i < mesh->material_parts.count; ++i) {
163 const ufbx_mesh_part *mesh_part = &mesh->material_parts.data[i];
164 num_indices += convert_mesh_part(g, mesh, mesh_part);
165 }
166
167 array::resize(g._position_indices, (u32)num_indices);
168 generate_indices(g._position_indices, g._positions, sizeof(f32)*3);
169
170 if (mesh::has_normals(g)) {
171 array::resize(g._normal_indices, (u32)num_indices);
172 generate_indices(g._normal_indices, g._normals, sizeof(f32)*3);
173 }
174
175 if (mesh::has_tangents(g)) {
176 array::resize(g._tangent_indices, (u32)num_indices);
177 generate_indices(g._tangent_indices, g._tangents, sizeof(f32)*3);
178 }
179
180 if (mesh::has_bitangents(g)) {
181 array::resize(g._bitangent_indices, (u32)num_indices);
182 generate_indices(g._bitangent_indices, g._bitangents, sizeof(f32)*3);
183 }
184
185 if (mesh::has_uvs(g)) {
186 array::resize(g._uv_indices, (u32)num_indices);
187 generate_indices(g._uv_indices, g._uvs, sizeof(f32)*2);
188 }
189
190 return 0;
191 }
192
193 static s32 parse_geometries(Mesh &m, const ufbx_mesh_list *meshes, CompileOptions &opts)
194 {

Callers 1

parse_geometriesFunction · 0.70

Calls 7

has_normalsFunction · 0.85
has_tangentsFunction · 0.85
has_bitangentsFunction · 0.85
has_uvsFunction · 0.85
convert_mesh_partFunction · 0.70
generate_indicesFunction · 0.70
resizeFunction · 0.50

Tested by

no test coverage detected