Commit 0c1cfaf1 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[ADD] added basic clip-plane functionality to point renderer. Now only works...

[ADD] added basic clip-plane functionality to point renderer. Now only works with shader code modification. Will be extended to use properties later.
parent 0639101c
......@@ -115,7 +115,7 @@ void main()
// finally set the color and depth
wgeInitGBuffer();
wge_FragColor = vec4( gl_Color.rgb * r, 1.0 );
wge_FragColor = vec4( gl_Color.rgb * r , gl_Color.a );
wge_FragNormal = textureNormalize( sphereSurf );
wge_FragZoom = v_worldScale;
wge_FragTangent = textureNormalize( vec3( 0.0, 1.0, 0.0 ) );
......
......@@ -50,6 +50,11 @@ uniform float u_pointSize = 1.0;
*/
varying in vec3 v_normal[];
/**
* Clip vertex if not 0.0
*/
varying in float v_clip[];
/**
* The vertex coordinates in world-space
*/
......@@ -103,6 +108,12 @@ varying out float v_worldScale;
*/
void main()
{
// clip whole sprite
if( v_clip[0] != 0.0 )
{
return;
}
// grab the info we got from the vertex array:
vec3 vertex = gl_PositionIn[0].xyz;
......
......@@ -38,6 +38,8 @@
// Varyings
/////////////////////////////////////////////////////////////////////////////
varying float v_clip ;
/////////////////////////////////////////////////////////////////////////////
// Variables
/////////////////////////////////////////////////////////////////////////////
......@@ -51,6 +53,11 @@
*/
void main()
{
// use clipping planes to cut away parts
v_clip = 0.0;
// TODO(ebaum): implement this using proper clip-plane implementation
// v_clip = float(( gl_Vertex.x > 500. ) || (gl_Vertex.y>500.) );
// forward to geometry shader
gl_FrontColor = gl_Color;
gl_Position = gl_ModelViewMatrix * gl_Vertex;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment