diff --git a/AGENTS.md b/AGENTS.md index f3c4dc8..bf08955 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,6 +42,7 @@ to the custom scripts instead of system-installed packages. - **4-space indentation** - **No semicolons after closing braces** for namespaces/classes - `auto` for obvious types (e.g. `auto main(...) -> int`) +- **East const** (e.g. `char const*` not `const char*`) - `<>` includes only for system headers (std, OS, etc.) - `""` includes for third-party dependencies (e.g. `fmt`, `nlohmann/json`) - **Naming:** `snake_case` for variables, functions, and classes diff --git a/cbt/opengl/buffer.cpp b/cbt/opengl/buffer.cpp index 38d527c..1cd9766 100644 --- a/cbt/opengl/buffer.cpp +++ b/cbt/opengl/buffer.cpp @@ -45,7 +45,7 @@ auto buffer::unbind() const -> void { glBindBuffer(static_cast(m_type), 0); } -auto buffer::upload(const void* data, size_t size) -> void { +auto buffer::upload(void const* data, size_t size) -> void { bind(); glBufferData(static_cast(m_type), size, data, GL_STATIC_DRAW); unbind(); @@ -55,7 +55,7 @@ auto buffer::upload(std::vector data) -> void { upload(data.data(), data.size()); } -auto buffer::upload_dynamic(const void* data, size_t size) -> void { +auto buffer::upload_dynamic(void const* data, size_t size) -> void { bind(); glBufferData(static_cast(m_type), size, data, GL_DYNAMIC_DRAW); unbind(); diff --git a/cbt/opengl/buffer.hpp b/cbt/opengl/buffer.hpp index e959c9c..5dbd631 100644 --- a/cbt/opengl/buffer.hpp +++ b/cbt/opengl/buffer.hpp @@ -23,17 +23,17 @@ public: explicit buffer(buffer_type type); ~buffer(); - buffer(const buffer&) = delete; - buffer& operator=(const buffer&) = delete; + buffer(buffer const&) = delete; + buffer& operator=(buffer const&) = delete; buffer(buffer&& other) noexcept; buffer& operator=(buffer&& other) noexcept; auto bind() const -> void; auto unbind() const -> void; - auto upload(const void* data, size_t size) -> void; + auto upload(void const* data, size_t size) -> void; auto upload(std::vector data) -> void; - auto upload_dynamic(const void* data, size_t size) -> void; + auto upload_dynamic(void const* data, size_t size) -> void; auto id() const -> GLuint; auto valid() const -> bool; }; diff --git a/cbt/opengl/context.cpp b/cbt/opengl/context.cpp index a550d98..04adf10 100644 --- a/cbt/opengl/context.cpp +++ b/cbt/opengl/context.cpp @@ -33,10 +33,10 @@ auto context::setup_gl() -> bool { auto context::print_info() -> void { fmt::print("OpenGL Info:\n"); - fmt::print(" vendor | {}\n", std::string_view(reinterpret_cast(glGetString(GL_VENDOR)))); - fmt::print(" renderer| {}\n", std::string_view(reinterpret_cast(glGetString(GL_RENDERER)))); - fmt::print(" version | {}\n", std::string_view(reinterpret_cast(glGetString(GL_VERSION)))); - fmt::print(" glsl | {}\n", std::string_view(reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION)))); + fmt::print(" vendor | {}\n", std::string_view(reinterpret_cast(glGetString(GL_VENDOR)))); + fmt::print(" renderer| {}\n", std::string_view(reinterpret_cast(glGetString(GL_RENDERER)))); + fmt::print(" version | {}\n", std::string_view(reinterpret_cast(glGetString(GL_VERSION)))); + fmt::print(" glsl | {}\n", std::string_view(reinterpret_cast(glGetString(GL_SHADING_LANGUAGE_VERSION)))); fmt::print("\n"); } diff --git a/cbt/opengl/shader.cpp b/cbt/opengl/shader.cpp index 0c31153..b730d43 100644 --- a/cbt/opengl/shader.cpp +++ b/cbt/opengl/shader.cpp @@ -31,7 +31,7 @@ shader& shader::operator=(shader&& other) noexcept { return *this; } -auto shader::compile_vertex(const char* source) -> bool { +auto shader::compile_vertex(char const* source) -> bool { auto vert = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vert, 1, &source, nullptr); glCompileShader(vert); @@ -55,7 +55,7 @@ auto shader::compile_vertex(const char* source) -> bool { return true; } -auto shader::compile_fragment(const char* source) -> bool { +auto shader::compile_fragment(char const* source) -> bool { auto frag = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(frag, 1, &source, nullptr); glCompileShader(frag); diff --git a/cbt/opengl/shader.hpp b/cbt/opengl/shader.hpp index 0494296..5864a5a 100644 --- a/cbt/opengl/shader.hpp +++ b/cbt/opengl/shader.hpp @@ -13,14 +13,14 @@ public: shader(); ~shader(); - shader(const shader&) = delete; - shader& operator=(const shader&) = delete; + shader(shader const&) = delete; + shader& operator=(shader const&) = delete; shader(shader&& other) noexcept; shader& operator=(shader&& other) noexcept; - auto compile_vertex(const char* source) -> bool; - auto compile_fragment(const char* source) -> bool; + auto compile_vertex(char const* source) -> bool; + auto compile_fragment(char const* source) -> bool; auto link() -> bool; auto use() const -> void; auto unuse() const -> void; diff --git a/cbt/opengl/texture.cpp b/cbt/opengl/texture.cpp index 9e9b815..4702a64 100644 --- a/cbt/opengl/texture.cpp +++ b/cbt/opengl/texture.cpp @@ -46,7 +46,7 @@ auto texture::unbind() -> void { glBindTexture(static_cast(m_target), 0); } -auto texture::upload(const void* data, int width, int height, texture_format format, texture_type type) -> void { +auto texture::upload(void const* data, int width, int height, texture_format format, texture_type type) -> void { bind(); glTexImage2D(static_cast(m_target), 0, static_cast(format), width, height, 0, diff --git a/cbt/opengl/texture.hpp b/cbt/opengl/texture.hpp index d77f856..6329074 100644 --- a/cbt/opengl/texture.hpp +++ b/cbt/opengl/texture.hpp @@ -38,15 +38,15 @@ public: explicit texture(texture_target target); ~texture(); - texture(const texture&) = delete; - texture& operator=(const texture&) = delete; + texture(texture const&) = delete; + texture& operator=(texture const&) = delete; texture(texture&& other) noexcept; texture& operator=(texture&& other) noexcept; auto bind(GLuint unit = 0) -> void; auto unbind() -> void; - auto upload(const void* data, int width, int height, texture_format format, texture_type type) -> void; + auto upload(void const* data, int width, int height, texture_format format, texture_type type) -> void; auto set_filter(GLenum min_filter, GLenum mag_filter) -> void; auto set_wrap(GLenum wrap_s, GLenum wrap_t) -> void; auto generate_mipmaps() -> void; diff --git a/cbt/opengl/vao.hpp b/cbt/opengl/vao.hpp index 41603e5..ca07609 100644 --- a/cbt/opengl/vao.hpp +++ b/cbt/opengl/vao.hpp @@ -11,8 +11,8 @@ public: vao(); ~vao(); - vao(const vao&) = delete; - vao& operator=(const vao&) = delete; + vao(vao const&) = delete; + vao& operator=(vao const&) = delete; vao(vao&& other) noexcept; vao& operator=(vao&& other) noexcept; diff --git a/cuber.cpp b/cuber.cpp index 8ae2f44..5ec52b7 100644 --- a/cuber.cpp +++ b/cuber.cpp @@ -19,7 +19,7 @@ auto main([[maybe_unused]]int argc, [[maybe_unused]]char const* argv[]) -> int { // compile shader auto prog = cbt::opengl::shader(); - const char* vert_src = R"glsl( + char const* vert_src = R"glsl( #version 410 core layout(location = 0) in vec3 a_pos; layout(location = 1) in vec3 a_color; @@ -30,7 +30,7 @@ auto main([[maybe_unused]]int argc, [[maybe_unused]]char const* argv[]) -> int { } )glsl"; - const char* frag_src = R"glsl( + char const* frag_src = R"glsl( #version 410 core in vec3 v_color; out vec4 frag_color;