Crazy Eddie's GUI System  0.8.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CEGUI::Direct3D10Renderer Class Reference

Renderer implementation using Direct3D 10. More...

+ Inheritance diagram for CEGUI::Direct3D10Renderer:
+ Collaboration diagram for CEGUI::Direct3D10Renderer:

Public Member Functions

ID3D10Device & getDirect3DDevice () const
 return the ID3D10Device used by this renderer object.
 
void bindTechniquePass (const BlendMode mode, const bool clipped)
 low-level function that binds the technique pass ready for use
 
void setCurrentTextureShaderResource (ID3D10ShaderResourceView *srv)
 low-level function to set the texture shader resource view to be used.
 
void setProjectionMatrix (D3DXMATRIX &matrix)
 low-level function to set the projection matrix to be used.
 
void setWorldMatrix (D3DXMATRIX &matrix)
 low-level function to set the world matrix to be used.
 
RenderTargetgetDefaultRenderTarget ()
 Returns the default RenderTarget object. The default render target is is typically one that targets the entire screen (or rendering window). More...
 
GeometryBuffercreateGeometryBuffer ()
 Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from any RenderQueues and call destroyGeometryBuffer when you want to destroy the GeometryBuffer. More...
 
void destroyGeometryBuffer (const GeometryBuffer &buffer)
 Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function. Before destroying any GeometryBuffer you should ensure that it has been removed from any RenderQueue that was using it. More...
 
void destroyAllGeometryBuffers ()
 Destroy all GeometryBuffer objects created by this Renderer.
 
TextureTargetcreateTextureTarget ()
 Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose it's content from one frame to another. More...
 
void destroyTextureTarget (TextureTarget *target)
 Function that cleans up TextureTarget objects created with the createTextureTarget function. More...
 
void destroyAllTextureTargets ()
 Destory all TextureTarget objects created by this Renderer.
 
TexturecreateTexture (const String &name)
 Create a 'null' Texture object. More...
 
TexturecreateTexture (const String &name, const String &filename, const String &resourceGroup)
 Create a Texture object using the given image file. More...
 
TexturecreateTexture (const String &name, const Sizef &size)
 Create a Texture object with the given pixel dimensions as specified by size. More...
 
void destroyTexture (Texture &texture)
 Destroy a Texture object that was previously created by calling the createTexture functions. More...
 
void destroyTexture (const String &name)
 Destroy a Texture object that was previously created by calling the createTexture functions. More...
 
void destroyAllTextures ()
 Destroy all Texture objects created by this Renderer.
 
TexturegetTexture (const String &name) const
 Return a Texture object that was previously created by calling the createTexture functions. More...
 
bool isTextureDefined (const String &name) const
 Return whether a texture with the given name exists.
 
void beginRendering ()
 Perform any operations required to put the system into a state ready for rendering operations to begin.
 
void endRendering ()
 Perform any operations required to finalise rendering.
 
void setDisplaySize (const Sizef &sz)
 Set the size of the display or host window in pixels for this Renderer object. More...
 
const SizefgetDisplaySize () const
 Return the size of the display or host window in pixels. More...
 
const Vector2fgetDisplayDPI () const
 Return the resolution of the display or host window in dots per inch. More...
 
uint getMaxTextureSize () const
 Return the pixel size of the maximum supported texture. More...
 
const StringgetIdentifierString () const
 Return identification string for the renderer module. More...
 
- Public Member Functions inherited from CEGUI::Renderer
virtual ~Renderer ()
 Destructor.
 

Static Public Member Functions

static Direct3D10RendererbootstrapSystem (ID3D10Device *device, const int abi=CEGUI_VERSION_ABI)
 Convenience function that creates the required objects to initialise the CEGUI system. More...
 
static void destroySystem ()
 Convenience function to cleanup the CEGUI system and related objects that were created by calling the bootstrapSystem function. More...
 
static Direct3D10Renderercreate (ID3D10Device *device, const int abi=CEGUI_VERSION_ABI)
 Create an Direct3D10Renderer object.
 
static void destroy (Direct3D10Renderer &renderer)
 Destroy an Direct3D10Renderer object. More...
 

Protected Types

typedef std::vector
< TextureTarget * > 
TextureTargetList
 container type used to hold TextureTargets we create.
 
typedef std::vector
< Direct3D10GeometryBuffer * > 
GeometryBufferList
 container type used to hold GeometryBuffers we create.
 
typedef std::map< String,
Direct3D10Texture
*, StringFastLessCompare
CEGUI_MAP_ALLOC(String,
Direct3D10Texture *)> 
TextureMap
 container type used to hold Textures we create.
 

Protected Member Functions

 Direct3D10Renderer (ID3D10Device *device)
 constructor
 
 ~Direct3D10Renderer ()
 destructor.
 
Sizef getViewportSize ()
 return size of the D3D device viewport.
 
void throwIfNameExists (const String &name) const
 helper to throw exception if name is already used.
 

Static Protected Member Functions

static void logTextureCreation (const String &name)
 helper to safely log the creation of a named texture
 
static void logTextureDestruction (const String &name)
 helper to safely log the destruction of a named texture
 

Protected Attributes

ID3D10Device * d_device
 The D3D device we're using to render with.
 
Sizef d_displaySize
 What the renderer considers to be the current display size.
 
Vector2f d_displayDPI
 What the renderer considers to be the current display DPI resolution.
 
RenderTargetd_defaultTarget
 The default RenderTarget.
 
TextureTargetList d_textureTargets
 Container used to track texture targets.
 
GeometryBufferList d_geometryBuffers
 Container used to track geometry buffers.
 
TextureMap d_textures
 Container used to track textures.
 
ID3D10Effect * d_effect
 Effect (shader) used when rendering.
 
ID3D10EffectTechnique * d_normalClippedTechnique
 Rendering technique that supplies scissor clipped BM_NORMAL type rendering.
 
ID3D10EffectTechnique * d_normalUnclippedTechnique
 Rendering technique that supplies BM_NORMAL type rendering.
 
ID3D10EffectTechnique * d_premultipliedClippedTechnique
 Rendering technique that supplies scissor clipped BM_RTT_PREMULTIPLIED type rendering.
 
ID3D10EffectTechnique * d_premultipliedUnclippedTechnique
 Rendering technique that supplies BM_RTT_PREMULTIPLIED type rendering.
 
ID3D10InputLayout * d_inputLayout
 D3D10 input layout describing the vertex format we use.
 
ID3D10EffectShaderResourceVariable * d_boundTextureVariable
 Variable to access current texture (actually shader resource view)
 
ID3D10EffectMatrixVariable * d_worldMatrixVariable
 Variable to access world matrix used in geometry transformation.
 
ID3D10EffectMatrixVariable * d_projectionMatrixVariable
 Variable to access projection matrix used in geometry transformation.
 

Static Protected Attributes

static String d_rendererID
 String holding the renderer identification text.
 

Detailed Description

Renderer implementation using Direct3D 10.

Member Function Documentation

static Direct3D10Renderer& CEGUI::Direct3D10Renderer::bootstrapSystem ( ID3D10Device *  device,
const int  abi = CEGUI_VERSION_ABI 
)
static

Convenience function that creates the required objects to initialise the CEGUI system.

This will create and initialise the following objects for you:
- CEGUI::Direct3D10Renderer
- CEGUI::DefaultResourceProvider
- CEGUI::System
Parameters
devicePointer to the ID3D10Device interface that is to be used for CEGUI rendering operations.
abiThis must be set to CEGUI_VERSION_ABI
Returns
Reference to the CEGUI::Direct3D10Renderer object that was created.
GeometryBuffer& CEGUI::Direct3D10Renderer::createGeometryBuffer ( )
virtual

Create a new GeometryBuffer and return a reference to it. You should remove the GeometryBuffer from any RenderQueues and call destroyGeometryBuffer when you want to destroy the GeometryBuffer.

Returns
GeometryBuffer object.

Implements CEGUI::Renderer.

Texture& CEGUI::Direct3D10Renderer::createTexture ( const String name)
virtual

Create a 'null' Texture object.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
Returns
A newly created Texture object. The returned Texture object has no size or imagery associated with it.

Implements CEGUI::Renderer.

Texture& CEGUI::Direct3D10Renderer::createTexture ( const String name,
const String filename,
const String resourceGroup 
)
virtual

Create a Texture object using the given image file.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
filenameString object that specifies the path and filename of the image file to use when creating the texture.
resourceGroupString objet that specifies the resource group identifier to be passed to the resource provider when loading the texture file filename.
Returns
A newly created Texture object. The initial content of the texture memory is the requested image file.
Note
Due to possible limitations of the underlying hardware, API or engine, the final size of the texture may not match the size of the loaded file. You can check the ultimate sizes by querying the Texture object after creation.

Implements CEGUI::Renderer.

Texture& CEGUI::Direct3D10Renderer::createTexture ( const String name,
const Sizef size 
)
virtual

Create a Texture object with the given pixel dimensions as specified by size.

Parameters
nameString holding the name for the new texture. Texture names must be unique within the Renderer.
sizeSize object that describes the desired texture size.
Returns
A newly created Texture object. The initial contents of the texture memory is undefined.
Note
Due to possible limitations of the underlying hardware, API or engine, the final size of the texture may not match the requested size. You can check the ultimate sizes by querying the Texture object after creation.

Implements CEGUI::Renderer.

TextureTarget* CEGUI::Direct3D10Renderer::createTextureTarget ( )
virtual

Create a TextureTarget that can be used to cache imagery; this is a RenderTarget that does not lose it's content from one frame to another.

If the renderer is unable to offer such a thing, 0 should be returned.
Returns
Pointer to a TextureTarget object that is suitable for caching imagery, or 0 if the renderer is unable to offer such a thing.

Implements CEGUI::Renderer.

static void CEGUI::Direct3D10Renderer::destroy ( Direct3D10Renderer renderer)
static

Destroy an Direct3D10Renderer object.

Parameters
rendererThe Direct3D10Renderer object to be destroyed.
void CEGUI::Direct3D10Renderer::destroyGeometryBuffer ( const GeometryBuffer buffer)
virtual

Destroy a GeometryBuffer that was returned when calling the createGeometryBuffer function. Before destroying any GeometryBuffer you should ensure that it has been removed from any RenderQueue that was using it.

Parameters
bufferThe GeometryBuffer object to be destroyed.

Implements CEGUI::Renderer.

static void CEGUI::Direct3D10Renderer::destroySystem ( )
static

Convenience function to cleanup the CEGUI system and related objects that were created by calling the bootstrapSystem function.

This function will destroy the following objects for you:
- CEGUI::System
- CEGUI::DefaultResourceProvider
- CEGUI::Direct3D10Renderer
Note
If you did not initialise CEGUI by calling the bootstrapSystem function, you should not call this, but rather delete any objects you created manually.
void CEGUI::Direct3D10Renderer::destroyTexture ( Texture texture)
virtual

Destroy a Texture object that was previously created by calling the createTexture functions.

Parameters
textureTexture object to be destroyed.

Implements CEGUI::Renderer.

void CEGUI::Direct3D10Renderer::destroyTexture ( const String name)
virtual

Destroy a Texture object that was previously created by calling the createTexture functions.

Parameters
nameString holding the name of the texture to destroy.

Implements CEGUI::Renderer.

void CEGUI::Direct3D10Renderer::destroyTextureTarget ( TextureTarget target)
virtual

Function that cleans up TextureTarget objects created with the createTextureTarget function.

Parameters
targetA pointer to a TextureTarget object that was previously returned from a call to createTextureTarget.

Implements CEGUI::Renderer.

RenderTarget& CEGUI::Direct3D10Renderer::getDefaultRenderTarget ( )
virtual

Returns the default RenderTarget object. The default render target is is typically one that targets the entire screen (or rendering window).

Returns
Reference to a RenderTarget object.

Implements CEGUI::Renderer.

const Vector2f& CEGUI::Direct3D10Renderer::getDisplayDPI ( ) const
virtual

Return the resolution of the display or host window in dots per inch.

Returns
Vector2 object that describes the resolution of the display or host window in DPI.

Implements CEGUI::Renderer.

const Sizef& CEGUI::Direct3D10Renderer::getDisplaySize ( ) const
virtual

Return the size of the display or host window in pixels.

Returns
Size object describing the pixel dimesntions of the current display or host window.

Implements CEGUI::Renderer.

const String& CEGUI::Direct3D10Renderer::getIdentifierString ( ) const
virtual

Return identification string for the renderer module.

Returns
String object holding text that identifies the Renderer in use.

Implements CEGUI::Renderer.

uint CEGUI::Direct3D10Renderer::getMaxTextureSize ( ) const
virtual

Return the pixel size of the maximum supported texture.

Returns
Size of the maximum supported texture in pixels.

Implements CEGUI::Renderer.

Texture& CEGUI::Direct3D10Renderer::getTexture ( const String name) const
virtual

Return a Texture object that was previously created by calling the createTexture functions.

Parameters
nameString holding the name of the Texture object to be returned.

Implements CEGUI::Renderer.

void CEGUI::Direct3D10Renderer::setDisplaySize ( const Sizef size)
virtual

Set the size of the display or host window in pixels for this Renderer object.

This is intended to be called by the System as part of the notification
process when display size changes are notified to it via the
System::notifyDisplaySizeChanged function.
Note
The Renderer implementation should not use this function other than to perform internal state updates on the Renderer and related objects.
Parameters
sizeSize object describing the dimesions of the current or host window in pixels.

Implements CEGUI::Renderer.