summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-12-04 13:16:21 -0500
committerFreya Murphy <freya@freyacat.org>2025-12-04 13:18:33 -0500
commitba2f810f0752bdecf8253b34bd245c7939f23534 (patch)
tree23a5fa60afb7f9f5d0ff1b51d11bb8dd24f46e04 /assets
downloadvoxel-ba2f810f0752bdecf8253b34bd245c7939f23534.tar.gz
voxel-ba2f810f0752bdecf8253b34bd245c7939f23534.tar.bz2
voxel-ba2f810f0752bdecf8253b34bd245c7939f23534.zip
initial chunk rendering
Diffstat (limited to 'assets')
-rwxr-xr-xassets/fragment.glsl22
-rwxr-xr-xassets/vertex.glsl14
2 files changed, 36 insertions, 0 deletions
diff --git a/assets/fragment.glsl b/assets/fragment.glsl
new file mode 100755
index 0000000..831a8ab
--- /dev/null
+++ b/assets/fragment.glsl
@@ -0,0 +1,22 @@
+#version 330
+
+flat in uint pass_data;
+
+out vec4 color;
+
+const float TINT[6] = float[](
+ // px, nx
+ 0.9, 0.9,
+ // py, ny
+ 1, 0.7,
+ // pz, nz
+ 0.8, 0.8
+);
+
+void main(void)
+{
+ uint face = pass_data >> 2u;
+ uint block = pass_data & 3u;
+ float tint = TINT[face];
+ color = vec4(tint, tint, tint, 1);
+}
diff --git a/assets/vertex.glsl b/assets/vertex.glsl
new file mode 100755
index 0000000..a0af427
--- /dev/null
+++ b/assets/vertex.glsl
@@ -0,0 +1,14 @@
+#version 330
+
+in vec3 position;
+in uint data;
+
+flat out uint pass_data;
+
+uniform mat4 proj_view;
+
+void main(void)
+{
+ gl_Position = proj_view * vec4(position, 1.0);
+ pass_data = data;
+}