style: naming convention

This commit is contained in:
2025-10-13 16:22:57 +02:00
parent f981cee4e0
commit f1a24f576b
16 changed files with 114 additions and 113 deletions

View File

@@ -12,9 +12,9 @@
Shader::Shader(const std::string& vertexPath, const std::string& fragmentPath)
{
const uint32_t vshader = CompileShader(GL_VERTEX_SHADER, vertexPath);
const uint32_t vshader = compile_shader(GL_VERTEX_SHADER, vertexPath);
const uint32_t fshader =
CompileShader(GL_FRAGMENT_SHADER, fragmentPath);
compile_shader(GL_FRAGMENT_SHADER, fragmentPath);
if (vshader == 0 || fshader == 0) {
program_id_ = 0;
@@ -42,13 +42,13 @@ Shader::Shader(const std::string& vertexPath, const std::string& fragmentPath)
glDeleteShader(fshader);
}
void Shader::Use() const
void Shader::use() const
{
if (program_id_ != 0)
glUseProgram(program_id_);
}
void Shader::SetupAttribs() const
void Shader::setup_attribs() const
{
int loc = glGetAttribLocation(program_id_, "vpos");
if (loc != -1) {
@@ -67,42 +67,42 @@ void Shader::SetupAttribs() const
}
}
int Shader::getLocation(const char* key) const
int Shader::uniform_location(const char* key) const
{
return glGetUniformLocation(program_id_, key);
}
void Shader::setInt(int loc, int value)
void Shader::set_int(int loc, int value)
{
if (loc != -1)
glUniform1i(loc, value);
}
void Shader::setFloat(int loc, float value)
void Shader::set_float(int loc, float value)
{
if (loc != -1)
glUniform1f(loc, value);
}
void Shader::setVec3(int loc, const glm::vec3& value)
void Shader::set_vec3(int loc, const glm::vec3& value)
{
if (loc != -1)
glUniform3fv(loc, 1, &value[0]);
}
void Shader::setVec4(int loc, const glm::vec4& value)
void Shader::set_vec4(int loc, const glm::vec4& value)
{
if (loc != -1)
glUniform4fv(loc, 1, &value[0]);
}
void Shader::setMat4(int loc, const glm::mat4& value)
void Shader::set_mat4(int loc, const glm::mat4& value)
{
if (loc != -1)
glUniformMatrix4fv(loc, 1, GL_FALSE, &value[0][0]);
}
std::string Shader::ReadShaderFile(const std::string& filename)
std::string Shader::read_shader_file(const std::string& filename)
{
std::ifstream file(filename);
if (!file) {
@@ -115,9 +115,9 @@ std::string Shader::ReadShaderFile(const std::string& filename)
return buffer.str();
}
uint32_t Shader::CompileShader(uint32_t type, const std::string& source_path)
uint32_t Shader::compile_shader(uint32_t type, const std::string& source_path)
{
std::string source = ReadShaderFile(source_path);
std::string source = read_shader_file(source_path);
// std::cout << "SHADER FILE: " << source << "\n";
if (source.empty())
return 0;