Add outline pass to cubes

This commit is contained in:
Hugo Mårdbrink 2025-08-27 00:16:42 +02:00
parent 1852cf3a7f
commit 2ee22c118c
10 changed files with 425 additions and 108 deletions

41
shaders/src/cube.glsl Normal file
View file

@ -0,0 +1,41 @@
@header package shaders
@header import sg "../../sokol/gfx"
@ctype mat4 Mat4
@vs vs_cube
in vec3 pos;
in vec2 uv;
layout(binding = 0) uniform VsParamsCube {
mat4 mvp;
vec4 col;
};
out vec4 color;
out vec2 tex_coord;
void main() {
gl_Position = mvp * vec4(pos, 1);
color = col;
tex_coord = uv;
}
@end
@fs fs_cube
in vec4 color;
in vec2 tex_coord;
layout(binding=0) uniform texture2D tex;
layout(binding=0) uniform sampler smp;
out vec4 frag_color;
void main() {
frag_color = texture(sampler2D(tex, smp), tex_coord) * color;
}
@end
@program cube vs_cube fs_cube