Commit 281544c6 authored by Christopher Tenter's avatar Christopher Tenter

- IRenderer: renderobjects can request a depth map of the scene, which is...

- IRenderer: renderobjects can request a depth map of the scene, which is optionally rendered in a z-prepass
- GLMatrix: extraction of clipping planes in a projection matrix

_ ShaderGen: control glsl version in shader descriptor
- GLSL::Shader: add suppport for tessellation shaders


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18555 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0e7f2a13
...@@ -2,6 +2,31 @@ ...@@ -2,6 +2,31 @@
// declare IO mapping prototype // declare IO mapping prototype
void sg_MapIO(const int); void sg_MapIO(const int);
void computeEdgeQuadPos(const int v0, const int v1, in vec2 screenSize, in float lineWidth,
out vec4 pos0, out vec4 pos1, out vec4 pos2, out vec4 pos3)
{
vec4 p0 = gl_in[v0].gl_Position;
vec4 p1 = gl_in[v1].gl_Position;
// convert to screen space
p0.xy = p0.xy / p0.w * screenSize;
p1.xy = p1.xy / p1.w * screenSize;
// compute dir and normal
vec2 lineDir = p1.xy - p0.xy;
vec2 lineNormal = normalize(vec2(-lineDir.y, lineDir.x));
// create screen-aligned quad
vec2 offset = lineNormal * lineWidth;
pos0 = vec4( (p0.xy + offset) * p0.w / screenSize, p0.z, p0.w);
pos1 = vec4( (p0.xy - offset) * p0.w / screenSize, p0.z, p0.w);
pos2 = vec4( (p1.xy + offset) * p1.w / screenSize, p1.z, p1.w);
pos3 = vec4( (p1.xy - offset) * p1.w / screenSize, p1.z, p1.w);
}
// emit a screen aligned quad along the edge v1-v2 // emit a screen aligned quad along the edge v1-v2
void createEdgeQuad(const int v0, const int v1, in vec2 screenSize, in float lineWidth) void createEdgeQuad(const int v0, const int v1, in vec2 screenSize, in float lineWidth)
{ {
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include <ACG/GL/gl.hh> #include <ACG/GL/gl.hh>
#include <ACG/GL/GLError.hh> #include <ACG/GL/GLError.hh>
#include <ACG/GL/FBO.hh> #include <ACG/GL/FBO.hh>
#include <ACG/GL/IRenderer.hh>
#include <iostream> #include <iostream>
#include <string> #include <string>
...@@ -639,7 +640,15 @@ void glViewer::drawScene() ...@@ -639,7 +640,15 @@ void glViewer::drawScene()
if ( renderManager().activeId( properties_.viewerId() ) == 0 ) { if ( renderManager().activeId( properties_.viewerId() ) == 0 ) {
drawScene_mono(); drawScene_mono();
} else { } else {
renderManager().active( properties_.viewerId() )->plugin->render(glstate_,properties_); RenderInterface* renderPlugin = renderManager().active( properties_.viewerId() )->plugin;
// eventually set viewer id in IRenderer
ACG::IRenderer* shaderRenderPlugin = dynamic_cast<ACG::IRenderer*>(renderPlugin);
if (shaderRenderPlugin)
shaderRenderPlugin->setViewerID( properties_.viewerId() );
renderPlugin->render(glstate_,properties_);
} }
checkGLError(); checkGLError();
......
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