summaryrefslogtreecommitdiff
path: root/modules/lightmapper_rd/lightmapper_rd.h
diff options
context:
space:
mode:
authorWilliam Deurwaarder <william.git@xs4all.nl>2021-09-11 14:02:37 +0200
committerWilliam Deurwaarder <william.git@xs4all.nl>2021-09-11 14:02:37 +0200
commite11dd6500a50c47e4f2d7c19813d4ba5c5533235 (patch)
treef3c792cd6d86a98d86a91e9947a2d1424a4317d7 /modules/lightmapper_rd/lightmapper_rd.h
parent43e96e0c652cd2ed41a1b9dfb7989ff272607a88 (diff)
GPULightmapper's triangles and their bounding box will be in-sync
Previously the bounding boxes and triangles were maintained in two separate arrays (Vectors). As the triangle vector was sorted and the bounding-box array was not , the order of both arrays differed. This meant that the index in one was different than the other, which caused lookup issues. To prevent this, the bounding-box is now part of the triangle structure so that there is a single structure that cannot become out-of-sync anymore.
Diffstat (limited to 'modules/lightmapper_rd/lightmapper_rd.h')
-rw-r--r--modules/lightmapper_rd/lightmapper_rd.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/modules/lightmapper_rd/lightmapper_rd.h b/modules/lightmapper_rd/lightmapper_rd.h
index 7ab7f34464..a6a3740051 100644
--- a/modules/lightmapper_rd/lightmapper_rd.h
+++ b/modules/lightmapper_rd/lightmapper_rd.h
@@ -157,16 +157,13 @@ class LightmapperRD : public Lightmapper {
}
};
- struct Box {
+ struct Triangle {
+ uint32_t indices[3] = {};
+ uint32_t slice = 0;
float min_bounds[3] = {};
float pad0 = 0.0;
float max_bounds[3] = {};
float pad1 = 0.0;
- };
-
- struct Triangle {
- uint32_t indices[3] = {};
- uint32_t slice = 0;
bool operator<(const Triangle &p_triangle) const {
return slice < p_triangle.slice;
}
@@ -231,7 +228,7 @@ class LightmapperRD : public Lightmapper {
Vector<Color> probe_values;
BakeError _blit_meshes_into_atlas(int p_max_texture_size, Vector<Ref<Image>> &albedo_images, Vector<Ref<Image>> &emission_images, AABB &bounds, Size2i &atlas_size, int &atlas_slices, BakeStepFunc p_step_function, void *p_bake_userdata);
- void _create_acceleration_structures(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, AABB &bounds, int grid_size, Vector<Probe> &probe_positions, GenerateProbes p_generate_probes, Vector<int> &slice_triangle_count, Vector<int> &slice_seam_count, RID &vertex_buffer, RID &triangle_buffer, RID &box_buffer, RID &lights_buffer, RID &triangle_cell_indices_buffer, RID &probe_positions_buffer, RID &grid_texture, RID &seams_buffer, BakeStepFunc p_step_function, void *p_bake_userdata);
+ void _create_acceleration_structures(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, AABB &bounds, int grid_size, Vector<Probe> &probe_positions, GenerateProbes p_generate_probes, Vector<int> &slice_triangle_count, Vector<int> &slice_seam_count, RID &vertex_buffer, RID &triangle_buffer, RID &lights_buffer, RID &triangle_cell_indices_buffer, RID &probe_positions_buffer, RID &grid_texture, RID &seams_buffer, BakeStepFunc p_step_function, void *p_bake_userdata);
void _raster_geometry(RenderingDevice *rd, Size2i atlas_size, int atlas_slices, int grid_size, AABB bounds, float p_bias, Vector<int> slice_triangle_count, RID position_tex, RID unocclude_tex, RID normal_tex, RID raster_depth_buffer, RID rasterize_shader, RID raster_base_uniform);
public: