| 14 | } |
| 15 | |
| 16 | void GraphicRenderer2D::AddMesh(Meshes::Mesh& mesh) { |
| 17 | const auto& material = mesh.GetMaterial(); |
| 18 | const auto& material_hashcode = material->GetHashCode(); |
| 19 | |
| 20 | auto it = std::find_if(std::begin(m_mesh_map), std::end(m_mesh_map), |
| 21 | [&material_hashcode](const std::pair<unsigned int, std::vector<Meshes::Mesh>>& value) { return value.first == material_hashcode; }); |
| 22 | |
| 23 | if (it == std::end(m_mesh_map)) { |
| 24 | std::vector<Meshes::Mesh> meshes = {mesh}; |
| 25 | mesh.SetUniqueIdentifier(0); |
| 26 | m_mesh_map.emplace(material_hashcode, meshes); |
| 27 | } |
| 28 | |
| 29 | else { |
| 30 | unsigned int mesh_identifier_id = it->second.size(); |
| 31 | mesh.SetUniqueIdentifier(mesh_identifier_id); |
| 32 | it->second.push_back(mesh); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | void GraphicRenderer2D::EndScene() { |
| 37 |
nothing calls this directly
no test coverage detected