summaryrefslogtreecommitdiff
path: root/src/shader.rs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-01-03 13:41:21 -0500
committerLLLL Colonq <llll@colonq>2025-01-03 13:41:21 -0500
commitf1b47ccb8a92280df51bb28b495829f8f7f8127e (patch)
treed5311a3d3135af498da0d808042b22c59fe5b2ae /src/shader.rs
parent2f30c4d25f3e01fb4fc8089134a610195f1cdb13 (diff)
Add initial GLTF support
Diffstat (limited to 'src/shader.rs')
-rw-r--r--src/shader.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shader.rs b/src/shader.rs
index 71f2a7c..46deb82 100644
--- a/src/shader.rs
+++ b/src/shader.rs
@@ -183,6 +183,19 @@ impl Shader {
}
}
+ pub fn set_mat4_array(&self, ctx: &context::Context, name: &str, val: &[glam::Mat4]) {
+ if let Some(loc) = self.uniforms.get(name) {
+ let vs: Vec<f32> = val.iter().flat_map(|m| m.to_cols_array()).collect();
+ unsafe {
+ ctx.gl.uniform_matrix_4_f32_slice(
+ Some(loc),
+ false,
+ &vs,
+ );
+ }
+ }
+ }
+
pub fn set_position_3d(&self, ctx: &context::Context, position: &glam::Mat4) {
self.set_mat4(&ctx, "position", &position);
self.set_mat4(&ctx, "normal_matrix", &position.inverse().transpose());