BALL::VIEW::RenderSetup Class Reference
#include <BALL/VIEW/RENDERING/renderSetup.h>
List of all members.
|
Public Types |
enum | STEREO_SETUP { NONE,
LEFT_EYE,
RIGHT_EYE
} |
Public Member Functions |
| RenderSetup (Renderer *r, RenderTarget *t, Scene *scene, const Stage *stage) |
| RenderSetup (const RenderSetup &rs) |
const RenderSetup & | operator= (const RenderSetup &rs) |
void | init () |
void | resize (Size width, Size height) |
void | pauseRendering () |
void | startRendering () |
bool | isPaused () const |
void | setReceiveBufferUpdates (bool do_receive) |
bool | receivesBufferUpdates () const |
void | updateCamera (const Camera *camera=0) |
void | setOffset (const Vector3 &offset) |
void | setStereoMode (STEREO_SETUP stereo) |
void | bufferRepresentation (const Representation &rep) |
void | removeRepresentation (const Representation &rep) |
void | renderToBuffer () |
bool | exportPNG (const String &filename) |
void | setLights (bool reset_all=false) |
void | updateBackgroundColor () |
Position | prepareGridTextures (const RegularData3D &grid, const ColorMap &map) |
void | removeGridTextures (const RegularData3D &grid) |
Vector3 | mapViewportTo3D (Position x, Position y) |
Vector2 | map3DToViewport (const Vector3 &vec) |
void | pickObjects (Position x1, Position y1, Position x2, Position y2, List< GeometricObject * > &objects) |
void | showRuler (bool show) |
void | useContinuousLoop (bool use_loop) |
bool | isContinuous () |
virtual void | makeCurrent () |
virtual void | run () |
Public Attributes |
Renderer * | renderer |
RenderTarget * | target |
Protected Member Functions |
void | renderToBuffer_ () |
Protected Attributes |
bool | rendering_paused_ |
bool | receive_updates_ |
bool | use_offset_ |
Camera | camera_ |
Vector3 | camera_offset_ |
STEREO_SETUP | stereo_setup_ |
bool | use_continuous_loop_ |
Scene * | scene_ |
Stage const * | stage_ |
Mutex | render_mutex_ |
Size | width_ |
Size | height_ |
bool | do_resize_ |
bool | show_ruler_ |
GLRenderWindow * | gl_target_ |
Detailed Description
This class encapsulates a (renderer, target) pair for Scene.
Please try to call functions inside this class instead of working with the renderers and targets directly to ensure thread safety.
Member Enumeration Documentation
Constructor & Destructor Documentation
BALL::VIEW::RenderSetup::RenderSetup |
( |
const RenderSetup & |
rs |
) |
|
Member Function Documentation
void BALL::VIEW::RenderSetup::bufferRepresentation |
( |
const Representation & |
rep |
) |
|
Makes the target the current context and forwards the given representation to the renderer for buffering.
If the renderer is not receiving buffer updates, this is a noop.
bool BALL::VIEW::RenderSetup::exportPNG |
( |
const String & |
filename |
) |
|
Render the current state into a PNG file.
void BALL::VIEW::RenderSetup::init |
( |
|
) |
|
Initialize renderer and target.
bool BALL::VIEW::RenderSetup::isContinuous |
( |
|
) |
[inline] |
Returns the mode of the render loop.
bool BALL::VIEW::RenderSetup::isPaused |
( |
|
) |
const [inline] |
This function returns the rendering state of our renderer.
virtual void BALL::VIEW::RenderSetup::makeCurrent |
( |
|
) |
[virtual] |
Ensure correct current rendering context.
If the target type uses a GL context, this is made current if necessary. If the target does not need GL, this function is a noop.
Vector2 BALL::VIEW::RenderSetup::map3DToViewport |
( |
const Vector3 & |
vec |
) |
|
Compute the 2D position on the screen corresponding to the 3D point vec
Compute the 3D position on the view plane corresponding to point (x,y) on the view port
void BALL::VIEW::RenderSetup::pauseRendering |
( |
|
) |
[inline] |
Pause rendering. This function allows to skip rendering while still buffering representations. Thus, a paused renderer will still receive all updates to representations, it will just not display anything.
Pick all objects in the given screen rectangle.
Send a grid texture to the renderer.
If the current renderer can not handle this kind of object, this is a noop.
bool BALL::VIEW::RenderSetup::receivesBufferUpdates |
( |
|
) |
const [inline] |
Returns the buffering state of the renderer.
void BALL::VIEW::RenderSetup::removeGridTextures |
( |
const RegularData3D & |
grid |
) |
|
Remove a grid texture from the renderer.
If the current renderer can not handle this kind of object, this is a noop.
void BALL::VIEW::RenderSetup::removeRepresentation |
( |
const Representation & |
rep |
) |
|
Makes the target the current context and forwards the given representation to the renderer for removal.
If the renderer is not receiving buffer updates, this is a noop.
void BALL::VIEW::RenderSetup::renderToBuffer |
( |
|
) |
|
Renders the current state into the given buffer.
Please note that this function only does anything when rendering is event-based, and if the renderer is not paused. If continuous rendering is set to true, the updates will be performed in a continuous loop instead and this function will immediately return.
void BALL::VIEW::RenderSetup::renderToBuffer_ |
( |
|
) |
[protected] |
void BALL::VIEW::RenderSetup::resize |
( |
Size |
width, |
|
|
Size |
height | |
|
) |
| | |
Resize renderer and target.
virtual void BALL::VIEW::RenderSetup::run |
( |
|
) |
[virtual] |
void BALL::VIEW::RenderSetup::setLights |
( |
bool |
reset_all = false |
) |
|
Calls light setup for the current renderer.
void BALL::VIEW::RenderSetup::setOffset |
( |
const Vector3 & |
offset |
) |
|
Sets an offset to apply to camera position and look at point.
Please note that the offset is interpreted as relative to the camera with components (right, up, view) and will be updated at each position change.
void BALL::VIEW::RenderSetup::setReceiveBufferUpdates |
( |
bool |
do_receive |
) |
[inline] |
Prevent updating of rendering buffers.
This function allows to prevent the renderer from buffering or deleting representations.
Please note that this is potentially dangerous, since the renderer will not be made aware of deleted representations. Callers should make sure that the renderer state is effectively reset upon reactivating this switch.
A common use case for this function is to support two render targets sharing one render context, where we want to prevent the second target from rebuffering all representations already seen by the first.
void BALL::VIEW::RenderSetup::setStereoMode |
( |
STEREO_SETUP |
stereo |
) |
[inline] |
This function turns the connected renderer into part of a stereo setup.
Depending on the value set here, renderers will be passed additional information upon update camera to set eye separation and focal distance or to prepare correct frustra.
void BALL::VIEW::RenderSetup::showRuler |
( |
bool |
show |
) |
|
Show a simple ruler.
If supported by the renderer implementation, this function can be used to produce a simple ruler that is rendered together with the other representations. The main use of this function is in the edit mode, where it can help to straighten-up structures and to correctly estimate angles and distances.
void BALL::VIEW::RenderSetup::startRendering |
( |
|
) |
[inline] |
This function allows to activate a paused renderer again. Please note that the corresponding window will not be automatically updated. This has to be performed by the caller.
void BALL::VIEW::RenderSetup::updateBackgroundColor |
( |
|
) |
|
void BALL::VIEW::RenderSetup::updateCamera |
( |
const Camera * |
camera = 0 |
) |
|
Tells the connected renderer to update its camera.
This function applies transformations like adding an offset to camera position and view point before handing over the camera to the renderer.
void BALL::VIEW::RenderSetup::useContinuousLoop |
( |
bool |
use_loop |
) |
|
Decide between event based and (threaded) continuous loop rendering.
Member Data Documentation