Declaring an array with zero size is not allowed, so using zero for
max_clip_planes doesn't work.
out vec3 tbn_zenith_dir = eye_zenith_dir*eye_tbn_matrix;
out float fog_coord = eye_vertex.z;
- for(int i=0; i<max_clip_planes; ++i)
- gl_ClipDistance[i] = dot(eye_vertex, clip_planes[i].equation);
+ if(use_clipping)
+ {
+ for(int i=0; i<max_clip_planes; ++i)
+ gl_ClipDistance[i] = dot(eye_vertex, clip_planes[i].equation);
+ }
shadow_transform(eye_vertex);
}
float fog_density;
};
-layout(constant_id=auto) const int max_clip_planes = 0;
+layout(constant_id=auto) const bool use_clipping = false;
+layout(constant_id=auto) const int max_clip_planes = 8;
uniform Clipping
{
ClipPlane clip_planes[max_clip_planes];