Expand description
Defines traits and types for generating GLSL code from Rust definitions.
All GLSL primitives, like int
or vec3
, implement the Glsl
trait. Structs
should implement GlslStruct
, which can be derived.
§Examples
Given this struct:
use mint::{ColumnMatrix4, Vector3};
use crevice::glsl::GlslStruct;
#[derive(GlslStruct)]
struct SpotLight {
transform: ColumnMatrix4<f32>,
color: Vector3<f32>,
intensity: f32,
}
println!("{}", SpotLight::glsl_definition());
The output will be:
struct SpotLight {
mat4 transform;
vec3 color;
float intensity;
};
Structs§
- A field contained within a GLSL struct definition.
Traits§
- Trait for types that have a GLSL equivalent. Useful for generating GLSL code from Rust structs.
- Trait for types that can be represented as a struct in GLSL.