Plasma Engine  2.0
Loading...
Searching...
No Matches
FindPlacementTilesTask.h
1#pragma once
2
3#include <Foundation/Threading/TaskSystem.h>
4#include <ProcGenPlugin/Declarations.h>
5
6enum
7{
8 EmptyTileIndex = plInvalidIndex,
9 NewTileIndex = EmptyTileIndex - 1
10};
11
13
14namespace plProcGenInternal
15{
16 class FindPlacementTilesTask final : public plTask
17 {
18 public:
19 FindPlacementTilesTask(plProcPlacementComponent* pComponent, plUInt32 uiOutputIndex);
21
22 void AddCameraPosition(const plVec3& vCameraPosition) { m_CameraPositions.PushBack(vCameraPosition); }
23
24 plArrayPtr<const PlacementTileDesc> GetNewTiles() const { return m_NewTiles; }
25 plArrayPtr<const plUInt64> GetOldTiles() const { return m_OldTileKeys; }
26
27 private:
28 virtual void Execute() override;
29
30 plProcPlacementComponent* m_pComponent = nullptr;
31 plUInt32 m_uiOutputIndex = 0;
32
33 plHybridArray<plVec3, 2> m_CameraPositions;
34
36 plDynamicArray<plUInt64> m_OldTileKeys;
37
38 struct TileByAge
39 {
40 PL_DECLARE_POD_TYPE();
41
42 plUInt64 m_uiTileKey;
43 plUInt64 m_uiLastSeenFrame;
44 };
45
46 plDynamicArray<TileByAge> m_TilesByAge;
47 };
48
49 PL_ALWAYS_INLINE plUInt64 GetTileKey(plInt32 x, plInt32 y)
50 {
51 plUInt64 sx = (plUInt32)x;
52 plUInt64 sy = (plUInt32)y;
53
54 return (sx << 32) | sy;
55 }
56} // namespace plProcGenInternal
This class encapsulates an array and it's size. It is recommended to use this class instead of plain ...
Definition ArrayPtr.h:37
Definition DynamicArray.h:81
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Definition FindPlacementTilesTask.h:17
virtual void Execute() override
Override this to implement the task's supposed functionality.
Definition FindPlacementTilesTask.cpp:25
Definition ProcPlacementComponent.h:112
Base class for custom tasks.
Definition Task.h:10