3#include <Core/World/World.h>
4#include <Foundation/IO/MemoryStream.h>
5#include <Foundation/IO/Stream.h>
6#include <Foundation/Time/Time.h>
7#include <Foundation/Types/UniquePtr.h>
19 const plUInt16* m_pOverrideTeamID =
nullptr;
21 bool m_bForceDynamic =
false;
35 plUInt32 m_uiCustomRandomSeedRootValue = 0;
132 plUInt32 GetComponentTypeVersion(
const plRTTI* pRtti)
const;
135 void ClearAndCompact();
138 plUInt64 GetHeapMemoryUsage()
const;
152 plUInt32 GetRootObjectCount()
const;
153 plUInt32 GetChildObjectCount()
const;
159 struct GameObjectToCreate
163 plUInt32 m_uiParentHandleIdx;
166 void ReadGameObjectDesc(GameObjectToCreate& godesc);
167 void ReadComponentTypeInfo(plUInt32 uiComponentTypeIdx);
168 void ReadComponentDataToMemStream(
bool warningOnUnknownSkip =
true);
175 plUInt8 m_uiVersion = 0;
181 struct ComponentTypeInfo
183 const plRTTI* m_pRtti =
nullptr;
185 plUInt32 m_uiNumComponents = 0;
192 plUInt64 m_uiTotalNumComponents = 0;
196 class InstantiationContext :
public InstantiationContextBase
200 ~InstantiationContext();
202 virtual StepResult
Step()
override;
203 virtual void Cancel()
override;
205 template <
bool UseTransform>
208 bool CreateComponents(
plTime endTime);
209 bool DeserializeComponents(
plTime endTime);
210 bool AddComponentsToBatch(
plTime endTime);
212 void SetMaxStepTime(
plTime stepTime);
213 plTime GetMaxStepTime()
const;
217 void SetSubProgressCompletion(
double fCompletion);
222 bool m_bUseTransform =
false;
238 DeserializeComponents,
239 AddComponentsToBatch,
246 Phase::Enum m_Phase = Phase::Invalid;
247 plUInt32 m_uiCurrentIndex = 0;
248 plUInt32 m_uiCurrentComponentTypeIndex = 0;
249 plUInt64 m_uiCurrentNumComponentsProcessed = 0;
Definition Declarations.h:363
The default implementation for memory stream storage.
Definition MemoryStream.h:161
Definition DynamicArray.h:81
Definition HashTable.h:333
A reader which can access a memory stream.
Definition MemoryStream.h:259
Manages the way a progress bar is subdivided and advanced.
Definition Progress.h:36
plProgressRange is the preferred method to inform the system of progress.
Definition Progress.h:97
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
Interface for binary in (read) streams.
Definition Stream.h:22
This class to restore strings written to a stream using a plStringDeduplicationWriteContext.
Definition StringDeduplicationContext.h:53
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
A class to use together with plHashedString for quick comparisons with temporary strings that need no...
Definition HashedString.h:151
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
A context object is returned from InstantiateWorld or InstantiatePrefab if a maxStepTime greater than...
Definition WorldReader.h:55
StepResult
Definition WorldReader.h:58
virtual void Cancel()=0
\Brief Cancel the instantiation. This might lead to inconsistent states and must be used with care.
virtual StepResult Step()=0
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
static FindComponentTypeCallback s_FindComponentTypeCallback
An optional callback to redirect the lookup of a component type name to an plRTTI type.
Definition WorldReader.h:150
plStreamReader & GetStream() const
Gives access to the stream of data. Use this inside component deserialization functions to read data.
Definition WorldReader.h:121
constexpr PL_FORCE_INLINE T Step(T value, T edge)
Returns 0, if value < edge, and 1, if value >= edge.
Definition Math_inl.h:255
A handle to a component.
Definition Declarations.h:138
A generic delegate class which supports static functions and member functions.
Definition Delegate.h:76
Describes the initial state of a game object.
Definition GameObjectDesc.h:11
A handle to a game object.
Definition Declarations.h:76
Definition WorldReader.h:14
plTempHashedString m_ReplaceNamedRootWithParent
If the prefab has a single root node with this non-empty name, rather than creating a new object,...
Definition WorldReader.h:24
RandomSeedMode
Definition WorldReader.h:27
@ CompletelyRandom
plWorld::CreateObject() will assign a random value to this object
@ FixedFromSerialization
Keep deserialized random seed value.
@ CustomRootValue
Use the given seed root value to assign a deterministic (but different) value to each game object.
@ DeterministicFromParent
plWorld::CreateObject() will either derive a deterministic value from the parent object,...
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
PL_ALWAYS_INLINE static constexpr plTime MakeZero()
Creates an instance of plTime that was initialized with zero.
Definition Time.h:42