Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-10-07 01:29:52 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-10-07 13:43:09 +0300
commit223f970407666828922616f1646768433ab7e7a0 (patch)
tree4b2a805bb226b0d807bad1522c104748fcc5045c /source/blender/draw/engines
parenta775e42dee00d708ecd0725f8c04cf753b448425 (diff)
EEVEE: Move reflection clip plane to local storage
This avoid dependency with the draw view.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c3
-rw-r--r--source/blender/draw/engines/eevee/eevee_private.h1
-rw-r--r--source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl1
-rw-r--r--source/blender/draw/engines/eevee/shaders/surface_vert.glsl2
4 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 94915180483..6538821b671 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -796,6 +796,7 @@ static void render_reflections(void (*callback)(int face, EEVEE_BakeRenderData *
int ref_count)
{
EEVEE_StorageList *stl = user_data->vedata->stl;
+ EEVEE_ViewLayerData *sldata = user_data->sldata;
DRWView *main_view = stl->effects->taa_view;
DRWView **views = stl->g_data->planar_views;
/* Prepare views at the same time for faster culling. */
@@ -804,6 +805,8 @@ static void render_reflections(void (*callback)(int face, EEVEE_BakeRenderData *
}
for (int i = 0; i < ref_count; i++) {
+ copy_v4_v4(sldata->common_data.planar_clip_plane, planar_data[i].plane_equation);
+ sldata->common_data.planar_clip_plane[3] += planar_data[i].clipsta;
DRW_view_set_active(views[i]);
callback(i, user_data);
}
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h
index b7f2b0ae859..e9b27354965 100644
--- a/source/blender/draw/engines/eevee/eevee_private.h
+++ b/source/blender/draw/engines/eevee/eevee_private.h
@@ -900,6 +900,7 @@ typedef struct EEVEE_CommonUniformBuffer {
float alpha_hash_offset; /* float */
float alpha_hash_scale; /* float */
float camera_uv_scale[2], camera_uv_bias[2]; /* vec4 */
+ float planar_clip_plane[4]; /* vec4 */
} EEVEE_CommonUniformBuffer;
BLI_STATIC_ASSERT_ALIGN(EEVEE_CommonUniformBuffer, 16)
diff --git a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl
index 0cf36817788..c06f164c025 100644
--- a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl
@@ -46,6 +46,7 @@ layout(std140) uniform common_block
float alphaHashScale;
/* Misc */
vec4 cameraUvScaleBias;
+ vec4 planarClipPlane;
};
/* rayType (keep in sync with ray_type) */
diff --git a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl
index 54aad7891dc..8f49c7bd265 100644
--- a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl
@@ -45,7 +45,7 @@ void main()
gl_Position = point_world_to_ndc(world_pos);
/* Used for planar reflections */
- gl_ClipDistance[0] = dot(vec4(world_pos, 1.0), clipPlanes[0]);
+ gl_ClipDistance[0] = dot(vec4(world_pos, 1.0), planarClipPlane);
#ifdef MESH_SHADER
worldPosition = world_pos;