diff options
Diffstat (limited to 'src/rendering')
| -rw-r--r-- | src/rendering/framebuffer.cpp | 2 | ||||
| -rw-r--r-- | src/rendering/framebuffer.h | 16 | ||||
| -rw-r--r-- | src/rendering/index_buffer.cpp | 2 | ||||
| -rw-r--r-- | src/rendering/index_buffer.h | 8 | ||||
| -rw-r--r-- | src/rendering/renderer.cpp | 16 | ||||
| -rw-r--r-- | src/rendering/renderer.h | 110 | ||||
| -rw-r--r-- | src/rendering/shader.cpp | 18 | ||||
| -rw-r--r-- | src/rendering/shader.h | 44 | ||||
| -rw-r--r-- | src/rendering/texture.cpp | 8 | ||||
| -rw-r--r-- | src/rendering/texture.h | 18 | ||||
| -rw-r--r-- | src/rendering/texture_manager.cpp | 10 | ||||
| -rw-r--r-- | src/rendering/texture_manager.h | 10 | ||||
| -rw-r--r-- | src/rendering/uniform_buffer.cpp | 2 | ||||
| -rw-r--r-- | src/rendering/uniform_buffer.h | 6 | ||||
| -rw-r--r-- | src/rendering/vertex_array.cpp | 4 | ||||
| -rw-r--r-- | src/rendering/vertex_array.h | 14 | ||||
| -rw-r--r-- | src/rendering/vertex_buffer.cpp | 2 | ||||
| -rw-r--r-- | src/rendering/vertex_buffer.h | 20 |
18 files changed, 156 insertions, 154 deletions
diff --git a/src/rendering/framebuffer.cpp b/src/rendering/framebuffer.cpp index e227dcf..089c31e 100644 --- a/src/rendering/framebuffer.cpp +++ b/src/rendering/framebuffer.cpp @@ -5,7 +5,7 @@ namespace Donut { - Ref<Framebuffer> Framebuffer::create(const FramebufferSpecification& spec) + auto Framebuffer::create(const FramebufferSpecification& spec) -> Ref<Framebuffer> { switch (Renderer::get_api()) { diff --git a/src/rendering/framebuffer.h b/src/rendering/framebuffer.h index 1d42d85..a01a81b 100644 --- a/src/rendering/framebuffer.h +++ b/src/rendering/framebuffer.h @@ -49,17 +49,17 @@ namespace Donut public: virtual ~Framebuffer() = default; - virtual void bind() = 0; - virtual void unbind() = 0; + virtual auto bind() -> void = 0; + virtual auto unbind() -> void = 0; - virtual void resize(uint32_t width, uint32_t height) = 0; - virtual int read_pixel(uint32_t attachment_index, int x, int y) = 0; + virtual auto resize(uint32_t width, uint32_t height) -> void = 0; + virtual auto read_pixel(uint32_t attachment_index, int x, int y) -> int = 0; - virtual void clear_attachment(uint32_t attachment_index, int value) = 0; - virtual uint32_t get_color_attachment_renderer_id(uint32_t index = 0) const = 0; + virtual auto clear_attachment(uint32_t attachment_index, int value) -> void = 0; + virtual auto get_color_attachment_renderer_id(uint32_t index = 0) const -> uint32_t = 0; - virtual const FramebufferSpecification& get_specification() const = 0; + virtual auto get_specification() const -> const FramebufferSpecification& = 0; - static Ref<Framebuffer> create(const FramebufferSpecification& spec); + static auto create(const FramebufferSpecification& spec) -> Ref<Framebuffer>; }; }; diff --git a/src/rendering/index_buffer.cpp b/src/rendering/index_buffer.cpp index 1095e3b..9603c72 100644 --- a/src/rendering/index_buffer.cpp +++ b/src/rendering/index_buffer.cpp @@ -6,7 +6,7 @@ namespace Donut { - IndexBuffer* IndexBuffer::create(const uint32_t* indices, uint32_t count) + auto IndexBuffer::create(const uint32_t* indices, uint32_t count) -> IndexBuffer* { switch (Renderer::get_api()) { diff --git a/src/rendering/index_buffer.h b/src/rendering/index_buffer.h index 856559a..8389f2d 100644 --- a/src/rendering/index_buffer.h +++ b/src/rendering/index_buffer.h @@ -9,10 +9,10 @@ namespace Donut public: virtual ~IndexBuffer() = default; - virtual void bind() const = 0; - virtual void unbind() const = 0; - virtual uint32_t get_count() const = 0; + virtual auto bind() const -> void = 0; + virtual auto unbind() const -> void = 0; + virtual auto get_count() const -> uint32_t = 0; - static IndexBuffer* create(const uint32_t* indices, uint32_t count); + static auto create(const uint32_t* indices, uint32_t count) -> IndexBuffer*; }; }; diff --git a/src/rendering/renderer.cpp b/src/rendering/renderer.cpp index 5e4682c..28b7962 100644 --- a/src/rendering/renderer.cpp +++ b/src/rendering/renderer.cpp @@ -7,7 +7,7 @@ namespace Donut { - Scope<RendererAPI> RendererAPI::create() + auto RendererAPI::create() -> Scope<RendererAPI> { switch (s_api) { @@ -22,25 +22,25 @@ namespace Donut RendererAPI::API RendererAPI::s_api = RendererAPI::API::OpenGL; - void Renderer::init() + auto Renderer::init() -> void { RenderCommand::init(); RenderCommand::enable_depth_test(); } - void Renderer::shutdown() + auto Renderer::shutdown() -> void { } - void Renderer::on_window_resize(uint32_t width, uint32_t height) + auto Renderer::on_window_resize(uint32_t width, uint32_t height) -> void { RenderCommand::set_viewport(0, 0, width, height); } - void Renderer::submit(const Ref<Shader>& shader, + auto Renderer::submit(const Ref<Shader>& shader, const Ref<VertexArray>& vertex_array, const glm::mat4& transform, - const glm::mat4& view_projection) + const glm::mat4& view_projection) -> void { shader->bind(); shader->set_mat4("u_ViewProjection", view_projection); @@ -52,12 +52,12 @@ namespace Donut Scope<RendererAPI> RenderCommand::s_renderer_api = RendererAPI::create(); - void Renderer::set_clear_color(const glm::vec4& color) + auto Renderer::set_clear_color(const glm::vec4& color) -> void { RenderCommand::set_clear_color(color); } - void Renderer::clear() + auto Renderer::clear() -> void { RenderCommand::clear(); } diff --git a/src/rendering/renderer.h b/src/rendering/renderer.h index ea200db..189723d 100644 --- a/src/rendering/renderer.h +++ b/src/rendering/renderer.h @@ -9,124 +9,126 @@ namespace Donut { - class RendererAPI + class RendererAPI { public: - enum class API + enum class API { - None = 0, + None = 0, OpenGL = 1, Vulkan = 2, }; + public: virtual ~RendererAPI() = default; - virtual void init() = 0; - virtual void set_viewport(uint32_t x, uint32_t y, - uint32_t width, uint32_t height) = 0; - virtual void set_clear_color(const glm::vec4& color) = 0; - virtual void clear() = 0; - virtual void enable_depth_test() = 0; - virtual void disable_depth_test() = 0; - virtual void set_face_culling(bool enabled) = 0; - virtual void enable_blending() = 0; - virtual void disable_blending() = 0; + virtual auto init() -> void = 0; + virtual auto set_viewport(uint32_t x, uint32_t y, + uint32_t width, uint32_t height) -> void = 0; + virtual auto set_clear_color(const glm::vec4& color) -> void = 0; + virtual auto clear() -> void = 0; + virtual auto enable_depth_test() -> void = 0; + virtual auto disable_depth_test() -> void = 0; + virtual auto set_face_culling(bool enabled) -> void = 0; + virtual auto enable_blending() -> void = 0; + virtual auto disable_blending() -> void = 0; + + virtual auto draw_indexed(const Ref<VertexArray>& vertex_array, + uint32_t index_count = 0) -> void = 0; + + virtual auto draw_arrays(uint32_t vertex_count, uint32_t first = 0) -> void = 0; + virtual auto draw_lines(const Ref<VertexArray>& vertex_array, + uint32_t index_count = 0) -> void = 0; + virtual auto bind_texture(uint32_t texture_id, uint32_t slot = 0) -> void = 0; + virtual auto bind_image_texture(uint32_t texture_id, + uint32_t slot = 0, + bool read_only = false) -> void = 0; + virtual auto read_pixels(uint32_t x, uint32_t y, uint32_t width, uint32_t height, + uint32_t format, uint32_t type, void* pixels) -> void = 0; - virtual void draw_indexed(const Ref<VertexArray>& vertex_array, - uint32_t index_count = 0) = 0; - - virtual void draw_arrays(uint32_t vertex_count, uint32_t first = 0) = 0; - virtual void draw_lines(const Ref<VertexArray>& vertex_array, - uint32_t index_count = 0) = 0; - virtual void bind_texture(uint32_t texture_id, uint32_t slot = 0) = 0; - virtual void bind_image_texture(uint32_t texture_id, - uint32_t slot = 0, - bool read_only = false) = 0; - virtual void read_pixels(uint32_t x, uint32_t y, uint32_t width, uint32_t height, - uint32_t format, uint32_t type, void* pixels) = 0; + inline static auto get_api() -> API { return s_api; } + inline static auto set_api(API api) -> void { s_api = api; } + static auto create() -> Scope<RendererAPI>; - inline static API get_api() { return s_api; } - inline static void set_api(API api) { s_api = api; } - static Scope<RendererAPI> create(); private: static API s_api; }; - class RenderCommand + class RenderCommand { public: - inline static void init() + inline static auto init() -> void { s_renderer_api->init(); } - inline static void set_viewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) + inline static auto set_viewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) -> void { s_renderer_api->set_viewport(x, y, width, height); } - inline static void set_clear_color(const glm::vec4& color) + inline static auto set_clear_color(const glm::vec4& color) -> void { s_renderer_api->set_clear_color(color); } - inline static void clear() + inline static auto clear() -> void { s_renderer_api->clear(); } - inline static void enable_depth_test() + inline static auto enable_depth_test() -> void { s_renderer_api->enable_depth_test(); } - inline static void disable_depth_test() + inline static auto disable_depth_test() -> void { s_renderer_api->disable_depth_test(); } - inline static void set_face_culling(bool enabled) + inline static auto set_face_culling(bool enabled) -> void { s_renderer_api->set_face_culling(enabled); } - inline static void enable_blending() + inline static auto enable_blending() -> void { s_renderer_api->enable_blending(); } - inline static void disable_blending() + inline static auto disable_blending() -> void { s_renderer_api->disable_blending(); } - inline static void draw_indexed(const Ref<VertexArray>& vertex_array, uint32_t index_count = 0) + inline static auto draw_indexed(const Ref<VertexArray>& vertex_array, uint32_t index_count = 0) -> void { s_renderer_api->draw_indexed(vertex_array, index_count); } - inline static void draw_arrays(uint32_t vertex_count, uint32_t first = 0) + inline static auto draw_arrays(uint32_t vertex_count, uint32_t first = 0) -> void { s_renderer_api->draw_arrays(vertex_count, first); } - inline static void draw_lines(const Ref<VertexArray>& vertex_array, uint32_t index_count = 0) + inline static auto draw_lines(const Ref<VertexArray>& vertex_array, uint32_t index_count = 0) -> void { s_renderer_api->draw_lines(vertex_array, index_count); } - inline static void bind_texture(uint32_t texture_id, uint32_t slot = 0) + inline static auto bind_texture(uint32_t texture_id, uint32_t slot = 0) -> void { s_renderer_api->bind_texture(texture_id, slot); } - inline static void bind_image_texture(uint32_t texture_id, uint32_t slot = 0, bool read_only = false) + inline static auto bind_image_texture(uint32_t texture_id, uint32_t slot = 0, bool read_only = false) -> void { s_renderer_api->bind_image_texture(texture_id, slot, read_only); } - inline static void read_pixels(uint32_t x, uint32_t y, uint32_t width, uint32_t height, - uint32_t format, uint32_t type, void* pixels) + inline static auto read_pixels(uint32_t x, uint32_t y, uint32_t width, uint32_t height, + uint32_t format, uint32_t type, void* pixels) -> void { s_renderer_api->read_pixels(x, y, width, height, format, type, pixels); } @@ -135,22 +137,22 @@ namespace Donut static Scope<RendererAPI> s_renderer_api; }; - class Renderer + class Renderer { public: - static void init(); - static void shutdown(); + static auto init() -> void; + static auto shutdown() -> void; - static void on_window_resize(uint32_t width, uint32_t height); + static auto on_window_resize(uint32_t width, uint32_t height) -> void; - static void submit(const Ref<Shader>& shader, + static auto submit(const Ref<Shader>& shader, const Ref<VertexArray>& vertex_array, const glm::mat4& transform, - const glm::mat4& view_projection); + const glm::mat4& view_projection) -> void; - static void set_clear_color(const glm::vec4& color); - static void clear(); + static auto set_clear_color(const glm::vec4& color) -> void; + static auto clear() -> void; - inline static RendererAPI::API get_api() { return RendererAPI::get_api(); } + inline static auto get_api() -> RendererAPI::API { return RendererAPI::get_api(); } }; }; diff --git a/src/rendering/shader.cpp b/src/rendering/shader.cpp index 1bbd0fc..8c6fa76 100644 --- a/src/rendering/shader.cpp +++ b/src/rendering/shader.cpp @@ -6,7 +6,7 @@ namespace Donut { - Shader* Shader::create(const std::string& filepath) + auto Shader::create(const std::string& filepath) -> Shader* { switch (Renderer::get_api()) { @@ -19,7 +19,7 @@ namespace Donut } } - Shader* Shader::create(const std::string& name, const std::string& vertex_src, const std::string& fragment_src) + auto Shader::create(const std::string& name, const std::string& vertex_src, const std::string& fragment_src) -> Shader* { switch (Renderer::get_api()) { @@ -32,7 +32,7 @@ namespace Donut } } - Shader* Shader::create_compute(const std::string& name, const std::string& compute_src) + auto Shader::create_compute(const std::string& name, const std::string& compute_src) -> Shader* { switch (Renderer::get_api()) { @@ -45,39 +45,39 @@ namespace Donut } } - void ShaderLibrary::add(const Ref<Shader>& shader) + auto ShaderLibrary::add(const Ref<Shader>& shader) -> void { auto& name = shader->get_name(); add(name, shader); } - void ShaderLibrary::add(const std::string& name, const Ref<Shader>& shader) + auto ShaderLibrary::add(const std::string& name, const Ref<Shader>& shader) -> void { m_shaders[name] = shader; } - Ref<Shader> ShaderLibrary::load(const std::string& filepath) + auto ShaderLibrary::load(const std::string& filepath) -> Ref<Shader> { auto shader = Ref<Shader>(Shader::create(filepath)); add(shader); return shader; } - Ref<Shader> ShaderLibrary::load(const std::string& name, const std::string& filepath) + auto ShaderLibrary::load(const std::string& name, const std::string& filepath) -> Ref<Shader> { auto shader = Ref<Shader>(Shader::create(filepath)); add(name, shader); return shader; } - Ref<Shader> ShaderLibrary::get(const std::string& name) + auto ShaderLibrary::get(const std::string& name) -> Ref<Shader> { if (exists(name)) return m_shaders[name]; return nullptr; } - bool ShaderLibrary::exists(const std::string& name) const + auto ShaderLibrary::exists(const std::string& name) const -> bool { return m_shaders.find(name) != m_shaders.end(); } diff --git a/src/rendering/shader.h b/src/rendering/shader.h index 3e05132..7e4f48c 100644 --- a/src/rendering/shader.h +++ b/src/rendering/shader.h @@ -18,40 +18,40 @@ namespace Donut public: virtual ~Shader() = default; - virtual void bind() const = 0; - virtual void unbind() const = 0; + virtual auto bind() const -> void = 0; + virtual auto unbind() const -> void = 0; - virtual void set_int( const std::string& name, int value) = 0; - virtual void set_int_array(const std::string& name, int* values, uint32_t count) = 0; - virtual void set_float( const std::string& name, float value) = 0; - virtual void set_float2( const std::string& name, const glm::vec2& value) = 0; - virtual void set_float3( const std::string& name, const glm::vec3& value) = 0; - virtual void set_float4( const std::string& name, const glm::vec4& value) = 0; - virtual void set_mat4( const std::string& name, const glm::mat4& value) = 0; + virtual auto set_int( const std::string& name, int value) -> void = 0; + virtual auto set_int_array(const std::string& name, int* values, uint32_t count) -> void = 0; + virtual auto set_float( const std::string& name, float value) -> void = 0; + virtual auto set_float2( const std::string& name, const glm::vec2& value) -> void = 0; + virtual auto set_float3( const std::string& name, const glm::vec3& value) -> void = 0; + virtual auto set_float4( const std::string& name, const glm::vec4& value) -> void = 0; + virtual auto set_mat4( const std::string& name, const glm::mat4& value) -> void = 0; - virtual void dispatch(uint32_t x, uint32_t y = 1, uint32_t z = 1) = 0; - virtual void dispatch_indirect(uint32_t offset = 0) = 0; - virtual void memory_barrier(uint32_t barriers) = 0; + virtual auto dispatch(uint32_t x, uint32_t y = 1, uint32_t z = 1) -> void = 0; + virtual auto dispatch_indirect(uint32_t offset = 0) -> void = 0; + virtual auto memory_barrier(uint32_t barriers) -> void = 0; - virtual const std::string& get_name() const = 0; - virtual uint32_t get_renderer_id() const = 0; + virtual auto get_name() const -> const std::string& = 0; + virtual auto get_renderer_id() const -> uint32_t = 0; - static Shader* create(const std::string& filepath); - static Shader* create(const std::string& name, const std::string& vertex_src, const std::string& fragment_src); - static Shader* create_compute(const std::string& name, const std::string& compute_src); + static auto create(const std::string& filepath) -> Shader*; + static auto create(const std::string& name, const std::string& vertex_src, const std::string& fragment_src) -> Shader*; + static auto create_compute(const std::string& name, const std::string& compute_src) -> Shader*; }; class ShaderLibrary { public: - void add(const Ref<Shader>& shader); - void add(const std::string& name, const Ref<Shader>& shader); - Ref<Shader> load(const std::string& filepath); - Ref<Shader> load(const std::string& name, const std::string& filepath); + auto add(const Ref<Shader>& shader) -> void; + auto add(const std::string& name, const Ref<Shader>& shader) -> void; + auto load(const std::string& filepath) -> Ref<Shader>; + auto load(const std::string& name, const std::string& filepath) -> Ref<Shader>; Ref<Shader> get(const std::string& name); - bool exists(const std::string& name) const; + auto exists(const std::string& name) const -> bool; private: std::unordered_map<std::string, Ref<Shader>> m_shaders; }; diff --git a/src/rendering/texture.cpp b/src/rendering/texture.cpp index a33edd0..b36be1b 100644 --- a/src/rendering/texture.cpp +++ b/src/rendering/texture.cpp @@ -6,7 +6,7 @@ namespace Donut { - Ref<Texture2D> Texture2D::create(uint32_t width, uint32_t height) + auto Texture2D::create(uint32_t width, uint32_t height) -> Ref<Texture2D> { switch (Renderer::get_api()) { @@ -21,7 +21,7 @@ namespace Donut } } - Ref<Texture2D> Texture2D::create(const std::string& path) + auto Texture2D::create(const std::string& path) -> Ref<Texture2D> { switch (Renderer::get_api()) { @@ -36,7 +36,7 @@ namespace Donut } } - Ref<CubemapTexture> CubemapTexture::create(uint32_t width, uint32_t height) + auto CubemapTexture::create(uint32_t width, uint32_t height) -> Ref<CubemapTexture> { switch (Renderer::get_api()) { @@ -51,7 +51,7 @@ namespace Donut } } - Ref<CubemapTexture> CubemapTexture::create_from_hdri(const std::string& path) + auto CubemapTexture::create_from_hdri(const std::string& path) -> Ref<CubemapTexture> { switch (Renderer::get_api()) { diff --git a/src/rendering/texture.h b/src/rendering/texture.h index 195605c..d7f3050 100644 --- a/src/rendering/texture.h +++ b/src/rendering/texture.h @@ -12,12 +12,12 @@ namespace Donut public: virtual ~Texture() = default; - virtual uint32_t get_width() const = 0; - virtual uint32_t get_height() const = 0; - virtual uint32_t get_renderer_id() const = 0; + virtual auto get_width() const -> uint32_t = 0; + virtual auto get_height() const -> uint32_t = 0; + virtual auto get_renderer_id() const -> uint32_t = 0; - virtual void set_data(void* data, uint32_t size) = 0; - virtual void bind(uint32_t slot = 0) const = 0; + virtual auto set_data(void* data, uint32_t size) -> void = 0; + virtual auto bind(uint32_t slot = 0) const -> void = 0; virtual void bind_as_image(uint32_t slot = 0, bool read_only = false) const = 0; @@ -28,15 +28,15 @@ namespace Donut : public Texture { public: - static Ref<Texture2D> create(uint32_t width, uint32_t height); - static Ref<Texture2D> create(const std::string& path); + static auto create(uint32_t width, uint32_t height) -> Ref<Texture2D>; + static auto create(const std::string& path) -> Ref<Texture2D>; }; class CubemapTexture : public Texture { public: - static Ref<CubemapTexture> create(uint32_t width, uint32_t height); - static Ref<CubemapTexture> create_from_hdri(const std::string& path); + static auto create(uint32_t width, uint32_t height) -> Ref<CubemapTexture>; + static auto create_from_hdri(const std::string& path) -> Ref<CubemapTexture>; }; }; diff --git a/src/rendering/texture_manager.cpp b/src/rendering/texture_manager.cpp index fff5dda..ad2c68b 100644 --- a/src/rendering/texture_manager.cpp +++ b/src/rendering/texture_manager.cpp @@ -5,28 +5,28 @@ namespace Donut { - Ref<Texture2D> TextureManager::create_texture(uint32_t width, uint32_t height) + auto TextureManager::create_texture(uint32_t width, uint32_t height) -> Ref<Texture2D> { return create_ref<OpenGLTexture2D>(width, height); } - void TextureManager::bind_texture(uint32_t texture_id, uint32_t slot) + auto TextureManager::bind_texture(uint32_t texture_id, uint32_t slot) -> void { RenderCommand::bind_texture(texture_id, slot); } - void TextureManager::bind_image_texture(uint32_t texture_id, uint32_t slot, bool read_only) + auto TextureManager::bind_image_texture(uint32_t texture_id, uint32_t slot, bool read_only) -> void { RenderCommand::bind_image_texture(texture_id, slot, read_only); } - void TextureManager::set_texture_data(uint32_t texture_id, void* data, uint32_t width, uint32_t height) + auto TextureManager::set_texture_data(uint32_t texture_id, void* data, uint32_t width, uint32_t height) -> void { glBindTexture(GL_TEXTURE_2D, texture_id); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); } - void TextureManager::resize_texture(uint32_t texture_id, uint32_t width, uint32_t height) + auto TextureManager::resize_texture(uint32_t texture_id, uint32_t width, uint32_t height) -> void { glBindTexture(GL_TEXTURE_2D, texture_id); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); diff --git a/src/rendering/texture_manager.h b/src/rendering/texture_manager.h index 902a27d..02c32b1 100644 --- a/src/rendering/texture_manager.h +++ b/src/rendering/texture_manager.h @@ -9,11 +9,11 @@ namespace Donut class TextureManager { public: - static Ref<Texture2D> create_texture(uint32_t width, uint32_t height); + static auto create_texture(uint32_t width, uint32_t height) -> Ref<Texture2D>; - static void bind_texture(uint32_t texture_id, uint32_t slot = 0); - static void bind_image_texture(uint32_t texture_id, uint32_t slot = 0, bool read_only = false); - static void set_texture_data(uint32_t texture_id, void* data, uint32_t width, uint32_t height); - static void resize_texture(uint32_t texture_id, uint32_t width, uint32_t height); + static auto bind_texture(uint32_t texture_id, uint32_t slot = 0) -> void; + static auto bind_image_texture(uint32_t texture_id, uint32_t slot = 0, bool read_only = false) -> void; + static auto set_texture_data(uint32_t texture_id, void* data, uint32_t width, uint32_t height) -> void; + static auto resize_texture(uint32_t texture_id, uint32_t width, uint32_t height) -> void; }; }; diff --git a/src/rendering/uniform_buffer.cpp b/src/rendering/uniform_buffer.cpp index 4e693a2..c344aec 100644 --- a/src/rendering/uniform_buffer.cpp +++ b/src/rendering/uniform_buffer.cpp @@ -6,7 +6,7 @@ namespace Donut { - Ref<UniformBuffer> UniformBuffer::create(uint32_t size, uint32_t binding) + auto UniformBuffer::create(uint32_t size, uint32_t binding) -> Ref<UniformBuffer> { switch (Renderer::get_api()) { diff --git a/src/rendering/uniform_buffer.h b/src/rendering/uniform_buffer.h index 4df39d9..eb28e53 100644 --- a/src/rendering/uniform_buffer.h +++ b/src/rendering/uniform_buffer.h @@ -10,9 +10,9 @@ namespace Donut public: virtual ~UniformBuffer() = default; - virtual void set_data(const void* data, uint32_t size, uint32_t offset = 0) = 0; - virtual void bind(uint32_t binding) = 0; + virtual auto set_data(const void* data, uint32_t size, uint32_t offset = 0) -> void = 0; + virtual auto bind(uint32_t binding) -> void = 0; - static Ref<UniformBuffer> create(uint32_t size, uint32_t binding); + static auto create(uint32_t size, uint32_t binding) -> Ref<UniformBuffer>; }; }; diff --git a/src/rendering/vertex_array.cpp b/src/rendering/vertex_array.cpp index bb92ff3..f1fd6c1 100644 --- a/src/rendering/vertex_array.cpp +++ b/src/rendering/vertex_array.cpp @@ -6,7 +6,7 @@ namespace Donut { - uint32_t VertexBufferElement::get_size_of_type(uint32_t type) + auto VertexBufferElement::get_size_of_type(uint32_t type) -> uint32_t { switch (type) { @@ -17,7 +17,7 @@ namespace Donut } } - VertexArray* VertexArray::create() + auto VertexArray::create() -> VertexArray* { switch (Renderer::get_api()) { diff --git a/src/rendering/vertex_array.h b/src/rendering/vertex_array.h index a39849f..921df56 100644 --- a/src/rendering/vertex_array.h +++ b/src/rendering/vertex_array.h @@ -14,15 +14,15 @@ namespace Donut public: virtual ~VertexArray() = default; - virtual void bind() const = 0; - virtual void unbind() const = 0; + virtual auto bind() const -> void = 0; + virtual auto unbind() const -> void = 0; - virtual void add_vertex_buffer(const Ref<VertexBuffer>& vertex_buffer) = 0; - virtual void set_index_buffer(const Ref<IndexBuffer>& index_buffer) = 0; + virtual auto add_vertex_buffer(const Ref<VertexBuffer>& vertex_buffer) -> void = 0; + virtual auto set_index_buffer(const Ref<IndexBuffer>& index_buffer) -> void = 0; - virtual const std::vector<Ref<VertexBuffer>>& get_vertex_buffers() const = 0; - virtual const Ref<IndexBuffer>& get_index_buffer() const = 0; + virtual auto get_vertex_buffers() const -> const std::vector<Ref<VertexBuffer>>& = 0; + virtual auto get_index_buffer() const -> const Ref<IndexBuffer>& = 0; - static VertexArray* create(); + static auto create() -> VertexArray*; }; }; diff --git a/src/rendering/vertex_buffer.cpp b/src/rendering/vertex_buffer.cpp index 4929711..354d0cd 100644 --- a/src/rendering/vertex_buffer.cpp +++ b/src/rendering/vertex_buffer.cpp @@ -6,7 +6,7 @@ namespace Donut { - VertexBuffer* VertexBuffer::create(const void* data, uint32_t size) + auto VertexBuffer::create(const void* data, uint32_t size) -> VertexBuffer* { switch (Renderer::get_api()) { diff --git a/src/rendering/vertex_buffer.h b/src/rendering/vertex_buffer.h index 77a76c9..9cf66d8 100644 --- a/src/rendering/vertex_buffer.h +++ b/src/rendering/vertex_buffer.h @@ -12,7 +12,7 @@ namespace Donut uint8_t normalized; uint32_t offset; - static uint32_t get_size_of_type(uint32_t type); + static auto get_size_of_type(uint32_t type) -> uint32_t; }; class VertexBufferLayout @@ -22,7 +22,7 @@ namespace Donut ~VertexBufferLayout() = default; template<typename T> - void push(uint32_t count) + auto push(uint32_t count) -> void { static_assert(false); } @@ -48,8 +48,8 @@ namespace Donut m_stride += count * VertexBufferElement::get_size_of_type(0x1401); } - inline const std::vector<VertexBufferElement>& get_elements() const { return m_elements; } - inline uint32_t get_stride() const { return m_stride; } + inline auto get_elements() const -> const std::vector<VertexBufferElement>& { return m_elements; } + inline auto get_stride() const -> uint32_t { return m_stride; } private: std::vector<VertexBufferElement> m_elements; @@ -61,13 +61,13 @@ namespace Donut public: virtual ~VertexBuffer() = default; - virtual void bind() const = 0; - virtual void unbind() const = 0; - virtual void set_data(const void* data, uint32_t size) = 0; + virtual auto bind() const -> void = 0; + virtual auto unbind() const -> void = 0; + virtual auto set_data(const void* data, uint32_t size) -> void = 0; - virtual const VertexBufferLayout& get_layout() const = 0; - virtual void set_layout(const VertexBufferLayout& layout) = 0; + virtual auto get_layout() const -> const VertexBufferLayout& = 0; + virtual auto set_layout(const VertexBufferLayout& layout) -> void = 0; - static VertexBuffer* create(const void* data, uint32_t size); + static auto create(const void* data, uint32_t size) -> VertexBuffer*; }; }; |
