BALL
1.4.79
|
#include <BALL/VIEW/RENDERING/renderSetup.h>
Public Types | |
enum | RendererType { UNKNOWN_RENDERER = 0, OPENGL_RENDERER, POV_RENDERER, VRML_RENDERER, STL_RENDERER, TILING_RENDERER, RTFACT_RENDERER } |
enum | STEREO_SETUP { NONE, LEFT_EYE, RIGHT_EYE } |
Public Attributes | |
Renderer * | renderer |
RenderTarget * | target |
QWaitCondition | wait_for_render |
Mutex | loop_mutex |
Protected Member Functions | |
void | renderToBuffer_ () |
void | initType_ () |
Protected Attributes | |
bool | rendering_paused_ |
bool | receive_updates_ |
bool | use_offset_ |
bool | about_to_quit_ |
Camera | camera_ |
Vector3 | camera_offset_ |
STEREO_SETUP | stereo_setup_ |
bool | use_continuous_loop_ |
Scene * | scene_ |
Stage const * | stage_ |
Mutex | render_mutex_ |
bool | show_ruler_ |
GLRenderWindow * | gl_target_ |
GLRenderer * | gl_renderer_ |
int | ttl_ |
bool | export_after_ttl_ |
String | export_after_ttl_filename_ |
std::deque< boost::shared_ptr < RenderSetup > > | keep_in_sync_ |
bool | buffer_is_ready_ |
RendererType | renderer_type_ |
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.
Definition at line 44 of file renderSetup.h.
The type of the encapsulated renderer
Definition at line 62 of file renderSetup.h.
Enumerator | |
---|---|
NONE | |
LEFT_EYE | |
RIGHT_EYE |
Definition at line 86 of file renderSetup.h.
BALL::VIEW::RenderSetup::RenderSetup | ( | Renderer * | r, |
RenderTarget * | t, | ||
Scene * | scene, | ||
const Stage * | stage | ||
) |
BALL::VIEW::RenderSetup::RenderSetup | ( | const RenderSetup & | rs | ) |
|
virtual |
|
inline |
Returns true if the buffer has been filled and just waits for painting.
Definition at line 300 of file renderSetup.h.
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.
Render the current state into a PNG file.
|
inline |
Export rendered image to PNG after time to live has expired.
Definition at line 280 of file renderSetup.h.
|
inline |
Definition at line 309 of file renderSetup.h.
|
inline |
Returns the type of the encapsulated renderer.
Definition at line 121 of file renderSetup.h.
|
inline |
Returns the time to live for this renderer.
Definition at line 276 of file renderSetup.h.
void BALL::VIEW::RenderSetup::init | ( | ) |
Initialize renderer and target.
|
protected |
|
inline |
Indicates whether the renderer has already been stopped.
Definition at line 258 of file renderSetup.h.
|
inline |
Returns the mode of the render loop.
Definition at line 262 of file renderSetup.h.
|
inline |
This function returns the rendering state of our renderer.
Definition at line 117 of file renderSetup.h.
bool BALL::VIEW::RenderSetup::isReadyToSwap | ( | ) |
Returns true iff bufferIsReady() holds for this renderer and all dependent ones.
|
inline |
Definition at line 292 of file renderSetup.h.
|
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.
|
inline |
Definition at line 312 of file renderSetup.h.
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
const RenderSetup& BALL::VIEW::RenderSetup::operator= | ( | const RenderSetup & | rs | ) |
|
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.
Definition at line 106 of file renderSetup.h.
void BALL::VIEW::RenderSetup::pickObjects | ( | Position | x1, |
Position | y1, | ||
Position | x2, | ||
Position | y2, | ||
std::list< GeometricObject * > & | objects | ||
) |
Pick all objects in the given screen rectangle.
Position BALL::VIEW::RenderSetup::prepareGridTextures | ( | const RegularData3D & | grid, |
const ColorMap & | map | ||
) |
Send a grid texture to the renderer.
If the current renderer can not handle this kind of object, this is a noop.
void BALL::VIEW::RenderSetup::projectionModeChanged | ( | ) |
Notifies the renderer that the projection mode has changed.
|
inline |
Returns the buffering state of the renderer.
Definition at line 142 of file renderSetup.h.
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.
|
protected |
|
virtual |
|
inline |
Definition at line 306 of file renderSetup.h.
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.
|
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.
Definition at line 138 of file renderSetup.h.
|
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.
Definition at line 164 of file renderSetup.h.
|
inline |
Sets the number of render operations this renderer should perform.
Every render operation will decrease the time to live of this RenderSetup. If ttl == 0, the owner of this RenderSetup (e.g., the Scene), will usually destroy this instance.
To represent an infinite live time, set ttl = -1 (this is also the default).
Definition at line 272 of file renderSetup.h.
void BALL::VIEW::RenderSetup::setupEnvironmentMap | ( | const QImage & | image | ) |
Setup an environment map if supported by the Renderer.
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.
|
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.
Definition at line 113 of file renderSetup.h.
|
inline |
Signal the renderer to quit as soon as possible.
Note: this function works asynchronously, so a rs.wait(); maybe required.
Definition at line 254 of file renderSetup.h.
|
inline |
Definition at line 293 of file renderSetup.h.
void BALL::VIEW::RenderSetup::updateBackgroundColor | ( | ) |
Setup background color.
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::updateMaterialForRepresentation | ( | const Representation * | rep | ) |
void BALL::VIEW::RenderSetup::useContinuousLoop | ( | bool | use_loop | ) |
Decide between event based and (threaded) continuous loop rendering.
|
protected |
Definition at line 324 of file renderSetup.h.
|
protected |
Definition at line 360 of file renderSetup.h.
|
protected |
Definition at line 326 of file renderSetup.h.
|
protected |
Definition at line 327 of file renderSetup.h.
|
protected |
Definition at line 353 of file renderSetup.h.
|
protected |
Definition at line 354 of file renderSetup.h.
|
protected |
Definition at line 348 of file renderSetup.h.
|
protected |
Definition at line 344 of file renderSetup.h.
|
protected |
Definition at line 358 of file renderSetup.h.
|
mutable |
Definition at line 297 of file renderSetup.h.
|
protected |
Definition at line 321 of file renderSetup.h.
|
mutableprotected |
Definition at line 338 of file renderSetup.h.
Renderer* BALL::VIEW::RenderSetup::renderer |
Definition at line 57 of file renderSetup.h.
|
protected |
Definition at line 363 of file renderSetup.h.
|
protected |
Definition at line 320 of file renderSetup.h.
|
protected |
Definition at line 334 of file renderSetup.h.
|
protected |
Definition at line 340 of file renderSetup.h.
|
protected |
Definition at line 335 of file renderSetup.h.
|
protected |
Definition at line 329 of file renderSetup.h.
RenderTarget* BALL::VIEW::RenderSetup::target |
Definition at line 58 of file renderSetup.h.
|
protected |
Definition at line 351 of file renderSetup.h.
|
protected |
Definition at line 332 of file renderSetup.h.
|
protected |
Definition at line 322 of file renderSetup.h.
|
mutable |
Definition at line 295 of file renderSetup.h.