Abstract renderer implementation. More...
#include <mitsuba/hw/renderer.h>
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 RendererCapabilities * | getCapabilities () 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 GPUTexture * | createGPUTexture (const std::string &name, Bitmap *bitmap=NULL)=0 |
Create a new GPU texture object. More... | |
virtual GPUProgram * | createGPUProgram (const std::string &name)=0 |
Create a new GPU program object. More... | |
virtual GPUSync * | createGPUSync ()=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 ¢er, 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... | |
Shader * | registerShaderForResource (const HWResource *res) |
Shader * | getShaderForResource (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 GPUGeometry * | createGPUGeometry (const Shape *mesh)=0 |
Create a new GPU geometry object. More... | |
GPUGeometry * | registerGeometry (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 Class * | getClass () 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 Renderer * | create (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 Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_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< Session > | m_session |
ref< Device > | m_device |
ref< RendererCapabilities > | m_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 |
Abstract renderer implementation.
typedef std::pair<const GPUGeometry *, Matrix4x4> mitsuba::Renderer::TransformedGPUGeometry |
Enumerator | |
---|---|
EBlendNone |
Blending turned off. |
EBlendAlpha |
Normal alpha blending. |
EBlendAdditive |
Additive blending. |
|
protected |
Construct a new OpenI rendering interface.
|
protectedvirtual |
Virtual destructor.
|
pure virtual |
Set up the renderer for drawing triangle geometry.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Blit a screen-sized quad.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Draw a quad using the given texture.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Check for any error indications.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Clear the viewport.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Clear the view and projection transformations.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Create a new GPU geometry object.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Create a new GPU program object.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Create a new synchronization object.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Create a new GPU texture object.
Implemented in mitsuba::GLRenderer.
|
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.
|
pure virtual |
Draw a wire-frame axis-aligned box.
Implemented in mitsuba::GLRenderer.
|
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.
|
pure virtual |
Draw an ellipse with the specified center and axes.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Draw a filled rectangle between two specified points (2D)
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Draw a filled rectangle between two specified points (2D, integer coordinates)
Implemented in mitsuba::GLRenderer.
Draw a line between two specified points.
Implemented in mitsuba::GLRenderer.
Draw a line between two specified points (2D)
Implemented in mitsuba::GLRenderer.
Draw a line between two specified points (2D, integer coordinates)
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Send a triangle mesh to the renderer.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Send a triangle mesh to the renderer.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Draw a point.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Draw a point (2D)
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Draw a point (2D, integer coordinates)
Implemented in mitsuba::GLRenderer.
Draw a rectangle between two specified points (2D)
Implemented in mitsuba::GLRenderer.
Draw a rectangle between two specified points (2D, integer coordinates)
Implemented in mitsuba::GLRenderer.
|
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.
|
pure virtual |
Clean up the renderer after drawing triangle geometry.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Completely finish outstanding rendering commands.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Flush outstanding rendering commands.
Implemented in mitsuba::GLRenderer.
|
inline |
Return the renderer's capabilities.
|
virtual |
Retrieve this object's class.
Reimplemented from Object.
Reimplemented in mitsuba::GLRenderer, mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.
|
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.
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.
|
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
|
pure virtual |
Set the currently active blending mode.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Configure the camera.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Configure the camera (manual)
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Set the color value that is written by clear()
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Set the depth value that is written by clear()
Implemented in mitsuba::GLRenderer.
Set the current fixed-function pipeline color.
Implemented in mitsuba::GLRenderer.
Set the current fixed-function pipeline color.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Set the currently active culling mode.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Activate or deactivate the writing of depth information.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Activate or deactivate depth testing.
Implemented in mitsuba::GLRenderer.
|
inline |
Set the log level.
|
pure virtual |
Directly set the modelview or projection matrix.
Implemented in mitsuba::GLRenderer.
|
pure virtual |
Set the size of point primitives.
Implemented in mitsuba::GLRenderer.
|
inline |
Set the log level for warnings.
|
virtual |
Shut the renderer down.
Reimplemented in mitsuba::GLRenderer, mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.
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.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
protected |