diff options
author | mattkae <mattkae@protonmail.com> | 2023-07-31 07:31:52 -0400 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2023-07-31 07:31:52 -0400 |
commit | b6a666e96ffd04bd6d52be8fd9899faf27b751db (patch) | |
tree | ddc56ec77d0fa6a35a581ea49bcd1b4c3cac3756 /themes/src/_shaders | |
parent | ffa1ada2b7f65e0b3afe561b3291219394df21f3 (diff) |
Some initial shader loading work
Diffstat (limited to 'themes/src/_shaders')
-rw-r--r-- | themes/src/_shaders/renderer2d.frag | 0 | ||||
-rw-r--r-- | themes/src/_shaders/renderer2d.vert | 0 | ||||
-rw-r--r-- | themes/src/_shaders/renderer3d.frag | 7 | ||||
-rw-r--r-- | themes/src/_shaders/renderer3d.vert | 15 | ||||
-rw-r--r-- | themes/src/_shaders/sun.vert | 0 |
5 files changed, 22 insertions, 0 deletions
diff --git a/themes/src/_shaders/renderer2d.frag b/themes/src/_shaders/renderer2d.frag new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/src/_shaders/renderer2d.frag diff --git a/themes/src/_shaders/renderer2d.vert b/themes/src/_shaders/renderer2d.vert new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/src/_shaders/renderer2d.vert diff --git a/themes/src/_shaders/renderer3d.frag b/themes/src/_shaders/renderer3d.frag new file mode 100644 index 0000000..2f50347 --- /dev/null +++ b/themes/src/_shaders/renderer3d.frag @@ -0,0 +1,7 @@ +varying lowp vec4 VertexColor; +varying lowp vec4 VertexNormal; + +void main() { + const lowp vec3 lightDirection = vec3(0.0, 1.0, 0.0); + gl_FragColor = vec4(VertexColor.xyz * dot(VertexNormal.xyz, lightDirection), 1); +} diff --git a/themes/src/_shaders/renderer3d.vert b/themes/src/_shaders/renderer3d.vert new file mode 100644 index 0000000..026285f --- /dev/null +++ b/themes/src/_shaders/renderer3d.vert @@ -0,0 +1,15 @@ +attribute vec4 position; +attribute vec4 color; +attribute vec4 normal; +uniform mat4 projection; +uniform mat4 view; +uniform mat4 model; +varying lowp vec4 VertexColor; +varying lowp vec4 VertexNormal; + +void main() { + vec4 fragmentPosition = projection * view * model * position; + gl_Position = fragmentPosition; + VertexColor = color; + VertexNormal = normal; +} diff --git a/themes/src/_shaders/sun.vert b/themes/src/_shaders/sun.vert new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/src/_shaders/sun.vert |