[EDIT] comments on each function
This commit is contained in:
@@ -26,13 +26,47 @@ namespace shaders
|
||||
public:
|
||||
EntityShader();
|
||||
|
||||
/*
|
||||
* @brief: A method to load the model matrix into the shader
|
||||
*
|
||||
* @param matrix: The model matrix
|
||||
*/
|
||||
void LoadModelMatrix(const glm::mat4& matrix) const;
|
||||
|
||||
/*
|
||||
* @brief: A method to load the projection matrix into the shader
|
||||
*
|
||||
* @param projection: The projection matrix
|
||||
*/
|
||||
void LoadProjectionMatrix(const glm::mat4& projection) const;
|
||||
|
||||
/*
|
||||
* @brief: A method to load the view matrix (camera) into the shader
|
||||
*
|
||||
* @param camera: The camera which the scene needs to be rendered from
|
||||
*/
|
||||
void LoadViewMatrix(entities::Camera& camera) const;
|
||||
|
||||
/*
|
||||
* @brief: A method to load a light into the shader
|
||||
*
|
||||
* @param light: The light
|
||||
*/
|
||||
void LoadLight(entities::Light& light) const;
|
||||
|
||||
/*
|
||||
* @brief: A method to load the the shine variables from a model into the shader
|
||||
*
|
||||
* @param shine_damper: The dampening of the angle from when to render reflectivity on the vertex
|
||||
* @param reflectivity: The amount the model reflects
|
||||
*/
|
||||
void LoadShineVariables(float shine_damper, float reflectivity) const;
|
||||
|
||||
/*
|
||||
* @brief: A method to load the sky color into the shader. This color will be used for the fog
|
||||
*
|
||||
* @param sky_color: The color of the sky
|
||||
*/
|
||||
void LoadSkyColor(glm::vec3 sky_color) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -21,29 +21,87 @@ namespace shaders
|
||||
ShaderProgram(std::string& vertex_shader, std::string& fragment_shader);
|
||||
virtual ~ShaderProgram() = default;
|
||||
|
||||
// Call this function after making the shaderprogram (sets all the attributes of the shader)
|
||||
/*
|
||||
* @brief: Call this function after making the shaderprogram (sets all the attributes of the shader)
|
||||
*/
|
||||
void Init();
|
||||
// Call this function before rendering
|
||||
|
||||
/*
|
||||
* @brief: Call this function before rendering
|
||||
*/
|
||||
void Start() const;
|
||||
// Call this function after rendering
|
||||
|
||||
/*
|
||||
* @brief: Call this function after rendering
|
||||
*/
|
||||
void Stop() const;
|
||||
// Call this function when closing the application
|
||||
|
||||
/*
|
||||
* @brief: Call this function when closing the application
|
||||
*/
|
||||
void CleanUp() const;
|
||||
|
||||
protected:
|
||||
// Set the inputs of the vertex shader
|
||||
/*
|
||||
* @brief: Set the inputs of the vertex shader
|
||||
*/
|
||||
virtual void SetAttributes() const = 0;
|
||||
|
||||
/*
|
||||
* @brief: Sets/binds a input variable (in) to a VBO from the model
|
||||
*
|
||||
* @param attribute: The id of the VBO
|
||||
* @param variable_name: The name of the "in" variable in the shader
|
||||
*/
|
||||
void SetAttribute(const GLuint attribute, const char* variable_name) const;
|
||||
|
||||
// Loads value's (uniform variables) into the shader
|
||||
/*
|
||||
* @brief: This function loads a float value into a uniform variable into the shader
|
||||
*
|
||||
* @param location: The location of the variable in openGL
|
||||
* @param value: The value which will be loaded into the variable
|
||||
*/
|
||||
void LoadFloat(GLuint location, GLfloat value) const;
|
||||
|
||||
/*
|
||||
* @brief: This function loads a vector value into a uniform variable into the shader
|
||||
*
|
||||
* @param location: The location of the variable in openGL
|
||||
* @param vector: The value which will be loaded into the variable
|
||||
*/
|
||||
void LoadVector(GLuint location, glm::vec3 vector) const;
|
||||
|
||||
/*
|
||||
* @brief: This function loads a 4x4 matrix value into a uniform variable into the shader
|
||||
*
|
||||
* @param location: The location of the variable in openGL
|
||||
* @param matrix: The value which will be loaded into the variable
|
||||
*/
|
||||
void LoadMatrix(GLuint location, glm::mat4 matrix) const;
|
||||
|
||||
|
||||
/*
|
||||
* @brief: This function will get all the locations of each uniform variable
|
||||
*/
|
||||
virtual void GetAllUniformLocations() = 0;
|
||||
|
||||
/*
|
||||
* @brief: This function will retrieve the location of a uniform variable
|
||||
*
|
||||
* @param uniform_name: The name of the uniform variable
|
||||
*
|
||||
* @return: The location of the uniform variable
|
||||
*/
|
||||
GLuint GetUniformLocation(const GLchar* uniform_name) const;
|
||||
|
||||
private:
|
||||
/*
|
||||
* @brief: This function will load a shader into openGL
|
||||
*
|
||||
* @param shader_string: The shader as a string (the whole code)
|
||||
* @param type: The type of the shader (Vertex/Fragment)
|
||||
*
|
||||
* @return: The id of the shader given by openGL
|
||||
*/
|
||||
GLuint LoadShader(const std::string& shader_string, GLuint type) const;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user