removed const from draw functions
This commit is contained in:
parent
1e44994bb4
commit
46e3ec5848
5 changed files with 21 additions and 4 deletions
|
@ -54,7 +54,7 @@ namespace lol
|
||||||
*
|
*
|
||||||
* @param drawable A Drawable that should be rendered through this camera
|
* @param drawable A Drawable that should be rendered through this camera
|
||||||
*/
|
*/
|
||||||
inline void Draw(const Drawable& drawable) const
|
inline void Draw(Drawable& drawable) const
|
||||||
{
|
{
|
||||||
drawable.Draw(*this);
|
drawable.Draw(*this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,14 @@ namespace lol
|
||||||
*
|
*
|
||||||
* @param camera The camera with which this object is rendered.
|
* @param camera The camera with which this object is rendered.
|
||||||
*/
|
*/
|
||||||
virtual void PreRender(const CameraBase& camera) const { };
|
virtual void PreRender(const CameraBase& camera) { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Bind the shader and draw the VAO
|
* @brief Bind the shader and draw the VAO
|
||||||
*
|
*
|
||||||
* @param camera The camera with which this object is rendered.
|
* @param camera The camera with which this object is rendered.
|
||||||
*/
|
*/
|
||||||
void Draw(const CameraBase& camera) const;
|
void Draw(const CameraBase& camera);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The VAO can be rendered as a mesh, a set of lines, loops, strips etc
|
* @brief The VAO can be rendered as a mesh, a set of lines, loops, strips etc
|
||||||
|
|
|
@ -39,6 +39,14 @@ namespace lol
|
||||||
void Bind();
|
void Bind();
|
||||||
void Unbind();
|
void Unbind();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a float uniform
|
||||||
|
*
|
||||||
|
* @param name Name of the uniform
|
||||||
|
* @param value Value of the uniform
|
||||||
|
*/
|
||||||
|
void SetUniform(const std::string& name, float value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a 4x4 matrix uniform
|
* Set a 4x4 matrix uniform
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace lol
|
namespace lol
|
||||||
{
|
{
|
||||||
|
|
||||||
void Drawable::Draw(const CameraBase& camera) const
|
void Drawable::Draw(const CameraBase& camera)
|
||||||
{
|
{
|
||||||
shader->Bind();
|
shader->Bind();
|
||||||
vao->Bind();
|
vao->Bind();
|
||||||
|
|
|
@ -86,6 +86,15 @@ namespace lol
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Shader::SetUniform(const std::string& name, float value)
|
||||||
|
{
|
||||||
|
GLint location = glGetUniformLocation(id, name.c_str());
|
||||||
|
if (location == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glUniform1f(location, value);
|
||||||
|
}
|
||||||
|
|
||||||
void Shader::SetUniform(const std::string& name, const glm::mat4& value)
|
void Shader::SetUniform(const std::string& name, const glm::mat4& value)
|
||||||
{
|
{
|
||||||
GLint location = glGetUniformLocation(id, name.c_str());
|
GLint location = glGetUniformLocation(id, name.c_str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue