diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-12 15:06:13 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-12 15:06:13 -0500 |
commit | 759db92cf135aba21f0cbd17073d2f2e294fdf4d (patch) | |
tree | 8f0c875217ef2434d898c6c8df1775340f93a986 /honey/asset/shader.lua | |
parent | 0d96ebc90c9740e7e66a70aa11168b11f49d220b (diff) |
add nice builtin shaders
Diffstat (limited to 'honey/asset/shader.lua')
-rw-r--r-- | honey/asset/shader.lua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/honey/asset/shader.lua b/honey/asset/shader.lua index a23c17b..d1fecc4 100644 --- a/honey/asset/shader.lua +++ b/honey/asset/shader.lua @@ -140,4 +140,47 @@ clearCache = function() end +--===== builtin shaders =====-- + +builtin["builtin.basic3d.vert"] = [[ + #version 410 core + layout (location = 0) in vec3 in_position; + layout (location = 1) in vec3 in_normal; + layout (location = 2) in vec2 in_texture; + + uniform mat4 model; + uniform mat4 view; + uniform mat4 projection; + + out vec3 position; + out vec3 normal; + out vec2 tex; + + void main() + { + gl_Position = projection * view * model * vec4(in_position, 1.0); + + position = in_position; + normal = in_normal; + tex = in_texture; + } +]] + +builtin["builtin.flat.frag"] = [[ + #version 410 core + + out vec4 frag_color; + + in vec3 position; + in vec3 normal; + in vec2 tex; + + uniform sampler2D surface; + + void main() + { + frag_color = texture(surface, tex); + } +]] + return module |