./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
0 / 32
0.0%
Branches:
0 / 36
0.0%
Functions:
0 / 3
0.0%

libs/render/src/eu/render/compiledmesh.cc
Line Branch Exec Source
1 #include "eu/render/compiledmesh.h"
2
3 #include "world.h"
4 #include "eu/core/mesh.h"
5
6 namespace eu::render
7 {
8 ✗ CompiledMesh compile_mesh(DEBUG_LABEL_ARG_MANY const core::Mesh& mesh, const core::CompiledGeomVertexAttributes& geom_layout)
9 {
10 ✗ CompiledMesh ret;
11
12
0/2
✗ Branch 37 → 4 not taken.
✗ Branch 37 → 38 not taken.
✗ for (const auto& meshes : mesh.meshes)
13 {
14 ✗ CompiledTransformedMesh trans{
15 ✗ .name = meshes.name,
16 .transform = meshes.transform,
17 .geoms = {}
18
0/4
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 46 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
✗ };
19
0/2
✗ Branch 25 → 11 not taken.
✗ Branch 25 → 26 not taken.
✗ for (const auto& geom : meshes.geoms)
20 {
21
0/2
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 42 not taken.
✗ auto compiled = compile_geom(USE_DEBUG_LABEL_MANY(debug_label) geom.geom, geom_layout);
22
0/2
✗ Branch 14 → 15 not taken.
✗ Branch 14 → 40 not taken.
✗ trans.geoms.emplace_back(compiled);
23 ✗ }
24
0/2
✗ Branch 26 → 27 not taken.
✗ Branch 26 → 44 not taken.
✗ ret.meshes.emplace_back(trans);
25 ✗ }
26
27 ✗ return ret;
28 ✗ }
29
30 ✗ void MeshInWorld::add_to_world(CompiledMesh* m, World* world, std::shared_ptr<Material> mat)
31 {
32
0/6
✗ Branch 2 → 3 not taken.
✗ Branch 2 → 9 not taken.
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 9 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 48 not taken.
✗ ASSERT(compiled_mesh == nullptr);
33 ✗ compiled_mesh = m;
34
35
0/2
✗ Branch 46 → 11 not taken.
✗ Branch 46 → 47 not taken.
✗ for (const auto& mesh : m->meshes)
36 {
37 ✗ TransformedMeshInWorld trans;
38
0/2
✗ Branch 34 → 15 not taken.
✗ Branch 34 → 35 not taken.
✗ for (const auto& geom: mesh.geoms)
39 {
40
0/2
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 51 not taken.
✗ auto instanced = make_mesh_instance(geom.geom, mat);
41
0/2
✗ Branch 22 → 23 not taken.
✗ Branch 22 → 57 not taken.
✗ world->meshes.emplace_back(instanced);
42
0/2
✗ Branch 23 → 24 not taken.
✗ Branch 23 → 57 not taken.
✗ trans.geoms.emplace_back(instanced);
43 ✗ }
44
0/2
✗ Branch 35 → 36 not taken.
✗ Branch 35 → 61 not taken.
✗ meshes.emplace_back(trans);
45 ✗ }
46 ✗ }
47
48 ✗ void MeshInWorld::set_transform(const m4& trans)
49 {
50
0/2
✗ Branch 15 → 3 not taken.
✗ Branch 15 → 16 not taken.
✗ for (std::size_t mesh_index = 0; mesh_index < meshes.size(); mesh_index += 1)
51 {
52
0/2
✗ Branch 12 → 4 not taken.
✗ Branch 12 → 13 not taken.
✗ for (std::size_t geom_index = 0; geom_index < meshes[mesh_index].geoms.size(); geom_index += 1)
53 {
54 ✗ meshes[mesh_index].geoms[geom_index]->transform = trans * compiled_mesh->meshes[mesh_index].transform;
55 }
56 }
57 ✗ }
58
59 }
60