summaryrefslogtreecommitdiff
path: root/src/shaders/world.vert
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2025-01-19 15:23:06 -0600
committerAlexander M Pickering <alex@cogarr.net>2025-01-19 15:23:06 -0600
commitda9dd31f504d30f33922cdf362a7c01673a6b927 (patch)
tree6e3247dc8f57c16fd02d7ac07246d82c8ab65ccb /src/shaders/world.vert
parent90ee66a3a6aae10fd84f3f43844db55229933e37 (diff)
downloadggj25-da9dd31f504d30f33922cdf362a7c01673a6b927.tar.gz
ggj25-da9dd31f504d30f33922cdf362a7c01673a6b927.tar.bz2
ggj25-da9dd31f504d30f33922cdf362a7c01673a6b927.zip
Last commit before theme release
Diffstat (limited to 'src/shaders/world.vert')
-rw-r--r--src/shaders/world.vert10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shaders/world.vert b/src/shaders/world.vert
index 0e6747a..42276fe 100644
--- a/src/shaders/world.vert
+++ b/src/shaders/world.vert
@@ -1,7 +1,9 @@
precision highp float;
attribute vec3 world; // position
attribute vec2 texuv;
+attribute float r; // for round objects, 0 for non-round
varying vec2 textureuv;
+varying float radius;
varying mat3 light1;
uniform vec4 color;
varying vec4 v_color;
@@ -13,10 +15,12 @@ void main() {
v_color = vec4(world.xyz,1.);
vec2 vxy = vec2(world.x - world_x, world.y - world_y);
float z_scale = 0.5;
- float xoff = world.z * vxy.x * z_scale;
- float yoff = world.z * vxy.y * z_scale;
+ float xoff = clamp(world.z * vxy.x * z_scale, -32., 32.);
+ float yoff = clamp(world.z * vxy.y * z_scale, -32., 32.);
textureuv=texuv;
+ //radius = r;
// if z > 0 then
// xoff = ceil(xoff, 0)
- gl_Position = P * MV * vec4(vxy.x + xoff, vxy.y + yoff, 0., 1.0);
+ // add to the z coord so we don't intersect with the ui
+ gl_Position = P * MV * vec4(vxy.x + xoff, vxy.y + yoff, -world.z -1., 1.0);
}