OGL Engine 1.2.0-dev
Loading...
Searching...
No Matches
spatialhash.hpp
Go to the documentation of this file.
1
11#pragma once
12
13#include <bitset>
14#include <vector>
15#include <unordered_map>
16
17#include "../defs.hpp"
18
19namespace Engine::Physics {
25 struct Cell { uint32_t x, y; };
26
35 bool operator==(const Cell& a, const Cell& b);
36
44 struct CellHash {
45 size_t operator()(Cell c) const;
46 };
47
53 using SpatialHash = std::unordered_map<Cell, std::vector<Engine::EntityID>, CellHash>;
54}
Définit des types de données utilisés dans le moteur.
Definition aabb.hpp:10
bool operator==(const Cell &a, const Cell &b)
Surcharge de l'opérateur de test d'égalité pour les cellules.
Definition spatialhash.cpp:8
std::unordered_map< Cell, std::vector< Engine::EntityID >, CellHash > SpatialHash
Défiinition du "type" spatialHash => simplement une unordered_map qui lit des entités à une cellule.
Definition spatialhash.hpp:53
Le hash d'une cellule donnée.
Definition spatialhash.hpp:44
size_t operator()(Cell c) const
Definition spatialhash.cpp:4
Structure qui définit l'emplacement d'une cellule dans l'espace en 2D.
Definition spatialhash.hpp:25
uint32_t y
Definition spatialhash.hpp:25
uint32_t x
Definition spatialhash.hpp:25