CommonLibSSE NG
Loading...
Searching...
No Matches
GFxResource.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/G/GAtomic.h"
6#include "RE/G/GStats.h"
7
8namespace RE
9{
10 class GFxResourceLibBase;
11 class GFxResourceReport;
12
13 // Resource is an interface for casting to different types of resources.
14 class GFxResource : public GNewOverrideBase<GStatGroups::kGStat_Default_Mem>
15 {
16 friend class GFxResourceWeakLib;
17
18 public:
19 // Different types of resources.
20 enum class ResourceType
21 {
22 // Set this bit if CharacterDef
23 kCharacterDefBit = 1 << 7,
24
25 // Non-character types
26 kNone = 0,
27 kImage,
28 kFont,
29 // Internal
32
33 // GFxCharacterDef derived types
41
42 // Mask and shift applied to store ResourceType in type code
43 kTypeCode_Mask = 0xFF00,
45 };
46
47 // An enumeration listing the attributes of the image resource to use such as bitmap, gradient or font texture etc.
48 enum class ResourceUse
49 {
50 kNone = 0,
51 kBitmap = 1,
52 kGradient = 2,
53 kFontTexture = 3,
54 kSoundSample = 4,
55
56 // Use mask within TypeCode
57 kTypeCode_Mask = 0xFF
58 };
59
61 virtual ~GFxResource(); // 00
62
63 // add
64 virtual GFxResourceKey GetKey(); // 01
65 [[nodiscard]] virtual std::uint32_t GetResourceTypeCode() const; // 02
67
68 static std::uint32_t MakeTypeCode(ResourceType a_resourceType, ResourceUse a_resourceUse = ResourceUse::kNone); // Creates a resource type code which is a combination of ResourceType and ResourceUse.
69
70 void AddRef(); // Thread-safe reference count implementation; increments the reference count.
71 bool AddRef_NotZero(); // Thread-safe reference count implementation ; increments a reference count if it is not zero.
72 void Release(); // Thread-Safe reference count implementation; release the resources.
73 [[nodiscard]] std::int32_t GetRefCount() const; // Thread-Safe reference count implementation; returns the reference count.
74 void SetOwnerResourceLib(GFxResourceLibBase* a_lib); // Assigns owner library for resource.
75 [[nodiscard]] ResourceType GetResourceType() const; // Obtains the resource type.
76 [[nodiscard]] ResourceUse GetResourceUse() const; // Obtains the type of resource use.
77
78 protected:
79 // members
81 std::uint32_t _pad0C; // 0C
83 };
84 static_assert(sizeof(GFxResource) == 0x18);
85}
Definition GAtomic.h:43
Definition GFxResource.h:15
virtual GFxResourceReport * GetResourceReport()
GAtomicInt< std::int32_t > _refCount
Definition GFxResource.h:80
std::uint32_t _pad0C
Definition GFxResource.h:81
void SetOwnerResourceLib(GFxResourceLibBase *a_lib)
virtual ~GFxResource()
virtual std::uint32_t GetResourceTypeCode() const
ResourceUse
Definition GFxResource.h:49
GFxResourceLibBase * _lib
Definition GFxResource.h:82
static std::uint32_t MakeTypeCode(ResourceType a_resourceType, ResourceUse a_resourceUse=ResourceUse::kNone)
ResourceUse GetResourceUse() const
ResourceType GetResourceType() const
std::int32_t GetRefCount() const
ResourceType
Definition GFxResource.h:21
bool AddRef_NotZero()
virtual GFxResourceKey GetKey()
Definition GFxResourceKey.h:6
Definition GFxResourceLibBase.h:11
Definition GFxResourceReport.h:11
Definition GFxResourceWeakLib.h:11
Definition GNewOverrideBase.h:9
Definition AbsorbEffect.h:6