diff options
Diffstat (limited to 'drivers/gles2/rasterizer_scene_gles2.h')
-rw-r--r-- | drivers/gles2/rasterizer_scene_gles2.h | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h index 0d917f4da2..48672991d1 100644 --- a/drivers/gles2/rasterizer_scene_gles2.h +++ b/drivers/gles2/rasterizer_scene_gles2.h @@ -103,6 +103,7 @@ public: GLuint sky_verts; GLuint immediate_buffer; + Color default_ambient; // ResolveShaderGLES3 resolve_shader; // ScreenSpaceReflectionShaderGLES3 ssr_shader; @@ -255,6 +256,7 @@ public: GLuint fbo; GLuint depth; + GLuint color; Map<RID, uint32_t> shadow_owners; }; @@ -278,6 +280,7 @@ public: struct DirectionalShadow { GLuint fbo; GLuint depth; + GLuint color; int light_count; int size; @@ -310,10 +313,9 @@ public: int reflection_index; GLuint fbo[6]; - GLuint cubemap; + GLuint color[6]; GLuint depth; - - GLuint fbo_blur; + GLuint cubemap; int current_resolution; mutable bool dirty; @@ -473,7 +475,7 @@ public: virtual void light_instance_set_transform(RID p_light_instance, const Transform &p_transform); virtual void light_instance_set_shadow_transform(RID p_light_instance, const CameraMatrix &p_projection, const Transform &p_transform, float p_far, float p_split, int p_pass, float p_bias_scale = 1.0); virtual void light_instance_mark_visible(RID p_light_instance); - virtual bool light_instances_can_render_shadow_cube() const { return storage->config.support_write_depth; } + virtual bool light_instances_can_render_shadow_cube() const { return storage->config.support_shadow_cubemaps; } LightInstance **render_light_instances; int render_directional_lights; @@ -500,7 +502,8 @@ public: enum { MAX_LIGHTS = 255, MAX_REFLECTION_PROBES = 255, - DEFAULT_MAX_ELEMENTS = 65536 + DEFAULT_MAX_ELEMENTS = 65536, + SORT_KEY_PRIORITY_SHIFT = 56 }; int max_elements; @@ -596,6 +599,29 @@ public: } } + struct SortByReverseDepthAndPriority { + + _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const { + uint32_t layer_A = uint32_t(A->sort_key >> SORT_KEY_PRIORITY_SHIFT); + uint32_t layer_B = uint32_t(B->sort_key >> SORT_KEY_PRIORITY_SHIFT); + if (layer_A == layer_B) { + return A->instance->depth > B->instance->depth; + } else { + return layer_A < layer_B; + } + } + }; + + void sort_by_reverse_depth_and_priority(bool p_alpha) { //used for alpha + + SortArray<Element *, SortByReverseDepthAndPriority> sorter; + if (p_alpha) { + sorter.sort(&elements[max_elements - alpha_element_count], alpha_element_count); + } else { + sorter.sort(elements, element_count); + } + } + // element adding and stuff _FORCE_INLINE_ Element *add_element() { |