79 void load(
VK_Window *window,
const std::string &texture_path,
const std::string &vertex_shader_path,
const std::string &fragment_shader_path,
size_t max_vertices);
105 void update_mvp(uint32_t image_index,
const glm::mat4 &mvp);
112 void render(VkCommandBuffer cmd, uint32_t image_index);
133 [[nodiscard]]
bool loaded()
const {
return batch_loaded; }
135 [[nodiscard]]
size_t capacity()
const {
return max_vertices; }
143 alignas(16) glm::mat4 mvp{1.0f};
147 void create_vertex_buffer();
149 void destroy_vertex_buffer();
151 void create_swapchain_resources();
153 void cleanup_swapchain_resources();
155 void create_descriptor_set_layout();
157 void create_uniform_buffers();
159 void destroy_uniform_buffers();
161 void create_descriptor_pool();
163 void create_descriptor_sets();
165 void create_pipeline();
167 void destroy_pipeline();
169 [[nodiscard]] std::vector<char> read_shader_file(
const std::string &path)
const;
171 VulkanContext context{};
173 VkPipelineCache pipeline_cache = VK_NULL_HANDLE;
175 VkFormat color_attachment_format = VK_FORMAT_UNDEFINED;
177 VkFormat depth_attachment_format = VK_FORMAT_UNDEFINED;
179 size_t image_count = 0;
182 std::string texture_path{};
184 std::string vertex_shader_path{};
186 std::string fragment_shader_path{};
189 TextureResource texture{};
191 BufferResource vertex_buffer{};
193 size_t max_vertices = 0;
195 size_t active_vertices = 0;
198 VkDescriptorSetLayout descriptor_set_layout = VK_NULL_HANDLE;
200 VkDescriptorPool descriptor_pool = VK_NULL_HANDLE;
202 std::vector<VkDescriptorSet> descriptor_sets{};
204 std::vector<BufferResource> uniform_buffers{};
207 VkPipelineLayout pipeline_layout = VK_NULL_HANDLE;
209 VkPipeline pipeline = VK_NULL_HANDLE;
211 bool additive_blending =
true;
213 bool depth_test_enabled =
false;
215 bool depth_write_enabled =
false;
217 bool batch_loaded =
false;
size_t vertex_count() const
void load(VK_Window *window, const std::string &texture_path, const std::string &vertex_shader_path, const std::string &fragment_shader_path, size_t max_vertices)
Create texture, vertex buffer, descriptors, and point-list pipeline.
void set_depth_write_enabled(bool enabled)
Enable or disable depth writes in the point-sprite pipeline.
void render(VkCommandBuffer cmd, uint32_t image_index)
Record point-sprite draw commands into an active rendering scope.
void update_mvp(uint32_t image_index, const glm::mat4 &mvp)
Update the MVP uniform for one swapchain image.
void resize(VK_Window *window)
Recreate swapchain-dependent resources after a window resize.
void cleanup()
Destroy all owned resources and reset the batch to an unloaded state.
void set_additive_blending(bool enabled)
Select additive or alpha-over color blending.
void upload_vertices(const PointSpriteVertex *vertices, size_t count)
Copy point vertices into the persistent mapped vertex buffer.
VK_PointSpriteBatch(VK_PointSpriteBatch &&)=delete
void set_depth_test_enabled(bool enabled)
Enable or disable depth testing in the point-sprite pipeline.
VK_PointSpriteBatch & operator=(VK_PointSpriteBatch &&)=delete
VK_PointSpriteBatch(const VK_PointSpriteBatch &)=delete
VK_PointSpriteBatch & operator=(const VK_PointSpriteBatch &)=delete
VK_PointSpriteBatch()=default
Construct an empty point-sprite batch.
Main Vulkan window wrapper for MXVK.
Minimal Vulkan handles shared across MXVK helpers.
Reusable Vulkan buffer, image, upload, and one-shot command helpers.
Utilities for loading and saving PNG images.
Vertex layout consumed by VK_PointSpriteBatch.
float color[4]
RGBA tint color passed to shader location 2.
float size
Rasterized point size in pixels, passed to shader location 1.
float position[3]
Vertex position passed to shader location 0.