Skip to content

Commit

Permalink
Added Uniform::sem().
Browse files Browse the repository at this point in the history
  • Loading branch information
hadronized committed Nov 13, 2016
1 parent f395c9d commit 01a1474
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions luminance/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 0.13.1

- Added `Uniform::sem()` function to create `Sem` out of `Uniform<C, T>` in a simpler way.

## 0.13.0

- Changed the pipeline workflow by introducing `Pipe` objects.
Expand Down
2 changes: 1 addition & 1 deletion luminance/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "luminance"
version = "0.13.0"
version = "0.13.1"
license = "BSD-3-Clause"
authors = ["Dimitri Sabadie <dimitri.sabadie@gmail.com>"]
description = "Stateless and type-safe graphics framework"
Expand Down
8 changes: 7 additions & 1 deletion luminance/src/shader/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ impl<C, T> Uniform<C, T> where C: HasProgram, T: Uniformable<C> {
_t: PhantomData
}
}

/// Create a `Sem` by giving a mapping name. The `Type` and `Dim` are reified using the static
/// type of the uniform (`T`).
pub fn sem(&self, name: &str) -> Sem {
Sem::new(name, T::reify_type(), T::dim())
}
}

/// Type of a uniform.
Expand Down Expand Up @@ -234,7 +240,7 @@ pub trait Uniformable<C>: Sized where C: HasProgram {
/// Update the uniform with a new value.
fn update(self, program: &C::Program, u: &Uniform<C, Self>);
/// Retrieve the `Type` of the uniform.
fn reify_type() -> Type;
fn reify_type() -> Type; // FIXME: call that ty() instead
/// Retrieve the `Dim` of the uniform.
fn dim() -> Dim;
}
Expand Down

0 comments on commit 01a1474

Please sign in to comment.