3#include <Core/CoreDLL.h>
5#include <Core/ResourceManager/Resource.h>
6#include <Core/World/Declarations.h>
7#include <Foundation/Containers/DynamicArray.h>
8#include <Foundation/Reflection/Reflection.h>
75 const T*
GetData()
const {
return GetLoadingState() == plResourceState::Loaded ?
reinterpret_cast<const T*
>(m_Data) :
nullptr; }
87 struct alignas(PL_ALIGNMENT_OF(T))
89 plUInt8 m_Data[
sizeof(T)];
96#define PL_DECLARE_CUSTOM_DATA_RESOURCE(SELF) \
97 class SELF##Resource : public plCustomDataResource<SELF> \
99 PL_ADD_DYNAMIC_REFLECTION(SELF##Resource, plCustomDataResource<SELF>); \
100 PL_RESOURCE_DECLARE_COMMON_CODE(SELF##Resource); \
103 using SELF##ResourceHandle = plTypedResourceHandle<SELF##Resource>
108#define PL_DEFINE_CUSTOM_DATA_RESOURCE(SELF) \
109 PL_BEGIN_DYNAMIC_REFLECTED_TYPE(SELF##Resource, 1, plRTTIDefaultAllocator<SELF##Resource>) \
110 PL_END_DYNAMIC_REFLECTED_TYPE; \
112 PL_RESOURCE_IMPLEMENT_COMMON_CODE(SELF##Resource)
115#include <Core/Utils/Implementation/CustomData_inl.h>
Definition AbstractObjectGraph.h:115
Definition AbstractObjectGraph.h:17
A base class for user-defined data assets.
Definition CustomData.h:23
Base class for resources that represent different implementations of plCustomData.
Definition CustomData.h:49
Template resource type for sub-classed plCustomData types.
Definition CustomData.h:67
const T * GetData() const
Provides read access to the custom data type.
Definition CustomData.h:75
virtual void UpdateMemoryUsage(MemoryUsage &out_NewMemoryUsage) override
This function must be overridden by all resource types.
Definition CustomData_inl.h:46
virtual plResourceLoadDesc UnloadData(Unload WhatToUnload) override
Requests the resource to unload another quality level. If bFullUnload is true, the resource should un...
Definition CustomData_inl.h:29
virtual plResourceLoadDesc UpdateContent(plStreamReader *Stream) override
Called whenever more data for the resource is available. The resource must read the stream to update ...
Definition CustomData_inl.h:40
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86
The base class for all resources.
Definition Resource.h:10
PL_ALWAYS_INLINE plResourceState GetLoadingState() const
Returns the current state in which this resource is in.
Definition Resource.h:66
Definition RttiConverter.h:33
Interface for binary in (read) streams.
Definition Stream.h:22
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102