Abstract renderer implementation. More...
#include <mitsuba/hw/renderer.h>
Inheritance diagram for Renderer:Classes | |
| struct | ShaderRecord |
Public Types | |
| enum | EBlendMode { EBlendNone, EBlendAlpha, EBlendAdditive } |
| enum | ECullMode { ECullNone, ECullFront, ECullBack } |
Public Member Functions | |
| const RendererCapabilities * | getCapabilities () const |
| Return the renderer's capabilities. | |
| 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) | |
| virtual void | shutdown () |
| Shut the renderer down. | |
| virtual GPUTexture * | createGPUTexture (const std::string &name, Bitmap *bitmap=NULL)=0 |
| Create a new GPU texture object. | |
| virtual GPUGeometry * | createGPUGeometry (const TriMesh *mesh)=0 |
| Create a new GPU geometry object. | |
| virtual GPUProgram * | createGPUProgram (const std::string &name)=0 |
| Create a new GPU program object. | |
| virtual GPUSync * | createGPUSync ()=0 |
| Create a new synchronization object. | |
| virtual void | clear ()=0 |
| Clear the viewport. | |
| virtual void | setCamera (const ProjectiveCamera *camera)=0 |
| Configure the camera. | |
| virtual void | setCamera (const ProjectiveCamera *camera, const Point2 &jitter)=0 |
| Configure the camera (supports a pixel offset) | |
| virtual void | setCamera (const Matrix4x4 &proj, const Matrix4x4 &view)=0 |
| Configure the camera (manual) | |
| virtual void | beginDrawingMeshes (bool transmitOnlyPositions=false)=0 |
| Set up the renderer for drawing triangle geometry. | |
| virtual void | drawTriMesh (const TriMesh *mesh)=0 |
| Send a triangle mesh to the renderer. | |
| virtual void | endDrawingMeshes ()=0 |
| Clean up the renderer after drawing triangle geometry. | |
| virtual void | drawAll (const std::vector< std::pair< const GPUGeometry *, Transform > > &geo)=0 |
| Quickly draw all geometry that has been registered with the renderer. | |
| 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. | |
| virtual void | blitQuad (bool flipVertically)=0 |
| Blit a screen-sized quad. | |
| 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. | |
| virtual void | drawPoint (const Point &p)=0 |
| Draw a point. | |
| virtual void | drawLine (const Point &a, const Point &b)=0 |
| Draw a line between two specified points. | |
| virtual void | drawEllipse (const Point ¢er, const Vector &axis1, const Vector &axis2)=0 |
| Draw an ellipse with the specified center and axes. | |
| virtual void | drawAABB (const AABB &aabb)=0 |
| Draw a wire-frame axis-aligned box. | |
| virtual void | setDepthOffset (Float value)=0 |
| Set a depth offset for shadow mapping (0 to disable) | |
| virtual void | setBlendMode (EBlendMode mode)=0 |
| Set the currently active blending mode. | |
| virtual void | setCullMode (ECullMode mode)=0 |
| Set the currently active culling mode. | |
| virtual void | setDepthTest (bool value)=0 |
| Activate or deactivate depth testing. | |
| virtual void | setDepthMask (bool value)=0 |
| Activate or deactivate the writing of depth information. | |
| virtual void | setColorMask (bool value)=0 |
| Activate or deactivate the writing of color information. | |
| virtual void | setColor (const Spectrum &spec, Float alpha=1.0f)=0 |
| Set the current fixed-function pipeline color. | |
| virtual void | pushTransform (const Transform &trafo)=0 |
| Push a view transformation onto the matrix stack. | |
| virtual void | popTransform ()=0 |
| Pop the last view transformation from the matrix stack. | |
| virtual void | flush ()=0 |
| Flush outstanding rendering commands. | |
| virtual void | finish ()=0 |
| Completely finish outstanding rendering commands. | |
| virtual void | checkError (bool onlyWarn=true)=0 |
| Check for any error indications. | |
| Shader * | registerShaderForResource (const HWResource *res) |
| Shader * | getShaderForResource (const HWResource *res) |
| Look up a shader by the associated HWResource object. | |
| void | unregisterShaderForResource (const HWResource *res) |
| GPUGeometry * | registerGeometry (const TriMesh *mesh) |
| void | unregisterGeometry (const TriMesh *mesh) |
| Unregister a triangle mesh from the renderer. | |
| void | setLogLevel (ELogLevel logLevel) |
| Set the log level. | |
| void | setWarnLogLevel (ELogLevel logLevel) |
| Set the log level for warnings. | |
Static Public Member Functions | |
| static Renderer * | create (Session *session) |
Protected Member Functions | |
| Renderer (Session *session) | |
| Construct a new OpenI rendering interface. | |
| virtual | ~Renderer () |
| Virtual destructor. | |
Protected Attributes | |
| ref< Session > | m_session |
| ref< Device > | m_device |
| ref< RendererCapabilities > | m_capabilities |
| std::map< const HWResource *, ShaderRecord > | m_shaders |
| std::map< const TriMesh *, 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.
| enum Renderer::EBlendMode |
| enum Renderer::ECullMode |
| Renderer::Renderer | ( | Session * | session | ) | [protected] |
Construct a new OpenI rendering interface.
| virtual Renderer::~Renderer | ( | ) | [protected, virtual] |
Virtual destructor.
| virtual void Renderer::beginDrawingMeshes | ( | bool | transmitOnlyPositions = false | ) | [pure virtual] |
Set up the renderer for drawing triangle geometry.
Implemented in GLRenderer.
| virtual void Renderer::blitQuad | ( | bool | flipVertically | ) | [pure virtual] |
Blit a screen-sized quad.
Implemented in GLRenderer.
| virtual void 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 GLRenderer.
| virtual void Renderer::checkError | ( | bool | onlyWarn = true | ) | [pure virtual] |
Check for any error indications.
Implemented in GLRenderer.
| virtual void Renderer::clear | ( | ) | [pure virtual] |
Clear the viewport.
Implemented in GLRenderer.
| virtual GPUGeometry* Renderer::createGPUGeometry | ( | const TriMesh * | mesh | ) | [pure virtual] |
Create a new GPU geometry object.
Implemented in GLRenderer.
| virtual GPUProgram* Renderer::createGPUProgram | ( | const std::string & | name | ) | [pure virtual] |
Create a new GPU program object.
Implemented in GLRenderer.
| virtual GPUSync* Renderer::createGPUSync | ( | ) | [pure virtual] |
Create a new synchronization object.
Implemented in GLRenderer.
| virtual GPUTexture* Renderer::createGPUTexture | ( | const std::string & | name, |
| Bitmap * | bitmap = NULL |
||
| ) | [pure virtual] |
Create a new GPU texture object.
Implemented in GLRenderer.
| virtual void Renderer::drawAABB | ( | const AABB & | aabb | ) | [pure virtual] |
Draw a wire-frame axis-aligned box.
Implemented in GLRenderer.
| virtual void Renderer::drawAll | ( | const std::vector< std::pair< const GPUGeometry *, Transform > > & | 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 GLRenderer.
| virtual void Renderer::drawEllipse | ( | const Point & | center, |
| const Vector & | axis1, | ||
| const Vector & | axis2 | ||
| ) | [pure virtual] |
Draw an ellipse with the specified center and axes.
Implemented in GLRenderer.
Draw a line between two specified points.
Implemented in GLRenderer.
| virtual void Renderer::drawPoint | ( | const Point & | p | ) | [pure virtual] |
Draw a point.
Implemented in GLRenderer.
| virtual void 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 GLRenderer.
| virtual void Renderer::drawTriMesh | ( | const TriMesh * | mesh | ) | [pure virtual] |
Send a triangle mesh to the renderer.
Implemented in GLRenderer.
| virtual void Renderer::endDrawingMeshes | ( | ) | [pure virtual] |
Clean up the renderer after drawing triangle geometry.
Implemented in GLRenderer.
| virtual void Renderer::finish | ( | ) | [pure virtual] |
Completely finish outstanding rendering commands.
Implemented in GLRenderer.
| virtual void Renderer::flush | ( | ) | [pure virtual] |
Flush outstanding rendering commands.
Implemented in GLRenderer.
| const RendererCapabilities* Renderer::getCapabilities | ( | ) | const [inline] |
Return the renderer's capabilities.
| Shader* 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 GLRenderer, NSGLRenderer, GLXRenderer, and WGLRenderer.
| virtual void Renderer::popTransform | ( | ) | [pure virtual] |
Pop the last view transformation from the matrix stack.
Implemented in GLRenderer.
| virtual void Renderer::pushTransform | ( | const Transform & | trafo | ) | [pure virtual] |
Push a view transformation onto the matrix stack.
Implemented in GLRenderer.
| virtual void Renderer::reconfigure | ( | const Device * | device | ) | [pure virtual] |
Reconfigure the renderer for a certain device (e.g. after a resize event)
Implemented in GLRenderer.
| GPUGeometry* Renderer::registerGeometry | ( | const TriMesh * | mesh | ) |
Register a triangle mesh with the renderer. This will transfer the associated geometry to the GPU, which accelerates later calls to drawTriMesh()
| Shader* Renderer::registerShaderForResource | ( | const HWResource * | res | ) |
Register a shader with this renderer. Increases the reference count if it already exists
| virtual void Renderer::setBlendMode | ( | EBlendMode | mode | ) | [pure virtual] |
Set the currently active blending mode.
Implemented in GLRenderer.
| virtual void Renderer::setCamera | ( | const ProjectiveCamera * | camera | ) | [pure virtual] |
Configure the camera.
Implemented in GLRenderer.
| virtual void Renderer::setCamera | ( | const ProjectiveCamera * | camera, |
| const Point2 & | jitter | ||
| ) | [pure virtual] |
Configure the camera (supports a pixel offset)
Implemented in GLRenderer.
Configure the camera (manual)
Implemented in GLRenderer.
Set the current fixed-function pipeline color.
Implemented in GLRenderer.
| virtual void Renderer::setColorMask | ( | bool | value | ) | [pure virtual] |
Activate or deactivate the writing of color information.
Implemented in GLRenderer.
| virtual void Renderer::setCullMode | ( | ECullMode | mode | ) | [pure virtual] |
Set the currently active culling mode.
Implemented in GLRenderer.
| virtual void Renderer::setDepthMask | ( | bool | value | ) | [pure virtual] |
Activate or deactivate the writing of depth information.
Implemented in GLRenderer.
| virtual void Renderer::setDepthOffset | ( | Float | value | ) | [pure virtual] |
Set a depth offset for shadow mapping (0 to disable)
Implemented in GLRenderer.
| virtual void Renderer::setDepthTest | ( | bool | value | ) | [pure virtual] |
Activate or deactivate depth testing.
Implemented in GLRenderer.
| void Renderer::setLogLevel | ( | ELogLevel | logLevel | ) | [inline] |
Set the log level.
| virtual void Renderer::setPointSize | ( | Float | size | ) | [pure virtual] |
Set the size of point primitives.
Implemented in GLRenderer.
| void Renderer::setWarnLogLevel | ( | ELogLevel | logLevel | ) | [inline] |
Set the log level for warnings.
| virtual void Renderer::shutdown | ( | ) | [virtual] |
Shut the renderer down.
Reimplemented in GLRenderer, NSGLRenderer, GLXRenderer, and WGLRenderer.
| void Renderer::unregisterGeometry | ( | const TriMesh * | mesh | ) |
Unregister a triangle mesh from the renderer.
| void Renderer::unregisterShaderForResource | ( | const HWResource * | res | ) |
Decrease the reference count of a shader. Deletes it when zero is reached
bool Renderer::m_borrowed [protected] |
ref<RendererCapabilities> Renderer::m_capabilities [protected] |
ref<Device> Renderer::m_device [protected] |
std::string Renderer::m_driverRenderer [protected] |
std::string Renderer::m_driverVendor [protected] |
std::string Renderer::m_driverVersion [protected] |
std::map<const TriMesh*, GPUGeometry *> Renderer::m_geometry [protected] |
bool Renderer::m_initialized [protected] |
ELogLevel Renderer::m_logLevel [protected] |
ref<Session> Renderer::m_session [protected] |
std::map<const HWResource*, ShaderRecord> Renderer::m_shaders [protected] |
ELogLevel Renderer::m_warnLogLevel [protected] |