DI-Guy SDK Documentation  13.8
diguyDx11GraphicsShaderProgram.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2024 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
9 
11 #include "dx11_headers.h"
12 
13 struct ID3DXEffect;
14 
17 {
18 public:
19 
20  diguyDx11GraphicsShaderProgram( void* internal_data );
22 
23  virtual int load_vertex_shader_source( const char* filename_base );
24  virtual int load_pixel_shader_source( const char* filename_base );
25  virtual int reload();
26  virtual int link();
27 
28  virtual int bind();
29  virtual int unbind();
30 
31  virtual int bind_model_view_matrices( const float* view_matrix, const float* model_matrix );
32  virtual int bind_link_matrices( int num_mats, const float* mat_data );
33  virtual int bind_color_array( int num_colors, const float* color_data );
34  virtual void set_apply_matrices_flag( int apply_matrices_flag );
35 
36 protected:
37 
38  char* load_shader_source( const char* shader_filename );
39  void free_shader_source( char* source_source );
40 
41 public:
42 
43  ID3D11InputLayout* m_skinned_vertexDecl;
44  ID3D11InputLayout* m_rigid_vertexDecl;
45 
46 protected:
47 
48  ID3DBlob* m_vertex_blob;
49  ID3D11VertexShader* m_vertex_shader;
52 
53  ID3DBlob* m_pixel_blob;
54  ID3D11PixelShader* m_pixel_shader;
57 
58  bool m_linked;
59 
60 };
61 
62 
63 // Create function declaration.
64 // Declare a subclass creation function that will be registered with the DI-Guy Graphics API.
ID3D11PixelShader * m_pixel_shader
Definition: diguyDx11GraphicsShaderProgram.h:54
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...
virtual void set_apply_matrices_flag(int apply_matrices_flag)
char * load_shader_source(const char *shader_filename)
virtual int bind_model_view_matrices(const float *view_matrix, const float *model_matrix)
bool m_linked
Definition: diguyDx11GraphicsShaderProgram.h:58
ID3D11InputLayout * m_skinned_vertexDecl
Definition: diguyDx11GraphicsShaderProgram.h:43
diguyGraphicsShaderProgram * diguyDx11GraphicsShaderProgram_create_func(void *internal_data)
bool m_vertex_shader_loaded
Definition: diguyDx11GraphicsShaderProgram.h:51
ID3DBlob * m_vertex_blob
Definition: diguyDx11GraphicsShaderProgram.h:48
char m_vertex_shader_filename[512]
Definition: diguyDx11GraphicsShaderProgram.h:50
char m_pixel_shader_filename[512]
Definition: diguyDx11GraphicsShaderProgram.h:55
bool m_pixel_shader_loaded
Definition: diguyDx11GraphicsShaderProgram.h:56
ID3D11InputLayout * m_rigid_vertexDecl
Definition: diguyDx11GraphicsShaderProgram.h:44
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...
ID3D11VertexShader * m_vertex_shader
Definition: diguyDx11GraphicsShaderProgram.h:49
virtual int link()
This function will be called by DI-Guy when it is time for the shader program to be linked...
void free_shader_source(char *source_source)
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...
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: diguyDx11GraphicsShaderProgram.h:16
ID3DBlob * m_pixel_blob
Definition: diguyDx11GraphicsShaderProgram.h:53
diguyDx11GraphicsShaderProgram(void *internal_data)
virtual int reload()
Forces the underlying shader to reload. Returns 0 on success.
This class implements shader programs for use with DI-Guy character graphics.
Definition: diguyGraphicsShaderProgram.h:94
virtual int unbind()
In general variables that were set in bind() should be unset or unbound here.
virtual int bind()
This function will be called by DI-Guy when this program is being bound for rendering.