3 static void shader_unlit_link(void);
4 static void shader_unlit_register(void);
5 static struct vg_shader _shader_unlit
= {
7 .link
= shader_unlit_link
,
10 .orig_file
= "../../shaders/standard.vs",
12 "layout (location=0) in vec3 a_co;\n"
13 "layout (location=1) in vec3 a_norm;\n"
14 "layout (location=2) in vec2 a_uv;\n"
15 "layout (location=3) in vec4 a_colour;\n"
16 "layout (location=4) in vec4 a_weights;\n"
17 "layout (location=5) in ivec4 a_groups;\n"
22 "uniform mat4x3 uMdl;\n"
28 "out vec3 aWorldCo;\n"
32 " vec3 world_pos = uMdl * vec4(a_co,1.0);\n"
33 " gl_Position = uPv * vec4( world_pos, 1.0 );\n"
34 " aColour = a_colour;\n"
36 " aNorm = mat3(uMdl) * a_norm;\n"
38 " aWorldCo = world_pos;\n"
43 .orig_file
= "../../shaders/unlit.fs",
45 "out vec4 FragColor;\n"
47 "uniform sampler2D uTexMain;\n"
48 "uniform vec4 uColour;\n"
57 " vec3 diffuse = texture( uTexMain, aUv ).rgb;\n"
58 " FragColor = vec4(pow(diffuse,vec3(1.0)),1.0);\n"
63 static GLuint _uniform_unlit_uPv
;
64 static GLuint _uniform_unlit_uMdl
;
65 static GLuint _uniform_unlit_uTexMain
;
66 static GLuint _uniform_unlit_uColour
;
67 static void shader_unlit_uPv(m4x4f m
){
68 glUniformMatrix4fv( _uniform_unlit_uPv
, 1, GL_FALSE
, (float *)m
);
70 static void shader_unlit_uMdl(m4x3f m
){
71 glUniformMatrix4x3fv( _uniform_unlit_uMdl
, 1, GL_FALSE
, (float *)m
);
73 static void shader_unlit_uTexMain(int i
){
74 glUniform1i( _uniform_unlit_uTexMain
, i
);
76 static void shader_unlit_uColour(v4f v
){
77 glUniform4fv( _uniform_unlit_uColour
, 1, v
);
79 static void shader_unlit_register(void){
80 vg_shader_register( &_shader_unlit
);
82 static void shader_unlit_use(void){ glUseProgram(_shader_unlit
.id
); }
83 static void shader_unlit_link(void){
84 _uniform_unlit_uPv
= glGetUniformLocation( _shader_unlit
.id
, "uPv" );
85 _uniform_unlit_uMdl
= glGetUniformLocation( _shader_unlit
.id
, "uMdl" );
86 _uniform_unlit_uTexMain
= glGetUniformLocation( _shader_unlit
.id
, "uTexMain" );
87 _uniform_unlit_uColour
= glGetUniformLocation( _shader_unlit
.id
, "uColour" );
89 #endif /* SHADER_unlit_H */