Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Assets::TypedTextureHandle< Type > Class Template Reference

Type-safe texture handle wrapper providing compile-time type safety. More...

#include <TextureHandle.h>

Collaboration diagram for Engine::Assets::TypedTextureHandle< Type >:

Public Member Functions

 TypedTextureHandle ()=default
 Creates an invalid typed texture handle.
 TypedTextureHandle (TextureHandle base)
 Construct from a base TextureHandle.
bool isValid () const
 Check if this handle points to a valid registry entry.
TextureHandle getBase () const
 Get the underlying base handle.
uint32_t getId () const
 Get the registry ID for this handle.
 operator TextureHandle () const
 Implicit conversion to base handle for storage/runtime use.
bool operator== (const TypedTextureHandle &other) const
 Compares the underlying base handles.
bool operator!= (const TypedTextureHandle &other) const
 Returns true when the underlying base handles differ.

Static Public Member Functions

static constexpr TextureType getType ()
 Get the texture type (compile-time constant)

Private Attributes

TextureHandle base_

Detailed Description

template<TextureType Type>
class Engine::Assets::TypedTextureHandle< Type >

Type-safe texture handle wrapper providing compile-time type safety.

This template class wraps TextureHandle and provides compile-time type checking. You cannot accidentally assign a normal map handle to an albedo slot - the compiler will reject it.

Example:

AlbedoTextureHandle albedo = registry.getOrCreateHandle<TextureType::BaseColor>(path);
NormalTextureHandle normal = registry.getOrCreateHandle<TextureType::Normal>(path);
material->setBaseColorTextureHandle(albedo); // OK
material->setNormalTextureHandle(normal); // OK
material->setNormalTextureHandle(albedo); // COMPILE ERROR!
@ BaseColor
Color data with gamma (SRGB format for 8-bit)
Definition TextureType.h:16
@ Normal
Linear data for normal maps (UNORM format for 8-bit)
Definition TextureType.h:17
Template Parameters
TypeThe TextureType this handle represents

Definition at line 84 of file TextureHandle.h.

Constructor & Destructor Documentation

◆ TypedTextureHandle() [1/2]

template<TextureType Type>
Engine::Assets::TypedTextureHandle< Type >::TypedTextureHandle ( )
default

Creates an invalid typed texture handle.

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

Here is the caller graph for this function:

◆ TypedTextureHandle() [2/2]

template<TextureType Type>
Engine::Assets::TypedTextureHandle< Type >::TypedTextureHandle ( TextureHandle base)
inlineexplicit

Construct from a base TextureHandle.

Asserts that the base handle's type matches the template type.

Definition at line 96 of file TextureHandle.h.

References base_, Engine::Assets::TextureHandle::getType(), and Engine::Assets::TextureHandle::isValid().

Here is the call graph for this function:

Member Function Documentation

◆ getBase()

template<TextureType Type>
TextureHandle Engine::Assets::TypedTextureHandle< Type >::getBase ( ) const
inlinenodiscard

Get the underlying base handle.

Definition at line 109 of file TextureHandle.h.

References base_.

◆ getId()

template<TextureType Type>
uint32_t Engine::Assets::TypedTextureHandle< Type >::getId ( ) const
inlinenodiscard

Get the registry ID for this handle.

Definition at line 114 of file TextureHandle.h.

References base_.

◆ getType()

template<TextureType Type>
constexpr TextureType Engine::Assets::TypedTextureHandle< Type >::getType ( )
inlinestaticnodiscardconstexpr

Get the texture type (compile-time constant)

Definition at line 119 of file TextureHandle.h.

◆ isValid()

template<TextureType Type>
bool Engine::Assets::TypedTextureHandle< Type >::isValid ( ) const
inlinenodiscard

Check if this handle points to a valid registry entry.

Definition at line 104 of file TextureHandle.h.

References base_.

◆ operator TextureHandle()

template<TextureType Type>
Engine::Assets::TypedTextureHandle< Type >::operator TextureHandle ( ) const
inline

Implicit conversion to base handle for storage/runtime use.

Definition at line 124 of file TextureHandle.h.

References base_.

◆ operator!=()

template<TextureType Type>
bool Engine::Assets::TypedTextureHandle< Type >::operator!= ( const TypedTextureHandle< Type > & other) const
inline

Returns true when the underlying base handles differ.

Definition at line 136 of file TextureHandle.h.

References TypedTextureHandle().

Here is the call graph for this function:

◆ operator==()

template<TextureType Type>
bool Engine::Assets::TypedTextureHandle< Type >::operator== ( const TypedTextureHandle< Type > & other) const
inline

Compares the underlying base handles.

Definition at line 129 of file TextureHandle.h.

References base_, and TypedTextureHandle().

Here is the call graph for this function:

Member Data Documentation

◆ base_


The documentation for this class was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Texture/TextureHandle.h