1 #ifndef __OpenTomb__shader_description__ 2 #define __OpenTomb__shader_description__ 3 4 #include <SDL2/SDL_platform.h> 5 #include <SDL2/SDL_opengl.h> 6 #include "../core/gl_util.h" 7 8 struct shader_stage 9 { 10 GLhandleARB shader; 11 12 shader_stage(GLenum type, const char *filename, const char *additionalDefines = 0); 13 ~shader_stage(); 14 }; 15 16 /*! 17 * A shader description consists of a program, code to load the 18 * program, and the indices of the various uniform values. Each 19 * shader or set of related shaders will have its own subclass 20 * of shader_description. We assume (for now) that every shader 21 * has a texture. 22 */ 23 struct shader_description 24 { 25 GLhandleARB program; 26 GLint sampler; 27 28 shader_description(const shader_stage &vertex, const shader_stage &fragment); 29 ~shader_description(); 30 }; 31 32 /*! 33 * A shader description for text 34 */ 35 struct text_shader_description : public shader_description 36 { 37 GLint screenSize; 38 GLint colorReplace; 39 40 text_shader_description(const shader_stage &vertex, const shader_stage &fragment); 41 }; 42 43 /*! 44 * A shader description type that contains transform information. This comes in the form of a model view projection matrix. 45 */ 46 struct unlit_shader_description : public shader_description 47 { 48 GLint model_view_projection; 49 GLint dist_fog; 50 51 unlit_shader_description(const shader_stage &vertex, const shader_stage &fragment); 52 }; 53 54 /*! 55 * A shader description type that is suitable for lit objects. Also 56 * contains a model view matrix and information about the current 57 * light situation 58 */ 59 struct lit_shader_description : public unlit_shader_description 60 { 61 GLint model_view; 62 GLint number_of_lights; 63 GLint light_position; 64 GLint light_color; 65 GLint light_inner_radius; 66 GLint light_outer_radius; 67 GLint light_ambient; 68 69 lit_shader_description(const shader_stage &vertex, const shader_stage &fragment); 70 }; 71 72 struct unlit_tinted_shader_description : public unlit_shader_description 73 { 74 GLint current_tick; 75 GLint tint_mult; 76 77 unlit_tinted_shader_description(const shader_stage &vertex, const shader_stage &fragment); 78 }; 79 80 #endif /* defined(__OpenTomb__shader_description__) */ 81