From f1b47ccb8a92280df51bb28b495829f8f7f8127e Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Fri, 3 Jan 2025 13:41:21 -0500 Subject: Add initial GLTF support --- src/shader.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/shader.rs') 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 = 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()); -- cgit v1.2.3