Graphics::Renderer namespace

This namespace contains most internal stuff related with rendering, such as Direct3D Device and shaders, shader data, etc.

Contents

Classes

struct DeviceParameters

Functions

auto GetDirect3D() -> IDirect3D9*
auto GetDevice() -> IDirect3DDevice9*
Returns the Direct3D Device used for all rendering operations in the game.
auto GetShaderData() -> void**
Returns a pointer to the array that contains the values of shader data.
auto GetMaterialShader() -> MaterialShader*
Returns the current MaterialShader object which is being used to render.
auto GetModelToWorld() -> D3DMATRIX*
Returns the 'modelToWorld' matrix.
void SetModelMatrix(D3DMATRIX* value)
Sets the 'modelToWorld' matrix.
auto GetModelToWorldTransposed() -> D3DMATRIX*
Returns the 'modelToWorld' matrix, transposed.
void SetModelToWorldTransposed(D3DMATRIX* value)
Sets the 'modelToWorld' matrix, transposed.
auto GetPresentationParameters() -> D3DPRESENT_PARAMETERS&
void SetShaderData(short index, void* value, bool overrideIfEqual = false)
auto GetShaderDataSize(short index) -> int
void RegisterShaderData(short id, ShaderDataInformation::UnfixCB, ShaderDataInformation::RefixCB, ShaderDataInformation::FixupCB, ShaderDataInformation::UploadCB)
auto SetPresentationParameters(const DeviceParameters& parameters) -> int
Assigns the presentation parameters that will be used by the DirectX device.
auto CreateDevice(DeviceParameters& parameters) -> int
Creates the Direct3D device.
void SetTexture(int slotIndex, RenderWare::Raster* raster)
Sends the given raster to the Direct3D device.
auto SetRenderTarget(int index, RenderWare::Raster* raster) -> HRESULT
Sets the given raster to be the active Direct3D render target for the given index.

Function documentation

IDirect3D9* Graphics::Renderer::GetDirect3D()

IDirect3DDevice9* Graphics::Renderer::GetDevice()

Returns the Direct3D Device used for all rendering operations in the game.

void** Graphics::Renderer::GetShaderData()

Returns a pointer to the array that contains the values of shader data.

For example, you can do GetShaderData()[ShaderData::skinWeights];

MaterialShader* Graphics::Renderer::GetMaterialShader()

Returns the current MaterialShader object which is being used to render.

This can either be a ShaderBuilder or an StandardShader.

D3DMATRIX* Graphics::Renderer::GetModelToWorld()

Returns the 'modelToWorld' matrix.

void Graphics::Renderer::SetModelMatrix(D3DMATRIX* value)

Sets the 'modelToWorld' matrix.

Parameters
value

D3DMATRIX* Graphics::Renderer::GetModelToWorldTransposed()

Returns the 'modelToWorld' matrix, transposed.

void Graphics::Renderer::SetModelToWorldTransposed(D3DMATRIX* value)

Sets the 'modelToWorld' matrix, transposed.

Parameters
value

D3DPRESENT_PARAMETERS& Graphics::Renderer::GetPresentationParameters()

void Graphics::Renderer::SetShaderData(short index, void* value, bool overrideIfEqual = false)

int Graphics::Renderer::GetShaderDataSize(short index)

int Graphics::Renderer::SetPresentationParameters(const DeviceParameters& parameters)

Assigns the presentation parameters that will be used by the DirectX device.

Parameters
parameters

This must not be called, as it would create another device, but it can be detoured.

int Graphics::Renderer::CreateDevice(DeviceParameters& parameters)

Creates the Direct3D device.

Parameters
parameters

This must not be called, as it would create another device; if you need to modify this, detour this function.

void Graphics::Renderer::SetTexture(int slotIndex, RenderWare::Raster* raster)

Sends the given raster to the Direct3D device.

Parameters
slotIndex The slot this raster will occupy, between 0 and 15.
raster

HRESULT Graphics::Renderer::SetRenderTarget(int index, RenderWare::Raster* raster)

Sets the given raster to be the active Direct3D render target for the given index.

Parameters
index The render target index
raster
Returns D3D_OK if the operation succeeded, an error code otherwise.

Only works if the Raster is a surface.