From 445fc5217859a799e3a977c9763141d9a5f6cbb5 Mon Sep 17 00:00:00 2001 From: sanine Date: Wed, 19 Apr 2023 23:49:38 -0500 Subject: add split drawing function and renderQuad component --- honey/mesh.lua | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'honey/mesh.lua') 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 -- cgit v1.2.1