.log_source_info = 1,
.steam_api = 1,
.use_3d = 0,
- .custom_game_settings = 1
+ .custom_game_settings = 1,
+ .custom_shaders = 1
});
vg_add_source( proj, "marblecomp.c" );
_S( "post_darken", "post_darken.vs.glsl", "post_darken.fs.glsl" );
_S( "post_comp", "post_comp.vs.glsl", "post_comp.fs.glsl" );
_S( "post_blur", "post_blur.vs.glsl", "post_blur.fs.glsl" );
+
+ vg_build_shader_impl( "shaders/impl.c" );
}
#endif
#define VG_STEAM_APPID 1218140U
#define VG_FRAMEBUFFER_RESIZE 1
-#include "vg/vg.h"
+#include "vg/vg_engine.h"
enum world_button_mode
{
/* FIXME */
#define UI_GLYPH_SPACING_X 8
-void _mc_vg1_register(void){
- shader_tile_colour_register();
- shader_tile_main_register();
- shader_ball_register();
- shader_background_register();
- shader_wire_register();
- shader_button_register();
- shader_sprite_register();
- shader_post_darken_register();
- shader_post_comp_register();
- shader_post_blur_register();
-}
-
// TEXTURES
// ===========================================================================================================
VG_VAR_PERSISTENT );
vg_audio.always_keep_compressed = 1;
- _mc_vg1_register();
_mc_resource_load_main();
vg_bake_shaders();
vg_async_call( async_call_ready, NULL, 0 );
-#ifndef SHADER_background_H
-#define SHADER_background_H
-static void shader_background_link(void);
-static void shader_background_register(void);
-static struct vg_shader _shader_background = {
- .name = "background",
- .link = shader_background_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_background;
+extern GLuint _uniform_background_uPv;
+extern GLuint _uniform_background_uOffset;
+extern GLuint _uniform_background_uTexMain;
+extern GLuint _uniform_background_uSamplerNoise;
+extern GLuint _uniform_background_uVariance;
+extern GLuint _uniform_background_uVisibility;
+static inline void shader_background_uPv(m3x3f m)
{
-.orig_file = "shaders/background.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"uniform mat3 uPv;\n"
-"uniform vec3 uOffset;\n"
-"\n"
-"out vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec2 world_pos = a_co * uOffset.z + uOffset.xy;\n"
-" gl_Position = vec4( uPv * vec3( world_pos, 1.0 ), 1.0 );\n"
-" aTexCoords = a_co;\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/background.fs.glsl",
-.static_src =
-"out vec4 FragColor;\n"
-"\n"
-"uniform sampler2D uTexMain;\n"
-"uniform sampler2D uSamplerNoise;\n"
-"uniform float uVariance;\n"
-"uniform float uVisibility;\n"
-"\n"
-"in vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec4 data_this_tile = texture( uTexMain, aTexCoords );\n"
-"\n"
-" float ao_accum = 0.0;\n"
-" vec2 random_noise;\n"
-"\n"
-" for( int i=0; i<10; ++i ){\n"
-" random_noise = (texture( uSamplerNoise, \n"
-" aTexCoords*10.0 + float(i)*0.2 ).xy - vec2(0.5)) \n"
-" * uVariance;\n"
-" vec4 background = texture( uTexMain, aTexCoords + random_noise );\n"
-" float height_diff = min(data_this_tile.r - background.r,0.0);\n"
-" ao_accum += height_diff * clamp((1.0 - length( random_noise )), 0.0, 1.0);\n"
-" }\n"
-" ao_accum *= 0.15;\n"
-"\n"
-" vec2 square_coords = fract( aTexCoords * 64.0 );\n"
-" vec2 grid_coords = abs( square_coords - 0.5 );\n"
-" float gridline = step( 0.49, max(grid_coords.x,grid_coords.y) );\n"
-"\n"
-" vec3 colour_main = mix( vec3( 0.14 ) + random_noise.x*0.5, \n"
-" vec3( 0.1 ) + gridline*0.02, \n"
-" data_this_tile.g * uVisibility );\n"
-" FragColor = vec4( colour_main + ao_accum*0.05, 1.0 );\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_background_uPv;
-static GLuint _uniform_background_uOffset;
-static GLuint _uniform_background_uTexMain;
-static GLuint _uniform_background_uSamplerNoise;
-static GLuint _uniform_background_uVariance;
-static GLuint _uniform_background_uVisibility;
-static void shader_background_uPv(m3x3f m){
- glUniformMatrix3fv(_uniform_background_uPv,1,GL_FALSE,(float*)m);
+ glUniformMatrix3fv(_uniform_background_uPv,1,GL_FALSE,(f32*)m);
}
-static void shader_background_uOffset(v3f v){
+static inline void shader_background_uOffset(v3f v)
+{
glUniform3fv(_uniform_background_uOffset,1,v);
}
-static void shader_background_uTexMain(int i){
+static inline void shader_background_uTexMain(int i)
+{
glUniform1i(_uniform_background_uTexMain,i);
}
-static void shader_background_uSamplerNoise(int i){
+static inline void shader_background_uSamplerNoise(int i)
+{
glUniform1i(_uniform_background_uSamplerNoise,i);
}
-static void shader_background_uVariance(float f){
+static inline void shader_background_uVariance(f32 f)
+{
glUniform1f(_uniform_background_uVariance,f);
}
-static void shader_background_uVisibility(float f){
+static inline void shader_background_uVisibility(f32 f)
+{
glUniform1f(_uniform_background_uVisibility,f);
}
-static void shader_background_register(void){
- vg_shader_register( &_shader_background );
-}
-static void shader_background_use(void){ glUseProgram(_shader_background.id); }
-static void shader_background_link(void){
- _uniform_background_uPv = glGetUniformLocation( _shader_background.id, "uPv" );
- _uniform_background_uOffset = glGetUniformLocation( _shader_background.id, "uOffset" );
- _uniform_background_uTexMain = glGetUniformLocation( _shader_background.id, "uTexMain" );
- _uniform_background_uSamplerNoise = glGetUniformLocation( _shader_background.id, "uSamplerNoise" );
- _uniform_background_uVariance = glGetUniformLocation( _shader_background.id, "uVariance" );
- _uniform_background_uVisibility = glGetUniformLocation( _shader_background.id, "uVisibility" );
+static inline void shader_background_use(void);
+static inline void shader_background_use(void)
+{
+ glUseProgram(_shader_background.id);
}
-#endif /* SHADER_background_H */
-#ifndef SHADER_ball_H
-#define SHADER_ball_H
-static void shader_ball_link(void);
-static void shader_ball_register(void);
-static struct vg_shader _shader_ball = {
- .name = "ball",
- .link = shader_ball_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_ball;
+extern GLuint _uniform_ball_uOffset;
+extern GLuint _uniform_ball_uPv;
+extern GLuint _uniform_ball_uTexMain;
+extern GLuint _uniform_ball_uColour;
+extern GLuint _uniform_ball_uTexOffset;
+static inline void shader_ball_uOffset(v3f v)
{
-.orig_file = "shaders/ball.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"uniform vec3 uOffset;\n"
-"uniform mat3 uPv;\n"
-"\n"
-"out vec4 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" // Vertex transform\n"
-" vec3 worldpos = vec3( (a_co * 0.5 - 0.25) * uOffset.z + uOffset.xy, 1.0 );\n"
-" gl_Position = vec4( uPv * worldpos, 1.0 );\n"
-"\n"
-" // Create texture coords\n"
-" aTexCoords = vec4( a_co, worldpos.xy );\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/ball.fs.glsl",
-.static_src =
-"out vec4 FragColor;\n"
-"\n"
-"uniform sampler2D uTexMain;\n"
-"uniform vec3 uColour;\n"
-"uniform vec2 uTexOffset;\n"
-"\n"
-"in vec4 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec2 center_coords = aTexCoords.xy - 0.5;\n"
-" vec2 center_coords_sqr = center_coords*center_coords;\n"
-" float circle_factor = smoothstep( 0.07, 0.0625, \n"
-" center_coords_sqr.x+center_coords_sqr.y );\n"
-" \n"
-" float bulge_amt = center_coords_sqr.x+center_coords_sqr.y;\n"
-" vec2 warped_coords = aTexCoords.zw+uTexOffset - center_coords;\n"
-" vec4 noise_sample = texture( uTexMain, warped_coords );\n"
-" \n"
-" float rim_light = (center_coords_sqr.x+center_coords_sqr.y)*15.0;\n"
-" \n"
-" vec2 shadow_coords = center_coords + vec2(0.02,0.07);\n"
-" vec2 shadow_coords_sqr = shadow_coords*shadow_coords;\n"
-" float shadow = exp(-((shadow_coords_sqr.x+shadow_coords_sqr.y)-0.0125)*15.0);\n"
-" \n"
-" vec3 marble_comp = uColour*0.6 + \n"
-" (noise_sample.x*2.7+pow(rim_light,3.0)*2.0) * 0.1;\n"
-" vec4 colour_comp = mix( vec4(0.0,0.0,0.0,shadow), \n"
-" vec4(marble_comp,1.0), circle_factor );\n"
-" FragColor = colour_comp;\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_ball_uOffset;
-static GLuint _uniform_ball_uPv;
-static GLuint _uniform_ball_uTexMain;
-static GLuint _uniform_ball_uColour;
-static GLuint _uniform_ball_uTexOffset;
-static void shader_ball_uOffset(v3f v){
glUniform3fv(_uniform_ball_uOffset,1,v);
}
-static void shader_ball_uPv(m3x3f m){
- glUniformMatrix3fv(_uniform_ball_uPv,1,GL_FALSE,(float*)m);
+static inline void shader_ball_uPv(m3x3f m)
+{
+ glUniformMatrix3fv(_uniform_ball_uPv,1,GL_FALSE,(f32*)m);
}
-static void shader_ball_uTexMain(int i){
+static inline void shader_ball_uTexMain(int i)
+{
glUniform1i(_uniform_ball_uTexMain,i);
}
-static void shader_ball_uColour(v3f v){
+static inline void shader_ball_uColour(v3f v)
+{
glUniform3fv(_uniform_ball_uColour,1,v);
}
-static void shader_ball_uTexOffset(v2f v){
+static inline void shader_ball_uTexOffset(v2f v)
+{
glUniform2fv(_uniform_ball_uTexOffset,1,v);
}
-static void shader_ball_register(void){
- vg_shader_register( &_shader_ball );
-}
-static void shader_ball_use(void){ glUseProgram(_shader_ball.id); }
-static void shader_ball_link(void){
- _uniform_ball_uOffset = glGetUniformLocation( _shader_ball.id, "uOffset" );
- _uniform_ball_uPv = glGetUniformLocation( _shader_ball.id, "uPv" );
- _uniform_ball_uTexMain = glGetUniformLocation( _shader_ball.id, "uTexMain" );
- _uniform_ball_uColour = glGetUniformLocation( _shader_ball.id, "uColour" );
- _uniform_ball_uTexOffset = glGetUniformLocation( _shader_ball.id, "uTexOffset" );
+static inline void shader_ball_use(void);
+static inline void shader_ball_use(void)
+{
+ glUseProgram(_shader_ball.id);
}
-#endif /* SHADER_ball_H */
-#ifndef SHADER_button_H
-#define SHADER_button_H
-static void shader_button_link(void);
-static void shader_button_register(void);
-static struct vg_shader _shader_button = {
- .name = "button",
- .link = shader_button_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_button;
+extern GLuint _uniform_button_uOffset;
+extern GLuint _uniform_button_uPv;
+extern GLuint _uniform_button_uTexMain;
+extern GLuint _uniform_button_uColour;
+static inline void shader_button_uOffset(v4f v)
{
-.orig_file = "shaders/button.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"uniform vec4 uOffset; // Tile x/y, uv x/y\n"
-"uniform mat3 uPv;\n"
-"\n"
-"out vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" // Vertex transform\n"
-" vec3 worldpos = vec3( a_co + uOffset.xy, 1.0 );\n"
-" gl_Position = vec4( uPv * worldpos, 1.0 );\n"
-"\n"
-" // Create texture coords\n"
-" vec2 edge_safe_coords = a_co * 0.98 + 0.01;\n"
-" vec2 tex_uv = (edge_safe_coords + uOffset.zw) * 0.25;\n"
-" tex_uv = vec2( tex_uv.x, 1.0-tex_uv.y );\n"
-" aTexCoords = tex_uv;\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/button.fs.glsl",
-.static_src =
-"out vec4 FragColor;\n"
-"\n"
-"uniform sampler2D uTexMain;\n"
-"uniform vec4 uColour; // rgb, light amount\n"
-"\n"
-"in vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec4 glyph = texture( uTexMain, aTexCoords.xy );\n"
-" \n"
-" FragColor = vec4( uColour.rgb * \n"
-" (mix(glyph.r,glyph.g,uColour.a)+0.02)*2.6 + glyph.b * 0.4, \n"
-" glyph.a );\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_button_uOffset;
-static GLuint _uniform_button_uPv;
-static GLuint _uniform_button_uTexMain;
-static GLuint _uniform_button_uColour;
-static void shader_button_uOffset(v4f v){
glUniform4fv(_uniform_button_uOffset,1,v);
}
-static void shader_button_uPv(m3x3f m){
- glUniformMatrix3fv(_uniform_button_uPv,1,GL_FALSE,(float*)m);
+static inline void shader_button_uPv(m3x3f m)
+{
+ glUniformMatrix3fv(_uniform_button_uPv,1,GL_FALSE,(f32*)m);
}
-static void shader_button_uTexMain(int i){
+static inline void shader_button_uTexMain(int i)
+{
glUniform1i(_uniform_button_uTexMain,i);
}
-static void shader_button_uColour(v4f v){
+static inline void shader_button_uColour(v4f v)
+{
glUniform4fv(_uniform_button_uColour,1,v);
}
-static void shader_button_register(void){
- vg_shader_register( &_shader_button );
-}
-static void shader_button_use(void){ glUseProgram(_shader_button.id); }
-static void shader_button_link(void){
- _uniform_button_uOffset = glGetUniformLocation( _shader_button.id, "uOffset" );
- _uniform_button_uPv = glGetUniformLocation( _shader_button.id, "uPv" );
- _uniform_button_uTexMain = glGetUniformLocation( _shader_button.id, "uTexMain" );
- _uniform_button_uColour = glGetUniformLocation( _shader_button.id, "uColour" );
+static inline void shader_button_use(void);
+static inline void shader_button_use(void)
+{
+ glUseProgram(_shader_button.id);
}
-#endif /* SHADER_button_H */
--- /dev/null
+#include "shaders/tile_colour.h"
+struct vg_shader _shader_tile_colour = {
+ .name = "tile_colour",
+ .vs =
+{
+.orig_file = "shaders/tile_colour.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"uniform mat3 uPv;\n"
+"uniform vec3 uOffset;\n"
+"\n"
+"void main(){\n"
+" gl_Position = vec4( uPv * vec3( a_co * uOffset.z + uOffset.xy, 1.0 ), 1.0 );\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/tile_colour.fs.glsl",
+.static_src =
+"out vec4 FragColor;\n"
+"uniform vec4 uColour;\n"
+"void main(){\n"
+" FragColor = uColour;\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_tile_colour_uPv;
+GLuint _uniform_tile_colour_uOffset;
+GLuint _uniform_tile_colour_uColour;
+#include "shaders/tile_main.h"
+struct vg_shader _shader_tile_main = {
+ .name = "tile_main",
+ .vs =
+{
+.orig_file = "shaders/tile_main.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"uniform vec4 uOffset; // Tile x/y, uv x/y\n"
+"uniform mat3 uPv;\n"
+"uniform mat2 uSubTransform;\n"
+"uniform float uVisibility;\n"
+"\n"
+"out vec4 aTexCoords;\n"
+"out vec2 aWorldCoords;\n"
+"\n"
+"vec2 hash22(vec2 p){\n"
+" vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));\n"
+" p3 += dot(p3, p3.yzx+33.33);\n"
+" return fract((p3.xx+p3.yz)*p3.zy);\n"
+"}\n"
+"\n"
+"void main(){\n"
+" vec2 hash_val = hash22(uOffset.xy);\n"
+" float scaling_factor = smoothstep( hash_val.x, hash_val.x+1.0, uVisibility );\n"
+"\n"
+" // Vertex transform\n"
+" vec2 subtransform = uSubTransform * (a_co-0.5) * scaling_factor + 0.5;\n"
+" vec3 worldpos = vec3( subtransform + uOffset.xy, 1.0 );\n"
+" gl_Position = vec4( uPv * worldpos, 1.0 );\n"
+"\n"
+" // Create texture coords\n"
+" vec2 random_offset = floor(hash_val * 4.0) * 0.25;\n"
+" vec2 edge_safe_coords = a_co * 0.98 + 0.01;\n"
+" vec2 tex_uv = (edge_safe_coords + uOffset.zw) * 0.25;\n"
+" tex_uv = vec2( tex_uv.x, 1.0-tex_uv.y );\n"
+" aTexCoords = vec4( tex_uv, edge_safe_coords * 0.25 + random_offset );\n"
+" aWorldCoords = worldpos.xy; \n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/tile_main.fs.glsl",
+.static_src =
+"out vec4 FragColor;\n"
+"\n"
+"uniform sampler2D uTexGlyphs;\n"
+"uniform sampler2D uTexGlow;\n"
+"uniform sampler2D uTexWood;\n"
+"uniform float uGhost;\n"
+"uniform float uForeground;\n"
+"uniform vec2 uMousePos;\n"
+"uniform vec4 uColour;\n"
+"uniform vec3 uShadowing;\n"
+"uniform vec3 uGlowA;\n"
+"uniform vec3 uGlowB;\n"
+"\n"
+"in vec4 aTexCoords;\n"
+"in vec2 aWorldCoords;\n"
+"\n"
+"void main(){\n"
+" vec4 glyph = texture( uTexGlyphs, aTexCoords.xy );\n"
+" vec4 glyph_glow = texture( uTexGlow, aTexCoords.xy );\n"
+" vec4 wood = texture( uTexWood, aTexCoords.zw );\n"
+" vec4 wood_secondary = texture( uTexWood, aTexCoords.zw + 0.25 );\n"
+" vec3 wood_comp = mix( wood_secondary.rgb * uShadowing, \n"
+" wood.rgb, clamp( glyph.b*2.0-1.0, 0.0, 1.0 ) );\n"
+" \n"
+" vec3 shadows = mix( uShadowing, vec3(1.0,1.0,1.0), glyph.r );\n"
+" vec4 output_regular = vec4( wood_comp * shadows, \n"
+" mix( glyph.a, glyph.b, uForeground ) );\n"
+" \n"
+" float ghost_dist = clamp( 1.5-distance(uMousePos, aWorldCoords), 0.0, 1.0 );\n"
+" vec4 output_ghost = vec4( 1.0, 1.0, 1.0, glyph.g*ghost_dist );\n"
+" vec4 glow_comp = vec4(glyph_glow.b*uGlowA+glyph_glow.g*uGlowB,0.0);\n"
+" \n"
+" FragColor = mix( output_regular, output_ghost, uGhost )*uColour + glow_comp;\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_tile_main_uOffset;
+GLuint _uniform_tile_main_uPv;
+GLuint _uniform_tile_main_uSubTransform;
+GLuint _uniform_tile_main_uVisibility;
+GLuint _uniform_tile_main_uTexGlyphs;
+GLuint _uniform_tile_main_uTexGlow;
+GLuint _uniform_tile_main_uTexWood;
+GLuint _uniform_tile_main_uGhost;
+GLuint _uniform_tile_main_uForeground;
+GLuint _uniform_tile_main_uMousePos;
+GLuint _uniform_tile_main_uColour;
+GLuint _uniform_tile_main_uShadowing;
+GLuint _uniform_tile_main_uGlowA;
+GLuint _uniform_tile_main_uGlowB;
+#include "shaders/ball.h"
+struct vg_shader _shader_ball = {
+ .name = "ball",
+ .vs =
+{
+.orig_file = "shaders/ball.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"uniform vec3 uOffset;\n"
+"uniform mat3 uPv;\n"
+"\n"
+"out vec4 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" // Vertex transform\n"
+" vec3 worldpos = vec3( (a_co * 0.5 - 0.25) * uOffset.z + uOffset.xy, 1.0 );\n"
+" gl_Position = vec4( uPv * worldpos, 1.0 );\n"
+"\n"
+" // Create texture coords\n"
+" aTexCoords = vec4( a_co, worldpos.xy );\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/ball.fs.glsl",
+.static_src =
+"out vec4 FragColor;\n"
+"\n"
+"uniform sampler2D uTexMain;\n"
+"uniform vec3 uColour;\n"
+"uniform vec2 uTexOffset;\n"
+"\n"
+"in vec4 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec2 center_coords = aTexCoords.xy - 0.5;\n"
+" vec2 center_coords_sqr = center_coords*center_coords;\n"
+" float circle_factor = smoothstep( 0.07, 0.0625, \n"
+" center_coords_sqr.x+center_coords_sqr.y );\n"
+" \n"
+" float bulge_amt = center_coords_sqr.x+center_coords_sqr.y;\n"
+" vec2 warped_coords = aTexCoords.zw+uTexOffset - center_coords;\n"
+" vec4 noise_sample = texture( uTexMain, warped_coords );\n"
+" \n"
+" float rim_light = (center_coords_sqr.x+center_coords_sqr.y)*15.0;\n"
+" \n"
+" vec2 shadow_coords = center_coords + vec2(0.02,0.07);\n"
+" vec2 shadow_coords_sqr = shadow_coords*shadow_coords;\n"
+" float shadow = exp(-((shadow_coords_sqr.x+shadow_coords_sqr.y)-0.0125)*15.0);\n"
+" \n"
+" vec3 marble_comp = uColour*0.6 + \n"
+" (noise_sample.x*2.7+pow(rim_light,3.0)*2.0) * 0.1;\n"
+" vec4 colour_comp = mix( vec4(0.0,0.0,0.0,shadow), \n"
+" vec4(marble_comp,1.0), circle_factor );\n"
+" FragColor = colour_comp;\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_ball_uOffset;
+GLuint _uniform_ball_uPv;
+GLuint _uniform_ball_uTexMain;
+GLuint _uniform_ball_uColour;
+GLuint _uniform_ball_uTexOffset;
+#include "shaders/background.h"
+struct vg_shader _shader_background = {
+ .name = "background",
+ .vs =
+{
+.orig_file = "shaders/background.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"uniform mat3 uPv;\n"
+"uniform vec3 uOffset;\n"
+"\n"
+"out vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec2 world_pos = a_co * uOffset.z + uOffset.xy;\n"
+" gl_Position = vec4( uPv * vec3( world_pos, 1.0 ), 1.0 );\n"
+" aTexCoords = a_co;\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/background.fs.glsl",
+.static_src =
+"out vec4 FragColor;\n"
+"\n"
+"uniform sampler2D uTexMain;\n"
+"uniform sampler2D uSamplerNoise;\n"
+"uniform float uVariance;\n"
+"uniform float uVisibility;\n"
+"\n"
+"in vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec4 data_this_tile = texture( uTexMain, aTexCoords );\n"
+"\n"
+" float ao_accum = 0.0;\n"
+" vec2 random_noise;\n"
+"\n"
+" for( int i=0; i<10; ++i ){\n"
+" random_noise = (texture( uSamplerNoise, \n"
+" aTexCoords*10.0 + float(i)*0.2 ).xy - vec2(0.5)) \n"
+" * uVariance;\n"
+" vec4 background = texture( uTexMain, aTexCoords + random_noise );\n"
+" float height_diff = min(data_this_tile.r - background.r,0.0);\n"
+" ao_accum += height_diff * clamp((1.0 - length( random_noise )), 0.0, 1.0);\n"
+" }\n"
+" ao_accum *= 0.15;\n"
+"\n"
+" vec2 square_coords = fract( aTexCoords * 64.0 );\n"
+" vec2 grid_coords = abs( square_coords - 0.5 );\n"
+" float gridline = step( 0.49, max(grid_coords.x,grid_coords.y) );\n"
+"\n"
+" vec3 colour_main = mix( vec3( 0.14 ) + random_noise.x*0.5, \n"
+" vec3( 0.1 ) + gridline*0.02, \n"
+" data_this_tile.g * uVisibility );\n"
+" FragColor = vec4( colour_main + ao_accum*0.05, 1.0 );\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_background_uPv;
+GLuint _uniform_background_uOffset;
+GLuint _uniform_background_uTexMain;
+GLuint _uniform_background_uSamplerNoise;
+GLuint _uniform_background_uVariance;
+GLuint _uniform_background_uVisibility;
+#include "shaders/wire.h"
+struct vg_shader _shader_wire = {
+ .name = "wire",
+ .vs =
+{
+.orig_file = "shaders/wire.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"uniform vec3 uStart;\n"
+"uniform vec3 uEnd;\n"
+"uniform mat3 uPv;\n"
+"uniform float uCurve;\n"
+"\n"
+"out vec2 aTexCoords;\n"
+"\n"
+"vec3 sample_curve_time( float t ){\n"
+" vec3 line_coord = mix( uStart, uEnd, t );\n"
+"\n"
+" float curve_amt = 1.0-(pow((t*2.0-1.0),2.0));\n"
+" return vec3( line_coord.x, line_coord.y - curve_amt*uCurve, line_coord.z );\n"
+"}\n"
+"\n"
+"void main(){\n"
+" // Vertex transform\n"
+" vec3 p0 = sample_curve_time( a_co.x );\n"
+" vec3 p1 = sample_curve_time( a_co.x + 0.025 );\n"
+" \n"
+" vec2 line_tangent = normalize(p1.xy-p0.xy);\n"
+" vec2 line_normal = vec2( -line_tangent.y, line_tangent.x );\n"
+" \n"
+" vec2 worldfinal = p0.xy + line_normal*a_co.y*p0.z;\n"
+" \n"
+" gl_Position = vec4( uPv * vec3(worldfinal, 1.0), 1.0 );\n"
+"\n"
+" // Create texture coords (todo: include stretch adjusted coords?)\n"
+" aTexCoords = vec2( a_co.x, a_co.y + 0.5 );\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/wire.fs.glsl",
+.static_src =
+"out vec4 FragColor;\n"
+"\n"
+"uniform sampler2D uTexMain;\n"
+"uniform vec4 uColour;\n"
+"uniform float uTime;\n"
+"uniform float uGlow;\n"
+"\n"
+"in vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" // Compute shadowing\n"
+" float shadow = 1.0 - abs(aTexCoords.y - 0.5) * 2.0;\n"
+" float masking = smoothstep( 0.5, 0.8, shadow );\n"
+" \n"
+" vec3 colour_comp = mix( vec3(0.0,0.0,0.0), uColour.rgb, masking );\n"
+" \n"
+" float flow_thing = fract( aTexCoords.x + uTime );\n"
+" vec3 final_comp = colour_comp + flow_thing * uGlow;\n"
+" \n"
+" FragColor = vec4( final_comp, max( shadow* 0.2, masking ) * uColour.a );\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_wire_uStart;
+GLuint _uniform_wire_uEnd;
+GLuint _uniform_wire_uPv;
+GLuint _uniform_wire_uCurve;
+GLuint _uniform_wire_uTexMain;
+GLuint _uniform_wire_uColour;
+GLuint _uniform_wire_uTime;
+GLuint _uniform_wire_uGlow;
+#include "shaders/button.h"
+struct vg_shader _shader_button = {
+ .name = "button",
+ .vs =
+{
+.orig_file = "shaders/button.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"uniform vec4 uOffset; // Tile x/y, uv x/y\n"
+"uniform mat3 uPv;\n"
+"\n"
+"out vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" // Vertex transform\n"
+" vec3 worldpos = vec3( a_co + uOffset.xy, 1.0 );\n"
+" gl_Position = vec4( uPv * worldpos, 1.0 );\n"
+"\n"
+" // Create texture coords\n"
+" vec2 edge_safe_coords = a_co * 0.98 + 0.01;\n"
+" vec2 tex_uv = (edge_safe_coords + uOffset.zw) * 0.25;\n"
+" tex_uv = vec2( tex_uv.x, 1.0-tex_uv.y );\n"
+" aTexCoords = tex_uv;\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/button.fs.glsl",
+.static_src =
+"out vec4 FragColor;\n"
+"\n"
+"uniform sampler2D uTexMain;\n"
+"uniform vec4 uColour; // rgb, light amount\n"
+"\n"
+"in vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec4 glyph = texture( uTexMain, aTexCoords.xy );\n"
+" \n"
+" FragColor = vec4( uColour.rgb * \n"
+" (mix(glyph.r,glyph.g,uColour.a)+0.02)*2.6 + glyph.b * 0.4, \n"
+" glyph.a );\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_button_uOffset;
+GLuint _uniform_button_uPv;
+GLuint _uniform_button_uTexMain;
+GLuint _uniform_button_uColour;
+#include "shaders/sprite.h"
+struct vg_shader _shader_sprite = {
+ .name = "sprite",
+ .vs =
+{
+.orig_file = "shaders/sprite.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co; // quad mesh\n"
+"uniform vec4 uUv;\n"
+"uniform vec3 uPos;\n"
+"\n"
+"uniform mat3 uPv;\n"
+"\n"
+"out vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec2 vertex_world = uUv.zw * (a_co-0.5) * uPos.z + uPos.xy;\n"
+" gl_Position = vec4( uPv * vec3( vertex_world, 1.0 ), 1.0 );\n"
+" aTexCoords = uUv.xy + a_co*uUv.zw;\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/sprite.fs.glsl",
+.static_src =
+"uniform sampler2D uTexMain;\n"
+"out vec4 FragColor;\n"
+"\n"
+"in vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec4 texture_sample = texture( uTexMain, aTexCoords );\n"
+" FragColor = texture_sample;\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_sprite_uUv;
+GLuint _uniform_sprite_uPos;
+GLuint _uniform_sprite_uPv;
+GLuint _uniform_sprite_uTexMain;
+#include "shaders/post_darken.h"
+struct vg_shader _shader_post_darken = {
+ .name = "post_darken",
+ .vs =
+{
+.orig_file = "shaders/post_darken.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"out vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );\n"
+" aTexCoords = a_co;\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/post_darken.fs.glsl",
+.static_src =
+"uniform sampler2D uTexMain;\n"
+"out vec4 FragColor;\n"
+"\n"
+"in vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec4 texture_sample = texture( uTexMain, aTexCoords );\n"
+" FragColor = vec4(pow(texture_sample.rgb,vec3(2.2)), 1.0);\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_post_darken_uTexMain;
+#include "shaders/post_comp.h"
+struct vg_shader _shader_post_comp = {
+ .name = "post_comp",
+ .vs =
+{
+.orig_file = "shaders/post_comp.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"out vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );\n"
+" aTexCoords = a_co;\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/post_comp.fs.glsl",
+.static_src =
+"uniform sampler2D uTexMain;\n"
+"uniform sampler2D uTexBloom;\n"
+"uniform vec2 uComp; /* x: bloom, y: vignette */\n"
+"out vec4 FragColor;\n"
+"\n"
+"in vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec4 texture_sample = texture( uTexMain, aTexCoords );\n"
+" vec4 bloom_sample = texture( uTexBloom, aTexCoords );\n"
+" \n"
+" vec2 vigCoord = aTexCoords - 0.5;\n"
+" float vig = pow(1.0 - dot( vigCoord, vigCoord ), 2.0);\n"
+" \n"
+" FragColor = (texture_sample + bloom_sample*0.3*uComp.x)\n"
+" * max(uComp.y, vig);\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_post_comp_uTexMain;
+GLuint _uniform_post_comp_uTexBloom;
+GLuint _uniform_post_comp_uComp;
+#include "shaders/post_blur.h"
+struct vg_shader _shader_post_blur = {
+ .name = "post_blur",
+ .vs =
+{
+.orig_file = "shaders/post_blur.vs.glsl",
+.static_src =
+"layout (location=0) in vec2 a_co;\n"
+"out vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );\n"
+" aTexCoords = a_co;\n"
+"}\n"
+""},
+ .fs =
+{
+.orig_file = "shaders/post_blur.fs.glsl",
+.static_src =
+"uniform sampler2D uTexMain;\n"
+"uniform vec2 uDir;\n"
+"out vec4 FragColor;\n"
+"\n"
+"in vec2 aTexCoords;\n"
+"\n"
+"void main(){\n"
+" vec4 colour = vec4(0.0);\n"
+"\n"
+" vec2 off1 = vec2(1.411764705882353) * uDir;\n"
+" vec2 off2 = vec2(3.2941176470588234) * uDir;\n"
+" vec2 off3 = vec2(5.176470588235294) * uDir;\n"
+" colour += texture2D( uTexMain, aTexCoords ) * 0.1964825501511404;\n"
+" colour += texture2D( uTexMain, aTexCoords + off1 ) * 0.2969069646728344;\n"
+" colour += texture2D( uTexMain, aTexCoords - off1 ) * 0.2969069646728344;\n"
+" colour += texture2D( uTexMain, aTexCoords + off2 ) * 0.09447039785044732;\n"
+" colour += texture2D( uTexMain, aTexCoords - off2 ) * 0.09447039785044732;\n"
+" colour += texture2D( uTexMain, aTexCoords + off3 ) * 0.010381362401148057;\n"
+" colour += texture2D( uTexMain, aTexCoords - off3 ) * 0.010381362401148057;\n"
+" FragColor = colour;\n"
+"}\n"
+""},
+};
+
+GLuint _uniform_post_blur_uTexMain;
+GLuint _uniform_post_blur_uDir;
+
+
+void vg_auto_shader_link(void)
+{
+ _uniform_tile_colour_uPv = glGetUniformLocation( _shader_tile_colour.id, "uPv" );
+ _uniform_tile_colour_uOffset = glGetUniformLocation( _shader_tile_colour.id, "uOffset" );
+ _uniform_tile_colour_uColour = glGetUniformLocation( _shader_tile_colour.id, "uColour" );
+ _uniform_tile_main_uOffset = glGetUniformLocation( _shader_tile_main.id, "uOffset" );
+ _uniform_tile_main_uPv = glGetUniformLocation( _shader_tile_main.id, "uPv" );
+ _uniform_tile_main_uSubTransform = glGetUniformLocation( _shader_tile_main.id, "uSubTransform" );
+ _uniform_tile_main_uVisibility = glGetUniformLocation( _shader_tile_main.id, "uVisibility" );
+ _uniform_tile_main_uTexGlyphs = glGetUniformLocation( _shader_tile_main.id, "uTexGlyphs" );
+ _uniform_tile_main_uTexGlow = glGetUniformLocation( _shader_tile_main.id, "uTexGlow" );
+ _uniform_tile_main_uTexWood = glGetUniformLocation( _shader_tile_main.id, "uTexWood" );
+ _uniform_tile_main_uGhost = glGetUniformLocation( _shader_tile_main.id, "uGhost" );
+ _uniform_tile_main_uForeground = glGetUniformLocation( _shader_tile_main.id, "uForeground" );
+ _uniform_tile_main_uMousePos = glGetUniformLocation( _shader_tile_main.id, "uMousePos" );
+ _uniform_tile_main_uColour = glGetUniformLocation( _shader_tile_main.id, "uColour" );
+ _uniform_tile_main_uShadowing = glGetUniformLocation( _shader_tile_main.id, "uShadowing" );
+ _uniform_tile_main_uGlowA = glGetUniformLocation( _shader_tile_main.id, "uGlowA" );
+ _uniform_tile_main_uGlowB = glGetUniformLocation( _shader_tile_main.id, "uGlowB" );
+ _uniform_ball_uOffset = glGetUniformLocation( _shader_ball.id, "uOffset" );
+ _uniform_ball_uPv = glGetUniformLocation( _shader_ball.id, "uPv" );
+ _uniform_ball_uTexMain = glGetUniformLocation( _shader_ball.id, "uTexMain" );
+ _uniform_ball_uColour = glGetUniformLocation( _shader_ball.id, "uColour" );
+ _uniform_ball_uTexOffset = glGetUniformLocation( _shader_ball.id, "uTexOffset" );
+ _uniform_background_uPv = glGetUniformLocation( _shader_background.id, "uPv" );
+ _uniform_background_uOffset = glGetUniformLocation( _shader_background.id, "uOffset" );
+ _uniform_background_uTexMain = glGetUniformLocation( _shader_background.id, "uTexMain" );
+ _uniform_background_uSamplerNoise = glGetUniformLocation( _shader_background.id, "uSamplerNoise" );
+ _uniform_background_uVariance = glGetUniformLocation( _shader_background.id, "uVariance" );
+ _uniform_background_uVisibility = glGetUniformLocation( _shader_background.id, "uVisibility" );
+ _uniform_wire_uStart = glGetUniformLocation( _shader_wire.id, "uStart" );
+ _uniform_wire_uEnd = glGetUniformLocation( _shader_wire.id, "uEnd" );
+ _uniform_wire_uPv = glGetUniformLocation( _shader_wire.id, "uPv" );
+ _uniform_wire_uCurve = glGetUniformLocation( _shader_wire.id, "uCurve" );
+ _uniform_wire_uTexMain = glGetUniformLocation( _shader_wire.id, "uTexMain" );
+ _uniform_wire_uColour = glGetUniformLocation( _shader_wire.id, "uColour" );
+ _uniform_wire_uTime = glGetUniformLocation( _shader_wire.id, "uTime" );
+ _uniform_wire_uGlow = glGetUniformLocation( _shader_wire.id, "uGlow" );
+ _uniform_button_uOffset = glGetUniformLocation( _shader_button.id, "uOffset" );
+ _uniform_button_uPv = glGetUniformLocation( _shader_button.id, "uPv" );
+ _uniform_button_uTexMain = glGetUniformLocation( _shader_button.id, "uTexMain" );
+ _uniform_button_uColour = glGetUniformLocation( _shader_button.id, "uColour" );
+ _uniform_sprite_uUv = glGetUniformLocation( _shader_sprite.id, "uUv" );
+ _uniform_sprite_uPos = glGetUniformLocation( _shader_sprite.id, "uPos" );
+ _uniform_sprite_uPv = glGetUniformLocation( _shader_sprite.id, "uPv" );
+ _uniform_sprite_uTexMain = glGetUniformLocation( _shader_sprite.id, "uTexMain" );
+ _uniform_post_darken_uTexMain = glGetUniformLocation( _shader_post_darken.id, "uTexMain" );
+ _uniform_post_comp_uTexMain = glGetUniformLocation( _shader_post_comp.id, "uTexMain" );
+ _uniform_post_comp_uTexBloom = glGetUniformLocation( _shader_post_comp.id, "uTexBloom" );
+ _uniform_post_comp_uComp = glGetUniformLocation( _shader_post_comp.id, "uComp" );
+ _uniform_post_blur_uTexMain = glGetUniformLocation( _shader_post_blur.id, "uTexMain" );
+ _uniform_post_blur_uDir = glGetUniformLocation( _shader_post_blur.id, "uDir" );
+}
+
+void vg_auto_shader_register(void)
+{
+ vg_shader_register( &_shader_tile_colour );
+ vg_shader_register( &_shader_tile_main );
+ vg_shader_register( &_shader_ball );
+ vg_shader_register( &_shader_background );
+ vg_shader_register( &_shader_wire );
+ vg_shader_register( &_shader_button );
+ vg_shader_register( &_shader_sprite );
+ vg_shader_register( &_shader_post_darken );
+ vg_shader_register( &_shader_post_comp );
+ vg_shader_register( &_shader_post_blur );
+}
+
-#ifndef SHADER_post_blur_H
-#define SHADER_post_blur_H
-static void shader_post_blur_link(void);
-static void shader_post_blur_register(void);
-static struct vg_shader _shader_post_blur = {
- .name = "post_blur",
- .link = shader_post_blur_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_post_blur;
+extern GLuint _uniform_post_blur_uTexMain;
+extern GLuint _uniform_post_blur_uDir;
+static inline void shader_post_blur_uTexMain(int i)
{
-.orig_file = "shaders/post_blur.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"out vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );\n"
-" aTexCoords = a_co;\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/post_blur.fs.glsl",
-.static_src =
-"uniform sampler2D uTexMain;\n"
-"uniform vec2 uDir;\n"
-"out vec4 FragColor;\n"
-"\n"
-"in vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec4 colour = vec4(0.0);\n"
-"\n"
-" vec2 off1 = vec2(1.411764705882353) * uDir;\n"
-" vec2 off2 = vec2(3.2941176470588234) * uDir;\n"
-" vec2 off3 = vec2(5.176470588235294) * uDir;\n"
-" colour += texture2D( uTexMain, aTexCoords ) * 0.1964825501511404;\n"
-" colour += texture2D( uTexMain, aTexCoords + off1 ) * 0.2969069646728344;\n"
-" colour += texture2D( uTexMain, aTexCoords - off1 ) * 0.2969069646728344;\n"
-" colour += texture2D( uTexMain, aTexCoords + off2 ) * 0.09447039785044732;\n"
-" colour += texture2D( uTexMain, aTexCoords - off2 ) * 0.09447039785044732;\n"
-" colour += texture2D( uTexMain, aTexCoords + off3 ) * 0.010381362401148057;\n"
-" colour += texture2D( uTexMain, aTexCoords - off3 ) * 0.010381362401148057;\n"
-" FragColor = colour;\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_post_blur_uTexMain;
-static GLuint _uniform_post_blur_uDir;
-static void shader_post_blur_uTexMain(int i){
glUniform1i(_uniform_post_blur_uTexMain,i);
}
-static void shader_post_blur_uDir(v2f v){
+static inline void shader_post_blur_uDir(v2f v)
+{
glUniform2fv(_uniform_post_blur_uDir,1,v);
}
-static void shader_post_blur_register(void){
- vg_shader_register( &_shader_post_blur );
-}
-static void shader_post_blur_use(void){ glUseProgram(_shader_post_blur.id); }
-static void shader_post_blur_link(void){
- _uniform_post_blur_uTexMain = glGetUniformLocation( _shader_post_blur.id, "uTexMain" );
- _uniform_post_blur_uDir = glGetUniformLocation( _shader_post_blur.id, "uDir" );
+static inline void shader_post_blur_use(void);
+static inline void shader_post_blur_use(void)
+{
+ glUseProgram(_shader_post_blur.id);
}
-#endif /* SHADER_post_blur_H */
-#ifndef SHADER_post_comp_H
-#define SHADER_post_comp_H
-static void shader_post_comp_link(void);
-static void shader_post_comp_register(void);
-static struct vg_shader _shader_post_comp = {
- .name = "post_comp",
- .link = shader_post_comp_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_post_comp;
+extern GLuint _uniform_post_comp_uTexMain;
+extern GLuint _uniform_post_comp_uTexBloom;
+extern GLuint _uniform_post_comp_uComp;
+static inline void shader_post_comp_uTexMain(int i)
{
-.orig_file = "shaders/post_comp.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"out vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );\n"
-" aTexCoords = a_co;\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/post_comp.fs.glsl",
-.static_src =
-"uniform sampler2D uTexMain;\n"
-"uniform sampler2D uTexBloom;\n"
-"uniform vec2 uComp; /* x: bloom, y: vignette */\n"
-"out vec4 FragColor;\n"
-"\n"
-"in vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec4 texture_sample = texture( uTexMain, aTexCoords );\n"
-" vec4 bloom_sample = texture( uTexBloom, aTexCoords );\n"
-" \n"
-" vec2 vigCoord = aTexCoords - 0.5;\n"
-" float vig = pow(1.0 - dot( vigCoord, vigCoord ), 2.0);\n"
-" \n"
-" FragColor = (texture_sample + bloom_sample*0.3*uComp.x)\n"
-" * max(uComp.y, vig);\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_post_comp_uTexMain;
-static GLuint _uniform_post_comp_uTexBloom;
-static GLuint _uniform_post_comp_uComp;
-static void shader_post_comp_uTexMain(int i){
glUniform1i(_uniform_post_comp_uTexMain,i);
}
-static void shader_post_comp_uTexBloom(int i){
+static inline void shader_post_comp_uTexBloom(int i)
+{
glUniform1i(_uniform_post_comp_uTexBloom,i);
}
-static void shader_post_comp_uComp(v2f v){
+static inline void shader_post_comp_uComp(v2f v)
+{
glUniform2fv(_uniform_post_comp_uComp,1,v);
}
-static void shader_post_comp_register(void){
- vg_shader_register( &_shader_post_comp );
-}
-static void shader_post_comp_use(void){ glUseProgram(_shader_post_comp.id); }
-static void shader_post_comp_link(void){
- _uniform_post_comp_uTexMain = glGetUniformLocation( _shader_post_comp.id, "uTexMain" );
- _uniform_post_comp_uTexBloom = glGetUniformLocation( _shader_post_comp.id, "uTexBloom" );
- _uniform_post_comp_uComp = glGetUniformLocation( _shader_post_comp.id, "uComp" );
+static inline void shader_post_comp_use(void);
+static inline void shader_post_comp_use(void)
+{
+ glUseProgram(_shader_post_comp.id);
}
-#endif /* SHADER_post_comp_H */
-#ifndef SHADER_post_darken_H
-#define SHADER_post_darken_H
-static void shader_post_darken_link(void);
-static void shader_post_darken_register(void);
-static struct vg_shader _shader_post_darken = {
- .name = "post_darken",
- .link = shader_post_darken_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_post_darken;
+extern GLuint _uniform_post_darken_uTexMain;
+static inline void shader_post_darken_uTexMain(int i)
{
-.orig_file = "shaders/post_darken.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"out vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" gl_Position = vec4( a_co * 2.0 - 1.0, 0.0, 1.0 );\n"
-" aTexCoords = a_co;\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/post_darken.fs.glsl",
-.static_src =
-"uniform sampler2D uTexMain;\n"
-"out vec4 FragColor;\n"
-"\n"
-"in vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec4 texture_sample = texture( uTexMain, aTexCoords );\n"
-" FragColor = vec4(pow(texture_sample.rgb,vec3(2.2)), 1.0);\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_post_darken_uTexMain;
-static void shader_post_darken_uTexMain(int i){
glUniform1i(_uniform_post_darken_uTexMain,i);
}
-static void shader_post_darken_register(void){
- vg_shader_register( &_shader_post_darken );
-}
-static void shader_post_darken_use(void){ glUseProgram(_shader_post_darken.id); }
-static void shader_post_darken_link(void){
- _uniform_post_darken_uTexMain = glGetUniformLocation( _shader_post_darken.id, "uTexMain" );
+static inline void shader_post_darken_use(void);
+static inline void shader_post_darken_use(void)
+{
+ glUseProgram(_shader_post_darken.id);
}
-#endif /* SHADER_post_darken_H */
-#ifndef SHADER_sprite_H
-#define SHADER_sprite_H
-static void shader_sprite_link(void);
-static void shader_sprite_register(void);
-static struct vg_shader _shader_sprite = {
- .name = "sprite",
- .link = shader_sprite_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_sprite;
+extern GLuint _uniform_sprite_uUv;
+extern GLuint _uniform_sprite_uPos;
+extern GLuint _uniform_sprite_uPv;
+extern GLuint _uniform_sprite_uTexMain;
+static inline void shader_sprite_uUv(v4f v)
{
-.orig_file = "shaders/sprite.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co; // quad mesh\n"
-"uniform vec4 uUv;\n"
-"uniform vec3 uPos;\n"
-"\n"
-"uniform mat3 uPv;\n"
-"\n"
-"out vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec2 vertex_world = uUv.zw * (a_co-0.5) * uPos.z + uPos.xy;\n"
-" gl_Position = vec4( uPv * vec3( vertex_world, 1.0 ), 1.0 );\n"
-" aTexCoords = uUv.xy + a_co*uUv.zw;\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/sprite.fs.glsl",
-.static_src =
-"uniform sampler2D uTexMain;\n"
-"out vec4 FragColor;\n"
-"\n"
-"in vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" vec4 texture_sample = texture( uTexMain, aTexCoords );\n"
-" FragColor = texture_sample;\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_sprite_uUv;
-static GLuint _uniform_sprite_uPos;
-static GLuint _uniform_sprite_uPv;
-static GLuint _uniform_sprite_uTexMain;
-static void shader_sprite_uUv(v4f v){
glUniform4fv(_uniform_sprite_uUv,1,v);
}
-static void shader_sprite_uPos(v3f v){
+static inline void shader_sprite_uPos(v3f v)
+{
glUniform3fv(_uniform_sprite_uPos,1,v);
}
-static void shader_sprite_uPv(m3x3f m){
- glUniformMatrix3fv(_uniform_sprite_uPv,1,GL_FALSE,(float*)m);
+static inline void shader_sprite_uPv(m3x3f m)
+{
+ glUniformMatrix3fv(_uniform_sprite_uPv,1,GL_FALSE,(f32*)m);
}
-static void shader_sprite_uTexMain(int i){
+static inline void shader_sprite_uTexMain(int i)
+{
glUniform1i(_uniform_sprite_uTexMain,i);
}
-static void shader_sprite_register(void){
- vg_shader_register( &_shader_sprite );
-}
-static void shader_sprite_use(void){ glUseProgram(_shader_sprite.id); }
-static void shader_sprite_link(void){
- _uniform_sprite_uUv = glGetUniformLocation( _shader_sprite.id, "uUv" );
- _uniform_sprite_uPos = glGetUniformLocation( _shader_sprite.id, "uPos" );
- _uniform_sprite_uPv = glGetUniformLocation( _shader_sprite.id, "uPv" );
- _uniform_sprite_uTexMain = glGetUniformLocation( _shader_sprite.id, "uTexMain" );
+static inline void shader_sprite_use(void);
+static inline void shader_sprite_use(void)
+{
+ glUseProgram(_shader_sprite.id);
}
-#endif /* SHADER_sprite_H */
-#ifndef SHADER_tile_colour_H
-#define SHADER_tile_colour_H
-static void shader_tile_colour_link(void);
-static void shader_tile_colour_register(void);
-static struct vg_shader _shader_tile_colour = {
- .name = "tile_colour",
- .link = shader_tile_colour_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_tile_colour;
+extern GLuint _uniform_tile_colour_uPv;
+extern GLuint _uniform_tile_colour_uOffset;
+extern GLuint _uniform_tile_colour_uColour;
+static inline void shader_tile_colour_uPv(m3x3f m)
{
-.orig_file = "shaders/tile_colour.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"uniform mat3 uPv;\n"
-"uniform vec3 uOffset;\n"
-"\n"
-"void main(){\n"
-" gl_Position = vec4( uPv * vec3( a_co * uOffset.z + uOffset.xy, 1.0 ), 1.0 );\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/tile_colour.fs.glsl",
-.static_src =
-"out vec4 FragColor;\n"
-"uniform vec4 uColour;\n"
-"void main(){\n"
-" FragColor = uColour;\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_tile_colour_uPv;
-static GLuint _uniform_tile_colour_uOffset;
-static GLuint _uniform_tile_colour_uColour;
-static void shader_tile_colour_uPv(m3x3f m){
- glUniformMatrix3fv(_uniform_tile_colour_uPv,1,GL_FALSE,(float*)m);
+ glUniformMatrix3fv(_uniform_tile_colour_uPv,1,GL_FALSE,(f32*)m);
}
-static void shader_tile_colour_uOffset(v3f v){
+static inline void shader_tile_colour_uOffset(v3f v)
+{
glUniform3fv(_uniform_tile_colour_uOffset,1,v);
}
-static void shader_tile_colour_uColour(v4f v){
+static inline void shader_tile_colour_uColour(v4f v)
+{
glUniform4fv(_uniform_tile_colour_uColour,1,v);
}
-static void shader_tile_colour_register(void){
- vg_shader_register( &_shader_tile_colour );
-}
-static void shader_tile_colour_use(void){ glUseProgram(_shader_tile_colour.id); }
-static void shader_tile_colour_link(void){
- _uniform_tile_colour_uPv = glGetUniformLocation( _shader_tile_colour.id, "uPv" );
- _uniform_tile_colour_uOffset = glGetUniformLocation( _shader_tile_colour.id, "uOffset" );
- _uniform_tile_colour_uColour = glGetUniformLocation( _shader_tile_colour.id, "uColour" );
+static inline void shader_tile_colour_use(void);
+static inline void shader_tile_colour_use(void)
+{
+ glUseProgram(_shader_tile_colour.id);
}
-#endif /* SHADER_tile_colour_H */
-#ifndef SHADER_tile_main_H
-#define SHADER_tile_main_H
-static void shader_tile_main_link(void);
-static void shader_tile_main_register(void);
-static struct vg_shader _shader_tile_main = {
- .name = "tile_main",
- .link = shader_tile_main_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_tile_main;
+extern GLuint _uniform_tile_main_uOffset;
+extern GLuint _uniform_tile_main_uPv;
+extern GLuint _uniform_tile_main_uSubTransform;
+extern GLuint _uniform_tile_main_uVisibility;
+extern GLuint _uniform_tile_main_uTexGlyphs;
+extern GLuint _uniform_tile_main_uTexGlow;
+extern GLuint _uniform_tile_main_uTexWood;
+extern GLuint _uniform_tile_main_uGhost;
+extern GLuint _uniform_tile_main_uForeground;
+extern GLuint _uniform_tile_main_uMousePos;
+extern GLuint _uniform_tile_main_uColour;
+extern GLuint _uniform_tile_main_uShadowing;
+extern GLuint _uniform_tile_main_uGlowA;
+extern GLuint _uniform_tile_main_uGlowB;
+static inline void shader_tile_main_uOffset(v4f v)
{
-.orig_file = "shaders/tile_main.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"uniform vec4 uOffset; // Tile x/y, uv x/y\n"
-"uniform mat3 uPv;\n"
-"uniform mat2 uSubTransform;\n"
-"uniform float uVisibility;\n"
-"\n"
-"out vec4 aTexCoords;\n"
-"out vec2 aWorldCoords;\n"
-"\n"
-"vec2 hash22(vec2 p){\n"
-" vec3 p3 = fract(vec3(p.xyx) * vec3(.1031, .1030, .0973));\n"
-" p3 += dot(p3, p3.yzx+33.33);\n"
-" return fract((p3.xx+p3.yz)*p3.zy);\n"
-"}\n"
-"\n"
-"void main(){\n"
-" vec2 hash_val = hash22(uOffset.xy);\n"
-" float scaling_factor = smoothstep( hash_val.x, hash_val.x+1.0, uVisibility );\n"
-"\n"
-" // Vertex transform\n"
-" vec2 subtransform = uSubTransform * (a_co-0.5) * scaling_factor + 0.5;\n"
-" vec3 worldpos = vec3( subtransform + uOffset.xy, 1.0 );\n"
-" gl_Position = vec4( uPv * worldpos, 1.0 );\n"
-"\n"
-" // Create texture coords\n"
-" vec2 random_offset = floor(hash_val * 4.0) * 0.25;\n"
-" vec2 edge_safe_coords = a_co * 0.98 + 0.01;\n"
-" vec2 tex_uv = (edge_safe_coords + uOffset.zw) * 0.25;\n"
-" tex_uv = vec2( tex_uv.x, 1.0-tex_uv.y );\n"
-" aTexCoords = vec4( tex_uv, edge_safe_coords * 0.25 + random_offset );\n"
-" aWorldCoords = worldpos.xy; \n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/tile_main.fs.glsl",
-.static_src =
-"out vec4 FragColor;\n"
-"\n"
-"uniform sampler2D uTexGlyphs;\n"
-"uniform sampler2D uTexGlow;\n"
-"uniform sampler2D uTexWood;\n"
-"uniform float uGhost;\n"
-"uniform float uForeground;\n"
-"uniform vec2 uMousePos;\n"
-"uniform vec4 uColour;\n"
-"uniform vec3 uShadowing;\n"
-"uniform vec3 uGlowA;\n"
-"uniform vec3 uGlowB;\n"
-"\n"
-"in vec4 aTexCoords;\n"
-"in vec2 aWorldCoords;\n"
-"\n"
-"void main(){\n"
-" vec4 glyph = texture( uTexGlyphs, aTexCoords.xy );\n"
-" vec4 glyph_glow = texture( uTexGlow, aTexCoords.xy );\n"
-" vec4 wood = texture( uTexWood, aTexCoords.zw );\n"
-" vec4 wood_secondary = texture( uTexWood, aTexCoords.zw + 0.25 );\n"
-" vec3 wood_comp = mix( wood_secondary.rgb * uShadowing, \n"
-" wood.rgb, clamp( glyph.b*2.0-1.0, 0.0, 1.0 ) );\n"
-" \n"
-" vec3 shadows = mix( uShadowing, vec3(1.0,1.0,1.0), glyph.r );\n"
-" vec4 output_regular = vec4( wood_comp * shadows, \n"
-" mix( glyph.a, glyph.b, uForeground ) );\n"
-" \n"
-" float ghost_dist = clamp( 1.5-distance(uMousePos, aWorldCoords), 0.0, 1.0 );\n"
-" vec4 output_ghost = vec4( 1.0, 1.0, 1.0, glyph.g*ghost_dist );\n"
-" vec4 glow_comp = vec4(glyph_glow.b*uGlowA+glyph_glow.g*uGlowB,0.0);\n"
-" \n"
-" FragColor = mix( output_regular, output_ghost, uGhost )*uColour + glow_comp;\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_tile_main_uOffset;
-static GLuint _uniform_tile_main_uPv;
-static GLuint _uniform_tile_main_uSubTransform;
-static GLuint _uniform_tile_main_uVisibility;
-static GLuint _uniform_tile_main_uTexGlyphs;
-static GLuint _uniform_tile_main_uTexGlow;
-static GLuint _uniform_tile_main_uTexWood;
-static GLuint _uniform_tile_main_uGhost;
-static GLuint _uniform_tile_main_uForeground;
-static GLuint _uniform_tile_main_uMousePos;
-static GLuint _uniform_tile_main_uColour;
-static GLuint _uniform_tile_main_uShadowing;
-static GLuint _uniform_tile_main_uGlowA;
-static GLuint _uniform_tile_main_uGlowB;
-static void shader_tile_main_uOffset(v4f v){
glUniform4fv(_uniform_tile_main_uOffset,1,v);
}
-static void shader_tile_main_uPv(m3x3f m){
- glUniformMatrix3fv(_uniform_tile_main_uPv,1,GL_FALSE,(float*)m);
+static inline void shader_tile_main_uPv(m3x3f m)
+{
+ glUniformMatrix3fv(_uniform_tile_main_uPv,1,GL_FALSE,(f32*)m);
}
-static void shader_tile_main_uSubTransform(m2x2f m){
- glUniformMatrix2fv(_uniform_tile_main_uSubTransform,1,GL_FALSE,(float*)m);
+static inline void shader_tile_main_uSubTransform(m2x2f m)
+{
+ glUniformMatrix2fv(_uniform_tile_main_uSubTransform,1,GL_FALSE,(f32*)m);
}
-static void shader_tile_main_uVisibility(float f){
+static inline void shader_tile_main_uVisibility(f32 f)
+{
glUniform1f(_uniform_tile_main_uVisibility,f);
}
-static void shader_tile_main_uTexGlyphs(int i){
+static inline void shader_tile_main_uTexGlyphs(int i)
+{
glUniform1i(_uniform_tile_main_uTexGlyphs,i);
}
-static void shader_tile_main_uTexGlow(int i){
+static inline void shader_tile_main_uTexGlow(int i)
+{
glUniform1i(_uniform_tile_main_uTexGlow,i);
}
-static void shader_tile_main_uTexWood(int i){
+static inline void shader_tile_main_uTexWood(int i)
+{
glUniform1i(_uniform_tile_main_uTexWood,i);
}
-static void shader_tile_main_uGhost(float f){
+static inline void shader_tile_main_uGhost(f32 f)
+{
glUniform1f(_uniform_tile_main_uGhost,f);
}
-static void shader_tile_main_uForeground(float f){
+static inline void shader_tile_main_uForeground(f32 f)
+{
glUniform1f(_uniform_tile_main_uForeground,f);
}
-static void shader_tile_main_uMousePos(v2f v){
+static inline void shader_tile_main_uMousePos(v2f v)
+{
glUniform2fv(_uniform_tile_main_uMousePos,1,v);
}
-static void shader_tile_main_uColour(v4f v){
+static inline void shader_tile_main_uColour(v4f v)
+{
glUniform4fv(_uniform_tile_main_uColour,1,v);
}
-static void shader_tile_main_uShadowing(v3f v){
+static inline void shader_tile_main_uShadowing(v3f v)
+{
glUniform3fv(_uniform_tile_main_uShadowing,1,v);
}
-static void shader_tile_main_uGlowA(v3f v){
+static inline void shader_tile_main_uGlowA(v3f v)
+{
glUniform3fv(_uniform_tile_main_uGlowA,1,v);
}
-static void shader_tile_main_uGlowB(v3f v){
+static inline void shader_tile_main_uGlowB(v3f v)
+{
glUniform3fv(_uniform_tile_main_uGlowB,1,v);
}
-static void shader_tile_main_register(void){
- vg_shader_register( &_shader_tile_main );
-}
-static void shader_tile_main_use(void){ glUseProgram(_shader_tile_main.id); }
-static void shader_tile_main_link(void){
- _uniform_tile_main_uOffset = glGetUniformLocation( _shader_tile_main.id, "uOffset" );
- _uniform_tile_main_uPv = glGetUniformLocation( _shader_tile_main.id, "uPv" );
- _uniform_tile_main_uSubTransform = glGetUniformLocation( _shader_tile_main.id, "uSubTransform" );
- _uniform_tile_main_uVisibility = glGetUniformLocation( _shader_tile_main.id, "uVisibility" );
- _uniform_tile_main_uTexGlyphs = glGetUniformLocation( _shader_tile_main.id, "uTexGlyphs" );
- _uniform_tile_main_uTexGlow = glGetUniformLocation( _shader_tile_main.id, "uTexGlow" );
- _uniform_tile_main_uTexWood = glGetUniformLocation( _shader_tile_main.id, "uTexWood" );
- _uniform_tile_main_uGhost = glGetUniformLocation( _shader_tile_main.id, "uGhost" );
- _uniform_tile_main_uForeground = glGetUniformLocation( _shader_tile_main.id, "uForeground" );
- _uniform_tile_main_uMousePos = glGetUniformLocation( _shader_tile_main.id, "uMousePos" );
- _uniform_tile_main_uColour = glGetUniformLocation( _shader_tile_main.id, "uColour" );
- _uniform_tile_main_uShadowing = glGetUniformLocation( _shader_tile_main.id, "uShadowing" );
- _uniform_tile_main_uGlowA = glGetUniformLocation( _shader_tile_main.id, "uGlowA" );
- _uniform_tile_main_uGlowB = glGetUniformLocation( _shader_tile_main.id, "uGlowB" );
+static inline void shader_tile_main_use(void);
+static inline void shader_tile_main_use(void)
+{
+ glUseProgram(_shader_tile_main.id);
}
-#endif /* SHADER_tile_main_H */
-#ifndef SHADER_wire_H
-#define SHADER_wire_H
-static void shader_wire_link(void);
-static void shader_wire_register(void);
-static struct vg_shader _shader_wire = {
- .name = "wire",
- .link = shader_wire_link,
- .vs =
+#pragma once
+#include "vg/vg_engine.h"
+extern struct vg_shader _shader_wire;
+extern GLuint _uniform_wire_uStart;
+extern GLuint _uniform_wire_uEnd;
+extern GLuint _uniform_wire_uPv;
+extern GLuint _uniform_wire_uCurve;
+extern GLuint _uniform_wire_uTexMain;
+extern GLuint _uniform_wire_uColour;
+extern GLuint _uniform_wire_uTime;
+extern GLuint _uniform_wire_uGlow;
+static inline void shader_wire_uStart(v3f v)
{
-.orig_file = "shaders/wire.vs.glsl",
-.static_src =
-"layout (location=0) in vec2 a_co;\n"
-"uniform vec3 uStart;\n"
-"uniform vec3 uEnd;\n"
-"uniform mat3 uPv;\n"
-"uniform float uCurve;\n"
-"\n"
-"out vec2 aTexCoords;\n"
-"\n"
-"vec3 sample_curve_time( float t ){\n"
-" vec3 line_coord = mix( uStart, uEnd, t );\n"
-"\n"
-" float curve_amt = 1.0-(pow((t*2.0-1.0),2.0));\n"
-" return vec3( line_coord.x, line_coord.y - curve_amt*uCurve, line_coord.z );\n"
-"}\n"
-"\n"
-"void main(){\n"
-" // Vertex transform\n"
-" vec3 p0 = sample_curve_time( a_co.x );\n"
-" vec3 p1 = sample_curve_time( a_co.x + 0.025 );\n"
-" \n"
-" vec2 line_tangent = normalize(p1.xy-p0.xy);\n"
-" vec2 line_normal = vec2( -line_tangent.y, line_tangent.x );\n"
-" \n"
-" vec2 worldfinal = p0.xy + line_normal*a_co.y*p0.z;\n"
-" \n"
-" gl_Position = vec4( uPv * vec3(worldfinal, 1.0), 1.0 );\n"
-"\n"
-" // Create texture coords (todo: include stretch adjusted coords?)\n"
-" aTexCoords = vec2( a_co.x, a_co.y + 0.5 );\n"
-"}\n"
-""},
- .fs =
-{
-.orig_file = "shaders/wire.fs.glsl",
-.static_src =
-"out vec4 FragColor;\n"
-"\n"
-"uniform sampler2D uTexMain;\n"
-"uniform vec4 uColour;\n"
-"uniform float uTime;\n"
-"uniform float uGlow;\n"
-"\n"
-"in vec2 aTexCoords;\n"
-"\n"
-"void main(){\n"
-" // Compute shadowing\n"
-" float shadow = 1.0 - abs(aTexCoords.y - 0.5) * 2.0;\n"
-" float masking = smoothstep( 0.5, 0.8, shadow );\n"
-" \n"
-" vec3 colour_comp = mix( vec3(0.0,0.0,0.0), uColour.rgb, masking );\n"
-" \n"
-" float flow_thing = fract( aTexCoords.x + uTime );\n"
-" vec3 final_comp = colour_comp + flow_thing * uGlow;\n"
-" \n"
-" FragColor = vec4( final_comp, max( shadow* 0.2, masking ) * uColour.a );\n"
-"}\n"
-""},
-};
-
-static GLuint _uniform_wire_uStart;
-static GLuint _uniform_wire_uEnd;
-static GLuint _uniform_wire_uPv;
-static GLuint _uniform_wire_uCurve;
-static GLuint _uniform_wire_uTexMain;
-static GLuint _uniform_wire_uColour;
-static GLuint _uniform_wire_uTime;
-static GLuint _uniform_wire_uGlow;
-static void shader_wire_uStart(v3f v){
glUniform3fv(_uniform_wire_uStart,1,v);
}
-static void shader_wire_uEnd(v3f v){
+static inline void shader_wire_uEnd(v3f v)
+{
glUniform3fv(_uniform_wire_uEnd,1,v);
}
-static void shader_wire_uPv(m3x3f m){
- glUniformMatrix3fv(_uniform_wire_uPv,1,GL_FALSE,(float*)m);
+static inline void shader_wire_uPv(m3x3f m)
+{
+ glUniformMatrix3fv(_uniform_wire_uPv,1,GL_FALSE,(f32*)m);
}
-static void shader_wire_uCurve(float f){
+static inline void shader_wire_uCurve(f32 f)
+{
glUniform1f(_uniform_wire_uCurve,f);
}
-static void shader_wire_uTexMain(int i){
+static inline void shader_wire_uTexMain(int i)
+{
glUniform1i(_uniform_wire_uTexMain,i);
}
-static void shader_wire_uColour(v4f v){
+static inline void shader_wire_uColour(v4f v)
+{
glUniform4fv(_uniform_wire_uColour,1,v);
}
-static void shader_wire_uTime(float f){
+static inline void shader_wire_uTime(f32 f)
+{
glUniform1f(_uniform_wire_uTime,f);
}
-static void shader_wire_uGlow(float f){
+static inline void shader_wire_uGlow(f32 f)
+{
glUniform1f(_uniform_wire_uGlow,f);
}
-static void shader_wire_register(void){
- vg_shader_register( &_shader_wire );
-}
-static void shader_wire_use(void){ glUseProgram(_shader_wire.id); }
-static void shader_wire_link(void){
- _uniform_wire_uStart = glGetUniformLocation( _shader_wire.id, "uStart" );
- _uniform_wire_uEnd = glGetUniformLocation( _shader_wire.id, "uEnd" );
- _uniform_wire_uPv = glGetUniformLocation( _shader_wire.id, "uPv" );
- _uniform_wire_uCurve = glGetUniformLocation( _shader_wire.id, "uCurve" );
- _uniform_wire_uTexMain = glGetUniformLocation( _shader_wire.id, "uTexMain" );
- _uniform_wire_uColour = glGetUniformLocation( _shader_wire.id, "uColour" );
- _uniform_wire_uTime = glGetUniformLocation( _shader_wire.id, "uTime" );
- _uniform_wire_uGlow = glGetUniformLocation( _shader_wire.id, "uGlow" );
+static inline void shader_wire_use(void);
+static inline void shader_wire_use(void)
+{
+ glUseProgram(_shader_wire.id);
}
-#endif /* SHADER_wire_H */