Plasma Engine  2.0
Loading...
Searching...
No Matches
CollectionResource.h
1#pragma once
2
3#include <Core/CoreDLL.h>
4#include <Core/ResourceManager/Resource.h>
5
7struct PL_CORE_DLL plCollectionEntry
8{
11 plHashedString m_sAssetTypeName;
12 plUInt64 m_uiFileSize = 0;
13};
14
17{
19
20 void Save(plStreamWriter& inout_stream) const;
21 void Load(plStreamReader& inout_stream);
22};
23
25
44class PL_CORE_DLL plCollectionResource : public plResource
45{
46 PL_ADD_DYNAMIC_REFLECTION(plCollectionResource, plResource);
47 PL_RESOURCE_DECLARE_COMMON_CODE(plCollectionResource);
48 PL_RESOURCE_DECLARE_CREATEABLE(plCollectionResource, plCollectionResourceDescriptor);
49
50public:
53
62 void RegisterNames();
63
67 void UnregisterNames();
68
74 bool PreloadResources(plUInt32 uiNumResourcesToPreload = plMath::MaxValue<plUInt32>());
75
83 bool IsLoadingFinished(float* out_pProgress = nullptr) const;
84
86 const plCollectionResourceDescriptor& GetDescriptor() const;
87
90
91private:
92 virtual plResourceLoadDesc UnloadData(Unload WhatToUnload) override;
93 virtual plResourceLoadDesc UpdateContent(plStreamReader* Stream) override;
94 virtual void UpdateMemoryUsage(MemoryUsage& out_NewMemoryUsage) override;
95
96 mutable plMutex m_PreloadMutex;
97 bool m_bRegistered = false;
100};
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
An plCollectionResource is used to tell the engine about resources that it should preload in the back...
Definition CollectionResource.h:45
plArrayPtr< const plTypelessResourceHandle > GetPreloadedResources() const
Returns the current list of resources that have already been added to the preload list....
Definition CollectionResource.h:89
Definition DynamicArray.h:81
This class is optimized to take nearly no memory (sizeof(void*)) and to allow very fast checks whethe...
Definition HashedString.h:25
Provides a simple mechanism for mutual exclusion to prevent multiple threads from accessing a shared ...
Definition Mutex.h:13
The base class for all resources.
Definition Resource.h:10
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
constexpr TYPE MaxValue()
Returns the largest possible positive value (that is not infinity).
Represents one resource to load / preload through an plCollectionResource.
Definition CollectionResource.h:8
plString m_sOptionalNiceLookupName
Optional, can be used to lookup the resource at runtime with a nice name. E.g. "SkyTexture" instead o...
Definition CollectionResource.h:9
plString m_sResourceID
The ID / path to the resource to load.
Definition CollectionResource.h:10
Describes a full plCollectionResource, ie. lists all the resources that the collection contains.
Definition CollectionResource.h:17
Describes in which loading state a resource currently is, and how many different quality levels there...
Definition Declarations.h:102