BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Protected Attributes | List of all members
BALL::VIEW::Renderer Class Reference

#include <BALL/VIEW/RENDERING/RENDERERS/renderer.h>

Inheritance diagram for BALL::VIEW::Renderer:
BALL::VIEW::BufferedRenderer BALL::VIEW::GLRenderer BALL::VIEW::POVRenderer BALL::VIEW::STLRenderer BALL::VIEW::TilingRenderer BALL::VIEW::VRMLRenderer BALL::VIEW::XML3DRenderer BALL::VIEW::RaytracingRenderer BALL::VIEW::CudaVolumeRenderer BALL::VIEW::RTfactRenderer

Public Types

enum  StereoMode {
  NO_STEREO = 0, ACTIVE_STEREO, DUAL_VIEW_STEREO, DUAL_VIEW_DIFFERENT_DISPLAY_STEREO,
  TOP_BOTTOM_STEREO, INTERLACED_STEREO
}
 

Public Member Functions

Constructors and Destructors
 Renderer ()
 
 Renderer (const Renderer &renderer)
 
virtual ~Renderer ()
 
virtual void clear ()
 
virtual bool init (Scene &scene)
 
virtual bool init (const Stage &stage, float height, float width)
 
virtual void setLights (bool reset_all=false)
 Set the light sources according to the stage. More...
 
virtual void updateCamera (const Camera *camera=0)
 
virtual void updateMaterialForRepresentation (Representation const *)
 
virtual void updateBackgroundColor ()
 Update the background color from the stage. More...
 
virtual void setupEnvironmentMap (const QImage &image)
 Setup an environment map. More...
 
virtual void setupStereo (float eye_separation, float focal_length)
 
virtual void useContinuousLoop (bool use_loop)
 
bool isContinuous ()
 
virtual bool hasFPScounter ()
 
virtual double getFPS ()
 
virtual bool finish ()
 
virtual Vector3 mapViewportTo3D (Position x, Position y)
 
virtual Vector2 map3DToViewport (const Vector3 &vec)
 
virtual void pickObjects (Position x1, Position y1, Position x2, Position y2, std::list< GeometricObject * > &objects)
 
virtual void getFrustum (float &near_f, float &far_f, float &left_f, float &right_f, float &top_f, float &bottom_f)
 
Accessors
virtual bool renderOneRepresentation (const Representation &representation)
 
virtual void bufferRepresentation (const Representation &)
 
virtual void removeRepresentation (const Representation &)
 
virtual const StagegetStage () const
 
virtual void setStage (const Stage &stage)
 
bool hasStage () const
 Test if a Stage was assigned to the Renderer. More...
 
virtual void setSize (float width, float height)
 Set the size of the display. More...
 
virtual float getWidth () const
 
virtual float getHeight () const
 
virtual void setPreviewMode (bool show_preview)
 
virtual void showLightSources (bool show_light_sources)
 
virtual void renderRuler ()
 
virtual void setStereoMode (StereoMode state)
 
virtual StereoMode getStereoMode () const
 
virtual void setStereoFrustumConversion (int width_factor, int height_factor)
 

Protected Attributes

Scenescene_
 
const Stagestage_
 
float width_
 
float height_
 
bool show_preview_
 
float volume_width_
 
bool show_light_sources_
 
Camera camera_
 
Vector3 camera_offset_
 
bool use_continuous_loop_
 
Size stereo_frustum_conversion_width_
 
Size stereo_frustum_conversion_height_
 
StereoMode stereo_
 

Predicates

bool operator== (const Renderer &) const
 
virtual void render_ (const GeometricObject *object)
 Wrapper for the renderering of special GeometricObjects. More...
 
virtual void renderClippingPlane_ (const ClippingPlane &)
 
virtual void renderLabel_ (const Label &)
 
virtual void renderLine_ (const Line &)
 Render a line. More...
 
virtual void renderMultiLine_ (const MultiLine &)
 Render an illuminated line. More...
 
virtual void renderMesh_ (const Mesh &)
 Render a surface mesh. More...
 
virtual void renderPoint_ (const Point &)
 Render a single point. More...
 
virtual void renderBox_ (const Box &)
 Render a box. More...
 
virtual void renderSimpleBox_ (const SimpleBox &)
 Render a simple box (parallel to the axes) More...
 
virtual void renderSphere_ (const Sphere &)
 Render a sphere. More...
 
virtual void renderDisc_ (const Disc &)
 Render a disc. More...
 
virtual void renderTube_ (const Tube &)
 Render a tube. More...
 
virtual void renderTwoColoredLine_ (const TwoColoredLine &)
 Render a line with two colors. More...
 
virtual void renderTwoColoredTube_ (const TwoColoredTube &)
 Render a tube with two colors. More...
 
virtual void renderGridVisualisation_ (const GridVisualisation &)
 Render a grid. More...
 
virtual void renderQuadMesh_ (const QuadMesh &)
 Render a quad mesh. More...
 

Detailed Description

Renderer is just a generic base class. Derived classes are GLRenderer and POVRenderer. Every renderer has a pointer to a Stage object, which contains the viewpoint, the LightSource, etc. The renderer also knows the width and height, of the display, it shall render.

Definition at line 54 of file renderer.h.

Member Enumeration Documentation

Enumerator
NO_STEREO 
ACTIVE_STEREO 

Stereo mode for shutter glasses.

DUAL_VIEW_STEREO 

Stereo mode for output on two projectors.

DUAL_VIEW_DIFFERENT_DISPLAY_STEREO 

Stereo mode for output on two projectors with one display per head.

TOP_BOTTOM_STEREO 

Stereo mode for top bottom views.

INTERLACED_STEREO 

Line interlaced stereo.

Definition at line 59 of file renderer.h.

Constructor & Destructor Documentation

BALL::VIEW::Renderer::Renderer ( )

Default Constructor.

BALL::VIEW::Renderer::Renderer ( const Renderer renderer)

Copy constructor.

virtual BALL::VIEW::Renderer::~Renderer ( )
inlinevirtual

Destructor

Definition at line 95 of file renderer.h.

Member Function Documentation

virtual void BALL::VIEW::Renderer::bufferRepresentation ( const Representation )
inlinevirtual

Buffer a Representation for later rendering.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::RTfactRenderer, and BALL::VIEW::TilingRenderer.

Definition at line 191 of file renderer.h.

virtual void BALL::VIEW::Renderer::clear ( )
inlinevirtual

Explicit default initialization.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::XML3DRenderer, BALL::VIEW::POVRenderer, BALL::VIEW::VRMLRenderer, and BALL::VIEW::STLRenderer.

Definition at line 99 of file renderer.h.

virtual bool BALL::VIEW::Renderer::finish ( )
virtual
virtual double BALL::VIEW::Renderer::getFPS ( )
inlinevirtual

Internal renderer FPS if available, otherwise returns 0.

Reimplemented in BALL::VIEW::RTfactRenderer.

Definition at line 154 of file renderer.h.

virtual void BALL::VIEW::Renderer::getFrustum ( float near_f,
float far_f,
float left_f,
float right_f,
float top_f,
float bottom_f 
)
virtual

Return the frustum used by this renderer.

Reimplemented in BALL::VIEW::GLRenderer, and BALL::VIEW::RTfactRenderer.

virtual float BALL::VIEW::Renderer::getHeight ( ) const
inlinevirtual

Definition at line 217 of file renderer.h.

virtual const Stage& BALL::VIEW::Renderer::getStage ( ) const
inlinevirtual

Get the stage for the renderer (const)

Definition at line 199 of file renderer.h.

virtual StereoMode BALL::VIEW::Renderer::getStereoMode ( ) const
virtual
virtual float BALL::VIEW::Renderer::getWidth ( ) const
inlinevirtual

Definition at line 214 of file renderer.h.

virtual bool BALL::VIEW::Renderer::hasFPScounter ( )
inlinevirtual

Whether renderer has its own FPS counter.

Reimplemented in BALL::VIEW::RTfactRenderer.

Definition at line 150 of file renderer.h.

bool BALL::VIEW::Renderer::hasStage ( ) const

Test if a Stage was assigned to the Renderer.

virtual bool BALL::VIEW::Renderer::init ( Scene scene)
virtual

Initialization routines. This method is called by Scene::initializeGL.

Reimplemented in BALL::VIEW::XML3DRenderer, and BALL::VIEW::RTfactRenderer.

virtual bool BALL::VIEW::Renderer::init ( const Stage stage,
float  height,
float  width 
)
virtual

Initialisation with the Stage. Called by Scene::exportScene().

Reimplemented in BALL::VIEW::XML3DRenderer, BALL::VIEW::GLRenderer, and BALL::VIEW::POVRenderer.

bool BALL::VIEW::Renderer::isContinuous ( )
inline

Returns the mode of the render loop.

Definition at line 146 of file renderer.h.

virtual Vector2 BALL::VIEW::Renderer::map3DToViewport ( const Vector3 vec)
virtual

Compute the 2D position on the screen corresponding to the 3D point vec

Reimplemented in BALL::VIEW::TilingRenderer.

virtual Vector3 BALL::VIEW::Renderer::mapViewportTo3D ( Position  x,
Position  y 
)
virtual

Compute the 3D position on the view plane corresponding to point (x,y) on the view port

Reimplemented in BALL::VIEW::TilingRenderer.

bool BALL::VIEW::Renderer::operator== ( const Renderer ) const
inline

Definition at line 255 of file renderer.h.

virtual void BALL::VIEW::Renderer::pickObjects ( Position  x1,
Position  y1,
Position  x2,
Position  y2,
std::list< GeometricObject * > &  objects 
)
virtual

Pick all objects in the given screen rectangle.

Reimplemented in BALL::VIEW::GLRenderer, and BALL::VIEW::RTfactRenderer.

virtual void BALL::VIEW::Renderer::removeRepresentation ( const Representation )
inlinevirtual

Remove a representation from the buffer.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::RTfactRenderer, and BALL::VIEW::TilingRenderer.

Definition at line 195 of file renderer.h.

virtual void BALL::VIEW::Renderer::render_ ( const GeometricObject object)
virtual

Wrapper for the renderering of special GeometricObjects.

Reimplemented in BALL::VIEW::TilingRenderer.

virtual void BALL::VIEW::Renderer::renderBox_ ( const Box )
inlineprotectedvirtual

Render a box.

Reimplemented in BALL::VIEW::GLRenderer.

Definition at line 288 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderClippingPlane_ ( const ClippingPlane )
inlineprotectedvirtual

Reimplemented in BALL::VIEW::GLRenderer.

Definition at line 264 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderDisc_ ( const Disc )
inlineprotectedvirtual

Render a disc.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::XML3DRenderer, and BALL::VIEW::POVRenderer.

Definition at line 300 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderGridVisualisation_ ( const GridVisualisation )
inlineprotectedvirtual

Render a grid.

Reimplemented in BALL::VIEW::GLRenderer.

Definition at line 316 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderLabel_ ( const Label )
inlineprotectedvirtual

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::XML3DRenderer, and BALL::VIEW::POVRenderer.

Definition at line 268 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderLine_ ( const Line )
inlineprotectedvirtual
virtual void BALL::VIEW::Renderer::renderMesh_ ( const Mesh )
inlineprotectedvirtual
virtual void BALL::VIEW::Renderer::renderMultiLine_ ( const MultiLine )
inlineprotectedvirtual

Render an illuminated line.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::XML3DRenderer, and BALL::VIEW::POVRenderer.

Definition at line 276 of file renderer.h.

virtual bool BALL::VIEW::Renderer::renderOneRepresentation ( const Representation representation)
virtual
virtual void BALL::VIEW::Renderer::renderPoint_ ( const Point )
inlineprotectedvirtual

Render a single point.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::XML3DRenderer, and BALL::VIEW::POVRenderer.

Definition at line 284 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderQuadMesh_ ( const QuadMesh )
inlineprotectedvirtual

Render a quad mesh.

Reimplemented in BALL::VIEW::GLRenderer.

Definition at line 319 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderRuler ( )
virtual

Render a ruler.

If supported by the renderer implementation, this function will 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.

Reimplemented in BALL::VIEW::GLRenderer, and BALL::VIEW::TilingRenderer.

virtual void BALL::VIEW::Renderer::renderSimpleBox_ ( const SimpleBox )
inlineprotectedvirtual

Render a simple box (parallel to the axes)

Reimplemented in BALL::VIEW::GLRenderer.

Definition at line 292 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderSphere_ ( const Sphere )
inlineprotectedvirtual
virtual void BALL::VIEW::Renderer::renderTube_ ( const Tube )
inlineprotectedvirtual
virtual void BALL::VIEW::Renderer::renderTwoColoredLine_ ( const TwoColoredLine )
inlineprotectedvirtual

Render a line with two colors.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::XML3DRenderer, BALL::VIEW::POVRenderer, BALL::VIEW::VRMLRenderer, and BALL::VIEW::STLRenderer.

Definition at line 308 of file renderer.h.

virtual void BALL::VIEW::Renderer::renderTwoColoredTube_ ( const TwoColoredTube )
inlineprotectedvirtual

Render a tube with two colors.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::XML3DRenderer, BALL::VIEW::POVRenderer, BALL::VIEW::VRMLRenderer, and BALL::VIEW::STLRenderer.

Definition at line 312 of file renderer.h.

virtual void BALL::VIEW::Renderer::setLights ( bool  reset_all = false)
virtual

Set the light sources according to the stage.

Reimplemented in BALL::VIEW::RTfactRenderer, BALL::VIEW::GLRenderer, and BALL::VIEW::TilingRenderer.

virtual void BALL::VIEW::Renderer::setPreviewMode ( bool  show_preview)
inlinevirtual

Decides whether the renderer should use a faster preview mode. Please note that not all renderers support previews and may choose just to ignore this setting.

Definition at line 223 of file renderer.h.

virtual void BALL::VIEW::Renderer::setSize ( float  width,
float  height 
)
inlinevirtual

Set the size of the display.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::RTfactRenderer, BALL::VIEW::TilingRenderer, and BALL::VIEW::XML3DRenderer.

Definition at line 211 of file renderer.h.

virtual void BALL::VIEW::Renderer::setStage ( const Stage stage)
inlinevirtual

Set the stage for the renderer

Definition at line 204 of file renderer.h.

virtual void BALL::VIEW::Renderer::setStereoFrustumConversion ( int  width_factor,
int  height_factor 
)
virtual
virtual void BALL::VIEW::Renderer::setStereoMode ( StereoMode  state)
virtual
virtual void BALL::VIEW::Renderer::setupEnvironmentMap ( const QImage &  image)
virtual

Setup an environment map.

Reimplemented in BALL::VIEW::RTfactRenderer.

virtual void BALL::VIEW::Renderer::setupStereo ( float  eye_separation,
float  focal_length 
)
virtual

Sets this renderer as a part of a stereo setup.

eye_separation denotes the distance along the right vector used by this "eye".

Reimplemented in BALL::VIEW::GLRenderer, and BALL::VIEW::RTfactRenderer.

virtual void BALL::VIEW::Renderer::showLightSources ( bool  show_light_sources)
inlinevirtual

Decides whether to draw light sources explicitly. Please note that not all renderers support this feature and may choose just to ignore this setting.

Definition at line 229 of file renderer.h.

virtual void BALL::VIEW::Renderer::updateBackgroundColor ( )
virtual

Update the background color from the stage.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::RTfactRenderer, and BALL::VIEW::TilingRenderer.

virtual void BALL::VIEW::Renderer::updateCamera ( const Camera camera = 0)
virtual

Update the camera position either from a given Camera, or from the default Stage.

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::RTfactRenderer, and BALL::VIEW::TilingRenderer.

virtual void BALL::VIEW::Renderer::updateMaterialForRepresentation ( Representation const *  )
inlinevirtual

Updates the material for the current representation

Reimplemented in BALL::VIEW::GLRenderer, BALL::VIEW::RTfactRenderer, and BALL::VIEW::RaytracingRenderer.

Definition at line 121 of file renderer.h.

virtual void BALL::VIEW::Renderer::useContinuousLoop ( bool  use_loop)
inlinevirtual

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

Reimplemented in BALL::VIEW::RTfactRenderer.

Definition at line 138 of file renderer.h.

Member Data Documentation

Camera BALL::VIEW::Renderer::camera_
protected

Definition at line 345 of file renderer.h.

Vector3 BALL::VIEW::Renderer::camera_offset_
protected

Definition at line 348 of file renderer.h.

float BALL::VIEW::Renderer::height_
protected

Definition at line 333 of file renderer.h.

Scene* BALL::VIEW::Renderer::scene_
protected

Definition at line 324 of file renderer.h.

bool BALL::VIEW::Renderer::show_light_sources_
protected

Definition at line 342 of file renderer.h.

bool BALL::VIEW::Renderer::show_preview_
protected

Definition at line 336 of file renderer.h.

const Stage* BALL::VIEW::Renderer::stage_
protected

Definition at line 327 of file renderer.h.

StereoMode BALL::VIEW::Renderer::stereo_
protected

Definition at line 355 of file renderer.h.

Size BALL::VIEW::Renderer::stereo_frustum_conversion_height_
protected

Definition at line 353 of file renderer.h.

Size BALL::VIEW::Renderer::stereo_frustum_conversion_width_
protected

Definition at line 352 of file renderer.h.

bool BALL::VIEW::Renderer::use_continuous_loop_
protected

Definition at line 350 of file renderer.h.

float BALL::VIEW::Renderer::volume_width_
protected

Definition at line 339 of file renderer.h.

float BALL::VIEW::Renderer::width_
protected

Definition at line 330 of file renderer.h.