diff options
Diffstat (limited to 'modules/raycast')
-rw-r--r-- | modules/raycast/lightmap_raycaster.cpp | 2 | ||||
-rw-r--r-- | modules/raycast/lightmap_raycaster.h | 4 | ||||
-rw-r--r-- | modules/raycast/raycast_occlusion_cull.h | 16 | ||||
-rw-r--r-- | modules/raycast/static_raycaster.cpp | 2 | ||||
-rw-r--r-- | modules/raycast/static_raycaster.h | 4 |
5 files changed, 15 insertions, 13 deletions
diff --git a/modules/raycast/lightmap_raycaster.cpp b/modules/raycast/lightmap_raycaster.cpp index fc9ac416b7..9b35b5616e 100644 --- a/modules/raycast/lightmap_raycaster.cpp +++ b/modules/raycast/lightmap_raycaster.cpp @@ -152,7 +152,7 @@ void LightmapRaycasterEmbree::commit() { rtcCommitScene(embree_scene); } -void LightmapRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) { +void LightmapRaycasterEmbree::set_mesh_filter(const HashSet<int> &p_mesh_ids) { for (const int &E : p_mesh_ids) { rtcDisableGeometry(rtcGetGeometry(embree_scene, E)); } diff --git a/modules/raycast/lightmap_raycaster.h b/modules/raycast/lightmap_raycaster.h index 4c52758fd8..4266b46ea8 100644 --- a/modules/raycast/lightmap_raycaster.h +++ b/modules/raycast/lightmap_raycaster.h @@ -53,7 +53,7 @@ private: static void filter_function(const struct RTCFilterFunctionNArguments *p_args); HashMap<unsigned int, AlphaTextureData> alpha_textures; - RBSet<int> filter_meshes; + HashSet<int> filter_meshes; public: virtual bool intersect(Ray &p_ray) override; @@ -64,7 +64,7 @@ public: virtual void set_mesh_alpha_texture(Ref<Image> p_alpha_texture, unsigned int p_id) override; virtual void commit() override; - virtual void set_mesh_filter(const RBSet<int> &p_mesh_ids) override; + virtual void set_mesh_filter(const HashSet<int> &p_mesh_ids) override; virtual void clear_mesh_filter() override; static LightmapRaycaster *create_embree_raycaster(); diff --git a/modules/raycast/raycast_occlusion_cull.h b/modules/raycast/raycast_occlusion_cull.h index 779f6fb3c4..4474031991 100644 --- a/modules/raycast/raycast_occlusion_cull.h +++ b/modules/raycast/raycast_occlusion_cull.h @@ -86,11 +86,13 @@ private: RID scenario; RID instance; - bool operator<(const InstanceID &rhs) const { - if (instance == rhs.instance) { - return rhs.scenario < scenario; - } - return instance < rhs.instance; + static uint32_t hash(const InstanceID &p_ins) { + uint32_t h = hash_djb2_one_64(p_ins.scenario.get_id()); + return hash_djb2_one_64(p_ins.instance.get_id(), h); + } + bool operator==(const InstanceID &rhs) const { + return instance == rhs.instance && rhs.scenario == scenario; + ; } InstanceID() {} @@ -101,7 +103,7 @@ private: struct Occluder { PackedVector3Array vertices; PackedInt32Array indices; - RBSet<InstanceID> users; + HashSet<InstanceID, InstanceID> users; }; struct OccluderInstance { @@ -136,7 +138,7 @@ private: int current_scene_idx = 0; HashMap<RID, OccluderInstance> instances; - RBSet<RID> dirty_instances; // To avoid duplicates + HashSet<RID> dirty_instances; // To avoid duplicates LocalVector<RID> dirty_instances_array; // To iterate and split into threads LocalVector<RID> removed_instances; diff --git a/modules/raycast/static_raycaster.cpp b/modules/raycast/static_raycaster.cpp index 5d2dedf1a4..7659eea27f 100644 --- a/modules/raycast/static_raycaster.cpp +++ b/modules/raycast/static_raycaster.cpp @@ -94,7 +94,7 @@ void StaticRaycasterEmbree::commit() { rtcCommitScene(embree_scene); } -void StaticRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) { +void StaticRaycasterEmbree::set_mesh_filter(const HashSet<int> &p_mesh_ids) { for (const int &E : p_mesh_ids) { rtcDisableGeometry(rtcGetGeometry(embree_scene, E)); } diff --git a/modules/raycast/static_raycaster.h b/modules/raycast/static_raycaster.h index b52b5bccfc..e2909f9b56 100644 --- a/modules/raycast/static_raycaster.h +++ b/modules/raycast/static_raycaster.h @@ -41,7 +41,7 @@ private: static RTCDevice embree_device; RTCScene embree_scene; - RBSet<int> filter_meshes; + HashSet<int> filter_meshes; public: virtual bool intersect(Ray &p_ray) override; @@ -50,7 +50,7 @@ public: virtual void add_mesh(const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices, unsigned int p_id) override; virtual void commit() override; - virtual void set_mesh_filter(const RBSet<int> &p_mesh_ids) override; + virtual void set_mesh_filter(const HashSet<int> &p_mesh_ids) override; virtual void clear_mesh_filter() override; static StaticRaycaster *create_embree_raycaster(); |