BALL::VIEW::RenderSetup Class Reference

#include <BALL/VIEW/RENDERING/renderSetup.h>

Inheritance diagram for BALL::VIEW::RenderSetup:
Inheritance graph
[legend]

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 RenderSetupoperator= (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, std::list< GeometricObject * > &objects)
void showRuler (bool show)
void projectionModeChanged ()
void useContinuousLoop (bool use_loop)
bool isContinuous ()
virtual void makeCurrent ()
virtual void run ()

Public Attributes

Rendererrenderer
RenderTargettarget

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_
Scenescene_
Stage const * stage_
Mutex render_mutex_
Size width_
Size height_
bool do_resize_
bool show_ruler_
GLRenderWindowgl_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.

Definition at line 36 of file renderSetup.h.


Member Enumeration Documentation

Enumerator:
NONE 
LEFT_EYE 
RIGHT_EYE 

Definition at line 50 of file renderSetup.h.


Constructor & Destructor Documentation

BALL::VIEW::RenderSetup::RenderSetup ( Renderer r,
RenderTarget t,
Scene scene,
const Stage stage 
)
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.

Definition at line 206 of file renderSetup.h.

bool BALL::VIEW::RenderSetup::isPaused (  )  const [inline]

This function returns the rendering state of our renderer.

Definition at line 81 of file renderSetup.h.

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

Vector3 BALL::VIEW::RenderSetup::mapViewportTo3D ( Position  x,
Position  y 
)

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  ) 
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.

Definition at line 70 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.

bool BALL::VIEW::RenderSetup::receivesBufferUpdates (  )  const [inline]

Returns the buffering state of the renderer.

Definition at line 102 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.

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.

Definition at line 98 of file renderSetup.h.

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.

Definition at line 124 of file renderSetup.h.

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.

Definition at line 77 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::useContinuousLoop ( bool  use_loop  ) 

Decide between event based and (threaded) continuous loop rendering.


Member Data Documentation

Definition at line 226 of file renderSetup.h.

Definition at line 227 of file renderSetup.h.

Definition at line 242 of file renderSetup.h.

Definition at line 248 of file renderSetup.h.

Definition at line 241 of file renderSetup.h.

Definition at line 223 of file renderSetup.h.

Definition at line 238 of file renderSetup.h.

Definition at line 47 of file renderSetup.h.

Definition at line 222 of file renderSetup.h.

Definition at line 234 of file renderSetup.h.

Definition at line 244 of file renderSetup.h.

Definition at line 235 of file renderSetup.h.

Definition at line 229 of file renderSetup.h.

Definition at line 48 of file renderSetup.h.

Definition at line 232 of file renderSetup.h.

Definition at line 224 of file renderSetup.h.

Definition at line 240 of file renderSetup.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Generated by  doxygen 1.6.3