mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-24 15:53:45 +02:00

PortableGL supports shaders, but requires them to be compiled ahead-of-time to C or C++. I'll write a compiler later to translate from GLSL to this format automatically at build time.
16 lines
610 B
C
16 lines
610 B
C
#include "flatColor.pgl.h"
|
|
|
|
void mkxpFlatColorVS(float *_output, pgl_vec4 *_attribs, Shader_Builtins *builtins, void *_uniforms)
|
|
{
|
|
struct FlatColorUniforms *uniforms = (struct FlatColorUniforms *)_uniforms;
|
|
struct FlatColorAttribs *attribs = (struct FlatColorAttribs *)_attribs;
|
|
|
|
builtins->gl_Position = mult_mat4_vec4(uniforms->projMat, (pgl_vec4){attribs->position.x, attribs->position.y, 0, 1});
|
|
}
|
|
|
|
void mkxpFlatColorFS(float *_input, Shader_Builtins *builtins, void *_uniforms)
|
|
{
|
|
struct FlatColorUniforms *uniforms = (struct FlatColorUniforms *)_uniforms;
|
|
|
|
builtins->gl_FragColor = uniforms->color;
|
|
}
|