3#include <Core/World/Implementation/WorldData.h>
35 plUInt32 GetIndex()
const;
52 void DeleteObjectNow(
const plGameObjectHandle& hObject,
bool bAlsoDeleteEmptyParents =
true);
58 void DeleteObjectDelayed(
const plGameObjectHandle& hObject,
bool bAlsoDeleteEmptyParents =
true);
81 plUInt32 GetObjectCount()
const;
102 void Traverse(VisitorFunc visitorFunc, TraversalMethod method = DepthFirst);
109 template <
typename ModuleType>
116 template <
typename ModuleType>
120 void DeleteModule(
const plRTTI* pRtti);
123 template <
typename ModuleType>
127 template <
typename ModuleType>
131 template <
typename ModuleType>
145 template <
typename ManagerType>
146 ManagerType* GetOrCreateComponentManager();
152 template <
typename ManagerType>
153 void DeleteComponentManager();
156 template <
typename ManagerType>
160 template <
typename ManagerType>
173 template <
typename ComponentType>
174 [[nodiscard]]
bool TryGetComponent(
const plComponentHandle& hComponent, ComponentType*& out_pComponent);
177 template <
typename ComponentType>
178 [[nodiscard]]
bool TryGetComponent(
const plComponentHandle& hComponent,
const ComponentType*& out_pComponent)
const;
246 void SetWorldSimulationEnabled(
bool bEnable);
249 bool GetWorldSimulationEnabled()
const;
259 plUInt32 GetUpdateCounter()
const;
287 const plClock& GetClock()
const;
291 plRandom& GetRandomNumberGenerator();
311 void SetMaxInitializationTimePerFrame(
plTime maxInitTime);
314 void SetUserData(
void* pUserData);
317 void* GetUserData()
const;
329 using ResourceReloadContext = plInternal::WorldData::ResourceReloadContext;
338 static constexpr plUInt64 GetMaxNumGameObjects();
339 static constexpr plUInt64 GetMaxNumHierarchyLevels();
340 static constexpr plUInt64 GetMaxNumComponentsPerType();
341 static constexpr plUInt64 GetMaxNumWorldModules();
342 static constexpr plUInt64 GetMaxNumComponentTypes();
343 static constexpr plUInt64 GetMaxNumWorlds();
348 static plUInt32 GetWorldCount();
351 static plWorld* GetWorld(plUInt32 uiIndex);
364 PL_ALLOW_PRIVATE_PROPERTIES(
plWorld);
367 plClock* Reflection_GetClock();
369 void CheckForReadAccess()
const;
370 void CheckForWriteAccess()
const;
372 plGameObject* GetObjectUnchecked(plUInt32 uiIndex)
const;
383 void ProcessQueuedMessage(
const plInternal::WorldData::MessageQueue::Entry& entry);
386 template <
typename World,
typename GameObject,
typename Component>
396 void UpdateFromThread();
398 void UpdateAsynchronous();
401 bool ProcessInitializationBatch(plInternal::WorldData::InitBatch& batch,
plTime endTime);
402 void ProcessComponentsToInitialize();
403 void ProcessUpdateFunctionsToRegister();
406 void DeleteDeadObjects();
407 void DeleteDeadComponents();
410 void RecreateHierarchyData(
plGameObject* pObject,
bool bWasDynamic);
412 void ProcessResourceReloadFunctions();
414 bool ReportErrorWhenStaticObjectMoves()
const;
416 float GetInvDeltaSeconds()
const;
422 using QueuedMsgMetaData = plInternal::WorldData::QueuedMsgMetaData;
428PL_DECLARE_REFLECTABLE_TYPE(PL_CORE_DLL,
plWorld);
430#include <Core/World/Implementation/World_inl.h>
Base class for all memory allocators.
Definition Allocator.h:23
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
A clock that can be speed up, slowed down, paused, etc. Useful for updating game logic,...
Definition Clock.h:15
Base class of all component types.
Definition Component.h:25
Definition Declarations.h:363
Base class for all component managers. Do not derive directly from this class, but derive from plComp...
Definition ComponentManager.h:21
Definition CoordinateSystem.h:18
A double buffered stack allocator.
Definition FrameAllocator.h:7
Definition DynamicArray.h:81
Base class for components that want to handle 'event messages'.
Definition EventMessageHandlerComponent.h:14
This class represents an object inside the world.
Definition GameObject.h:32
TransformPreservation
Defines during re-parenting what transform is going to be preserved.
Definition GameObject.h:165
This class is optimized to take nearly no memory (sizeof(void*)) and to allow very fast checks whethe...
Definition HashedString.h:25
Definition WorldData.h:50
Definition WorldData.h:75
Definition WorldData.h:273
Definition WorldData.h:286
Definition WorldData.h:18
Base class for all message types. Each message type has it's own id which is used to dispatch message...
Definition Message.h:22
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
A random number generator. Currently uses the WELL512 algorithm.
Definition Random.h:9
A Shared ptr manages a shared object and destroys that object when no one references it anymore....
Definition SharedPtr.h:10
Definition SpatialSystem.h:10
Wraps a C-style array, which has a fixed size at compile-time, with a more convenient interface.
Definition StaticArray.h:13
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
The typeless implementation of resource handles. A typed interface is provided by plTypedResourceHand...
Definition ResourceHandle.h:32
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
const ManagerType * GetComponentManager() const
Returns the instance to the given component manager type.
ModuleType * GetModule()
Returns the instance to the given module type or derived types.
const ModuleType * GetModuleReadOnly() const
Returns the instance to the given module type or derived types.
void DeleteModule()
Deletes the module of the given type or derived types.
ModuleType * GetOrCreateModule()
Creates an instance of the given module type or derived type or returns a pointer to an already exist...
const ModuleType * GetModule() const
Returns the instance to the given module type or derived types.
ManagerType * GetComponentManager()
Returns the instance to the given component manager type.
Definition WorldModule.h:10
A handle to a component.
Definition Declarations.h:138
Definition CoordinateSystem.h:9
Base class for all messages that are sent as 'events'.
Definition EventMessage.h:8
Describes the initial state of a game object.
Definition GameObjectDesc.h:11
A handle to a game object.
Definition Declarations.h:76
Enum
Definition Declarations.h:274
@ NextFrame
Process the message in the PreAsync phase of the next frame.
Definition Declarations.h:277
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
Describes the initial state of a world.
Definition WorldDesc.h:14
Description of an update function that can be registered at the world.
Definition WorldModule.h:43