GFXNullDevice Class Reference

#include <gfxNullDevice.h>

Inheritance diagram for GFXNullDevice:

Inheritance graph
[legend]
List of all members.

State Initalization.

virtual void copyBBToSfxBuff ()
virtual GFXCubemapcreateCubemap ()
virtual F32 getFillConventionOffset () const
 Get the fill convention for this device.
virtual void initStates ()
 State initalization.
virtual void setMatrix (GFXMatrixType mtype, const MatrixF &mat)
 This function must be implemented differently per API and it should set ONLY the current matrix.
virtual GFXVertexBufferallocVertexBuffer (U32 numVerts, U32 vertFlags, U32 vertSize, GFXBufferType bufferType)
 This allocates a vertex buffer and returns a pointer to the allocated buffer.
virtual GFXPrimitiveBufferallocPrimitiveBuffer (U32 numIndices, U32 numPrimitives, GFXBufferType bufferType)
 This allocates a primitive buffer and returns a pointer to the allocated buffer.

Public Member Functions

 GFXNullDevice ()
virtual ~GFXNullDevice ()
void init (const GFXVideoMode &mode, PlatformWindow *window=NULL)
 Initialize this GFXDevice, optionally specifying a platform window to bind to.
virtual void activate ()
virtual void deactivate ()
virtual GFXAdapterType getAdapterType ()
 Returns active graphics adapter type.
virtual void enumerateVideoModes ()
 Enumerates the supported video modes of the device.
virtual void setVideoMode (const GFXVideoMode &mode)
 Sets the video mode for the device.
virtual GFXTextureTargetallocRenderToTextureTarget ()
 Allocate a target for doing render to texture operations, with no depth/stencil buffer.
virtual GFXWindowTargetallocWindowTarget (PlatformWindow *window)
 Allocate a target for a given window.
virtual void pushActiveRenderTarget ()
 Save current render target states - note this works with MRT's.
virtual void popActiveRenderTarget ()
 Restore all render targets - supports MRT's.
virtual void setActiveRenderTarget (GFXTarget *target)
 Start rendering to to a specified render target.
virtual GFXTargetgetActiveRenderTarget ()
 Return a pointer to the current active render target.
virtual F32 getPixelShaderVersion () const
virtual void setPixelShaderVersion (F32 version)
virtual U32 getNumSamplers () const
 Returns the number of texture samplers that can be used in a shader rendering pass.
virtual GFXShadercreateShader (const char *vertFile, const char *pixFile, F32 pixVersion, const Vector< GFXShaderMacro > &macros)
 Creates a shader.
virtual void clear (U32 flags, ColorI color, F32 z, U32 stencil)
virtual bool beginSceneInternal ()
virtual void endSceneInternal ()
virtual void drawPrimitive (GFXPrimitiveType primType, U32 vertexStart, U32 primitiveCount)
virtual void drawIndexedPrimitive (GFXPrimitiveType primType, U32 minIndex, U32 numVerts, U32 startIndex, U32 primitiveCount)
virtual void setViewport (const RectI &rect)
virtual const RectIgetViewport () const
virtual void setClipRect (const RectI &rect)
virtual const RectIgetClipRect () const
virtual void preDestroy ()
 This is called before this, or any other device, is deleted in the global destroy() method.
virtual U32 getMaxDynamicVerts ()
virtual U32 getMaxDynamicIndices ()
virtual GFXFormat selectSupportedFormat (GFXTextureProfile *profile, const Vector< GFXFormat > &formats, bool texture, bool mustblend)
GFXFencecreateFence ()
 Allocate a fence.
Debug Methods
virtual void enterDebugEvent (ColorI color, const char *name)
virtual void leaveDebugEvent ()
virtual void setDebugMarker (ColorI color, const char *name)

Static Public Member Functions

static GFXDevicecreateInstance (U32 adapterIndex)
static void enumerateAdapters (Vector< GFXAdapter * > &adapterList)

Protected Member Functions

virtual GFXStateBlockRef createStateBlockInternal (const GFXStateBlockDesc &desc)
 Called by GFXDevice to create a device specific stateblock.
virtual void setStateBlockInternal (GFXStateBlock *block, bool force)
 Called by GFXDevice to actually set a stateblock.
virtual void setShaderConstBufferInternal (GFXShaderConstBuffer *buffer)
 Called by base GFXDevice to actually set a const buffer.
virtual void setTextureInternal (U32 textureUnit, const GFXTextureObject *texture)
virtual void setLightInternal (U32 lightStage, const GFXLightInfo light, bool lightEnable)
virtual void setLightMaterialInternal (const GFXLightMaterial mat)
virtual void setGlobalAmbientInternal (ColorF color)

Static Protected Attributes

static GFXAdapter::CreateDeviceInstanceDelegate mCreateDeviceInstance

Private Types

typedef GFXDevice Parent

Private Attributes

RectI viewport
RectI clip
GFXStateBlockRef mNullStateBlock

Member Typedef Documentation

typedef GFXDevice GFXNullDevice::Parent [private]


Constructor & Destructor Documentation

GFXNullDevice::GFXNullDevice (  ) 

virtual GFXNullDevice::~GFXNullDevice (  )  [virtual]


Member Function Documentation

static GFXDevice* GFXNullDevice::createInstance ( U32  adapterIndex  )  [static]

static void GFXNullDevice::enumerateAdapters ( Vector< GFXAdapter * > &  adapterList  )  [static]

void GFXNullDevice::init ( const GFXVideoMode mode,
PlatformWindow window = NULL 
) [virtual]

Initialize this GFXDevice, optionally specifying a platform window to bind to.

Implements GFXDevice.

virtual void GFXNullDevice::activate (  )  [inline, virtual]

virtual void GFXNullDevice::deactivate (  )  [inline, virtual]

virtual GFXAdapterType GFXNullDevice::getAdapterType (  )  [inline, virtual]

Returns active graphics adapter type.

Implements GFXDevice.

virtual void GFXNullDevice::enterDebugEvent ( ColorI  color,
const char *  name 
) [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::leaveDebugEvent (  )  [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::setDebugMarker ( ColorI  color,
const char *  name 
) [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::enumerateVideoModes (  )  [inline, virtual]

Enumerates the supported video modes of the device.

Implements GFXDevice.

virtual void GFXNullDevice::setVideoMode ( const GFXVideoMode mode  )  [inline, virtual]

Sets the video mode for the device.

virtual GFXStateBlockRef GFXNullDevice::createStateBlockInternal ( const GFXStateBlockDesc desc  )  [inline, protected, virtual]

Called by GFXDevice to create a device specific stateblock.

Implements GFXDevice.

virtual void GFXNullDevice::setStateBlockInternal ( GFXStateBlock block,
bool  force 
) [inline, protected, virtual]

Called by GFXDevice to actually set a stateblock.

Implements GFXDevice.

virtual void GFXNullDevice::setShaderConstBufferInternal ( GFXShaderConstBuffer buffer  )  [inline, protected, virtual]

Called by base GFXDevice to actually set a const buffer.

Implements GFXDevice.

virtual void GFXNullDevice::setTextureInternal ( U32  textureUnit,
const GFXTextureObject texture 
) [inline, protected, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::setLightInternal ( U32  lightStage,
const GFXLightInfo  light,
bool  lightEnable 
) [protected, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::setLightMaterialInternal ( const GFXLightMaterial  mat  )  [inline, protected, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::setGlobalAmbientInternal ( ColorF  color  )  [inline, protected, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::initStates (  )  [inline, protected, virtual]

State initalization.

This MUST BE CALLED in setVideoMode after the device is created.

Implements GFXDevice.

virtual void GFXNullDevice::setMatrix ( GFXMatrixType  mtype,
const MatrixF mat 
) [inline, protected, virtual]

This function must be implemented differently per API and it should set ONLY the current matrix.

For example, in OpenGL, there should be NO matrix stack activity, all the stack stuff is managed in the GFX layer.

OpenGL does not have separate world and view matrices. It has ModelView which is world * view. You must take this into consideration.

Parameters:
mtype Which matrix to set, world/view/projection
mat Matrix to assign

Implements GFXDevice.

virtual GFXVertexBuffer* GFXNullDevice::allocVertexBuffer ( U32  numVerts,
U32  vertFlags,
U32  vertSize,
GFXBufferType  bufferType 
) [protected, virtual]

This allocates a vertex buffer and returns a pointer to the allocated buffer.

This function should not be called directly - rather it should be used by the GFXVertexBufferHandle class.

Implements GFXDevice.

virtual GFXPrimitiveBuffer* GFXNullDevice::allocPrimitiveBuffer ( U32  numIndices,
U32  numPrimitives,
GFXBufferType  bufferType 
) [protected, virtual]

This allocates a primitive buffer and returns a pointer to the allocated buffer.

A primitive buffer's type argument refers to the index data - the primitive data will always be preserved from call to call.

Note:
All index buffers use 16-bit indices.

Implements GFXDevice.

virtual void GFXNullDevice::copyBBToSfxBuff (  )  [inline, virtual]

Implements GFXDevice.

virtual GFXCubemap* GFXNullDevice::createCubemap (  )  [virtual]

Implements GFXDevice.

virtual F32 GFXNullDevice::getFillConventionOffset (  )  const [inline, virtual]

Get the fill convention for this device.

Implements GFXDevice.

virtual GFXTextureTarget* GFXNullDevice::allocRenderToTextureTarget (  )  [inline, virtual]

Allocate a target for doing render to texture operations, with no depth/stencil buffer.

Implements GFXDevice.

virtual GFXWindowTarget* GFXNullDevice::allocWindowTarget ( PlatformWindow window  )  [inline, virtual]

Allocate a target for a given window.

Implements GFXDevice.

virtual void GFXNullDevice::pushActiveRenderTarget (  )  [inline, virtual]

Save current render target states - note this works with MRT's.

Reimplemented from GFXDevice.

virtual void GFXNullDevice::popActiveRenderTarget (  )  [inline, virtual]

Restore all render targets - supports MRT's.

Reimplemented from GFXDevice.

virtual void GFXNullDevice::setActiveRenderTarget ( GFXTarget target  )  [inline, virtual]

Start rendering to to a specified render target.

Implements GFXDevice.

virtual GFXTarget* GFXNullDevice::getActiveRenderTarget (  )  [inline, virtual]

Return a pointer to the current active render target.

Reimplemented from GFXDevice.

virtual F32 GFXNullDevice::getPixelShaderVersion (  )  const [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::setPixelShaderVersion ( F32  version  )  [inline, virtual]

Implements GFXDevice.

virtual U32 GFXNullDevice::getNumSamplers (  )  const [inline, virtual]

Returns the number of texture samplers that can be used in a shader rendering pass.

Implements GFXDevice.

virtual GFXShader* GFXNullDevice::createShader ( const char *  vertFile,
const char *  pixFile,
F32  pixVersion,
const Vector< GFXShaderMacro > &  macros 
) [inline, virtual]

Creates a shader.

Parameters:
vertFile Vertex shader filename
pixFile Pixel shader filename
pixVersion Pixel shader version
macros Macros passed to the shader compiler.

Implements GFXDevice.

virtual void GFXNullDevice::clear ( U32  flags,
ColorI  color,
F32  z,
U32  stencil 
) [inline, virtual]

Implements GFXDevice.

virtual bool GFXNullDevice::beginSceneInternal (  )  [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::endSceneInternal (  )  [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::drawPrimitive ( GFXPrimitiveType  primType,
U32  vertexStart,
U32  primitiveCount 
) [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::drawIndexedPrimitive ( GFXPrimitiveType  primType,
U32  minIndex,
U32  numVerts,
U32  startIndex,
U32  primitiveCount 
) [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::setViewport ( const RectI rect  )  [inline, virtual]

Implements GFXDevice.

virtual const RectI& GFXNullDevice::getViewport (  )  const [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::setClipRect ( const RectI rect  )  [inline, virtual]

Implements GFXDevice.

virtual const RectI& GFXNullDevice::getClipRect (  )  const [inline, virtual]

Implements GFXDevice.

virtual void GFXNullDevice::preDestroy (  )  [inline, virtual]

This is called before this, or any other device, is deleted in the global destroy() method.

It allows the device to clean up anything while everything is still valid.

Reimplemented from GFXDevice.

virtual U32 GFXNullDevice::getMaxDynamicVerts (  )  [inline, virtual]

Implements GFXDevice.

virtual U32 GFXNullDevice::getMaxDynamicIndices (  )  [inline, virtual]

Implements GFXDevice.

virtual GFXFormat GFXNullDevice::selectSupportedFormat ( GFXTextureProfile profile,
const Vector< GFXFormat > &  formats,
bool  texture,
bool  mustblend 
) [inline, virtual]

Implements GFXDevice.

GFXFence* GFXNullDevice::createFence (  )  [inline, virtual]

Allocate a fence.

The API specific implementation of GFXDevice is responsible to make sure that the proper type is used. GFXGeneralFence should work in all cases.

Implements GFXDevice.


Member Data Documentation