Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Fling::Texture Class Reference

An image represents a 2D file that has data about each pixel in the image. More...

#include <Texture.h>

Inherits Fling::Resource.

Public Member Functions

 Texture (Guid t_ID)
 
virtual ~Texture ()
 
FORCEINLINE UINT32 GetWidth () const
 
FORCEINLINE UINT32 GetHeight () const
 
FORCEINLINE INT32 GetChannels () const
 
FORCEINLINE UINT32 GetMipLevels () const
 
FORCEINLINE const VkImage & GetVkImage () const
 
FORCEINLINE const VkImageView & GetVkImageView () const
 
FORCEINLINE const VkSampler & GetSampler () const
 
FORCEINLINE VkDescriptorImageInfo * GetDescriptorInfo ()
 
FORCEINLINE const VkFormat & GetVkImageFormat () const
 
UINT64 GetImageSize () const
 Get the Image Size object (width * height * 4) Multiply by 4 because the pixel is laid out row by row with 4 bytes per pixel. More...
 
stbi_uc * GetPixelData () const
 Get the Pixel Data object. More...
 
void Release ()
 Release the Vulkan resources of this image. More...
 
- Public Member Functions inherited from Fling::Resource
 Resource (Fling::Guid t_ID)
 
virtual ~Resource ()=default
 
Fling::Guid_Handle GetGuidHandle () const
 Get GUID handle (just an int) for this resources guid. More...
 
const std::string & GetGuidString () const
 Get the human-readable string representation of this GUID. More...
 
std::string GetFilepathReleativeToAssets () const
 Returns the full file path that is relative to the assets path based on the GUID of this resource. More...
 

Static Public Member Functions

static std::shared_ptr< Fling::TextureCreate (Guid t_ID)
 

Private Member Functions

void LoadVulkanImage ()
 Loads the Vulkan resources needed for this image. More...
 
void CreateImageView ()
 Create a Image View object that is needed to sample this image from the swap chain. More...
 
void CreateTextureSampler ()
 
void CopyBufferToImage (VkBuffer t_Buffer)
 
void GenerateMipMaps (VkFormat imageFormat)
 

Private Attributes

UINT32 m_Width = 0
 Width of this image. More...
 
UINT32 m_Height = 0
 Height of this image. More...
 
UINT32 m_MipLevels = 0
 
INT32 m_Channels = 0
 The color channels of this image. More...
 
VkImage m_vVkImage
 The Vulkan image data. More...
 
VkImageView m_ImageView
 The view of this image for the swap chain. More...
 
VkSampler m_TextureSampler
 
VkDeviceMemory m_VkMemory
 The Vulkan memory resource for this image. More...
 
VkDescriptorImageInfo m_ImageInfo {}
 
stbi_uc * m_PixelData
 Pixel data of image. More...
 
VkFormat m_Format = VK_FORMAT_R8G8B8A8_UNORM
 

Additional Inherited Members

- Protected Attributes inherited from Fling::Resource
Fling::Guid m_Guid
 
std::string m_HumanReadableName
 

Detailed Description

An image represents a 2D file that has data about each pixel in the image.

Constructor & Destructor Documentation

◆ Texture()

Fling::Texture::Texture ( Guid  t_ID)
explicit

◆ ~Texture()

Fling::Texture::~Texture ( )
virtual

Member Function Documentation

◆ CopyBufferToImage()

void Fling::Texture::CopyBufferToImage ( VkBuffer  t_Buffer)
private

◆ Create()

std::shared_ptr< Fling::Texture > Fling::Texture::Create ( Guid  t_ID)
static

◆ CreateImageView()

void Fling::Texture::CreateImageView ( )
private

Create a Image View object that is needed to sample this image from the swap chain.

◆ CreateTextureSampler()

void Fling::Texture::CreateTextureSampler ( )
private

◆ GenerateMipMaps()

void Fling::Texture::GenerateMipMaps ( VkFormat  imageFormat)
private

◆ GetChannels()

FORCEINLINE INT32 Fling::Texture::GetChannels ( ) const
inline

◆ GetDescriptorInfo()

FORCEINLINE VkDescriptorImageInfo* Fling::Texture::GetDescriptorInfo ( )
inline

◆ GetHeight()

FORCEINLINE UINT32 Fling::Texture::GetHeight ( ) const
inline

◆ GetImageSize()

UINT64 Fling::Texture::GetImageSize ( ) const
inline

Get the Image Size object (width * height * 4) Multiply by 4 because the pixel is laid out row by row with 4 bytes per pixel.

Returns
INT32

◆ GetMipLevels()

FORCEINLINE UINT32 Fling::Texture::GetMipLevels ( ) const
inline

◆ GetPixelData()

stbi_uc* Fling::Texture::GetPixelData ( ) const
inline

Get the Pixel Data object.

Returns
stbi_uc*

◆ GetSampler()

FORCEINLINE const VkSampler& Fling::Texture::GetSampler ( ) const
inline

◆ GetVkImage()

FORCEINLINE const VkImage& Fling::Texture::GetVkImage ( ) const
inline

◆ GetVkImageFormat()

FORCEINLINE const VkFormat& Fling::Texture::GetVkImageFormat ( ) const
inline

◆ GetVkImageView()

FORCEINLINE const VkImageView& Fling::Texture::GetVkImageView ( ) const
inline

◆ GetWidth()

FORCEINLINE UINT32 Fling::Texture::GetWidth ( ) const
inline

◆ LoadVulkanImage()

void Fling::Texture::LoadVulkanImage ( )
private

Loads the Vulkan resources needed for this image.

◆ Release()

void Fling::Texture::Release ( )

Release the Vulkan resources of this image.

Field Documentation

◆ m_Channels

INT32 Fling::Texture::m_Channels = 0
private

The color channels of this image.

◆ m_Format

VkFormat Fling::Texture::m_Format = VK_FORMAT_R8G8B8A8_UNORM
private

◆ m_Height

UINT32 Fling::Texture::m_Height = 0
private

Height of this image.

◆ m_ImageInfo

VkDescriptorImageInfo Fling::Texture::m_ImageInfo {}
private

◆ m_ImageView

VkImageView Fling::Texture::m_ImageView
private

The view of this image for the swap chain.

◆ m_MipLevels

UINT32 Fling::Texture::m_MipLevels = 0
private

◆ m_PixelData

stbi_uc* Fling::Texture::m_PixelData
private

Pixel data of image.

◆ m_TextureSampler

VkSampler Fling::Texture::m_TextureSampler
private

◆ m_VkMemory

VkDeviceMemory Fling::Texture::m_VkMemory
private

The Vulkan memory resource for this image.

◆ m_vVkImage

VkImage Fling::Texture::m_vVkImage
private

The Vulkan image data.

◆ m_Width

UINT32 Fling::Texture::m_Width = 0
private

Width of this image.


The documentation for this class was generated from the following files: