From ec00c661a39073ba24a78ba7624009bc912ae572 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Tue, 27 Oct 2020 18:16:24 -0500 Subject: add cglm bindings for vec3 and mat3 functions --- demo/main.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'demo') diff --git a/demo/main.lua b/demo/main.lua index f3a3c4a..1be7eaf 100644 --- a/demo/main.lua +++ b/demo/main.lua @@ -4,6 +4,15 @@ end honey.input.key.bind(honey.input.key.escape, honey.exit) +local vec4 = function(v) + local vector = honey.cglm.new_array_zero(4) + honey.cglm.set_value(vector, 0, v[1]) + honey.cglm.set_value(vector, 1, v[2]) + honey.cglm.set_value(vector, 2, v[3]) + honey.cglm.set_value(vector, 3, v[4]) + return vector +end + local vertex_shader = [[ #version 330 core @@ -24,12 +33,8 @@ void main() { color = base_color; } ]] local shader = honey.shader.new(vertex_shader, fragment_shader) local plane = honey.primitives.plane(2,2) -local color1 = honey.cglm.new_array_zero(4) -honey.cglm.set_value(color1, 3, 1) -local color2 = honey.cglm.copy_array(color1, 4) -honey.cglm.set_value(color1, 0, 1) -honey.cglm.set_value(color2, 2, 1) - +local color1 = vec4{1,0,0,1} +local color2 = vec4{0,0,1,1} local color = honey.cglm.new_array_zero(4) local total_time = 0 -- cgit v1.2.1