My Project
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
ParaEngine::RenderDevice Class Reference

a very thin wrapper to DirectX device with a portable version of openGL implementation. More...

#include <RenderDeviceDirectX.h>

Inheritance diagram for ParaEngine::RenderDevice:
ParaEngine::RenderDeviceBase ParaEngine::RenderDeviceBase

Public Member Functions

HRESULT RendererRecreated ()
 
HRESULT SetRenderState (D3DRENDERSTATETYPE State, DWORD Value)
 
HRESULT SetTextureStageState (DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value)
 
HRESULT SetClipPlane (DWORD Index, const float *pPlane)
 
HRESULT SetTexture (DWORD Stage, DeviceTexturePtr_type pTexture)
 
HRESULT SetSamplerState (DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value)
 
HRESULT GetSamplerState (DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD *pValue)
 
HRESULT SetIndices (IndexBufferDevicePtr_type pIndexData)
 
HRESULT SetStreamSource (UINT StreamNumber, VertexBufferDevicePtr_type pStreamData, UINT OffsetInBytes, UINT Stride)
 
HRESULT SetTransform (D3DTRANSFORMSTATETYPE State, DeviceMatrix_ptr pMatrix)
 
HRESULT SetFVF (DWORD FVF)
 
void SetCursorPosition (int X, int Y, DWORD Flags)
 
HRESULT SetVertexDeclaration (VertexDeclarationPtr pDecl)
 
HRESULT CreateVertexDeclaration (VertexElement *pVertexElements, VertexDeclarationPtr *ppDecl)
 
HRESULT BeginScene ()
 
HRESULT EndScene ()
 
HRESULT Clear (DWORD Count, const void *pRects, DWORD Flags, DWORD Color, float Z, DWORD Stencil)
 
HRESULT SetViewport (const D3DVIEWPORT9 *pViewport)
 
HRESULT GetViewport (D3DVIEWPORT9 *pViewport)
 
HRESULT SetScissorRect (RECT *pRect)
 
HRESULT GetScissorRect (RECT *pRect)
 
void BeginRenderTarget (int nWidth, int nHeight)
 this is only used by Opengl render target. More...
 
void EndRenderTarget ()
 
bool IsUsingRenderTarget ()
 

Static Public Member Functions

static RenderDeviceGetInstance ()
 
static HRESULT DrawPrimitive (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount)
 
static HRESULT DrawPrimitiveUP (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
 
static HRESULT DrawIndexedPrimitive (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT indexStart, UINT PrimitiveCount)
 
static HRESULT DrawIndexedPrimitiveUP (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void *pIndexData, D3DFORMAT IndexDataFormat, CONST void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
 
static bool CheckRenderError (const char *filename=NULL, const char *func=NULL, int nLine=0)
 check render error and print to log. More...
 
static bool ReadPixels (int nLeft, int nTop, int nWidth, int nHeight, void *pDataOut, DWORD nDataFormat=0, DWORD nDataType=0)
 read a block of pixels from the frame buffer this emulate: glReadPixels(). More...
 
static RenderDeviceGetInstance ()
 
static HRESULT DrawPrimitive (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount)
 
static HRESULT DrawPrimitiveUP (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
 
static HRESULT DrawIndexedPrimitive (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinIndex, UINT NumVertices, UINT indexStart, UINT PrimitiveCount)
 
static HRESULT DrawIndexedPrimitiveUP (RenderDevicePtr pd3dDevice, int nStatisticsType, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, const void *pIndexData, D3DFORMAT IndexDataFormat, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride)
 
static bool CheckRenderError (const char *filename=NULL, const char *func=NULL, int nLine=0)
 check render error and print to log. More...
 
static bool ReadPixels (int nLeft, int nTop, int nWidth, int nHeight, void *pDataOut, DWORD nDataFormat=0, DWORD nDataType=0)
 read a block of pixels from the frame buffer this emulate: glReadPixels(). More...
 
static uint32 GetStencilBits ()
 
- Static Public Member Functions inherited from ParaEngine::RenderDeviceBase
static int GetPerfCount (StatisticsType nStatisticsType)
 get the performance counter for a given type
 
static void ClearAllPerfCount ()
 reset all the performance counters to 0. More...
 
static void IncrementDrawBatchAndVertices (int nDrawCount, int nVertices, int nPrimitiveType=DRAW_PERF_TRIANGLES_UNKNOWN)
 increment both draw count and vertices
 
static int GetMaxSimultaneousTextures ()
 

Protected Member Functions

void GetScreenSize (int &nScreenWidth, int &nScreenHeight)
 

Static Protected Member Functions

static void ApplyBlendingModeChange ()
 

Additional Inherited Members

- Public Types inherited from ParaEngine::RenderDeviceBase
enum  StatisticsType {
  DRAW_PERF_TRIANGLES_UNKNOWN = 0, DRAW_PERF_TRIANGLES_UI = 1, DRAW_PERF_TRIANGLES_TERRAIN = 2, DRAW_PERF_TRIANGLES_CHARACTER = 3,
  DRAW_PERF_TRIANGLES_MESH = 4, DRAW_PERF_DRAW_CALL_COUNT = 5, DRAW_PERF_TOTAL_TRIANGLES = 6, DRAW_PERF_END
}
 
- Static Public Attributes inherited from ParaEngine::RenderDeviceBase
static int g_perfCounters [DRAW_PERF_END]
 

Detailed Description

a very thin wrapper to DirectX device with a portable version of openGL implementation.

functions include drawing primitives, binding textures, setting blending operations, etc. This wrapper is made as thin as possible, so that one can use native DirectX or openGL api with this class.

Member Function Documentation

§ BeginRenderTarget()

void ParaEngine::RenderDevice::BeginRenderTarget ( int  nWidth,
int  nHeight 
)

this is only used by Opengl render target.

§ CheckRenderError() [1/2]

bool ParaEngine::RenderDevice::CheckRenderError ( const char *  filename = NULL,
const char *  func = NULL,
int  nLine = 0 
)
static

check render error and print to log.

only call this in debug mode, since it breaks parallelism between gpu and cpu.

§ CheckRenderError() [2/2]

static bool ParaEngine::RenderDevice::CheckRenderError ( const char *  filename = NULL,
const char *  func = NULL,
int  nLine = 0 
)
static

check render error and print to log.

only call this in debug mode, since it breaks parallelism between gpu and cpu.

§ ReadPixels() [1/2]

bool ParaEngine::RenderDevice::ReadPixels ( int  nLeft,
int  nTop,
int  nWidth,
int  nHeight,
void *  pDataOut,
DWORD  nDataFormat = 0,
DWORD  nDataType = 0 
)
static

read a block of pixels from the frame buffer this emulate: glReadPixels().

§ ReadPixels() [2/2]

static bool ParaEngine::RenderDevice::ReadPixels ( int  nLeft,
int  nTop,
int  nWidth,
int  nHeight,
void *  pDataOut,
DWORD  nDataFormat = 0,
DWORD  nDataType = 0 
)
static

read a block of pixels from the frame buffer this emulate: glReadPixels().


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