summaryrefslogtreecommitdiff
path: root/src/gltf_render/basic.frag
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 18:04:21 -0300
committerGabriel Schneider <[email protected]>2026-11-16 18:04:21 -0300
commite77b01d4b5504cea08a3f88cf8502897d868a1d3 (patch)
treec8e643d234dd26d920cbc563bfa7f740febf1fc7 /src/gltf_render/basic.frag
parentd3074636fff0fbcd5fd9b71c0c3b1c1f5c0c1285 (diff)
downloadsketchbook-e77b01d4b5504cea08a3f88cf8502897d868a1d3.tar.gz
sketchbook-e77b01d4b5504cea08a3f88cf8502897d868a1d3.zip
Add glTF scene rendering, resource setup and 9P controls
Diffstat (limited to 'src/gltf_render/basic.frag')
-rw-r--r--src/gltf_render/basic.frag10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gltf_render/basic.frag b/src/gltf_render/basic.frag
new file mode 100644
index 0000000..73209ea
--- /dev/null
+++ b/src/gltf_render/basic.frag
@@ -0,0 +1,10 @@
+#version 450
+layout(location = 0) in vec3 world_normal;
+layout(location = 1) in vec4 color;
+layout(location = 0) out vec4 out_color;
+void main() {
+ vec3 normal = normalize(world_normal);
+ if (!gl_FrontFacing) normal = -normal;
+ float light = 0.42 + 0.58 * max(dot(normal, normalize(vec3(-0.45, 0.85, 0.3))), 0.0);
+ out_color = vec4(pow(max(color.rgb * light, vec3(0.0)), vec3(1.0 / 2.2)), 1.0);
+}