DI-Guy SDK Documentation  13.2
diguyDx9GraphicsShaderProgram.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  **
4  *2 diguyDx9GraphicsShaderProgram
5  **
6  ** This class is part of the DI-Guy Graphics API. It overrides the class
7  ** diguyGraphicsShaderProgram. Detailed documentation is in the
8  ** implementation file documentation
9  ** <a href="diguyDx9GraphicsShaderProgram.cpp.html">here</a>.
10  */
11 
12 #ifndef diguyDx9GraphicsShaderProgram_h__
13 #define diguyDx9GraphicsShaderProgram_h__
14 
15 class diguyGraphicsLink;
16 
18 #include <dx9_headers.h>
19 
20 struct ID3DXEffect;
21 
22 
23 /****************************************************************************/
25 {
26 
27 public:
28 
29  diguyDx9GraphicsShaderProgram(void* internal_data);
31 
32  virtual int load_vertex_shader_source(const char* filename_base);
33  virtual int load_pixel_shader_source(const char* filename_base);
34  virtual int reload();
35  virtual int link();
36 
37  virtual int bind();
38  virtual int unbind();
39 
40 
41  virtual int bind_link_matrices(int num_mats,
42  const float* mat_data);
43  virtual int bind_color_array(int num_colors,
44  const float* color_data);
45  virtual void set_apply_matrices_flag(int apply_matrices_flag);
46 
47 protected:
48 
50  const char* shader_filename,
51  bool& shader_loaded);
52 
53  char* load_shader_source(const char* shader_filename);
54  void free_shader_source(char* source_source);
55 
56  LPD3DXBUFFER m_vertex_code;
57  LPDIRECT3DVERTEXSHADER9 m_vertex_shader;
58  char m_vertex_shader_filename[512];
60 
61  LPD3DXBUFFER m_pixel_code;
62  LPDIRECT3DPIXELSHADER9 m_pixel_shader;
63  char m_pixel_shader_filename[512];
65 
66  bool m_linked;
67 };
68 
69 
75 
76 #endif /* diguyDx9GraphicsShaderProgram_h__ */
77 
virtual int bind_link_matrices(int num_mats, const float *mat_data)
This function will be called by DI-Guy when the matrix data of a character's links needs to be sent t...
Definition: diguyDx9GraphicsShaderProgram.cpp:442
char * load_shader_source(const char *shader_filename)
Definition: diguyDx9GraphicsShaderProgram.cpp:404
void free_shader_source(char *source_source)
Definition: diguyDx9GraphicsShaderProgram.cpp:421
virtual int load_pixel_shader_source(const char *filename_base)
This function is the pixel shader (AKA fragment shader in OpenGL) equivalent of load_vertex_shader_so...
Definition: diguyDx9GraphicsShaderProgram.cpp:189
LPD3DXBUFFER m_pixel_code
Definition: diguyDx9GraphicsShaderProgram.h:59
char m_vertex_shader_filename[512]
Definition: diguyDx9GraphicsShaderProgram.h:56
virtual int bind_color_array(int num_colors, const float *color_data)
This function will be called by DI-Guy when the color data of a character's links needs to be sent to...
Definition: diguyDx9GraphicsShaderProgram.cpp:474
LPDIRECT3DVERTEXSHADER9 m_vertex_shader
Definition: diguyDx9GraphicsShaderProgram.h:55
virtual int link()
This function will be called by DI-Guy when it is time for the shader program to be linked...
Definition: diguyDx9GraphicsShaderProgram.cpp:250
char m_pixel_shader_filename[512]
Definition: diguyDx9GraphicsShaderProgram.h:61
~diguyDx9GraphicsShaderProgram()
Definition: diguyDx9GraphicsShaderProgram.cpp:94
diguyGraphicsShaderProgram * diguyDx9GraphicsShaderProgram_create_func(void *internal_data)
Create function declaration.
Definition: diguyDx9GraphicsShaderProgram.cpp:523
int load_and_compile_shader(const char *shader_filename, bool &shader_loaded)
Definition: diguyDx9GraphicsShaderProgram.cpp:367
Definition: diguyDx9GraphicsShaderProgram.h:23
LPD3DXBUFFER m_vertex_code
Definition: diguyDx9GraphicsShaderProgram.h:54
bool m_vertex_shader_loaded
Definition: diguyDx9GraphicsShaderProgram.h:57
LPDIRECT3DPIXELSHADER9 m_pixel_shader
Definition: diguyDx9GraphicsShaderProgram.h:60
virtual int unbind()
In general variables that were set in bind() should be unset or unbound here.
Definition: diguyDx9GraphicsShaderProgram.cpp:315
bool m_pixel_shader_loaded
Definition: diguyDx9GraphicsShaderProgram.h:62
virtual int load_vertex_shader_source(const char *filename_base)
This function will be called by DI-Guy when it is time for the vertex part of this shader to be loade...
Definition: diguyDx9GraphicsShaderProgram.cpp:127
virtual int bind()
This function will be called by DI-Guy when this program is being bound for rendering.
Definition: diguyDx9GraphicsShaderProgram.cpp:284
diguyDx9GraphicsShaderProgram(void *internal_data)
4 Header files and forward declarations
Definition: diguyDx9GraphicsShaderProgram.cpp:53
This class implements shader programs for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderProgram.h:96
bool m_linked
Definition: diguyDx9GraphicsShaderProgram.h:64
virtual int reload()
Definition: diguyDx9GraphicsShaderProgram.cpp:346
virtual void set_apply_matrices_flag(int apply_matrices_flag)
Definition: diguyDx9GraphicsShaderProgram.cpp:505