Ocular Engine
Ocular::Graphics::GraphicsDriver Class Reference
Inheritance diagram for Ocular::Graphics::GraphicsDriver:
Ocular::Graphics::D3D11GraphicsDriver

Public Member Functions

virtual bool initialize ()
 
virtual void clearBuffers (Core::Color const &clearColor=Core::Color::DefaultClearGray())
 
virtual void clearDepthBuffer (float value=1.0f)
 
virtual void clearStencilBuffer (uint32_t value=0)
 
virtual void swapBuffers ()
 
virtual RenderStategetRenderState ()
 
virtual void setRenderTexture (RenderTexture *texture)
 
virtual void setDepthTexture (DepthTexture *texture)
 
virtual MaterialcreateMaterial () const
 
virtual ViewportcreateViewport (float x, float y, float width, float height, float minDepth=0.0f, float maxDepth=1.0f) const
 
virtual TexturecreateTexture (TextureDescriptor const &descriptor) const
 
virtual Texture2DcreateTexture2D (TextureDescriptor const &descriptor) const
 
virtual RenderTexturecreateRenderTexture (TextureDescriptor const &descriptor) const
 
virtual DepthTexturecreateDepthTexture (TextureDescriptor const &descriptor) const
 
virtual uint32_t getMaxBoundTextures () const
 
virtual VertexShadercreateVertexShader () const
 
virtual GeometryShadercreateGeometryShader () const
 
virtual FragmentShadercreateFragmentShader () const
 
virtual PreTessellationShadercreatePreTessellationShader () const
 
virtual PostTessellationShadercreatePostTessellationShader () const
 
virtual UniformBuffercreateUniformBuffer (UniformBufferType type) const
 
virtual IndexBuffercreateIndexBuffer () const
 
virtual VertexBuffercreateVertexBuffer () const
 
virtual GPUBuffercreateGPUBuffer (GPUBufferDescriptor const &descriptor) const
 
virtual void drawDebugLine (Math::Vector3f const &start, Math::Vector3f const &stop, Core::Color const &color, uint64_t lifetime=30000)
 
virtual void drawDebugCircle (Math::Vector3f const &center, float radius, Math::Vector3f const &normal, Core::Color const &color, uint32_t segments=64, uint64_t lifetime=30000)
 
virtual void renderDebug ()
 
virtual bool renderMesh (Mesh *mesh, uint32_t submesh=0)
 
virtual bool renderBounds (Core::SceneObject *object, Math::BoundsType type)
 
void clearFrameStats ()
 
FrameStats getLastFrameStats () const
 

Protected Member Functions

void addDrawCall (uint32_t numIndices)
 

Protected Attributes

FrameStats m_LastFrameStats
 
FrameStats m_CurrFrameStats
 
Debug m_Debug
 
RenderStatem_RenderState
 

Member Function Documentation

void Ocular::Graphics::GraphicsDriver::addDrawCall ( uint32_t  numIndices)
protected

Updates the current frame stats with a new draw call.

void Ocular::Graphics::GraphicsDriver::clearBuffers ( Core::Color const &  clearColor = Core::Color::DefaultClearGray())
virtual

Clears the backbuffer RTV, and currently bound depth/stencil buffers.

The backbuffer is cleared to the specified color value. The depth buffer is cleared to 1.0. The stencil buffer is cleared to 0.

Parameters
[in]clearColor

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

void Ocular::Graphics::GraphicsDriver::clearDepthBuffer ( float  value = 1.0f)
virtual

Clears the active depth buffer to the specified value.

Parameters
[in]value

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

void Ocular::Graphics::GraphicsDriver::clearFrameStats ( )

Called at the beginning of a new frame to clear the frame statistics.

void Ocular::Graphics::GraphicsDriver::clearStencilBuffer ( uint32_t  value = 0)
virtual

Clears the active stencil buffer to the specified value.

Parameters
[in]value

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

DepthTexture * Ocular::Graphics::GraphicsDriver::createDepthTexture ( TextureDescriptor const &  descriptor) const
virtual

Creates a new API-specific implementation of the DepthTexture class.

Parameters
[in]descriptor
Returns
Returns the new instantiated texture. The caller must assume ownership of the texture and handle any cleanup. May return NULL if texture creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

FragmentShader * Ocular::Graphics::GraphicsDriver::createFragmentShader ( ) const
virtual

Creates a new API-specific implementation of the FragmentShader class.

Returns
Returns the new instantiated shader. The caller must assume ownership of the shader and handle any cleanup. May return NULL if shader creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

GeometryShader * Ocular::Graphics::GraphicsDriver::createGeometryShader ( ) const
virtual

Creates a new API-specific implementation of the GeometryShader class.

Returns
Returns the new instantiated shader. The caller must assume ownership of the shader and handle any cleanup. May return NULL if shader creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

GPUBuffer * Ocular::Graphics::GraphicsDriver::createGPUBuffer ( GPUBufferDescriptor const &  descriptor) const
virtual

Creates a new API-specific GPU Buffer. The type of underlying buffer depends on the parameters specified in the descriptor.

Parameters
[in]descriptor
Returns
Returns the new GPU Buffer. If the provided descriptor does not describe a valid buffer, then NULL is returned.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

IndexBuffer * Ocular::Graphics::GraphicsDriver::createIndexBuffer ( ) const
virtual

Creates a new API-specific implementation of the IndexBuffer class.

Returns
Returns the new instantiated buffer. The caller must assume ownership of the buffer and handle any cleanup. May return NULL if buffer creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

Material * Ocular::Graphics::GraphicsDriver::createMaterial ( ) const
virtual

Creates a new API-specific implementation of the Material class.

Returns
Returns the new instantiated material. The caller must assume ownership of the texture and handle any cleanup. May return NULL if texture creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

PostTessellationShader * Ocular::Graphics::GraphicsDriver::createPostTessellationShader ( ) const
virtual

Creates a new API-specific implementation of the PostTessellationShader class.

Returns
Returns the new instantiated shader. The caller must assume ownership of the shader and handle any cleanup. May return NULL if shader creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

PreTessellationShader * Ocular::Graphics::GraphicsDriver::createPreTessellationShader ( ) const
virtual

Creates a new API-specific implementation of the PreTessellationShader class.

Returns
Returns the new instantiated shader. The caller must assume ownership of the shader and handle any cleanup. May return NULL if shader creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

RenderTexture * Ocular::Graphics::GraphicsDriver::createRenderTexture ( TextureDescriptor const &  descriptor) const
virtual

Creates a new API-specific implementation of the RenderTexture class.

Parameters
[in]descriptor
Returns
Returns the new instantiated texture. The caller must assume ownership of the texture and handle any cleanup. May return NULL if texture creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

Texture * Ocular::Graphics::GraphicsDriver::createTexture ( TextureDescriptor const &  descriptor) const
virtual

Creates a new API-specific implementation of the Texture class.

Parameters
[in]descriptor
Returns
Returns the new instantiated texture. The caller must assume ownership of the texture and handle any cleanup. May return NULL if texture creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

Texture2D * Ocular::Graphics::GraphicsDriver::createTexture2D ( TextureDescriptor const &  descriptor) const
virtual

Creates a new API-specific implementation of the Texture2D class.

Parameters
[in]descriptor
Returns
Returns the new instantiated texture. The caller must assume ownership of the texture and handle any cleanup. May return NULL if texture creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

UniformBuffer * Ocular::Graphics::GraphicsDriver::createUniformBuffer ( UniformBufferType  type) const
virtual

Creates a new API-specific implementation of the UniformBuffer class.

Returns
Returns the new instantiated buffer. The caller must assume ownership of the buffer and handle any cleanup. May return NULL if buffer creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

VertexBuffer * Ocular::Graphics::GraphicsDriver::createVertexBuffer ( ) const
virtual

Creates a new API-specific implementation of the VertexBuffer class.

Returns
Returns the new instantiated buffer. The caller must assume ownership of the buffer and handle any cleanup. May return NULL if buffer creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

VertexShader * Ocular::Graphics::GraphicsDriver::createVertexShader ( ) const
virtual

Creates a new API-specific implementation of the VertexShader class.

Returns
Returns the new instantiated shader. The caller must assume ownership of the shader and handle any cleanup. May return NULL if shader creation failed.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

void Ocular::Graphics::GraphicsDriver::drawDebugCircle ( Math::Vector3f const &  center,
float  radius,
Math::Vector3f const &  normal,
Core::Color const &  color,
uint32_t  segments = 64,
uint64_t  lifetime = 30000 
)
virtual

Draws a 3D circle on all viewports that lasts for the specified length of time.

Parameters
[in]centerCenter of the circle in world coordinates.
[in]radiusRadius of the circle in units.
[in]normalNormal of the circle's surface.
[in]colorColor of the circle.
[in]segmentsNumber of individual segments that comprise the circle. Minimum of 3.
[in]lifetimeLength of time (in milliseconds) the line should be drawn. Lifetime of 0 indicates the line will persist forever.
void Ocular::Graphics::GraphicsDriver::drawDebugLine ( Math::Vector3f const &  start,
Math::Vector3f const &  stop,
Core::Color const &  color,
uint64_t  lifetime = 30000 
)
virtual

Draws a line on all viewports that lasts for the specified length of time.

Parameters
[in]startLine starting point in world coordinates
[in]stopLine stopping point in world coordinates
[in]colorLine color
[in]lifetimeLength of time (in milliseconds) the line should be drawn. Lifetime of 0 indicates the line will persist forever.
FrameStats Ocular::Graphics::GraphicsDriver::getLastFrameStats ( ) const

Returns the statistics from the last rendered frame.

uint32_t Ocular::Graphics::GraphicsDriver::getMaxBoundTextures ( ) const
virtual

Returns the maximum number of textures that can be bound to a single shader. This is primarily for use when assigning textures to materials, but can be used in other locations as well.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

RenderState * Ocular::Graphics::GraphicsDriver::getRenderState ( )
virtual

Returns the current RenderState for the GraphicsDriver. No changes to the RenderState will take affect until the RenderState::bind method is called.

Returns
The current RenderState. May return NULL if no underlying graphical API (D3D, GL, etc.) is in use.
bool Ocular::Graphics::GraphicsDriver::initialize ( )
virtual

Initializes the GraphicsDriver implementation.

Returns
FALSE if initialization failed (this should be a fatal event).

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

bool Ocular::Graphics::GraphicsDriver::renderBounds ( Core::SceneObject object,
Math::BoundsType  type 
)
virtual

Renders the bounds of the specified SceneObject

Parameters
[in]object
[in]type

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

void Ocular::Graphics::GraphicsDriver::renderDebug ( )
virtual

Renders all debug shapes.

bool Ocular::Graphics::GraphicsDriver::renderMesh ( Mesh mesh,
uint32_t  submesh = 0 
)
virtual

Renders the specified mesh and it's vertex and index buffers.

Parameters
[in]meshMesh to render.
[in]submeshIndex of the SubMesh to render.
Returns
TRUE if rendered successfully.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

void Ocular::Graphics::GraphicsDriver::setDepthTexture ( DepthTexture texture)
virtual

Sets the Depth Texture to direct all depth operations towards.

Parameters
[in]texture

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

void Ocular::Graphics::GraphicsDriver::setRenderTexture ( RenderTexture texture)
virtual

Sets the Render Texture to direct all rendering operations towards.

Parameters
[in]texture

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.

void Ocular::Graphics::GraphicsDriver::swapBuffers ( )
virtual

Swaps the back and front buffers.

Reimplemented in Ocular::Graphics::D3D11GraphicsDriver.


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