diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/bit_map.cpp | 4 | ||||
-rw-r--r-- | scene/resources/concave_polygon_shape_3d.cpp | 2 | ||||
-rw-r--r-- | scene/resources/concave_polygon_shape_3d.h | 12 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 2 | ||||
-rw-r--r-- | scene/resources/polygon_path_finder.cpp | 2 | ||||
-rw-r--r-- | scene/resources/polygon_path_finder.h | 22 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 4 | ||||
-rw-r--r-- | scene/resources/resource_format_text.h | 2 | ||||
-rw-r--r-- | scene/resources/theme.cpp | 2 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 2 | ||||
-rw-r--r-- | scene/resources/tile_set.h | 1 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 16 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 4 | ||||
-rw-r--r-- | scene/resources/world_2d.h | 4 | ||||
-rw-r--r-- | scene/resources/world_3d.h | 4 |
15 files changed, 43 insertions, 40 deletions
diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp index 634fb3ef2f..1ff72825ac 100644 --- a/scene/resources/bit_map.cpp +++ b/scene/resources/bit_map.cpp @@ -170,8 +170,8 @@ Vector<Vector2> BitMap::_march_square(const Rect2i &rect, const Point2i &start) int curx = startx; int cury = starty; unsigned int count = 0; - RBSet<Point2i> case9s; - RBSet<Point2i> case6s; + HashSet<Point2i> case9s; + HashSet<Point2i> case6s; Vector<Vector2> _points; do { int sv = 0; diff --git a/scene/resources/concave_polygon_shape_3d.cpp b/scene/resources/concave_polygon_shape_3d.cpp index 081271c2fc..b91f0e4f1c 100644 --- a/scene/resources/concave_polygon_shape_3d.cpp +++ b/scene/resources/concave_polygon_shape_3d.cpp @@ -33,7 +33,7 @@ #include "servers/physics_server_3d.h" Vector<Vector3> ConcavePolygonShape3D::get_debug_mesh_lines() const { - RBSet<DrawEdge> edges; + HashSet<DrawEdge, DrawEdge> edges; int index_count = faces.size(); ERR_FAIL_COND_V((index_count % 3) != 0, Vector<Vector3>()); diff --git a/scene/resources/concave_polygon_shape_3d.h b/scene/resources/concave_polygon_shape_3d.h index 5337deb5fb..4711e38468 100644 --- a/scene/resources/concave_polygon_shape_3d.h +++ b/scene/resources/concave_polygon_shape_3d.h @@ -42,12 +42,12 @@ class ConcavePolygonShape3D : public Shape3D { struct DrawEdge { Vector3 a; Vector3 b; - bool operator<(const DrawEdge &p_edge) const { - if (a == p_edge.a) { - return b < p_edge.b; - } else { - return a < p_edge.a; - } + static uint32_t hash(const DrawEdge &p_edge) { + uint32_t h = hash_djb2_one_32(HashMapHasherDefault::hash(p_edge.a)); + return hash_djb2_one_32(HashMapHasherDefault::hash(p_edge.b), h); + } + bool operator==(const DrawEdge &p_edge) const { + return (a == p_edge.a && b == p_edge.b); } DrawEdge(const Vector3 &p_a = Vector3(), const Vector3 &p_b = Vector3()) { diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index c7b1981aed..f795e0ffd0 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -53,7 +53,7 @@ static Array _sanitize_node_pinned_properties(Node *p_node) { if (pinned.is_empty()) { return Array(); } - RBSet<StringName> storable_properties; + HashSet<StringName> storable_properties; p_node->get_storable_properties(storable_properties); int i = 0; do { diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index 6b0c22d720..29135e30c9 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -289,7 +289,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2 &p_from, const Vector } //solve graph - RBSet<int> open_list; + HashSet<int> open_list; points.write[aidx].distance = 0; points.write[aidx].prev = aidx; diff --git a/scene/resources/polygon_path_finder.h b/scene/resources/polygon_path_finder.h index 71ad77eb6e..0e22b53dcb 100644 --- a/scene/resources/polygon_path_finder.h +++ b/scene/resources/polygon_path_finder.h @@ -38,21 +38,23 @@ class PolygonPathFinder : public Resource { struct Point { Vector2 pos; - RBSet<int> connections; + HashSet<int> connections; float distance = 0.0; float penalty = 0.0; int prev = 0; }; - struct Edge { - int points[2] = {}; + union Edge { + struct { + int32_t points[2]; + }; + uint64_t key = 0; - _FORCE_INLINE_ bool operator<(const Edge &p_edge) const { - if (points[0] == p_edge.points[0]) { - return points[1] < p_edge.points[1]; - } else { - return points[0] < p_edge.points[0]; - } + _FORCE_INLINE_ bool operator==(const Edge &p_edge) const { + return key == p_edge.key; + } + _FORCE_INLINE_ static uint32_t hash(const Edge &p_edge) { + return hash_one_uint64(p_edge.key); } Edge(int a = 0, int b = 0) { @@ -68,7 +70,7 @@ class PolygonPathFinder : public Resource { Rect2 bounds; Vector<Point> points; - RBSet<Edge> edges; + HashSet<Edge, Edge> edges; bool _is_point_inside(const Vector2 &p_point) const; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 193bd0ac05..72d66ee4f5 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1737,7 +1737,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso #ifdef TOOLS_ENABLED // Keep order from cached ids. - RBSet<String> cached_ids_found; + HashSet<String> cached_ids_found; for (KeyValue<Ref<Resource>, String> &E : external_resources) { String cached_id = E.key->get_id_for_path(local_path); if (cached_id.is_empty() || cached_ids_found.has(cached_id)) { @@ -1809,7 +1809,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso f->store_line(String()); // Separate. } - RBSet<String> used_unique_ids; + HashSet<String> used_unique_ids; for (List<Ref<Resource>>::Element *E = saved_resources.front(); E; E = E->next()) { Ref<Resource> res = E->get(); diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index adab503599..5c6a937bf2 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -165,7 +165,7 @@ class ResourceFormatSaverTextInstance { RBMap<NonPersistentKey, Ref<Resource>> non_persistent_map; - RBSet<Ref<Resource>> resource_set; + HashSet<Ref<Resource>> resource_set; List<Ref<Resource>> saved_resources; HashMap<Ref<Resource>, String> external_resources; HashMap<Ref<Resource>, String> internal_resources; diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 2981f38766..6af5d127a8 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -1275,7 +1275,7 @@ void Theme::get_type_list(List<StringName> *p_list) const { // This Set guarantees uniqueness. // Because each map can have the same type defined, but for this method // we only want one occurrence of each type. - RBSet<StringName> types; + HashSet<StringName> types; // Icons. for (const KeyValue<StringName, ThemeIconMap> &E : icon_map) { diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index cdfe75f478..1b1107d79e 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -34,7 +34,7 @@ #include "core/io/marshalls.h" #include "core/math/geometry_2d.h" #include "core/templates/local_vector.h" - +#include "core/templates/rb_set.h" #include "scene/2d/navigation_region_2d.h" #include "scene/gui/control.h" #include "scene/resources/convex_polygon_shape_2d.h" diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 633e1f4bed..615ab35615 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -34,6 +34,7 @@ #include "core/io/resource.h" #include "core/object/object.h" #include "core/templates/local_vector.h" +#include "core/templates/rb_set.h" #include "scene/2d/light_occluder_2d.h" #include "scene/2d/navigation_region_2d.h" #include "scene/main/canvas_item.h" diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index d361aa876b..18bb0ff01d 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1180,7 +1180,7 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port StringBuilder global_code_per_node; HashMap<Type, StringBuilder> global_code_per_func; StringBuilder code; - RBSet<StringName> classes; + HashSet<StringName> classes; global_code += String() + "shader_type canvas_item;\n"; @@ -1222,7 +1222,7 @@ String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port code += "\nvoid fragment() {\n"; - RBSet<int> processed; + HashSet<int> processed; Error err = _write_node(p_type, &global_code, &global_code_per_node, &global_code_per_func, code, default_tex_params, input_connections, output_connections, p_node, processed, true, classes); ERR_FAIL_COND_V(err != OK, String()); @@ -1551,7 +1551,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const { //render modes HashMap<String, String> blend_mode_enums; - RBSet<String> toggles; + HashSet<String> toggles; const Vector<ShaderLanguage::ModeInfo> &rmodes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)); @@ -1611,7 +1611,7 @@ void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const { } } -Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap<Type, StringBuilder> *global_code_per_func, StringBuilder &code, Vector<VisualShader::DefaultTextureParam> &def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &output_connections, int node, RBSet<int> &processed, bool for_preview, RBSet<StringName> &r_classes) const { +Error VisualShader::_write_node(Type type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap<Type, StringBuilder> *global_code_per_func, StringBuilder &code, Vector<VisualShader::DefaultTextureParam> &def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &output_connections, int node, HashSet<int> &processed, bool for_preview, HashSet<StringName> &r_classes) const { const Ref<VisualShaderNode> vsnode = graph[type].nodes[node].node; if (vsnode->is_disabled()) { @@ -2136,7 +2136,7 @@ void VisualShader::_update_shader() const { HashMap<Type, StringBuilder> global_code_per_func; StringBuilder code; Vector<VisualShader::DefaultTextureParam> default_tex_params; - RBSet<StringName> classes; + HashSet<StringName> classes; HashMap<int, int> insertion_pos; static const char *shader_mode_str[Shader::MODE_MAX] = { "spatial", "canvas_item", "particles", "sky", "fog" }; @@ -2181,7 +2181,7 @@ void VisualShader::_update_shader() const { static const char *func_name[TYPE_MAX] = { "vertex", "fragment", "light", "start", "process", "collide", "start_custom", "process_custom", "sky", "fog" }; String global_expressions; - RBSet<String> used_uniform_names; + HashSet<String> used_uniform_names; List<VisualShaderNodeUniform *> uniforms; HashMap<int, List<int>> emitters; HashMap<int, List<int>> varying_setters; @@ -2270,7 +2270,7 @@ void VisualShader::_update_shader() const { } HashMap<int, String> code_map; - RBSet<int> empty_funcs; + HashSet<int> empty_funcs; for (int i = 0; i < TYPE_MAX; i++) { if (!has_func_name(RenderingServer::ShaderMode(shader_mode), func_name[i])) { @@ -2282,7 +2282,7 @@ void VisualShader::_update_shader() const { VMap<ConnectionKey, const List<Connection>::Element *> output_connections; StringBuilder func_code; - RBSet<int> processed; + HashSet<int> processed; bool is_empty_func = false; if (shader_mode != Shader::MODE_PARTICLES && shader_mode != Shader::MODE_SKY && shader_mode != Shader::MODE_FOG) { diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index aa5263943b..925dff31af 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -139,7 +139,7 @@ private: Vector2 graph_offset; HashMap<String, int> modes; - RBSet<StringName> flags; + HashSet<StringName> flags; HashMap<String, Varying> varyings; List<Varying> varyings_list; @@ -158,7 +158,7 @@ private: } }; - Error _write_node(Type p_type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap<Type, StringBuilder> *global_code_per_func, StringBuilder &code, Vector<DefaultTextureParam> &def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &output_connections, int node, RBSet<int> &processed, bool for_preview, RBSet<StringName> &r_classes) const; + Error _write_node(Type p_type, StringBuilder *global_code, StringBuilder *global_code_per_node, HashMap<Type, StringBuilder> *global_code_per_func, StringBuilder &code, Vector<DefaultTextureParam> &def_tex_params, const VMap<ConnectionKey, const List<Connection>::Element *> &input_connections, const VMap<ConnectionKey, const List<Connection>::Element *> &output_connections, int node, HashSet<int> &processed, bool for_preview, HashSet<StringName> &r_classes) const; void _input_type_changed(Type p_type, int p_id); bool has_func_name(RenderingServer::ShaderMode p_mode, const String &p_func_name) const; diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h index 71ae40ec82..c04b8f6461 100644 --- a/scene/resources/world_2d.h +++ b/scene/resources/world_2d.h @@ -46,7 +46,7 @@ class World2D : public Resource { RID space; RID navigation_map; - RBSet<Viewport *> viewports; + HashSet<Viewport *> viewports; protected: static void _bind_methods(); @@ -62,7 +62,7 @@ public: PhysicsDirectSpaceState2D *get_direct_space_state(); - _FORCE_INLINE_ const RBSet<Viewport *> &get_viewports() { return viewports; } + _FORCE_INLINE_ const HashSet<Viewport *> &get_viewports() { return viewports; } World2D(); ~World2D(); diff --git a/scene/resources/world_3d.h b/scene/resources/world_3d.h index 18d28e812f..08bc050349 100644 --- a/scene/resources/world_3d.h +++ b/scene/resources/world_3d.h @@ -53,7 +53,7 @@ private: Ref<Environment> fallback_environment; Ref<CameraEffects> camera_effects; - RBSet<Camera3D *> cameras; + HashSet<Camera3D *> cameras; protected: static void _bind_methods(); @@ -77,7 +77,7 @@ public: void set_camera_effects(const Ref<CameraEffects> &p_camera_effects); Ref<CameraEffects> get_camera_effects() const; - _FORCE_INLINE_ const RBSet<Camera3D *> &get_cameras() const { return cameras; } + _FORCE_INLINE_ const HashSet<Camera3D *> &get_cameras() const { return cameras; } PhysicsDirectSpaceState3D *get_direct_space_state(); |