Plasma Engine  2.0
Loading...
Searching...
No Matches
Texture3DResource.h
1#pragma once
2
3#include <RendererCore/RendererCoreDLL.h>
4
5#include <Foundation/IO/MemoryStream.h>
6
7#include <Core/ResourceManager/Resource.h>
8#include <Core/ResourceManager/ResourceTypeLoader.h>
9
10#include <RendererFoundation/Descriptors/Descriptors.h>
11#include <RendererFoundation/RendererFoundationDLL.h>
12
13#include <RendererCore/Pipeline/Declarations.h>
14#include <RendererCore/RenderContext/Implementation/RenderContextStructs.h>
15
16class plImage;
17
19
21struct PL_RENDERERCORE_DLL plTexture3DResourceDescriptor
22{
26
28 plUInt8 m_uiQualityLevelsDiscardable = 0;
29
31 plUInt8 m_uiQualityLevelsLoadable = 0;
32
36};
37
38class PL_RENDERERCORE_DLL plTexture3DResource : public plResource
39{
40 PL_ADD_DYNAMIC_REFLECTION(plTexture3DResource, plResource);
41
42 PL_RESOURCE_DECLARE_COMMON_CODE(plTexture3DResource);
43 PL_RESOURCE_DECLARE_CREATEABLE(plTexture3DResource, plTexture3DResourceDescriptor);
44
45public:
47
48 PL_ALWAYS_INLINE plGALResourceFormat::Enum GetFormat() const { return m_Format; }
49 PL_ALWAYS_INLINE plUInt32 GetWidth() const { return m_uiWidth; }
50 PL_ALWAYS_INLINE plUInt32 GetHeight() const { return m_uiHeight; }
51 PL_ALWAYS_INLINE plUInt32 GetDepth() const { return m_uiDepth; }
52 PL_ALWAYS_INLINE plGALTextureType::Enum GetType() const { return m_Type; }
53
54 static void FillOutDescriptor(plTexture3DResourceDescriptor& ref_td, const plImage* pImage, bool bSRGB, plUInt32 uiNumMipLevels,
55 plUInt32& out_uiMemoryUsed, plHybridArray<plGALSystemMemoryDescription, 32>& ref_initData);
56
57 const plGALTextureHandle& GetGALTexture() const { return m_hGALTexture[m_uiLoadedTextures - 1]; }
58 const plGALSamplerStateHandle& GetGALSamplerState() const { return m_hSamplerState; }
59
60protected:
61 virtual plResourceLoadDesc UnloadData(Unload WhatToUnload) override;
62 virtual plResourceLoadDesc UpdateContent(plStreamReader* Stream) override;
63 virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage) override;
64
65 plTexture3DResource(DoUpdate ResourceUpdateThread);
66
67 plUInt8 m_uiLoadedTextures = 0;
68 plGALTextureHandle m_hGALTexture[2];
69 plUInt32 m_uiMemoryGPU[2] = {0, 0};
70
71 plGALTextureType::Enum m_Type = plGALTextureType::Invalid;
72 plGALResourceFormat::Enum m_Format = plGALResourceFormat::Invalid;
73 plUInt32 m_uiWidth = 0;
74 plUInt32 m_uiHeight = 0;
75 plUInt32 m_uiDepth = 0;
76
77 plGALSamplerStateHandle m_hSamplerState;
78};
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition RendererFoundationDLL.h:481
Definition RendererFoundationDLL.h:411
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
A class containing image data and associated meta data.
Definition Image.h:103
The base class for all resources.
Definition Resource.h:10
Interface for binary in (read) streams.
Definition Stream.h:22
Definition Texture3DResource.h:39
Definition Descriptors.h:118
Definition Descriptors.h:177
Definition Resource.h:34
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102
Use this descriptor in calls to plResourceManager::CreateResource<plTexture3DResource> to create text...
Definition Texture3DResource.h:22
plGALTextureCreationDescription m_DescGAL
Describes the texture format, etc.
Definition Texture3DResource.h:24
plArrayPtr< plGALSystemMemoryDescription > m_InitialContent
Definition Texture3DResource.h:35