Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / games / kart / src / main / rust / shaders / kart.vert
kart.vert24 lines · 716 BRaw
| 1 | #version 450 |
| 2 | // Unlit vertex-color kart shader: the mesh carries the art (asphalt gray, |
| 3 | // grass green, per-kart box colors), so no textures and no samplers. |
| 4 | layout(location = 0) in vec3 inPos; |
| 5 | layout(location = 1) in vec3 inColor; |
| 6 | |
| 7 | layout(location = 0) out vec3 vColor; |
| 8 | layout(location = 1) out vec3 vWorld; |
| 9 | |
| 10 | layout(set = 0, binding = 0) uniform Ubo { |
| 11 | mat4 viewProj; |
| 12 | vec3 sunDir; |
| 13 | vec3 camPos; |
| 14 | } ubo; |
| 15 | |
| 16 | void main() { |
| 17 | vColor = inColor; |
| 18 | vWorld = inPos; |
| 19 | vec4 clip = ubo.viewProj * vec4(inPos, 1.0); |
| 20 | // Vulkan Y flip: NDC Y points down, and the flip inverts winding (hence |
| 21 | // CULL_NONE in the pipeline) — same arrangement as games/voxels. |
| 22 | clip.y = -clip.y; |
| 23 | gl_Position = clip; |
| 24 | } |