diff --git a/core/rhi/opengl/render_target_opengl.cpp b/core/rhi/opengl/render_target_opengl.cpp index fec7ae7..cc8c078 100644 --- a/core/rhi/opengl/render_target_opengl.cpp +++ b/core/rhi/opengl/render_target_opengl.cpp @@ -70,10 +70,7 @@ GLint to_internal_format(texture_format format) { return 0; } -void render_target_opengl::init(int width, int height, texture_format format) { - width_ = width; - height_ = height; - +void render_target_opengl::on_init(int width, int height, texture_format format) { glGenFramebuffers(1, &fbo_); CHECK_GL_ERRORS glBindFramebuffer(GL_FRAMEBUFFER, fbo_); diff --git a/core/rhi/opengl/render_target_opengl.h b/core/rhi/opengl/render_target_opengl.h index 3a9ae48..debdfcb 100644 --- a/core/rhi/opengl/render_target_opengl.h +++ b/core/rhi/opengl/render_target_opengl.h @@ -4,7 +4,6 @@ class render_target_opengl : public render_target { public: - void init(int width, int height, texture_format format) override; ~render_target_opengl() override; @@ -18,6 +17,7 @@ public: void unlock() override; protected: + void on_init(int width, int height, texture_format format) override; void on_resize(int width, int height) override; private: diff --git a/core/rhi/render_resource.cpp b/core/rhi/render_resource.cpp deleted file mode 100644 index 86bef95..0000000 --- a/core/rhi/render_resource.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "render_resource.h" diff --git a/core/rhi/render_target.cpp b/core/rhi/render_target.cpp deleted file mode 100644 index 6625d95..0000000 --- a/core/rhi/render_target.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "render_target.h" diff --git a/core/rhi/render_target.h b/core/rhi/render_target.h index e04c31c..3a4b737 100644 --- a/core/rhi/render_target.h +++ b/core/rhi/render_target.h @@ -14,7 +14,11 @@ public: [[nodiscard]] int get_height() const override { return height_; } [[nodiscard]] int get_width() const override { return width_; } - virtual void init(int width, int height, texture_format format) = 0; + void init(const int width, const int height, const texture_format format) { + width_ = width; + height_ = height; + on_init(width, height, format); + } virtual void resize(const int width, const int height) { if (width_ == width && height_ == height) @@ -34,6 +38,7 @@ public: std::function)> on_resize_callback; protected: + virtual void on_init(int width, int height, texture_format format) = 0; virtual void on_resize(int width, int height) = 0; int width_ = 0; diff --git a/core/rhi/shader.cpp b/core/rhi/shader.cpp deleted file mode 100644 index 1ff07ac..0000000 --- a/core/rhi/shader.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "shader.h" diff --git a/core/rhi/texture.cpp b/core/rhi/texture.cpp deleted file mode 100644 index bf221e1..0000000 --- a/core/rhi/texture.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "texture.h"