style: unify naming conventions across the project

This commit is contained in:
2026-03-07 09:51:51 +08:00
parent b372d92858
commit fc7f3e75b1
10 changed files with 216 additions and 198 deletions

View File

@@ -1,16 +1,18 @@
#include <fstream>
#include <Cubed/tools/shader_tools.hpp>
#include <Cubed/tools/log.hpp>
void printShaderLog(GLuint shader) {
void print_shader_log(GLuint shader) {
int len = 0;
int chWritten = 0;
int ch_written = 0;
char *log;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
if (len > 0) {
log = (char*)malloc(len);
glGetShaderInfoLog(shader, len, &chWritten, log);
glGetShaderInfoLog(shader, len, &ch_written, log);
LOG::info("Shader Info Log: {}", log);
free(log);
}
@@ -18,55 +20,55 @@ void printShaderLog(GLuint shader) {
}
void printProgramInfo(int prog) {
void print_program_info(int prog) {
int len = 0;
int chWritten = 0;
int ch_written = 0;
char *log;
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &len);
if (len > 0) {
log = (char*)malloc(len);
glGetProgramInfoLog(prog, len, &chWritten, log);
glGetProgramInfoLog(prog, len, &ch_written, log);
LOG::info("Program Info Log: {}", log);
free(log);
}
}
bool checkOpenGLError() {
bool foundError = false;
int glErr = glGetError();
while (glErr != GL_NO_ERROR) {
LOG::error("glEorr: {}", glErr);
foundError = true;
glErr = glGetError();
bool check_opengl_error() {
bool found_error = false;
int gl_err = glGetError();
while (gl_err != GL_NO_ERROR) {
LOG::error("glEorr: {}", gl_err);
found_error = true;
gl_err = glGetError();
}
return foundError;
return found_error;
}
std::string readShaderSource(const char* filePath) {
std::string read_shader_source(const char* file_path) {
std::string content;
std::ifstream fileStream(filePath, std::ios::in);
std::ifstream file_stream(file_path, std::ios::in);
if (!fileStream.is_open()) {
if (!file_stream.is_open()) {
LOG::error("file not exist");
}
std::string line = "";
while (!fileStream.eof()) {
while (!file_stream.eof()) {
getline(fileStream, line);
getline(file_stream, line);
content.append(line + "\n");
}
fileStream.close();
file_stream.close();
return content;
}
GLuint loadTexture(const char* texImagePath) {
GLuint textureID;
textureID = SOIL_load_OGL_texture(texImagePath, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
if (textureID == 0) {
GLuint load_texture(const char* tex_image_path) {
GLuint texture_id;
texture_id = SOIL_load_OGL_texture(tex_image_path, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y);
if (texture_id == 0) {
LOG::error("could not find texture file");
}
return textureID;
return texture_id;
}