Chronos 0.0
A advanced 2D rendering and animation system
|
This is a Uniform buffer for storing the uniform variables in the shaders. More...
#include <buffers.hpp>
Public Member Functions | |
void | create (Chronos::Engine::Device device) |
Creates the buffer and maps the memory. | |
void | update (VkExtent2D swapChainExtent, float x, float y, float rotation, float x_size, float y_size) |
Updates the buffer with the given information. | |
![]() | |
void | create (Chronos::Engine::Device device, VkBufferUsageFlags flags, VkMemoryPropertyFlags properties) |
This is used to initialize the buffer. | |
void | copy (void *data, VkCommandPool commandPool) |
Copies the data to the buffer. | |
void | destroy () |
Destroys the buffer and frees the memory. | |
Private Attributes | |
void * | data |
Temporary storage used to store the data before copying to the buffer. | |
Additional Inherited Members | |
![]() | |
VkBuffer | buffer |
The buffer. | |
VkDeviceSize | size |
The size of the buffer. | |
VkDeviceMemory | memory |
The device memory of the buffer. | |
This is a Uniform buffer for storing the uniform variables in the shaders.
Currently used only for shapes properties like postition, size etc. Can be updated on the fly using the update function.
Definition at line 104 of file buffers.hpp.
void Chronos::Engine::UniformBuffer::create | ( | Chronos::Engine::Device | device | ) |
Creates the buffer and maps the memory.
It uses the inherited function create to create the buffer
device | The device on which the buffer should be stored. |
Definition at line 73 of file buffers.cpp.
References Chronos::Engine::Buffer::create(), and Chronos::Engine::Device::device.
void Chronos::Engine::UniformBuffer::update | ( | VkExtent2D | swapChainExtent, |
float | x, | ||
float | y, | ||
float | rotation, | ||
float | x_size, | ||
float | y_size | ||
) |
Updates the buffer with the given information.
It creates a UniformBufferObject. The entires in this struct are calculated using glm functions. We need the swapChainExtent to calculate the projection matrix so that the scale is correct even when resizing windows.
swapChainExtent | The extent of the swap chain. |
x | The x coordinate of the shape. |
y | The y coordinate of the shape. |
rotation | The rotation of the shape. |
x_size | The x size of the shape. |
y_size | The y size of the shape. |
Definition at line 83 of file buffers.cpp.
References LOG, and Chronos::Engine::UniformBufferObject::model.
|
private |
Temporary storage used to store the data before copying to the buffer.
Definition at line 141 of file buffers.hpp.