Developer Documentation
|
Classes | |
class | DepthMapPass |
struct | LightData |
Public Member Functions | |
virtual void | addRenderObject (RenderObject *_renderObject) |
Callback for the scenegraph nodes, which send new render objects via this function. More... | |
virtual void | addLight (const LightData &_light) |
Callback for the scenegraph nodes, which send new lights to the renderer via this function. More... | |
void | dumpRenderObjectsToFile (const char *_fileName, ACG::RenderObject **_sortedList=0) const |
Debugging function to dump list of render objects into a file. More... | |
virtual QString | dumpCurrentRenderObjectsToString (ACG::RenderObject **_list=0, bool _outputShaders=false, std::vector< ACG::ShaderModifier * > *_modifiers=0) |
Outputs the current render objects to the string. More... | |
void | setErrorDetectionLevel (int _level) |
Control error detection for checking render objects. More... | |
int | getErrorDetectionLevel () const |
Get error detection level. | |
void | setViewerID (int _viewerID) |
Set currently active viewer id. More... | |
Protected Member Functions | |
virtual void | prepareRenderingPipeline (ACG::GLState *_glState, ACG::SceneGraph::DrawModes::DrawMode _drawMode, ACG::SceneGraph::BaseNode *_scenegraphRoot) |
Prepares renderer and OpenGL for any draw-related calls including. More... | |
virtual void | collectRenderObjects (ACG::GLState *_glState, ACG::SceneGraph::DrawModes::DrawMode _drawMode, ACG::SceneGraph::BaseNode *_sceneGraphRoot) |
Traverse the scenegraph to collect render information. More... | |
void | traverseRenderableNodes (ACG::GLState *_glState, ACG::SceneGraph::DrawModes::DrawMode _drawMode, ACG::SceneGraph::BaseNode *_node, const ACG::SceneGraph::Material *_mat) |
Scene graph traversal for render object collection. More... | |
virtual void | sortRenderObjects () |
Sort the renderobjects by priority. More... | |
virtual void | renderObject (ACG::RenderObject *_obj, GLSL::Program *_prog=0, bool _constRenderStates=false, const std::vector< unsigned int > *_shaderModifiers=0) |
Render one renderobject. More... | |
virtual void | bindObjectVBO (ACG::RenderObject *_obj, GLSL::Program *_prog) |
Binding VBOs (First state function) More... | |
virtual void | bindObjectUniforms (ACG::RenderObject *_obj, GLSL::Program *_prog) |
Binding Uniforms (Second state function) More... | |
virtual void | bindObjectRenderStates (ACG::RenderObject *_obj) |
Binding Render state (Third state function) More... | |
virtual void | drawObject (ACG::RenderObject *_obj) |
Executes the opengl draw call for one object (Fourth function) More... | |
virtual void | finishRenderingPipeline (bool _drawOverlay=true) |
Draw overlay objects and reset OpenGL state. More... | |
virtual void | saveInputFbo () |
Save input Fbo configuration (fbo id + viewport) | |
virtual void | restoreInputFbo () |
Restore the previously saved input Fbo configuration (fbo id + viewport) | |
virtual void | saveActiveFbo (GLint *_outFboId, GLint *_outViewport, GLint *_outDrawBuffer) const |
Save active Fbo configuration (fbo id + viewport) More... | |
virtual void | restoreFbo (GLint _fboId, const GLint *_outViewport, GLint _drawBuffer) const |
Restore a previously saved input Fbo configuration (fbo id + viewport) More... | |
virtual void | clearInputFbo (const ACG::Vec4f &_clearColor) |
Clear input Fbo. More... | |
virtual void | copyDepthToBackBuffer (GLuint _depthTex, float _scale=1.0f) |
Copy texture to depth buffer. More... | |
virtual void | renderDepthMap (int _viewerID, int _width, int _height) |
Render the depth map of the scene. More... | |
int | getNumRenderObjects () const |
Get the number of collected render objects (not including overlay objects or gl4.2 line objects) | |
int | getNumOverlayObjects () const |
Get the number of render objects in the overlay (for instance objects from coordsys are overlayed) | |
int | getNumLineGL42Objects () const |
Get the number of default line objects rendered with opengl 4.2. | |
int | getNumLights () const |
Get the number of current light sources. | |
ACG::RenderObject * | getRenderObject (int i) |
Get render objects in the sorted list by index (not including overlay objects) | |
ACG::RenderObject * | getOverlayRenderObject (int i) |
Get render objects in the sorted list by index (only overlay objects) | |
ACG::RenderObject * | getLineGL42RenderObject (int i) |
Get render objects in the sorted list by index (only line objects rendered with gl4.2) | |
LightData * | getLight (int i) |
Get light by index. | |
const ACG::Vec3f & | getGlobalAmbientScale () const |
Get global ambient light contribution from GL_LIGHT_MODEL_AMBIENT. | |
void | setLineThicknessRenderingGL42 (bool _enable) |
Static Protected Member Functions | |
static int | cmpPriority (const void *, const void *) |
Compare priority of render objects. More... | |
Protected Attributes | |
int | numLights_ |
Number of Lights. | |
LightData | lights_ [SG_MAX_SHADER_LIGHTS] |
Light sources ( Filled by addLight() ) | |
ACG::Vec3f | globalLightModelAmbient_ |
std::vector< ACG::RenderObject > | renderObjects_ |
array of renderobjects, filled by addRenderObject() | |
std::vector< ACG::RenderObject * > | sortedObjects_ |
sorted list of renderobjects without overlay objects (sorted in rendering order) | |
std::vector< ACG::RenderObject * > | overlayObjects_ |
sorted list of overlay-only renderobjects (sorted in rendering order) | |
std::map< int, ACG::FBO * > | depthMaps_ |
bool | depthMapUsed_ |
true if at least one renderobject requires a scene depthmap, false otherwise | |
int | curViewerID_ |
currently active viewer ID as specified in prepareRenderObjects() | |
GLMatrixf | viewMatrix_ |
view transform | |
Vec3f | camPosWS_ |
cam position in world-space | |
Vec3f | camDirWS_ |
direction the camera is looking to in world-space | |
GLint | prevFbo_ |
previous fbo | |
GLint | prevDrawBuffer_ |
previous drawbuffer target (ie GL_BACK, GL_COLOR_ATTACHMENTi...) | |
GLint | prevViewport_ [4] |
previous viewport | |
bool | prevFboSaved_ |
flag indicating a that saveCurrentFbo() has been called prior restoreFbo() | |
GLSL::Program * | depthCopyShader_ |
shader copies depth of the first front layer to the back buffer | |
int | errorDetectionLevel_ |
error-detection level for checking render objects | |
Private Member Functions | |
void | renderLineThicknessGL42 () |
Private Attributes | |
bool | enableLineThicknessGL42_ |
Enable/disable gl4.2 based technique for rendering thick lines. More... | |
std::vector< RenderObject * > | lineGL42Objects_ |
default line render objects that are rendered with gl4.2 | |
std::map< int, Texture * > | lineColorBuffers_ |
map from viewport id to line buffer | |
Definition at line 84 of file MeshNode2T.cc.
|
virtual |
Callback for the scenegraph nodes, which send new lights to the renderer via this function.
Scenegraph nodes are able to add new light sources to the renderer with this function. To so, the node should implement getRenderObjects() and call addLight in there. LightNodes use this for example.
_light | Newly added light |
|
virtual |
Callback for the scenegraph nodes, which send new render objects via this function.
AddRenderObject is typically called by a scenegraph nodes during the collection of renderable objects. A renderobject is a collection of opengl states, buffers and parameters, that correspond to exactly one draw call.
Creates another RenderObject instance internally, safe for temporary local RenderObject instances.
_renderObject | Newly added render object |
|
protectedvirtual |
Binding Render state (Third state function)
This is the third function called by renderObject().
Prepare the opengl state machine for a renderobject draw call.
This includes any glEnable/glDisable states, depth-cmp functions, blend equation..
|
protectedvirtual |
Binding Uniforms (Second state function)
This is the second function called by renderObject().
Set common shader constants like model-view-projection matrix, material colors and light params.
|
protectedvirtual |
Binding VBOs (First state function)
This is the first function called by renderObject().
It binds vertex, index buffer and vertex format of a render object.
|
protectedvirtual |
Clear input Fbo.
Clears color and depth buffer of input Fbo (using a scissor test to only clear viewport area).
_clearColor | clear color |
|
staticprotected |
Compare priority of render objects.
compare function for qsort. This is required to compare render objects based on their prioerity and render them in the right order
|
protectedvirtual |
Traverse the scenegraph to collect render information.
Traverses the scenegraph and calls the getRenderObject function of each node. Each node can then add multiple renderobjects via addRenderObject to this renderer.
Also collects all light sources in the scenegraph. The currently active list of renderobjects is invalidated too.
|
protectedvirtual |
Copy texture to depth buffer.
Copies depth values from a texture to the input depth buffer. These are the changes made to the OpenGL state, which are not restored upon return:
_depthTex | texture containing depth values |
_scale | scaling factor for the depth values from _depthTex |
|
protectedvirtual |
Executes the opengl draw call for one object (Fourth function)
This is the fourth function called by renderObject().
Executes one draw call for the given render object
|
virtual |
Outputs the current render objects to the string.
_list | Pointer to a list of render objects used for output (defaults to unsorted internal list) |
_outputShaders | Output the shaders used for the objects? |
_modifiers | Pointer to vector of registered ShaderModifier |
void ACG::SceneGraph::ACG::IRenderer::dumpRenderObjectsToFile | ( | const char * | _fileName, |
ACG::RenderObject ** | _sortedList = 0 |
||
) | const |
Debugging function to dump list of render objects into a file.
Dump list of render objects to text file.
_fileName | name of text file to write to |
_sortedList | dump sorted render objects in order, may be 0 to use the unsorted list instead |
|
protectedvirtual |
Draw overlay objects and reset OpenGL state.
Optionally renders overlay objects. Resets critical OpenGL states to default to prevent crashes.
|
protectedvirtual |
Prepares renderer and OpenGL for any draw-related calls including.
Prepares renderer and OpenGL for any draw-related calls including:
_glState | pointer to glstate |
_drawMode | default drawmode |
_scenegraphRoot | root node of scenegraph |
|
protectedvirtual |
Render the depth map of the scene.
When setting up a shader of a render-object, a scenegraph node can use the depth map for custom rendering techniques. If at least one render object calls this function, the depth map is later rendered before the scene pass. and bound to the shader of an renderobject in bindObjectUniforms according to the provided "depthMapUniformName". Depth Map format: GL_TEXTURE_2D, GL_R32F, depth value = gl_FragCoord.z This function is automatically called in prepareRenderingPipeline() when required.
_viewerID | id of viewport, |
_width | viewport width |
_height | viewport height |
|
protectedvirtual |
Render one renderobject.
Fully prepares opengl for a renderobject and executes the draw call. This combines bindObjectVBO, bindObjectUniforms...
Optionally render-states may not be changed, in case depth-peeling or similar global shader operations may require a fixed state setting.
Shader modifiers can be combined and applied to this pass.
|
protectedvirtual |
Restore a previously saved input Fbo configuration (fbo id + viewport)
_fboId | fbo id |
_outViewport | [in] pointer to address of 4 GLint values receiving the currently active viewport |
_drawBuffer | draw-buffer target of fbo |
|
protectedvirtual |
Save active Fbo configuration (fbo id + viewport)
_outFboId | [out] pointer to address receiving the currently active fbo id |
_outViewport | [out] pointer to address of 4 GLint values receiving the currently active viewport |
_outDrawBuffer | [out] pointer to address receiving the currently active drawbuffer target (ie GL_BACK, GL_COLOR_ATTACHMENTi ..) |
void ACG::SceneGraph::ACG::IRenderer::setErrorDetectionLevel | ( | int | _level | ) |
Control error detection for checking render objects.
Levels: 0 - disable error detection 1 - fast check (obvious stuff that does not require much time to check) 2 - intensive check (do additional check, possibly false positives and impact on performance)
Default level is 1
_level | detection level |
|
protected |
Enable/disable line thickness rendering with opengl4.2
Instead of quad extrusion in a geometry shader, thick lines are manually rasterized in a load/store image. This image is then composited with the back buffer. If the gpu does not support image load/store, the default quad extrusion is used anyway and this function has no effect.
_enable | enable/disable |
void ACG::SceneGraph::ACG::IRenderer::setViewerID | ( | int | _viewerID | ) |
Set currently active viewer id.
If the scenegraph makes use of the z-prepass feature and the application uses multiple viewports, the currently active viewport should be set prior rendering. Otherwise, this function can be ignored.
_viewerID | unique id of the current viewport (i.e. ViewerProperties::viewerID() ) |
|
protectedvirtual |
Sort the renderobjects by priority.
Sort array of renderobjects by priority and store the result in sortedObjects_.
|
protected |
Scene graph traversal for render object collection.
Calls getRenderObjects on each node of the scenegraph recursively.Calls getRenderObjects on each node of the scenegraph recursively. Each node then triggers the callbacks.
|
protected |
Stores fbo containing a depth map for each viewport. The depth map is computed in a z-prepass if at least one RenderObject makes use of the scene depth map. (optional convenience feature)
Definition at line 473 of file MeshNode2T.cc.
|
private |
Enable/disable gl4.2 based technique for rendering thick lines.
If enabled, default line objects are not returned via getRenderObject(), but are rendered in finishRenderingPipeline() just before drawing overlays.
Definition at line 519 of file MeshNode2T.cc.
|
protected |
ambient color scale for global light: this is set via glLightModel(GL_LIGHT_MODEL_AMBIENT, scale)
Definition at line 456 of file MeshNode2T.cc.