From ddc4ae117595e2059404170ff3e8c6040413b219 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Mon, 12 Sep 2022 19:44:48 +1000 Subject: Move cluster builder, sdfgi and gi structures to clustered renderer, move light and probe elements into storage and reorganise our render_scene method. --- drivers/gles3/rasterizer_scene_gles3.h | 77 ++-------------------------------- 1 file changed, 3 insertions(+), 74 deletions(-) (limited to 'drivers/gles3/rasterizer_scene_gles3.h') diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index f0dc972678..d11dc14080 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -44,6 +44,7 @@ #include "shader_gles3.h" #include "shaders/cubemap_filter.glsl.gen.h" #include "shaders/sky.glsl.gen.h" +#include "storage/light_storage.h" #include "storage/material_storage.h" #include "storage/render_scene_buffers_gles3.h" #include "storage/utilities.h" @@ -183,34 +184,6 @@ private: }; static_assert(sizeof(DirectionalLightData) % 16 == 0, "DirectionalLightData size must be a multiple of 16 bytes"); - struct LightInstance { - RS::LightType light_type = RS::LIGHT_DIRECTIONAL; - - AABB aabb; - RID self; - RID light; - Transform3D transform; - - Vector3 light_vector; - Vector3 spot_vector; - float linear_att = 0.0; - - uint64_t shadow_pass = 0; - uint64_t last_scene_pass = 0; - uint64_t last_scene_shadow_pass = 0; - uint64_t last_pass = 0; - uint32_t cull_mask = 0; - uint32_t light_directional_index = 0; - - Rect2 directional_rect; - - uint32_t gl_id = -1; - - LightInstance() {} - }; - - mutable RID_Owner light_instance_owner; - class GeometryInstanceGLES3; // Cached data for drawing surfaces @@ -398,8 +371,8 @@ private: LightData *omni_lights = nullptr; LightData *spot_lights = nullptr; - InstanceSort *omni_light_sort; - InstanceSort *spot_light_sort; + InstanceSort *omni_light_sort; + InstanceSort *spot_light_sort; GLuint omni_light_buffer = 0; GLuint spot_light_buffer = 0; uint32_t omni_light_count = 0; @@ -605,17 +578,6 @@ public: uint32_t geometry_instance_get_pair_mask() override; - /* SHADOW ATLAS API */ - - RID shadow_atlas_create() override; - void shadow_atlas_set_size(RID p_atlas, int p_size, bool p_16_bits = true) override; - void shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision) override; - bool shadow_atlas_update_light(RID p_atlas, RID p_light_intance, float p_coverage, uint64_t p_light_version) override; - - void directional_shadow_atlas_set_size(int p_size, bool p_16_bits = true) override; - int get_directional_light_shadow_size(RID p_light_intance) override; - void set_directional_shadow_count(int p_count) override; - /* SDFGI UPDATE */ void sdfgi_update(const Ref &p_render_buffers, RID p_environment, const Vector3 &p_world_position) override {} @@ -666,45 +628,12 @@ public: void positional_soft_shadow_filter_set_quality(RS::ShadowQuality p_quality) override; void directional_soft_shadow_filter_set_quality(RS::ShadowQuality p_quality) override; - RID light_instance_create(RID p_light) override; - void light_instance_set_transform(RID p_light_instance, const Transform3D &p_transform) override; - void light_instance_set_aabb(RID p_light_instance, const AABB &p_aabb) override; - void light_instance_set_shadow_transform(RID p_light_instance, const Projection &p_projection, const Transform3D &p_transform, float p_far, float p_split, int p_pass, float p_shadow_texel_size, float p_bias_scale = 1.0, float p_range_begin = 0, const Vector2 &p_uv_scale = Vector2()) override; - void light_instance_mark_visible(RID p_light_instance) override; - - _FORCE_INLINE_ RS::LightType light_instance_get_type(RID p_light_instance) { - LightInstance *li = light_instance_owner.get_or_null(p_light_instance); - return li->light_type; - } - _FORCE_INLINE_ uint32_t light_instance_get_gl_id(RID p_light_instance) { - LightInstance *li = light_instance_owner.get_or_null(p_light_instance); - return li->gl_id; - } - RID fog_volume_instance_create(RID p_fog_volume) override; void fog_volume_instance_set_transform(RID p_fog_volume_instance, const Transform3D &p_transform) override; void fog_volume_instance_set_active(RID p_fog_volume_instance, bool p_active) override; RID fog_volume_instance_get_volume(RID p_fog_volume_instance) const override; Vector3 fog_volume_instance_get_position(RID p_fog_volume_instance) const override; - RID reflection_atlas_create() override; - int reflection_atlas_get_size(RID p_ref_atlas) const override; - void reflection_atlas_set_size(RID p_ref_atlas, int p_reflection_size, int p_reflection_count) override; - - RID reflection_probe_instance_create(RID p_probe) override; - void reflection_probe_instance_set_transform(RID p_instance, const Transform3D &p_transform) override; - void reflection_probe_release_atlas_index(RID p_instance) override; - bool reflection_probe_instance_needs_redraw(RID p_instance) override; - bool reflection_probe_instance_has_reflection(RID p_instance) override; - bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) override; - bool reflection_probe_instance_postprocess_step(RID p_instance) override; - - RID decal_instance_create(RID p_decal) override; - void decal_instance_set_transform(RID p_decal, const Transform3D &p_transform) override; - - RID lightmap_instance_create(RID p_lightmap) override; - void lightmap_instance_set_transform(RID p_lightmap, const Transform3D &p_transform) override; - RID voxel_gi_instance_create(RID p_voxel_gi) override; void voxel_gi_instance_set_transform_to_data(RID p_probe, const Transform3D &p_xform) override; bool voxel_gi_needs_update(RID p_probe) const override; -- cgit v1.2.3