ombre 0.6.7

Shadowy game and graphics library for Rust
Documentation
use super::*;

/// Shader identifier.
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash)]
pub struct ShaderId(id::Id);

#[derive(Clone, Debug)]
pub enum ShaderError {
    CompilationError { kind: ShaderKind, message: String },
    LinkError(String),
    Internal(String),
}

impl ShaderId {
    /// Get the next shader id.
    pub fn next() -> Self {
        Self(id::next())
    }
}

#[derive(Clone, Debug, Copy, PartialEq, Eq)]
pub enum ShaderKind {
    Vertex,
    Fragment,
}

#[derive(Debug)]
pub struct ShaderSource<'a> {
    pub vertex: &'a str,
    pub fragment: &'a str,
}

#[derive(Debug, Clone)]
pub struct ShaderDescriptor {
    pub uniforms: UniformBlockLayout,
    pub textures: Vec<String>,
}

/// Shader bindings
#[derive(Clone, Debug)]
pub struct Bindings {
    /// Vertex buffers. Data contained in the buffer must match layout
    /// specified in the [`PipelineDescriptor`].
    pub vertex: Vec<BufferId>,
    /// Index buffer.
    pub index: Option<BufferId>,
    /// Textures that can be sampled from the fragment shader.
    pub textures: Vec<TextureId>,
}