diff options
Diffstat (limited to 'honey/mesh.lua')
-rw-r--r-- | honey/mesh.lua | 23 |
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 |