DRW: support clipping for all lamp types
This commit is contained in:
@@ -8,9 +8,18 @@ layout(line_strip, max_vertices = 2) out;
|
||||
void main()
|
||||
{
|
||||
vec3 vert = gl_in[0].gl_Position.xyz;
|
||||
|
||||
gl_Position = ViewProjectionMatrix * vec4(vert.xyz, 1.0);
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance);
|
||||
#endif
|
||||
EmitVertex();
|
||||
|
||||
gl_Position = ViewProjectionMatrix * vec4(vert.xy, 0.0, 1.0);
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance(vec3(vert.xy, 0.0));
|
||||
#endif
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ in vec3 pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ViewProjectionMatrix * vec4(pos.xy, 0.0, 1.0);
|
||||
vec4 pos_4d = vec4(pos.xy, 0.0, 1.0);
|
||||
gl_Position = ViewProjectionMatrix * pos_4d;
|
||||
gl_PointSize = 2.0;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance(pos_4d.xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
uniform mat4 ModelMatrix;
|
||||
#endif
|
||||
|
||||
/* Does Nothing */
|
||||
in vec3 pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(pos, 1.0);
|
||||
vec4 pos_4d = vec4(pos, 1.0);
|
||||
gl_Position = pos_4d;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -18,8 +18,13 @@ void main()
|
||||
{
|
||||
float len = end - start;
|
||||
vec3 sta = vec3(0.0, 0.0, -start);
|
||||
vec4 pos_4d = vec4(pos * -len + sta, 1.0);
|
||||
|
||||
gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pos * -len + sta, 1.0);
|
||||
gl_Position = ViewProjectionMatrix * InstanceModelMatrix * pos_4d;
|
||||
gl_PointSize = size;
|
||||
finalColor = vec4(color, 1.0);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((InstanceModelMatrix * pos_4d).xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -28,10 +28,18 @@ flat out vec4 finalColor;
|
||||
void emitLine(vec4 color)
|
||||
{
|
||||
gl_Position = ProjectionMatrix * MV_pos[0];
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_set_clip_distance(gl_in[0].gl_ClipDistance);
|
||||
#endif
|
||||
EmitVertex();
|
||||
|
||||
gl_Position = ProjectionMatrix * MV_pos[1];
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_set_clip_distance(gl_in[1].gl_ClipDistance);
|
||||
#endif
|
||||
finalColor = color;
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ void main()
|
||||
|
||||
mat4 ModelViewMatrix = ViewMatrix * InstanceModelMatrix;
|
||||
|
||||
MV_pos = ModelViewMatrix * vec4(pos, 1.0);
|
||||
vec4 pos_4d = vec4(pos, 1.0);
|
||||
MV_pos = ModelViewMatrix * pos_4d;
|
||||
|
||||
mat3 NormalMatrix = transpose(inverse(mat3(ModelViewMatrix)));
|
||||
|
||||
@@ -60,4 +61,8 @@ void main()
|
||||
edgeClass = -1.0; // back-facing edge
|
||||
|
||||
fCol = color;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((InstanceModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user