Rocket::Core::RenderInterface Class Reference

#include <RenderInterface.h>

Inheritance diagram for Rocket::Core::RenderInterface:
Collaboration diagram for Rocket::Core::RenderInterface:

Public Member Functions

virtual void RenderGeometry (Vertex *vertices, int num_vertices, int *indices, int num_indices, TextureHandle texture, const Vector2f &translation)=0
virtual CompiledGeometryHandle CompileGeometry (Vertex *vertices, int num_vertices, int *indices, int num_indices, TextureHandle texture)
virtual void RenderCompiledGeometry (CompiledGeometryHandle geometry, const Vector2f &translation)
virtual void ReleaseCompiledGeometry (CompiledGeometryHandle geometry)
virtual void EnableScissorRegion (bool enable)=0
virtual void SetScissorRegion (int x, int y, int width, int height)=0
virtual bool LoadTexture (TextureHandle &texture_handle, Vector2i &texture_dimensions, const String &source)
virtual bool GenerateTexture (TextureHandle &texture_handle, const byte *source, const Vector2i &source_dimensions)
virtual void ReleaseTexture (TextureHandle texture)
virtual float GetHorizontalTexelOffset ()
virtual float GetVerticalTexelOffset ()
virtual void Release ()
 Called when this render interface is released.
ContextGetContext () const

Protected Member Functions

virtual void OnReferenceDeactivate ()
 A hook method called when the reference count drops to 0.

Friends

class Context

Detailed Description

The abstract base class for application-specific rendering implementation. Your application must provide a concrete implementation of this class and install it through Core::SetRenderInterface() in order for anything to be rendered.

Author:
Peter Curry

Member Function Documentation

virtual void Rocket::Core::RenderInterface::RenderGeometry ( Vertex vertices,
int  num_vertices,
int *  indices,
int  num_indices,
TextureHandle  texture,
const Vector2f translation 
) [pure virtual]

Called by Rocket when it wants to render geometry that the application does not wish to optimise. Note that Rocket renders everything as triangles.

Parameters:
[in] vertices The geometry's vertex data.
[in] num_vertices The number of vertices passed to the function.
[in] indices The geometry's index data.
[in] num_indices The number of indices passed to the function. This will always be a multiple of three.
[in] texture The texture to be applied to the geometry. This may be NULL, in which case the geometry is untextured.
[in] translation The translation to apply to the geometry.

virtual CompiledGeometryHandle Rocket::Core::RenderInterface::CompileGeometry ( Vertex vertices,
int  num_vertices,
int *  indices,
int  num_indices,
TextureHandle  texture 
) [virtual]

Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future. If supported, this should be return a pointer to an optimised, application-specific version of the data. If not, do not override the function or return NULL; the simpler RenderGeometry() will be called instead.

Parameters:
[in] vertices The geometry's vertex data.
[in] num_vertices The number of vertices passed to the function.
[in] indices The geometry's index data.
[in] num_indices The number of indices passed to the function. This will always be a multiple of three.
[in] texture The texture to be applied to the geometry. This may be NULL, in which case the geometry is untextured.
Returns:
The application-specific compiled geometry. Compiled geometry will be stored and rendered using RenderCompiledGeometry() in future calls, and released with ReleaseCompiledGeometry() when it is no longer needed.

virtual void Rocket::Core::RenderInterface::RenderCompiledGeometry ( CompiledGeometryHandle  geometry,
const Vector2f translation 
) [virtual]

Called by Rocket when it wants to render application-compiled geometry.

Parameters:
[in] geometry The application-specific compiled geometry to render.
[in] translation The translation to apply to the geometry.

virtual void Rocket::Core::RenderInterface::ReleaseCompiledGeometry ( CompiledGeometryHandle  geometry  )  [virtual]

Called by Rocket when it wants to release application-compiled geometry.

Parameters:
[in] geometry The application-specific compiled geometry to release.

virtual void Rocket::Core::RenderInterface::EnableScissorRegion ( bool  enable  )  [pure virtual]

Called by Rocket when it wants to enable or disable scissoring to clip content.

Parameters:
[in] enable True if scissoring is to enabled, false if it is to be disabled.

virtual void Rocket::Core::RenderInterface::SetScissorRegion ( int  x,
int  y,
int  width,
int  height 
) [pure virtual]

Called by Rocket when it wants to change the scissor region.

Parameters:
[in] x The left-most pixel to be rendered. All pixels to the left of this should be clipped.
[in] y The top-most pixel to be rendered. All pixels to the top of this should be clipped.
[in] width The width of the scissored region. All pixels to the right of (x + width) should be clipped.
[in] height The height of the scissored region. All pixels to below (y + height) should be clipped.

virtual bool Rocket::Core::RenderInterface::LoadTexture ( TextureHandle &  texture_handle,
Vector2i texture_dimensions,
const String source 
) [virtual]

Called by Rocket when a texture is required by the library.

Parameters:
[out] texture_handle The handle to write the texture handle for the loaded texture to.
[out] texture_dimensions The variable to write the dimensions of the loaded texture.
[in] source The application-defined image source, joined with the path of the referencing document.
Returns:
True if the load attempt succeeded and the handle and dimensions are valid, false if not.

virtual bool Rocket::Core::RenderInterface::GenerateTexture ( TextureHandle &  texture_handle,
const byte *  source,
const Vector2i source_dimensions 
) [virtual]

Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels.

Parameters:
[out] texture_handle The handle to write the texture handle for the generated texture to.
[in] source The raw 8-bit texture data. Each pixel is made up of four 8-bit values, indicating red, green, blue and alpha in that order.
[in] source_dimensions The dimensions, in pixels, of the source data.
Returns:
True if the texture generation succeeded and the handle is valid, false if not.

virtual void Rocket::Core::RenderInterface::ReleaseTexture ( TextureHandle  texture  )  [virtual]

Called by Rocket when a loaded texture is no longer required.

Parameters:
texture The texture handle to release.

float Rocket::Core::RenderInterface::GetHorizontalTexelOffset (  )  [virtual]

Returns the native horizontal texel offset for the renderer.

Returns:
The renderer's horizontal texel offset. The default implementation returns 0.

float Rocket::Core::RenderInterface::GetVerticalTexelOffset (  )  [virtual]

Returns the native vertical texel offset for the renderer.

Returns:
The renderer's vertical texel offset. The default implementation returns 0.

Context * Rocket::Core::RenderInterface::GetContext (  )  const

Get the context currently being rendered. This is only valid during RenderGeometry, CompileGeometry, RenderCompiledGeometry, EnableScissorRegion and SetScissorRegion.


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