Chronos 0.0
A advanced 2D rendering and animation system
|
This class holds the Vulkan data and objects needed for a texture. More...
#include <texture.hpp>
Public Member Functions | |
void | create (Chronos::Engine::Device device, VkCommandPool commandPool, std::string texturePath, std::string textureName) |
Create the texture by loading the texture from the given path. Only supports jpg and png images. | |
void | create (Chronos::Engine::Device device, VkCommandPool commandPool, void *data, size_t texWidth, size_t texHeight, VkDeviceSize imageSize, VkFormat format, std::string textureName) |
Create the texture by loading the texture from the given raw data. | |
void | destroy () |
Destroy the texture assets. | |
Public Attributes | |
VkDeviceMemory | textureImageMemory |
The memory for the texture. | |
VkImage | textureImage |
The image for the texture. | |
VkImageView | textureImageView |
The image view for the texture. | |
std::string | texturePath |
The path of the texture that it was loaded from. | |
std::string | textureName |
The name of the texture. | |
int | height |
int | width |
Private Attributes | |
Chronos::Engine::Device | device |
The device that has the texture. | |
This class holds the Vulkan data and objects needed for a texture.
The items needed for creating a texture that are stored in this class are:
VkDeviceMemory
for the texture memoryVkImage
for the textureVkImageView
for the texture image view Definition at line 134 of file texture.hpp.
void Chronos::Engine::Texture::create | ( | Chronos::Engine::Device | device, |
VkCommandPool | commandPool, | ||
std::string | texturePath, | ||
std::string | textureName | ||
) |
Create the texture by loading the texture from the given path. Only supports jpg and png images.
device | The device that has the texture. |
commandPool | The command pool to create the temporary command buffer from. |
texturePath | The path to the texture(only jpg or png). |
textureName | The name of the texture(must be unique). |
Definition at line 83 of file texture.cpp.
References Chronos::Engine::copyBufferToImage(), Chronos::Engine::createBuffer(), Chronos::Engine::createImage(), Chronos::Engine::createImageView(), Chronos::Engine::createTextureSampler(), Chronos::Engine::Device::device, device, height, textureImage, textureImageMemory, textureImageView, textureName, texturePath, Chronos::Engine::transitionImageLayout(), and width.
void Chronos::Engine::Texture::create | ( | Chronos::Engine::Device | device, |
VkCommandPool | commandPool, | ||
void * | data, | ||
size_t | texWidth, | ||
size_t | texHeight, | ||
VkDeviceSize | imageSize, | ||
VkFormat | format, | ||
std::string | textureName | ||
) |
Create the texture by loading the texture from the given raw data.
Used in Text Rendering
device | The device that has the texture. |
commandPool | The command pool to create the temporary command buffer from. |
data | The raw data of the texture. |
texWidth | The width of the texture. |
texHeight | The height of the texture. |
imageSize | The size of the image. |
format | The format of the image. |
textureName | The name of the texture(must be unique). |
Definition at line 149 of file texture.cpp.
References Chronos::Engine::copyBufferToImage(), Chronos::Engine::createBuffer(), Chronos::Engine::createImage(), Chronos::Engine::createImageView(), Chronos::Engine::Device::device, and Chronos::Engine::transitionImageLayout().
void Chronos::Engine::Texture::destroy | ( | ) |
|
private |
The device that has the texture.
Definition at line 210 of file texture.hpp.
int Chronos::Engine::Texture::height |
Definition at line 199 of file texture.hpp.
VkImage Chronos::Engine::Texture::textureImage |
The image for the texture.
Definition at line 144 of file texture.hpp.
VkDeviceMemory Chronos::Engine::Texture::textureImageMemory |
The memory for the texture.
Definition at line 139 of file texture.hpp.
VkImageView Chronos::Engine::Texture::textureImageView |
The image view for the texture.
Definition at line 149 of file texture.hpp.
std::string Chronos::Engine::Texture::textureName |
The name of the texture.
Definition at line 197 of file texture.hpp.
std::string Chronos::Engine::Texture::texturePath |
The path of the texture that it was loaded from.
Definition at line 192 of file texture.hpp.
int Chronos::Engine::Texture::width |
Definition at line 200 of file texture.hpp.