/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/RendererCore/Textures/Texture3DResource.h
85 строк
3 KB
Jan Krassnigg
Added code documentation to RendererCore (#1697)
28 окт 2025, 13:18
Не верифицирован
28 окт 2025, 13:18
d573105
Код
Авторство
О чём код?
#pragma once #include <RendererCore/RendererCoreDLL.h> #include <Foundation/IO/MemoryStream.h> #include <Core/ResourceManager/Resource.h> #include <Core/ResourceManager/ResourceTypeLoader.h> #include <RendererFoundation/Descriptors/Descriptors.h> #include <RendererFoundation/RendererFoundationDLL.h> #include <RendererCore/Pipeline/Declarations.h> #include <RendererCore/RenderContext/Implementation/RenderContextStructs.h> class ezImage; using ezTexture3DResourceHandle = ezTypedResourceHandle<class ezTexture3DResource>; /// \brief Use this descriptor in calls to ezResourceManager::CreateResource<ezTexture3DResource> to create textures from data in memory. struct EZ_RENDERERCORE_DLL ezTexture3DResourceDescriptor { /// Describes the texture format, etc. ezGALTextureCreationDescription m_DescGAL; ezGALSamplerStateCreationDescription m_SamplerDesc; /// How many quality levels can be discarded and reloaded. For created textures this can currently only be 0 or 1. ezUInt8 m_uiQualityLevelsDiscardable = 0; /// How many additional quality levels can be loaded (typically from file). ezUInt8 m_uiQualityLevelsLoadable = 0; /// One memory desc per (array * faces * mipmap) (in that order) (array is outer loop, mipmap is inner loop). Can be empty to not /// initialize data. ezArrayPtr<ezGALSystemMemoryDescription> m_InitialContent; }; /// Resource for 3D volume textures. /// /// 3D textures have width, height, and depth dimensions. They are sampled using 3D coordinates /// and are commonly used for volumetric effects like fog, clouds, or 3D lookup tables. class EZ_RENDERERCORE_DLL ezTexture3DResource : public ezResource { EZ_ADD_DYNAMIC_REFLECTION(ezTexture3DResource, ezResource); EZ_RESOURCE_DECLARE_COMMON_CODE(ezTexture3DResource); EZ_RESOURCE_DECLARE_CREATEABLE(ezTexture3DResource, ezTexture3DResourceDescriptor); public: ezTexture3DResource(); EZ_ALWAYS_INLINE ezGALResourceFormat::Enum GetFormat() const { return m_Format; } EZ_ALWAYS_INLINE ezUInt32 GetWidth() const { return m_uiWidth; } EZ_ALWAYS_INLINE ezUInt32 GetHeight() const { return m_uiHeight; } EZ_ALWAYS_INLINE ezUInt32 GetDepth() const { return m_uiDepth; } EZ_ALWAYS_INLINE ezGALTextureType::Enum GetType() const { return m_Type; } /// Fills a descriptor from image data, preparing it for texture creation. /// /// Configures format, dimensions, mipmaps, and sets up initial content from the image. static void FillOutDescriptor(ezTexture3DResourceDescriptor& ref_td, const ezImage* pImage, bool bSRGB, ezUInt32 uiNumMipLevels, ezUInt32& out_uiMemoryUsed, ezHybridArray<ezGALSystemMemoryDescription, 32>& ref_initData); const ezGALTextureHandle& GetGALTexture() const { return m_hGALTexture[m_uiLoadedTextures - 1]; } const ezGALSamplerStateHandle& GetGALSamplerState() const { return m_hSamplerState; } protected: virtual ezResourceLoadDesc UnloadData(Unload WhatToUnload) override; virtual ezResourceLoadDesc UpdateContent(ezStreamReader* Stream) override; virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage) override; ezTexture3DResource(DoUpdate ResourceUpdateThread); ezUInt8 m_uiLoadedTextures = 0; ezGALTextureHandle m_hGALTexture[2]; ezUInt32 m_uiMemoryGPU[2] = {0, 0}; ezGALTextureType::Enum m_Type = ezGALTextureType::Invalid; ezGALResourceFormat::Enum m_Format = ezGALResourceFormat::Invalid; ezUInt32 m_uiWidth = 0; ezUInt32 m_uiHeight = 0; ezUInt32 m_uiDepth = 0; ezGALSamplerStateHandle m_hSamplerState; };