Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
This commit is contained in:
parent
396def9b66
commit
746dddc067
587 changed files with 3707 additions and 3538 deletions
|
|
@ -211,7 +211,7 @@ void CSGBrush::build_from_faces(const Vector<Vector3> &p_vertices, const Vector<
|
|||
int ic = p_flip_faces.size();
|
||||
const bool *ri = p_flip_faces.ptr();
|
||||
|
||||
Map<Ref<Material>, int> material_map;
|
||||
HashMap<Ref<Material>, int> material_map;
|
||||
|
||||
faces.resize(p_vertices.size() / 3);
|
||||
|
||||
|
|
@ -242,10 +242,10 @@ void CSGBrush::build_from_faces(const Vector<Vector3> &p_vertices, const Vector<
|
|||
if (mc == vc / 3) {
|
||||
Ref<Material> mat = rm[i];
|
||||
if (mat.is_valid()) {
|
||||
const Map<Ref<Material>, int>::Element *E = material_map.find(mat);
|
||||
HashMap<Ref<Material>, int>::ConstIterator E = material_map.find(mat);
|
||||
|
||||
if (E) {
|
||||
f.material = E->get();
|
||||
f.material = E->value;
|
||||
} else {
|
||||
f.material = material_map.size();
|
||||
material_map[mat] = f.material;
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@
|
|||
#include "core/math/vector3.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/templates/list.h"
|
||||
#include "core/templates/map.h"
|
||||
#include "core/templates/oa_hash_map.h"
|
||||
#include "core/templates/rb_map.h"
|
||||
#include "core/templates/vector.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
|
|
@ -139,8 +139,8 @@ struct CSGBrushOperation {
|
|||
|
||||
Vector<Vector3> points;
|
||||
Vector<Face> faces;
|
||||
Map<Ref<Material>, int> materials;
|
||||
Map<Vector3, int> vertex_map;
|
||||
HashMap<Ref<Material>, int> materials;
|
||||
HashMap<Vector3, int> vertex_map;
|
||||
OAHashMap<VertexKey, int, VertexKeyHash> snap_cache;
|
||||
float vertex_snap = 0.0;
|
||||
|
||||
|
|
@ -184,8 +184,8 @@ struct CSGBrushOperation {
|
|||
};
|
||||
|
||||
struct Build2DFaceCollection {
|
||||
Map<int, Build2DFaces> build2DFacesA;
|
||||
Map<int, Build2DFaces> build2DFacesB;
|
||||
HashMap<int, Build2DFaces> build2DFacesA;
|
||||
HashMap<int, Build2DFaces> build2DFacesB;
|
||||
};
|
||||
|
||||
void update_faces(const CSGBrush &p_brush_a, const int p_face_idx_a, const CSGBrush &p_brush_b, const int p_face_idx_b, Build2DFaceCollection &p_collection, float p_vertex_snap);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue