summaryrefslogtreecommitdiff
path: root/modules/gridmap/grid_map.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gridmap/grid_map.h')
-rw-r--r--modules/gridmap/grid_map.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h
index 83d5af1324..08ed4d3d12 100644
--- a/modules/gridmap/grid_map.h
+++ b/modules/gridmap/grid_map.h
@@ -56,9 +56,15 @@ class GridMap : public Node3D {
};
uint64_t key = 0;
+ static uint32_t hash(const IndexKey &p_key) {
+ return hash_one_uint64(p_key.key);
+ }
_FORCE_INLINE_ bool operator<(const IndexKey &p_key) const {
return key < p_key.key;
}
+ _FORCE_INLINE_ bool operator==(const IndexKey &p_key) const {
+ return key == p_key.key;
+ }
_FORCE_INLINE_ operator Vector3i() const {
return Vector3i(x, y, z);
@@ -92,6 +98,7 @@ class GridMap : public Node3D {
struct NavMesh {
RID region;
Transform3D xform;
+ RID navmesh_debug_instance;
};
struct MultimeshInstance {
@@ -107,13 +114,13 @@ class GridMap : public Node3D {
};
Vector<MultimeshInstance> multimesh_instances;
- Set<IndexKey> cells;
+ HashSet<IndexKey> cells;
RID collision_debug;
RID collision_debug_instance;
bool dirty = false;
RID static_body;
- Map<IndexKey, NavMesh> navmesh_ids;
+ HashMap<IndexKey, NavMesh> navmesh_ids;
};
union OctantKey {
@@ -126,8 +133,11 @@ class GridMap : public Node3D {
uint64_t key = 0;
- _FORCE_INLINE_ bool operator<(const OctantKey &p_key) const {
- return key < p_key.key;
+ static uint32_t hash(const OctantKey &p_key) {
+ return hash_one_uint64(p_key.key);
+ }
+ _FORCE_INLINE_ bool operator==(const OctantKey &p_key) const {
+ return key == p_key.key;
}
//OctantKey(const IndexKey& p_k, int p_item) { indexkey=p_k.key; item=p_item; }
@@ -150,18 +160,12 @@ class GridMap : public Node3D {
bool center_z = true;
float cell_scale = 1.0;
- bool clip = false;
- bool clip_above = true;
- int clip_floor = 0;
-
bool recreating_octants = false;
- Vector3::Axis clip_axis = Vector3::AXIS_Z;
-
Ref<MeshLibrary> mesh_library;
- Map<OctantKey, Octant *> octant_map;
- Map<IndexKey, Cell> cell_map;
+ HashMap<OctantKey, Octant *, OctantKey> octant_map;
+ HashMap<IndexKey, Cell, IndexKey> cell_map;
void _recreate_octant_data();
@@ -187,7 +191,7 @@ class GridMap : public Node3D {
void _queue_octants_dirty();
void _update_octants_callback();
- void resource_changed(const RES &p_res);
+ void resource_changed(const Ref<Resource> &p_res);
void _clear_internal();
@@ -234,7 +238,7 @@ public:
void set_bake_navigation(bool p_bake_navigation);
bool is_baking_navigation();
- void set_navigation_layers(uint32_t p_layers);
+ void set_navigation_layers(uint32_t p_navigation_layers);
uint32_t get_navigation_layers();
void set_mesh_library(const Ref<MeshLibrary> &p_mesh_library);
@@ -260,8 +264,6 @@ public:
Vector3i world_to_map(const Vector3 &p_world_position) const;
Vector3 map_to_world(const Vector3i &p_map_position) const;
- void set_clip(bool p_enabled, bool p_clip_above = true, int p_floor = 0, Vector3::Axis p_axis = Vector3::AXIS_X);
-
void set_cell_scale(float p_scale);
float get_cell_scale() const;