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

View file

@ -3,11 +3,11 @@
@ctype mat4 Mat4
@vs vs
@vs vs_cube
in vec3 pos;
in vec2 uv;
layout(binding = 0) uniform VsParams {
layout(binding = 0) uniform VsParamsCube {
mat4 mvp;
vec4 col;
};
@ -23,7 +23,7 @@ void main() {
@end
@fs fs
@fs fs_cube
in vec4 color;
in vec2 tex_coord;
@ -38,4 +38,4 @@ void main() {
@end
@program main vs fs
@program cube vs_cube fs_cube

31
shaders/src/outline.glsl Normal file
View file

@ -0,0 +1,31 @@
@header package shaders
@header import sg "../../sokol/gfx"
@ctype mat4 Mat4
@vs vs_outline
in vec3 pos;
in vec2 uv;
layout(binding = 0) uniform VsParamsOutline {
mat4 mvp;
};
void main() {
gl_Position = mvp * vec4(pos, 1);
}
@end
@fs fs_outline
layout(binding = 1) uniform FsParamsOutline {
vec4 col;
};
out vec4 frag_color;
void main() {
frag_color = col;
}
@end
@program outline vs_outline fs_outline