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