shader.h (1008B)
1 enum ShaderUniform 2 { 3 SHADER_UNIFORM_MODEL, 4 SHADER_UNIFORM_VIEW, 5 SHADER_UNIFORM_PROJECTION, 6 SHADER_UNIFORM_COLOR, 7 SHADER_UNIFORM_TEX_INTERP, 8 SHADER_UNIFORM_TILE_ID, 9 10 NUM_SHADER_UNIFORMS, 11 }; 12 13 struct Shader 14 { 15 u32 program; 16 i32 uniform_locations[NUM_SHADER_UNIFORMS]; 17 }; 18 19 bool shader_compile(const GLchar *vertex_shader_source, const GLchar *fragment_shader_source, struct Shader *compiled_shader); 20 void shader_use(struct Shader *s); 21 void shader_setb(struct Shader *s, enum ShaderUniform u, bool value); 22 void shader_seti(struct Shader *s, enum ShaderUniform u, int value); 23 void shader_setf(struct Shader *s, enum ShaderUniform u, f32 value); 24 void shader_setm4(struct Shader *s, enum ShaderUniform u, m4 *mat); 25 void shader_setf3(struct Shader *s, enum ShaderUniform u, f32 x, f32 y, f32 z); 26 void shader_setf3_1(struct Shader *s, enum ShaderUniform u, f32 f); 27 void shader_setv3(struct Shader *s, enum ShaderUniform u, v3 *v); 28 char *shader_uniform_get_name(enum ShaderUniform u);