diff --git a/README.md b/README.md index 28ac4335..581cc638 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,20 @@ ninja ./FunGame gprof ./FunGame gmon.out | gprof2dot | dot -Tsvg -o output.svg ``` -Don't know how to turn this off though - +To turn off ```sh rm -rf build # or cmake --fresh ``` +gprof doesn't work with multi-threading. For that we can use perf. + +```sh +perf record -ag ./FunGame Start # or any other commands +perf script report flamegraph # this will ask to download something +firefox flamegraph.html +``` + ## Formatting POSIX shells only diff --git a/src/util/mesh.hpp b/src/util/mesh.hpp index 33c7e534..339e3cd9 100644 --- a/src/util/mesh.hpp +++ b/src/util/mesh.hpp @@ -151,7 +151,7 @@ class Mesh { template std::optional> analyze_voxel_interface( - T voxel_object, VoxelOffset position, VoxelOffset major_direction, + const T& voxel_object, VoxelOffset position, VoxelOffset major_direction, VoxelOffset minor_direction_1, VoxelOffset minor_direction_2 ) { VoxelColorId voxel_a = voxel_object.get_voxel_color_id(position); @@ -279,7 +279,7 @@ for dimension (x,y,z direction) */ template Mesh -ambient_occlusion_mesher(T voxel_object) { +ambient_occlusion_mesher(const T& voxel_object) { std::vector indicies; std::vector indexed_vertices; std::vector indexed_colors; diff --git a/src/util/voxel.hpp b/src/util/voxel.hpp index f3f1d327..86dafd49 100644 --- a/src/util/voxel.hpp +++ b/src/util/voxel.hpp @@ -158,7 +158,7 @@ class VoxelObject : VoxelBase { * @return VoxelSize length in x, y, z */ [[nodiscard]] inline VoxelSize - get_size() noexcept { + get_size() const noexcept { return size_; } }; diff --git a/src/world/terrain/chunk.hpp b/src/world/terrain/chunk.hpp index 4c6d51a4..d056ae2f 100644 --- a/src/world/terrain/chunk.hpp +++ b/src/world/terrain/chunk.hpp @@ -256,7 +256,7 @@ class ChunkData : public voxel_utility::VoxelBase { * @return VoxelSize vector of Chunk::SIZE */ [[nodiscard]] inline VoxelSize - get_size() { + get_size() const { return {Chunk::SIZE, Chunk::SIZE, Chunk::SIZE}; }