Plasma Engine  2.0
Loading...
Searching...
No Matches
CustomData_inl.h
1
2template <typename T>
4
5template <typename T>
7
8template <typename T>
10{
11 T* pData = reinterpret_cast<T*>(m_Data);
12
13 if (GetLoadingState() == plResourceState::Loaded)
14 {
16 }
17
19
20 if (pRootNode)
21 {
22 // pRootNode is empty when the resource file is empty
23 // no need to attempt to load it then
24 pData->Load(ref_graph, ref_context, pRootNode);
25 }
26}
27
28template <typename T>
30{
31 if (GetData() != nullptr)
32 {
33 plMemoryUtils::Destruct(GetData());
34 }
35
36 return plCustomDataResourceBase::UnloadData(WhatToUnload);
37}
38
39template <typename T>
41{
42 return UpdateContent_Internal(Stream, *plGetStaticRTTI<T>());
43}
44
45template <typename T>
47{
48 out_NewMemoryUsage.m_uiMemoryCPU = sizeof(plCustomDataResource<T>);
49 out_NewMemoryUsage.m_uiMemoryGPU = 0;
50}
Definition AbstractObjectGraph.h:115
Definition AbstractObjectGraph.h:17
virtual plResourceLoadDesc UnloadData(Unload WhatToUnload) override
Requests the resource to unload another quality level. If bFullUnload is true, the resource should un...
Definition CustomData.cpp:35
Template resource type for sub-classed plCustomData types.
Definition CustomData.h:67
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
static void Construct(T *pDestination, size_t uiCount=1)
Constructs uiCount objects of type T in a raw buffer at pDestination.
static void Destruct(T *pDestination, size_t uiCount=1)
Destructs uiCount objects of type T at pDestination.
Definition RttiConverter.h:33
Interface for binary in (read) streams.
Definition Stream.h:22
Definition Resource.h:34
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102