Skip to main content

yog_gfx/
core.rs

1//! Core graphics constants and enumerations.
2
3/// Primitive topology for draw calls.
4#[repr(u8)]
5#[derive(Copy, Clone, Debug, PartialEq, Eq)]
6pub enum DrawMode {
7    Triangles     = 0,
8    Lines         = 1,
9    LineStrip     = 2,
10    TriangleStrip = 3,
11    TriangleFan   = 4,
12}
13
14/// Vertex attribute component data type.
15#[repr(u8)]
16#[derive(Copy, Clone, Debug, PartialEq, Eq)]
17pub enum DataType {
18    /// 32-bit float (`GL_FLOAT`).
19    F32 = 0,
20    /// Unsigned byte, optionally normalized to 0.0–1.0 (`GL_UNSIGNED_BYTE`).
21    U8  = 1,
22    /// Signed 32-bit integer (`GL_INT`).
23    I32 = 2,
24    /// Unsigned 32-bit integer (`GL_UNSIGNED_INT`).
25    U32 = 3,
26}
27
28/// OpenGL blend factor constants for use with [`crate::GfxContext::set_blend`].
29pub mod blend {
30    pub const ZERO:                u32 = 0;
31    pub const ONE:                 u32 = 1;
32    pub const SRC_COLOR:           u32 = 0x0300;
33    pub const ONE_MINUS_SRC_COLOR: u32 = 0x0301;
34    pub const SRC_ALPHA:           u32 = 0x0302;
35    pub const ONE_MINUS_SRC_ALPHA: u32 = 0x0303;
36    pub const DST_ALPHA:           u32 = 0x0304;
37    pub const ONE_MINUS_DST_ALPHA: u32 = 0x0305;
38    pub const DST_COLOR:           u32 = 0x0306;
39    pub const ONE_MINUS_DST_COLOR: u32 = 0x0307;
40}