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:16:25 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-10-07 13:43:10 +0300
commit126d485b837d317ead313c46bcd6545d03391020 (patch)
tree37c9f9efea017ca9854aa43244ed046c0be1dd35 /source/blender/draw/engines/eevee
parenta945cf4d0fc38f3c84747767612ad1d748ceb2a0 (diff)
DRW: Remove screen_vecs
These were only a normalized copy of the XY axes of the inverse viewmat. But since the viewmatrix is always normalized we can use it directly.
Diffstat (limited to 'source/blender/draw/engines/eevee')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c2
-rw-r--r--source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_vert.glsl4
-rw-r--r--source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl4
3 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 6538821b671..942ab5502c7 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -329,7 +329,6 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
DRW_shgroup_uniform_texture_ref(grp, "probeCubes", &lcache->cube_tx.tex);
DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo);
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
- DRW_shgroup_uniform_vec3(grp, "screen_vecs", DRW_viewport_screenvecs_get(), 2);
DRW_shgroup_uniform_float_copy(
grp, "sphere_size", scene_eval->eevee.gi_cubemap_draw_size * 0.5f);
/* TODO(fclem): get rid of those UBO. */
@@ -353,7 +352,6 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
DRW_shgroup_uniform_vec3(shgrp, "increment_x", egrid->increment_x, 1);
DRW_shgroup_uniform_vec3(shgrp, "increment_y", egrid->increment_y, 1);
DRW_shgroup_uniform_vec3(shgrp, "increment_z", egrid->increment_z, 1);
- DRW_shgroup_uniform_vec3(shgrp, "screen_vecs", DRW_viewport_screenvecs_get(), 2);
DRW_shgroup_uniform_texture_ref(shgrp, "irradianceGrid", &lcache->grid_tx.tex);
DRW_shgroup_uniform_float_copy(
shgrp, "sphere_size", scene_eval->eevee.gi_irradiance_draw_size * 0.5f);
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_vert.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_vert.glsl
index 1c32a5975be..d1da9873228 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_vert.glsl
@@ -15,7 +15,6 @@ layout(std140) uniform probe_block
};
uniform float sphere_size;
-uniform vec3 screen_vecs[2];
flat out int pid;
out vec2 quadCoord;
@@ -36,7 +35,8 @@ void main()
quadCoord = pos[vert_id];
vec3 ws_location = probes_data[pid].position_type.xyz;
- vec3 screen_pos = screen_vecs[0] * quadCoord.x + screen_vecs[1] * quadCoord.y;
+ vec3 screen_pos = ViewMatrixInverse[0].xyz * quadCoord.x +
+ ViewMatrixInverse[1].xyz * quadCoord.y;
ws_location += screen_pos * sphere_size;
gl_Position = ProjectionMatrix * (ViewMatrix * vec4(ws_location, 1.0));
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl
index c296d901880..b22d63de29e 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl
@@ -8,7 +8,6 @@ uniform vec3 corner;
uniform vec3 increment_x;
uniform vec3 increment_y;
uniform vec3 increment_z;
-uniform vec3 screen_vecs[2];
flat out int cellOffset;
out vec2 quadCoord;
@@ -39,7 +38,8 @@ void main()
increment_z * ls_cell_location.z);
quadCoord = pos[vert_id];
- vec3 screen_pos = screen_vecs[0] * quadCoord.x + screen_vecs[1] * quadCoord.y;
+ vec3 screen_pos = ViewMatrixInverse[0].xyz * quadCoord.x +
+ ViewMatrixInverse[1].xyz * quadCoord.y;
ws_cell_location += screen_pos * sphere_size;
gl_Position = ProjectionMatrix * (ViewMatrix * vec4(ws_cell_location, 1.0));