From 6c5b65ee55ca130310268cbcc40db3c9c54d2529 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Mon, 21 Aug 2017 11:25:58 -0400 Subject: [PATCH] gamnit: intro UniformInt MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/gamnit/programs.nit | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/gamnit/programs.nit b/lib/gamnit/programs.nit index 6859c76..fc02530 100644 --- a/lib/gamnit/programs.nit +++ b/lib/gamnit/programs.nit @@ -162,6 +162,14 @@ class UniformBool fun uniform(val: Bool) do uniform_1i(location, if val then 1 else 0) end +# Shader uniform of GLSL type `int` +class UniformInt + super Uniform + + # Set this uniform value + fun uniform(val: Int) do uniform_1i(location, val) +end + # Shader uniform of GLSL type `vec4` class UniformFloat super Uniform @@ -230,6 +238,7 @@ end class InactiveUniform super InactiveVariable super UniformBool + super UniformInt super UniformFloat super UniformSampler2D super UniformVec2 @@ -408,6 +417,8 @@ abstract class GamnitProgram var uniform if typ == gl_BOOL then uniform = new UniformBool(gl_program, name, location, size) + else if typ == gl_INT then + uniform = new UniformInt(gl_program, name, location, size) else if typ == gl_SAMPLER_2D then uniform = new UniformSampler2D(gl_program, name, location, size) else if typ == gl_FLOAT then -- 1.7.9.5