diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/prepass_vert.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/prepass_vert.glsl | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl b/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl new file mode 100644 index 00000000000..f2e9e7001e8 --- /dev/null +++ b/source/blender/draw/engines/eevee/shaders/prepass_vert.glsl @@ -0,0 +1,35 @@ + +uniform mat4 ModelViewProjectionMatrix; +uniform mat4 ModelMatrix; + +/* keep in sync with DRWManager.view_data */ +layout(std140) uniform clip_block { + vec4 ClipPlanes[1]; +}; + +#ifndef HAIR_SHADER +in vec3 pos; +#endif + +void main() +{ +#ifdef HAIR_SHADER + float time, thick_time, thickness; + vec3 pos, tan, binor; + hair_get_pos_tan_binor_time( + (ProjectionMatrix[3][3] == 0.0), + ViewMatrixInverse[3].xyz, ViewMatrixInverse[2].xyz, + pos, tan, binor, time, thickness, thick_time); + + gl_Position = ViewProjectionMatrix * vec4(pos, 1.0); + vec4 worldPosition = vec4(pos, 1.0); +#else + gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); + vec4 worldPosition = (ModelMatrix * vec4(pos, 1.0)); +#endif + +#ifdef CLIP_PLANES + gl_ClipDistance[0] = dot(vec4(worldPosition.xyz, 1.0), ClipPlanes[0]); +#endif + /* TODO motion vectors */ +} |