diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/box_shape_3d.cpp (renamed from scene/resources/box_shape.cpp) | 26 | ||||
-rw-r--r-- | scene/resources/box_shape_3d.h (renamed from scene/resources/box_shape.h) | 10 | ||||
-rw-r--r-- | scene/resources/capsule_shape_3d.cpp (renamed from scene/resources/capsule_shape.cpp) | 34 | ||||
-rw-r--r-- | scene/resources/capsule_shape_3d.h (renamed from scene/resources/capsule_shape.h) | 10 | ||||
-rw-r--r-- | scene/resources/concave_polygon_shape_3d.cpp (renamed from scene/resources/concave_polygon_shape.cpp) | 26 | ||||
-rw-r--r-- | scene/resources/concave_polygon_shape_3d.h (renamed from scene/resources/concave_polygon_shape.h) | 14 | ||||
-rw-r--r-- | scene/resources/convex_polygon_shape_3d.cpp (renamed from scene/resources/convex_polygon_shape.cpp) | 26 | ||||
-rw-r--r-- | scene/resources/convex_polygon_shape_3d.h (renamed from scene/resources/convex_polygon_shape.h) | 10 | ||||
-rw-r--r-- | scene/resources/cylinder_shape_3d.cpp (renamed from scene/resources/cylinder_shape.cpp) | 34 | ||||
-rw-r--r-- | scene/resources/cylinder_shape_3d.h (renamed from scene/resources/cylinder_shape.h) | 14 | ||||
-rw-r--r-- | scene/resources/height_map_shape_3d.cpp (renamed from scene/resources/height_map_shape.cpp) | 42 | ||||
-rw-r--r-- | scene/resources/height_map_shape_3d.h (renamed from scene/resources/height_map_shape.h) | 10 | ||||
-rw-r--r-- | scene/resources/mesh.cpp | 24 | ||||
-rw-r--r-- | scene/resources/mesh.h | 8 | ||||
-rw-r--r-- | scene/resources/mesh_library.h | 6 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 6 | ||||
-rw-r--r-- | scene/resources/ray_shape_3d.cpp (renamed from scene/resources/ray_shape.cpp) | 34 | ||||
-rw-r--r-- | scene/resources/ray_shape_3d.h (renamed from scene/resources/ray_shape.h) | 10 | ||||
-rw-r--r-- | scene/resources/shape_3d.cpp (renamed from scene/resources/shape.cpp) | 26 | ||||
-rw-r--r-- | scene/resources/shape_3d.h (renamed from scene/resources/shape.h) | 18 | ||||
-rw-r--r-- | scene/resources/sphere_shape_3d.cpp (renamed from scene/resources/sphere_shape.cpp) | 26 | ||||
-rw-r--r-- | scene/resources/sphere_shape_3d.h (renamed from scene/resources/sphere_shape.h) | 14 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 3 | ||||
-rw-r--r-- | scene/resources/tile_set.h | 2 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 2 | ||||
-rw-r--r-- | scene/resources/world_3d.cpp (renamed from scene/resources/world.cpp) | 122 | ||||
-rw-r--r-- | scene/resources/world_3d.h (renamed from scene/resources/world.h) | 39 | ||||
-rw-r--r-- | scene/resources/world_margin_shape_3d.cpp (renamed from scene/resources/world_margin_shape.cpp) | 24 | ||||
-rw-r--r-- | scene/resources/world_margin_shape_3d.h (renamed from scene/resources/world_margin_shape.h) | 14 |
29 files changed, 317 insertions, 317 deletions
diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape_3d.cpp index e1f485bae6..3ac29642d7 100644 --- a/scene/resources/box_shape.cpp +++ b/scene/resources/box_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* box_shape.cpp */ +/* box_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "box_shape.h" +#include "box_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> BoxShape::get_debug_mesh_lines() { +Vector<Vector3> BoxShape3D::get_debug_mesh_lines() { Vector<Vector3> lines; AABB aabb; @@ -48,17 +48,17 @@ Vector<Vector3> BoxShape::get_debug_mesh_lines() { return lines; } -real_t BoxShape::get_enclosing_radius() const { +real_t BoxShape3D::get_enclosing_radius() const { return extents.length(); } -void BoxShape::_update_shape() { +void BoxShape3D::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), extents); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void BoxShape::set_extents(const Vector3 &p_extents) { +void BoxShape3D::set_extents(const Vector3 &p_extents) { extents = p_extents; _update_shape(); @@ -66,21 +66,21 @@ void BoxShape::set_extents(const Vector3 &p_extents) { _change_notify("extents"); } -Vector3 BoxShape::get_extents() const { +Vector3 BoxShape3D::get_extents() const { return extents; } -void BoxShape::_bind_methods() { +void BoxShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_extents", "extents"), &BoxShape::set_extents); - ClassDB::bind_method(D_METHOD("get_extents"), &BoxShape::get_extents); + ClassDB::bind_method(D_METHOD("set_extents", "extents"), &BoxShape3D::set_extents); + ClassDB::bind_method(D_METHOD("get_extents"), &BoxShape3D::get_extents); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents"), "set_extents", "get_extents"); } -BoxShape::BoxShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_BOX)) { +BoxShape3D::BoxShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_BOX)) { set_extents(Vector3(1, 1, 1)); } diff --git a/scene/resources/box_shape.h b/scene/resources/box_shape_3d.h index fb164cc300..a93fd8d33a 100644 --- a/scene/resources/box_shape.h +++ b/scene/resources/box_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* box_shape.h */ +/* box_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,11 +31,11 @@ #ifndef BOX_SHAPE_H #define BOX_SHAPE_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class BoxShape : public Shape { +class BoxShape3D : public Shape3D { - GDCLASS(BoxShape, Shape); + GDCLASS(BoxShape3D, Shape3D); Vector3 extents; protected: @@ -50,7 +50,7 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - BoxShape(); + BoxShape3D(); }; #endif // BOX_SHAPE_H diff --git a/scene/resources/capsule_shape.cpp b/scene/resources/capsule_shape_3d.cpp index dddbd7fef3..a929caa275 100644 --- a/scene/resources/capsule_shape.cpp +++ b/scene/resources/capsule_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* capsule_shape.cpp */ +/* capsule_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "capsule_shape.h" +#include "capsule_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> CapsuleShape::get_debug_mesh_lines() { +Vector<Vector3> CapsuleShape3D::get_debug_mesh_lines() { float radius = get_radius(); float height = get_height(); @@ -69,20 +69,20 @@ Vector<Vector3> CapsuleShape::get_debug_mesh_lines() { return points; } -real_t CapsuleShape::get_enclosing_radius() const { +real_t CapsuleShape3D::get_enclosing_radius() const { return radius + height * 0.5; } -void CapsuleShape::_update_shape() { +void CapsuleShape3D::_update_shape() { Dictionary d; d["radius"] = radius; d["height"] = height; PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void CapsuleShape::set_radius(float p_radius) { +void CapsuleShape3D::set_radius(float p_radius) { radius = p_radius; _update_shape(); @@ -90,12 +90,12 @@ void CapsuleShape::set_radius(float p_radius) { _change_notify("radius"); } -float CapsuleShape::get_radius() const { +float CapsuleShape3D::get_radius() const { return radius; } -void CapsuleShape::set_height(float p_height) { +void CapsuleShape3D::set_height(float p_height) { height = p_height; _update_shape(); @@ -103,24 +103,24 @@ void CapsuleShape::set_height(float p_height) { _change_notify("height"); } -float CapsuleShape::get_height() const { +float CapsuleShape3D::get_height() const { return height; } -void CapsuleShape::_bind_methods() { +void CapsuleShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CapsuleShape::set_radius); - ClassDB::bind_method(D_METHOD("get_radius"), &CapsuleShape::get_radius); - ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape::set_height); - ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape::get_height); + ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CapsuleShape3D::set_radius); + ClassDB::bind_method(D_METHOD("get_radius"), &CapsuleShape3D::get_radius); + ClassDB::bind_method(D_METHOD("set_height", "height"), &CapsuleShape3D::set_height); + ClassDB::bind_method(D_METHOD("get_height"), &CapsuleShape3D::get_height); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height"); } -CapsuleShape::CapsuleShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CAPSULE)) { +CapsuleShape3D::CapsuleShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CAPSULE)) { radius = 1.0; height = 1.0; diff --git a/scene/resources/capsule_shape.h b/scene/resources/capsule_shape_3d.h index f097e51175..dca7a6c983 100644 --- a/scene/resources/capsule_shape.h +++ b/scene/resources/capsule_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* capsule_shape.h */ +/* capsule_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,11 +31,11 @@ #ifndef CAPSULE_SHAPE_H #define CAPSULE_SHAPE_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class CapsuleShape : public Shape { +class CapsuleShape3D : public Shape3D { - GDCLASS(CapsuleShape, Shape); + GDCLASS(CapsuleShape3D, Shape3D); float radius; float height; @@ -53,7 +53,7 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - CapsuleShape(); + CapsuleShape3D(); }; #endif // CAPSULE_SHAPE_H diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape_3d.cpp index fe123a2df7..6be4a087ad 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* concave_polygon_shape.cpp */ +/* concave_polygon_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "concave_polygon_shape.h" +#include "concave_polygon_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() { +Vector<Vector3> ConcavePolygonShape3D::get_debug_mesh_lines() { Set<DrawEdge> edges; @@ -64,7 +64,7 @@ Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() { return points; } -real_t ConcavePolygonShape::get_enclosing_radius() const { +real_t ConcavePolygonShape3D::get_enclosing_radius() const { Vector<Vector3> data = get_faces(); const Vector3 *read = data.ptr(); real_t r = 0; @@ -74,30 +74,30 @@ real_t ConcavePolygonShape::get_enclosing_radius() const { return Math::sqrt(r); } -void ConcavePolygonShape::_update_shape() { - Shape::_update_shape(); +void ConcavePolygonShape3D::_update_shape() { + Shape3D::_update_shape(); } -void ConcavePolygonShape::set_faces(const Vector<Vector3> &p_faces) { +void ConcavePolygonShape3D::set_faces(const Vector<Vector3> &p_faces) { PhysicsServer::get_singleton()->shape_set_data(get_shape(), p_faces); notify_change_to_owners(); } -Vector<Vector3> ConcavePolygonShape::get_faces() const { +Vector<Vector3> ConcavePolygonShape3D::get_faces() const { return PhysicsServer::get_singleton()->shape_get_data(get_shape()); } -void ConcavePolygonShape::_bind_methods() { +void ConcavePolygonShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_faces", "faces"), &ConcavePolygonShape::set_faces); - ClassDB::bind_method(D_METHOD("get_faces"), &ConcavePolygonShape::get_faces); + ClassDB::bind_method(D_METHOD("set_faces", "faces"), &ConcavePolygonShape3D::set_faces); + ClassDB::bind_method(D_METHOD("get_faces"), &ConcavePolygonShape3D::get_faces); ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_faces", "get_faces"); } -ConcavePolygonShape::ConcavePolygonShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CONCAVE_POLYGON)) { +ConcavePolygonShape3D::ConcavePolygonShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CONCAVE_POLYGON)) { //set_planes(Vector3(1,1,1)); } diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape_3d.h index 63aabb27d7..b4e96c662f 100644 --- a/scene/resources/concave_polygon_shape.h +++ b/scene/resources/concave_polygon_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* concave_polygon_shape.h */ +/* concave_polygon_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CONCAVE_POLYGON_SHAPE_H -#define CONCAVE_POLYGON_SHAPE_H +#ifndef CONCAVE_POLYGON_SHAPE_3D_H +#define CONCAVE_POLYGON_SHAPE_3D_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class ConcavePolygonShape : public Shape { +class ConcavePolygonShape3D : public Shape3D { - GDCLASS(ConcavePolygonShape, Shape); + GDCLASS(ConcavePolygonShape3D, Shape3D); struct DrawEdge { @@ -69,7 +69,7 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - ConcavePolygonShape(); + ConcavePolygonShape3D(); }; #endif // CONCAVE_POLYGON_SHAPE_H diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape_3d.cpp index b7463605b4..e25301b2eb 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* convex_polygon_shape.cpp */ +/* convex_polygon_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "convex_polygon_shape.h" +#include "convex_polygon_shape_3d.h" #include "core/math/quick_hull.h" #include "servers/physics_server.h" -Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() { +Vector<Vector3> ConvexPolygonShape3D::get_debug_mesh_lines() { Vector<Vector3> points = get_points(); @@ -55,7 +55,7 @@ Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() { return Vector<Vector3>(); } -real_t ConvexPolygonShape::get_enclosing_radius() const { +real_t ConvexPolygonShape3D::get_enclosing_radius() const { Vector<Vector3> data = get_points(); const Vector3 *read = data.ptr(); real_t r = 0; @@ -65,32 +65,32 @@ real_t ConvexPolygonShape::get_enclosing_radius() const { return Math::sqrt(r); } -void ConvexPolygonShape::_update_shape() { +void ConvexPolygonShape3D::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), points); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void ConvexPolygonShape::set_points(const Vector<Vector3> &p_points) { +void ConvexPolygonShape3D::set_points(const Vector<Vector3> &p_points) { points = p_points; _update_shape(); notify_change_to_owners(); } -Vector<Vector3> ConvexPolygonShape::get_points() const { +Vector<Vector3> ConvexPolygonShape3D::get_points() const { return points; } -void ConvexPolygonShape::_bind_methods() { +void ConvexPolygonShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_points", "points"), &ConvexPolygonShape::set_points); - ClassDB::bind_method(D_METHOD("get_points"), &ConvexPolygonShape::get_points); + ClassDB::bind_method(D_METHOD("set_points", "points"), &ConvexPolygonShape3D::set_points); + ClassDB::bind_method(D_METHOD("get_points"), &ConvexPolygonShape3D::get_points); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "points"), "set_points", "get_points"); } -ConvexPolygonShape::ConvexPolygonShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON)) { +ConvexPolygonShape3D::ConvexPolygonShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CONVEX_POLYGON)) { } diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape_3d.h index fcd733887e..51e4c8eb0b 100644 --- a/scene/resources/convex_polygon_shape.h +++ b/scene/resources/convex_polygon_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* convex_polygon_shape.h */ +/* convex_polygon_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,11 +31,11 @@ #ifndef CONVEX_POLYGON_SHAPE_H #define CONVEX_POLYGON_SHAPE_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class ConvexPolygonShape : public Shape { +class ConvexPolygonShape3D : public Shape3D { - GDCLASS(ConvexPolygonShape, Shape); + GDCLASS(ConvexPolygonShape3D, Shape3D); Vector<Vector3> points; protected: @@ -50,7 +50,7 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - ConvexPolygonShape(); + ConvexPolygonShape3D(); }; #endif // CONVEX_POLYGON_SHAPE_H diff --git a/scene/resources/cylinder_shape.cpp b/scene/resources/cylinder_shape_3d.cpp index 53d368d32a..7636c55346 100644 --- a/scene/resources/cylinder_shape.cpp +++ b/scene/resources/cylinder_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* cylinder_shape.cpp */ +/* cylinder_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "cylinder_shape.h" +#include "cylinder_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> CylinderShape::get_debug_mesh_lines() { +Vector<Vector3> CylinderShape3D::get_debug_mesh_lines() { float radius = get_radius(); float height = get_height(); @@ -62,20 +62,20 @@ Vector<Vector3> CylinderShape::get_debug_mesh_lines() { return points; } -real_t CylinderShape::get_enclosing_radius() const { +real_t CylinderShape3D::get_enclosing_radius() const { return Vector2(radius, height * 0.5).length(); } -void CylinderShape::_update_shape() { +void CylinderShape3D::_update_shape() { Dictionary d; d["radius"] = radius; d["height"] = height; PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void CylinderShape::set_radius(float p_radius) { +void CylinderShape3D::set_radius(float p_radius) { radius = p_radius; _update_shape(); @@ -83,12 +83,12 @@ void CylinderShape::set_radius(float p_radius) { _change_notify("radius"); } -float CylinderShape::get_radius() const { +float CylinderShape3D::get_radius() const { return radius; } -void CylinderShape::set_height(float p_height) { +void CylinderShape3D::set_height(float p_height) { height = p_height; _update_shape(); @@ -96,24 +96,24 @@ void CylinderShape::set_height(float p_height) { _change_notify("height"); } -float CylinderShape::get_height() const { +float CylinderShape3D::get_height() const { return height; } -void CylinderShape::_bind_methods() { +void CylinderShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CylinderShape::set_radius); - ClassDB::bind_method(D_METHOD("get_radius"), &CylinderShape::get_radius); - ClassDB::bind_method(D_METHOD("set_height", "height"), &CylinderShape::set_height); - ClassDB::bind_method(D_METHOD("get_height"), &CylinderShape::get_height); + ClassDB::bind_method(D_METHOD("set_radius", "radius"), &CylinderShape3D::set_radius); + ClassDB::bind_method(D_METHOD("get_radius"), &CylinderShape3D::get_radius); + ClassDB::bind_method(D_METHOD("set_height", "height"), &CylinderShape3D::set_height); + ClassDB::bind_method(D_METHOD("get_height"), &CylinderShape3D::get_height); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_radius", "get_radius"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_RANGE, "0.01,4096,0.01"), "set_height", "get_height"); } -CylinderShape::CylinderShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CYLINDER)) { +CylinderShape3D::CylinderShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_CYLINDER)) { radius = 1.0; height = 2.0; diff --git a/scene/resources/cylinder_shape.h b/scene/resources/cylinder_shape_3d.h index a26fda10cd..7b37f733e0 100644 --- a/scene/resources/cylinder_shape.h +++ b/scene/resources/cylinder_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* cylinder_shape.h */ +/* cylinder_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef CYLINDER_SHAPE_H -#define CYLINDER_SHAPE_H +#ifndef CYLINDER_SHAPE_3D_H +#define CYLINDER_SHAPE_3D_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class CylinderShape : public Shape { +class CylinderShape3D : public Shape3D { - GDCLASS(CylinderShape, Shape); + GDCLASS(CylinderShape3D, Shape3D); float radius; float height; @@ -52,7 +52,7 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - CylinderShape(); + CylinderShape3D(); }; #endif // CYLINDER_SHAPE_H diff --git a/scene/resources/height_map_shape.cpp b/scene/resources/height_map_shape_3d.cpp index fa45ddcabb..85c081238d 100644 --- a/scene/resources/height_map_shape.cpp +++ b/scene/resources/height_map_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* height_map_shape.cpp */ +/* height_map_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "height_map_shape.h" +#include "height_map_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> HeightMapShape::get_debug_mesh_lines() { +Vector<Vector3> HeightMapShape3D::get_debug_mesh_lines() { Vector<Vector3> points; if ((map_width != 0) && (map_depth != 0)) { @@ -76,11 +76,11 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() { return points; } -real_t HeightMapShape::get_enclosing_radius() const { +real_t HeightMapShape3D::get_enclosing_radius() const { return Vector3(real_t(map_width), max_height - min_height, real_t(map_depth)).length(); } -void HeightMapShape::_update_shape() { +void HeightMapShape3D::_update_shape() { Dictionary d; d["width"] = map_width; @@ -89,10 +89,10 @@ void HeightMapShape::_update_shape() { d["min_height"] = min_height; d["max_height"] = max_height; PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void HeightMapShape::set_map_width(int p_new) { +void HeightMapShape3D::set_map_width(int p_new) { if (p_new < 1) { // ignore } else if (map_width != p_new) { @@ -114,11 +114,11 @@ void HeightMapShape::set_map_width(int p_new) { } } -int HeightMapShape::get_map_width() const { +int HeightMapShape3D::get_map_width() const { return map_width; } -void HeightMapShape::set_map_depth(int p_new) { +void HeightMapShape3D::set_map_depth(int p_new) { if (p_new < 1) { // ignore } else if (map_depth != p_new) { @@ -140,11 +140,11 @@ void HeightMapShape::set_map_depth(int p_new) { } } -int HeightMapShape::get_map_depth() const { +int HeightMapShape3D::get_map_depth() const { return map_depth; } -void HeightMapShape::set_map_data(PackedFloat32Array p_new) { +void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) { int size = (map_width * map_depth); if (p_new.size() != size) { // fail @@ -174,25 +174,25 @@ void HeightMapShape::set_map_data(PackedFloat32Array p_new) { _change_notify("map_data"); } -PackedFloat32Array HeightMapShape::get_map_data() const { +PackedFloat32Array HeightMapShape3D::get_map_data() const { return map_data; } -void HeightMapShape::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape::set_map_width); - ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape::get_map_width); - ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape::set_map_depth); - ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape::get_map_depth); - ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape::set_map_data); - ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape::get_map_data); +void HeightMapShape3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_map_width", "width"), &HeightMapShape3D::set_map_width); + ClassDB::bind_method(D_METHOD("get_map_width"), &HeightMapShape3D::get_map_width); + ClassDB::bind_method(D_METHOD("set_map_depth", "height"), &HeightMapShape3D::set_map_depth); + ClassDB::bind_method(D_METHOD("get_map_depth"), &HeightMapShape3D::get_map_depth); + ClassDB::bind_method(D_METHOD("set_map_data", "data"), &HeightMapShape3D::set_map_data); + ClassDB::bind_method(D_METHOD("get_map_data"), &HeightMapShape3D::get_map_data); ADD_PROPERTY(PropertyInfo(Variant::INT, "map_width", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_width", "get_map_width"); ADD_PROPERTY(PropertyInfo(Variant::INT, "map_depth", PROPERTY_HINT_RANGE, "1,4096,1"), "set_map_depth", "get_map_depth"); ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "map_data"), "set_map_data", "get_map_data"); } -HeightMapShape::HeightMapShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_HEIGHTMAP)) { +HeightMapShape3D::HeightMapShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_HEIGHTMAP)) { map_width = 2; map_depth = 2; diff --git a/scene/resources/height_map_shape.h b/scene/resources/height_map_shape_3d.h index b8204f6c98..291d41a34e 100644 --- a/scene/resources/height_map_shape.h +++ b/scene/resources/height_map_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* height_map_shape.h */ +/* height_map_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,10 +31,10 @@ #ifndef HEIGHT_MAP_SHAPE_H #define HEIGHT_MAP_SHAPE_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class HeightMapShape : public Shape { - GDCLASS(HeightMapShape, Shape); +class HeightMapShape3D : public Shape3D { + GDCLASS(HeightMapShape3D, Shape3D); int map_width; int map_depth; @@ -57,7 +57,7 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - HeightMapShape(); + HeightMapShape3D(); }; #endif /* !HEIGHT_MAP_SHAPE_H */ diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 9f3433be0f..0d32fdb0fa 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -31,8 +31,8 @@ #include "mesh.h" #include "core/pair.h" -#include "scene/resources/concave_polygon_shape.h" -#include "scene/resources/convex_polygon_shape.h" +#include "scene/resources/concave_polygon_shape_3d.h" +#include "scene/resources/convex_polygon_shape_3d.h" #include "surface_tool.h" #include <stdlib.h> @@ -226,28 +226,28 @@ Vector<Face3> Mesh::get_faces() const { */ } -Ref<Shape> Mesh::create_convex_shape() const { +Ref<Shape3D> Mesh::create_convex_shape() const { Vector<Vector3> vertices; for (int i = 0; i < get_surface_count(); i++) { Array a = surface_get_arrays(i); - ERR_FAIL_COND_V(a.empty(), Ref<ConvexPolygonShape>()); + ERR_FAIL_COND_V(a.empty(), Ref<ConvexPolygonShape3D>()); Vector<Vector3> v = a[ARRAY_VERTEX]; vertices.append_array(v); } - Ref<ConvexPolygonShape> shape = memnew(ConvexPolygonShape); + Ref<ConvexPolygonShape3D> shape = memnew(ConvexPolygonShape3D); shape->set_points(vertices); return shape; } -Ref<Shape> Mesh::create_trimesh_shape() const { +Ref<Shape3D> Mesh::create_trimesh_shape() const { Vector<Face3> faces = get_faces(); if (faces.size() == 0) - return Ref<Shape>(); + return Ref<Shape3D>(); Vector<Vector3> face_points; face_points.resize(faces.size() * 3); @@ -260,7 +260,7 @@ Ref<Shape> Mesh::create_trimesh_shape() const { face_points.set(i + 2, f.vertex[2]); } - Ref<ConcavePolygonShape> shape = memnew(ConcavePolygonShape); + Ref<ConcavePolygonShape3D> shape = memnew(ConcavePolygonShape3D); shape->set_faces(face_points); return shape; } @@ -541,15 +541,15 @@ void Mesh::clear_cache() const { debug_lines.clear(); } -Vector<Ref<Shape>> Mesh::convex_decompose() const { +Vector<Ref<Shape3D>> Mesh::convex_decompose() const { - ERR_FAIL_COND_V(!convex_composition_function, Vector<Ref<Shape>>()); + ERR_FAIL_COND_V(!convex_composition_function, Vector<Ref<Shape3D>>()); const Vector<Face3> faces = get_faces(); Vector<Vector<Face3>> decomposed = convex_composition_function(faces); - Vector<Ref<Shape>> ret; + Vector<Ref<Shape3D>> ret; for (int i = 0; i < decomposed.size(); i++) { Set<Vector3> points; @@ -569,7 +569,7 @@ Vector<Ref<Shape>> Mesh::convex_decompose() const { } } - Ref<ConvexPolygonShape> shape; + Ref<ConvexPolygonShape3D> shape; shape.instance(); shape->set_points(convex_points); ret.push_back(shape); diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h index e0cc214301..e5f87dbbe5 100644 --- a/scene/resources/mesh.h +++ b/scene/resources/mesh.h @@ -35,7 +35,7 @@ #include "core/math/triangle_mesh.h" #include "core/resource.h" #include "scene/resources/material.h" -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" #include "servers/visual_server.h" class Mesh : public Resource { @@ -131,8 +131,8 @@ public: void generate_debug_mesh_lines(Vector<Vector3> &r_lines); void generate_debug_mesh_indices(Vector<Vector3> &r_points); - Ref<Shape> create_trimesh_shape() const; - Ref<Shape> create_convex_shape() const; + Ref<Shape3D> create_trimesh_shape() const; + Ref<Shape3D> create_convex_shape() const; Ref<Mesh> create_outline(float p_margin) const; @@ -146,7 +146,7 @@ public: static ConvexDecompositionFunc convex_composition_function; - Vector<Ref<Shape>> convex_decompose() const; + Vector<Ref<Shape3D>> convex_decompose() const; Mesh(); }; diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h index b256e86b96..55001f2545 100644 --- a/scene/resources/mesh_library.h +++ b/scene/resources/mesh_library.h @@ -34,8 +34,8 @@ #include "core/map.h" #include "core/resource.h" #include "mesh.h" -#include "scene/3d/navigation_region.h" -#include "shape.h" +#include "scene/3d/navigation_region_3d.h" +#include "shape_3d.h" class MeshLibrary : public Resource { @@ -44,7 +44,7 @@ class MeshLibrary : public Resource { public: struct ShapeData { - Ref<Shape> shape; + Ref<Shape3D> shape; Transform local_transform; }; struct Item { diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 7059682904..549c29a7f3 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -35,7 +35,7 @@ #include "core/io/resource_loader.h" #include "core/project_settings.h" #include "scene/2d/node_2d.h" -#include "scene/3d/spatial.h" +#include "scene/3d/node_3d.h" #include "scene/gui/control.h" #include "scene/main/instance_placeholder.h" @@ -159,8 +159,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } WARN_PRINT(String("Warning node of type " + snames[n.type].operator String() + " does not exist.").ascii().get_data()); if (n.parent >= 0 && n.parent < nc && ret_nodes[n.parent]) { - if (Object::cast_to<Spatial>(ret_nodes[n.parent])) { - obj = memnew(Spatial); + if (Object::cast_to<Node3D>(ret_nodes[n.parent])) { + obj = memnew(Node3D); } else if (Object::cast_to<Control>(ret_nodes[n.parent])) { obj = memnew(Control); } else if (Object::cast_to<Node2D>(ret_nodes[n.parent])) { diff --git a/scene/resources/ray_shape.cpp b/scene/resources/ray_shape_3d.cpp index 906abaf60c..ad927afd58 100644 --- a/scene/resources/ray_shape.cpp +++ b/scene/resources/ray_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* ray_shape.cpp */ +/* ray_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "ray_shape.h" +#include "ray_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> RayShape::get_debug_mesh_lines() { +Vector<Vector3> RayShape3D::get_debug_mesh_lines() { Vector<Vector3> points; points.push_back(Vector3()); @@ -41,20 +41,20 @@ Vector<Vector3> RayShape::get_debug_mesh_lines() { return points; } -real_t RayShape::get_enclosing_radius() const { +real_t RayShape3D::get_enclosing_radius() const { return length; } -void RayShape::_update_shape() { +void RayShape3D::_update_shape() { Dictionary d; d["length"] = length; d["slips_on_slope"] = slips_on_slope; PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void RayShape::set_length(float p_length) { +void RayShape3D::set_length(float p_length) { length = p_length; _update_shape(); @@ -62,12 +62,12 @@ void RayShape::set_length(float p_length) { _change_notify("length"); } -float RayShape::get_length() const { +float RayShape3D::get_length() const { return length; } -void RayShape::set_slips_on_slope(bool p_active) { +void RayShape3D::set_slips_on_slope(bool p_active) { slips_on_slope = p_active; _update_shape(); @@ -75,24 +75,24 @@ void RayShape::set_slips_on_slope(bool p_active) { _change_notify("slips_on_slope"); } -bool RayShape::get_slips_on_slope() const { +bool RayShape3D::get_slips_on_slope() const { return slips_on_slope; } -void RayShape::_bind_methods() { +void RayShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_length", "length"), &RayShape::set_length); - ClassDB::bind_method(D_METHOD("get_length"), &RayShape::get_length); + ClassDB::bind_method(D_METHOD("set_length", "length"), &RayShape3D::set_length); + ClassDB::bind_method(D_METHOD("get_length"), &RayShape3D::get_length); - ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape::set_slips_on_slope); - ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape::get_slips_on_slope); + ClassDB::bind_method(D_METHOD("set_slips_on_slope", "active"), &RayShape3D::set_slips_on_slope); + ClassDB::bind_method(D_METHOD("get_slips_on_slope"), &RayShape3D::get_slips_on_slope); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_length", "get_length"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slips_on_slope"), "set_slips_on_slope", "get_slips_on_slope"); } -RayShape::RayShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_RAY)) { +RayShape3D::RayShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_RAY)) { length = 1.0; slips_on_slope = false; diff --git a/scene/resources/ray_shape.h b/scene/resources/ray_shape_3d.h index c89705ad7d..83bb71cca3 100644 --- a/scene/resources/ray_shape.h +++ b/scene/resources/ray_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* ray_shape.h */ +/* ray_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -30,11 +30,11 @@ #ifndef RAY_SHAPE_H #define RAY_SHAPE_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class RayShape : public Shape { +class RayShape3D : public Shape3D { - GDCLASS(RayShape, Shape); + GDCLASS(RayShape3D, Shape3D); float length; bool slips_on_slope; @@ -52,6 +52,6 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - RayShape(); + RayShape3D(); }; #endif // RAY_SHAPE_H diff --git a/scene/resources/shape.cpp b/scene/resources/shape_3d.cpp index 4a6da18f2b..c3aeba857a 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* shape.cpp */ +/* shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "shape.h" +#include "shape_3d.h" #include "core/os/os.h" #include "scene/main/scene_tree.h" #include "scene/resources/mesh.h" #include "servers/physics_server.h" -void Shape::add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xform) { +void Shape3D::add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xform) { Vector<Vector3> toadd = get_debug_mesh_lines(); @@ -50,16 +50,16 @@ void Shape::add_vertices_to_array(Vector<Vector3> &array, const Transform &p_xfo } } -real_t Shape::get_margin() const { +real_t Shape3D::get_margin() const { return margin; } -void Shape::set_margin(real_t p_margin) { +void Shape3D::set_margin(real_t p_margin) { margin = p_margin; PhysicsServer::get_singleton()->shape_set_margin(shape, margin); } -Ref<ArrayMesh> Shape::get_debug_mesh() { +Ref<ArrayMesh> Shape3D::get_debug_mesh() { if (debug_mesh_cache.is_valid()) return debug_mesh_cache; @@ -96,32 +96,32 @@ Ref<ArrayMesh> Shape::get_debug_mesh() { return debug_mesh_cache; } -void Shape::_update_shape() { +void Shape3D::_update_shape() { emit_changed(); debug_mesh_cache.unref(); } -void Shape::_bind_methods() { +void Shape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Shape::set_margin); - ClassDB::bind_method(D_METHOD("get_margin"), &Shape::get_margin); + ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Shape3D::set_margin); + ClassDB::bind_method(D_METHOD("get_margin"), &Shape3D::get_margin); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin"); } -Shape::Shape() : +Shape3D::Shape3D() : margin(0.04) { ERR_PRINT("Constructor must not be called!"); } -Shape::Shape(RID p_shape) : +Shape3D::Shape3D(RID p_shape) : margin(0.04) { shape = p_shape; } -Shape::~Shape() { +Shape3D::~Shape3D() { PhysicsServer::get_singleton()->free(shape); } diff --git a/scene/resources/shape.h b/scene/resources/shape_3d.h index e5ccbf7e28..e7a516412d 100644 --- a/scene/resources/shape.h +++ b/scene/resources/shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* shape.h */ +/* shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,17 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef SHAPE_H -#define SHAPE_H +#ifndef SHAPE_3D_H +#define SHAPE_3D_H #include "core/resource.h" class ArrayMesh; -class Shape : public Resource { +class Shape3D : public Resource { - GDCLASS(Shape, Resource); - OBJ_SAVE_TYPE(Shape); + GDCLASS(Shape3D, Resource); + OBJ_SAVE_TYPE(Shape3D); RES_BASE_EXTENSION("shape"); RID shape; real_t margin; @@ -49,7 +49,7 @@ protected: static void _bind_methods(); _FORCE_INLINE_ RID get_shape() const { return shape; } - Shape(RID p_shape); + Shape3D(RID p_shape); virtual void _update_shape(); @@ -66,8 +66,8 @@ public: real_t get_margin() const; void set_margin(real_t p_margin); - Shape(); - ~Shape(); + Shape3D(); + ~Shape3D(); }; #endif // SHAPE_H diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape_3d.cpp index 825708d1e2..46f7c96ce1 100644 --- a/scene/resources/sphere_shape.cpp +++ b/scene/resources/sphere_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* sphere_shape.cpp */ +/* sphere_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "sphere_shape.h" +#include "sphere_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> SphereShape::get_debug_mesh_lines() { +Vector<Vector3> SphereShape3D::get_debug_mesh_lines() { float r = get_radius(); @@ -55,17 +55,17 @@ Vector<Vector3> SphereShape::get_debug_mesh_lines() { return points; } -real_t SphereShape::get_enclosing_radius() const { +real_t SphereShape3D::get_enclosing_radius() const { return radius; } -void SphereShape::_update_shape() { +void SphereShape3D::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), radius); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void SphereShape::set_radius(float p_radius) { +void SphereShape3D::set_radius(float p_radius) { radius = p_radius; _update_shape(); @@ -73,21 +73,21 @@ void SphereShape::set_radius(float p_radius) { _change_notify("radius"); } -float SphereShape::get_radius() const { +float SphereShape3D::get_radius() const { return radius; } -void SphereShape::_bind_methods() { +void SphereShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_radius", "radius"), &SphereShape::set_radius); - ClassDB::bind_method(D_METHOD("get_radius"), &SphereShape::get_radius); + ClassDB::bind_method(D_METHOD("set_radius", "radius"), &SphereShape3D::set_radius); + ClassDB::bind_method(D_METHOD("get_radius"), &SphereShape3D::get_radius); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_radius", "get_radius"); } -SphereShape::SphereShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_SPHERE)) { +SphereShape3D::SphereShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_SPHERE)) { set_radius(1.0); } diff --git a/scene/resources/sphere_shape.h b/scene/resources/sphere_shape_3d.h index 07e8f1e233..3ed50cfe83 100644 --- a/scene/resources/sphere_shape.h +++ b/scene/resources/sphere_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* sphere_shape.h */ +/* sphere_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef SPHERE_SHAPE_H -#define SPHERE_SHAPE_H +#ifndef SPHERE_SHAPE_3D_H +#define SPHERE_SHAPE_3D_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class SphereShape : public Shape { +class SphereShape3D : public Shape3D { - GDCLASS(SphereShape, Shape); + GDCLASS(SphereShape3D, Shape3D); float radius; protected: @@ -50,7 +50,7 @@ public: virtual Vector<Vector3> get_debug_mesh_lines(); virtual real_t get_enclosing_radius() const; - SphereShape(); + SphereShape3D(); }; #endif // SPHERE_SHAPE_H diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 119cbcd098..0cd2bed71d 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -29,7 +29,8 @@ /*************************************************************************/ #include "style_box.h" -#include "scene/2d/canvas_item.h" + +#include "scene/main/canvas_item.h" #include <limits.h> diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index 3c964ec667..5252c560a4 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -34,7 +34,7 @@ #include "core/array.h" #include "core/resource.h" #include "scene/2d/light_occluder_2d.h" -#include "scene/2d/navigation_polygon.h" +#include "scene/2d/navigation_region_2d.h" #include "scene/resources/convex_polygon_shape_2d.h" #include "scene/resources/shape_2d.h" #include "scene/resources/texture.h" diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index fecef88792..c4a019c728 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1034,7 +1034,7 @@ bool VisualShader::_get(const StringName &p_name, Variant &r_ret) const { void VisualShader::_get_property_list(List<PropertyInfo> *p_list) const { //mode - p_list->push_back(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Spatial,CanvasItem,Particles,Sky")); + p_list->push_back(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Node3D,CanvasItem,Particles,Sky")); //render modes Map<String, String> blend_mode_enums; diff --git a/scene/resources/world.cpp b/scene/resources/world_3d.cpp index a7e519479f..0a687af803 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* world.cpp */ +/* world_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,17 +28,17 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "world.h" +#include "world_3d.h" #include "core/math/camera_matrix.h" #include "core/math/octree.h" -#include "scene/3d/camera.h" -#include "scene/3d/visibility_notifier.h" +#include "scene/3d/camera_3d.h" +#include "scene/3d/visibility_notifier_3d.h" #include "scene/scene_string_names.h" struct SpatialIndexer { - Octree<VisibilityNotifier> octree; + Octree<VisibilityNotifier3D> octree; struct NotifierData { @@ -46,25 +46,25 @@ struct SpatialIndexer { OctreeElementID id; }; - Map<VisibilityNotifier *, NotifierData> notifiers; + Map<VisibilityNotifier3D *, NotifierData> notifiers; struct CameraData { - Map<VisibilityNotifier *, uint64_t> notifiers; + Map<VisibilityNotifier3D *, uint64_t> notifiers; }; - Map<Camera *, CameraData> cameras; + Map<Camera3D *, CameraData> cameras; enum { VISIBILITY_CULL_MAX = 32768 }; - Vector<VisibilityNotifier *> cull; + Vector<VisibilityNotifier3D *> cull; bool changed; uint64_t pass; uint64_t last_frame; - void _notifier_add(VisibilityNotifier *p_notifier, const AABB &p_rect) { + void _notifier_add(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { ERR_FAIL_COND(notifiers.has(p_notifier)); notifiers[p_notifier].aabb = p_rect; @@ -72,9 +72,9 @@ struct SpatialIndexer { changed = true; } - void _notifier_update(VisibilityNotifier *p_notifier, const AABB &p_rect) { + void _notifier_update(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { - Map<VisibilityNotifier *, NotifierData>::Element *E = notifiers.find(p_notifier); + Map<VisibilityNotifier3D *, NotifierData>::Element *E = notifiers.find(p_notifier); ERR_FAIL_COND(!E); if (E->get().aabb == p_rect) return; @@ -84,18 +84,18 @@ struct SpatialIndexer { changed = true; } - void _notifier_remove(VisibilityNotifier *p_notifier) { + void _notifier_remove(VisibilityNotifier3D *p_notifier) { - Map<VisibilityNotifier *, NotifierData>::Element *E = notifiers.find(p_notifier); + Map<VisibilityNotifier3D *, NotifierData>::Element *E = notifiers.find(p_notifier); ERR_FAIL_COND(!E); octree.erase(E->get().id); notifiers.erase(p_notifier); - List<Camera *> removed; - for (Map<Camera *, CameraData>::Element *F = cameras.front(); F; F = F->next()) { + List<Camera3D *> removed; + for (Map<Camera3D *, CameraData>::Element *F = cameras.front(); F; F = F->next()) { - Map<VisibilityNotifier *, uint64_t>::Element *G = F->get().notifiers.find(p_notifier); + Map<VisibilityNotifier3D *, uint64_t>::Element *G = F->get().notifiers.find(p_notifier); if (G) { F->get().notifiers.erase(G); @@ -112,7 +112,7 @@ struct SpatialIndexer { changed = true; } - void _add_camera(Camera *p_camera) { + void _add_camera(Camera3D *p_camera) { ERR_FAIL_COND(cameras.has(p_camera)); CameraData vd; @@ -120,17 +120,17 @@ struct SpatialIndexer { changed = true; } - void _update_camera(Camera *p_camera) { + void _update_camera(Camera3D *p_camera) { - Map<Camera *, CameraData>::Element *E = cameras.find(p_camera); + Map<Camera3D *, CameraData>::Element *E = cameras.find(p_camera); ERR_FAIL_COND(!E); changed = true; } - void _remove_camera(Camera *p_camera) { + void _remove_camera(Camera3D *p_camera) { ERR_FAIL_COND(!cameras.has(p_camera)); - List<VisibilityNotifier *> removed; - for (Map<VisibilityNotifier *, uint64_t>::Element *E = cameras[p_camera].notifiers.front(); E; E = E->next()) { + List<VisibilityNotifier3D *> removed; + for (Map<VisibilityNotifier3D *, uint64_t>::Element *E = cameras[p_camera].notifiers.front(); E; E = E->next()) { removed.push_back(E->key()); } @@ -152,26 +152,26 @@ struct SpatialIndexer { if (!changed) return; - for (Map<Camera *, CameraData>::Element *E = cameras.front(); E; E = E->next()) { + for (Map<Camera3D *, CameraData>::Element *E = cameras.front(); E; E = E->next()) { pass++; - Camera *c = E->key(); + Camera3D *c = E->key(); Vector<Plane> planes = c->get_frustum(); int culled = octree.cull_convex(planes, cull.ptrw(), cull.size()); - VisibilityNotifier **ptr = cull.ptrw(); + VisibilityNotifier3D **ptr = cull.ptrw(); - List<VisibilityNotifier *> added; - List<VisibilityNotifier *> removed; + List<VisibilityNotifier3D *> added; + List<VisibilityNotifier3D *> removed; for (int i = 0; i < culled; i++) { //notifiers in frustum - Map<VisibilityNotifier *, uint64_t>::Element *H = E->get().notifiers.find(ptr[i]); + Map<VisibilityNotifier3D *, uint64_t>::Element *H = E->get().notifiers.find(ptr[i]); if (!H) { E->get().notifiers.insert(ptr[i], pass); @@ -181,7 +181,7 @@ struct SpatialIndexer { } } - for (Map<VisibilityNotifier *, uint64_t>::Element *F = E->get().notifiers.front(); F; F = F->next()) { + for (Map<VisibilityNotifier3D *, uint64_t>::Element *F = E->get().notifiers.front(); F; F = F->next()) { if (F->get() != pass) removed.push_back(F->key()); @@ -210,65 +210,65 @@ struct SpatialIndexer { } }; -void World::_register_camera(Camera *p_camera) { +void World3D::_register_camera(Camera3D *p_camera) { #ifndef _3D_DISABLED indexer->_add_camera(p_camera); #endif } -void World::_update_camera(Camera *p_camera) { +void World3D::_update_camera(Camera3D *p_camera) { #ifndef _3D_DISABLED indexer->_update_camera(p_camera); #endif } -void World::_remove_camera(Camera *p_camera) { +void World3D::_remove_camera(Camera3D *p_camera) { #ifndef _3D_DISABLED indexer->_remove_camera(p_camera); #endif } -void World::_register_notifier(VisibilityNotifier *p_notifier, const AABB &p_rect) { +void World3D::_register_notifier(VisibilityNotifier3D *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 AABB &p_rect) { +void World3D::_update_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect) { #ifndef _3D_DISABLED indexer->_notifier_update(p_notifier, p_rect); #endif } -void World::_remove_notifier(VisibilityNotifier *p_notifier) { +void World3D::_remove_notifier(VisibilityNotifier3D *p_notifier) { #ifndef _3D_DISABLED indexer->_notifier_remove(p_notifier); #endif } -void World::_update(uint64_t p_frame) { +void World3D::_update(uint64_t p_frame) { #ifndef _3D_DISABLED indexer->_update(p_frame); #endif } -RID World::get_space() const { +RID World3D::get_space() const { return space; } -RID World::get_scenario() const { +RID World3D::get_scenario() const { return scenario; } -void World::set_environment(const Ref<Environment> &p_environment) { +void World3D::set_environment(const Ref<Environment> &p_environment) { if (environment == p_environment) { return; } @@ -282,12 +282,12 @@ void World::set_environment(const Ref<Environment> &p_environment) { emit_changed(); } -Ref<Environment> World::get_environment() const { +Ref<Environment> World3D::get_environment() const { return environment; } -void World::set_fallback_environment(const Ref<Environment> &p_environment) { +void World3D::set_fallback_environment(const Ref<Environment> &p_environment) { if (fallback_environment == p_environment) { return; } @@ -301,12 +301,12 @@ void World::set_fallback_environment(const Ref<Environment> &p_environment) { emit_changed(); } -Ref<Environment> World::get_fallback_environment() const { +Ref<Environment> World3D::get_fallback_environment() const { return fallback_environment; } -void World::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { +void World3D::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { camera_effects = p_camera_effects; if (camera_effects.is_valid()) @@ -315,34 +315,34 @@ void World::set_camera_effects(const Ref<CameraEffects> &p_camera_effects) { VS::get_singleton()->scenario_set_camera_effects(scenario, RID()); } -Ref<CameraEffects> World::get_camera_effects() const { +Ref<CameraEffects> World3D::get_camera_effects() const { return camera_effects; } -PhysicsDirectSpaceState *World::get_direct_space_state() { +PhysicsDirectSpaceState *World3D::get_direct_space_state() { return PhysicsServer::get_singleton()->space_get_direct_state(space); } -void World::get_camera_list(List<Camera *> *r_cameras) { +void World3D::get_camera_list(List<Camera3D *> *r_cameras) { - for (Map<Camera *, SpatialIndexer::CameraData>::Element *E = indexer->cameras.front(); E; E = E->next()) { + for (Map<Camera3D *, SpatialIndexer::CameraData>::Element *E = indexer->cameras.front(); E; E = E->next()) { r_cameras->push_back(E->key()); } } -void World::_bind_methods() { - - ClassDB::bind_method(D_METHOD("get_space"), &World::get_space); - ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario); - ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment); - ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment); - ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment); - ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World::get_fallback_environment); - ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World::set_camera_effects); - ClassDB::bind_method(D_METHOD("get_camera_effects"), &World::get_camera_effects); - ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World::get_direct_space_state); +void World3D::_bind_methods() { + + ClassDB::bind_method(D_METHOD("get_space"), &World3D::get_space); + ClassDB::bind_method(D_METHOD("get_scenario"), &World3D::get_scenario); + ClassDB::bind_method(D_METHOD("set_environment", "env"), &World3D::set_environment); + ClassDB::bind_method(D_METHOD("get_environment"), &World3D::get_environment); + ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World3D::set_fallback_environment); + ClassDB::bind_method(D_METHOD("get_fallback_environment"), &World3D::get_fallback_environment); + ClassDB::bind_method(D_METHOD("set_camera_effects", "env"), &World3D::set_camera_effects); + ClassDB::bind_method(D_METHOD("get_camera_effects"), &World3D::get_camera_effects); + ClassDB::bind_method(D_METHOD("get_direct_space_state"), &World3D::get_direct_space_state); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_environment", "get_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "camera_effects", PROPERTY_HINT_RESOURCE_TYPE, "CameraEffects"), "set_camera_effects", "get_camera_effects"); @@ -351,7 +351,7 @@ void World::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state"); } -World::World() { +World3D::World3D() { space = PhysicsServer::get_singleton()->space_create(); scenario = VisualServer::get_singleton()->scenario_create(); @@ -371,7 +371,7 @@ World::World() { #endif } -World::~World() { +World3D::~World3D() { PhysicsServer::get_singleton()->free(space); VisualServer::get_singleton()->free(scenario); diff --git a/scene/resources/world.h b/scene/resources/world_3d.h index 6fd79abaaf..4c18ba9cea 100644 --- a/scene/resources/world.h +++ b/scene/resources/world_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* world.h */ +/* world_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,21 +28,20 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WORLD_H -#define WORLD_H +#ifndef WORLD_3D_H +#define WORLD_3D_H #include "core/resource.h" #include "scene/resources/environment.h" #include "servers/physics_server.h" #include "servers/visual_server.h" -class Camera; -class VisibilityNotifier; +class Camera3D; +class VisibilityNotifier3D; struct SpatialIndexer; -class World : public Resource { - GDCLASS(World, Resource); - RES_BASE_EXTENSION("world"); +class World3D : public Resource { + GDCLASS(World3D, Resource); private: RID space; @@ -55,16 +54,16 @@ private: protected: static void _bind_methods(); - friend class Camera; - friend class VisibilityNotifier; + friend class Camera3D; + friend class VisibilityNotifier3D; - void _register_camera(Camera *p_camera); - void _update_camera(Camera *p_camera); - void _remove_camera(Camera *p_camera); + void _register_camera(Camera3D *p_camera); + void _update_camera(Camera3D *p_camera); + void _remove_camera(Camera3D *p_camera); - 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); + void _register_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect); + void _update_notifier(VisibilityNotifier3D *p_notifier, const AABB &p_rect); + void _remove_notifier(VisibilityNotifier3D *p_notifier); friend class Viewport; void _update(uint64_t p_frame); @@ -81,12 +80,12 @@ public: void set_camera_effects(const Ref<CameraEffects> &p_camera_effects); Ref<CameraEffects> get_camera_effects() const; - void get_camera_list(List<Camera *> *r_cameras); + void get_camera_list(List<Camera3D *> *r_cameras); PhysicsDirectSpaceState *get_direct_space_state(); - World(); - ~World(); + World3D(); + ~World3D(); }; -#endif // WORLD_H +#endif // WORLD_3D_H diff --git a/scene/resources/world_margin_shape.cpp b/scene/resources/world_margin_shape_3d.cpp index b5b701327c..3bea3111ef 100644 --- a/scene/resources/world_margin_shape.cpp +++ b/scene/resources/world_margin_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* world_margin_shape.cpp */ +/* world_margin_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "world_margin_shape.h" +#include "world_margin_shape_3d.h" #include "servers/physics_server.h" -Vector<Vector3> WorldMarginShape::get_debug_mesh_lines() { +Vector<Vector3> WorldMarginShape3D::get_debug_mesh_lines() { Plane p = get_plane(); Vector<Vector3> points; @@ -61,13 +61,13 @@ Vector<Vector3> WorldMarginShape::get_debug_mesh_lines() { return points; } -void WorldMarginShape::_update_shape() { +void WorldMarginShape3D::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), plane); - Shape::_update_shape(); + Shape3D::_update_shape(); } -void WorldMarginShape::set_plane(Plane p_plane) { +void WorldMarginShape3D::set_plane(Plane p_plane) { plane = p_plane; _update_shape(); @@ -75,21 +75,21 @@ void WorldMarginShape::set_plane(Plane p_plane) { _change_notify("plane"); } -Plane WorldMarginShape::get_plane() const { +Plane WorldMarginShape3D::get_plane() const { return plane; } -void WorldMarginShape::_bind_methods() { +void WorldMarginShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_plane", "plane"), &WorldMarginShape::set_plane); - ClassDB::bind_method(D_METHOD("get_plane"), &WorldMarginShape::get_plane); + ClassDB::bind_method(D_METHOD("set_plane", "plane"), &WorldMarginShape3D::set_plane); + ClassDB::bind_method(D_METHOD("get_plane"), &WorldMarginShape3D::get_plane); ADD_PROPERTY(PropertyInfo(Variant::PLANE, "plane"), "set_plane", "get_plane"); } -WorldMarginShape::WorldMarginShape() : - Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_PLANE)) { +WorldMarginShape3D::WorldMarginShape3D() : + Shape3D(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_PLANE)) { set_plane(Plane(0, 1, 0, 0)); } diff --git a/scene/resources/world_margin_shape.h b/scene/resources/world_margin_shape_3d.h index 78ea570212..5e0f046628 100644 --- a/scene/resources/world_margin_shape.h +++ b/scene/resources/world_margin_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* world_margin_shape.h */ +/* world_margin_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,14 +28,14 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef WORLD_MARGIN_SHAPE_H -#define WORLD_MARGIN_SHAPE_H +#ifndef WORLD_MARGIN_SHAPE_3D_H +#define WORLD_MARGIN_SHAPE_3D_H -#include "scene/resources/shape.h" +#include "scene/resources/shape_3d.h" -class WorldMarginShape : public Shape { +class WorldMarginShape3D : public Shape3D { - GDCLASS(WorldMarginShape, Shape); + GDCLASS(WorldMarginShape3D, Shape3D); Plane plane; protected: @@ -52,6 +52,6 @@ public: return 0; } - WorldMarginShape(); + WorldMarginShape3D(); }; #endif // WORLD_MARGIN_SHAPE_H |