diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_vert.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lightprobe_cube_display_vert.glsl | 43 |
1 files changed, 21 insertions, 22 deletions
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 b327878b63d..db780714091 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 @@ -1,14 +1,15 @@ /* XXX TODO fix code duplication */ struct CubeData { - vec4 position_type; - vec4 attenuation_fac_type; - mat4 influencemat; - mat4 parallaxmat; + vec4 position_type; + vec4 attenuation_fac_type; + mat4 influencemat; + mat4 parallaxmat; }; -layout(std140) uniform probe_block { - CubeData probes_data[MAX_PROBE]; +layout(std140) uniform probe_block +{ + CubeData probes_data[MAX_PROBE]; }; uniform float sphere_size; @@ -17,27 +18,25 @@ uniform vec3 screen_vecs[2]; flat out int pid; out vec2 quadCoord; -const vec2 pos[6] = vec2[6]( - vec2(-1.0, -1.0), - vec2( 1.0, -1.0), - vec2(-1.0, 1.0), +const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0), + vec2(1.0, -1.0), + vec2(-1.0, 1.0), - vec2( 1.0, -1.0), - vec2( 1.0, 1.0), - vec2(-1.0, 1.0) -); + vec2(1.0, -1.0), + vec2(1.0, 1.0), + vec2(-1.0, 1.0)); void main() { - pid = 1 + (gl_VertexID / 6); /* +1 for the world */ - int vert_id = gl_VertexID % 6; + pid = 1 + (gl_VertexID / 6); /* +1 for the world */ + int vert_id = gl_VertexID % 6; - quadCoord = pos[vert_id]; + 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; - ws_location += screen_pos * sphere_size; + vec3 ws_location = probes_data[pid].position_type.xyz; + vec3 screen_pos = screen_vecs[0] * quadCoord.x + screen_vecs[1] * quadCoord.y; + ws_location += screen_pos * sphere_size; - gl_Position = ViewProjectionMatrix * vec4(ws_location, 1.0); - gl_Position.z += 0.0001; /* Small bias to let the icon draw without zfighting */ + gl_Position = ViewProjectionMatrix * vec4(ws_location, 1.0); + gl_Position.z += 0.0001; /* Small bias to let the icon draw without zfighting */ } |