51 struct FramebufferParams;
108 bool multitexturingSupported =
false;
110 int maxTextureSize = 1024;
114 bool shadowMappingSupported =
false;
116 bool framebufferSupported =
false;
117 int maxRenderbufferSize = 0;
119 bool anisotropySupported =
false;
120 int maxAnisotropy = 1;
122 bool multisamplingSupported =
false;
135 TEXTURE_SECONDARY = 1,
147 TRANSFORM_PROJECTION,
157 RENDER_STATE_LIGHTING,
158 RENDER_STATE_BLENDING,
160 RENDER_STATE_DEPTH_TEST,
161 RENDER_STATE_DEPTH_WRITE,
162 RENDER_STATE_ALPHA_TEST,
163 RENDER_STATE_CULLING,
164 RENDER_STATE_DEPTH_BIAS,
165 RENDER_STATE_SHADOW_MAPPING,
175 RENDER_MODE_INTERFACE,
211 BLEND_SRC_ALPHA_SATURATE
269 PRIMITIVE_LINE_STRIP,
271 PRIMITIVE_TRIANGLE_STRIP
282 FRUSTUM_PLANE_LEFT = 0x01,
283 FRUSTUM_PLANE_RIGHT = 0x02,
284 FRUSTUM_PLANE_TOP = 0x04,
285 FRUSTUM_PLANE_BOTTOM = 0x08,
286 FRUSTUM_PLANE_FRONT = 0x10,
287 FRUSTUM_PLANE_BACK = 0x20,
288 FRUSTUM_PLANE_ALL = FRUSTUM_PLANE_LEFT | FRUSTUM_PLANE_RIGHT |
289 FRUSTUM_PLANE_TOP | FRUSTUM_PLANE_BOTTOM |
290 FRUSTUM_PLANE_FRONT | FRUSTUM_PLANE_BACK
301 RENDER_TARGET_STENCIL
309 virtual void* GetPixelsData() = 0;
326 std::string m_errorMessage;
338 return m_errorMessage;
354 virtual std::string
GetName() = 0;
357 virtual bool Create() = 0;
370 virtual void Clear() = 0;
406 virtual void SetTexture(
int index,
unsigned int textureId) = 0;
418 Color color =
Color(1.0f, 1.0f, 1.0f, 1.0f)) = 0;
421 Color color =
Color(1.0f, 1.0f, 1.0f, 1.0f)) = 0;
427 int first[],
int count[],
int drawCount,
428 Color color =
Color(1.0f, 1.0f, 1.0f, 1.0f)) = 0;
431 int first[],
int count[],
int drawCount,
432 Color color =
Color(1.0f, 1.0f, 1.0f, 1.0f)) = 0;
435 int first[],
int count[],
int drawCount) = 0;
466 virtual void SetViewport(
int x,
int y,
int width,
int height) = 0;
472 virtual void SetColorMask(
bool red,
bool green,
bool blue,
bool alpha) = 0;
478 virtual void SetDepthBias(
float factor,
float units) = 0;
RenderMode
Render modes the graphics device can be in.
Definition: device.h:172
Draw only points.
Definition: device.h:254
void LoadDefault()
Loads the default values.
Definition: device.h:96
virtual void ConfigChanged(const DeviceConfig &newConfig)=0
Changes configuration.
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 bool IsAnisotropySupported()=0
Checks if anisotropy is supported.
virtual void Clear()=0
Clears the screen to blank.
bool noFrame
No window frame (also set with full screen)
Definition: device.h:77
Vertex of a primitive.
Definition: vertex.h:52
virtual void SetShadeModel(ShadeModel model)=0
Sets the shade model.
bool fullScreen
Full screen.
Definition: device.h:71
Vertex with secondary texture coordinates.
Definition: vertex.h:113
virtual void SetLight(int index, const Light &light)=0
Sets the light at given index.
virtual void SetRenderMode(RenderMode mode)=0
Sets current rendering mode.
FogMode
Type of fog calculation function.
Definition: device.h:218
int greenSize
Size of green channel in bits.
Definition: device.h:82
virtual int GetMaxTextureSize()=0
Returns max texture size supported.
4x4 matrix
Definition: matrix.h:65
virtual void DestroyTexture(const Texture &texture)=0
Deletes a given texture, freeing it from video memory.
TexWrapMode
Wrapping mode for texture coords.
Definition: texture.h:99
Math::IntPoint size
Screen size.
Definition: device.h:67
virtual void SetRenderState(RenderState state, bool enabled)=0
Enables/disables the given render state.
This structs contains various capabilities of graphics device.
Definition: device.h:106
virtual void DestroyAllTextures()=0
Deletes all textures created so far.
virtual void UpdateTexture(const Texture &texture, Math::IntPoint offset, ImageData *data, TexImgFormat format)=0
Updates a part of texture from raw image data.
FillMode
Polygon fill mode.
Definition: device.h:251
virtual void SetDepthTestFunc(CompFunc func)=0
Sets the function of depth test.
virtual void SetFillMode(FillMode mode)=0
Sets the current fill mode.
Texture struct and related enums.
CompFunc
Type of function used to compare values.
Definition: device.h:183
virtual void DestroyStaticBuffer(unsigned int bufferId)=0
Deletes a static buffer.
Parameters for a texture unit.
Definition: texture.h:180
Material of a surface.
Definition: material.h:45
int depthSize
Color depth in bits.
Definition: device.h:88
virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius)=0
int bpp
Bits per pixel.
Definition: device.h:69
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 SetAlphaTestFunc(CompFunc func, float refValue)=0
Sets the alpha test function and reference value.
virtual void DeleteFramebuffer(std::string name)=0
Deletes framebuffer.
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 void DebugLights()=0
Displays light positions to aid in debuggings.
virtual Texture CreateDepthTexture(int width, int height, int depth)=0
Creates a depth texture with specific dimensions and depth.
bool resizeable
Resizeable window.
Definition: device.h:73
FrustumPlane
Planes of frustum space.
Definition: device.h:280
TexImgFormat
Format of image data.
Definition: texture.h:42
General config for graphics device.
Definition: device.h:64
Properties of light in 3D scene.
Definition: light.h:54
virtual void SetCullMode(CullMode mode)=0
Sets the current cull mode.
virtual CFramebuffer * GetFramebuffer(std::string name)=0
Returns framebuffer with given name or nullptr if it doesn't exist.
virtual void SetGlobalAmbient(const Color &color)=0
Sets the global ambient color.
virtual bool IsShadowMappingSupported()=0
Checks if shadow mapping is supported.
Color structs and related functions.
virtual CFramebuffer * CreateFramebuffer(std::string name, const FramebufferParams ¶ms)=0
Creates new framebuffer with given name or nullptr if it's not possible.
virtual void Destroy()=0
Destroys the device, releasing every acquired resource.
Namespace for (new) math code.
Definition: device.h:39
Parameters for texture creation.
Definition: texture.h:155
ShadeModel
Shade model used in rendering.
Definition: device.h:241
virtual void EndScene()=0
Ends drawing the 3D scene.
BlendFunc
Type of blending function.
Definition: device.h:199
virtual void SetDepthBias(float factor, float units)=0
Sets the depth bias (constant value added to Z-coords)
int alphaSize
Size of alpha channel in bits.
Definition: device.h:86
int blueSize
Size of blue channel in bits.
Definition: device.h:84
virtual int GetMaxAnisotropyLevel()=0
Returns max anisotropy level supported.
virtual void BeginScene()=0
Begins drawing the 3D scene.
virtual bool IsFramebufferSupported()=0
Checks if framebuffers are supported.
Image loaded from file.
Definition: image.h:54
Cull clockwise faces.
Definition: device.h:232
Contains parameters for new framebuffer.
Definition: framebuffer.h:34
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 SetTransform(TransformType type, const Math::Matrix &matrix)=0
Sets the transform matrix of given type.
PrimitiveType
Type of primitive to render.
Definition: device.h:265
virtual void DrawStaticBuffer(unsigned int bufferId)=0
Draws a static buffer.
Draw full polygons.
Definition: device.h:258
const DeviceCapabilities & GetCapabilities()
Returns device capabilities.
Definition: device.h:342
CullMode
Culling mode for polygons.
Definition: device.h:229
Colored vertex.
Definition: vertex.h:84
virtual void SetMaterial(const Material &material)=0
Sets the current material.
int stencilSize
Stencil depth in bits.
Definition: device.h:90
virtual void SetTextureEnabled(int index, bool enabled)=0
Enables/disables the given texture stage.
int redSize
Size of red channel in bits.
Definition: device.h:80
virtual void SetColorMask(bool red, bool green, bool blue, bool alpha)=0
Sets the color mask.
virtual void SetViewport(int x, int y, int width, int height)=0
Changes rendering viewport.
Namespace for (new) graphics code.
Definition: app.h:49
Implementation-specific image data.
Definition: image.h:41
Cull counter-clockwise faces.
Definition: device.h:234
virtual void DebugHook()=0
Provides a hook to debug graphics code (implementation-specific)
virtual std::string GetName()=0
Returns a name of this device.
RenderState
Render states that can be enabled/disabled.
Definition: device.h:155
virtual bool Create()=0
Initializes the device, setting the initial state.
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 SetShadowColor(float value)=0
Sets shadow color.
virtual void SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wrapT)=0
Sets only the texture wrap modes (for faster than thru stage params)
Info about a texture.
Definition: texture.h:256
DeviceCapabilities m_capabilities
Definition: device.h:330
virtual std::unique_ptr< CFrameBufferPixels > GetFrameBufferPixels() const =0
Returns the pixels of the entire screen.
bool doubleBuf
Double buffering.
Definition: device.h:75
virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms)=0
Sets the params for texture stage with given index.
3D (3x1) vector
Definition: vector.h:53
bool hardwareAccel
Force hardware acceleration (video mode set will fail on lack of hw accel)
Definition: device.h:93
TextureUnit
Texture unit values for binding textures.
Definition: device.h:132
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend)=0
Sets the blending functions for source and destination operations.
2D Point with integer coords
Definition: intpoint.h:41
RGBA color.
Definition: color.h:39
virtual void SetLightEnabled(int index, bool enabled)=0
Enables/disables the light at given index.
virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms)=0
Creates a texture from image; the image can be safely removed after that.
TransformType
Type of transformation in rendering pipeline.
Definition: device.h:143
virtual int GetMaxLightCount()=0
Returns the maximum number of lights available.
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.
virtual void SetClearColor(const Color &color)=0
Sets the clear color.
virtual int GetMaxTextureStageCount()=0
Returns the maximum number of multitexture stages.
Draw only lines.
Definition: device.h:256
virtual void SetTexture(int index, const Texture &texture)=0
Sets the texture at given texture stage.
virtual int GetMaxSamples()=0
Returns max samples supported.
Abstract interface of graphics device.
Definition: device.h:323
Abstract interface of default framebuffer and offscreen framebuffers.
Definition: framebuffer.h:67
std::string GetError()
Returns last error message or empty string.
Definition: device.h:336
RenderTarget
Render targets for rendering to textures.
Definition: device.h:297