.
67
data/batcher.glsl
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
@ctype vec2 vec2
|
||||
@ctype vec4 vec4
|
||||
|
||||
@vs vs
|
||||
layout(binding=0) uniform render_data {
|
||||
vec2 one_over_window_size;
|
||||
float zoom;
|
||||
};
|
||||
|
||||
in vec4 quad;
|
||||
in vec4 tex_quad;
|
||||
in vec4 colour;
|
||||
|
||||
out vec2 uv;
|
||||
out vec4 fs_colour;
|
||||
|
||||
const int indices[6] = {
|
||||
0, 1, 2, 2, 3, 0,
|
||||
};
|
||||
|
||||
const vec3 positions[4] = {
|
||||
vec3(0, 0, 0),
|
||||
vec3(0, 1, 0),
|
||||
vec3(1, 1, 0),
|
||||
vec3(1, 0, 0),
|
||||
};
|
||||
|
||||
const vec2 uvs[4] = {
|
||||
vec2(0.0f, 0.0f),
|
||||
vec2(0.0f, 1.0f),
|
||||
vec2(1.0f, 1.0f),
|
||||
vec2(1.0f, 0.0f),
|
||||
};
|
||||
|
||||
void main() {
|
||||
int vtx = indices[gl_VertexIndex];
|
||||
vec3 pos = positions[vtx];
|
||||
uv = uvs[vtx];
|
||||
|
||||
pos.xy = ((pos.xy * quad.zw) + quad.xy) * zoom;
|
||||
pos.xy = (pos.xy * one_over_window_size) * 2.0 - 1.0;
|
||||
pos.y = -pos.y;
|
||||
|
||||
uv *= tex_quad.zw;
|
||||
uv += tex_quad.xy;
|
||||
|
||||
gl_Position = vec4(pos, 1);
|
||||
fs_colour = colour;
|
||||
}
|
||||
@end
|
||||
|
||||
@fs fs
|
||||
layout(binding=0) uniform texture2D tex;
|
||||
layout(binding=0) uniform sampler smp;
|
||||
in vec2 uv;
|
||||
in vec4 fs_colour;
|
||||
|
||||
out vec4 frag_colour;
|
||||
|
||||
void main() {
|
||||
vec4 c = texture(sampler2D(tex, smp), uv) * fs_colour;
|
||||
if (c.a < 1) discard;
|
||||
frag_colour = c;
|
||||
}
|
||||
@end
|
||||
|
||||
@program batcher vs fs
|
||||
BIN
data/font.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
data/metro.glb
|
|
@ -1,5 +1,5 @@
|
|||
@ctype mat4 HMM_Mat4
|
||||
@ctype vec3 HMM_Vec3
|
||||
@ctype mat4 mat4
|
||||
@ctype vec3 vec3
|
||||
|
||||
@vs vs
|
||||
layout(binding=0) uniform vs_params {
|
||||
|
|
|
|||
BIN
data/testino.glb
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 1,011 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 70 KiB |
|
|
@ -1,22 +0,0 @@
|
|||
@vs vs
|
||||
in vec4 position;
|
||||
in vec4 color0;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
void main() {
|
||||
gl_Position = position;
|
||||
color = color0;
|
||||
}
|
||||
@end
|
||||
|
||||
@fs fs
|
||||
in vec4 color;
|
||||
out vec4 frag_color;
|
||||
|
||||
void main() {
|
||||
frag_color = color;
|
||||
}
|
||||
@end
|
||||
|
||||
@program triangle vs fs
|
||||