Colobot
Public Member Functions | List of all members
Gfx::CNullDevice Class Reference

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

#include <nulldevice.h>

Inheritance diagram for Gfx::CNullDevice:
Inheritance graph
[legend]

Public Member Functions

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

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

void Gfx::CNullDevice::DebugHook ( )
overridevirtual

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

Implements Gfx::CDevice.

void Gfx::CNullDevice::DebugLights ( )
overridevirtual

Displays light positions to aid in debuggings.

Implements Gfx::CDevice.

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

Returns a name of this device.

Implements Gfx::CDevice.

bool Gfx::CNullDevice::Create ( )
overridevirtual

Initializes the device, setting the initial state.

Implements Gfx::CDevice.

void Gfx::CNullDevice::Destroy ( )
overridevirtual

Destroys the device, releasing every acquired resource.

Implements Gfx::CDevice.

void Gfx::CNullDevice::ConfigChanged ( const DeviceConfig newConfig)
overridevirtual

Changes configuration.

Implements Gfx::CDevice.

void Gfx::CNullDevice::BeginScene ( )
overridevirtual

Begins drawing the 3D scene.

Implements Gfx::CDevice.

void Gfx::CNullDevice::EndScene ( )
overridevirtual

Ends drawing the 3D scene.

Implements Gfx::CDevice.

void Gfx::CNullDevice::Clear ( )
overridevirtual

Clears the screen to blank.

Implements Gfx::CDevice.

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

Sets current rendering mode.

Implements Gfx::CDevice.

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

Sets the transform matrix of given type.

Implements Gfx::CDevice.

void Gfx::CNullDevice::SetMaterial ( const Material material)
overridevirtual

Sets the current material.

Implements Gfx::CDevice.

int Gfx::CNullDevice::GetMaxLightCount ( )
overridevirtual

Returns the maximum number of lights available.

Implements Gfx::CDevice.

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

Sets the light at given index.

Implements Gfx::CDevice.

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

Enables/disables the light at given index.

Implements Gfx::CDevice.

Texture Gfx::CNullDevice::CreateTexture ( CImage image,
const TextureCreateParams params 
)
overridevirtual

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

Implements Gfx::CDevice.

Texture Gfx::CNullDevice::CreateTexture ( ImageData data,
const TextureCreateParams params 
)
overridevirtual

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

Implements Gfx::CDevice.

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

Creates a depth texture with specific dimensions and depth.

Implements Gfx::CDevice.

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

Updates a part of texture from raw image data.

Implements Gfx::CDevice.

void Gfx::CNullDevice::DestroyTexture ( const Texture texture)
overridevirtual

Deletes a given texture, freeing it from video memory.

Implements Gfx::CDevice.

void Gfx::CNullDevice::DestroyAllTextures ( )
overridevirtual

Deletes all textures created so far.

Implements Gfx::CDevice.

int Gfx::CNullDevice::GetMaxTextureStageCount ( )
overridevirtual

Returns the maximum number of multitexture stages.

Implements Gfx::CDevice.

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

Sets the texture at given texture stage.

Implements Gfx::CDevice.

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

Sets the texture image by ID at given texture stage.

Implements Gfx::CDevice.

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

Enables/disables the given texture stage.

Implements Gfx::CDevice.

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

Sets the params for texture stage with given index.

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

Renders primitive composed of vertices with single texture.

Implements Gfx::CDevice.

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

Renders primitive composed of vertices with multitexturing (2 textures)

Implements Gfx::CDevice.

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

Renders primitive composed of vertices with solid color.

Implements Gfx::CDevice.

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) 
)
overridevirtual

Renders primitives composed of lists of vertices with single texture.

Implements Gfx::CDevice.

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) 
)
overridevirtual

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

Implements Gfx::CDevice.

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

Renders primitives composed of lists of vertices with solid color.

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

Creates a static buffer composed of given primitives with multitexturing.

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

Updates the static buffer composed of given primitives with multitexturing.

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

Draws a static buffer.

Implements Gfx::CDevice.

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

Deletes a static buffer.

Implements Gfx::CDevice.

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

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.

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

Changes rendering viewport.

Implements Gfx::CDevice.

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

Enables/disables the given render state.

Implements Gfx::CDevice.

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

Sets the color mask.

Implements Gfx::CDevice.

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

Sets the function of depth test.

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

Sets the alpha test function and reference value.

Implements Gfx::CDevice.

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

Sets the blending functions for source and destination operations.

Implements Gfx::CDevice.

void Gfx::CNullDevice::SetClearColor ( const Color color)
overridevirtual

Sets the clear color.

Implements Gfx::CDevice.

void Gfx::CNullDevice::SetGlobalAmbient ( const Color color)
overridevirtual

Sets the global ambient color.

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

Sets the current cull mode.

Implements Gfx::CDevice.

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

Sets the shade model.

Implements Gfx::CDevice.

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

Sets shadow color.

Implements Gfx::CDevice.

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

Sets the current fill mode.

Implements Gfx::CDevice.

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

Copies content of framebuffer to texture.

Implements Gfx::CDevice.

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

Returns the pixels of the entire screen.

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

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

Implements Gfx::CDevice.

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

Deletes framebuffer.

Implements Gfx::CDevice.

bool Gfx::CNullDevice::IsAnisotropySupported ( )
overridevirtual

Checks if anisotropy is supported.

Implements Gfx::CDevice.

int Gfx::CNullDevice::GetMaxAnisotropyLevel ( )
overridevirtual

Returns max anisotropy level supported.

Implements Gfx::CDevice.

int Gfx::CNullDevice::GetMaxSamples ( )
overridevirtual

Returns max samples supported.

Implements Gfx::CDevice.

bool Gfx::CNullDevice::IsShadowMappingSupported ( )
overridevirtual

Checks if shadow mapping is supported.

Implements Gfx::CDevice.

int Gfx::CNullDevice::GetMaxTextureSize ( )
overridevirtual

Returns max texture size supported.

Implements Gfx::CDevice.

bool Gfx::CNullDevice::IsFramebufferSupported ( )
overridevirtual

Checks if framebuffers are supported.

Implements Gfx::CDevice.


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