-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove `VertexBufferCache`, allocate scratch on each draw. - Remove `RenderDevice` from `Drawable` constructors.
- Loading branch information
Showing
28 changed files
with
133 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,26 @@ | ||
#pragma once | ||
#include <bave/graphics/geometry.hpp> | ||
#include <bave/graphics/render_device.hpp> | ||
#include <memory> | ||
|
||
namespace bave { | ||
class Mesh { | ||
public: | ||
Mesh(Mesh const&) = delete; | ||
auto operator=(Mesh const&) -> Mesh& = delete; | ||
|
||
Mesh(Mesh&&) = default; | ||
auto operator=(Mesh&&) -> Mesh& = default; | ||
|
||
explicit Mesh(NotNull<RenderDevice*> render_device); | ||
|
||
~Mesh(); | ||
|
||
[[nodiscard]] auto get_render_device() const -> RenderDevice const& { return *m_render_device; } | ||
struct Data { | ||
std::span<std::byte const> bytes{}; | ||
std::size_t ibo_offset{}; | ||
}; | ||
|
||
[[nodiscard]] auto is_empty() const -> bool { return m_bytes.empty(); } | ||
[[nodiscard]] auto get_vertex_count() const -> std::uint32_t { return m_verts; } | ||
[[nodiscard]] auto get_index_count() const -> std::uint32_t { return m_indices; } | ||
|
||
void write(Geometry const& geometry); | ||
|
||
private: | ||
[[nodiscard]] auto get_buffer() const -> Ptr<detail::RenderBuffer>; | ||
void draw(vk::CommandBuffer command_buffer, std::uint32_t instance_count = 1) const; | ||
[[nodiscard]] auto get_data() const -> Data { return {.bytes = m_bytes, .ibo_offset = m_ibo_offset}; } | ||
|
||
NotNull<RenderDevice*> m_render_device; | ||
std::shared_ptr<detail::VertexBuffer> m_vbo{}; | ||
std::vector<std::byte> m_data{}; | ||
private: | ||
std::vector<std::byte> m_bytes{}; | ||
std::uint32_t m_verts{}; | ||
std::uint32_t m_indices{}; | ||
std::size_t m_ibo_offset{}; | ||
|
||
friend class Shader; | ||
}; | ||
} // namespace bave |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.