diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2017-11-16 21:09:00 -0500 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-11-17 11:01:41 -0500 |
commit | d28763a4c1792dc00fde3d151eaea54f9cf2b8a9 (patch) | |
tree | 7abd311b6e672829bd751fbf4d9135b60f2f9913 /scene | |
parent | b44cb4e3b9b573a3cbbd6f71aff81e6c3465d84b (diff) |
Rename Rect3 to AABB.
Fixes #12973.
Diffstat (limited to 'scene')
39 files changed, 132 insertions, 132 deletions
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index c146ac08c2..aee5d89150 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -77,7 +77,7 @@ void Particles2D::set_randomness_ratio(float p_ratio) { void Particles2D::set_visibility_rect(const Rect2 &p_aabb) { visibility_rect = p_aabb; - Rect3 aabb; + AABB aabb; aabb.position.x = p_aabb.position.x; aabb.position.y = p_aabb.position.y; aabb.size.x = p_aabb.size.x; @@ -223,7 +223,7 @@ String Particles2D::get_configuration_warning() const { Rect2 Particles2D::capture_rect() const { - Rect3 aabb = VS::get_singleton()->particles_get_current_aabb(particles); + AABB aabb = VS::get_singleton()->particles_get_current_aabb(particles); Rect2 r; r.position.x = aabb.position.x; r.position.y = aabb.position.y; @@ -378,7 +378,7 @@ void Particles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta"); ADD_GROUP("Drawing", ""); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_rect"), "set_visibility_rect", "get_visibility_rect"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_rect"), "set_visibility_rect", "get_visibility_rect"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates"); ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime"), "set_draw_order", "get_draw_order"); ADD_GROUP("Process Material", "process_"); diff --git a/scene/3d/collision_polygon.cpp b/scene/3d/collision_polygon.cpp index 382cbb8f38..a6d812efec 100644 --- a/scene/3d/collision_polygon.cpp +++ b/scene/3d/collision_polygon.cpp @@ -117,7 +117,7 @@ Vector<Point2> CollisionPolygon::get_polygon() const { return polygon; } -Rect3 CollisionPolygon::get_item_rect() const { +AABB CollisionPolygon::get_item_rect() const { return aabb; } @@ -176,7 +176,7 @@ void CollisionPolygon::_bind_methods() { CollisionPolygon::CollisionPolygon() { - aabb = Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2)); + aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); depth = 1.0; set_notify_local_transform(true); parent = NULL; diff --git a/scene/3d/collision_polygon.h b/scene/3d/collision_polygon.h index dbed1d7154..14d8c3aba6 100644 --- a/scene/3d/collision_polygon.h +++ b/scene/3d/collision_polygon.h @@ -40,7 +40,7 @@ class CollisionPolygon : public Spatial { protected: float depth; - Rect3 aabb; + AABB aabb; Vector<Point2> polygon; uint32_t owner_id; @@ -64,7 +64,7 @@ public: void set_disabled(bool p_disabled); bool is_disabled() const; - virtual Rect3 get_item_rect() const; + virtual AABB get_item_rect() const; String get_configuration_warning() const; diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index bc70feaffb..05d5d52d28 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -31,12 +31,12 @@ #include "mesh_instance.h" -void GIProbeData::set_bounds(const Rect3 &p_bounds) { +void GIProbeData::set_bounds(const AABB &p_bounds) { VS::get_singleton()->gi_probe_set_bounds(probe, p_bounds); } -Rect3 GIProbeData::get_bounds() const { +AABB GIProbeData::get_bounds() const { return VS::get_singleton()->gi_probe_get_bounds(probe); } @@ -180,7 +180,7 @@ void GIProbeData::_bind_methods() { ClassDB::bind_method(D_METHOD("set_compress", "compress"), &GIProbeData::set_compress); ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbeData::is_compressed); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_size", "get_cell_size"); ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "to_cell_xform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_to_cell_xform", "get_to_cell_xform"); @@ -542,7 +542,7 @@ static _FORCE_INLINE_ Vector2 get_uv(const Vector3 &p_pos, const Vector3 *p_vtx, return p_uv[0] * u + p_uv[1] * v + p_uv[2] * w; } -void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const Rect3 &p_aabb, Baker *p_baker) { +void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const AABB &p_aabb, Baker *p_baker) { if (p_level == p_baker->cell_subdiv - 1) { //plot the face by guessing it's albedo and emission value @@ -702,7 +702,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons int half = (1 << (p_baker->cell_subdiv - 1)) >> (p_level + 1); for (int i = 0; i < 8; i++) { - Rect3 aabb = p_aabb; + AABB aabb = p_aabb; aabb.size *= 0.5; int nx = p_x; @@ -726,7 +726,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons continue; { - Rect3 test_aabb = aabb; + AABB test_aabb = aabb; //test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time Vector3 qsize = test_aabb.size * 0.5; //quarter size, for fast aabb test @@ -1083,11 +1083,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) { Ref<Mesh> mesh = mi->get_mesh(); if (mesh.is_valid()) { - Rect3 aabb = mesh->get_aabb(); + AABB aabb = mesh->get_aabb(); Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform(); - if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) { + if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) { Baker::PlotMesh pm; pm.local_xform = xf; pm.mesh = mesh; @@ -1113,11 +1113,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) { if (!mesh.is_valid()) continue; - Rect3 aabb = mesh->get_aabb(); + AABB aabb = mesh->get_aabb(); Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf); - if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) { + if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) { Baker::PlotMesh pm; pm.local_xform = xf; pm.mesh = mesh; @@ -1151,7 +1151,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { baker.bake_cells.resize(1); //find out the actual real bounds, power of 2, which gets the highest subdivision - baker.po2_bounds = Rect3(-extents, extents * 2.0); + baker.po2_bounds = AABB(-extents, extents * 2.0); int longest_axis = baker.po2_bounds.get_longest_axis_index(); baker.axis_cell_size[longest_axis] = (1 << (baker.cell_subdiv - 1)); baker.leaf_voxel_count = 0; @@ -1286,7 +1286,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { Ref<GIProbeData> probe_data; probe_data.instance(); - probe_data->set_bounds(Rect3(-extents, extents * 2.0)); + probe_data->set_bounds(AABB(-extents, extents * 2.0)); probe_data->set_cell_size(baker.po2_bounds.size[longest_axis] / baker.axis_cell_size[longest_axis]); probe_data->set_dynamic_data(data); probe_data->set_dynamic_range(dynamic_range); @@ -1306,7 +1306,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) { } } -void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) { +void GIProbe::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) { if (p_level == p_baker->cell_subdiv - 1) { @@ -1328,7 +1328,7 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<Multi if (p_baker->bake_cells[p_idx].childs[i] == Baker::CHILD_EMPTY) continue; - Rect3 aabb = p_aabb; + AABB aabb = p_aabb; aabb.size *= 0.5; if (i & 1) @@ -1440,9 +1440,9 @@ void GIProbe::_debug_bake() { bake(NULL, true); } -Rect3 GIProbe::get_aabb() const { +AABB GIProbe::get_aabb() const { - return Rect3(-extents, extents * 2); + return AABB(-extents, extents * 2); } PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index 8f13960b67..324ff8e917 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -43,8 +43,8 @@ protected: static void _bind_methods(); public: - void set_bounds(const Rect3 &p_bounds); - Rect3 get_bounds() const; + void set_bounds(const AABB &p_bounds); + AABB get_bounds() const; void set_cell_size(float p_size); float get_cell_size() const; @@ -146,7 +146,7 @@ private: MaterialCache _get_material_cache(Ref<Material> p_material); int leaf_voxel_count; - Rect3 po2_bounds; + AABB po2_bounds; int axis_cell_size[3]; struct PlotMesh { @@ -180,12 +180,12 @@ private: Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color_mul, const Color &p_color_add); Baker::MaterialCache _get_material_cache(Ref<Material> p_material, Baker *p_baker); - void _plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const Rect3 &p_aabb, Baker *p_baker); + void _plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const AABB &p_aabb, Baker *p_baker); void _plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, Baker *p_baker, const Vector<Ref<Material> > &p_materials, const Ref<Material> &p_override_material); void _find_meshes(Node *p_at_node, Baker *p_baker); void _fixup_plot(int p_idx, int p_level, int p_x, int p_y, int p_z, Baker *p_baker); - void _debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker); + void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker); void _create_debug_mesh(Baker *p_baker); void _debug_bake(); @@ -230,7 +230,7 @@ public: void bake(Node *p_from_node = NULL, bool p_create_visual_debug = false); - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; GIProbe(); diff --git a/scene/3d/immediate_geometry.cpp b/scene/3d/immediate_geometry.cpp index 11f7efe066..092ed8f0b2 100644 --- a/scene/3d/immediate_geometry.cpp +++ b/scene/3d/immediate_geometry.cpp @@ -85,7 +85,7 @@ void ImmediateGeometry::clear() { cached_textures.clear(); } -Rect3 ImmediateGeometry::get_aabb() const { +AABB ImmediateGeometry::get_aabb() const { return aabb; } diff --git a/scene/3d/immediate_geometry.h b/scene/3d/immediate_geometry.h index 93ef726c6d..1ff4e05e82 100644 --- a/scene/3d/immediate_geometry.h +++ b/scene/3d/immediate_geometry.h @@ -42,7 +42,7 @@ class ImmediateGeometry : public GeometryInstance { // in VisualServer from becoming invalid if the texture is no longer used List<Ref<Texture> > cached_textures; bool empty; - Rect3 aabb; + AABB aabb; protected: static void _bind_methods(); @@ -62,7 +62,7 @@ public: void add_sphere(int p_lats, int p_lons, float p_radius, bool p_add_uv = true); - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; ImmediateGeometry(); diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 389d87cd90..324411c5cc 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -117,24 +117,24 @@ bool Light::get_shadow_reverse_cull_face() const { return reverse_cull; } -Rect3 Light::get_aabb() const { +AABB Light::get_aabb() const { if (type == VisualServer::LIGHT_DIRECTIONAL) { - return Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2)); + return AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); } else if (type == VisualServer::LIGHT_OMNI) { - return Rect3(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]); + return AABB(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]); } else if (type == VisualServer::LIGHT_SPOT) { float len = param[PARAM_RANGE]; float size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len; - return Rect3(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); + return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len)); } - return Rect3(); + return AABB(); } PoolVector<Face3> Light::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/light.h b/scene/3d/light.h index 2f3ac8a5e7..37c17cbbe3 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -113,7 +113,7 @@ public: void set_shadow_reverse_cull_face(bool p_enable); bool get_shadow_reverse_cull_face() const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; Light(); diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index c8215971c4..1e52ccc6e0 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -165,12 +165,12 @@ NodePath MeshInstance::get_skeleton_path() { return skeleton_path; } -Rect3 MeshInstance::get_aabb() const { +AABB MeshInstance::get_aabb() const { if (!mesh.is_null()) return mesh->get_aabb(); - return Rect3(); + return AABB(); } PoolVector<Face3> MeshInstance::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 8e8c12a592..970a10aaf3 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -85,7 +85,7 @@ public: void create_debug_tangents(); - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; MeshInstance(); diff --git a/scene/3d/multimesh_instance.cpp b/scene/3d/multimesh_instance.cpp index f90489f1f0..ce7b97be7f 100644 --- a/scene/3d/multimesh_instance.cpp +++ b/scene/3d/multimesh_instance.cpp @@ -55,10 +55,10 @@ PoolVector<Face3> MultiMeshInstance::get_faces(uint32_t p_usage_flags) const { return PoolVector<Face3>(); } -Rect3 MultiMeshInstance::get_aabb() const { +AABB MultiMeshInstance::get_aabb() const { if (multimesh.is_null()) - return Rect3(); + return AABB(); else return multimesh->get_aabb(); } diff --git a/scene/3d/multimesh_instance.h b/scene/3d/multimesh_instance.h index cd0e7b463c..9b2b1ff9a7 100644 --- a/scene/3d/multimesh_instance.h +++ b/scene/3d/multimesh_instance.h @@ -52,7 +52,7 @@ public: void set_multimesh(const Ref<MultiMesh> &p_multimesh); Ref<MultiMesh> get_multimesh() const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; MultiMeshInstance(); ~MultiMeshInstance(); diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 6ac6e52367..915a10328b 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -31,9 +31,9 @@ #include "scene/resources/surface_tool.h" #include "servers/visual_server.h" -Rect3 Particles::get_aabb() const { +AABB Particles::get_aabb() const { - return Rect3(); + return AABB(); } PoolVector<Face3> Particles::get_faces(uint32_t p_usage_flags) const { @@ -82,7 +82,7 @@ void Particles::set_randomness_ratio(float p_ratio) { randomness_ratio = p_ratio; VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio); } -void Particles::set_visibility_aabb(const Rect3 &p_aabb) { +void Particles::set_visibility_aabb(const AABB &p_aabb) { visibility_aabb = p_aabb; VS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb); @@ -140,7 +140,7 @@ float Particles::get_randomness_ratio() const { return randomness_ratio; } -Rect3 Particles::get_visibility_aabb() const { +AABB Particles::get_visibility_aabb() const { return visibility_aabb; } @@ -252,7 +252,7 @@ void Particles::restart() { VisualServer::get_singleton()->particles_restart(particles); } -Rect3 Particles::capture_aabb() const { +AABB Particles::capture_aabb() const { return VS::get_singleton()->particles_get_current_aabb(particles); } @@ -335,7 +335,7 @@ void Particles::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta"); ADD_GROUP("Drawing", ""); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates"); ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime,View Depth"), "set_draw_order", "get_draw_order"); ADD_GROUP("Process Material", ""); @@ -367,7 +367,7 @@ Particles::Particles() { set_pre_process_time(0); set_explosiveness_ratio(0); set_randomness_ratio(0); - set_visibility_aabb(Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8))); + set_visibility_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))); set_use_local_coordinates(true); set_draw_passes(1); set_draw_order(DRAW_ORDER_INDEX); diff --git a/scene/3d/particles.h b/scene/3d/particles.h index e3109f470f..30080360bb 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -65,7 +65,7 @@ private: float explosiveness_ratio; float randomness_ratio; float speed_scale; - Rect3 visibility_aabb; + AABB visibility_aabb; bool local_coords; int fixed_fps; bool fractional_delta; @@ -82,7 +82,7 @@ protected: virtual void _validate_property(PropertyInfo &property) const; public: - Rect3 get_aabb() const; + AABB get_aabb() const; PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_emitting(bool p_emitting); @@ -92,7 +92,7 @@ public: void set_pre_process_time(float p_time); void set_explosiveness_ratio(float p_ratio); void set_randomness_ratio(float p_ratio); - void set_visibility_aabb(const Rect3 &p_aabb); + void set_visibility_aabb(const AABB &p_aabb); void set_use_local_coordinates(bool p_enable); void set_process_material(const Ref<Material> &p_material); void set_speed_scale(float p_scale); @@ -104,7 +104,7 @@ public: float get_pre_process_time() const; float get_explosiveness_ratio() const; float get_randomness_ratio() const; - Rect3 get_visibility_aabb() const; + AABB get_visibility_aabb() const; bool get_use_local_coordinates() const; Ref<Material> get_process_material() const; float get_speed_scale() const; @@ -128,7 +128,7 @@ public: void restart(); - Rect3 capture_aabb() const; + AABB capture_aabb() const; Particles(); ~Particles(); }; diff --git a/scene/3d/portal.cpp b/scene/3d/portal.cpp index 6c14f7dbc9..4fde29aab9 100644 --- a/scene/3d/portal.cpp +++ b/scene/3d/portal.cpp @@ -98,7 +98,7 @@ void Portal::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::REAL, "connect_range", PROPERTY_HINT_RANGE, "0.1,4096,0.01")); } -Rect3 Portal::get_aabb() const { +AABB Portal::get_aabb() const { return aabb; } diff --git a/scene/3d/portal.h b/scene/3d/portal.h index 6de3df8553..4ea208a718 100644 --- a/scene/3d/portal.h +++ b/scene/3d/portal.h @@ -53,7 +53,7 @@ class Portal : public VisualInstance { Color disabled_color; float connect_range; - Rect3 aabb; + AABB aabb; protected: bool _set(const StringName &p_name, const Variant &p_value); @@ -63,7 +63,7 @@ protected: static void _bind_methods(); public: - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_enabled(bool p_enabled); diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 46b105cd21..0e575ec152 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -178,9 +178,9 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const { return update_mode; } -Rect3 ReflectionProbe::get_aabb() const { +AABB ReflectionProbe::get_aabb() const { - Rect3 aabb; + AABB aabb; aabb.position = -origin_offset; aabb.size = origin_offset + extents; return aabb; diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h index 7c328a8f16..26f17fdcf9 100644 --- a/scene/3d/reflection_probe.h +++ b/scene/3d/reflection_probe.h @@ -101,7 +101,7 @@ public: void set_update_mode(UpdateMode p_mode); UpdateMode get_update_mode() const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; ReflectionProbe(); diff --git a/scene/3d/room_instance.cpp b/scene/3d/room_instance.cpp index 439b6bfdf8..47a7b8bfb9 100644 --- a/scene/3d/room_instance.cpp +++ b/scene/3d/room_instance.cpp @@ -66,12 +66,12 @@ void Room::_notification(int p_what) { } } -Rect3 Room::get_aabb() const { +AABB Room::get_aabb() const { if (room.is_null()) - return Rect3(); + return AABB(); - return Rect3(); + return AABB(); } PoolVector<Face3> Room::get_faces(uint32_t p_usage_flags) const { diff --git a/scene/3d/room_instance.h b/scene/3d/room_instance.h index b9a64b6670..3069ea2eba 100644 --- a/scene/3d/room_instance.h +++ b/scene/3d/room_instance.h @@ -71,7 +71,7 @@ public: NOTIFICATION_AREA_CHANGED = 60 }; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; void set_room(const Ref<RoomBounds> &p_room); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 49a3205f21..18ebc22c8b 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -188,7 +188,7 @@ void SpriteBase3D::_queue_update() { call_deferred(SceneStringNames::get_singleton()->_im_update); } -Rect3 SpriteBase3D::get_aabb() const { +AABB SpriteBase3D::get_aabb() const { return aabb; } @@ -407,7 +407,7 @@ void Sprite3D::_draw() { } } - Rect3 aabb; + AABB aabb; for (int i = 0; i < 4; i++) { VS::get_singleton()->immediate_normal(immediate, normal); @@ -698,7 +698,7 @@ void AnimatedSprite3D::_draw() { } } - Rect3 aabb; + AABB aabb; for (int i = 0; i < 4; i++) { VS::get_singleton()->immediate_normal(immediate, normal); diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index 1165392cb2..d18553a504 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -71,7 +71,7 @@ private: Vector3::Axis axis; float pixel_size; - Rect3 aabb; + AABB aabb; RID immediate; @@ -87,7 +87,7 @@ protected: void _notification(int p_what); static void _bind_methods(); virtual void _draw() = 0; - _FORCE_INLINE_ void set_aabb(const Rect3 &p_aabb) { aabb = p_aabb; } + _FORCE_INLINE_ void set_aabb(const AABB &p_aabb) { aabb = p_aabb; } _FORCE_INLINE_ RID &get_immediate() { return immediate; } void _queue_update(); @@ -130,7 +130,7 @@ public: virtual Rect2 get_item_rect() const = 0; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const; SpriteBase3D(); diff --git a/scene/3d/visibility_notifier.cpp b/scene/3d/visibility_notifier.cpp index e60b32a92a..47144c4b78 100644 --- a/scene/3d/visibility_notifier.cpp +++ b/scene/3d/visibility_notifier.cpp @@ -60,7 +60,7 @@ void VisibilityNotifier::_exit_camera(Camera *p_camera) { } } -void VisibilityNotifier::set_aabb(const Rect3 &p_aabb) { +void VisibilityNotifier::set_aabb(const AABB &p_aabb) { if (aabb == p_aabb) return; @@ -74,7 +74,7 @@ void VisibilityNotifier::set_aabb(const Rect3 &p_aabb) { update_gizmo(); } -Rect3 VisibilityNotifier::get_aabb() const { +AABB VisibilityNotifier::get_aabb() const { return aabb; } @@ -108,7 +108,7 @@ void VisibilityNotifier::_bind_methods() { ClassDB::bind_method(D_METHOD("get_aabb"), &VisibilityNotifier::get_aabb); ClassDB::bind_method(D_METHOD("is_on_screen"), &VisibilityNotifier::is_on_screen); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "aabb"), "set_aabb", "get_aabb"); + ADD_PROPERTY(PropertyInfo(Variant::AABB, "aabb"), "set_aabb", "get_aabb"); ADD_SIGNAL(MethodInfo("camera_entered", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"))); ADD_SIGNAL(MethodInfo("camera_exited", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"))); @@ -118,7 +118,7 @@ void VisibilityNotifier::_bind_methods() { VisibilityNotifier::VisibilityNotifier() { - aabb = Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2)); + aabb = AABB(Vector3(-1, -1, -1), Vector3(2, 2, 2)); set_notify_transform(true); } diff --git a/scene/3d/visibility_notifier.h b/scene/3d/visibility_notifier.h index 0b83e0534e..fc06cf5aec 100644 --- a/scene/3d/visibility_notifier.h +++ b/scene/3d/visibility_notifier.h @@ -39,7 +39,7 @@ class VisibilityNotifier : public Spatial { Set<Camera *> cameras; - Rect3 aabb; + AABB aabb; protected: virtual void _screen_enter() {} @@ -53,8 +53,8 @@ protected: void _exit_camera(Camera *p_camera); public: - void set_aabb(const Rect3 &p_aabb); - Rect3 get_aabb() const; + void set_aabb(const AABB &p_aabb); + AABB get_aabb() const; bool is_on_screen() const; VisibilityNotifier(); diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index fa35d982eb..b92e7ead04 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -33,7 +33,7 @@ #include "servers/visual_server.h" #include "skeleton.h" -Rect3 VisualInstance::get_transformed_aabb() const { +AABB VisualInstance::get_transformed_aabb() const { return get_global_transform().xform(get_aabb()); } diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h index c405236d2c..5827f1e1fb 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -62,10 +62,10 @@ public: }; RID get_instance() const; - virtual Rect3 get_aabb() const = 0; + virtual AABB get_aabb() const = 0; virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const = 0; - virtual Rect3 get_transformed_aabb() const; // helper + virtual AABB get_transformed_aabb() const; // helper void set_base(const RID &p_base); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index e0508cf147..40d06dc756 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -416,10 +416,10 @@ Variant Tween::_run_equation(InterpolateData &p_data) { result = r; } break; - case Variant::RECT3: { - Rect3 i = initial_val; - Rect3 d = delta_val; - Rect3 r; + case Variant::AABB: { + AABB i = initial_val; + AABB d = delta_val; + AABB r; APPLY_EQUATION(position.x); APPLY_EQUATION(position.y); @@ -956,10 +956,10 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final case Variant::QUAT: delta_val = final_val.operator Quat() - initial_val.operator Quat(); break; - case Variant::RECT3: { - Rect3 i = initial_val; - Rect3 f = final_val; - delta_val = Rect3(f.position - i.position, f.size - i.size); + case Variant::AABB: { + AABB i = initial_val; + AABB f = final_val; + delta_val = AABB(f.position - i.position, f.size - i.size); } break; case Variant::TRANSFORM: { Transform i = initial_val; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 21e4a85cd1..8192074c17 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1125,14 +1125,14 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a return a.cubic_slerp(b, pa, pb, p_c); } break; - case Variant::RECT3: { + case Variant::AABB: { - Rect3 a = p_a; - Rect3 b = p_b; - Rect3 pa = p_pre_a; - Rect3 pb = p_post_b; + AABB a = p_a; + AABB b = p_b; + AABB pa = p_pre_a; + AABB pb = p_post_b; - return Rect3( + return AABB( a.position.cubic_interpolate(b.position, pa.position, pb.position, p_c), a.size.cubic_interpolate(b.size, pa.size, pb.size, p_c)); } break; diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp index bbc85ce0f6..4b9843f3f5 100644 --- a/scene/resources/box_shape.cpp +++ b/scene/resources/box_shape.cpp @@ -33,7 +33,7 @@ Vector<Vector3> BoxShape::_gen_debug_mesh_lines() { Vector<Vector3> lines; - Rect3 aabb; + AABB aabb; aabb.position = -get_extents(); aabb.size = aabb.position * -2; diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 3e86daf3a7..06b147ba41 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -594,9 +594,9 @@ bool ArrayMesh::_set(const StringName &p_name, const Variant &p_value) { } ERR_FAIL_COND_V(!d.has("aabb"), false); - Rect3 aabb = d["aabb"]; + AABB aabb = d["aabb"]; - Vector<Rect3> bone_aabb; + Vector<AABB> bone_aabb; if (d.has("skeleton_aabb")) { Array baabb = d["skeleton_aabb"]; bone_aabb.resize(baabb.size()); @@ -676,7 +676,7 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const { d["format"] = VS::get_singleton()->mesh_surface_get_format(mesh, idx); d["aabb"] = VS::get_singleton()->mesh_surface_get_aabb(mesh, idx); - Vector<Rect3> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh, idx); + Vector<AABB> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh, idx); Array arr; for (int i = 0; i < skel_aabb.size(); i++) { arr[i] = skel_aabb[i]; @@ -725,13 +725,13 @@ void ArrayMesh::_get_property_list(List<PropertyInfo> *p_list) const { } } - p_list->push_back(PropertyInfo(Variant::RECT3, "custom_aabb/custom_aabb")); + p_list->push_back(PropertyInfo(Variant::AABB, "custom_aabb/custom_aabb")); } void ArrayMesh::_recompute_aabb() { // regenerate AABB - aabb = Rect3(); + aabb = AABB(); for (int i = 0; i < surfaces.size(); i++) { @@ -742,7 +742,7 @@ void ArrayMesh::_recompute_aabb() { } } -void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<Rect3> &p_bone_aabbs) { +void ArrayMesh::add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes, const Vector<AABB> &p_bone_aabbs) { Surface s; s.aabb = p_aabb; @@ -772,7 +772,7 @@ void ArrayMesh::add_surface_from_arrays(PrimitiveType p_primitive, const Array & const Vector3 *vtx = r.ptr(); // check AABB - Rect3 aabb; + AABB aabb; for (int i = 0; i < len; i++) { if (i == 0) @@ -926,7 +926,7 @@ void ArrayMesh::surface_update_region(int p_surface, int p_offset, const PoolVec VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data); } -void ArrayMesh::surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb) { +void ArrayMesh::surface_set_custom_aabb(int p_idx, const AABB &p_aabb) { ERR_FAIL_INDEX(p_idx, surfaces.size()); surfaces[p_idx].aabb = p_aabb; @@ -942,7 +942,7 @@ Ref<Material> ArrayMesh::surface_get_material(int p_idx) const { void ArrayMesh::add_surface_from_mesh_data(const Geometry::MeshData &p_mesh_data) { VisualServer::get_singleton()->mesh_add_surface_from_mesh_data(mesh, p_mesh_data); - Rect3 aabb; + AABB aabb; for (int i = 0; i < p_mesh_data.vertices.size(); i++) { if (i == 0) @@ -970,18 +970,18 @@ RID ArrayMesh::get_rid() const { return mesh; } -Rect3 ArrayMesh::get_aabb() const { +AABB ArrayMesh::get_aabb() const { return aabb; } -void ArrayMesh::set_custom_aabb(const Rect3 &p_custom) { +void ArrayMesh::set_custom_aabb(const AABB &p_custom) { custom_aabb = p_custom; VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb); } -Rect3 ArrayMesh::get_custom_aabb() const { +AABB ArrayMesh::get_custom_aabb() const { return custom_aabb; } diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index 75927079c7..b85a6a84af 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -136,7 +136,7 @@ public: Ref<Mesh> create_outline(float p_margin) const; - virtual Rect3 get_aabb() const = 0; + virtual AABB get_aabb() const = 0; Mesh(); }; @@ -149,16 +149,16 @@ class ArrayMesh : public Mesh { private: struct Surface { String name; - Rect3 aabb; + AABB aabb; Ref<Material> material; bool is_2d; }; Vector<Surface> surfaces; RID mesh; - Rect3 aabb; + AABB aabb; BlendShapeMode blend_shape_mode; Vector<StringName> blend_shapes; - Rect3 custom_aabb; + AABB custom_aabb; void _recompute_aabb(); @@ -173,7 +173,7 @@ protected: public: void add_surface_from_arrays(PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), uint32_t p_flags = ARRAY_COMPRESS_DEFAULT); - void add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>()); + void add_surface(uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const AABB &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<AABB> &p_bone_aabbs = Vector<AABB>()); Array surface_get_arrays(int p_surface) const; Array surface_get_blend_shape_arrays(int p_surface) const; @@ -191,7 +191,7 @@ public: int get_surface_count() const; void surface_remove(int p_idx); - void surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb); //only recognized by driver + void surface_set_custom_aabb(int p_idx, const AABB &p_aabb); //only recognized by driver int surface_get_array_len(int p_idx) const; int surface_get_array_index_len(int p_idx) const; @@ -207,10 +207,10 @@ public: void add_surface_from_mesh_data(const Geometry::MeshData &p_mesh_data); - void set_custom_aabb(const Rect3 &p_custom); - Rect3 get_custom_aabb() const; + void set_custom_aabb(const AABB &p_custom); + AABB get_custom_aabb() const; - Rect3 get_aabb() const; + AABB get_aabb() const; virtual RID get_rid() const; void center_geometry(); diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp index 15f1e15542..ee6efa6e85 100644 --- a/scene/resources/multimesh.cpp +++ b/scene/resources/multimesh.cpp @@ -155,7 +155,7 @@ Color MultiMesh::get_instance_color(int p_instance) const { return VisualServer::get_singleton()->multimesh_instance_get_color(multimesh, p_instance); } -Rect3 MultiMesh::get_aabb() const { +AABB MultiMesh::get_aabb() const { return VisualServer::get_singleton()->multimesh_get_aabb(multimesh); } diff --git a/scene/resources/multimesh.h b/scene/resources/multimesh.h index 7ca66b0b46..0a5310f641 100644 --- a/scene/resources/multimesh.h +++ b/scene/resources/multimesh.h @@ -84,7 +84,7 @@ public: void set_instance_color(int p_instance, const Color &p_color); Color get_instance_color(int p_instance) const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual RID get_rid() const; diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 8e3899315c..3b80db291c 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -42,7 +42,7 @@ void PrimitiveMesh::_update() const { PoolVector<Vector3> points = arr[VS::ARRAY_VERTEX]; - aabb = Rect3(); + aabb = AABB(); int pc = points.size(); ERR_FAIL_COND(pc == 0); @@ -141,7 +141,7 @@ StringName PrimitiveMesh::get_blend_shape_name(int p_index) const { return StringName(); } -Rect3 PrimitiveMesh::get_aabb() const { +AABB PrimitiveMesh::get_aabb() const { if (pending_request) { _update(); } diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h index f0c8935261..b38c247827 100644 --- a/scene/resources/primitive_meshes.h +++ b/scene/resources/primitive_meshes.h @@ -47,7 +47,7 @@ class PrimitiveMesh : public Mesh { private: RID mesh; - mutable Rect3 aabb; + mutable AABB aabb; Ref<Material> material; @@ -73,7 +73,7 @@ public: virtual Ref<Material> surface_get_material(int p_idx) const; virtual int get_blend_shape_count() const; virtual StringName get_blend_shape_name(int p_index) const; - virtual Rect3 get_aabb() const; + virtual AABB get_aabb() const; virtual RID get_rid() const; void set_material(const Ref<Material> &p_material); diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index f0304bfaa5..fe23fbf6b3 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -33,7 +33,7 @@ #include "project_settings.h" #include "version.h" -//version 2: changed names for basis, rect3, poolvectors, etc. +//version 2: changed names for basis, aabb, poolvectors, etc. #define FORMAT_VERSION 2 #include "os/dir_access.h" diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index af159975ca..86b32a5cdd 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -41,7 +41,7 @@ struct SpatialIndexer { struct NotifierData { - Rect3 aabb; + AABB aabb; OctreeElementID id; }; @@ -63,7 +63,7 @@ struct SpatialIndexer { uint64_t pass; uint64_t last_frame; - void _notifier_add(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { + void _notifier_add(VisibilityNotifier *p_notifier, const AABB &p_rect) { ERR_FAIL_COND(notifiers.has(p_notifier)); notifiers[p_notifier].aabb = p_rect; @@ -71,7 +71,7 @@ struct SpatialIndexer { changed = true; } - void _notifier_update(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { + void _notifier_update(VisibilityNotifier *p_notifier, const AABB &p_rect) { Map<VisibilityNotifier *, NotifierData>::Element *E = notifiers.find(p_notifier); ERR_FAIL_COND(!E); @@ -229,14 +229,14 @@ void World::_remove_camera(Camera *p_camera) { #endif } -void World::_register_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { +void World::_register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { #ifndef _3D_DISABLED indexer->_notifier_add(p_notifier, p_rect); #endif } -void World::_update_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect) { +void World::_update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { #ifndef _3D_DISABLED indexer->_notifier_update(p_notifier, p_rect); diff --git a/scene/resources/world.h b/scene/resources/world.h index 767d1b5b6e..e0f1de1fd0 100644 --- a/scene/resources/world.h +++ b/scene/resources/world.h @@ -60,8 +60,8 @@ protected: void _update_camera(Camera *p_camera); void _remove_camera(Camera *p_camera); - void _register_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect); - void _update_notifier(VisibilityNotifier *p_notifier, const Rect3 &p_rect); + void _register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect); + void _update_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect); void _remove_notifier(VisibilityNotifier *p_notifier); friend class Viewport; void _update(uint64_t p_frame); |