transparent-cube

Minimal cross-platform native/wasm graphics example.
git clone git://git.amin.space/transparent-cube.git
Log | Files | Refs | README | LICENSE

shader.h (949B)


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