diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-12 14:10:48 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-12 14:10:48 -0500 |
commit | 0d96ebc90c9740e7e66a70aa11168b11f49d220b (patch) | |
tree | 758403f74f4fbcab61a228ef58e720850b3f70db /honey/asset | |
parent | 6036d1b5d7e0fc160637ce70595bac57ed1fcd00 (diff) |
run working program with refactored code
Diffstat (limited to 'honey/asset')
-rw-r--r-- | honey/asset/mesh.lua | 12 | ||||
-rw-r--r-- | honey/asset/shader.lua | 4 |
2 files changed, 11 insertions, 5 deletions
diff --git a/honey/asset/mesh.lua b/honey/asset/mesh.lua index 876c5e4..5e0a26d 100644 --- a/honey/asset/mesh.lua +++ b/honey/asset/mesh.lua @@ -136,14 +136,20 @@ end --===== builtin meshes =====-- -function createBuiltins() - cache["builtin.quad"] = {Mesh( +local function builtin(name, vertices, indices) + local vao, vbo, ebo, count = createMesh(vertices, indices) + cache[name] = { {vao=vao, vbo=vbo, ebo=ebo, count=count } } +end + +init = function() + builtin( + "builtin.quad", { 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 diff --git a/honey/asset/shader.lua b/honey/asset/shader.lua index 0e8c93a..a23c17b 100644 --- a/honey/asset/shader.lua +++ b/honey/asset/shader.lua @@ -35,8 +35,8 @@ local function buildProgram(sources) local shader = compileShader(readFile(sources.vertex), gl.VERTEX_SHADER) table.insert(shaders, shader) end - if sources.vertex then - local shader = compileShader(readFile(sources.vertex), gl.VERTEX_SHADER) + if sources.fragment then + local shader = compileShader(readFile(sources.fragment), gl.FRAGMENT_SHADER) table.insert(shaders, shader) end |