summaryrefslogtreecommitdiff
path: root/honey/asset
diff options
context:
space:
mode:
Diffstat (limited to 'honey/asset')
-rw-r--r--honey/asset/mesh.lua12
-rw-r--r--honey/asset/shader.lua4
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