MCPcopy Create free account
hub / github.com/axmolengine/axmol / updateVertex

Function updateVertex

core/3d/ObjLoader.cpp:331–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331static unsigned int updateVertex(std::map<vertex_index, unsigned int>& vertexCache,
332 std::vector<float>& positions,
333 std::vector<float>& normals,
334 std::vector<float>& texcoords,
335 const std::vector<float>& in_positions,
336 const std::vector<float>& in_normals,
337 const std::vector<float>& in_texcoords,
338 const vertex_index& i)
339{
340 const std::map<vertex_index, unsigned int>::iterator it = vertexCache.find(i);
341
342 if (it != vertexCache.end())
343 {
344 // found cache
345 return it->second;
346 }
347
348 assert(in_positions.size() > (unsigned int)(3 * i.v_idx + 2));
349
350 positions.emplace_back(in_positions[3 * i.v_idx + 0]);
351 positions.emplace_back(in_positions[3 * i.v_idx + 1]);
352 positions.emplace_back(in_positions[3 * i.v_idx + 2]);
353
354 if (i.vn_idx >= 0)
355 {
356 normals.emplace_back(in_normals[3 * i.vn_idx + 0]);
357 normals.emplace_back(in_normals[3 * i.vn_idx + 1]);
358 normals.emplace_back(in_normals[3 * i.vn_idx + 2]);
359 }
360
361 if (i.vt_idx >= 0)
362 {
363 texcoords.emplace_back(in_texcoords[2 * i.vt_idx + 0]);
364 texcoords.emplace_back(in_texcoords[2 * i.vt_idx + 1]);
365 }
366
367 unsigned int idx = static_cast<unsigned int>(positions.size() / 3 - 1);
368 vertexCache[i] = idx;
369
370 return idx;
371}
372
373void InitMaterial(material_t& material)
374{

Callers 1

exportFaceGroupToShapeFunction · 0.85

Calls 4

findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected