• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Razakhel / RaZ / 18064138724

27 Sep 2025 04:20PM UTC coverage: 74.093% (+0.04%) from 74.05%
18064138724

push

github

Razakhel
[Utils/Logger] Added formatted logging overloads

- Formatted calls to logging functions and made use of std::format() in several other places

100 of 170 new or added lines in 36 files covered. (58.82%)

4 existing lines in 2 files now uncovered.

8334 of 11248 relevant lines covered (74.09%)

1757.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/RaZ/Data/OffLoad.cpp
1
#include "RaZ/Data/OffFormat.hpp"
2
#include "RaZ/Data/Mesh.hpp"
3
#include "RaZ/Utils/FilePath.hpp"
4
#include "RaZ/Utils/Logger.hpp"
5

6
#include "tracy/Tracy.hpp"
7

8
#include <fstream>
9

10
namespace Raz::OffFormat {
11

12
Mesh load(const FilePath& filePath) {
×
13
  ZoneScopedN("OffFormat::load");
14
  ZoneTextF("Path: %s", filePath.toUtf8().c_str());
15

NEW
16
  Logger::debug("[OffLoad] Loading OFF file ('{}')...", filePath);
×
17

18
  std::ifstream file(filePath, std::ios_base::binary);
×
19

20
  if (!file)
×
NEW
21
    throw std::invalid_argument(std::format("Error: Could not open the OFF file '{}'", filePath));
×
22

23
  Mesh mesh;
×
24
  Submesh& submesh = mesh.addSubmesh();
×
25

26
  std::size_t vertexCount {};
×
27
  std::size_t faceCount {};
×
28

29
  file.ignore(3);
×
30
  file >> vertexCount >> faceCount;
×
31
  file.ignore(100, '\n');
×
32

33
  std::vector<Vertex>& vertices = submesh.getVertices();
×
34
  vertices.resize(vertexCount * 3);
×
35

36
  std::vector<unsigned int>& indices = submesh.getTriangleIndices();
×
37
  indices.reserve(faceCount * 3);
×
38

39
  for (std::size_t vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) {
×
40
    file >> vertices[vertexIndex].position.x()
×
41
         >> vertices[vertexIndex].position.y()
×
42
         >> vertices[vertexIndex].position.z();
×
43
  }
44

45
  for (std::size_t faceIndex = 0; faceIndex < faceCount; ++faceIndex) {
×
46
    uint16_t partCount {};
×
47
    file >> partCount;
×
48

49
    std::vector<std::size_t> partsIndices(partCount);
×
50
    file >> partsIndices[0] >> partsIndices[1] >> partsIndices[2];
×
51

52
    indices.emplace_back(static_cast<unsigned int>(partsIndices[0]));
×
53
    indices.emplace_back(static_cast<unsigned int>(partsIndices[1]));
×
54
    indices.emplace_back(static_cast<unsigned int>(partsIndices[2]));
×
55

56
    for (uint16_t partIndex = 3; partIndex < partCount; ++partIndex) {
×
57
      file >> partsIndices[partIndex];
×
58

59
      indices.emplace_back(static_cast<unsigned int>(partsIndices[0]));
×
60
      indices.emplace_back(static_cast<unsigned int>(partsIndices[partIndex - 1]));
×
61
      indices.emplace_back(static_cast<unsigned int>(partsIndices[partIndex]));
×
62
    }
63
  }
×
64

65
  indices.shrink_to_fit();
×
66

67
  mesh.computeTangents();
×
68

NEW
69
  Logger::debug("[OffLoad] Loaded OFF file ({} vertices, {} triangles)", mesh.recoverVertexCount(), mesh.recoverTriangleCount());
×
70

71
  return mesh;
×
72
}
×
73

74
} // namespace Raz::OffFormat
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc