Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Assets::CubemapTexture Class Reference

Owns Vulkan resources for a sampled cubemap texture. More...

#include <CubemapTexture.h>

Collaboration diagram for Engine::Assets::CubemapTexture:

Public Member Functions

 CubemapTexture ()=default
 Creates an empty cubemap texture with no Vulkan resources.
 CubemapTexture (CubemapTextureData data, Core::ApplicationContext *context)
 Creates a cubemap texture from CPU data and an application context.
 ~CubemapTexture ()
 Releases owned Vulkan resources.
 CubemapTexture (const CubemapTexture &)=delete
CubemapTextureoperator= (const CubemapTexture &)=delete
 CubemapTexture (CubemapTexture &&other) noexcept
 Move-constructs a cubemap texture and transfers Vulkan handles.
CubemapTextureoperator= (CubemapTexture &&other) noexcept
 Move-assigns a cubemap texture and transfers Vulkan handles.
void createResourcesAndUpload (VkCommandPool commandPool, VkQueue queue)
 Creates Vulkan resources and uploads all cubemap faces.
void cleanup ()
 Releases the Vulkan image, image memory, and image view.
VkDescriptorImageInfo getDescriptorInfo () const
 Gets descriptor data for shader sampling.
bool isValid () const
 Checks whether the texture has sampling resources.

Private Member Functions

void resetHandles ()

Private Attributes

CubemapTextureData data_ {}
Core::ApplicationContextcontext_ = nullptr
VkImage image_ = VK_NULL_HANDLE
VkDeviceMemory memory_ = VK_NULL_HANDLE
VkImageView imageView_ = VK_NULL_HANDLE
VkSampler sampler_ = VK_NULL_HANDLE

Detailed Description

Owns Vulkan resources for a sampled cubemap texture.

CubemapTexture uploads CubemapTextureData into a cube-compatible Vulkan image, creates a cube image view, and gets a clamp-to-edge sampler from the application sampler cache. The texture owns the image, memory, and image view. It does not own the ApplicationContext.

Definition at line 71 of file CubemapTexture.h.

Constructor & Destructor Documentation

◆ CubemapTexture() [1/4]

Engine::Assets::CubemapTexture::CubemapTexture ( )
default

Creates an empty cubemap texture with no Vulkan resources.

Referenced by CubemapTexture(), CubemapTexture(), operator=(), and operator=().

Here is the caller graph for this function:

◆ CubemapTexture() [2/4]

Engine::Assets::CubemapTexture::CubemapTexture ( CubemapTextureData data,
Core::ApplicationContext * context )

Creates a cubemap texture from CPU data and an application context.

Parameters
dataCPU-side cubemap data to upload later.
contextApplication context used for Vulkan device access. Must outlive this texture.

◆ ~CubemapTexture()

Engine::Assets::CubemapTexture::~CubemapTexture ( )

Releases owned Vulkan resources.

◆ CubemapTexture() [3/4]

Engine::Assets::CubemapTexture::CubemapTexture ( const CubemapTexture & )
delete

References CubemapTexture().

Here is the call graph for this function:

◆ CubemapTexture() [4/4]

Engine::Assets::CubemapTexture::CubemapTexture ( CubemapTexture && other)
noexcept

Move-constructs a cubemap texture and transfers Vulkan handles.

Parameters
otherTexture to move from.

References CubemapTexture().

Here is the call graph for this function:

Member Function Documentation

◆ cleanup()

void Engine::Assets::CubemapTexture::cleanup ( )

Releases the Vulkan image, image memory, and image view.

◆ createResourcesAndUpload()

void Engine::Assets::CubemapTexture::createResourcesAndUpload ( VkCommandPool commandPool,
VkQueue queue )

Creates Vulkan resources and uploads all cubemap faces.

Parameters
commandPoolCommand pool used for the one-time upload command buffer.
queueQueue used to submit the upload command buffer.
Exceptions
std::runtime_errorWhen the context or image data is missing, or Vulkan resource creation fails.

◆ getDescriptorInfo()

VkDescriptorImageInfo Engine::Assets::CubemapTexture::getDescriptorInfo ( ) const
nodiscard

Gets descriptor data for shader sampling.

Returns
Descriptor image info with sampler, cube image view, and shader-read layout.

◆ isValid()

bool Engine::Assets::CubemapTexture::isValid ( ) const
inlinenodiscard

Checks whether the texture has sampling resources.

Returns
True when both the image view and sampler are valid.

Definition at line 130 of file CubemapTexture.h.

References imageView_, and sampler_.

◆ operator=() [1/2]

CubemapTexture & Engine::Assets::CubemapTexture::operator= ( const CubemapTexture & )
delete

References CubemapTexture().

Here is the call graph for this function:

◆ operator=() [2/2]

CubemapTexture & Engine::Assets::CubemapTexture::operator= ( CubemapTexture && other)
noexcept

Move-assigns a cubemap texture and transfers Vulkan handles.

Parameters
otherTexture to move from.
Returns
This texture.

References CubemapTexture().

Here is the call graph for this function:

◆ resetHandles()

void Engine::Assets::CubemapTexture::resetHandles ( )
private

Member Data Documentation

◆ context_

Core::ApplicationContext* Engine::Assets::CubemapTexture::context_ = nullptr
private

Definition at line 134 of file CubemapTexture.h.

◆ data_

CubemapTextureData Engine::Assets::CubemapTexture::data_ {}
private

Definition at line 133 of file CubemapTexture.h.

◆ image_

VkImage Engine::Assets::CubemapTexture::image_ = VK_NULL_HANDLE
private

Definition at line 135 of file CubemapTexture.h.

◆ imageView_

VkImageView Engine::Assets::CubemapTexture::imageView_ = VK_NULL_HANDLE
private

Definition at line 137 of file CubemapTexture.h.

Referenced by isValid().

◆ memory_

VkDeviceMemory Engine::Assets::CubemapTexture::memory_ = VK_NULL_HANDLE
private

Definition at line 136 of file CubemapTexture.h.

◆ sampler_

VkSampler Engine::Assets::CubemapTexture::sampler_ = VK_NULL_HANDLE
private

Definition at line 138 of file CubemapTexture.h.

Referenced by isValid().


The documentation for this class was generated from the following file:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Texture/CubemapTexture.h