A lot of work
* moved all ugui code to lib/ugui.c3l and made it a library/module * started work on a sdl3 renderer, with shaders etc * added the new sdl3.c3l library as a dependency * makefile is for the renderer
This commit is contained in:
parent
2380c7693c
commit
712ce50631
32 changed files with 838 additions and 1 deletions
BIN
resources/shaders/compiled/rect.frag.spv
Normal file
BIN
resources/shaders/compiled/rect.frag.spv
Normal file
Binary file not shown.
BIN
resources/shaders/compiled/rect.vert.spv
Normal file
BIN
resources/shaders/compiled/rect.vert.spv
Normal file
Binary file not shown.
18
resources/shaders/source/font.frag.glsl
Normal file
18
resources/shaders/source/font.frag.glsl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#version 330 core
|
||||
|
||||
// viewsize.x = viewport width in pixels; viewsize.y = viewport height in pixels
|
||||
uniform ivec2 viewsize;
|
||||
uniform ivec2 texturesize;
|
||||
|
||||
// texture uv coordinate in texture space
|
||||
in vec2 uv;
|
||||
uniform sampler2DRect ts;
|
||||
|
||||
const vec3 textcolor = vec3(1.0, 1.0, 1.0);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
//gl_FragColor = vec4(1.0f,0.0f,0.0f,1.0f);
|
||||
gl_FragColor = vec4(textcolor, texture(ts, uv));
|
||||
}
|
||||
26
resources/shaders/source/font.vert.glsl
Normal file
26
resources/shaders/source/font.vert.glsl
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#version 330 core
|
||||
|
||||
// viewsize.x = viewport width in pixels; viewsize.y = viewport height in pixels
|
||||
uniform ivec2 viewsize;
|
||||
uniform ivec2 texturesize;
|
||||
|
||||
// both position and and uv are in pixels, they where converted to floats when
|
||||
// passed to the shader
|
||||
layout(location = 0) in vec2 position;
|
||||
layout(location = 1) in vec2 txcoord;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 v = vec2(float(viewsize.x), float(viewsize.y));
|
||||
|
||||
// vec2 p = vec2(position.x*2.0f/v.x - 1.0f, position.y*2.0f/v.y - 1.0f);
|
||||
vec2 p = vec2(position.x*2.0/v.x - 1.0, 1.0 - position.y*2.0/v.y);
|
||||
vec4 pos = vec4(p.x, p.y, 0.0f, 1.0f);
|
||||
|
||||
gl_Position = pos;
|
||||
// since the texture is a GL_TEXTURE_RECTANGLE the coordintes do not need to
|
||||
// be normalized
|
||||
uv = vec2(txcoord.x, txcoord.y);
|
||||
}
|
||||
9
resources/shaders/source/rect.frag.glsl
Normal file
9
resources/shaders/source/rect.frag.glsl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#version 450
|
||||
|
||||
layout(location = 0) in vec4 col;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = col;
|
||||
}
|
||||
25
resources/shaders/source/rect.vert.glsl
Normal file
25
resources/shaders/source/rect.vert.glsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#version 450
|
||||
|
||||
layout(set = 1, binding = 0) uniform Viewport {
|
||||
ivec2 view;
|
||||
ivec2 off;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec2 position;
|
||||
layout(location = 1) in vec2 uv;
|
||||
layout(location = 2) in ivec4 color;
|
||||
|
||||
layout(location = 0) out vec4 col;
|
||||
|
||||
void main()
|
||||
{
|
||||
//vec2 shift = vec2(0);
|
||||
vec2 shift;
|
||||
shift.x = float(off.x) / view.x;
|
||||
shift.y = -(float(off.y) / view.y);
|
||||
|
||||
vec2 pos = position + shift;
|
||||
|
||||
gl_Position = vec4(pos.x, pos.y, 0.0, 1.0);
|
||||
col = vec4(color) / 255.0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue