Commit 10d11387 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] point renderer now forwards the original object-space vertex to the fragment shader

parent 419e4be0
......@@ -198,6 +198,8 @@ void WMPointRenderer::moduleMain()
// add geode to group
postNode->clear();
postNode->insert( geode, m_shader );
debugLog() << "Bounding Box: " << points->getBoundingBox();
}
// it is important to always remove the modules again
......
......@@ -72,6 +72,11 @@ varying float v_worldSpaceRadius;
*/
varying vec3 v_centerPoint;
/**
* Vertex in world space.
*/
varying vec4 v_worldVertex;
/**
* Depth of the center point
*/
......@@ -115,7 +120,7 @@ void main()
// finally set the color and depth
wgeInitGBuffer();
wge_FragColor = vec4( gl_Color.rgb * r , gl_Color.a );
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 ) );
......
......@@ -55,6 +55,11 @@ varying in vec3 v_normal[];
*/
varying in float v_clip[];
/**
* Vertex in world space.
*/
varying in vec4 v_worldCenterVertex[];
/**
* The vertex coordinates in world-space
*/
......@@ -75,6 +80,11 @@ varying out float v_worldSpaceRadius;
*/
varying out vec3 v_centerPoint;
/**
* Vertex in world space.
*/
varying out vec4 v_worldVertex;
/**
* Depth of the center point
*/
......@@ -127,6 +137,7 @@ void main()
v_worldScale = getModelViewScale();
v_worldSpaceRadius = v_worldScale * u_pointSize;
v_centerPoint = vertex;
v_worldVertex = v_worldCenterVertex[0];
// calculate the depth using the point on the sphere most near to the cam
vec4 nearestVertex = vec4( v_centerPoint.xy, v_centerPoint.z - v_worldSpaceRadius, 1.0 );
......
......@@ -40,6 +40,11 @@
varying float v_clip;
/**
* Vertex in world space.
*/
varying vec4 v_worldCenterVertex;
/////////////////////////////////////////////////////////////////////////////
// Variables
/////////////////////////////////////////////////////////////////////////////
......@@ -61,5 +66,7 @@ void main()
// forward to geometry shader
gl_FrontColor = gl_Color;
gl_Position = gl_ModelViewMatrix * gl_Vertex;
v_worldCenterVertex = 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