summaryrefslogtreecommitdiff
path: root/demo/Vector.lua
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2020-10-27 23:23:22 -0500
committersanine-a <sanine.not@pm.me>2020-10-27 23:23:22 -0500
commitf0a6a17e4fba3510c8ba8f6b114012873035a4a1 (patch)
treebcc30d768b1ccf515936cc821ac30a21b5ed9ea7 /demo/Vector.lua
parentc3698446644365283fcd3d3f47f3eea67cad8331 (diff)
fix minor bugs, add cube primitive binding, and implement basic first-person camera
Diffstat (limited to 'demo/Vector.lua')
-rw-r--r--demo/Vector.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/demo/Vector.lua b/demo/Vector.lua
index 752c927..89fd26a 100644
--- a/demo/Vector.lua
+++ b/demo/Vector.lua
@@ -2,9 +2,9 @@ local Vec3 = {}
Vec3.tostring = function(vec3)
local str = '['..
- tostring(honey.cglm.get_value(vec4, 0))..','..
- tostring(honey.cglm.get_value(vec4, 1))..','..
- tostring(honey.cglm.get_value(vec4, 2))..']'
+ tostring(honey.cglm.get_value(vec3, 0))..','..
+ tostring(honey.cglm.get_value(vec3, 1))..','..
+ tostring(honey.cglm.get_value(vec3, 2))..']'
return str
end
@@ -19,12 +19,17 @@ Vec3.new = function(tbl)
local vec3 = honey.cglm.new_array_zero(3)
for i = 0,2 do
- honey.cglm.set_value(data, i, tbl[i+1])
+ honey.cglm.set_value(vec3, i, tbl[i+1])
end
return vec3
end
+Vec3.ZERO = Vec3.new()
+Vec3.X_UNIT = Vec3.new{1, 0, 0}
+Vec3.Y_UNIT = Vec3.new{0, 1, 0}
+Vec3.Z_UNIT = Vec3.new{0, 0, 1}
+
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
local Vec4 = {}