summaryrefslogtreecommitdiff
path: root/honey/mesh.lua
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-04-19 23:49:38 -0500
committersanine <sanine.not@pm.me>2023-04-19 23:49:38 -0500
commit445fc5217859a799e3a977c9763141d9a5f6cbb5 (patch)
tree9fe30aa97fe5d44b1f6fe0f85fe62543f5c2db4b /honey/mesh.lua
parent02c6f822e2cca41d5d28afd9f3a05211316587fd (diff)
add split drawing function and renderQuad component
Diffstat (limited to 'honey/mesh.lua')
-rw-r--r--honey/mesh.lua23
1 files changed, 18 insertions, 5 deletions
diff --git a/honey/mesh.lua b/honey/mesh.lua
index e46c399..e9a3404 100644
--- a/honey/mesh.lua
+++ b/honey/mesh.lua
@@ -54,12 +54,12 @@ function loadFile(filename)
end
-local meshCache = {}
-function loadMesh(filename, index)
- if not meshCache[filename] then
- meshCache[filename] = loadFile(filename)
+cache = {}
+function loadCached(filename, index)
+ if not cache[filename] then
+ cache[filename] = loadFile(filename)
end
- return meshCache[filename][index]
+ return cache[filename][index]
end
@@ -101,4 +101,17 @@ function Mesh.drawElements(self)
end
+--===== builtin meshes =====--
+
+function createBuiltins()
+ cache["builtin.quad"] = {Mesh(
+ { 0, 0, 0, 0, 1, 0, 0, 0,
+ 1, 0, 0, 0, 1, 0, 1, 0,
+ 0, 1, 0, 0, 1, 0, 0, 1,
+ 1, 1, 0, 0, 1, 0, 1, 1 },
+ { 0, 1, 3, 0, 3, 2 }
+ )}
+end
+
+
return module