diff options
| author | LLLL Colonq <llll@colonq> | 2024-04-02 12:54:43 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-04-02 12:54:43 -0400 |
| commit | 17eb85df48b64dd9d391cad28f58355e05ed2855 (patch) | |
| tree | 3d997324d3efc1cefc82861e058ca8badbe4dc16 /src/shader.rs | |
| parent | dd7f375f67251467e9799961428f87258df7282f (diff) | |
Update
Diffstat (limited to 'src/shader.rs')
| -rw-r--r-- | src/shader.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/shader.rs b/src/shader.rs index 6bcae3c..64ece63 100644 --- a/src/shader.rs +++ b/src/shader.rs @@ -163,6 +163,15 @@ impl Shader { ); } + pub fn set_texture_offset(&self, ctx: &context::Context, inc: i32, x: i32, y: i32) { + let count = inc as f32; + let ratio = 1.0 / count; + self.set_vec3( + ctx, "texture_offset", + &glam::Vec3::new((x % inc) as f32 * ratio, (y % inc) as f32 * ratio, count) + ); + } + pub fn bind(&self, ctx: &context::Context) { unsafe { ctx.gl.use_program(Some(self.program)); |
