4 #include <alicorn/std.fast/unordered-map.hpp>
6 #include "CubeCoords.hpp"
7 #include "Constants.hpp"
36 using SceneObjects_t =
37 ::alicorn::extension::std::fast::unordered_map<uint64_t, ::std::vector<Id_t>>;
38 using CellObject_t = SceneObjects_t::value_type;
39 using Callback_t = ::std::function<void(
const Id_t)>;
40 using RenderObject_t = ::std::pair<float, Id_t>;
52 float m_CameraOffsetX;
53 float m_CameraOffsetY;
57 explicit Camera(
const float = 0.0f,
const float = 0.0f,
const float = 0.0f);
65 SceneObjects_t Objects;
69 void SetCameraInfo(
const Camera &);
70 void Render(
const Callback_t &);
71 void ProcessAll(
const Callback_t &);
74 void Add(
const size_t, const ::std::vector<Id_t> &);
77 void CompleteReplace(
void);
78 void CompleteUpdate(
void);
81 void BuildRenderObjects(
void);
82 void Add(
const size_t, const ::std::vector<Id_t> &,
const uint64_t);
85 ::std::vector<Scene> m_Scenes;
86 ::std::vector<Scene> m_BkScenes;
88 ::std::vector<RenderObject_t> m_PrepareRenderObjects;
89 ::std::vector<RenderObject_t> m_CompleteRenderObjects;
90 bool m_IsUpdateRenderObjects =
false;
94 inline void GameScene::Add(
95 const size_t _SceneId,
96 const ::std::vector<Id_t> & _ObjectIds)
98 Add(_SceneId, _ObjectIds,
static_cast<uint64_t
>(0));
101 inline void GameScene::Add(
102 const size_t _SceneId,
103 const ::std::vector<Id_t> & _ObjectIds,
106 Add(_SceneId, _ObjectIds, _Position.GetHash());
109 inline void GameScene::Add(
110 const size_t _SceneId,
111 const ::std::vector<Id_t> & _ObjectIds,
112 const uint64_t _CoordHash)
114 if (_SceneId >= m_BkScenes.size()) m_BkScenes.resize(_SceneId + 1);
115 m_BkScenes[_SceneId].Objects[_CoordHash] = _ObjectIds;