Refactor in C++

This commit is contained in:
Phireh 2023-10-15 18:28:20 +02:00
commit abdd19f5e5
445 changed files with 68766 additions and 36566 deletions

View file

@ -1,7 +1,7 @@
#version 330 core
in vec4 vertex_color;
out vec4 final_color;
uniform vec4 hex_color;
void main()
{
final_color = vertex_color;
final_color = hex_color;
}

10
shaders/hex.vert Normal file
View file

@ -0,0 +1,10 @@
#version 330 core
layout (location = 0) in vec3 pos;
uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;
void main()
{
gl_Position = proj * view * model * vec4(pos, 1.0f);
}

12
shaders/text.frag Normal file
View file

@ -0,0 +1,12 @@
#version 330 core
in vec2 texuv;
out vec4 color;
uniform sampler2D text;
uniform vec3 text_color;
void main()
{
vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, texuv).r);
color = vec4(text_color, 1.0) * sampled;
}

11
shaders/text.vert Normal file
View file

@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec4 vertex; // <vec2 pos, vec2 tex>
out vec2 texuv;
uniform mat4 projection;
void main()
{
gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);
texuv = vertex.zw;
}

View file

@ -1,20 +0,0 @@
#version 330 core
layout (location = 0) in vec3 pos;
uniform vec4 uniform_color;
uniform mat4 camera;
uniform vec2 window_size;
out vec4 vertex_color;
const mat4 to_draw_coordinates_matrix = mat4(
1., 0., 0., 0.,
0., -1., 0., 0.,
0., 0., 1., 0.,
-1, 1, 0, 1);
void main()
{
float aspect_ratio = window_size.x / window_size.y;
mat4 scaling_matrix = mat4(1.0);
scaling_matrix[1][1] = aspect_ratio;
gl_Position = camera*scaling_matrix*to_draw_coordinates_matrix*vec4(pos, 1.0f);
vertex_color = uniform_color;
}