Files
test2/source/blender/draw/modes/shaders/edit_normals_vert.glsl
Campbell Barton 9bc47ed0f6 Fix clipping shaders with some AMD/Intel drivers
Caused:
    error: unsized array index must be constant

Use hard coded number of clipping planes, copying the 4th to 5 & 6
when only 4 are used.
2019-01-21 23:55:53 +11:00

35 lines
667 B
GLSL

uniform mat4 ModelViewProjectionMatrix;
uniform mat3 NormalMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 ModelMatrix;
uniform float normalSize;
in vec3 pos;
#ifdef LOOP_NORMALS
in vec3 lnor;
#define nor lnor
#elif defined(FACE_NORMALS)
in vec4 norAndFlag;
#define nor norAndFlag.xyz
#else
in vec3 vnor;
#define nor vnor
#endif
flat out vec4 v1;
flat out vec4 v2;
void main()
{
v1 = ModelViewProjectionMatrix * vec4(pos, 1.0);
vec3 n = normalize(NormalMatrix * nor); /* viewspace */
v2 = v1 + ProjectionMatrix * vec4(n * normalSize, 0.0);
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
#endif
}