Loading...
Searching...
No Matches
Gfx::CNullDevice Class Reference

Device implementation that doesn't render anything. More...

`#include <src/graphics/core/nulldevice.h>`

Inheritance diagram for Gfx::CNullDevice:
[legend]

## Public Member Functions

void | DebugHook () override
| Provides a hook to debug graphics code (implementation-specific).
void | DebugLights () override
| Displays light positions to aid in debuggings.
std::string | GetName () override
| Returns a name of this device.
bool | Create () override
| Initializes the device, setting the initial state.
void | Destroy () override
| Destroys the device, releasing every acquired resource.
void | ConfigChanged (const DeviceConfig &newConfig) override
| Changes configuration.
void | BeginScene () override
| Begins drawing the 3D scene.
void | EndScene () override
| Ends drawing the 3D scene.
void | Clear () override
| Clears the screen to blank.
void | SetRenderMode (RenderMode mode) override
| Sets current rendering mode.
void | SetTransform (TransformType type, const Math::Matrix &matrix) override
| Sets the transform matrix of given type.
void | SetMaterial (const Material &material) override
| Sets the current material.
int | GetMaxLightCount () override
| Returns the maximum number of lights available.
void | SetLight (int index, const Light &light) override
| Sets the light at given index.
void | SetLightEnabled (int index, bool enabled) override
| Enables/disables the light at given index.
Texture | CreateTexture (CImage *image, const TextureCreateParams &params) override
| Creates a texture from image; the image can be safely removed after that.
Texture | CreateTexture (ImageData *data, const TextureCreateParams &params) override
| Creates a texture from raw image data; image data can be freed after that.
Texture | CreateDepthTexture (int width, int height, int depth) override
| Creates a depth texture with specific dimensions and depth.
void | UpdateTexture (const Texture &texture, Math::IntPoint offset, ImageData *data, TexImgFormat format) override
| Updates a part of texture from raw image data.
void | DestroyTexture (const Texture &texture) override
| Deletes a given texture, freeing it from video memory.
void | DestroyAllTextures () override
| Deletes all textures created so far.
int | GetMaxTextureStageCount () override
| Returns the maximum number of multitexture stages.
void | SetTexture (int index, const Texture &texture) override
| Sets the texture at given texture stage.
void | SetTexture (int index, unsigned int textureId) override
| Sets the texture image by ID at given texture stage.
void | SetTextureEnabled (int index, bool enabled) override
| Enables/disables the given texture stage.
void | SetTextureStageParams (int index, const TextureStageParams &params) override
| Sets the params for texture stage with given index.
void | SetTextureStageWrap (int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT) override
| Sets only the texture wrap modes (for faster than thru stage params).
void | DrawPrimitive (PrimitiveType type, const Vertex *vertices, int vertexCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) override
| Renders primitive composed of vertices with single texture.
void | DrawPrimitive (PrimitiveType type, const VertexTex2 *vertices, int vertexCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) override
| Renders primitive composed of vertices with multitexturing (2 textures).
void | DrawPrimitive (PrimitiveType type, const VertexCol *vertices, int vertexCount) override
| Renders primitive composed of vertices with solid color.
void | DrawPrimitives (PrimitiveType type, const Vertex *vertices, int first[], int count[], int drawCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) override
| Renders primitives composed of lists of vertices with single texture.
void | DrawPrimitives (PrimitiveType type, const VertexTex2 *vertices, int first[], int count[], int drawCount, Color color=Color(1.0f, 1.0f, 1.0f, 1.0f)) override
| Renders primitives composed of lists of vertices with multitexturing (2 textures).
void | DrawPrimitives (PrimitiveType type, const VertexCol *vertices, int first[], int count[], int drawCount) override
| Renders primitives composed of lists of vertices with solid color.
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const Vertex *vertices, int vertexCount) override
| Creates a static buffer composed of given primitives with single texture vertices.
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) override
| Creates a static buffer composed of given primitives with multitexturing.
unsigned int | CreateStaticBuffer (PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) override
| Creates a static buffer composed of given primitives with solid color.
void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const Vertex *vertices, int vertexCount) override
| Updates the static buffer composed of given primitives with single texture vertices.
void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount) override
| Updates the static buffer composed of given primitives with multitexturing.
void | UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount) override
| Updates the static buffer composed of given primitives with solid color.
void | DrawStaticBuffer (unsigned int bufferId) override
| Draws a static buffer.
void | DestroyStaticBuffer (unsigned int bufferId) override
| Deletes a static buffer.
int | ComputeSphereVisibility (const Math::Vector &center, float radius) override
void | SetViewport (int x, int y, int width, int height) override
| Changes rendering viewport.
void | SetRenderState (RenderState state, bool enabled) override
| Enables/disables the given render state.
void | SetColorMask (bool red, bool green, bool blue, bool alpha) override
| Sets the color mask.
void | SetDepthTestFunc (CompFunc func) override
| Sets the function of depth test.
void | SetDepthBias (float factor, float units) override
| Sets the depth bias (constant value added to Z-coords).
void | SetAlphaTestFunc (CompFunc func, float refValue) override
| Sets the alpha test function and reference value.
void | SetBlendFunc (BlendFunc srcBlend, BlendFunc dstBlend) override
| Sets the blending functions for source and destination operations.
void | SetClearColor (const Color &color) override
| Sets the clear color.
void | SetGlobalAmbient (const Color &color) override
| Sets the global ambient color.
void | SetFogParams (FogMode mode, const Color &color, float start, float end, float density) override
| Sets the fog parameters: mode, color, start distance, end distance and density (for exp models).
void | SetCullMode (CullMode mode) override
| Sets the current cull mode.
void | SetShadeModel (ShadeModel model) override
| Sets the shade model.
void | SetShadowColor (float value) override
| Sets shadow color.
void | SetFillMode (FillMode mode) override
| Sets the current fill mode.
void | CopyFramebufferToTexture (Texture &texture, int xOffset, int yOffset, int x, int y, int width, int height) override
| Copies content of framebuffer to texture.
std::unique_ptr< CFrameBufferPixels > | GetFrameBufferPixels () const override
| Returns the pixels of the entire screen.
CFramebuffer * | GetFramebuffer (std::string name) override
| Returns framebuffer with given name or nullptr if it doesn't exist.
CFramebuffer * | CreateFramebuffer (std::string name, const FramebufferParams &params) override
| Creates new framebuffer with given name or nullptr if it's not possible.
void | DeleteFramebuffer (std::string name) override
| Deletes framebuffer.
bool | IsAnisotropySupported () override
| Checks if anisotropy is supported.
int | GetMaxAnisotropyLevel () override
| Returns max anisotropy level supported.
int | GetMaxSamples () override
| Returns max samples supported.
bool | IsShadowMappingSupported () override
| Checks if shadow mapping is supported.
int | GetMaxTextureSize () override
| Returns max texture size supported.
bool | IsFramebufferSupported () override
| Checks if framebuffers are supported.
Public Member Functions inherited from Gfx::CDevice
std::string | GetError ()
| Returns last error message or empty string.
const DeviceCapabilities & | GetCapabilities ()
| Returns device capabilities.

## Additional Inherited Members

Protected Attributes inherited from Gfx::CDevice
std::string | m_errorMessage
DeviceCapabilities | m_capabilities

## Detailed Description

Device implementation that doesn't render anything.

## Member Function Documentation

## DebugHook()

void Gfx::CNullDevice::DebugHook | ( |  | ) |

override virtual

Provides a hook to debug graphics code (implementation-specific).

Implements Gfx::CDevice.

## DebugLights()

void Gfx::CNullDevice::DebugLights | ( |  | ) |

override virtual

Displays light positions to aid in debuggings.

Implements Gfx::CDevice.

## GetName()

std::string Gfx::CNullDevice::GetName | ( |  | ) |

override virtual

Returns a name of this device.

Implements Gfx::CDevice.

## Create()

bool Gfx::CNullDevice::Create | ( |  | ) |

override virtual

Initializes the device, setting the initial state.

Implements Gfx::CDevice.

## Destroy()

void Gfx::CNullDevice::Destroy | ( |  | ) |

override virtual

Destroys the device, releasing every acquired resource.

Implements Gfx::CDevice.

## ConfigChanged()

void Gfx::CNullDevice::ConfigChanged | ( | const DeviceConfig & | newConfig | ) |

override virtual

Changes configuration.

Implements Gfx::CDevice.

## BeginScene()

void Gfx::CNullDevice::BeginScene | ( |  | ) |

override virtual

Begins drawing the 3D scene.

Implements Gfx::CDevice.

## EndScene()

void Gfx::CNullDevice::EndScene | ( |  | ) |

override virtual

Ends drawing the 3D scene.

Implements Gfx::CDevice.

## Clear()

void Gfx::CNullDevice::Clear | ( |  | ) |

override virtual

Clears the screen to blank.

Implements Gfx::CDevice.

## SetRenderMode()

void Gfx::CNullDevice::SetRenderMode | ( | RenderMode | mode | ) |

override virtual

Sets current rendering mode.

Implements Gfx::CDevice.

## SetTransform()

void Gfx::CNullDevice::SetTransform | ( | TransformType | type,
|  | const Math::Matrix & | matrix )

override virtual

Sets the transform matrix of given type.

Implements Gfx::CDevice.

## SetMaterial()

void Gfx::CNullDevice::SetMaterial | ( | const Material & | material | ) |

override virtual

Sets the current material.

Implements Gfx::CDevice.

## GetMaxLightCount()

int Gfx::CNullDevice::GetMaxLightCount | ( |  | ) |

override virtual

Returns the maximum number of lights available.

Implements Gfx::CDevice.

## SetLight()

void Gfx::CNullDevice::SetLight | ( | int | index,
|  | const Light & | light )

override virtual

Sets the light at given index.

Implements Gfx::CDevice.

## SetLightEnabled()

void Gfx::CNullDevice::SetLightEnabled | ( | int | index,
|  | bool | enabled )

override virtual

Enables/disables the light at given index.

Implements Gfx::CDevice.

## CreateTexture() [1/2]

Texture Gfx::CNullDevice::CreateTexture | ( | CImage * | image,
|  | const TextureCreateParams & | params )

override virtual

Creates a texture from image; the image can be safely removed after that.

Implements Gfx::CDevice.

## CreateTexture() [2/2]

Texture Gfx::CNullDevice::CreateTexture | ( | ImageData * | data,
|  | const TextureCreateParams & | params )

override virtual

Creates a texture from raw image data; image data can be freed after that.

Implements Gfx::CDevice.

## CreateDepthTexture()

Texture Gfx::CNullDevice::CreateDepthTexture | ( | int | width,
|  | int | height,
|  | int | depth )

override virtual

Creates a depth texture with specific dimensions and depth.

Implements Gfx::CDevice.

## UpdateTexture()

void Gfx::CNullDevice::UpdateTexture | ( | const Texture & | texture,
|  | Math::IntPoint | offset,
|  | ImageData * | data,
|  | TexImgFormat | format )

override virtual

Updates a part of texture from raw image data.

Implements Gfx::CDevice.

## DestroyTexture()

void Gfx::CNullDevice::DestroyTexture | ( | const Texture & | texture | ) |

override virtual

Deletes a given texture, freeing it from video memory.

Implements Gfx::CDevice.

## DestroyAllTextures()

void Gfx::CNullDevice::DestroyAllTextures | ( |  | ) |

override virtual

Deletes all textures created so far.

Implements Gfx::CDevice.

## GetMaxTextureStageCount()

int Gfx::CNullDevice::GetMaxTextureStageCount | ( |  | ) |

override virtual

Returns the maximum number of multitexture stages.

Implements Gfx::CDevice.

## SetTexture() [1/2]

void Gfx::CNullDevice::SetTexture | ( | int | index,
|  | const Texture & | texture )

override virtual

Sets the texture at given texture stage.

Implements Gfx::CDevice.

## SetTexture() [2/2]

void Gfx::CNullDevice::SetTexture | ( | int | index,
|  | unsigned int | textureId )

override virtual

Sets the texture image by ID at given texture stage.

Implements Gfx::CDevice.

## SetTextureEnabled()

void Gfx::CNullDevice::SetTextureEnabled | ( | int | index,
|  | bool | enabled )

override virtual

Enables/disables the given texture stage.

Implements Gfx::CDevice.

## SetTextureStageParams()

void Gfx::CNullDevice::SetTextureStageParams | ( | int | index,
|  | const TextureStageParams & | params )

override virtual

Sets the params for texture stage with given index.

Implements Gfx::CDevice.

## SetTextureStageWrap()

void Gfx::CNullDevice::SetTextureStageWrap | ( | int | index,
|  | Gfx::TexWrapMode | wrapS,
|  | Gfx::TexWrapMode | wrapT )

override virtual

Sets only the texture wrap modes (for faster than thru stage params).

Implements Gfx::CDevice.

## DrawPrimitive() [1/3]

void Gfx::CNullDevice::DrawPrimitive | ( | PrimitiveType | type,
|  | const Vertex * | vertices,
|  | int | vertexCount,
|  | Color | color = Color(1.0f, 1.0f, 1.0f, 1.0f) )

override virtual

Renders primitive composed of vertices with single texture.

Implements Gfx::CDevice.

## DrawPrimitive() [2/3]

void Gfx::CNullDevice::DrawPrimitive | ( | PrimitiveType | type,
|  | const VertexTex2 * | vertices,
|  | int | vertexCount,
|  | Color | color = Color(1.0f, 1.0f, 1.0f, 1.0f) )

override virtual

Renders primitive composed of vertices with multitexturing (2 textures).

Implements Gfx::CDevice.

## DrawPrimitive() [3/3]

void Gfx::CNullDevice::DrawPrimitive | ( | PrimitiveType | type,
|  | const VertexCol * | vertices,
|  | int | vertexCount )

override virtual

Renders primitive composed of vertices with solid color.

Implements Gfx::CDevice.

## DrawPrimitives() [1/3]

void Gfx::CNullDevice::DrawPrimitives | ( | PrimitiveType | type,
|  | const Vertex * | vertices,
|  | int | first[],
|  | int | count[],
|  | int | drawCount,
|  | Color | color = Color(1.0f, 1.0f, 1.0f, 1.0f) )

override virtual

Renders primitives composed of lists of vertices with single texture.

Implements Gfx::CDevice.

## DrawPrimitives() [2/3]

void Gfx::CNullDevice::DrawPrimitives | ( | PrimitiveType | type,
|  | const VertexTex2 * | vertices,
|  | int | first[],
|  | int | count[],
|  | int | drawCount,
|  | Color | color = Color(1.0f, 1.0f, 1.0f, 1.0f) )

override virtual

Renders primitives composed of lists of vertices with multitexturing (2 textures).

Implements Gfx::CDevice.

## DrawPrimitives() [3/3]

void Gfx::CNullDevice::DrawPrimitives | ( | PrimitiveType | type,
|  | const VertexCol * | vertices,
|  | int | first[],
|  | int | count[],
|  | int | drawCount )

override virtual

Renders primitives composed of lists of vertices with solid color.

Implements Gfx::CDevice.

## CreateStaticBuffer() [1/3]

unsigned int Gfx::CNullDevice::CreateStaticBuffer | ( | PrimitiveType | primitiveType,
|  | const Vertex * | vertices,
|  | int | vertexCount )

override virtual

Creates a static buffer composed of given primitives with single texture vertices.

Implements Gfx::CDevice.

## CreateStaticBuffer() [2/3]

unsigned int Gfx::CNullDevice::CreateStaticBuffer | ( | PrimitiveType | primitiveType,
|  | const VertexTex2 * | vertices,
|  | int | vertexCount )

override virtual

Creates a static buffer composed of given primitives with multitexturing.

Implements Gfx::CDevice.

## CreateStaticBuffer() [3/3]

unsigned int Gfx::CNullDevice::CreateStaticBuffer | ( | PrimitiveType | primitiveType,
|  | const VertexCol * | vertices,
|  | int | vertexCount )

override virtual

Creates a static buffer composed of given primitives with solid color.

Implements Gfx::CDevice.

## UpdateStaticBuffer() [1/3]

void Gfx::CNullDevice::UpdateStaticBuffer | ( | unsigned int | bufferId,
|  | PrimitiveType | primitiveType,
|  | const Vertex * | vertices,
|  | int | vertexCount )

override virtual

Updates the static buffer composed of given primitives with single texture vertices.

Implements Gfx::CDevice.

## UpdateStaticBuffer() [2/3]

void Gfx::CNullDevice::UpdateStaticBuffer | ( | unsigned int | bufferId,
|  | PrimitiveType | primitiveType,
|  | const VertexTex2 * | vertices,
|  | int | vertexCount )

override virtual

Updates the static buffer composed of given primitives with multitexturing.

Implements Gfx::CDevice.

## UpdateStaticBuffer() [3/3]

void Gfx::CNullDevice::UpdateStaticBuffer | ( | unsigned int | bufferId,
|  | PrimitiveType | primitiveType,
|  | const VertexCol * | vertices,
|  | int | vertexCount )

override virtual

Updates the static buffer composed of given primitives with solid color.

Implements Gfx::CDevice.

## DrawStaticBuffer()

void Gfx::CNullDevice::DrawStaticBuffer | ( | unsigned int | bufferId | ) |

override virtual

Draws a static buffer.

Implements Gfx::CDevice.

## DestroyStaticBuffer()

void Gfx::CNullDevice::DestroyStaticBuffer | ( | unsigned int | bufferId | ) |

override virtual

Deletes a static buffer.

Implements Gfx::CDevice.

## ComputeSphereVisibility()

int Gfx::CNullDevice::ComputeSphereVisibility | ( | const Math::Vector & | center,
|  | float | radius )

override virtual

Tests whether a sphere is (partially) within the frustum volume Returns a mask of frustum planes for which the test is positive

Implements Gfx::CDevice.

## SetViewport()

void Gfx::CNullDevice::SetViewport | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height )

override virtual

Changes rendering viewport.

Implements Gfx::CDevice.

## SetRenderState()

void Gfx::CNullDevice::SetRenderState | ( | RenderState | state,
|  | bool | enabled )

override virtual

Enables/disables the given render state.

Implements Gfx::CDevice.

## SetColorMask()

void Gfx::CNullDevice::SetColorMask | ( | bool | red,
|  | bool | green,
|  | bool | blue,
|  | bool | alpha )

override virtual

Sets the color mask.

Implements Gfx::CDevice.

## SetDepthTestFunc()

void Gfx::CNullDevice::SetDepthTestFunc | ( | CompFunc | func | ) |

override virtual

Sets the function of depth test.

Implements Gfx::CDevice.

## SetDepthBias()

void Gfx::CNullDevice::SetDepthBias | ( | float | factor,
|  | float | units )

override virtual

Sets the depth bias (constant value added to Z-coords).

Implements Gfx::CDevice.

## SetAlphaTestFunc()

void Gfx::CNullDevice::SetAlphaTestFunc | ( | CompFunc | func,
|  | float | refValue )

override virtual

Sets the alpha test function and reference value.

Implements Gfx::CDevice.

## SetBlendFunc()

void Gfx::CNullDevice::SetBlendFunc | ( | BlendFunc | srcBlend,
|  | BlendFunc | dstBlend )

override virtual

Sets the blending functions for source and destination operations.

Implements Gfx::CDevice.

## SetClearColor()

void Gfx::CNullDevice::SetClearColor | ( | const Color & | color | ) |

override virtual

Sets the clear color.

Implements Gfx::CDevice.

## SetGlobalAmbient()

void Gfx::CNullDevice::SetGlobalAmbient | ( | const Color & | color | ) |

override virtual

Sets the global ambient color.

Implements Gfx::CDevice.

## SetFogParams()

void Gfx::CNullDevice::SetFogParams | ( | FogMode | mode,
|  | const Color & | color,
|  | float | start,
|  | float | end,
|  | float | density )

override virtual

Sets the fog parameters: mode, color, start distance, end distance and density (for exp models).

Implements Gfx::CDevice.

## SetCullMode()

void Gfx::CNullDevice::SetCullMode | ( | CullMode | mode | ) |

override virtual

Sets the current cull mode.

Implements Gfx::CDevice.

## SetShadeModel()

void Gfx::CNullDevice::SetShadeModel | ( | ShadeModel | model | ) |

override virtual

Sets the shade model.

Implements Gfx::CDevice.

## SetShadowColor()

void Gfx::CNullDevice::SetShadowColor | ( | float | value | ) |

override virtual

Sets shadow color.

Implements Gfx::CDevice.

## SetFillMode()

void Gfx::CNullDevice::SetFillMode | ( | FillMode | mode | ) |

override virtual

Sets the current fill mode.

Implements Gfx::CDevice.

## CopyFramebufferToTexture()

void Gfx::CNullDevice::CopyFramebufferToTexture | ( | Texture & | texture,
|  | int | xOffset,
|  | int | yOffset,
|  | int | x,
|  | int | y,
|  | int | width,
|  | int | height )

override virtual

Copies content of framebuffer to texture.

Implements Gfx::CDevice.

## GetFrameBufferPixels()

std::unique_ptr< CFrameBufferPixels > Gfx::CNullDevice::GetFrameBufferPixels | ( |  | ) | const

override virtual

Returns the pixels of the entire screen.

Implements Gfx::CDevice.

## GetFramebuffer()

CFramebuffer * Gfx::CNullDevice::GetFramebuffer | ( | std::string | name | ) |

override virtual

Returns framebuffer with given name or nullptr if it doesn't exist.

Implements Gfx::CDevice.

## CreateFramebuffer()

CFramebuffer * Gfx::CNullDevice::CreateFramebuffer | ( | std::string | name,
|  | const FramebufferParams & | params )

override virtual

Creates new framebuffer with given name or nullptr if it's not possible.

Implements Gfx::CDevice.

## DeleteFramebuffer()

void Gfx::CNullDevice::DeleteFramebuffer | ( | std::string | name | ) |

override virtual

Deletes framebuffer.

Implements Gfx::CDevice.

## IsAnisotropySupported()

bool Gfx::CNullDevice::IsAnisotropySupported | ( |  | ) |

override virtual

Checks if anisotropy is supported.

Implements Gfx::CDevice.

## GetMaxAnisotropyLevel()

int Gfx::CNullDevice::GetMaxAnisotropyLevel | ( |  | ) |

override virtual

Returns max anisotropy level supported.

Implements Gfx::CDevice.

## GetMaxSamples()

int Gfx::CNullDevice::GetMaxSamples | ( |  | ) |

override virtual

Returns max samples supported.

Implements Gfx::CDevice.

## IsShadowMappingSupported()

bool Gfx::CNullDevice::IsShadowMappingSupported | ( |  | ) |

override virtual

Checks if shadow mapping is supported.

Implements Gfx::CDevice.

## GetMaxTextureSize()

int Gfx::CNullDevice::GetMaxTextureSize | ( |  | ) |

override virtual

Returns max texture size supported.

Implements Gfx::CDevice.

## IsFramebufferSupported()

bool Gfx::CNullDevice::IsFramebufferSupported | ( |  | ) |

override virtual

Checks if framebuffers are supported.

Implements Gfx::CDevice.

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

- src/graphics/core/nulldevice.h
- src/graphics/core/nulldevice.cpp