Commit 560e7314 authored by Jan Möbius's avatar Jan Möbius

Christopher:

- Fix for Line Geometry Shader (Didn't compile on linux nvidia)
- Pointnode extension for new renderer
- Fix for points in depth peeling renderer

closes #1747

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17659 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f9d056f7
// template file for shader generator
in vec2 outGeometryQuadPos;
uniform float pointSize;
uniform vec2 screenSize;
void main()
{
float r2 = dot(outGeometryQuadPos, outGeometryQuadPos);
// discard pixels outside of radius
if (r2 > 1.0)
discard;
SG_FRAGMENT_BEGIN
SG_FRAGMENT_END
}
// template file for shader generator
layout(points) in;
layout(triangle_strip, max_vertices = 4) out;
out vec2 outGeometryQuadPos;
uniform float pointSize;
uniform vec2 screenSize;
void main()
{
// center of point
vec4 p0 = gl_in[0].gl_Position;
// convert to screen space
p0.xy = p0.xy / p0.w * screenSize;
// create screen-aligned quad
vec2 offsetX = vec2(pointSize, 0.0);
vec2 offsetY = vec2(0.0, pointSize);
sg_MapIO(0); // default IO mapping
gl_Position = vec4( (p0.xy - offsetX + offsetY) * p0.w / screenSize, p0.z, p0.w);
outGeometryQuadPos = vec2(-1.0, 1.0);
EmitVertex();
sg_MapIO(0); // default IO mapping
gl_Position = vec4( (p0.xy - offsetX - offsetY) * p0.w / screenSize, p0.z, p0.w);
outGeometryQuadPos = vec2(-1.0, -1.0);
EmitVertex();
sg_MapIO(0); // default IO mapping
gl_Position = vec4( (p0.xy + offsetX + offsetY) * p0.w / screenSize, p0.z, p0.w);
outGeometryQuadPos = vec2(1.0, 1.0);
EmitVertex();
sg_MapIO(0); // default IO mapping
gl_Position = vec4( (p0.xy + offsetX - offsetY) * p0.w / screenSize, p0.z, p0.w);
outGeometryQuadPos = vec2(1.0, -1.0);
EmitVertex();
EndPrimitive();
}
......@@ -26,20 +26,20 @@ void main()
vec2 offset = lineNormal * lineWidth;
sg_MapIO(0); // default IO mapping
gl_Position = vec4( (p0 + offset) * p0.w / screenSize, p0.z, p0.w);
gl_Position = vec4( (p0.xy + offset) * p0.w / screenSize, p0.z, p0.w);
EmitVertex();
sg_MapIO(0); // default IO mapping
gl_Position = vec4( (p0 - offset) * p0.w / screenSize, p0.z, p0.w);
gl_Position = vec4( (p0.xy - offset) * p0.w / screenSize, p0.z, p0.w);
EmitVertex();
sg_MapIO(1); // default IO mapping
gl_Position = vec4( (p1 + offset) * p1.w / screenSize, p1.z, p1.w);
gl_Position = vec4( (p1.xy + offset) * p1.w / screenSize, p1.z, p1.w);
EmitVertex();
sg_MapIO(1); // default IO mapping
gl_Position = vec4( (p1 - offset) * p1.w / screenSize, p1.z, p1.w);
gl_Position = vec4( (p1.xy - offset) * p1.w / screenSize, p1.z, p1.w);
EmitVertex();
EndPrimitive();
......
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