56 lines
1.0 KiB
Rust
56 lines
1.0 KiB
Rust
use crate::geometry;
|
|
|
|
pub enum InputRequirement {
|
|
Required,
|
|
Optional
|
|
}
|
|
|
|
pub struct ShaderInput {
|
|
pub semantic: geometry::VertexSemantic,
|
|
pub component_count: usize,
|
|
pub data_type: geometry::AttributeType,
|
|
pub requirement: InputRequirement
|
|
}
|
|
|
|
pub struct ShaderInputs {
|
|
pub inputs: Vec<ShaderInput>,
|
|
}
|
|
|
|
impl ShaderInputs {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
inputs: vec![]
|
|
}
|
|
}
|
|
|
|
pub fn required(
|
|
mut self,
|
|
semantic: geometry::VertexSemantic,
|
|
component_count: usize,
|
|
data_type: geometry::AttributeType
|
|
) -> Self {
|
|
self.inputs.push(ShaderInput {
|
|
semantic,
|
|
data_type,
|
|
component_count,
|
|
requirement: InputRequirement::Required,
|
|
});
|
|
self
|
|
}
|
|
|
|
pub fn optional(
|
|
mut self,
|
|
semantic: geometry::VertexSemantic,
|
|
component_count: usize,
|
|
data_type: geometry::AttributeType
|
|
) -> Self {
|
|
self.inputs.push(ShaderInput {
|
|
semantic,
|
|
data_type,
|
|
component_count,
|
|
requirement: InputRequirement::Optional,
|
|
});
|
|
self
|
|
}
|
|
}
|