Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::Renderer Class Referenceabstract

Abstract renderer implementation. More...

#include <mitsuba/hw/renderer.h>

+ Inheritance diagram for mitsuba::Renderer:

Classes

struct  ShaderRecord
 

Public Types

enum  EBlendMode { EBlendNone = 0, EBlendAlpha, EBlendAdditive }
 
enum  ECullMode { ECullNone = 0, ECullFront, ECullBack }
 Possible culling modes. More...
 
enum  EMatrixType { EProjection = 0, EModelView }
 Matrices of the fixed function pipeline. More...
 
typedef std::pair< const
GPUGeometry *, Matrix4x4
TransformedGPUGeometry
 

Public Member Functions

const RendererCapabilitiesgetCapabilities () const
 Return the renderer's capabilities. More...
 
virtual void init (Device *device, Renderer *other=NULL)
 
virtual void reconfigure (const Device *device)=0
 Reconfigure the renderer for a certain device (e.g. after a resize event) More...
 
virtual void shutdown ()
 Shut the renderer down. More...
 
virtual GPUTexturecreateGPUTexture (const std::string &name, Bitmap *bitmap=NULL)=0
 Create a new GPU texture object. More...
 
virtual GPUProgramcreateGPUProgram (const std::string &name)=0
 Create a new GPU program object. More...
 
virtual GPUSynccreateGPUSync ()=0
 Create a new synchronization object. More...
 
virtual void clear ()=0
 Clear the viewport. More...
 
virtual void setCamera (const ProjectiveCamera *pCamera, const Point2 &apertureSample=Point2(0.5f), const Point2 &aaSample=Point2(0.5f), Float timeSample=0.5f)=0
 Configure the camera. More...
 
virtual void setCamera (const Matrix4x4 &proj, const Matrix4x4 &view)=0
 Configure the camera (manual) More...
 
virtual void setMatrix (EMatrixType type, const Matrix4x4 &value)=0
 Directly set the modelview or projection matrix. More...
 
virtual Matrix4x4 getMatrix (EMatrixType type) const =0
 Fetch the currently set modelview or projection matrix. More...
 
virtual void beginDrawingMeshes (bool transmitOnlyPositions=false)=0
 Set up the renderer for drawing triangle geometry. More...
 
virtual void drawMesh (const TriMesh *shape)=0
 Send a triangle mesh to the renderer. More...
 
virtual void drawMesh (const GPUGeometry *geo)=0
 Send a triangle mesh to the renderer. More...
 
virtual void endDrawingMeshes ()=0
 Clean up the renderer after drawing triangle geometry. More...
 
virtual void drawAll (const std::vector< TransformedGPUGeometry > &geo)=0
 Quickly draw all geometry that has been registered with the renderer. More...
 
virtual void blitTexture (const GPUTexture *texture, bool flipVertically=false, bool centerHoriz=true, bool centerVert=true, const Vector2i &offset=Vector2i(0, 0))=0
 Draw a quad using the given texture. More...
 
virtual void blitQuad (bool flipVertically)=0
 Blit a screen-sized quad. More...
 
virtual void drawText (const Point2i &pos, const Font *font, const std::string &text)=0
 
virtual void setPointSize (Float size)=0
 Set the size of point primitives. More...
 
virtual void drawPoint (const Point &p)=0
 Draw a point. More...
 
virtual void drawLine (const Point &a, const Point &b)=0
 Draw a line between two specified points. More...
 
virtual void drawPoint (const Point2 &p)=0
 Draw a point (2D) More...
 
virtual void drawPoint (const Point2i &p)=0
 Draw a point (2D, integer coordinates) More...
 
virtual void drawLine (const Point2 &a, const Point2 &b)=0
 Draw a line between two specified points (2D) More...
 
virtual void drawLine (const Point2i &a, const Point2i &b)=0
 Draw a line between two specified points (2D, integer coordinates) More...
 
virtual void drawRectangle (const Point2 &a, const Point2 &b)=0
 Draw a rectangle between two specified points (2D) More...
 
virtual void drawRectangle (const Point2i &a, const Point2i &b)=0
 Draw a rectangle between two specified points (2D, integer coordinates) More...
 
virtual void drawFilledRectangle (const Point2 &a, const Point2 &b)=0
 Draw a filled rectangle between two specified points (2D) More...
 
virtual void drawFilledRectangle (const Point2i &a, const Point2i &b)=0
 Draw a filled rectangle between two specified points (2D, integer coordinates) More...
 
virtual void drawEllipse (const Point &center, const Vector &axis1, const Vector &axis2)=0
 Draw an ellipse with the specified center and axes. More...
 
virtual void drawAABB (const AABB &aabb)=0
 Draw a wire-frame axis-aligned box. More...
 
virtual void setBlendMode (EBlendMode mode)=0
 Set the currently active blending mode. More...
 
virtual void setCullMode (ECullMode mode)=0
 Set the currently active culling mode. More...
 
virtual void setDepthTest (bool value)=0
 Activate or deactivate depth testing. More...
 
virtual void setDepthMask (bool value)=0
 Activate or deactivate the writing of depth information. More...
 
virtual void setColor (const Color3 &color, Float alpha=1.0f)=0
 Set the current fixed-function pipeline color. More...
 
virtual void setColor (const Spectrum &spec, Float alpha=1.0f)=0
 Set the current fixed-function pipeline color. More...
 
virtual void setClearDepth (Float depth)=0
 Set the depth value that is written by clear() More...
 
virtual void setClearColor (const Color3 &color)=0
 Set the color value that is written by clear() More...
 
virtual void clearTransforms ()=0
 Clear the view and projection transformations. More...
 
virtual void flush ()=0
 Flush outstanding rendering commands. More...
 
virtual void finish ()=0
 Completely finish outstanding rendering commands. More...
 
virtual void checkError (bool onlyWarn=true)=0
 Check for any error indications. More...
 
ShaderregisterShaderForResource (const HWResource *res)
 
ShadergetShaderForResource (const HWResource *res)
 Look up a shader by the associated HWResource object. More...
 
void unregisterShaderForResource (const HWResource *res)
 Decrease the reference count of a shader. Deletes it when zero is reached. More...
 
virtual GPUGeometrycreateGPUGeometry (const Shape *mesh)=0
 Create a new GPU geometry object. More...
 
GPUGeometryregisterGeometry (const Shape *shape)
 
bool unregisterGeometry (const Shape *shape)
 Unregister a triangle mesh from the renderer. More...
 
void setLogLevel (ELogLevel logLevel)
 Set the log level. More...
 
void setWarnLogLevel (ELogLevel logLevel)
 Set the log level for warnings. More...
 
virtual void debugString (const std::string &text)=0
 Send a debug string to the rendering backend. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Member Functions

static Renderercreate (Session *session)
 
- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

 Renderer (Session *session)
 Construct a new OpenI rendering interface. More...
 
virtual ~Renderer ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

ref< Sessionm_session
 
ref< Devicem_device
 
ref< RendererCapabilitiesm_capabilities
 
std::map< const HWResource
*, ShaderRecord
m_shaders
 
std::map< const Shape
*, GPUGeometry * > 
m_geometry
 
bool m_initialized
 
bool m_borrowed
 
std::string m_driverVendor
 
std::string m_driverRenderer
 
std::string m_driverVersion
 
ELogLevel m_logLevel
 
ELogLevel m_warnLogLevel
 

Detailed Description

Abstract renderer implementation.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
EBlendNone 

Blending turned off.

EBlendAlpha 

Normal alpha blending.

EBlendAdditive 

Additive blending.

Possible culling modes.

Enumerator
ECullNone 

No culling.

ECullFront 

Front-face culling.

ECullBack 

Back-face culling.

Matrices of the fixed function pipeline.

Enumerator
EProjection 
EModelView 

Constructor & Destructor Documentation

mitsuba::Renderer::Renderer ( Session session)
protected

Construct a new OpenI rendering interface.

virtual mitsuba::Renderer::~Renderer ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual void mitsuba::Renderer::beginDrawingMeshes ( bool  transmitOnlyPositions = false)
pure virtual

Set up the renderer for drawing triangle geometry.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::blitQuad ( bool  flipVertically)
pure virtual

Blit a screen-sized quad.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::blitTexture ( const GPUTexture texture,
bool  flipVertically = false,
bool  centerHoriz = true,
bool  centerVert = true,
const Vector2i offset = Vector2i(0, 0) 
)
pure virtual

Draw a quad using the given texture.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::checkError ( bool  onlyWarn = true)
pure virtual

Check for any error indications.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::clear ( )
pure virtual

Clear the viewport.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::clearTransforms ( )
pure virtual

Clear the view and projection transformations.

Implemented in mitsuba::GLRenderer.

static Renderer* mitsuba::Renderer::create ( Session session)
static
virtual GPUGeometry* mitsuba::Renderer::createGPUGeometry ( const Shape mesh)
pure virtual

Create a new GPU geometry object.

Implemented in mitsuba::GLRenderer.

virtual GPUProgram* mitsuba::Renderer::createGPUProgram ( const std::string &  name)
pure virtual

Create a new GPU program object.

Implemented in mitsuba::GLRenderer.

virtual GPUSync* mitsuba::Renderer::createGPUSync ( )
pure virtual

Create a new synchronization object.

Implemented in mitsuba::GLRenderer.

virtual GPUTexture* mitsuba::Renderer::createGPUTexture ( const std::string &  name,
Bitmap bitmap = NULL 
)
pure virtual

Create a new GPU texture object.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::debugString ( const std::string &  text)
pure virtual

Send a debug string to the rendering backend.

This is mainly useful when an OpenGL trace is captured by a tool such as 'apitrace'.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawAABB ( const AABB aabb)
pure virtual

Draw a wire-frame axis-aligned box.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawAll ( const std::vector< TransformedGPUGeometry > &  geo)
pure virtual

Quickly draw all geometry that has been registered with the renderer.

Only transmits positions, hence this is mainly useful for shadow mapping.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawEllipse ( const Point center,
const Vector axis1,
const Vector axis2 
)
pure virtual

Draw an ellipse with the specified center and axes.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawFilledRectangle ( const Point2 a,
const Point2 b 
)
pure virtual

Draw a filled rectangle between two specified points (2D)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawFilledRectangle ( const Point2i a,
const Point2i b 
)
pure virtual

Draw a filled rectangle between two specified points (2D, integer coordinates)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawLine ( const Point a,
const Point b 
)
pure virtual

Draw a line between two specified points.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawLine ( const Point2 a,
const Point2 b 
)
pure virtual

Draw a line between two specified points (2D)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawLine ( const Point2i a,
const Point2i b 
)
pure virtual

Draw a line between two specified points (2D, integer coordinates)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawMesh ( const TriMesh shape)
pure virtual

Send a triangle mesh to the renderer.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawMesh ( const GPUGeometry geo)
pure virtual

Send a triangle mesh to the renderer.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawPoint ( const Point p)
pure virtual

Draw a point.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawPoint ( const Point2 p)
pure virtual

Draw a point (2D)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawPoint ( const Point2i p)
pure virtual

Draw a point (2D, integer coordinates)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawRectangle ( const Point2 a,
const Point2 b 
)
pure virtual

Draw a rectangle between two specified points (2D)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawRectangle ( const Point2i a,
const Point2i b 
)
pure virtual

Draw a rectangle between two specified points (2D, integer coordinates)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::drawText ( const Point2i pos,
const Font font,
const std::string &  text 
)
pure virtual

Draw a line of text on the screen. The coordinates are specified in pixel coordinates, where the upper left corner is the origin

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::endDrawingMeshes ( )
pure virtual

Clean up the renderer after drawing triangle geometry.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::finish ( )
pure virtual

Completely finish outstanding rendering commands.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::flush ( )
pure virtual

Flush outstanding rendering commands.

Implemented in mitsuba::GLRenderer.

const RendererCapabilities* mitsuba::Renderer::getCapabilities ( ) const
inline

Return the renderer's capabilities.

virtual const Class* mitsuba::Renderer::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

Reimplemented in mitsuba::GLRenderer, mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.

virtual Matrix4x4 mitsuba::Renderer::getMatrix ( EMatrixType  type) const
pure virtual

Fetch the currently set modelview or projection matrix.

Implemented in mitsuba::GLRenderer.

Shader* mitsuba::Renderer::getShaderForResource ( const HWResource res)

Look up a shader by the associated HWResource object.

virtual void mitsuba::Renderer::init ( Device device,
Renderer other = NULL 
)
virtual

Initialize the renderer. Optionally, an existing renderer instance can be provided as a second argument – this establishes a link between them to permit sharing of textures, programs, etc.

Reimplemented in mitsuba::GLRenderer, mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.

virtual void mitsuba::Renderer::reconfigure ( const Device device)
pure virtual

Reconfigure the renderer for a certain device (e.g. after a resize event)

Implemented in mitsuba::GLRenderer.

GPUGeometry* mitsuba::Renderer::registerGeometry ( const Shape shape)

Register a triangle mesh with the renderer. This will transfer the associated geometry to the GPU, which accelerates later calls to drawMesh()

Shader* mitsuba::Renderer::registerShaderForResource ( const HWResource res)

Register a shader with this renderer. Increases the reference count if it already exists

virtual void mitsuba::Renderer::setBlendMode ( EBlendMode  mode)
pure virtual

Set the currently active blending mode.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setCamera ( const ProjectiveCamera pCamera,
const Point2 apertureSample = Point2(0.5f),
const Point2 aaSample = Point2(0.5f),
Float  timeSample = 0.5f 
)
pure virtual

Configure the camera.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setCamera ( const Matrix4x4 proj,
const Matrix4x4 view 
)
pure virtual

Configure the camera (manual)

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setClearColor ( const Color3 color)
pure virtual

Set the color value that is written by clear()

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setClearDepth ( Float  depth)
pure virtual

Set the depth value that is written by clear()

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setColor ( const Color3 color,
Float  alpha = 1.0f 
)
pure virtual

Set the current fixed-function pipeline color.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setColor ( const Spectrum spec,
Float  alpha = 1.0f 
)
pure virtual

Set the current fixed-function pipeline color.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setCullMode ( ECullMode  mode)
pure virtual

Set the currently active culling mode.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setDepthMask ( bool  value)
pure virtual

Activate or deactivate the writing of depth information.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setDepthTest ( bool  value)
pure virtual

Activate or deactivate depth testing.

Implemented in mitsuba::GLRenderer.

void mitsuba::Renderer::setLogLevel ( ELogLevel  logLevel)
inline

Set the log level.

virtual void mitsuba::Renderer::setMatrix ( EMatrixType  type,
const Matrix4x4 value 
)
pure virtual

Directly set the modelview or projection matrix.

Implemented in mitsuba::GLRenderer.

virtual void mitsuba::Renderer::setPointSize ( Float  size)
pure virtual

Set the size of point primitives.

Implemented in mitsuba::GLRenderer.

void mitsuba::Renderer::setWarnLogLevel ( ELogLevel  logLevel)
inline

Set the log level for warnings.

virtual void mitsuba::Renderer::shutdown ( )
virtual

Shut the renderer down.

Reimplemented in mitsuba::GLRenderer, mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.

bool mitsuba::Renderer::unregisterGeometry ( const Shape shape)

Unregister a triangle mesh from the renderer.

void mitsuba::Renderer::unregisterShaderForResource ( const HWResource res)

Decrease the reference count of a shader. Deletes it when zero is reached.

Member Data Documentation

bool mitsuba::Renderer::m_borrowed
protected
ref<RendererCapabilities> mitsuba::Renderer::m_capabilities
protected
ref<Device> mitsuba::Renderer::m_device
protected
std::string mitsuba::Renderer::m_driverRenderer
protected
std::string mitsuba::Renderer::m_driverVendor
protected
std::string mitsuba::Renderer::m_driverVersion
protected
std::map<const Shape*, GPUGeometry *> mitsuba::Renderer::m_geometry
protected
bool mitsuba::Renderer::m_initialized
protected
ELogLevel mitsuba::Renderer::m_logLevel
protected
ref<Session> mitsuba::Renderer::m_session
protected
std::map<const HWResource*, ShaderRecord> mitsuba::Renderer::m_shaders
protected
Class* mitsuba::Renderer::m_theClass
static
ELogLevel mitsuba::Renderer::m_warnLogLevel
protected

The documentation for this class was generated from the following file: