FS2_Open
Open source remastering of the Freespace 2 engine
gropenglshader.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 #ifndef _GROPENGLSHADER_H
12 #define _GROPENGLSHADER_H
13 
14 #include "globalincs/pstypes.h"
15 #include "graphics/gropengl.h"
16 
17 #include <string>
18 
19 #define MAX_SHADER_UNIFORMS 20
20 
21 #define SDR_ATTRIB_RADIUS 0
22 #define SDR_ATTRIB_SUBMODEL 1
23 
24 #define MAX_SDR_ATTRIBUTES 5
25 
26 #define MAX_SDR_UNIFORM_BLOCKS 5
27 
29 {
33 };
34 
37 
38  char *vert;
39  char *frag;
40  char *geo;
41 
43 
46 
49 
50  const char* description;
51 };
52 
55 
57 
58  int flag;
60 
63 
66 
67  const char* description;
68 };
69 
71  char *vert;
72  char *frag;
73  char *geo;
74 
75  int flags;
76 
79 
82 
83  const char* description;
84 };
85 
87  unsigned int flag;
88 
91 
94 
97 
98  const char* name;
99 };
100 
101 typedef struct opengl_shader_uniform_t {
104 
105  opengl_shader_uniform_t() : location(-1) {}
107 
108 typedef struct opengl_shader_t {
110 
112  unsigned int flags;
113  int flags2;
114 
117  SCP_vector<opengl_shader_uniform_t> attributes; // using the uniform data structure to keep track of vert attribs
118 
120  program_id(0), flags(0), flags2(0)
121  {
122  }
124 
126 
128 
130 
131 int gr_opengl_maybe_create_shader(shader_type shader_t, unsigned int flags);
132 void opengl_delete_shader(int sdr_handle);
133 void opengl_shader_set_current(opengl_shader_t *shader_obj = NULL);
134 void opengl_shader_set_current(int handle);
135 
136 void opengl_shader_init();
138 
140 
141 void opengl_shader_init_attribute(const char *attribute_text);
142 GLint opengl_shader_get_attribute(const char *attribute_text);
143 
144 void opengl_shader_init_uniform(const char *uniform_text);
145 GLint opengl_shader_get_uniform(const char *uniform_text);
146 
147 void opengl_shader_init_uniform_block(const char *uniform_text);
148 GLint opengl_shader_get_uniform_block(const char *uniform_text);
149 
150 
151 void gr_opengl_shader_set_animated_effect(int effect, float timer);
154 
157 
158 #define ANIMATED_SHADER_LOADOUTSELECT_FS1 0
159 #define ANIMATED_SHADER_LOADOUTSELECT_FS2 1
160 #define ANIMATED_SHADER_CLOAK 2
161 
162 #endif // _GROPENGLSHADER_H
unsigned int GLhandleARB
Definition: Glext.h:5080
void opengl_shader_init()
SCP_vector< opengl_shader_t > GL_shader
void opengl_shader_init_uniform(const char *uniform_text)
#define MAX_SDR_ATTRIBUTES
int opengl_compile_shader(shader_type sdr, uint flags)
#define MAX_SHADER_UNIFORMS
char * uniforms[MAX_SHADER_UNIFORMS]
unsigned int flags
#define MAX_SDR_UNIFORM_BLOCKS
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
int opengl_shader_get_animated_effect()
opengl_shader_t * Current_shader
void opengl_shader_init_attribute(const char *attribute_text)
unsigned int uint
Definition: pstypes.h:64
char * uniform_blocks[MAX_SDR_UNIFORM_BLOCKS]
void opengl_shader_compile_deferred_light_shader()
int gr_opengl_maybe_create_shader(shader_type shader_t, unsigned int flags)
void opengl_shader_init_uniform_block(const char *uniform_text)
char * attributes[MAX_SDR_ATTRIBUTES]
GLint opengl_shader_get_uniform(const char *uniform_text)
char * uniforms[MAX_SHADER_UNIFORMS]
char * uniforms[MAX_SHADER_UNIFORMS]
GLhandleARB program_id
char * attributes[MAX_SDR_ATTRIBUTES]
SCP_vector< opengl_shader_uniform_t > uniform_blocks
const char * description
char * uniforms[MAX_SHADER_UNIFORMS]
GLint opengl_shader_get_uniform_block(const char *uniform_text)
void opengl_delete_shader(int sdr_handle)
GLint opengl_shader_get_attribute(const char *attribute_text)
GLbitfield flags
Definition: Glext.h:6722
shader_type
Definition: 2d.h:30
void opengl_shader_shutdown()
SCP_vector< opengl_shader_uniform_t > attributes
struct opengl_shader_t opengl_shader_t
geometry_sdr_params * Current_geo_sdr_params
void gr_opengl_shader_set_animated_effect(int effect, float timer)
char * attributes[MAX_SDR_ATTRIBUTES]
float opengl_shader_get_animated_timer()
SCP_vector< opengl_shader_uniform_t > uniforms
char * attributes[MAX_SDR_ATTRIBUTES]
shader_type shader
struct opengl_shader_uniform_t opengl_shader_uniform_t
const char * description
void opengl_shader_set_current(opengl_shader_t *shader_obj=NULL)
int GLint
Definition: Gl.h:48
geometry_sdr_params geo_sdr_info
void opengl_shader_compile_deferred_light_clear_shader()