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:
@ -632,7 +632,7 @@ Vector2 Curve2D::interpolatef(real_t p_findex) const {
|
||||
return interpolate((int)p_findex, Math::fmod(p_findex, (real_t)1.0));
|
||||
}
|
||||
|
||||
void Curve2D::_bake_segment2d(Map<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_tol) const {
|
||||
void Curve2D::_bake_segment2d(HashMap<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_tol) const {
|
||||
real_t mp = p_begin + (p_end - p_begin) * 0.5;
|
||||
Vector2 beg = _bezier_interp(p_begin, p_a, p_a + p_out, p_b + p_in, p_b);
|
||||
Vector2 mid = _bezier_interp(mp, p_a, p_a + p_out, p_b + p_in, p_b);
|
||||
@ -954,7 +954,7 @@ PackedVector2Array Curve2D::tessellate(int p_max_stages, real_t p_tolerance) con
|
||||
if (points.size() == 0) {
|
||||
return tess;
|
||||
}
|
||||
Vector<Map<real_t, Vector2>> midpoints;
|
||||
Vector<HashMap<real_t, Vector2>> midpoints;
|
||||
|
||||
midpoints.resize(points.size() - 1);
|
||||
|
||||
@ -1137,7 +1137,7 @@ Vector3 Curve3D::interpolatef(real_t p_findex) const {
|
||||
return interpolate((int)p_findex, Math::fmod(p_findex, (real_t)1.0));
|
||||
}
|
||||
|
||||
void Curve3D::_bake_segment3d(Map<real_t, Vector3> &r_bake, real_t p_begin, real_t p_end, const Vector3 &p_a, const Vector3 &p_out, const Vector3 &p_b, const Vector3 &p_in, int p_depth, int p_max_depth, real_t p_tol) const {
|
||||
void Curve3D::_bake_segment3d(HashMap<real_t, Vector3> &r_bake, real_t p_begin, real_t p_end, const Vector3 &p_a, const Vector3 &p_out, const Vector3 &p_b, const Vector3 &p_in, int p_depth, int p_max_depth, real_t p_tol) const {
|
||||
real_t mp = p_begin + (p_end - p_begin) * 0.5;
|
||||
Vector3 beg = _bezier_interp(p_begin, p_a, p_a + p_out, p_b + p_in, p_b);
|
||||
Vector3 mid = _bezier_interp(mp, p_a, p_a + p_out, p_b + p_in, p_b);
|
||||
@ -1668,7 +1668,7 @@ PackedVector3Array Curve3D::tessellate(int p_max_stages, real_t p_tolerance) con
|
||||
if (points.size() == 0) {
|
||||
return tess;
|
||||
}
|
||||
Vector<Map<real_t, Vector3>> midpoints;
|
||||
Vector<HashMap<real_t, Vector3>> midpoints;
|
||||
|
||||
midpoints.resize(points.size() - 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user