Skip to content

Commit

Permalink
count faces
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Oct 30, 2023
1 parent 844b4f3 commit c58b164
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/base/geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ void Geometry::build(CommandBuffer &command_buffer,
_world_max[i] = -std::numeric_limits<float>::max();
_world_min[i] = std::numeric_limits<float>::max();
}
_triangle_count = 0u;
for (auto shape : shapes) { _process_shape(command_buffer, shape, init_time, nullptr); }
LUISA_INFO_WITH_LOCATION("Geometry built with {} triangles.", _triangle_count);
_instance_buffer = _pipeline.device().create_buffer<uint4>(_instances.size());
command_buffer << _instance_buffer.copy_from(_instances.data())
<< _accel.build();
Expand Down Expand Up @@ -141,6 +143,7 @@ void Geometry::_process_shape(
.instance_id = instance_id,
.light_tag = light_tag});
}
_triangle_count += mesh.resource->triangle_count();
} else {
_transform_tree.push(shape->transform());
for (auto child : shape->children()) {
Expand Down
2 changes: 2 additions & 0 deletions src/base/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class Geometry {
float3 _world_min;
float3 _world_max;

uint _triangle_count; // for debug

private:
void _process_shape(
CommandBuffer &command_buffer, const Shape *shape, float init_time,
Expand Down

0 comments on commit c58b164

Please sign in to comment.