BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
BALL::VIEW::BufferedRenderer Class Referenceabstract

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

Inheritance diagram for BALL::VIEW::BufferedRenderer:
BALL::VIEW::Renderer BALL::Object BALL::AutoDeletable

Public Member Functions

 BufferedRenderer ()
 
virtual ~BufferedRenderer () throw ()
 
bool setFrameBufferFormat (const FrameBufferFormat &format)
 
void renderToBuffer (RenderTarget *renderTarget, const Stage &stage) throw (BALL::Exception::InvalidFormat, BALL::Exception::NoBufferAvailable)
 
virtual bool supports (const PixelFormat &format) const =0
 
virtual Resolution getSupportedResolution (const Resolution &min, const Resolution &max, const PixelFormat &format) const =0 throw (BALL::Exception::FormatUnsupported)
 
- Public Member Functions inherited from BALL::VIEW::Renderer
 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 updateBackgroundColor ()
 Update the background color from the stage. More...
 
virtual void setupStereo (float eye_separation, float focal_length)
 
virtual void useContinuousLoop (bool use_loop)
 
bool isContinuous ()
 
virtual bool finish ()
 
virtual Vector3 mapViewportTo3D (Position x, Position y)
 
virtual Vector2 map3DToViewport (const Vector3 &vec)
 
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 ()
 
bool operator== (const Renderer &) const
 
virtual void render_ (const GeometricObject *object)
 Wrapper for the renderering of special GeometricObjects. More...
 
- Public Member Functions inherited from BALL::Object
 Object ()
 Default constructor. More...
 
 Object (const Object &object)
 Copy constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
const Objectoperator= (const Object &)
 
bool operator== (const Object &object) const
 
bool operator!= (const Object &object) const
 
bool operator< (const Object &object) const
 
bool operator<= (const Object &object) const
 
bool operator>= (const Object &object) const
 
bool operator> (const Object &object) const
 
int compare (const Object &object) const
 
virtual bool isValid () const
 
virtual void dump (::std::ostream &s=std::cout, Size depth=0) const
 
Handle getHandle () const
 
- Public Member Functions inherited from BALL::AutoDeletable
virtual ~AutoDeletable ()
 
void * operator new (size_t size)
 
void operator delete (void *ptr)
 
void * operator new (size_t size, void *ptr)
 
void operator delete (void *ptr, void *)
 
bool isAutoDeletable () const
 
void setAutoDeletable (bool enable)
 

Protected Member Functions

virtual bool supports (const FrameBufferFormat &format) const =0
 
virtual void formatUpdated ()=0
 
virtual void prepareBufferedRendering (const Stage &stage)=0
 
virtual void renderToBufferImpl (FrameBufferPtr buffer)=0
 
const FrameBufferFormatgetFrameBufferFormat () const
 
- Protected Member Functions inherited from BALL::VIEW::Renderer
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...
 

Private Attributes

FrameBufferFormat bufferFormat
 

Additional Inherited Members

- Static Public Member Functions inherited from BALL::Object
static Handle getNextHandle ()
 
static Handle getNewHandle ()
 
- Static Public Member Functions inherited from BALL::AutoDeletable
static void clearLastPtr ()
 
- Protected Attributes inherited from BALL::VIEW::Renderer
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_
 

Detailed Description

Interface for Buffered Rendering. BufferedRenderers don't create their own window. Instead, they render the scene to a FrameBuffer which is provided by a RenderTarget. The FrameBuffer contains a pointer to a memory area where the results will be stored, as well as the pixel format and the resolution. Before rendering can start, you have to choose an output format using the setFrameBufferFormat() function. After that, you can call renderToBuffer(), as long as the format of the RenderTarget is the same that you set before.

Definition at line 29 of file bufferedRenderer.h.

Constructor & Destructor Documentation

BALL::VIEW::BufferedRenderer::BufferedRenderer ( )
inline

Definition at line 33 of file bufferedRenderer.h.

virtual BALL::VIEW::BufferedRenderer::~BufferedRenderer ( ) throw ()
inlinevirtual

Definition at line 37 of file bufferedRenderer.h.

Member Function Documentation

virtual void BALL::VIEW::BufferedRenderer::formatUpdated ( )
protectedpure virtual
  This is called once the FrameBufferFormat has been set so the renderer

can perform any initialization steps that are needed.

const FrameBufferFormat& BALL::VIEW::BufferedRenderer::getFrameBufferFormat ( ) const
inlineprotected

Returns the current FrameBufferFormat.

Definition at line 116 of file bufferedRenderer.h.

virtual Resolution BALL::VIEW::BufferedRenderer::getSupportedResolution ( const Resolution min,
const Resolution max,
const PixelFormat format 
) const throw (BALL::Exception::FormatUnsupported)
pure virtual

Returns a supported resolution within the given limits. The x resolution will be between min.x and max.x and the y resolution will be between min.y and max.y. The returned resolution must be supported by the renderer with the requested PixelFormat.

virtual void BALL::VIEW::BufferedRenderer::prepareBufferedRendering ( const Stage stage)
protectedpure virtual

Prepare for the rendering, taking into account settings in Stage, eg. Camera, Lights, Background colors, etc.

void BALL::VIEW::BufferedRenderer::renderToBuffer ( RenderTarget renderTarget,
const Stage stage 
) throw (BALL::Exception::InvalidFormat, BALL::Exception::NoBufferAvailable)
inline

Render the current frame to the target's buffer using the Stage setup. Throws FrameBufferFormatException if the RenderTarget's format is not the one that you set before with setFrameBufferFormat().

Definition at line 59 of file bufferedRenderer.h.

virtual void BALL::VIEW::BufferedRenderer::renderToBufferImpl ( FrameBufferPtr  buffer)
protectedpure virtual

Render to the frame buffer.

Precondition
The frame buffer's format is the one stored in bufferFormat and prepareBufferedRendering() has been called.
bool BALL::VIEW::BufferedRenderer::setFrameBufferFormat ( const FrameBufferFormat format)
inline

Tries to choose a format for buffered rendering.

Returns
true if the format could be set, false if it is not supported.

Definition at line 43 of file bufferedRenderer.h.

virtual bool BALL::VIEW::BufferedRenderer::supports ( const PixelFormat format) const
pure virtual

Checks if a particular PixelFormat is supported by the renderer.

virtual bool BALL::VIEW::BufferedRenderer::supports ( const FrameBufferFormat format) const
protectedpure virtual

Checks if a particular FrameBufferFormat is supported by the renderer. This checks the combination of pixel format and resolution. If this returns true, the renderer is able to write to a buffer in this format.

Member Data Documentation

FrameBufferFormat BALL::VIEW::BufferedRenderer::bufferFormat
private

Definition at line 121 of file bufferedRenderer.h.