From 759db92cf135aba21f0cbd17073d2f2e294fdf4d Mon Sep 17 00:00:00 2001 From: sanine-a Date: Fri, 12 May 2023 15:06:13 -0500 Subject: add nice builtin shaders --- main.lua | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index c251071..60cc174 100644 --- a/main.lua +++ b/main.lua @@ -26,6 +26,26 @@ db:createEntityWithComponents{ }, } +-- skybox +db:createEntityWithComponents{ + node = { + matrix = Mat4() + :identity(), + }, + renderMesh = { + mesh = { + filename = "assets/skybox.obj", + index = 1, + }, + uniforms = { + textures = { + surface = { filename = "starfield2.png" }, + }, + }, + shader = { vertex = "builtin.basic3d.vert", fragment = "builtin.flat.frag" }, + }, +} + -- mesh db:createEntityWithComponents{ node = { @@ -37,15 +57,17 @@ db:createEntityWithComponents{ filename = "assets/dodecahedron.obj", index = 1, }, - textures = { - ourTexture = { filename = "assets/green-grass.jpg" }, + uniforms = { + textures = { + ourTexture = { filename = "assets/green-grass.jpg" }, + }, }, shader = { vertex="vertex.glsl", fragment="fragment.glsl" }, }, } honey.loop(function(dt) - gl.ClearColor(0.2, 0.4, 1.0, 1.0) + gl.ClearColor(0xa/0xff, 0x10/0xff, 0x1f/0xff, 1.0) gl.Clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT + gl.STENCIL_BUFFER_BIT) systems:update(dt) end) -- cgit v1.2.1