From 3cfb65320c1a33dc847ecd1998dcf163798e2876 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 24 Oct 2025 17:21:17 +0200 Subject: [PATCH] linter: opengl_shader.cpp --- source/rendering/opengl/opengl_shader.cpp | 12 ++++++------ source/rendering/opengl/opengl_shader.hpp | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source/rendering/opengl/opengl_shader.cpp b/source/rendering/opengl/opengl_shader.cpp index 7db51ad..e610f03 100644 --- a/source/rendering/opengl/opengl_shader.cpp +++ b/source/rendering/opengl/opengl_shader.cpp @@ -15,7 +15,7 @@ OpenGLShader::~OpenGLShader() { } #ifndef __APPLE__ -bool OpenGLShader::initGLExtensions() { +auto OpenGLShader::initGLExtensions() -> bool { glCreateShader = (PFNGLCREATESHADERPROC)SDL_GL_GetProcAddress("glCreateShader"); glShaderSource = (PFNGLSHADERSOURCEPROC)SDL_GL_GetProcAddress("glShaderSource"); glCompileShader = (PFNGLCOMPILESHADERPROC)SDL_GL_GetProcAddress("glCompileShader"); @@ -62,7 +62,7 @@ void OpenGLShader::checkGLError(const char* operation) { } } -GLuint OpenGLShader::compileShader(const std::string& source, GLenum shader_type) { +auto OpenGLShader::compileShader(const std::string& source, GLenum shader_type) -> GLuint { if (source.empty()) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ERROR: El código fuente del shader está vacío"); @@ -105,7 +105,7 @@ GLuint OpenGLShader::compileShader(const std::string& source, GLenum shader_type return shader_id; } -GLuint OpenGLShader::linkProgram(GLuint vertex_shader, GLuint fragment_shader) { +auto OpenGLShader::linkProgram(GLuint vertex_shader, GLuint fragment_shader) -> GLuint { GLuint program = glCreateProgram(); if (program == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, @@ -211,7 +211,7 @@ void OpenGLShader::createQuadGeometry() { glBindVertexArray(0); } -GLuint OpenGLShader::getTextureID(SDL_Texture* texture) { +auto OpenGLShader::getTextureID(SDL_Texture* texture) -> GLuint { if (!texture) return 1; SDL_PropertiesID props = SDL_GetTextureProperties(texture); @@ -237,10 +237,10 @@ GLuint OpenGLShader::getTextureID(SDL_Texture* texture) { return texture_id; } -bool OpenGLShader::init(SDL_Window* window, +auto OpenGLShader::init(SDL_Window* window, SDL_Texture* texture, const std::string& vertex_source, - const std::string& fragment_source) { + const std::string& fragment_source) -> bool { window_ = window; back_buffer_ = texture; renderer_ = SDL_GetRenderer(window); diff --git a/source/rendering/opengl/opengl_shader.hpp b/source/rendering/opengl/opengl_shader.hpp index 7c979fd..3617db7 100644 --- a/source/rendering/opengl/opengl_shader.hpp +++ b/source/rendering/opengl/opengl_shader.hpp @@ -23,23 +23,23 @@ class OpenGLShader : public ShaderBackend { OpenGLShader() = default; ~OpenGLShader() override; - bool init(SDL_Window* window, + auto init(SDL_Window* window, SDL_Texture* texture, const std::string& vertex_source, - const std::string& fragment_source) override; + const std::string& fragment_source) -> bool override; void render() override; void setTextureSize(float width, float height) override; - void cleanup() override; - bool isHardwareAccelerated() const override { return is_initialized_; } + void cleanup() override final; + [[nodiscard]] auto isHardwareAccelerated() const -> bool override { return is_initialized_; } private: // Funciones auxiliares - bool initGLExtensions(); - GLuint compileShader(const std::string& source, GLenum shader_type); - GLuint linkProgram(GLuint vertex_shader, GLuint fragment_shader); + auto initGLExtensions() -> bool; + auto compileShader(const std::string& source, GLenum shader_type) -> GLuint; + auto linkProgram(GLuint vertex_shader, GLuint fragment_shader) -> GLuint; void createQuadGeometry(); - GLuint getTextureID(SDL_Texture* texture); + auto getTextureID(SDL_Texture* texture) -> GLuint; void checkGLError(const char* operation); // Estado SDL @@ -59,8 +59,8 @@ class OpenGLShader : public ShaderBackend { // Tamaños int window_width_ = 0; int window_height_ = 0; - float texture_width_ = 0.0f; - float texture_height_ = 0.0f; + float texture_width_ = 0.0F; + float texture_height_ = 0.0F; // Estado bool is_initialized_ = false;