diff options
Diffstat (limited to 'src/shaders')
-rw-r--r-- | src/shaders/common_header.h | 7 | ||||
-rw-r--r-- | src/shaders/default.c | 20 | ||||
-rw-r--r-- | src/shaders/unlit.c | 23 |
3 files changed, 50 insertions, 0 deletions
diff --git a/src/shaders/common_header.h b/src/shaders/common_header.h new file mode 100644 index 0000000..848fe98 --- /dev/null +++ b/src/shaders/common_header.h @@ -0,0 +1,7 @@ +#ifndef _SOFTSHADEROOM_COMMON_HEADER_H_ +#define _SOFTSHADEROOM_COMMON_HEADER_H_ + +#include "../core/shader.h" + + +#endif
\ No newline at end of file diff --git a/src/shaders/default.c b/src/shaders/default.c new file mode 100644 index 0000000..b1345e0 --- /dev/null +++ b/src/shaders/default.c @@ -0,0 +1,20 @@ +#include "common_header.h" + +/*uniforms*/ +#define lightdir UV3(0) +#define shinees UN(0) + +/*vertex output*/ +#define uv reg_v2_00 + +static void vert(UniformCollection* uniforms, VertexShaderIn* in, Vec4* homocoord) { + static Vec4 p; p.xyz = in->vertex->position; p.w = 1; + mat4_applytovec4(uniforms->mvp, &p, homocoord); +} + +static bool frag(UniformCollection* uniforms, FragmentShaderIn* in, Color* color) { + + return 1; +} + +Program ssr_built_in_shader_default = { vert, frag };
\ No newline at end of file diff --git a/src/shaders/unlit.c b/src/shaders/unlit.c new file mode 100644 index 0000000..ec6949f --- /dev/null +++ b/src/shaders/unlit.c @@ -0,0 +1,23 @@ +#include "common_header.h" + +#define model_matrix UM4(0) + +#define world_normal reg_v3_00 +#define vcolor reg_v4_00 + +static void vert(UniformCollection* uniforms, VertexShaderIn* in, Vec4* clipcoord) { + static Vec4 p; p.xyz = in->vertex->position; p.w = 1; + mat4_applytovec4(uniforms->mvp, &p, clipcoord); + model_matrix; +} + +static bool frag(UniformCollection* uniforms, FragmentShaderIn* in, Color* color) { + *color = in->color; + world_normal; + return 1; +} + +Program ssr_built_in_shader_unlit = { + vert, frag, + VARYING_COLOR +}; |