/*
 * This file is part of Afterwarp Framework (http://afterwarp.io).
 * Copyright (c) 2015 - 2025 Dr. Yuriy Kotsarenko. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 */

// Afterwarp.Types.h
#pragma once

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

/// Defines how individual pixels and their colors are encoded in images and textures.
typedef uint8_t PixelFormat;

/// Pixel format enumeration that can be passed as one of ::PixelFormat values.
enum {
  /// Unknown pixel format.
  PIXEL_FORMAT_UNKNOWN,

  // Unsigned Normalized formats.

  /// 8-bit unsigned normalized format with red channel only.
  PIXEL_FORMAT_R8,

  /// 16-bit format with 8-bit unsigned normalized red and green channels.
  PIXEL_FORMAT_RG8,

  /// 32-bit format with 8-bit unsigned normalized red, green, blue and alpha channels.
  PIXEL_FORMAT_RGBA8,

  /// 8-bit unsigned normalized format with red channel only.
  PIXEL_FORMAT_R16,

  /// 32-bit format with 8-bit unsigned normalized red and green channels.
  PIXEL_FORMAT_RG16,

  /// 64-bit ARGB pixel format with each channel having 16 bits.
  PIXEL_FORMAT_RGBA16,

  // Signed Normalized formats.

  /// 8-bit signed normalized format with red channel only.
  PIXEL_FORMAT_R8S,

  /// 16-bit format with 8-bit signed normalized red and green channels.
  PIXEL_FORMAT_RG8S,

  /// 32-bit format with 8-bit signed normalized red, green, blue and alpha channels.
  PIXEL_FORMAT_RGBA8S,

  /// 16-bit signed normalized format with red channel only.
  PIXEL_FORMAT_R16S,

  /// 32-bit format with 16-bit signed normalized red and green channels.
  PIXEL_FORMAT_RG16S,

  /// 64-bit format with 16-bit signed normalized red, green, blue and alpha channels.
  PIXEL_FORMAT_RGBA16S,

  // Unsigned formats.

  /// 8-bit format with 8-bit unsigned integer red channel.
  PIXEL_FORMAT_R8U,

  /// 16-bit format with 8-bit unsigned integer red and green channels.
  PIXEL_FORMAT_RG8U,

  /// 32-bit format with 8-bit unsigned integer red and green channels.
  PIXEL_FORMAT_RGBA8U,

  /// 16-bit format with 16-bit unsigned integer red channel.
  PIXEL_FORMAT_R16U,

  /// 32-bit format with 16-bit unsigned integer red and green channels.
  PIXEL_FORMAT_RG16U,

  /// 64-bit format with 16-bit unsigned integer red and green channels.
  PIXEL_FORMAT_RGBA16U,

  /// 32-bit format with 32-bit unsigned integer red channel.
  PIXEL_FORMAT_R32U,

  /// 64-bit format with 32-bit unsigned integer red and green channels.
  PIXEL_FORMAT_RG32U,

  /// 128-bit format with 32-bit unsigned integer red and green channels.
  PIXEL_FORMAT_RGBA32U,

  // Signed formats.

  /// 8-bit format with 8-bit signed integer red channel.
  PIXEL_FORMAT_R8I,

  /// 16-bit format with 8-bit signed integer red and green channels.
  PIXEL_FORMAT_RG8I,

  /// 32-bit format with 8-bit signed integer red and green channels.
  PIXEL_FORMAT_RGBA8I,

  /// 16-bit format with 16-bit signed integer red channel.
  PIXEL_FORMAT_R16I,

  /// 32-bit format with 16-bit signed integer red and green channels.
  PIXEL_FORMAT_RG16I,

  /// 64-bit format with 16-bit signed integer red and green channels.
  PIXEL_FORMAT_RGBA16I,

  /// 32-bit format with 32-bit signed integer red channel.
  PIXEL_FORMAT_R32I,

  /// 64-bit format with 32-bit signed integer red and green channels.
  PIXEL_FORMAT_RG32I,

  /// 128-bit format with 16-bit unsigned integer red and green channels.
  PIXEL_FORMAT_RGBA32I,

  // Floating-point formats.

  /// 16-bit floating-point pixel format, which has only one component.
  PIXEL_FORMAT_R16F,

  /// 32-bit floating-point pixel format containing two components with 16 bits each.
  PIXEL_FORMAT_RG16F,

  /// 64-bit floating-point ARGB pixel format with each component having 16 bits.
  PIXEL_FORMAT_RGBA16F,

  /// 32-bit floating-point pixel format, which has only one component.
  PIXEL_FORMAT_R32F,

  /// 64-bit floating-point pixel format containing two components with 32 bits each.
  PIXEL_FORMAT_RG32F,

  /// 128-bit floating-point ARGB pixel format with each component having 32 bits.
  PIXEL_FORMAT_RGBA32F,

  // Specialized floating-point formats.

  /// 32-bit format with 11-bit unsigned floating-point red and green channels, and 10-bit blue channel.
  PIXEL_FORMAT_RG11B10F,

  /// 32-bit format with 9-bit floating-point red, green and blue channels with shared 5-bit exponent.
  PIXEL_FORMAT_RGB9E5F,

  // Specialized color formats.

  /// 32-bit format with 10-bit unsigned normalized red, green and blue channels, and 2-bit alpha-channel.
  PIXEL_FORMAT_RGB10A2,

  /// 32-bit format with 10-bit unsigned integer red, green and blue channels, and 2-bit alpha-channel.
  PIXEL_FORMAT_RGB10A2U,

  /// 32-bit format with 8-bit unsigned normalized red, green and blue channels (8 bits unused).
  PIXEL_FORMAT_RGBX8,

  /// 32-bit format with 8-bit unsigned normalized red, green, blue and alpha channels with sRGB curve.
  PIXEL_FORMAT_RGBA8_SRGB,

  /// 32-bit format with 8-bit unsigned normalized blue, green, red and alpha channels.
  PIXEL_FORMAT_BGRA8,

  /// 32-bit format with 8-bit unsigned normalized blue, green and red channels (8 bits unused).
  PIXEL_FORMAT_BGRX8,

  /// 32-bit format with 8-bit unsigned normalized blue, green, red and alpha channels with sRGB curve.
  PIXEL_FORMAT_BGRA8_SRGB,

  /// 32-bit format with 10-bit unsigned normalized blue, green and red channels, and 2-bit alpha-channel.
  PIXEL_FORMAT_BGR10A2,

  /// 32-bit format with 10-bit unsigned normalized blue, green and red channels (2 bits unused).
  PIXEL_FORMAT_BGR10X2,

  /// 16-bit format with 4-bit unsigned normalized blue, green, red and alpha channels.
  PIXEL_FORMAT_BGRA4,

  /// 16-bit format with 4-bit unsigned normalized blue, green and red channels (4 bits unused).
  PIXEL_FORMAT_BGRX4,

  /// 16-bit format with 5-bit unsigned normalized blue and red, and 6 bits for green channels.
  PIXEL_FORMAT_B5G6R5,

  /// 16-bit format with 5-bit unsigned normalized blue, green and red, 1 bit for alpha channels.
  PIXEL_FORMAT_BGR5A1,

  /// 16-bit format with 5-bit unsigned normalized blue, green and red channels (1 bit unused).
  PIXEL_FORMAT_BGR5X1,

  // Storage formats (not hardware accelerated).

  /// 24-bit format with 8-bit unsigned normalized red, green and blue channels.
  PIXEL_FORMAT_RGB8,

  /// 24-bit format with 8-bit unsigned normalized blue, green and red channels.
  PIXEL_FORMAT_BGR8,

  // Luminance and alpha formats that might require channel swizzling in shader.

  /// 8-bit alpha-channel pixel format.
  PIXEL_FORMAT_A8,

  /// 8-bit luminance pixel format.
  PIXEL_FORMAT_L8,

  /// 16-bit luminance pixel format.
  PIXEL_FORMAT_L16,

  /// 8-bit luminance/alpha pixel format with 4 bits per channel.
  PIXEL_FORMAT_LA4,

  /// 16-bit luminance/alpha pixel format with 8 bits per channel.
  PIXEL_FORMAT_LA8,

  // Legacy pallette formats.

  /// 8-bit palette indexed format.
  PIXEL_FORMAT_I8,

  // Compressed formats.

  /// Compressed format with red channel only.
  PIXEL_FORMAT_R_BC,

  /// Compressed format with red and green channels.
  PIXEL_FORMAT_RG_BC,

  /// Compressed format with red, green and blue channels.
  PIXEL_FORMAT_RGB_BC,

  /// Compressed format with red, green, blue and alpha channels.
  PIXEL_FORMAT_RGBA_BC,

  /// Compressed format with red, green and blue channels with sRGB curve.
  PIXEL_FORMAT_RGB_BC_SRGB,

  /// Compressed format with red, green and blue channels with sRGB curve, and an alpha-channel.
  PIXEL_FORMAT_RGBA_BC_SRGB,

  // Depth/stencil formats.

  /// Depth/stencil format with 16-bit (unsigned normalized) depth values and no storage for stencil.
  PIXEL_FORMAT_D16,

  /// Depth/stencil format with 24-bit (unsigned normalized) depth values and 8 bits for stencil.
  PIXEL_FORMAT_D24S8,

  /// Depth/stencil format with 32-bit (floating-point) depth values and no storage for stencil.
  PIXEL_FORMAT_D32F,

  /// Depth/stencil format with 32-bit (floating-point) depth values and 8 bits for stencil.
  PIXEL_FORMAT_D32S8F};

/// Defines how alpha-channel should be handled in the loaded image.
typedef uint8_t AlphaFormatRequest;

/// Alpha-channel format request enumeration that can be passed as one of ::AlphaFormatRequest values.
enum {
  /// Alpha-channel can be handled either way.
  ALPHA_FORMAT_REQUEST_DONT_CARE,

  /// Alpha-channel in the image should not be premultiplied. Under normal circumstances, this is the
  /// recommended approach as it preserves RGB color information in its original form. However, when using
  /// mipmapping for images that have alpha-channel, Premultiplied gives more accurate results.
  ALPHA_FORMAT_REQUEST_NON_PREMULTIPLIED,

  /// Alpha-channel in the image should be premultiplied. Under normal circumstances, this is not
  /// recommended as the image would lose information after RGB components are premultiplied by alpha (and
  /// for smaller alpha values, less information is preserved). However, when using mipmapping for images
  /// that have alpha-channel, this gives more accurate results.
  ALPHA_FORMAT_REQUEST_PREMULTIPLIED};

// Device enumerations.

enum {
  /// Direct3D 9 without depth texture support.
  LEGACY_BIT_MISSING_DEPTH_TEXTURE = 0x00000001,

  /// Direct3D 9 with Nvidia Geforce 6/7 series use RAWZ depth buffer format.
  LEGACY_BIT_DEPTH_FORMAT_RAWZ = 0x00000002,

  /// Direct3D 9 with capability bits set to support different bit-depths in MRT stack.
  LEGACY_BIT_DIFFERENT_BITDEPTH_MRT = 0x00000004,
};

/// Type of surface layer that should be cleared.
enum {
  /// Color buffer.
  DEVICE_CLEAR_LAYER_COLOR = 0x01,

  /// Depth buffer.
  DEVICE_CLEAR_LAYER_DEPTH = 0x02,

  /// Stencil buffer.
  DEVICE_CLEAR_LAYER_STENCIL = 0x04};

/// Device attributes that define its behavior.
enum {
  /// Debug-type context that helps to resolve issues in rendering code.
  DEVICE_ATTRIBUTE_DEBUG = 0x01,

  /// Software-based solution is used for rendering instead of GPU acceleration.
  DEVICE_ATTRIBUTE_SOFTWARE = 0x02,

  /// Compatibility device that is meant for older technologies.
  DEVICE_ATTRIBUTE_LEGACY = 0x04,

  /// Device should only enable extensions determined by their appropriate level
  /// (deviceAttributeExtensions), even if a higher core version is available that inherently supports
  /// higher level extensions.
  DEVICE_ATTRIBUTE_LIMITED_EXTENSIONS = 0x80};

/// Device behavior attributes that define the rendering code path.
enum {
  /// Graphics hardware supports executing fragment shader per each MSAA sample.
  DEVICE_BEHAVIOR_PER_SAMPLE_SHADING = 0x00000001,

  /// 3D clip space uses negative values for depth in range of [-1, 1] instead of [0, 1].
  /// This typically occurs on OpenGL (ES) backend that do not support clip control functions.
  DEVICE_BEHAVIOR_DEPTH_CLIP_NEGATIVE = 0x00000002,

  /// Compute shader support is available.
  DEVICE_BEHAVIOR_COMPUTE = 0x00000004,

  /// Tessellation shader support is available.
  DEVICE_BEHAVIOR_TESSELLATION = 0x00000008,

  /// Direct3D 11: Variable Rate Refresh (VRR) display support is available.
  DEVICE_BEHAVIOR_VARIABLE_RATE_REFRESH = 0x00000100,

  /// OpenGL: ARB_post_depth_coverage, Direct3D 11: PostZCoverageEnable through NvAPI.
  DEVICE_BEHAVIOR_POST_DEPTH_COVERAGE = 0x00000200,

  /// OpenGL / Intel HD Graphics bug workaround: always unbind buffers before updating their contents.
  DEVICE_BEHAVIOR_FORCE_BUFFER_UNBIND = 0x00001000,

  /// Direct3D 11 / Parallels bug workaround: clear depth buffer with value lower than one.
  DEVICE_BEHAVIOR_DEPTH_CLEAR_BAD_PRECISION = 0x00002000,

  /// Direct3D 11 / VMware bug workaround: avoid signed normalized integer formats.
  DEVICE_BEHAVIOR_SIGNED_NORM_INT_FORMAT_BUGGED = 0x00004000
};

/// Device memory barrier cumulative bits.
enum {
  /// Shader data sourced from buffers after the barrier will reflect data written by shaders prior
  /// to the barrier.
  DEVICE_BARRIER_SHADER_BUFFER = 0x00000001,

  /// Texture fetches from shaders, including fetches from typed buffers, after the barrier will reflect
  /// data written by shaders prior to the barrier.
  DEVICE_BARRIER_TEXTURE_FETCH = 0x00000002,

  /// Memory accesses using shader image load, store, and atomic built-in functions issued after the
  /// barrier will reflect data written by shaders prior to the barrier. Additionally, image stores and
  /// atomics issued after the barrier will not execute until all memory accesses (e.g., loads, stores,
  /// texture fetches, vertex fetches) initiated prior to the barrier complete.
  DEVICE_BARRIER_SHADER_IMAGE_ACCESS = 0x00000004,

  /// Writes to a texture by calling Update and Copy functions, and reads via Retrieve after the barrier
  /// will reflect data written by shaders prior to the barrier. Additionally, texture writes from these
  /// commands issued after the barrier will not execute until all shader writes initiated prior to the
  /// barrier complete.
  DEVICE_BARRIER_TEXTURE_UPDATE = 0x00000008,

  /// Buffer reads or writes bu calling Update and Copy functions after the barrier will reflect data
  /// written by shaders prior to the barrier. Additionally, writes via these commands issued after the
  /// barrier will wait on the completion of any shader writes to the same memory initiated prior
  /// to the barrier.
  DEVICE_BARRIER_BUFFER_UPDATE = 0x00000010,

  /// Reads and writes to drawable textures after the barrier will reflect data written by shaders prior
  /// to the barrier. Additionally, framebuffer writes issued after the barrier will wait on the
  /// completion of all shader writes issued prior to the barrier.
  DEVICE_BARRIER_DRAWABLES = 0x00000020,

  /// Accesses to atomic counters after the barrier will reflect writes prior to the barrier.
  DEVICE_BARRIER_ATOMIC_COUNTER = 0x00000040,

  /// Accesses to structured buffers after the barrier will reflect writes prior to the barrier.
  DEVICE_BARRIER_STRUCTURED = 0x00000080
};

/// Type of graphics technology used in application.
typedef uint8_t DeviceTechnology;

/// Graphics device technology enumeration that can be passed as one of ::DeviceTechnology values.
enum {
  /// The technology has not yet been established.
  DEVICE_TECHNOLOGY_UNKNOWN,

  /// Microsoft Direct3D technology.
  DEVICE_TECHNOLOGY_DIRECT3D,

  /// OpenGL by Khronos Group.
  DEVICE_TECHNOLOGY_OPENGL,

  /// OpenGL ES by Khronos Group.
  DEVICE_TECHNOLOGY_OPENGL_ES,

  /// Vulkan API by Khronos Group.
  DEVICE_TECHNOLOGY_VULKAN,

  /// Metal API by Apple.
  DEVICE_TECHNOLOGY_METAL,

  /// WebGL by Khronos Group.
  DEVICE_TECHNOLOGY_WEBGL,

  /// Software rasterizer.
  DEVICE_TECHNOLOGY_SOFTWARE,

  /// Private proprietary technology.
  DEVICE_TECHNOLOGY_PROPRIETARY};

/// Type of OS platform the application is running on.
typedef uint8_t DevicePlatform;

/// Graphics device platform enumeration that can be passed as one of ::DevicePlatform values.
enum
{
  /// The platform could not be properly identified.
  DEVICE_PLATFORM_UNKNOWN,

  /// Microsoft Windows platform.
  DEVICE_PLATFORM_WINDOWS,

  /// Linux platform.
  DEVICE_PLATFORM_LINUX,

  /// Generic Unix platform.
  DEVICE_PLATFORM_UNIX,

  /// Apple OS X platform.
  DEVICE_PLATFORM_OSX,

  /// Apple iOS platform.
  DEVICE_PLATFORM_IOS,

  /// Google Android platform.
  DEVICE_PLATFORM_ANDROID
};

/// State flags that can be combined together to form a rendering operation state.
enum {
  /// Depth testing should be performed. If this state is not present, depth writing is also disabled.
  DEVICE_STATE_DEPTH_TEST = 0x0001,

  /// Depth values should be written to Depth Buffer.
  DEVICE_STATE_DEPTH_WRITE = 0x0002,

  /// Stencil testing should be performed.
  /// If this state is not present, no other stencil operation will occur.
  DEVICE_STATE_STENCIL_TEST = 0x0004,

  /// Geometry should be clipped by the corresponding depth limits.
  DEVICE_STATE_DEPTH_CLIP = 0x0008,

  /// Geometry should be clipped by the corresponding scissor rectangles.
  DEVICE_STATE_SCISSOR_CLIP = 0x0010,

  /// Primitives should be rendered in a wireframe mode.
  DEVICE_STATE_WIREFRAME = 0x0020,

  /// Triangles having vertices in clockwise order would be culled. If this flag is not set, then triangles
  /// having vertices in counter-clockwise order would be culled.
  DEVICE_STATE_CULL_CLOCKWISE = 0x0040,

  /// Geometry should be rendered with multisampling.
  DEVICE_STATE_MULTISAMPLING = 0x0080,

  /// Standard 3D lines should be rendered with antialiasing.
  DEVICE_STATE_LINE_ANTIALIAS = 0x0100,

  /// Writing to color buffer should be performed.
  DEVICE_STATE_COLOR_WRITE = 0x0200,

  /// Blending operation should be performed.
  DEVICE_STATE_BLEND_ENABLE = 0x0400,

  /// Alpha channel should be converted to coverage samples.
  DEVICE_STATE_ALPHA_TO_COVERAGE = 0x0800,

  /// Cube Maps should be sampled from neighbor faces at seams.
  DEVICE_STATE_CUBE_MAP_SEAMLESS = 0x1000,

  /// Enables fragment shader execution for each individual MSAA sample.
  /// This has only effect on OpenGL (ES) based implementations.
  DEVICE_STATE_PER_SAMPLE_SHADING = 0x2000
};

/// Type of triangle face that should have processing applied to.
typedef uint8_t TriangleFace;

/// Face processing type enumeration that can be passed as one of ::TriangleFace values.
enum {
  /// Neither back nor front faces should be processed.
  TRIANGLE_FACE_NONE,

  /// Back faces should be processed.
  TRIANGLE_FACE_BACK,

  /// Front faces should be processed.
  TRIANGLE_FACE_FRONT,

  /// Both back and front faces should be processed.
  TRIANGLE_FACE_BOTH};

/// Function that defines how depth/stencil operands should be compared.
typedef uint8_t ComparisonFunc;

/// Comparison function enumeration that can be passed as one of ::ComparisonFunc values.
enum {
  /// Comparison is always true.
  COMPARISON_FUNC_ALWAYS,

  /// Comparison results true when source is less than destination.
  COMPARISON_FUNC_LESS,

  /// Comparison results true when source is less than or equal to destination.
  COMPARISON_FUNC_LESS_EQUAL,

  /// Comparison results true when source is greater than destination.
  COMPARISON_FUNC_GREATER,

  /// Comparison results true when source is greater than or equal to destination.
  COMPARISON_FUNC_GREATER_EQUAL,

  /// Comparison results true when source equals to destination.
  COMPARISON_FUNC_EQUAL,

  /// Comparison results true when source is not equal to destination.
  COMPARISON_FUNC_NOT_EQUAL,

  /// Comparison is always false.
  COMPARISON_FUNC_NEVER};

/// Operation that should be performed on stencil value.
typedef uint8_t StencilOp;

/// Stencil operation enumeration that can be passed as one of ::StencilOp values.
enum {
  /// Preserve destination value.
  STENCIL_OP_KEEP,

  /// Set destination value to zero.
  STENCIL_OP_ZERO,

  /// Replace destination value with the source one.
  STENCIL_OP_REPLACE,

  /// Invert the destination value.
  STENCIL_OP_INVERT,

  /// Increment the destination value by the source one and clamp, if necessary.
  STENCIL_OP_INCREMENT,

  /// Decrement the destination value by the source one and clamp, if necessary.
  STENCIL_OP_DECREMENT,

  /// Increment the destination value by the source one with wrap-around.
  STENCIL_OP_INCREMENT_WARP,

  /// Decrement the destination value by the source one with wrap-around.
  STENCIL_OP_DECREMENT_WARP};

/// Factor that determines how alpha-blending operand is considered.
typedef uint8_t BlendFactor;

/// Blending factor enumeration that can be passed as one of ::BlendFactor values.
enum {
  /// Blending factor is a constant that equals to one.
  BLEND_FACTOR_ONE,

  /// Blending factor is a constant that equals to zero.
  BLEND_FACTOR_ZERO,

  /// Source color is used as a blending factor.
  BLEND_FACTOR_SOURCE_COLOR,

  /// One minus source color is used as a blending factor.
  BLEND_FACTOR_INV_SOURCE_COLOR,

  /// Source alpha value is used as a blending factor.
  BLEND_FACTOR_SOURCE_ALPHA,

  /// One minus source alpha value is used as a blending factor.
  BLEND_FACTOR_INV_SOURCE_ALPHA,

  /// Destination color is used as a blending factor.
  BLEND_FACTOR_DEST_COLOR,

  /// One minus destination color is used as a blending factor.
  BLEND_FACTOR_INV_DEST_COLOR,

  /// Destination alpha value is used as a blending factor.
  BLEND_FACTOR_DEST_ALPHA,

  /// One minus destination alpha value is used as a blending factor.
  BLEND_FACTOR_INV_DEST_ALPHA,

  /// Blending factor is calculated as min(SrcAlpha, InvDestAlpha).
  BLEND_FACTOR_SOURCE_ALPHA_SAT,

  /// Blending factor is a user-defined color constant.
  BLEND_FACTOR_CONSTANT_COLOR,

  /// Blending factor is one minus user-defined color constant.
  BLEND_FACTOR_INV_CONSTANT_COLOR,

  /// Blending factor is an alpha value from user-defined color constant.
  BLEND_FACTOR_CONSTANT_ALPHA,

  /// Blending factor is one minus alpha value from user-defined color constant.
  BLEND_FACTOR_INV_CONSTANT_ALPHA,

  /// Source color (from 2nd pixel shader output) is used as a blending factor.
  BLEND_FACTOR_SOURCE_COLOR_1,

  /// One minus source color (from 2nd pixel shader output) is used as a blending factor.
  BLEND_FACTOR_INV_SOURCE_COLOR_1,

  /// Source alpha value (from 2nd pixel shader output) is used as a blending factor.
  BLEND_FACTOR_SOURCE_ALPHA_1,

  /// One minus source alpha (from 2nd pixel shader output) value is used as a blending factor.
  BLEND_FACTOR_INV_SOURCE_ALPHA_1};

/// Operation that should be performed between two blending operands.
typedef uint8_t BlendOp;

/// Blending operation enumeration that can be passed as one of ::BlendOp values.
enum {
  /// Add source and destination values.
  BLEND_OP_ADD,

  /// Subtract source value from destination value.
  BLEND_OP_SUBTRACT,

  /// Subtract destination value from source value.
  BLEND_OP_INV_SUBTRACT,

  /// Calculate minimum between source and destination values.
  BLEND_OP_MINIMUM,

  /// Calculate maximum between source and destination values.
  BLEND_OP_MAXIMUM};

// Buffer enumerations.

/// Type of data that a generic buffer contains.
typedef uint8_t BufferDataType;

/// Buffer data type enumeration that can be passed as one of ::BufferDataType values.
enum {
  /// Vertex information is stored in the buffer (Vertex Buffer).
  BUFFER_DATA_TYPE_VERTEX,

  /// Index information is stored in the buffer (Index Buffer).
  BUFFER_DATA_TYPE_INDEX,

  /// Shader constant information is stored in the buffer (Constant Buffer).
  BUFFER_DATA_TYPE_CONSTANT,

  /// Read-only shader buffer contained typed information (TBO / Buffer).
  BUFFER_DATA_TYPE_TYPED,

  /// Read-only shader buffer contained typed information (TBO / RWBuffer).
  BUFFER_DATA_TYPE_RW_TYPED,

  /// Read-only shader buffer containing structured information (SSBO / StructuredBuffer).
  BUFFER_DATA_TYPE_STRUCTURED,

  /// Read/write shader buffer containing structured information (SSBO / RWStructuredBuffer).
  BUFFER_DATA_TYPE_RW_STRUCTURED};

/// Type of access that is performed with mesh buffer.
typedef uint8_t BufferAccessType;

/// Buffer access type enumeration that can be passed as one of ::BufferAccessType values.
enum {
  /// The contents of buffer are updated occasionally.
  BUFFER_ACCESS_TYPE_DEFAULT,

  /// The contents of buffer are defined during construction and typically remain unchanged.
  BUFFER_ACCESS_TYPE_STATIC,

  /// The contents of buffer are changed very frequently.
  BUFFER_ACCESS_TYPE_DYNAMIC,

  /// The contents of the buffer are used by GPU exclusively.
  BUFFER_ACCESS_TYPE_COMPUTE,

  /// The buffer is used for asynchronous transfers from GPU back to CPU.
  BUFFER_ACCESS_TYPE_STAGING};

// Program enumerations.

/// Rendering primitive topology.
typedef uint8_t PrimitiveTopology;

/// Primitive topology enumeration that can be passed as one of ::PrimitiveTopology values.
enum {
  /// Unknown (undefined) topology.
  PRIMITIVE_TOPOLOGY_UNKNOWN,

  /// Points or point lists.
  PRIMITIVE_TOPOLOGY_POINTS,

  /// Lines or line lists.
  PRIMITIVE_TOPOLOGY_LINES,

  /// Line strips.
  PRIMITIVE_TOPOLOGY_LINE_STRIP,

  /// Triangles or triangle lists.
  PRIMITIVE_TOPOLOGY_TRIANGLES,

  /// Triangle strips.
  PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,

  /// Lines or line lists with adjacency information.
  PRIMITIVE_TOPOLOGY_LINES_ADJACENCY,

  /// Line strips with adjacency information.
  PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJACENCY,

  /// Triangles or triangle lists with adjacency information.
  PRIMITIVE_TOPOLOGY_TRIANGLES_ADJACENCY,

  /// Triangle strips with adjacency information.
  PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJACENCY};

/// Format in which a single value of the given element is represented.
typedef uint16_t ElementFormat;

/// Element format enumeration that can be passed as one of ::ElementFormat values.
enum {
  /// Undefined element format (VertexElement::count will define number of actual bytes).
  ELEMENT_FORMAT_UNDEFINED,

  /// 32-bit floating-point format.
  ELEMENT_FORMAT_FLOAT,

  /// 16-bit floating-point format.
  ELEMENT_FORMAT_HALF_FLOAT,

  /// 64-bit floating-point format.
  ELEMENT_FORMAT_DOUBLE,

  /// 32-bit signed integer format.
  ELEMENT_FORMAT_INT,

  /// 32-bit unsigned integer format.
  ELEMENT_FORMAT_UNSIGNED_INT,

  /// 16-bit signed integer format.
  ELEMENT_FORMAT_SHORT,

  /// 16-bit unsigned integer format.
  ELEMENT_FORMAT_UNSIGNED_SHORT,

  /// 8-bit signed integer format.
  ELEMENT_FORMAT_BYTE,

  /// 8-bit unsigned integer format.
  ELEMENT_FORMAT_UNSIGNED_BYTE,

  /// 32-bit storage for two 11-bit and one 10-bit floating-point numbers.
  /// The number of elements for this format must always be set to three (3).
  ELEMENT_FORMAT_FLOAT_11_11_10};

/// Type of shader in graphics rendering pipeline.
typedef uint8_t ShaderType;

/// Shader type enumeration that can be passed as one of ::ShaderType values.
enum {
  /// Undefined or unknown shader.
  SHADER_TYPE_UNDEFINED,

  /// Fragment (pixel) shader.
  SHADER_TYPE_FRAGMENT,

  /// Vertex shader.
  SHADER_TYPE_VERTEX,

  /// Geometry shader.
  SHADER_TYPE_GEOMETRY,

  /// Compute shader.
  SHADER_TYPE_COMPUTE,

  /// Hull shader.
  SHADER_TYPE_HULL,

  /// Domain shader.
  SHADER_TYPE_DOMAIN};

/// Type that characterizes shader element.
typedef uint8_t ShaderElement;

/// Shader element enumeration that can be passed as one of ::ShaderElement values.
enum {
  /// Undefined element type.
  SHADER_ELEMENT_UNDEFINED,

  /// Element is a texture.
  SHADER_ELEMENT_TEXTURE,

  /// Element is a constant buffer (uniform buffer object).
  SHADER_ELEMENT_CONSTANT_BUFFER,

  /// Element is a typed buffer (TBO / Buffer). Shares channels with textures.
  SHADER_ELEMENT_TYPED_BUFFER,

  /// Element is a typed buffer (TBO / RWBuffer). Shares channels with textures.
  /// For writing under OpenGL, this is bound as ImageBuffer (not TBO).
  /// For writing under Direct3D, this is bound as an Unordered Access View (UAV).
  SHADER_ELEMENT_RW_TYPED_BUFFER,

  /// Element is a compute shader buffer (SSBO / StructuredBuffer).
  SHADER_ELEMENT_STRUCTURED_BUFFER,

  /// Element is a compute shader buffer (SSBO / RWStructuredBuffer).
  SHADER_ELEMENT_RW_STRUCTURED_BUFFER};

enum
{
  /// Special channel number that corresponds to index buffer.
  VERTEX_CHANNEL_INDEX_BUFFER = 0x7FFFFFFF,

  /// Special channel number that corresponds to an empty line.
  VERTEX_CHANNEL_NO_BUFFERS = 0x7FFFFFFE,

  /// Special shader's element value (channel or index) that corresponds to an undefined (unset) location.
  SHADER_INDEX_UNDEFINED = 0x7FFFFFFF,

  /// Special bit added to vertex element channel indicating that the integer values are normalized.
  VERTEX_CHANNEL_NORMALIZED = 0x80000000
};

// Compute enumerations.

/// Compute program texture access type.
typedef uint8_t ComputeTextureAccess;

/// Compute program texture access type that can be passed as one of ::ComputeTextureAccess values.
enum {
  /// Texture will be read from, no writes allowed.
  COMPUTE_TEXTURE_ACCESS_READ,

  /// Texture will only be written to, no reads allowed.
  COMPUTE_TEXTURE_ACCESS_WRITE,

  /// Texture will be read from and written to.
  COMPUTE_TEXTURE_ACCESS_READ_WRITE
};

// Sampler enumerations.

/// Filtering mode that defines how colors are sampled from the texture.
typedef uint8_t TextureFilter;

/// Texture filtering enumeration that can be passed as one of ::TextureFilter values.
enum {
  /// No filtering is performed (applies only to mipmap filter, in which case it gets disabled).
  TEXTURE_FILTER_NONE,

  /// Nearest integer sample filtering.
  TEXTURE_FILTER_NEAREST,

  /// Linear interpolation filtering.
  TEXTURE_FILTER_LINEAR,

  /// Linear anisotropic filtering.
  TEXTURE_FILTER_ANISOTROPIC};

/// Addressing mode that defines how texture coordinates outside of [0, 1] range are treated.
typedef uint8_t TextureAddress;

/// Texture addressing enumeration that can be passed as one of ::TextureAddress values.
enum {
  /// Texture coordinates are wrapped; that is, only fractional part is considered.
  TEXTURE_ADDRESS_WRAP,

  /// Texture coordinates are clamped to stay within [0, 1] range.
  TEXTURE_ADDRESS_CLAMP,

  /// Texture coordinates are mirrored in each odd cycle (e.g. from 1 to 2, from 3 to 4 and so on).
  TEXTURE_ADDRESS_MIRROR,

  /// Texture coordinates are mirrored for one cycle and then clamped.
  TEXTURE_ADDRESS_MIRROR_ONCE,

  /// When texture coordinates are outside of [0, 1] range, a separate border color will be used instead.
  TEXTURE_ADDRESS_BORDER};

// Texture enumerations.

/// Attribute that defines special behavior and/or unique characteristics of the texture.
enum {
  /// Texture has a full mipmap surface chain attached. MipMapping technique can improve visual quality
  /// when the texture is drawn in different sizes, especially in smaller ones.
  TEXTURE_ATTRIBUTE_MIPMAPPING = 0x01,

  /// Texture contains a special type of surface that can be rendered to. In other words, the texture can
  /// be considered a render target (Direct3D) or render buffer object (OpenGL).
  TEXTURE_ATTRIBUTE_DRAWABLE = 0x02,

  /// Texture is meant for frequent write-only access. Dynamic textures cannot ontain mipmap surface chain
  /// attached and cannot be drawable either.
  TEXTURE_ATTRIBUTE_DYNAMIC = 0x04,

  /// Texture has its color components premultiplied by alpha-channel. This implies permanent loss of
  /// information as the components are multiplied by alpha value and stored (so, for example, pixels with
  /// alpha value of zero permanently lose all color information), however this can improve visual quality on
  /// mipmaps with translucent pixels. The parameter is merely a hint for rendering system, it does not change
  /// the actual pixels - an action that should be performed separately.
  TEXTURE_ATTRIBUTE_PREMULTIPLIED_ALPHA = 0x08,

  /// Texture will be used for Compute shader access (Direct3D-only, makes texture UAV-capable).
  TEXTURE_COMPUTE = 0x40,

  /// Texture is of "scratch" type. That is, it uses system memory for storage and, when used in context
  /// of Direct3D and/or OpenGL, it cannot be used directly.
  TEXTURE_SCRATCH = 0x8000};

/// Type of texture that defines how it is composed.
typedef uint8_t TextureType;

/// Texture type enumeration that can be passed as one of ::TextureType values.
enum {
  /// Standard 2D texture surface.
  TEXTURE_TYPE_SURFACE,

  /// Cube Map consisting of 6 individual 2D faces.
  TEXTURE_TYPE_CUBE_MAP,

  /// Layered 3D volume texture.
  TEXTURE_TYPE_VOLUME};

// Canvas enumerations.

/// Blending effect that defines how primitives are rendered on drawing surface.
typedef uint8_t BlendingEffect;

/// Blending effect enumeration that can be passed as one of ::BlendingEffect values.
enum {
  /// Undefined blending effect. Canvas does not change blending parameters configured in the device
  /// context and uses whatever configuration is currently active.
  BLENDING_EFFECT_UNDEFINED = 0,

  /// "Normal" blending effect: Cd = (Cs * As) + (Cd * (1 - As).
  BLENDING_EFFECT_NORMAL,

  /// "Shadow drawing" effect: Cd = Cd * (1 - As).
  BLENDING_EFFECT_SHADOW,

  /// Additive blending effect: Cd = (Cs * As) + Cd.
  BLENDING_EFFECT_ADD,

  /// Subtractive blending effect: Cd = (Cs * As) - Cd.
  BLENDING_EFFECT_SUBTRACT,

  /// Multiplication blending effect: Cd = Cs * Cd.
  BLENDING_EFFECT_MULTIPLY,

  /// Inverse multiplication effect: Cd = (1 - Cs) * Cd.
  BLENDING_EFFECT_INVERSE_MULTIPLY,

  /// Source color blending effect: Cd = (Cs * Cs) + (Cd * (1 - Cs)).
  BLENDING_EFFECT_SOURCE_COLOR,

  /// Source color additive blending effect: Cd = (Cs * Cs) + Cd.
  BLENDING_EFFECT_SOURCE_COLOR_ADD,

  /// Alpha-blending disabled, drawing is just a copy operation.
  BLENDING_EFFECT_COPY = 254,

  /// Custom alpha-blending as set up through device directly.
  BLENDING_EFFECT_CUSTOM = 255};

/// One of possible defined context states that can be pre-configured by the canvas.
typedef uint8_t CanvasContextState;

/// Canvas context state enumeration that can be passed as one of ::CanvasContextState values.
enum {
  /// Geometric shapes and images rendered in a flat 2D scene.
  CANVAS_CONTEXT_STATE_FLAT_SCENE,

  /// Text rendered in a flat 2D scene.
  CANVAS_CONTEXT_STATE_FLAT_TEXT,

  /// Geometric shapes, images and text rendered in a 3D surface projection.
  CANVAS_CONTEXT_STATE_PROJECTED,

  /// Undefined context state.
  CANVAS_CONTEXT_STATE_UNDEFINED = UINT8_MAX};

/// Canvas attribute flags that can be combined together.
enum {
  /// Transform 2D coordinates as 3D vectors (with Z = 0) by the appropriate 4x4 matrix as if drawing to
  /// an arbitrary plane in 3D.
  CANVAS_ATTRIBUTE_PROJECTED = 0x01,

  /// Preprocess the texture by using its alpha-channel as a signed distance field.
  CANVAS_ATTRIBUTE_SDF = 0x02,

  /// Include outline when rendering signed distance field (implies \c attributeSDF).
  CANVAS_ATTRIBUTE_OUTLINE_SDF = 0x04,

  /// Sample texture using bicubic interpolation for higher-quality results.
  CANVAS_ATTRIBUTE_CUBIC = 0x08,

  /// Adjusts texture color using YCH instead of RGB (only works for textures).
  CANVAS_ATTRIBUTE_COLOR_ADJUST = 0x10,

  /// Applies 3x3 world transformation matrix to non-holographic primitives.
  CANVAS_ATTRIBUTE_TRANSFORM = 0x20};

/// Type of super-sampling used for rendering Signed Distance Field (SDF).
typedef uint8_t SuperSampleSDF;

/// Super-sample SDF type enumeration that can be passed as one of ::SuperSampleSDF values.
enum {
  /// Non-supersampled rendering (for low-performance systems). Note that if outline is enabled, its color
  /// will be calculated using simplified scheme, where luma is calculated as usual, chroma is calculated
  /// in a simple fashion and hue is not affected.
  SUPER_SAMPLE_SDF_NO_SUPER_SAMPLE,

  /// 4x super-sampled rendering.
  SUPER_SAMPLE_SDF_SUPER_SAMPLE_4X,

  /// 16x super-sampled rendering.
  SUPER_SAMPLE_SDF_SUPER_SAMPLE_16X};

/// Image Region modifier flags that can be combined together.
enum
{
  /// Flip region vertically.
  IMAGE_REGION_FLIP = 0x01,

  /// Mirror region horizontally.
  IMAGE_REGION_MIRROR = 0x02,

  /// Rotate region by 90 degrees clockwise.
  IMAGE_REGION_ROTATE = 0x04
};

// Vector graphics enumerations.

/// Type of joint for connecting path lines.
typedef uint8_t PathJoint;

/// Path joint enumeration that can be passed as one of ::PathJoint values.
enum {
  /// No joint is produced, lines on each joint end with a butt cap.
  PATH_JOINT_NONE,

  /// Simple interpolated joint that does not guarantee correct line width on sharp corners.
  PATH_JOINT_SIMPLE,

  /// Miter joint with angular corners.
  PATH_JOINT_MITER,

  /// Beveled joint.
  PATH_JOINT_BEVEL,

  /// Round joint.
  PATH_JOINT_ROUND,

  /// Miter joint unless the miter would extend beyond its limit multiplied by half thickness.
  PATH_JOINT_MITER_BEVEL};

/// Type of caps that covers line end points.
typedef uint8_t LineCaps;

/// Line caps enumeration that can be passed as one of ::LineCaps values.
enum {
  /// Cap that starts and ends exactly at the center of end points.
  LINE_CAPS_BUTT,

  /// Cap that extends by half thickness after the end points.
  LINE_CAPS_SQUARE,

  /// Round cap with a radius equal to half thickness with center being each line end point.
  LINE_CAPS_ROUND};

/// Shape of point primitive.
typedef uint8_t PointShape;

/// Point shape enumeration that can be passed as one of ::PointShape values.
enum {
  /// Square point.
  POINT_SHAPE_SQUARE,

  /// Round point.
  POINT_SHAPE_ROUND,

  /// Equilateral triangle point.
  POINT_SHAPE_TRIANGLE,

  /// 5-sided star point.
  POINT_SHAPE_STAR,

  /// Cross point.
  POINT_SHAPE_CROSS};

// Font enumerations.

/// Weight of the font (apparent thickness of glyphs).
typedef uint8_t FontWeight;

/// Font weight enumeration that can be passed as one of ::FontWeight values.
enum {
  /// Letters should appear as thin as technically possible.
  FONT_WEIGHT_THIN,

  /// Letters should appear very thin.
  FONT_WEIGHT_EXTRA_LIGHT,

  /// Letters should appear even thinner.
  FONT_WEIGHT_LIGHT,

  /// Letters should have slightly lighter thickness.
  FONT_WEIGHT_SEMI_LIGHT,

  /// Letters should appear normal (default thickness).
  FONT_WEIGHT_NORMAL,

  /// Letters should have medium thicness, which is slightly above than normal.
  FONT_WEIGHT_MEDIUM,

  /// Letters should appear semi-bold.
  FONT_WEIGHT_SEMI_BOLD,

  /// Letters should appear as bold.
  FONT_WEIGHT_BOLD,

  /// Letters should appear as extra thick.
  FONT_WEIGHT_EXTRA_BOLD,

  /// Letters should appear very thick.
  FONT_WEIGHT_HEAVY,

  /// Letters should appear as thick as technically possible.
  FONT_WEIGHT_EXTRA_HEAVY};

/// Relative width of the font.
typedef uint8_t FontStretch;

/// Font stretch enumeration that can be passed as one of ::FontStretch values.
enum {
  /// Ultra-condensed width.
  FONT_STRETCH_ULTRA_CONDENSED,

  /// Extra-condensed width.
  FONT_STRETCH_EXTRA_CONDENSED,

  /// Condensed width.
  FONT_STRETCH_CONDENSED,

  /// Semi-condensed width.
  FONT_STRETCH_SEMI_CONDENSED,

  /// Normal width.
  FONT_STRETCH_NORMAL,

  /// Semi-expanded width.
  FONT_STRETCH_SEMI_EXPANDED,

  /// Expanded width.
  FONT_STRETCH_EXPANDED,

  /// Extra-expanded width.
  FONT_STRETCH_EXTRA_EXPANDED,

  /// Ultra-expanded width.
  FONT_STRETCH_ULTRA_EXPANDED};

/// Font slant styles.
typedef uint8_t FontSlant;

/// Font slant styles enumeration that can be passed as one of ::FontSlant values.
enum {
  /// Upright font.
  FONT_SLANT_NONE,

  /// Slanted font in a roman style.
  FONT_SLANT_OBLIQUE,

  /// Slanted in an italic style.
  FONT_SLANT_ITALIC};

/// Border that outlines text glyph's shapes.
typedef uint8_t FontBorder;

/// Font attribute bits that define some visual characteristics such as underline and strikeout.
typedef uint8_t FontAttributes;

/// Font attribute flags that define some visual characteristics.
enum
{
  /// Font with underlined text.
  FONT_ATTRIBUTE_UNDERLINE = 0x01,

  /// Font with strike-out text.
  FONT_ATTRIBUTE_STRIKE_OUT = 0x02
};

/// Font border enumeration that can be passed as one of ::FontBorder values.
enum {
  /// No border will appear around letters.
  FONT_BORDER_NONE,

  /// A light border will appear around letters.
  FONT_BORDER_NORMAL,

  /// A semi-heavy border will appear around letters.
  FONT_BORDER_SEMI_HEAVY,

  /// A heavy border will appear around letters.
  FONT_BORDER_HEAVY};

/// Text alignment when drawing with certain functions.
typedef uint8_t TextAlignment;

/// Text alignment enumeration that can be passed as one of ::TextAlignment values.
enum {
  /// Text should be aligned to the beginning (either top or left depending on context).
  TEXT_ALIGNMENT_START,

  /// Text should be centered in the middle.
  TEXT_ALIGNMENT_MIDDLE,

  /// Text should be aligned to the end (either bottom or right depending on context).
  TEXT_ALIGNMENT_END};

// Post-processing enumerations.

/// Format to be used as target for color dithering.
typedef uint8_t ColorDitheringFormat;

/// Format enumeration that can be passed as one of ::ColorDitheringFormat values.
enum {
  /// Red, green and blue channels have 8 bits each (16M colors).
  COLOR_DITHERING_FORMAT_RGB8,

  /// Red, green and blue channels have 6 bits each (256K colors).
  COLOR_DITHERING_FORMAT_RGB6,

  /// Red and blue channels have 5 bits each, while green channel has 6 bits (64K colors).
  COLOR_DITHERING_FORMAT_R5G6B5,

  /// Red, green and blue channels have 4 bits each (4K colors).
  COLOR_DITHERING_FORMAT_RGB4,

  /// Red and green channels have 3 bits each, while blue channel has 2 bits (256 colors).
  COLOR_DITHERING_FORMAT_RG3B2};

/// Type of texture provided by selection highlight module.
typedef uint8_t SelectionHighlightTextureType;

/// Texture type enumeration that can be passed as one of ::SelectionHighlightTextureType values.
enum {
  /// Texture that contains the selection highlight, to be rendered on top of the scene.
  SELECTION_HIGHLIGHT_TEXTURE_HIGHLIGHT,

  /// Texture that contains the highlight mask, that can be optionally rendered on top of the scene.
  SELECTION_HIGHLIGHT_TEXTURE_HIGHLIGHT_MASK
};

// Fog enumerations.

/// Defines type of formula used in fog calculation.
typedef uint8_t FogFormula;

/// Fog formula enumeration that can be passed as one of ::FogFormula values.
enum {
  /// Fog calculated as (far - d) / (far - near).
  FOG_FORMULA_LINEAR,

  /// Fog calculated as c x e^(-(d x b)^2).
  FOG_FORMULA_EXPONENTIAL,

  /// Ground fog with linear density and exponential depth.
  FOG_FORMULA_GROUND};

/// Defines how distance is calculated for depth fog.
typedef uint8_t DepthFogDistance;

/// Depth fog distance enumeration that can be passed as one of ::DepthFogDistance values.
enum {
  /// Distance is based on depth.
  DEPTH_FOG_DISTANCE_Z_BASED,

  /// Distance is relative to camera position.
  DEPTH_FOG_DISTANCE_EYE_RELATIVE};

// Scene enumerations.

/// Lighting technique that defines what type of lighting formula and/or BDRF is being used.
typedef uint8_t TechniqueLighting;

/// Lighting technique enumeration that can be passed as one of ::TechniqueLighting values.
enum {
  /// Traditional Phong lighting.
  TECHNIQUE_LIGHTING_PHONG,

  /// Minnaert lighting.
  TECHNIQUE_LIGHTING_MINNAERT,

  /// Cook-Torrance lighting.
  TECHNIQUE_LIGHTING_COOK_TORRANCE,

  /// Oren-Nayer lighting.
  TECHNIQUE_LIGHTING_OREN_NAYER};

/// Shadow rendering technique.
typedef uint8_t TechniqueShadows;

/// Shadow technique enumeration that can be passed as one of ::TechniqueShadows values.
enum {
  /// No shadows are rendered or used.
  TECHNIQUE_SHADOWS_NONE,

  /// Exponential Shadow Maps (ESM) using a single depth component.
  TECHNIQUE_SHADOWS_ESM,

  /// Exponential Shadow Maps (ESM) using two depth components for positive and negative parts.
  TECHNIQUE_SHADOWS_ESM_WARP,

  /// Exponential Variance Shadow Maps (EVSM) using four depth components.
  TECHNIQUE_SHADOWS_EVSM
};

/// Light culling mode for clustered shading.
typedef uint8_t ClustersCullingMode;

/// Light culling mode enumeration that can be passed as one of ::ClustersCullingMode values.
enum {
  /// High-quality mode supporting up to 1024 simultaneous lights per cluster.
  CLUSTERS_CULLING_MODE_QUALITY,

  /// Performance mode supporting up to 4 simultaneous lights per cluster.
  CLUSTERS_CULLING_MODE_PERFORMANCE};

/// Determines the choice of pixel formats for the container.
typedef uint8_t TextureFidelity;

/// Texture fidelity enumeration that can be passed as one of ::TextureFidelity values.
enum {
  /// Use lowest quality texture formats, which may reduce GPU memory consumption and potentially improve
  /// performance slightly at expense of visual quality.
  TEXTURE_FIDELITY_LOW,

  /// Use standard quality texture formats suitable for most common usage scenarios.
  TEXTURE_FIDELITY_MEDIUM,

  /// High quality texture formats, producing accurate and exceptionally looking images.
  TEXTURE_FIDELITY_HIGH,

  /// Excessively high quality texture formats, typically useful for generating images to be printed,
  /// screenshots and presentations. This may increase GPU memory consumption and impact performance.
  TEXTURE_FIDELITY_EXTREME};

/// Texture type used in the deferred shading scene.
typedef uint8_t TextureCabinetType;

/// Texture cabinet type enumeration that can be passed as one of ::TextureCabinetType values.
enum {
  /// Depth buffer of the scene.
  TEXTURE_CABINET_TYPE_DEPTH = 0,

  /// Texture containing information about screen-space normals.
  TEXTURE_CABINET_TYPE_NORMALS = 1,

  /// High dynamic range color accumulation buffer.
  TEXTURE_CABINET_TYPE_COLOR_HDR = 4,

  /// Color buffer of the scene (non-MSAA).
  TEXTURE_CABINET_TYPE_COLOR = 5,

  /// Linear depths for spatial fog and water (MSAA).
  TEXTURE_CABINET_TYPE_LINEAR_DEPTHS = 11};

/// Defines type of rendering pass that is currently being performed.
typedef uint8_t TextureCabinetPass;

/// Texture cabinet pass enumeration that can be passed as one of ::TextureCabinetPass values.
enum {
  /// Main color scene pass.
  TEXTURE_CABINET_PASS_COLOR,

  /// Order-independent transparency (OIT) post-pass.
  TEXTURE_CABINET_PASS_GLASSY,

  /// Depth (and normals) pre-pass.
  TEXTURE_CABINET_PASS_DEPTH};

/// Filter type that defienes how textures are processed.
typedef uint8_t TextureCabinetFilterType;

/// Texture cabinet filter type enumeration that can be passed as one of ::TextureCabinetFilterType values.
enum {
  /// Ambient occlusion computation.
  TEXTURE_CABINET_FILTER_TYPE_OCCLUSION,

  /// Bloom (glare) effect processing.
  TEXTURE_CABINET_FILTER_TYPE_BLOOM,

  /// Order-independent transparency (OIT) composition.
  TEXTURE_CABINET_FILTER_TYPE_GLASSY,

  /// Spatial fog effects for order-independent transparency (OIT) composition.
  TEXTURE_CABINET_FILTER_TYPE_GLASSY_FOG};

/// Cumulative rendering attributes that can be passed to ::TextureCabinetAttributes.
enum {
  /// Screen-Space Ambient Occlusion technique.
  TEXTURE_CABINET_ATTRIBUTE_AMBIENT_OCCLUSION = 0x0001,

  /// Downscales SSAO texture to enable 4x faster performance on low and mid-end GPUs.
  TEXTURE_CABINET_ATTRIBUTE_AMBIENT_OCCLUSION_DOWNSCALE = 0x0002,

  /// Bloom (glare) technique.
  TEXTURE_CABINET_ATTRIBUTE_BLOOM = 0x0004,

  /// Bloom is rendered at half of resolution to accomodate for higher display scales.
  TEXTURE_CABINET_ATTRIBUTE_BLOOM_DOWNSCALE = 0x0008,

  /// Bloom is applied using cubic interpolation for higher quality look.
  TEXTURE_CABINET_ATTRIBUTE_BLOOM_CUBIC = 0x0010,

  /// Linear depths are provided for techniques such as fog or water.
  TEXTURE_CABINET_ATTRIBUTE_LINEAR_DEPTHS = 0x0020,

  /// Accurate order-independent transparency (OIT) single-pass technique.
  TEXTURE_CABINET_ATTRIBUTE_GLASSY = 0x0040,

  /// Approximate order-independent transparency (OIT) single-pass technique.
  TEXTURE_CABINET_ATTRIBUTE_GLASSY_FAST = 0x0080,

  /// Add to order-independent transparency (OIT) technique support for spatial fog effects.
  TEXTURE_CABINET_ATTRIBUTE_GLASSY_FOG = 0x0100,

  /// Frosted Glass effect added to order-independent transparency (OIT) techniques.
  TEXTURE_CABINET_ATTRIBUTE_GLASSY_FROSTED = 0x0200};

/// Cumulative rendering attributes that can be passed to ::SceneAttributes.
enum {
  /// Instancing technique will be used during rendering.
  SCENE_ATTRIBUTE_INSTANCING = 0x01,

  /// Vertex normals will be processed and taken into account.
  SCENE_ATTRIBUTE_NORMALS = 0x02,

  /// Vertex colors will be processed and taken into account.
  SCENE_ATTRIBUTE_COLORING = 0x04,

  /// Cubic interpolation will be used for texture mapping.
  SCENE_ATTRIBUTE_TEXTURING_CUBIC = 0x08,

  /// Cubic interpolation will be used for shadow mapping.
  SCENE_ATTRIBUTE_SHADOWS_CUBIC = 0x10,

  /// Perform adjustments for Order-Independent Transparency (OIT) rendering.
  SCENE_ATTRIBUTE_GLASSY = 0x20,

  /// The whole scene is rendered in a single pass with ambient occlusion.
  SCENE_ATTRIBUTE_SINGLE_PASS = 0x40,

  // Attributes specific to depth/normals scene.

  /// Generate output for depth pre-pass, which at minimum includes normals.
  /// Note: it is possible to do depth pre-pass without normals by excluding this attribute.
  SCENE_ATTRIBUTE_DEPTH_PREPASS = 0x80,

  /// Produce linear depths as part of depth pre-pass for spatial fog or water effects.
  /// Note: this requires SCENE_ATTRIBUTE_DEPTH_PREPASS flag to be enabled and thus always includes normals.
  SCENE_ATTRIBUTE_LINEAR_DEPTHS = 0x100,

  // Status attributes.

  /// Scene is a modeling scene, which means it supports textures and materials.
  SCENE_ATTRIBUTE_MODELING = 0x1000};

/// Type of texture used by the scene.
typedef uint8_t SceneTextureType;

/// Scene texture type enumeration that can be passed as one of ::SceneTextureType values.
enum {
  /// Albedo texture.
  SCENE_TEXTURE_TYPE_ALBEDO,

  /// Normal Map texture.
  SCENE_TEXTURE_TYPE_NORMAL_MAP,

  /// Displacement Map texture for Parallax Mapping technique.
  SCENE_TEXTURE_TYPE_PARALLAX_MAP};


/// Type of sampler used by the scene.
typedef uint8_t SceneSamplerType;

/// Scene sampler type enumeration that can be passed as one of ::SceneSamplerType values.
enum {
  /// Albedo sampler.
  SCENE_SAMPLER_TYPE_ALBEDO,

  /// Normal Map sampler.
  SCENE_SAMPLER_TYPE_NORMAL_MAP,

  /// Displacement Map sampler for Parallax Mapping technique.
  SCENE_SAMPLER_TYPE_PARALLAX_MAP,

  /// Shadow Map sampler.
  SCENE_SAMPLER_TYPE_SHADOW_MAP};

/// Type of transform as used by object models.
typedef uint8_t ModelTransform;

// MeshMetaTagType enumerations.

/// Type of the mesh meta-tag.
enum {
  /// Tag type is not determined.
  MESH_META_TAG_TYPE_INDETERMINATE = 0,

  /// Tag represents a geometry group.
  MESH_META_TAG_TYPE_GEOMETRY = 1,

  /// Tag represents an object group.
  MESH_META_TAG_TYPE_OBJECT = 2
};

// SceneMesh enumerations.

/// Type of texture used in scene mesh material.
enum {
  /// Diffuse color texture.
  SCENE_MESH_TEXTURE_DIFFUSE = 0,

  /// Normal-mapping texture.
  SCENE_MESH_TEXTURE_NORMALS = 1,

  /// Parallax-mapping texture.
  SCENE_MESH_TEXTURE_PARALLAX = 2
};

/// Type of latch used in the 3D scene mesh.
enum {
  /// Bone joint connection.
  SCENE_MESH_LATCH_TYPE_JOINT,

  /// Movement waypoint.
  SCENE_MESH_LATCH_TYPE_WAYPOINT
};

/// Enumeration values that can be passed to scene mesh creation functions.
enum {
  /// A special "undefined" value for an vertex elements index.
  SCENE_MESH_VERTEX_ELEMENTS_INDEX_UNDEFINED = 0xFF,
};

/// Cumulative options that can be passed to one of xxAutoDraw functions.
enum {
  /// Unbind the rendering buffers after issuing draw call. This can help resolve racing conditions under
  /// buggy drivers (mostly OpenGL) at the expense of reduced performance.
  AUTO_DRAW_OPTION_POST_UNBIND = 0x01,

  /// Reset scene textures after issuing draw call. For performance reasons, the textures should be reset
  /// after rendering all objects.
  AUTO_DRAW_OPTION_RESET_TEXTURES = 0x02,

  /// Ignore materials integrated into the mesh if such are present, using object material and/or vertex
  /// colors instead. This has no impact on "OBJECT_SKIP_X_HAVING_MATERIALS" options functionality.
  AUTO_DRAW_OPTION_MATERIAL_IGNORE = 0x04,

  /// Alpha-channel from the scene mesh materials should be assigned to alpha-channel of the scene
  /// material (which normally corresponds to bloom factor). This is typically used when rendering
  /// semi-transparent objects.
  AUTO_DRAW_OPTION_MATERIAL_TRANSPARENCY = 0x08,

  /// Portions of the mesh that have semi-transparent materials should be skipped.
  AUTO_DRAW_OPTION_MATERIAL_SKIP_TRANSPARENT = 0x10,

  /// Portions of the mesh that have opaque materials should be skipped.
  AUTO_DRAW_OPTION_MATERIAL_SKIP_OPAQUE = 0x20,

  /// Skips objects that have transparent attribute set.
  AUTO_DRAW_OPTION_OBJECT_SKIP_TRANSPARENT = 0x40,

  /// Skips objects that do not have transparent attribute set.
  AUTO_DRAW_OPTION_OBJECT_SKIP_NON_TRANSPARENT = 0x80,

  /// Skips objects that have mesh materials present.
  AUTO_DRAW_OPTION_OBJECT_SKIP_HAVING_MATERIALS = 0x100,

  /// Skips objects that do not have mesh materials present.
  AUTO_DRAW_OPTION_OBJECT_SKIP_NOT_HAVING_MATERIALS = 0x200,

  /// Draws objects that have a highlight color assigned.
  AUTO_DRAW_OPTION_OBJECT_HIGHLIGHTED = 0x400,

  /// Do not use instancing to render multiple objects simultaneously.
  AUTO_DRAW_OPTION_OBJECT_DISABLE_INSTANCING = 0x800
};

// ObjectModel enumerations.

/// Object model transform type enumeration that can be passed as one of ::ModelTransform values.
enum {
  /// Local object transform.
  MODEL_TRANSFORM_LOCAL,

  /// Local Model object transform (for rendering).
  MODEL_TRANSFORM_LOCAL_MODEL,

  /// Local Volume object transform (OOBB Unity Cube).
  MODEL_TRANSFORM_LOCAL_VOLUME,

  /// Global object transform.
  MODEL_TRANSFORM_GLOBAL,

  /// Global Model object transform (for rendering).
  MODEL_TRANSFORM_GLOBAL_MODEL,

  /// Global Volume object transform (OOBB Unity Cube).
  MODEL_TRANSFORM_GLOBAL_VOLUME
};

/// Axis alignment that determines the placement of mesh around its model.
typedef uint8_t MeshAlign;

/// Axis alignment enumeration that can be passed as one of ::MeshAlign values.
enum {
  /// Mesh is aligned from the edge of positive axis.
  MESH_ALIGN_POSITIVE,

  /// Mesh is aligned in the middle of axis origin.
  MESH_ALIGN_ORIGIN,

  /// Mesh is aligned from the edge of negative axis.
  MESH_ALIGN_NEGATIVE,

  /// Mesh is unaligned on the axis.
  MESH_ALIGN_UNALIGNED};

/// Type of comparison applied to an ordered list of objects.
typedef uint8_t ObjectModelViewCompare;

/// Object model comparison enumeration that can be passed as one of ::ObjectModelViewCompare values.
enum {
  /// Objects are compared by their depth.
  OBJECT_MODEL_COMPARE_DEPTH,

  /// Objects are compared by their depth in reverse (for rendering transparency without OIT).
  OBJECT_MODEL_COMPARE_DEPTH_REVERSE,

  /// Objects are compared first by their order index, then by depth.
  OBJECT_MODEL_COMPARE_ORDERED,

  /// Objects are compared first by their mesh and then by depth.
  OBJECT_MODEL_COMPARE_MESHES,

  /// Objects are sorted by their instance type id, mesh and then material.
  OBJECT_MODEL_COMPARE_OBJECTS
};

/// Cumulative flags for a 3D object model that define its status.
enum {
  /// Object is visible so can be rendered and selected (if selected flag is set).
  OBJECT_MODEL_ATTRIBUTE_VISIBLE = 0x01,

  /// Object can be selected.
  OBJECT_MODEL_ATTRIBUTE_SELECTABLE = 0x02,

  /// Object is semi-transparent (might be rendered through a different mechanism).
  OBJECT_MODEL_ATTRIBUTE_TRANSPARENT = 0x04,

  /// Object does not participate in bounding volume hierarchy (BVH) calculation. This is particularly
  /// useful for constantly moving objects or those objects that have unusually large dimensions
  /// overlapping with other objects.
  OBJECT_MODEL_ATTRIBUTE_HIERARCHYLESS = 0x08,

  /// Object should not automatically realign itself.
  OBJECT_MODEL_ATTRIBUTE_DISABLE_REALIGN = 0x10,

  /// Object does not appear among visible objects in the view. This is useful for abstract objects that
  /// have no associated mesh, so aren't rendered in any way, but can still be selected.
  OBJECT_MODEL_ATTRIBUTE_NON_VIEWABLE = 0x20
};

/// Non-exclusive options passed and/or returned from mesh loading and saving functions.
enum {
  /// Material diffuse colors should be mapped to vertex colors.
  MESH_LOADING_OPTION_MATERIAL_VERTEX_COLOR = 0x01,

  /// Assume "MESH_LOADING_OPTION_MATERIAL_VERTEX_COLOR" option only when the model would reasonably look
  /// the same as if it would have been rendered with its materials. This requires that all model materials
  /// do not use texturing, have no emissive color, no lighting technique, no bloom factor specified or have
  /// these at their default values.
  MESH_LOADING_OPTION_MATERIAL_VERTEX_COLOR_PREFERRED = 0x02,

  /// One or more material texture could not be loaded.
  MESH_LOADING_OPTION_MATERIAL_TEXTURE_MISSING = 0x80,

  /// Include vertex normals in the exported file.
  MESH_LOADING_OPTION_EXPORT_NORMALS = 0x100,

  /// Include vertex tangents in the exported file.
  MESH_LOADING_OPTION_EXPORT_TANGENTS = 0x200,

  /// Include vertex texture coordinates in the exported file.
  MESH_LOADING_OPTION_EXPORT_TEXTURE_COORDINATES = 0x400,

  /// Include vertex colors in the exported file.
  MESH_LOADING_OPTION_EXPORT_COLORS = 0x800,

  /// Include vertex weights in the exported file.
  MESH_LOADING_OPTION_EXPORT_WEIGHTS = 0x1000,

  /// Strip names for geometry and object nodes when saving in OBJ format.
  MESH_LOADING_OPTION_STRIP_GEOMETRY_NAMES = 0x2000};

// ActorCamera enumerations.

/// Camera movement/rotation command.
typedef uint8_t CameraCommand;

/// Camera movement/rotation command enumeration that can be passed as one of ::CameraCommand values.
enum {
  /// Start camera movement on XZ plane.
  CAMERA_COMMAND_MOVEMENT,

  /// Start camera dragging.
  CAMERA_COMMAND_DRAGGING,

  /// Start camera rotation.
  CAMERA_COMMAND_ROTATION,

  /// Update camera movement/rotation.
  CAMERA_COMMAND_UPDATE,

  /// Stop camera movement/rotation.
  CAMERA_COMMAND_STOP
};

// Application enumerations.

/// Application's window state enumeration.
typedef uint8_t ApplicationWindowState;

/// Application window state enumeration that can be passed as one of ::ApplicationWindowState values.
enum {
  /// Windows appears normally with its title and border.
  APPLICATION_WINDOW_STATE_WINDOWED,

  /// Window appears minimized, iconic or hidden.
  APPLICATION_WINDOW_STATE_MINIMIZED,

  /// Window appears maximized to fill the screen's client area.
  APPLICATION_WINDOW_STATE_MAXIMIZED,

  /// Window appears occupying the entire screen.
  APPLICATION_WINDOW_STATE_FULLSCREEN
};

/// Type of mouse event corresponding to the notification.
typedef uint8_t MouseEvent;

/// Mouse event type enumeration that can be passed as one of ::MouseEvent values.
enum {
  /// Mouse button is pressed.
  MOUSE_EVENT_MOUSE_DOWN,

  /// Mouse cursor is being moved.
  MOUSE_EVENT_MOUSE_MOVE,

  /// Mouse button is de-pressed.
  MOUSE_EVENT_MOUSE_UP,

  /// Mouse wheel has been rotated up.
  MOUSE_EVENT_WHEEL_UP,

  /// Mouse wheel has been rotated down.
  MOUSE_EVENT_WHEEL_DOWN,

  /// Mouse has entered component's area.
  MOUSE_EVENT_MOUSE_ENTER,

  /// Mouse has left component's area.
  MOUSE_EVENT_MOUSE_LEAVE};

/// Type of mouse button that corresponds to the notification.
typedef uint8_t MouseButton;

/// Mouse button type enumeration that can be passed as one of ::MouseButton values.
enum {
  /// None or unknown button (typically specified during mouse move event).
  MOUSE_BUTTON_NONE,

  /// Left mouse button.
  MOUSE_BUTTON_LEFT,

  /// Right mouse button.
  MOUSE_BUTTON_RIGHT,

  /// Middle mouse button.
  MOUSE_BUTTON_MIDDLE};

/// Type of keyboard event corresponding to the notification.
typedef uint8_t KeyEvent;

/// Keyboard event type enumeration that can be passed as one of ::KeyEvent values.
enum {
  /// Key has been pressed.
  KEY_EVENT_PRESSED,

  /// Key has been released.
  KEY_EVENT_RELEASED,

  /// Key is being typed (for Unicode input).
  KEY_EVENT_TYPING};

/// Type of application event corresponding to the notification.
typedef uint8_t ApplicationEvent;

/// Application event type enumeration that can be passed as one of ::ApplicationEvent values.
enum {
  /// Application has been activated.
  APPLICATION_EVENT_ACTIVATE,

  /// Application has been de-activated.
  APPLICATION_EVENT_DEACTIVATE,

  /// Application has been minimized.
  APPLICATION_EVENT_MINIMIZE,

  /// Application has been restored.
  APPLICATION_EVENT_RESTORE,

  /// DPI changed or user switched between dark/white styles.
  APPLICATION_EVENT_APPEARANCE};

/// Storage type for portable key constants.
typedef uint8_t Key;

/// Portable key type enumeration that can be passed as one of ::Key values.
enum Key
{
  KEY_NULL = 0x00,
  // 0x01: SOH (Start of Heading)
  KEY_HOME = 0x02, // STX (Start of Text)
  KEY_END = 0x03, // ETX (End of Text)
  // 0x04: EOT (End of Transmission)
  KEY_PRINT_SCREEN = 0x05, // ENQ (Enquiry)
  // 0x06: ACK (Acknowledge)
  // 0x07: BEL (Bell)
  KEY_BACKSPACE = 0x08,
  KEY_TAB = 0x09,
  KEY_LINEFEED = 0x0A, // LF, NL (Newline)
  KEY_CLEAR = 0x0B, // VT (Vertical Tab)
  // 0x0C: FF (NP form feed, new page)
  KEY_RETURN = 0x0D, // Enter, CR (Carriage Return)
  KEY_PAGE_UP = 0x0E, // SO (Shift Out)
  KEY_PAGE_DOWN = 0x0F, // SI (Shift In)
  // 0x10: DLE (Data Link Escape)
  KEY_CAPSLOCK = 0x11, // DC1 (Device Control 1)
  KEY_NUM_LOCK = 0x12, // DC2 (Device Control 2)
  KEY_PAUSE = 0x13, // Hold, DC3 (Device Control 3)
  KEY_SCROLL_LOCK = 0x14, // DC4 (Device Control 4)
  KEY_SYS_REQ = 0x15, // SysRq, NAK (Negative Acknowledge)
  // 0x16: SYN (Synchronous Idle)
  // 0x17: ETB (End of Trans. Block)
  KEY_CANCEL = 0x18,
  // 0x19: EM (End of Medium)
  KEY_INSERT = 0x1A, // SUB (Substitute)
  KEY_ESCAPE = 0x1B,
  KEY_LEFT = 0x1C, // 0x1C: FS (File Separator)
  KEY_UP = 0x1D, // 0x1D: GS (Group Separator)
  KEY_RIGHT = 0x1E, // 0x1E: RS (Record Separator)
  KEY_DOWN = 0x1F, // 0x1F: US (Unit Separator)
  KEY_SPACE = 0x20,
  // 0x21 - 0x7E: ASCII characters.
  KEY_DELETE = 0x7F, // DEL
  // Extended keys
  KEY_F1 = 0x80,
  KEY_F2 = 0x81,
  KEY_F3 = 0x82,
  KEY_F4 = 0x83,
  KEY_F5 = 0x84,
  KEY_F6 = 0x85,
  KEY_F7 = 0x86,
  KEY_F8 = 0x87,
  KEY_F9 = 0x88,
  KEY_F10 = 0x89,
  KEY_F11 = 0x8A,
  KEY_F12 = 0x8B,
  // 0x8C - 0x97 (F13-F24 keys)
  // Control keys
  KEY_SHIFT_LEFT = 0x98,
  KEY_SHIFT_RIGHT = 0x99,
  KEY_CTRL_LEFT = 0x9A,
  KEY_CTRL_RIGHT = 0x9B,
  KEY_ALT_LEFT = 0x9C,
  KEY_ALT_RIGHT = 0x9D,
  KEY_SUPER_LEFT = 0x9E, // Left Windows key
  KEY_SUPER_RIGHT = 0x9F, // Right Windows key
  // Numpad keys
  KEY_NUMPAD_0 = 0xA0,
  KEY_NUMPAD_1 = 0xA1,
  KEY_NUMPAD_2 = 0xA2,
  KEY_NUMPAD_3 = 0xA3,
  KEY_NUMPAD_4 = 0xA4,
  KEY_NUMPAD_5 = 0xA5,
  KEY_NUMPAD_6 = 0xA6,
  KEY_NUMPAD_7 = 0xA7,
  KEY_NUMPAD_8 = 0xA8,
  KEY_NUMPAD_9 = 0xA9,
  // Numpad operators
  KEY_MULTIPLY = 0xAA,
  KEY_DIVIDE = 0xAB,
  KEY_ADD = 0xAC,
  KEY_SUBTRACT = 0xAD,
  // Numpad misc
  KEY_SEPARATOR = 0xAE,
  KEY_DECIMAL = 0xAF,
  // 0xB0 - 0xBF: reserved
  // Power keys
  KEY_SLEEP = 0xC0,
  // 0xC1 - 0xCB: reserved
  KEY_VOLUME_UP = 0xCC,
  KEY_VOLUME_DOWN = 0xCE,
  KEY_VOLUME_MUTE  = 0xCF,
  // Media playback keys
  KEY_MEDIA_NEXT_TRACK = 0xD0,
  KEY_MEDIA_PREV_TRACK = 0xD1,
  KEY_MEDIA_STOP = 0xD2,
  KEY_MEDIA_PLAY_PAUSE = 0xD3,
  // 0xD4 - 0xDF: reserved
  // Misc keys
  KEY_SELECT = 0xE0,
  KEY_PRINT = 0xE1,
  KEY_EXECUTE = 0xE2,
  KEY_HELP = 0xE3,
  KEY_APPS = 0xE4, // Applications key
  // 0xE5 - 0xFE: reserved
  // 0xFF: reserved
};

/// Application cursor enumeration.
typedef uint8_t AppCursor;

/// Application cursor enumeration that can be passed as one of ::AppCursor values.
enum {
  /// Blank (invisible) cursor.
  APP_CURSOR_BLANK = 0x00,

  /// Standard arrow cursor.
  APP_CURSOR_ARROW = 0x01,

  /// Text selection cursor.
  APP_CURSOR_TEXT_SELECT,

  // Vertical text selection cursor.
  APP_CURSOR_TEXT_SELECT_VERTICAL,

  /// Wait cursor.
  APP_CURSOR_WAIT,

  /// Arrow cursor with wait icon.
  APP_CURSOR_ARROW_WAIT,

  /// Crosshair cursor.
  APP_CURSOR_CROSSHAIR,

  /// Cell cursor.
  APP_CURSOR_CELL,

  /// Hyperlink selection cursor.
  APP_CURSOR_LINK_SELECT,

  /// Not allowed cursor.
  APP_CURSOR_NOT_ALLOWED,

  /// Help cursor.
  APP_CURSOR_HELP,

  /// Move cursor.
  APP_CURSOR_MOVE,

  /// Drag cursor.
  APP_CURSOR_DRAG,

  /// Dragging cursor.
  APP_CURSOR_DRAGGING,

  /// Vertical resize cursor.
  APP_CURSOR_RESIZE_VERT,

  /// Horizontal resize cursor.
  APP_CURSOR_RESIZE_HORIZ,

  /// Diagonal north-east south-west resize cursor.
  APP_CURSOR_RESIZE1,

  /// Diagonal north-west south-east resize cursor.
  APP_CURSOR_RESIZE2,

  /// Top resize cursor.
  APP_CURSOR_RESIZE_TOP,

  /// Bottom resize cursor.
  APP_CURSOR_RESIZE_BOTTOM,

  /// Left resize cursor.
  APP_CURSOR_RESIZE_LEFT,

  /// Right resize cursor.
  APP_CURSOR_RESIZE_RIGHT,

  /// Top/left resize cursor.
  APP_CURSOR_RESIZE_TOP_LEFT,

  /// Top/right resize cursor.
  APP_CURSOR_RESIZE_TOP_RIGHT,

  /// Bottom/right resize cursor.
  APP_CURSOR_RESIZE_BOTTOM_RIGHT,

  /// Bottom/left resize cursor.
  APP_CURSOR_RESIZE_BOTTOM_LEFT,

  /// Undefined or unspecified cursor.
  APP_CURSOR_UNDEFINED = 255};

/// Type of file chooser dialog type.
typedef uint8_t FileChooserDialog;

/// File chooser dialog type enumeration that can be passed as one of ::FileChooserDialog values.
enum {
  /// Open file dialog.
  FILE_CHOOSER_DIALOG_OPEN_FILE,

  /// Save file dialog.
  FILE_CHOOSER_DIALOG_SAVE_FILE,

  /// Select directory dialog.
  FILE_CHOOSER_DIALOG_DIRECTORY};

/// Alignment of the widget respective its parent.
typedef uint8_t WidgetAlignment;

/// Widget alignment enumeration that can be passed as one of ::WidgetAlignment values.
enum {
  /// No alignment is applied to widget.
  WIDGET_ALIGNMENT_NONE,

  /// Widget occupies the entire client area.
  WIDGET_ALIGNMENT_CLIENT,

  /// Widget is placed on the left occupying the entire client height.
  WIDGET_ALIGNMENT_LEFT,

  /// Widget is placed on the top occupying the entire client width.
  WIDGET_ALIGNMENT_TOP,

  /// Widget is placed on the right occupying the entire client height.
  WIDGET_ALIGNMENT_RIGHT,

  /// Widget is placed on the bottom occupying the entire client width.
  WIDGET_ALIGNMENT_BOTTOM};

/// Data type of a widget property.
typedef uint8_t WidgetPropertyType;

/// Widget property type enumeration that can be passed as one of ::WidgetPropertyType values.
enum {
  /// Unknown or undefined type. This may also refer to an event rather than property.
  WIDGET_PROPERTY_TYPE_NONE,

  /// 32-bit signed integer.
  WIDGET_PROPERTY_TYPE_INTEGER,

  /// 64-bit signed integer.
  WIDGET_PROPERTY_TYPE_INT64,

  /// 32-bit floating-point type.
  WIDGET_PROPERTY_TYPE_FLOAT,

  /// 64-bit floating-point type.
  WIDGET_PROPERTY_TYPE_REAL,

  /// Boolean value (either yes/no or true/false).
  WIDGET_PROPERTY_TYPE_BOOLEAN,

  /// Floating-point 2D vector.
  WIDGET_PROPERTY_TYPE_POINT,

  /// Floating-point 3D vector.
  WIDGET_PROPERTY_TYPE_VECTOR,

  /// Rectangle defined by four floating-point values: left, top, width and height.
  WIDGET_PROPERTY_TYPE_RECT,

  /// Margins defined by four floating-point values: left, top, right and bottom.
  WIDGET_PROPERTY_TYPE_MARGINS,

  /// Color value.
  WIDGET_PROPERTY_TYPE_COLOR,

  /// A pair of two colors.
  WIDGET_PROPERTY_TYPE_COLOR_PAIR,

  /// A set of four colors.
  WIDGET_PROPERTY_TYPE_COLOR_RECT,

  /// Enumeration (e.g. alignment) that is represented as a single byte.
  WIDGET_PROPERTY_TYPE_ENUMERATION,

  /// UTF-8 encoded string.
  WIDGET_PROPERTY_TYPE_STRING,

  /// Text font.
  WIDGET_PROPERTY_TYPE_FONT};

/// Behavior of the widget property, which can indicate its lifetime or whether the property is an event.
typedef uint8_t WidgetPropertyBehavior;

/// Widget property behavior enumeration that can be passed as one of ::WidgetPropertyBehavior values.
enum {
  /// Standard property behavior.
  WIDGET_PROPERTY_BEHAVIOR_NORMAL,

  /// Property wraps an existing variable of the parent.
  WIDGET_PROPERTY_BEHAVIOR_STATIC,

  /// Property is accessed through callback events.
  WIDGET_PROPERTY_BEHAVIOR_INDIRECT,

  /// Property is considered temporary or "volatile".
  WIDGET_PROPERTY_BEHAVIOR_VOLATILE,

  /// Property represents an event.
  WIDGET_PROPERTY_BEHAVIOR_EVENT
};

/// Widget property attribute bitmasks.
enum {
  /// The property is assigned: that is, it has an accompanying value.
  WIDGET_PROPERTY_ATTRIBUTE_ASSIGNED = 0x1000
};

/// Texture type used by widget manager for the compositioning of the rendered UI.
typedef uint8_t WidgetManagerTextureType;

/// Widget manager texture type enumeration that can be passed as one of ::WidgetManagerTextureType values.
enum {
  /// Texture with multisampling that is used for rendering using canvas.
  WIDGET_MANAGER_TEXTURE_TYPE_CANVAS,

  /// Final compositioning texture.
  WIDGET_MANAGER_TEXTURE_TYPE_SCREEN,

  /// Auxiliary texture used for compositioning effects.
  WIDGET_MANAGER_TEXTURE_TYPE_AUXILIARY
};

/// Widget manager cumulative attribute flags that define its behavior.
enum WidgetManagerAttribute
{
  /// Widgets support of composition effects such as glass and blur.
  WIDGET_MANAGER_ATTRIBUTE_COMPOSITION = 0x01,

  /// Design mode bit that enables additional functionality for creating interfaces on the fly.
  WIDGET_MANAGER_ATTRIBUTE_DESIGN = 0x80
};

/// Raw (untyped) color value is represented as a raw 32-bit unsigned integer, with components allocated
/// according to \c ARGB8 format.
typedef uint32_t Color;

/// Predefined constant for opaque Black color.
static Color const COLOR_BLACK = 0xFF000000;

/// Predefined constant for opaque White color.
static Color const COLOR_WHITE = 0xFFFFFFFF;

/// Predefined constant for translucent Black color.
static Color const COLOR_TRANSLUCENT_BLACK = 0x00000000;

/// Predefined constant for translucent White color.
static Color const COLOR_TRANSLUCENT_WHITE = 0x00FFFFFF;

/// A combination of two colors, primarily used for displaying text with the first color being on top and
/// the second being on bottom. The format for specifying colors is defined as \c ARGB8).
typedef struct ColorPair {
  /// First color entry, which can be reinterpreted as top or left color depending on context.
  Color first;

  /// Second color entry, which can be reinterpreted as bottom or right color depending on context.
  Color second;

#ifdef __cplusplus
  /// Creates two 32-bit ARGB color gradient from specified pair of values.
  ColorPair(Color first, Color second) : first(first), second(second) {};

  /// Creates two 32-bit ARGB color gradient with both values set to specified color.
  ColorPair(Color color) : first(color), second(color) {};
#endif
} ColorPair;

#ifndef __cplusplus
  /// Constructs a pair of two colors from the same value.
  #define COLOR_PAIR(x) ((ColorPair){x, x})
#endif

/// A rectangle of four colors, primarily used for displaying colored quads, where each color corresponds
/// to top/left, top/right, bottom/right and bottom/left accordingly (clockwise). The format for specifying
/// colors is defined as \c ARGB8.
typedef struct ColorRect
{
  /// Color corresponding to top / left corner.
  Color topLeft;

  /// Color corresponding to top / right corner.
  Color topRight;

  /// Color corresponding to bottom / right corner.
  Color bottomRight;

  /// Color corresponding to bottom / left corner.
  Color bottomLeft;
} ColorRect;

#ifndef __cplusplus
  /// Constructs a rectangle of four colors having the same value.
  #define COLOR_RECT(x) ((ColorRect){x, x, x, x})

  /// Constructs a rectangle of four colors with a horizontal two-color gradient.
  #define COLOR_RECT_H(x, y) ((ColorRect){x, y, y, x})

  /// Constructs a rectangle of four colors with a vertical two-color gradient.
  #define COLOR_RECT_V(x, y) ((ColorRect){x, x, y, y})
#endif

/// A three-component special high-precision color value that has each individual component represented
/// as 32-bit floating-point value in range of [0, 1]. Although components may have values outside of
/// aforementioned range, such colors cannot be reliably displayed on the screen.
typedef struct FloatColorRGB
{
  /// Red value ranging from 0.0 (no intensity) to 1.0 (fully intense).
  float red;

  /// Green value ranging from 0.0 (no intensity) to 1.0 (fully intense).
  float green;

  /// Blue value ranging from 0.0 (no intensity) to 1.0 (fully intense).
  float blue;
} FloatColorRGB;

/// A special high-precision color value that has each individual component represented as 32-bit
/// floating-point value in range of [0, 1]. Although components may have values outside of aforementioned
/// range, such colors cannot be reliably displayed on the screen.
typedef struct FloatColor
{
  /// Red value ranging from 0.0 (no intensity) to 1.0 (fully intense).
  float red;

  /// Green value ranging from 0.0 (no intensity) to 1.0 (fully intense).
  float green;

  /// Blue value ranging from 0.0 (no intensity) to 1.0 (fully intense).
  float blue;

  /// Alpha-channel value ranging from 0.0 (translucent) to 1.0 (opaque).
  float alpha;
} FloatColor;

/// 2D integer point (or vector).
typedef struct Point
{
  /// Horizontal coordinate in 2D space.
  int32_t x;

  /// Vertical coordinate in 2D space.
  int32_t y;
} Point;

/// 2D floating-point vector.
typedef struct PointF
{
  /// Horizontal coordinate in 2D space.
  float x;

  /// Vertical coordinate in 2D space.
  float y;
} PointF;

/// 3D floating-point vector.
typedef struct Vector
{
  /// X coordinate in 3D space.
  float x;

  /// Y coordinate in 3D space.
  float y;

  /// Z coordinate in 3D space.
  float z;
} Vector;

/// 4-component (XYZ + W) floating-point vector.
typedef struct Vector4
{
  /// X coordinate in 3D space.
  float x;

  /// Y coordinate in 3D space.
  float y;

  /// Z coordinate in 3D space.
  float z;

  /// W coordinate in 3D space.
  float w;
} Vector4;

/// 3x2 matrix representing rotation and translation in context of 2D graphics.
typedef struct Matrix3x2
{
  /// Individual matrix values.
  float data[3][2];
} Matrix3x2;

/// 4x4 matrix representing transformation information in context of 3D graphics.
typedef struct Matrix
{
  /// Individual matrix values.
  float data[4][4];
} Matrix;

/// 3D quaternion.
typedef struct Quaternion
{
  /// Quaternion X coordinate.
  float x;

  /// Quaternion Y coordinate.
  float y;

  /// Quaternion Z coordinate.
  float z;

  /// Quaternion W coordinate.
  float w;
} Quaternion;

/// Rectangle defined by integer top and left margins, width and height.
typedef struct Rect
{
  /// Left position of the rectangle.
  int32_t left;

  /// Top position of the rectangle.
  int32_t top;

  /// Width of the rectangle.
  int32_t width;

  /// Height of the rectangle.
  int32_t height;
} Rect;

/// Rectangle defined by floating-point top and left margins, width and height.
typedef struct RectF
{
  /// Left position of the rectangle.
  float left;

  /// Top position of the rectangle.
  float top;

  /// Width of the rectangle.
  float width;

  /// Height of the rectangle.
  float height;
} RectF;

/// Floating-point quadrilateral defined by four vertices in clockwise order starting from top/left.
typedef struct Quad
{
  /// Top/left vertex position.
  PointF topLeft;

  /// Top/right vertex position.
  PointF topRight;

  /// Bottom/right vertex position.
  PointF bottomRight;

  /// Bottom/left vertex position.
  PointF bottomLeft;
} Quad;

/// Margins defined by top, left, right and bottom edge paddings.
typedef struct Margins
{
  /// Left edge padding.
  float left;

  /// Top edge padding.
  float top;

  /// Right edge padding.
  float right;

  /// Bottom edge padding.
  float bottom;
} Margins;