Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::VulkanImage2D Class Reference

Vulkan implementation of a 2D image resource. More...

#include <VulkanImage.h>

Inherits Raven::Image2D.

Public Member Functions

ILLUMINE_API VulkanImage2D (const ImageSpecification &spec)
 Construct a VulkanImage2D with the given specification.
ImageSpecificationGetSpecification () override
 Access the current image specification.
const ImageSpecificationGetSpecification () const override
 Get immutable reference to the image specification.
void Resize (const u32 width, const u32 height)
 Resize the image and recreate underlying Vulkan resources.
u32 GetWidth () const override
 Get the width of the image in pixels.
u32 GetHeight () const override
 Get the height of the image in pixels.
Crux::uvec2 GetSize () const override
 Get image size as 2D vector.
virtual float GetAspectRatio () const override
 Compute the aspect ratio (width / height) of the image.
ILLUMINE_API void Invalidate () override
 Recreate the Vulkan image and related resources (called on resize).
ILLUMINE_API void Release () override
 Release Vulkan resources associated with this image.
VulkanImageInfoGetImageInfo ()
 Get Vulkan-specific image handles.
const VulkanImageInfoGetImageInfo () const
VkImageView GetLayerImageView (u32 layer) const
 Get the image view corresponding to a specific layer.
Buffer GetBuffer () const override
 Get or set the raw image data buffer.
BufferGetBuffer () override
 Get a mutable reference to the internal buffer.
void CreatePerSpecificLayerImageViews (const std::vector< u32 > &layerIndices)
 Create image views only for specified layers.
ILLUMINE_API void CreatePerLayerImageViews () override
 Create image views for all layers.
ILLUMINE_API void GenerateMips () const
 Generate mipmaps for the image (if supported).
ILLUMINE_API void SetData (const void *data, usize size) const override
bool IsDepthFormat () const
Public Member Functions inherited from Raven::Image2D
virtual ~Image2D ()=default
Public Member Functions inherited from Raven::RefCounted
 RefCounted ()
virtual ~RefCounted ()
void IncRefCount ()
void DecRefCount ()
u32 GetRefCount () const

Public Attributes

ResourceState CurrentState = ResourceState::Undefined

Additional Inherited Members

Static Public Member Functions inherited from Raven::Image2D
static Ref< Image2DCreate (const ImageSpecification &spec)
 Factory method to create a concrete Image2D instance.

Detailed Description

Vulkan implementation of a 2D image resource.

Manages Vulkan image creation, views per layer/mip, resizing, and memory. Inherits from the generic Image2D interface.

Constructor & Destructor Documentation

◆ VulkanImage2D()

Raven::VulkanImage2D::VulkanImage2D ( const ImageSpecification & spec)

Construct a VulkanImage2D with the given specification.

Parameters
specSpecification describing image dimensions, format, etc.

Member Function Documentation

◆ CreatePerLayerImageViews()

void Raven::VulkanImage2D::CreatePerLayerImageViews ( )
overridevirtual

Create image views for all layers.

Implements Raven::Image2D.

◆ CreatePerSpecificLayerImageViews()

void Raven::VulkanImage2D::CreatePerSpecificLayerImageViews ( const std::vector< u32 > & layerIndices)

Create image views only for specified layers.

Parameters
layerIndicesVector of layer indices for which to create views.

◆ GenerateMips()

void Raven::VulkanImage2D::GenerateMips ( ) const

Generate mipmaps for the image (if supported).

◆ GetAspectRatio()

virtual float Raven::VulkanImage2D::GetAspectRatio ( ) const
inlineoverridevirtual

Compute the aspect ratio (width / height) of the image.

Returns
Aspect ratio as a float.

Implements Raven::Image2D.

◆ GetBuffer() [1/2]

Buffer Raven::VulkanImage2D::GetBuffer ( ) const
inlineoverridevirtual

Get or set the raw image data buffer.

Implements Raven::Image2D.

◆ GetBuffer() [2/2]

Buffer & Raven::VulkanImage2D::GetBuffer ( )
inlineoverridevirtual

Get a mutable reference to the internal buffer.

Allows modification of the buffer, e.g., for updates or transfers.

Implements Raven::Image2D.

◆ GetHeight()

u32 Raven::VulkanImage2D::GetHeight ( ) const
inlineoverridevirtual

Get the height of the image in pixels.

Returns
Height in pixels.

Implements Raven::Image2D.

◆ GetImageInfo() [1/2]

VulkanImageInfo & Raven::VulkanImage2D::GetImageInfo ( )
inline

Get Vulkan-specific image handles.

◆ GetImageInfo() [2/2]

const VulkanImageInfo & Raven::VulkanImage2D::GetImageInfo ( ) const
inline

◆ GetLayerImageView()

VkImageView Raven::VulkanImage2D::GetLayerImageView ( u32 layer) const
inline

Get the image view corresponding to a specific layer.

Parameters
layerIndex of the image layer.
Returns
Vulkan image view handle for the layer.

◆ GetSize()

Crux::uvec2 Raven::VulkanImage2D::GetSize ( ) const
inlineoverridevirtual

Get image size as 2D vector.

Returns
Vector containing width and height.

Implements Raven::Image2D.

◆ GetSpecification() [1/2]

const ImageSpecification & Raven::VulkanImage2D::GetSpecification ( ) const
inlineoverridevirtual

Get immutable reference to the image specification.

For read-only access to image parameters.

Implements Raven::Image2D.

◆ GetSpecification() [2/2]

ImageSpecification & Raven::VulkanImage2D::GetSpecification ( )
inlineoverridevirtual

Access the current image specification.

Implements Raven::Image2D.

◆ GetWidth()

u32 Raven::VulkanImage2D::GetWidth ( ) const
inlineoverridevirtual

Get the width of the image in pixels.

Returns
Width in pixels.

Implements Raven::Image2D.

◆ Invalidate()

void Raven::VulkanImage2D::Invalidate ( )
overridevirtual

Recreate the Vulkan image and related resources (called on resize).

Implements Raven::Image2D.

◆ IsDepthFormat()

bool Raven::VulkanImage2D::IsDepthFormat ( ) const
inline

◆ Release()

void Raven::VulkanImage2D::Release ( )
overridevirtual

Release Vulkan resources associated with this image.

Implements Raven::Image2D.

◆ Resize()

void Raven::VulkanImage2D::Resize ( const u32 width,
const u32 height )
inlinevirtual

Resize the image and recreate underlying Vulkan resources.

Parameters
widthNew image width.
heightNew image height.

Implements Raven::Image2D.

◆ SetData()

void Raven::VulkanImage2D::SetData ( const void * data,
usize size ) const
overridevirtual

Implements Raven::Image2D.

Member Data Documentation

◆ CurrentState

ResourceState Raven::VulkanImage2D::CurrentState = ResourceState::Undefined

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