Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::TypedTextureHandle< Type > Class Template Reference

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

#include <TextureHandle.h>

Collaboration diagram for EngineCore::TypedTextureHandle< Type >:

Public Member Functions

 TypedTextureHandle ()=default
 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
bool operator!= (const TypedTextureHandle &other) const

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 EngineCore::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!
TypedTextureHandle< TextureType::Normal > NormalTextureHandle
TypedTextureHandle< TextureType::BaseColor > AlbedoTextureHandle
@ BaseColor
Color data with gamma (SRGB format for 8-bit)
Definition TextureType.h:19
@ Normal
Linear data for normal maps (UNORM format for 8-bit)
Definition TextureType.h:20
Template Parameters
TypeThe TextureType this handle represents
Author
Konstantin Passig
Date
2026-01-22

Definition at line 75 of file TextureHandle.h.

Constructor & Destructor Documentation

◆ TypedTextureHandle() [1/2]

template<TextureType Type>
EngineCore::TypedTextureHandle< Type >::TypedTextureHandle ( )
default

◆ TypedTextureHandle() [2/2]

template<TextureType Type>
EngineCore::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 84 of file TextureHandle.h.

Member Function Documentation

◆ getBase()

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

Get the underlying base handle.

Definition at line 97 of file TextureHandle.h.

◆ getId()

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

Get the registry ID for this handle.

Definition at line 102 of file TextureHandle.h.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ getType()

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

Get the texture type (compile-time constant)

Definition at line 107 of file TextureHandle.h.

◆ isValid()

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

Check if this handle points to a valid registry entry.

Definition at line 92 of file TextureHandle.h.

Referenced by EngineCore::RenderingDataManager::uploadMaterialBuffers().

Here is the caller graph for this function:

◆ operator TextureHandle()

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

Implicit conversion to base handle for storage/runtime use.

Definition at line 112 of file TextureHandle.h.

◆ operator!=()

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

Definition at line 118 of file TextureHandle.h.

◆ operator==()

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

Definition at line 114 of file TextureHandle.h.

Member Data Documentation

◆ base_


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