Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
Gfx::CDevice Class Referenceabstract

Abstract interface of graphics device. More...

#include <device.h>

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

Public Member Functions

virtual void DebugHook ()=0
 Provides a hook to debug graphics code (implementation-specific)
 
virtual void DebugLights ()=0
 Displays light positions to aid in debuggings.
 
virtual bool Create ()=0
 Initializes the device, setting the initial state.
 
virtual void Destroy ()=0
 Destroys the device, releasing every acquired resource.
 
virtual void BeginScene ()=0
 Begins drawing the 3D scene.
 
virtual void EndScene ()=0
 Ends drawing the 3D scene.
 
virtual void Clear ()=0
 Clears the screen to blank.
 
virtual void SetTransform (TransformType type, const Math::Matrix &matrix)=0
 Sets the transform matrix of given type.
 
virtual void SetMaterial (const Material &material)=0
 Sets the current material.
 
virtual int GetMaxLightCount ()=0
 Returns the maximum number of lights available.
 
virtual void SetLight (int index, const Light &light)=0
 Sets the light at given index.
 
virtual void SetLightEnabled (int index, bool enabled)=0
 Enables/disables the light at given index.
 
virtual Texture CreateTexture (CImage *image, const TextureCreateParams &params)=0
 Creates a texture from image; the image can be safely removed after that.
 
virtual Texture CreateTexture (ImageData *data, const TextureCreateParams &params)=0
 Creates a texture from raw image data; image data can be freed after that.
 
virtual Texture CreateDepthTexture (int width, int height, int depth)=0
 Creates a depth texture with specific dimensions and depth.
 
virtual void DestroyTexture (const Texture &texture)=0
 Deletes a given texture, freeing it from video memory.
 
virtual void DestroyAllTextures ()=0
 Deletes all textures created so far.
 
virtual int GetMaxTextureStageCount ()=0
 Returns the maximum number of multitexture stages.
 
virtual void SetTexture (int index, const Texture &texture)=0
 Sets the texture at given texture stage.
 
virtual void SetTexture (int index, unsigned int textureId)=0
 Sets the texture image by ID at given texture stage.
 
virtual void SetTextureEnabled (int index, bool enabled)=0
 Enables/disables the given texture stage.
 
virtual void SetTextureStageParams (int index, const TextureStageParams &params)=0
 Sets the params for texture stage with given index.
 
virtual void SetTextureStageWrap (int index, TexWrapMode wrapS, TexWrapMode wrapT)=0
 Sets only the texture wrap modes (for faster than thru stage params)
 
virtual void SetTextureCoordGeneration (int index, TextureGenerationParams &params)=0
 Sets the texture coordinate generation mode for given texture unit.
 
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.
 
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)
 
virtual void DrawPrimitive (PrimitiveType type, const VertexCol *vertices, int vertexCount)=0
 Renders primitive composed of vertices with solid color.
 
virtual unsigned int CreateStaticBuffer (PrimitiveType primitiveType, const Vertex *vertices, int vertexCount)=0
 Creates a static buffer composed of given primitives with single texture vertices.
 
virtual unsigned int CreateStaticBuffer (PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount)=0
 Creates a static buffer composed of given primitives with multitexturing.
 
virtual unsigned int CreateStaticBuffer (PrimitiveType primitiveType, const VertexCol *vertices, int vertexCount)=0
 Creates a static buffer composed of given primitives with solid color.
 
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.
 
virtual void UpdateStaticBuffer (unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2 *vertices, int vertexCount)=0
 Updates the static buffer composed of given primitives with multitexturing.
 
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.
 
virtual void DrawStaticBuffer (unsigned int bufferId)=0
 Draws a static buffer.
 
virtual void DestroyStaticBuffer (unsigned int bufferId)=0
 Deletes a static buffer.
 
virtual int ComputeSphereVisibility (const Math::Vector &center, float radius)=0
 
virtual void SetViewport (int x, int y, int width, int height)=0
 Changes rendering viewport.
 
virtual void SetRenderState (RenderState state, bool enabled)=0
 Enables/disables the given render state.
 
virtual void SetColorMask (bool red, bool green, bool blue, bool alpha)=0
 Sets the color mask.
 
virtual void SetDepthTestFunc (CompFunc func)=0
 Sets the function of depth test.
 
virtual void SetDepthBias (float factor, float units)=0
 Sets the depth bias (constant value added to Z-coords)
 
virtual void SetAlphaTestFunc (CompFunc func, float refValue)=0
 Sets the alpha test function and reference value.
 
virtual void SetBlendFunc (BlendFunc srcBlend, BlendFunc dstBlend)=0
 Sets the blending functions for source and destination operations.
 
virtual void SetClearColor (const Color &color)=0
 Sets the clear color.
 
virtual void SetGlobalAmbient (const Color &color)=0
 Sets the global ambient color.
 
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)
 
virtual void SetCullMode (CullMode mode)=0
 Sets the current cull mode.
 
virtual void SetShadeModel (ShadeModel model)=0
 Sets the shade model.
 
virtual void SetShadowColor (float value)=0
 Sets shadow color.
 
virtual void SetFillMode (FillMode mode)=0
 Sets the current fill mode.
 
virtual void InitOffscreenBuffer (int width, int height)=0
 Initializes offscreen buffer.
 
virtual void SetRenderTexture (RenderTarget target, int texture)=0
 Sets render target to texture.
 
virtual void CopyFramebufferToTexture (Texture &texture, int xOffset, int yOffset, int x, int y, int width, int height)=0
 Copies content of framebuffer to texture.
 
virtual void * GetFrameBufferPixels () const =0
 Returns the pixels of the entire screen.
 

Detailed Description

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.

Member Function Documentation

virtual int Gfx::CDevice::ComputeSphereVisibility ( const Math::Vector center,
float  radius 
)
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::CGLDevice, Gfx::CGL21Device, Gfx::CGL33Device, and Gfx::CNullDevice.


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