diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-04-26 09:06:22 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-04-26 09:06:22 +0300 |
commit | 27d837a6ac7104bf8ddd65839fcc2369ec9ba834 (patch) | |
tree | 740e477f7ab57cb1d17d23fd2c3f9031660960ab /source | |
parent | e4ee23f780993b83c3049c14c060fbd1d1c307e0 (diff) |
Workbench: Shader compilation
Diffstat (limited to 'source')
3 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl index e961f50b5f2..0c1c430c61b 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_object_overlap_lib.glsl @@ -9,5 +9,5 @@ float calculate_object_overlap(usampler2D objectId, ivec2 texel, uint object_id) texelFetchOffset(objectId, texel, 0, ivec2(-OBJECT_OVERLAP_OFFSET, 0)).r, texelFetchOffset(objectId, texel, 0, ivec2( OBJECT_OVERLAP_OFFSET, 0)).r); - return dot(vec4(equal(uvec4(object_id), oid_offset)), vec4(1.0/4.0)); + return dot(vec4(equal(uvec4(object_id), oid_offset)), vec4(0.25)); } diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl index 1535ab2e36f..09258654072 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl @@ -1,20 +1,25 @@ uniform int object_id = 0; uniform vec3 object_color = vec3(1.0, 0.0, 1.0); +#ifdef V3D_LIGHTING_STUDIO in vec3 normal_viewport; +#endif /* V3D_LIGHTING_STUDIO */ out uint objectId; out vec4 diffuseColor; +#ifdef V3D_LIGHTING_STUDIO #ifdef WORKBENCH_ENCODE_NORMALS out vec2 normalViewport; -#else +#else /* WORKBENCH_ENCODE_NORMALS */ out vec3 normalViewport; -#endif +#endif /* WORKBENCH_ENCODE_NORMALS */ +#endif /* V3D_LIGHTING_STUDIO */ void main() { objectId = uint(object_id); diffuseColor = vec4(object_color, 0.0); +#ifdef V3D_LIGHTING_STUDIO #ifdef WORKBENCH_ENCODE_NORMALS if (!gl_FrontFacing) { normalViewport = normal_encode(-normal_viewport); @@ -25,4 +30,5 @@ void main() #else /* WORKBENCH_ENCODE_NORMALS */ normalViewport = normal_viewport; #endif /* WORKBENCH_ENCODE_NORMALS */ +#endif /* V3D_LIGHTING_STUDIO */ } diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl index 2da5deabfc2..8f62ddb161d 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl @@ -1,13 +1,21 @@ uniform mat4 ModelViewProjectionMatrix; +#ifdef V3D_LIGHTING_STUDIO uniform mat3 NormalMatrix; +#endif /* V3D_LIGHTING_STUDIO */ in vec3 pos; +#ifdef V3D_LIGHTING_STUDIO in vec3 nor; +#endif /* V3D_LIGHTING_STUDIO */ +#ifdef V3D_LIGHTING_STUDIO out vec3 normal_viewport; +#endif /* V3D_LIGHTING_STUDIO */ void main() { +#ifdef V3D_LIGHTING_STUDIO normal_viewport = normalize(NormalMatrix * nor); +#endif /* V3D_LIGHTING_STUDIO */ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); } |