Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# Keos::CD3D9RenderSystem Class Reference

Class for Direct3D9 renderer system. More...

`#include <KeosD3D9RenderSystem.h>`

Inheritance diagram for Keos::CD3D9RenderSystem:

List of all members.

## Public Member Functions

| CD3D9RenderSystem ()
| Constructor.
| ~CD3D9RenderSystem ()
| Destructor.
const String & | GetName (void) const
| See RenderSystem.
virtual IRenderWindow * | Initialise (bool bAutoCreateWindow, const String &strWindowTitle="KEOS Render Window")
| See IRenderSystem.
virtual IRenderWindow * | CreateRenderWindow (const String &strName, uint nWidth, uint nHeight, uint nColourDepth, bool bFullScreen)
| See IRenderSystem.
virtual void | Reinitialise (void)
| See IRenderSystem.
virtual void | Shutdown (void)
| See IRenderSystem.
virtual void | BeginScene (void) const
| Start a scene render.
virtual void | EndScene (void) const
| End a scene render.
virtual void | PrintInfo (void) const
| Print information on the API.
virtual IBufferBase * | _CreateVB (ulong nSize, ulong nStride, ulong nFlags) const
| See IRenderSystem.
virtual IBufferBase * | _CreateIB (ulong nSize, ulong nStride, ulong nFlags) const
| See IRenderSystem.
virtual IDeclaration * | CreateDeclaration (const TDeclarationElement *pElements, size_t nCount) const
| See IRenderSystem.
virtual void | _SetVB (uint nStream, const IBufferBase *pBuffer, ulong nStride, ulong nMinVertex, ulong nMaxVertex)
| See IRenderSystem.
virtual void | _SetIB (const IBufferBase *pBuffer, ulong nStride)
| See IRenderSystem.
virtual void | SetDeclaration (const IDeclaration *pDeclaration)
| See IRenderSystem.
virtual void | DrawPrimitives (TPrimitiveType Type, ulong nFirstVertex, ulong nCount) const
| See IRenderSystem.
virtual void | DrawIndexedPrimitives (TPrimitiveType Type, ulong nFirstIndex, ulong nCount) const
| See IRenderSystem.
virtual void | PushMatrix (TMatrixType Type)
| See IRenderSystem.
virtual void | PopMatrix (TMatrixType Type)
| See IRenderSystem.
virtual void | LoadMatrix (TMatrixType Type, const CMatrix4 &Matrix)
| See IRenderSystem.
virtual void | LoadMatrixMult (TMatrixType Type, const CMatrix4 &Matrix)
| See IRenderSystem.
virtual void | GetMatrix (TMatrixType Type, CMatrix4 &Matrix) const
| See IRenderSystem.
virtual ulong | ConvertColor (const CColor &Color) const
| See IRenderSystem.
virtual ITextureBase * | CreateTexture (const TVector2I &Size, TPixelFormat Format, ulong nFlags=0) const
| See IRenderSystem.
virtual void | SetTexture (uint nUnit, const ITextureBase *pTexture) const
| See IRenderSystem.
virtual void | SetupAlphaBlending (TBlend Src, TBlend Dest) const
| See IRenderSystem.
virtual void | SetupTextureUnit (uint nUnit, TTextureOp Op, TTextureArg Arg1, TTextureArg Arg2=TXA_DIFFUSE, const CColor &Constant=0x00) const
| See IRenderSystem.
virtual void | Enable (TRenderParameter Param, bool bValue) const
| See IRenderSystem.
virtual IShaderBase * | CreateShader (CGprogram Program, TShaderType Type) const
| See IRenderSystem.
virtual void | SetVertexShader (const IShaderBase *pShader)
| See IRenderSystem.
virtual void | SetPixelShader (const IShaderBase *pShader)
| See IRenderSystem.
virtual void | SetClearColor (const CColor &Color)
| See IRenderSystem.
void | RestoreLostDevice (void)
| D3D specific method to restore a lost device.
bool | IsDeviceLost (void)
| D3D specific method to return whether the device has been lost.
void | _NotifyDeviceLost (void)
| Notify that a device has been lost.

## Private Member Functions

void | InitCapabilities (void)
| Initialize capabilities.
void | SearchVertexShaderCaps (D3DCAPS9 &Caps)
| Search vertex shaders capabilities.
void | SearchPixelShaderCaps (D3DCAPS9 &Caps)
| Search pixel shaders capabilities.
bool | CheckFormat (D3DFORMAT Format, D3DRESOURCETYPE ResourceType, ulong nUsage=0)
| Check if a pixel format is supported.

## Private Attributes

CD3D9 * | m_pD3D9
| Direct3D9 variables.
ulong | m_nMinVertex
| Save of the minimum index of the next verticies to be rendered.
ulong | m_nVertexCount
| Save of the number of the next verticies to be rendered.
std::vector< CMatrix4 > | m_Matrices [6]
| Matrices stack.
bool | m_bDeviceLost
| The device has been lost.

## Detailed Description

Class for Direct3D9 renderer system.

Definition at line 36 of file KeosD3D9RenderSystem.h.

## Constructor & Destructor Documentation

Keos::CD3D9RenderSystem::CD3D9RenderSystem | ( |  | ) |

| Constructor. Definition at line 44 of file KeosD3D9RenderSystem.cpp. References D3D9_EXCEPT, m_bDeviceLost, m_Matrices, m_nMinVertex, m_nVertexCount, m_pD3D9, and Keos::CD3D9::pD3D.

Keos::CD3D9RenderSystem::~CD3D9RenderSystem | ( |  | ) |

| Destructor. Definition at line 63 of file KeosD3D9RenderSystem.cpp. References m_pD3D9, and Shutdown().

## Member Function Documentation

IBufferBase * Keos::CD3D9RenderSystem::_CreateIB | ( | ulong | nSize,
|  | ulong | nStride,
|  | ulong | nFlags
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 392 of file KeosD3D9RenderSystem.cpp. References D3D9_EXCEPT, m_pD3D9, and Keos::CD3D9::pD3DDevice.

IBufferBase * Keos::CD3D9RenderSystem::_CreateVB | ( | ulong | nSize,
|  | ulong | nStride,
|  | ulong | nFlags
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 381 of file KeosD3D9RenderSystem.cpp. References D3D9_EXCEPT, m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::_NotifyDeviceLost | ( | void |  | ) |

| Notify that a device has been lost. Definition at line 679 of file KeosD3D9RenderSystem.cpp. References m_bDeviceLost.

void Keos::CD3D9RenderSystem::_SetIB | ( | const IBufferBase * | pBuffer,
|  | ulong | nStride
| ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 472 of file KeosD3D9RenderSystem.cpp. References Keos::CD3D9Buffer< T >::GetBuffer(), m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::_SetVB | ( | uint | nStream,
|  | const IBufferBase * | pBuffer,
|  | ulong | nStride,
|  | ulong | nMinVertex,
|  | ulong | nMaxVertex
| ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 458 of file KeosD3D9RenderSystem.cpp. References Keos::CD3D9Buffer< T >::GetBuffer(), m_nMinVertex, m_nVertexCount, m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::BeginScene | ( | void |  | ) | const`[virtual]`

| Start a scene render. Implements Keos::IRenderSystem. Definition at line 361 of file KeosD3D9RenderSystem.cpp. References m_pD3D9, Keos::CD3D9::pD3DDevice, and Keos::CColor::ToRGBA().

bool Keos::CD3D9RenderSystem::CheckFormat | ( | D3DFORMAT | Format,
|  | D3DRESOURCETYPE | ResourceType,
|  | ulong | nUsage = `0`
| ) | `[private]`

| Check if a pixel format is supported. Definition at line 352 of file KeosD3D9RenderSystem.cpp. References Assert, m_pD3D9, and Keos::CD3D9::pD3D. Referenced by InitCapabilities().

ulong Keos::CD3D9RenderSystem::ConvertColor | ( | const CColor & | Color | ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 540 of file KeosD3D9RenderSystem.cpp. Referenced by SetupTextureUnit().

IDeclaration * Keos::CD3D9RenderSystem::CreateDeclaration | ( | const TDeclarationElement * | pElements,
|  | size_t | nCount
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 403 of file KeosD3D9RenderSystem.cpp. References D3D9_EXCEPT, Keos::ELT_TYPE_COLOR, Keos::ELT_TYPE_FLOAT1, Keos::ELT_TYPE_FLOAT2, Keos::ELT_TYPE_FLOAT3, Keos::ELT_TYPE_FLOAT4, Keos::ELT_USAGE_DIFFUSE, Keos::ELT_USAGE_NORMAL, Keos::ELT_USAGE_POSITION, Keos::ELT_USAGE_TEXCOORD0, Keos::ELT_USAGE_TEXCOORD1, Keos::ELT_USAGE_TEXCOORD2, Keos::ELT_USAGE_TEXCOORD3, m_pD3D9, and Keos::CD3D9::pD3DDevice.

IRenderWindow * Keos::CD3D9RenderSystem::CreateRenderWindow | ( | const String & | strName,
|  | uint | nWidth,
|  | uint | nHeight,
|  | uint | nColourDepth,
|  | bool | bFullScreen
| ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 126 of file KeosD3D9RenderSystem.cpp. References Keos::IRenderSystem::AttachRenderTarget(), Keos::IRenderWindow::Create(), InitCapabilities(), m_pD3D9, Keos::CD3D9::pD3DDevice, and SetClearColor().

Referenced by Initialise().

IShaderBase * Keos::CD3D9RenderSystem::CreateShader | ( | CGprogram | Program,
|  | TShaderType | Type
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 611 of file KeosD3D9RenderSystem.cpp.

ITextureBase * Keos::CD3D9RenderSystem::CreateTexture | ( | const TVector2I & | Size,
|  | TPixelFormat | Format,
|  | ulong | nFlags = `0`
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 546 of file KeosD3D9RenderSystem.cpp. References Keos::CAP_HW_MIPMAPPING, D3D9_EXCEPT, Keos::IRenderSystem::GetCapabilities(), Keos::CRenderSystemCapabilities::HasCapability(), m_pD3D9, Keos::CD3D9::pD3D, Keos::CD3D9::pD3DDevice, and Keos::TEX_NOMIPMAP.

void Keos::CD3D9RenderSystem::DrawIndexedPrimitives | ( | TPrimitiveType | Type,
|  | ulong | nFirstIndex,
|  | ulong | nCount
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 498 of file KeosD3D9RenderSystem.cpp. References m_nMinVertex, m_nVertexCount, m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::DrawPrimitives | ( | TPrimitiveType | Type,
|  | ulong | nFirstVertex,
|  | ulong | nCount
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 492 of file KeosD3D9RenderSystem.cpp. References m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::Enable | ( | TRenderParameter | Param,
|  | bool | bValue
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 605 of file KeosD3D9RenderSystem.cpp. References m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::EndScene | ( | void |  | ) | const`[virtual]`

| End a scene render. Implements Keos::IRenderSystem. Definition at line 369 of file KeosD3D9RenderSystem.cpp. References m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::GetMatrix | ( | TMatrixType | Type,
|  | CMatrix4 & | Matrix
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 534 of file KeosD3D9RenderSystem.cpp. References m_Matrices.

const String & Keos::CD3D9RenderSystem::GetName | ( | void |  | ) | const`[virtual]`

| See RenderSystem. Implements Keos::IRenderSystem. Definition at line 71 of file KeosD3D9RenderSystem.cpp.

void Keos::CD3D9RenderSystem::InitCapabilities | ( | void |  | ) | `[private]`

| Initialize capabilities. Definition at line 160 of file KeosD3D9RenderSystem.cpp. References Keos::CAP_FRAGMENT_PROGRAM, Keos::CAP_HW_MIPMAPPING, Keos::CAP_NON_POWER_OF_2_TEXTURES, Keos::CAP_TEXTURE_COMPRESSION_DXT, Keos::CAP_VERTEX_PROGRAM, CheckFormat(), Keos::CRenderSystemCapabilities::HasCapability(), Keos::CRenderSystemCapabilities::Log(), m_pD3D9, Keos::CD3D9::pD3DDevice, SearchPixelShaderCaps(), SearchVertexShaderCaps(), Keos::CRenderSystemCapabilities::SetCapability(), and Keos::CRenderSystemCapabilities::SetNumTextureUnits().

Referenced by CreateRenderWindow().

IRenderWindow * Keos::CD3D9RenderSystem::Initialise | ( | bool | bAutoCreateWindow,
|  | const String & | strWindowTitle = `"KEOS Render Window"`
| ) | `[virtual]`

| See IRenderSystem. Reimplemented from Keos::IRenderSystem. Definition at line 78 of file KeosD3D9RenderSystem.cpp. References CreateRenderWindow(), and D3D9_EXCEPT. Referenced by Reinitialise().

bool Keos::CD3D9RenderSystem::IsDeviceLost | ( | void |  | ) |

| D3D specific method to return whether the device has been lost. Definition at line 673 of file KeosD3D9RenderSystem.cpp. References m_bDeviceLost. Referenced by Keos::CD3D9Window::Update().

void Keos::CD3D9RenderSystem::LoadMatrix | ( | TMatrixType | Type,
|  | const CMatrix4 & | Matrix
| ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 518 of file KeosD3D9RenderSystem.cpp. References m_Matrices, m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::LoadMatrixMult | ( | TMatrixType | Type,
|  | const CMatrix4 & | Matrix
| ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 526 of file KeosD3D9RenderSystem.cpp. References m_Matrices, m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::PopMatrix | ( | TMatrixType | Type | ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 510 of file KeosD3D9RenderSystem.cpp. References m_Matrices, m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::PrintInfo | ( | void |  | ) | const`[virtual]`

| Print information on the API. Implements Keos::IRenderSystem. Definition at line 375 of file KeosD3D9RenderSystem.cpp.

void Keos::CD3D9RenderSystem::PushMatrix | ( | TMatrixType | Type | ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 504 of file KeosD3D9RenderSystem.cpp. References m_Matrices.

void Keos::CD3D9RenderSystem::Reinitialise | ( | void |  | ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 112 of file KeosD3D9RenderSystem.cpp. References Initialise(), and Shutdown().

void Keos::CD3D9RenderSystem::RestoreLostDevice | ( | void |  | ) |

| D3D specific method to restore a lost device. Definition at line 653 of file KeosD3D9RenderSystem.cpp. References D3D9_EXCEPT, m_bDeviceLost, m_pD3D9, and Keos::CD3D9::pD3DDevice. Referenced by Keos::CD3D9Window::Update().

void Keos::CD3D9RenderSystem::SearchPixelShaderCaps | ( | D3DCAPS9 & | Caps | ) | `[private]`

| Search pixel shaders capabilities. Definition at line 261 of file KeosD3D9RenderSystem.cpp. References Keos::CAP_FRAGMENT_PROGRAM, Keos::CRenderSystemCapabilities::SetCapability(), and Keos::CRenderSystemCapabilities::SetMaxFragmentProgramVersion().

Referenced by InitCapabilities().

void Keos::CD3D9RenderSystem::SearchVertexShaderCaps | ( | D3DCAPS9 & | Caps | ) | `[private]`

| Search vertex shaders capabilities. Definition at line 208 of file KeosD3D9RenderSystem.cpp. References Keos::CAP_VERTEX_PROGRAM, Keos::CRenderSystemCapabilities::SetCapability(), and Keos::CRenderSystemCapabilities::SetMaxVertexProgramVersion(). Referenced by InitCapabilities().

void Keos::CD3D9RenderSystem::SetClearColor | ( | const CColor & | Color | ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 685 of file KeosD3D9RenderSystem.cpp. Referenced by CreateRenderWindow().

void Keos::CD3D9RenderSystem::SetDeclaration | ( | const IDeclaration * | pDeclaration | ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 482 of file KeosD3D9RenderSystem.cpp. References Keos::CD3D9Declaration::GetDeclaration(), m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::SetPixelShader | ( | const IShaderBase * | pShader | ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 635 of file KeosD3D9RenderSystem.cpp. References D3D9_EXCEPT, Keos::CD3D9Shader::GetProgram(), Keos::IShaderBase::GetType(), m_pD3D9, Keos::CD3D9::pD3DDevice, and Keos::SHADER_PIXEL.

void Keos::CD3D9RenderSystem::SetTexture | ( | uint | nUnit,
|  | const ITextureBase * | pTexture
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 567 of file KeosD3D9RenderSystem.cpp. References Keos::CD3D9Texture::GetD3D9Texture(), m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::SetupAlphaBlending | ( | TBlend | Src,
|  | TBlend | Dest
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 574 of file KeosD3D9RenderSystem.cpp. References m_pD3D9, and Keos::CD3D9::pD3DDevice.

void Keos::CD3D9RenderSystem::SetupTextureUnit | ( | uint | nUnit,
|  | TTextureOp | Op,
|  | TTextureArg | Arg1,
|  | TTextureArg | Arg2 = `TXA_DIFFUSE`,
|  | const CColor & | Constant = `0x00`
| ) | const`[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 581 of file KeosD3D9RenderSystem.cpp. References ConvertColor(), m_pD3D9, Keos::CD3D9::pD3DDevice, Keos::TXA_CONSTANT, and Keos::TXO_ALPHA_FIRSTARG.

void Keos::CD3D9RenderSystem::SetVertexShader | ( | const IShaderBase * | pShader | ) | `[virtual]`

| See IRenderSystem. Implements Keos::IRenderSystem. Definition at line 617 of file KeosD3D9RenderSystem.cpp. References D3D9_EXCEPT, Keos::CD3D9Shader::GetProgram(), Keos::IShaderBase::GetType(), m_pD3D9, Keos::CD3D9::pD3DDevice, and Keos::SHADER_VERTEX.

void Keos::CD3D9RenderSystem::Shutdown | ( | void |  | ) | `[virtual]`

| See IRenderSystem. Reimplemented from Keos::IRenderSystem. Definition at line 119 of file KeosD3D9RenderSystem.cpp. References m_pD3D9, and Keos::CD3D9::ReleaseDevice(). Referenced by Reinitialise(), and ~CD3D9RenderSystem().

## Member Data Documentation

bool Keos::CD3D9RenderSystem::m_bDeviceLost`[private]`

| The device has been lost. Definition at line 215 of file KeosD3D9RenderSystem.h. Referenced by _NotifyDeviceLost(), CD3D9RenderSystem(), IsDeviceLost(), and RestoreLostDevice().

std::vector<CMatrix4> Keos::CD3D9RenderSystem::m_Matrices[6]`[private]`

| Matrices stack. Definition at line 212 of file KeosD3D9RenderSystem.h. Referenced by CD3D9RenderSystem(), GetMatrix(), LoadMatrix(), LoadMatrixMult(), PopMatrix(), and PushMatrix().

ulong Keos::CD3D9RenderSystem::m_nMinVertex`[private]`

| Save of the minimum index of the next verticies to be rendered. Definition at line 206 of file KeosD3D9RenderSystem.h. Referenced by _SetVB(), CD3D9RenderSystem(), and DrawIndexedPrimitives().

ulong Keos::CD3D9RenderSystem::m_nVertexCount`[private]`

| Save of the number of the next verticies to be rendered. Definition at line 209 of file KeosD3D9RenderSystem.h. Referenced by _SetVB(), CD3D9RenderSystem(), and DrawIndexedPrimitives().

CD3D9* Keos::CD3D9RenderSystem::m_pD3D9`[private]`

| Direct3D9 variables. Definition at line 203 of file KeosD3D9RenderSystem.h. Referenced by _CreateIB(), _CreateVB(), _SetIB(), _SetVB(), BeginScene(), CD3D9RenderSystem(), CheckFormat(), CreateDeclaration(), CreateRenderWindow(), CreateTexture(), DrawIndexedPrimitives(), DrawPrimitives(), Enable(), EndScene(), InitCapabilities(), LoadMatrix(), LoadMatrixMult(), PopMatrix(), RestoreLostDevice(), SetDeclaration(), SetPixelShader(), SetTexture(), SetupAlphaBlending(), SetupTextureUnit(), SetVertexShader(), Shutdown(), and ~CD3D9RenderSystem().

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

- RenderSystems/Direct3D9/KeosD3D9RenderSystem.h
- RenderSystems/Direct3D9/KeosD3D9RenderSystem.cpp