From de3f6699a5192153e9882a62b58b9ca6cd82ee2d Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sat, 17 Oct 2020 01:08:21 -0400 Subject: Rename Transform to Transform3D in core --- modules/bullet/bullet_physics_server.cpp | 36 +++++------ modules/bullet/bullet_physics_server.h | 30 +++++----- modules/bullet/bullet_types_converter.cpp | 4 +- modules/bullet/bullet_types_converter.h | 4 +- modules/bullet/collision_object_bullet.cpp | 16 ++--- modules/bullet/collision_object_bullet.h | 14 ++--- modules/bullet/cone_twist_joint_bullet.cpp | 6 +- modules/bullet/cone_twist_joint_bullet.h | 2 +- modules/bullet/generic_6dof_joint_bullet.cpp | 22 +++---- modules/bullet/generic_6dof_joint_bullet.h | 10 ++-- modules/bullet/hinge_joint_bullet.cpp | 6 +- modules/bullet/hinge_joint_bullet.h | 2 +- modules/bullet/rigid_body_bullet.cpp | 4 +- modules/bullet/rigid_body_bullet.h | 4 +- modules/bullet/slider_joint_bullet.cpp | 30 +++++----- modules/bullet/slider_joint_bullet.h | 14 ++--- modules/bullet/soft_body_bullet.cpp | 4 +- modules/bullet/soft_body_bullet.h | 4 +- modules/bullet/space_bullet.cpp | 12 ++-- modules/bullet/space_bullet.h | 12 ++-- modules/csg/csg.cpp | 2 +- modules/csg/csg.h | 6 +- modules/csg/csg_gizmos.cpp | 4 +- modules/csg/csg_shape.cpp | 8 +-- modules/fbx/README.md | 28 ++++----- modules/fbx/data/pivot_transform.cpp | 70 +++++++++++----------- modules/fbx/data/pivot_transform.h | 16 ++--- modules/fbx/editor_scene_importer_fbx.cpp | 8 +-- modules/fbx/fbx_parser/FBXDocument.h | 16 ++--- modules/fbx/fbx_parser/FBXParser.cpp | 4 +- modules/fbx/fbx_parser/FBXParser.h | 2 +- modules/fbx/tools/import_utils.cpp | 6 +- modules/fbx/tools/import_utils.h | 4 +- modules/gdnative/gdnative/transform.cpp | 6 +- modules/gdnative/gdnative/variant.cpp | 4 +- modules/gdnative/register_types.cpp | 2 +- modules/gdnative/xr/xr_interface_gdnative.cpp | 14 ++--- modules/gdnative/xr/xr_interface_gdnative.h | 2 +- modules/gdnavigation/gd_navigation_server.cpp | 2 +- modules/gdnavigation/gd_navigation_server.h | 2 +- modules/gdnavigation/nav_region.cpp | 2 +- modules/gdnavigation/nav_region.h | 6 +- modules/gdnavigation/navigation_mesh_generator.cpp | 12 ++-- modules/gdnavigation/navigation_mesh_generator.h | 6 +- modules/gdscript/gdscript_vm.cpp | 4 +- modules/gltf/gltf_document.cpp | 56 ++++++++--------- modules/gltf/gltf_document.h | 6 +- modules/gltf/gltf_node.cpp | 6 +- modules/gltf/gltf_node.h | 6 +- modules/gltf/gltf_skin.cpp | 2 +- modules/gltf/gltf_skin.h | 2 +- modules/gridmap/grid_map.cpp | 21 ++++--- modules/gridmap/grid_map.h | 6 +- modules/gridmap/grid_map_editor_plugin.cpp | 18 +++--- modules/gridmap/grid_map_editor_plugin.h | 6 +- modules/mobile_vr/mobile_vr_interface.cpp | 6 +- modules/mobile_vr/mobile_vr_interface.h | 2 +- modules/mono/editor/bindings_generator.cpp | 6 +- .../glue/GodotSharp/GodotSharp/Core/Transform.cs | 68 ++++++++++----------- modules/mono/mono_gd/gd_mono_cache.cpp | 4 +- modules/mono/mono_gd/gd_mono_field.cpp | 6 +- modules/mono/mono_gd/gd_mono_marshal.cpp | 6 +- modules/mono/mono_gd/gd_mono_marshal.h | 20 +++---- modules/raycast/raycast_occlusion_cull.cpp | 10 ++-- modules/raycast/raycast_occlusion_cull.h | 16 ++--- modules/webxr/webxr_interface_js.cpp | 8 +-- modules/webxr/webxr_interface_js.h | 4 +- 67 files changed, 378 insertions(+), 379 deletions(-) (limited to 'modules') diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index e601884486..e07be14c5b 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -268,7 +268,7 @@ PhysicsServer3D::AreaSpaceOverrideMode BulletPhysicsServer3D::area_get_space_ove return area->get_spOv_mode(); } -void BulletPhysicsServer3D::area_add_shape(RID p_area, RID p_shape, const Transform &p_transform, bool p_disabled) { +void BulletPhysicsServer3D::area_add_shape(RID p_area, RID p_shape, const Transform3D &p_transform, bool p_disabled) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); @@ -288,7 +288,7 @@ void BulletPhysicsServer3D::area_set_shape(RID p_area, int p_shape_idx, RID p_sh area->set_shape(p_shape_idx, shape); } -void BulletPhysicsServer3D::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) { +void BulletPhysicsServer3D::area_set_shape_transform(RID p_area, int p_shape_idx, const Transform3D &p_transform) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); @@ -309,9 +309,9 @@ RID BulletPhysicsServer3D::area_get_shape(RID p_area, int p_shape_idx) const { return area->get_shape(p_shape_idx)->get_self(); } -Transform BulletPhysicsServer3D::area_get_shape_transform(RID p_area, int p_shape_idx) const { +Transform3D BulletPhysicsServer3D::area_get_shape_transform(RID p_area, int p_shape_idx) const { AreaBullet *area = area_owner.getornull(p_area); - ERR_FAIL_COND_V(!area, Transform()); + ERR_FAIL_COND_V(!area, Transform3D()); return area->get_shape_transform(p_shape_idx); } @@ -382,15 +382,15 @@ Variant BulletPhysicsServer3D::area_get_param(RID p_area, AreaParameter p_param) } } -void BulletPhysicsServer3D::area_set_transform(RID p_area, const Transform &p_transform) { +void BulletPhysicsServer3D::area_set_transform(RID p_area, const Transform3D &p_transform) { AreaBullet *area = area_owner.getornull(p_area); ERR_FAIL_COND(!area); area->set_transform(p_transform); } -Transform BulletPhysicsServer3D::area_get_transform(RID p_area) const { +Transform3D BulletPhysicsServer3D::area_get_transform(RID p_area) const { AreaBullet *area = area_owner.getornull(p_area); - ERR_FAIL_COND_V(!area, Transform()); + ERR_FAIL_COND_V(!area, Transform3D()); return area->get_transform(); } @@ -484,7 +484,7 @@ PhysicsServer3D::BodyMode BulletPhysicsServer3D::body_get_mode(RID p_body) const return body->get_mode(); } -void BulletPhysicsServer3D::body_add_shape(RID p_body, RID p_shape, const Transform &p_transform, bool p_disabled) { +void BulletPhysicsServer3D::body_add_shape(RID p_body, RID p_shape, const Transform3D &p_transform, bool p_disabled) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -504,7 +504,7 @@ void BulletPhysicsServer3D::body_set_shape(RID p_body, int p_shape_idx, RID p_sh body->set_shape(p_shape_idx, shape); } -void BulletPhysicsServer3D::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) { +void BulletPhysicsServer3D::body_set_shape_transform(RID p_body, int p_shape_idx, const Transform3D &p_transform) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -527,9 +527,9 @@ RID BulletPhysicsServer3D::body_get_shape(RID p_body, int p_shape_idx) const { return shape->get_self(); } -Transform BulletPhysicsServer3D::body_get_shape_transform(RID p_body, int p_shape_idx) const { +Transform3D BulletPhysicsServer3D::body_get_shape_transform(RID p_body, int p_shape_idx) const { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); - ERR_FAIL_COND_V(!body, Transform()); + ERR_FAIL_COND_V(!body, Transform3D()); return body->get_shape_transform(p_shape_idx); } @@ -842,7 +842,7 @@ PhysicsDirectBodyState3D *BulletPhysicsServer3D::body_get_direct_state(RID p_bod return BulletPhysicsDirectBodyState3D::get_singleton(body); } -bool BulletPhysicsServer3D::body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) { +bool BulletPhysicsServer3D::body_test_motion(RID p_body, const Transform3D &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result, bool p_exclude_raycast_shapes) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, false); ERR_FAIL_COND_V(!body->get_space(), false); @@ -850,7 +850,7 @@ bool BulletPhysicsServer3D::body_test_motion(RID p_body, const Transform &p_from return body->get_space()->test_body_motion(body, p_from, p_motion, p_infinite_inertia, r_result, p_exclude_raycast_shapes); } -int BulletPhysicsServer3D::body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, real_t p_margin) { +int BulletPhysicsServer3D::body_test_ray_separation(RID p_body, const Transform3D &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, real_t p_margin) { RigidBodyBullet *body = rigid_body_owner.getornull(p_body); ERR_FAIL_COND_V(!body, 0); ERR_FAIL_COND_V(!body->get_space(), 0); @@ -990,7 +990,7 @@ Variant BulletPhysicsServer3D::soft_body_get_state(RID p_body, BodyState p_state return Variant(); } -void BulletPhysicsServer3D::soft_body_set_transform(RID p_body, const Transform &p_transform) { +void BulletPhysicsServer3D::soft_body_set_transform(RID p_body, const Transform3D &p_transform) { SoftBodyBullet *body = soft_body_owner.getornull(p_body); ERR_FAIL_COND(!body); @@ -1205,7 +1205,7 @@ Vector3 BulletPhysicsServer3D::pin_joint_get_local_b(RID p_joint) const { return pin_joint->getPivotInB(); } -RID BulletPhysicsServer3D::joint_create_hinge(RID p_body_A, const Transform &p_hinge_A, RID p_body_B, const Transform &p_hinge_B) { +RID BulletPhysicsServer3D::joint_create_hinge(RID p_body_A, const Transform3D &p_hinge_A, RID p_body_B, const Transform3D &p_hinge_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1277,7 +1277,7 @@ bool BulletPhysicsServer3D::hinge_joint_get_flag(RID p_joint, HingeJointFlag p_f return hinge_joint->get_flag(p_flag); } -RID BulletPhysicsServer3D::joint_create_slider(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { +RID BulletPhysicsServer3D::joint_create_slider(RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1313,7 +1313,7 @@ real_t BulletPhysicsServer3D::slider_joint_get_param(RID p_joint, SliderJointPar return slider_joint->get_param(p_param); } -RID BulletPhysicsServer3D::joint_create_cone_twist(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { +RID BulletPhysicsServer3D::joint_create_cone_twist(RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); @@ -1347,7 +1347,7 @@ real_t BulletPhysicsServer3D::cone_twist_joint_get_param(RID p_joint, ConeTwistJ return coneTwist_joint->get_param(p_param); } -RID BulletPhysicsServer3D::joint_create_generic_6dof(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) { +RID BulletPhysicsServer3D::joint_create_generic_6dof(RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) { RigidBodyBullet *body_A = rigid_body_owner.getornull(p_body_A); ERR_FAIL_COND_V(!body_A, RID()); JointAssertSpace(body_A, "A", RID()); diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h index de0379c873..6df913ff80 100644 --- a/modules/bullet/bullet_physics_server.h +++ b/modules/bullet/bullet_physics_server.h @@ -134,12 +134,12 @@ public: virtual void area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) override; virtual AreaSpaceOverrideMode area_get_space_override_mode(RID p_area) const override; - virtual void area_add_shape(RID p_area, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false) override; + virtual void area_add_shape(RID p_area, RID p_shape, const Transform3D &p_transform = Transform3D(), bool p_disabled = false) override; virtual void area_set_shape(RID p_area, int p_shape_idx, RID p_shape) override; - virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform &p_transform) override; + virtual void area_set_shape_transform(RID p_area, int p_shape_idx, const Transform3D &p_transform) override; virtual int area_get_shape_count(RID p_area) const override; virtual RID area_get_shape(RID p_area, int p_shape_idx) const override; - virtual Transform area_get_shape_transform(RID p_area, int p_shape_idx) const override; + virtual Transform3D area_get_shape_transform(RID p_area, int p_shape_idx) const override; virtual void area_remove_shape(RID p_area, int p_shape_idx) override; virtual void area_clear_shapes(RID p_area) override; virtual void area_set_shape_disabled(RID p_area, int p_shape_idx, bool p_disabled) override; @@ -153,8 +153,8 @@ public: virtual void area_set_param(RID p_area, AreaParameter p_param, const Variant &p_value) override; virtual Variant area_get_param(RID p_area, AreaParameter p_param) const override; - virtual void area_set_transform(RID p_area, const Transform &p_transform) override; - virtual Transform area_get_transform(RID p_area) const override; + virtual void area_set_transform(RID p_area, const Transform3D &p_transform) override; + virtual Transform3D area_get_transform(RID p_area) const override; virtual void area_set_collision_mask(RID p_area, uint32_t p_mask) override; virtual void area_set_collision_layer(RID p_area, uint32_t p_layer) override; @@ -174,14 +174,14 @@ public: virtual void body_set_mode(RID p_body, BodyMode p_mode) override; virtual BodyMode body_get_mode(RID p_body) const override; - virtual void body_add_shape(RID p_body, RID p_shape, const Transform &p_transform = Transform(), bool p_disabled = false) override; + virtual void body_add_shape(RID p_body, RID p_shape, const Transform3D &p_transform = Transform3D(), bool p_disabled = false) override; // Not supported, Please remove and add new shape virtual void body_set_shape(RID p_body, int p_shape_idx, RID p_shape) override; - virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform &p_transform) override; + virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Transform3D &p_transform) override; virtual int body_get_shape_count(RID p_body) const override; virtual RID body_get_shape(RID p_body, int p_shape_idx) const override; - virtual Transform body_get_shape_transform(RID p_body, int p_shape_idx) const override; + virtual Transform3D body_get_shape_transform(RID p_body, int p_shape_idx) const override; virtual void body_set_shape_disabled(RID p_body, int p_shape_idx, bool p_disabled) override; @@ -253,8 +253,8 @@ public: // this function only works on physics process, errors and returns null otherwise virtual PhysicsDirectBodyState3D *body_get_direct_state(RID p_body) override; - virtual bool body_test_motion(RID p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) override; - virtual int body_test_ray_separation(RID p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, real_t p_margin = 0.001) override; + virtual bool body_test_motion(RID p_body, const Transform3D &p_from, const Vector3 &p_motion, bool p_infinite_inertia, MotionResult *r_result = nullptr, bool p_exclude_raycast_shapes = true) override; + virtual int body_test_ray_separation(RID p_body, const Transform3D &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, SeparationResult *r_results, int p_result_max, real_t p_margin = 0.001) override; /* SOFT BODY API */ @@ -283,7 +283,7 @@ public: virtual Variant soft_body_get_state(RID p_body, BodyState p_state) const override; /// Special function. This function has bad performance - virtual void soft_body_set_transform(RID p_body, const Transform &p_transform) override; + virtual void soft_body_set_transform(RID p_body, const Transform3D &p_transform) override; virtual void soft_body_set_ray_pickable(RID p_body, bool p_enable) override; @@ -333,7 +333,7 @@ public: virtual void pin_joint_set_local_b(RID p_joint, const Vector3 &p_B) override; virtual Vector3 pin_joint_get_local_b(RID p_joint) const override; - virtual RID joint_create_hinge(RID p_body_A, const Transform &p_hinge_A, RID p_body_B, const Transform &p_hinge_B) override; + virtual RID joint_create_hinge(RID p_body_A, const Transform3D &p_hinge_A, RID p_body_B, const Transform3D &p_hinge_B) override; virtual RID joint_create_hinge_simple(RID p_body_A, const Vector3 &p_pivot_A, const Vector3 &p_axis_A, RID p_body_B, const Vector3 &p_pivot_B, const Vector3 &p_axis_B) override; virtual void hinge_joint_set_param(RID p_joint, HingeJointParam p_param, real_t p_value) override; @@ -343,19 +343,19 @@ public: virtual bool hinge_joint_get_flag(RID p_joint, HingeJointFlag p_flag) const override; /// Reference frame is A - virtual RID joint_create_slider(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) override; + virtual RID joint_create_slider(RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) override; virtual void slider_joint_set_param(RID p_joint, SliderJointParam p_param, real_t p_value) override; virtual real_t slider_joint_get_param(RID p_joint, SliderJointParam p_param) const override; /// Reference frame is A - virtual RID joint_create_cone_twist(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) override; + virtual RID joint_create_cone_twist(RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) override; virtual void cone_twist_joint_set_param(RID p_joint, ConeTwistJointParam p_param, real_t p_value) override; virtual real_t cone_twist_joint_get_param(RID p_joint, ConeTwistJointParam p_param) const override; /// Reference frame is A - virtual RID joint_create_generic_6dof(RID p_body_A, const Transform &p_local_frame_A, RID p_body_B, const Transform &p_local_frame_B) override; + virtual RID joint_create_generic_6dof(RID p_body_A, const Transform3D &p_local_frame_A, RID p_body_B, const Transform3D &p_local_frame_B) override; virtual void generic_6dof_joint_set_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param, real_t p_value) override; virtual real_t generic_6dof_joint_get_param(RID p_joint, Vector3::Axis p_axis, G6DOFJointAxisParam p_param) override; diff --git a/modules/bullet/bullet_types_converter.cpp b/modules/bullet/bullet_types_converter.cpp index 19d4816372..01461767bd 100644 --- a/modules/bullet/bullet_types_converter.cpp +++ b/modules/bullet/bullet_types_converter.cpp @@ -59,7 +59,7 @@ void INVERT_B_TO_G(btMatrix3x3 const &inVal, Basis &outVal) { INVERT_B_TO_G(inVal[2], outVal[2]); } -void B_TO_G(btTransform const &inVal, Transform &outVal) { +void B_TO_G(btTransform const &inVal, Transform3D &outVal) { B_TO_G(inVal.getBasis(), outVal.basis); B_TO_G(inVal.getOrigin(), outVal.origin); } @@ -89,7 +89,7 @@ void INVERT_G_TO_B(Basis const &inVal, btMatrix3x3 &outVal) { INVERT_G_TO_B(inVal[2], outVal[2]); } -void G_TO_B(Transform const &inVal, btTransform &outVal) { +void G_TO_B(Transform3D const &inVal, btTransform &outVal) { G_TO_B(inVal.basis, outVal.getBasis()); G_TO_B(inVal.origin, outVal.getOrigin()); } diff --git a/modules/bullet/bullet_types_converter.h b/modules/bullet/bullet_types_converter.h index ca9b7175dd..74cdabd717 100644 --- a/modules/bullet/bullet_types_converter.h +++ b/modules/bullet/bullet_types_converter.h @@ -49,14 +49,14 @@ extern void B_TO_G(btVector3 const &inVal, Vector3 &outVal); extern void INVERT_B_TO_G(btVector3 const &inVal, Vector3 &outVal); extern void B_TO_G(btMatrix3x3 const &inVal, Basis &outVal); extern void INVERT_B_TO_G(btMatrix3x3 const &inVal, Basis &outVal); -extern void B_TO_G(btTransform const &inVal, Transform &outVal); +extern void B_TO_G(btTransform const &inVal, Transform3D &outVal); // Godot TO Bullet extern void G_TO_B(Vector3 const &inVal, btVector3 &outVal); extern void INVERT_G_TO_B(Vector3 const &inVal, btVector3 &outVal); extern void G_TO_B(Basis const &inVal, btMatrix3x3 &outVal); extern void INVERT_G_TO_B(Basis const &inVal, btMatrix3x3 &outVal); -extern void G_TO_B(Transform const &inVal, btTransform &outVal); +extern void G_TO_B(Transform3D const &inVal, btTransform &outVal); extern void UNSCALE_BT_BASIS(btTransform &scaledBasis); #endif diff --git a/modules/bullet/collision_object_bullet.cpp b/modules/bullet/collision_object_bullet.cpp index d9f5beb5a1..c45bd5bbc0 100644 --- a/modules/bullet/collision_object_bullet.cpp +++ b/modules/bullet/collision_object_bullet.cpp @@ -49,7 +49,7 @@ CollisionObjectBullet::ShapeWrapper::~ShapeWrapper() {} -void CollisionObjectBullet::ShapeWrapper::set_transform(const Transform &p_transform) { +void CollisionObjectBullet::ShapeWrapper::set_transform(const Transform3D &p_transform) { G_TO_B(p_transform.get_basis().get_scale_abs(), scale); G_TO_B(p_transform, transform); UNSCALE_BT_BASIS(transform); @@ -193,7 +193,7 @@ int CollisionObjectBullet::get_godot_object_flags() const { return bt_collision_object->getUserIndex2(); } -void CollisionObjectBullet::set_transform(const Transform &p_global_transform) { +void CollisionObjectBullet::set_transform(const Transform3D &p_global_transform) { set_body_scale(p_global_transform.basis.get_scale_abs()); btTransform bt_transform; @@ -203,8 +203,8 @@ void CollisionObjectBullet::set_transform(const Transform &p_global_transform) { set_transform__bullet(bt_transform); } -Transform CollisionObjectBullet::get_transform() const { - Transform t; +Transform3D CollisionObjectBullet::get_transform() const { + Transform3D t; B_TO_G(get_transform__bullet(), t); t.basis.scale(body_scale); return t; @@ -230,7 +230,7 @@ RigidCollisionObjectBullet::~RigidCollisionObjectBullet() { } } -void RigidCollisionObjectBullet::add_shape(ShapeBullet *p_shape, const Transform &p_transform, bool p_disabled) { +void RigidCollisionObjectBullet::add_shape(ShapeBullet *p_shape, const Transform3D &p_transform, bool p_disabled) { shapes.push_back(ShapeWrapper(p_shape, p_transform, !p_disabled)); p_shape->add_owner(this); reload_shapes(); @@ -296,7 +296,7 @@ void RigidCollisionObjectBullet::remove_all_shapes(bool p_permanentlyFromThisBod } } -void RigidCollisionObjectBullet::set_shape_transform(int p_index, const Transform &p_transform) { +void RigidCollisionObjectBullet::set_shape_transform(int p_index, const Transform3D &p_transform) { ERR_FAIL_INDEX(p_index, get_shape_count()); shapes.write[p_index].set_transform(p_transform); @@ -307,8 +307,8 @@ const btTransform &RigidCollisionObjectBullet::get_bt_shape_transform(int p_inde return shapes[p_index].transform; } -Transform RigidCollisionObjectBullet::get_shape_transform(int p_index) const { - Transform trs; +Transform3D RigidCollisionObjectBullet::get_shape_transform(int p_index) const { + Transform3D trs; B_TO_G(shapes[p_index].transform, trs); return trs; } diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h index c8081a53f1..67be2fd6da 100644 --- a/modules/bullet/collision_object_bullet.h +++ b/modules/bullet/collision_object_bullet.h @@ -83,7 +83,7 @@ public: set_transform(p_transform); } - ShapeWrapper(ShapeBullet *p_shape, const Transform &p_transform, bool p_active) : + ShapeWrapper(ShapeBullet *p_shape, const Transform3D &p_transform, bool p_active) : shape(p_shape), active(p_active) { set_transform(p_transform); @@ -102,7 +102,7 @@ public: active = otherShape.active; } - void set_transform(const Transform &p_transform); + void set_transform(const Transform3D &p_transform); void set_transform(const btTransform &p_transform); btTransform get_adjusted_transform() const; @@ -202,8 +202,8 @@ public: void set_godot_object_flags(int flags); int get_godot_object_flags() const; - void set_transform(const Transform &p_global_transform); - Transform get_transform() const; + void set_transform(const Transform3D &p_global_transform); + Transform3D get_transform() const; virtual void set_transform__bullet(const btTransform &p_global_transform); virtual const btTransform &get_transform__bullet() const; @@ -225,7 +225,7 @@ public: _FORCE_INLINE_ btCollisionShape *get_main_shape() const { return mainShape; } - void add_shape(ShapeBullet *p_shape, const Transform &p_transform = Transform(), bool p_disabled = false); + void add_shape(ShapeBullet *p_shape, const Transform3D &p_transform = Transform3D(), bool p_disabled = false); void set_shape(int p_index, ShapeBullet *p_shape); int get_shape_count() const; @@ -238,10 +238,10 @@ public: void remove_shape_full(int p_index); void remove_all_shapes(bool p_permanentlyFromThisBody = false, bool p_force_not_reload = false); - void set_shape_transform(int p_index, const Transform &p_transform); + void set_shape_transform(int p_index, const Transform3D &p_transform); const btTransform &get_bt_shape_transform(int p_index) const; - Transform get_shape_transform(int p_index) const; + Transform3D get_shape_transform(int p_index) const; void set_shape_disabled(int p_index, bool p_disabled); bool is_shape_disabled(int p_index); diff --git a/modules/bullet/cone_twist_joint_bullet.cpp b/modules/bullet/cone_twist_joint_bullet.cpp index e785780c5b..34516d8b3b 100644 --- a/modules/bullet/cone_twist_joint_bullet.cpp +++ b/modules/bullet/cone_twist_joint_bullet.cpp @@ -40,16 +40,16 @@ @author AndreaCatania */ -ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame) : +ConeTwistJointBullet::ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &rbAFrame, const Transform3D &rbBFrame) : JointBullet() { - Transform scaled_AFrame(rbAFrame.scaled(rbA->get_body_scale())); + Transform3D scaled_AFrame(rbAFrame.scaled(rbA->get_body_scale())); scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis); btTransform btFrameA; G_TO_B(scaled_AFrame, btFrameA); if (rbB) { - Transform scaled_BFrame(rbBFrame.scaled(rbB->get_body_scale())); + Transform3D scaled_BFrame(rbBFrame.scaled(rbB->get_body_scale())); scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis); btTransform btFrameB; diff --git a/modules/bullet/cone_twist_joint_bullet.h b/modules/bullet/cone_twist_joint_bullet.h index 7d6bafd292..7e51f7d644 100644 --- a/modules/bullet/cone_twist_joint_bullet.h +++ b/modules/bullet/cone_twist_joint_bullet.h @@ -43,7 +43,7 @@ class ConeTwistJointBullet : public JointBullet { class btConeTwistConstraint *coneConstraint; public: - ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &rbAFrame, const Transform &rbBFrame); + ConeTwistJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &rbAFrame, const Transform3D &rbBFrame); virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_CONE_TWIST; } diff --git a/modules/bullet/generic_6dof_joint_bullet.cpp b/modules/bullet/generic_6dof_joint_bullet.cpp index 43ad6c56d5..7e04d57b9d 100644 --- a/modules/bullet/generic_6dof_joint_bullet.cpp +++ b/modules/bullet/generic_6dof_joint_bullet.cpp @@ -40,7 +40,7 @@ @author AndreaCatania */ -Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) : +Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &frameInA, const Transform3D &frameInB) : JointBullet() { for (int i = 0; i < 3; i++) { for (int j = 0; j < PhysicsServer3D::G6DOF_JOINT_FLAG_MAX; j++) { @@ -48,7 +48,7 @@ Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBu } } - Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale())); + Transform3D scaled_AFrame(frameInA.scaled(rbA->get_body_scale())); scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis); @@ -56,7 +56,7 @@ Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBu G_TO_B(scaled_AFrame, btFrameA); if (rbB) { - Transform scaled_BFrame(frameInB.scaled(rbB->get_body_scale())); + Transform3D scaled_BFrame(frameInB.scaled(rbB->get_body_scale())); scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis); @@ -71,30 +71,30 @@ Generic6DOFJointBullet::Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBu setup(sixDOFConstraint); } -Transform Generic6DOFJointBullet::getFrameOffsetA() const { +Transform3D Generic6DOFJointBullet::getFrameOffsetA() const { btTransform btTrs = sixDOFConstraint->getFrameOffsetA(); - Transform gTrs; + Transform3D gTrs; B_TO_G(btTrs, gTrs); return gTrs; } -Transform Generic6DOFJointBullet::getFrameOffsetB() const { +Transform3D Generic6DOFJointBullet::getFrameOffsetB() const { btTransform btTrs = sixDOFConstraint->getFrameOffsetB(); - Transform gTrs; + Transform3D gTrs; B_TO_G(btTrs, gTrs); return gTrs; } -Transform Generic6DOFJointBullet::getFrameOffsetA() { +Transform3D Generic6DOFJointBullet::getFrameOffsetA() { btTransform btTrs = sixDOFConstraint->getFrameOffsetA(); - Transform gTrs; + Transform3D gTrs; B_TO_G(btTrs, gTrs); return gTrs; } -Transform Generic6DOFJointBullet::getFrameOffsetB() { +Transform3D Generic6DOFJointBullet::getFrameOffsetB() { btTransform btTrs = sixDOFConstraint->getFrameOffsetB(); - Transform gTrs; + Transform3D gTrs; B_TO_G(btTrs, gTrs); return gTrs; } diff --git a/modules/bullet/generic_6dof_joint_bullet.h b/modules/bullet/generic_6dof_joint_bullet.h index 62b8e85a81..00567e3085 100644 --- a/modules/bullet/generic_6dof_joint_bullet.h +++ b/modules/bullet/generic_6dof_joint_bullet.h @@ -48,14 +48,14 @@ class Generic6DOFJointBullet : public JointBullet { bool flags[3][PhysicsServer3D::G6DOF_JOINT_FLAG_MAX]; public: - Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB); + Generic6DOFJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &frameInA, const Transform3D &frameInB); virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_6DOF; } - Transform getFrameOffsetA() const; - Transform getFrameOffsetB() const; - Transform getFrameOffsetA(); - Transform getFrameOffsetB(); + Transform3D getFrameOffsetA() const; + Transform3D getFrameOffsetB() const; + Transform3D getFrameOffsetA(); + Transform3D getFrameOffsetB(); void set_linear_lower_limit(const Vector3 &linearLower); void set_linear_upper_limit(const Vector3 &linearUpper); diff --git a/modules/bullet/hinge_joint_bullet.cpp b/modules/bullet/hinge_joint_bullet.cpp index 4ceb98729f..b5fe50cf5f 100644 --- a/modules/bullet/hinge_joint_bullet.cpp +++ b/modules/bullet/hinge_joint_bullet.cpp @@ -40,16 +40,16 @@ @author AndreaCatania */ -HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB) : +HingeJointBullet::HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &frameA, const Transform3D &frameB) : JointBullet() { - Transform scaled_AFrame(frameA.scaled(rbA->get_body_scale())); + Transform3D scaled_AFrame(frameA.scaled(rbA->get_body_scale())); scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis); btTransform btFrameA; G_TO_B(scaled_AFrame, btFrameA); if (rbB) { - Transform scaled_BFrame(frameB.scaled(rbB->get_body_scale())); + Transform3D scaled_BFrame(frameB.scaled(rbB->get_body_scale())); scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis); btTransform btFrameB; diff --git a/modules/bullet/hinge_joint_bullet.h b/modules/bullet/hinge_joint_bullet.h index 06a95be374..dd0f69ba68 100644 --- a/modules/bullet/hinge_joint_bullet.h +++ b/modules/bullet/hinge_joint_bullet.h @@ -41,7 +41,7 @@ class HingeJointBullet : public JointBullet { class btHingeConstraint *hingeConstraint; public: - HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameA, const Transform &frameB); + HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &frameA, const Transform3D &frameB); HingeJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Vector3 &pivotInA, const Vector3 &pivotInB, const Vector3 &axisInA, const Vector3 &axisInB); virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_HINGE; } diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp index 675da1a597..def978cf14 100644 --- a/modules/bullet/rigid_body_bullet.cpp +++ b/modules/bullet/rigid_body_bullet.cpp @@ -106,11 +106,11 @@ Vector3 BulletPhysicsDirectBodyState3D::get_angular_velocity() const { return body->get_angular_velocity(); } -void BulletPhysicsDirectBodyState3D::set_transform(const Transform &p_transform) { +void BulletPhysicsDirectBodyState3D::set_transform(const Transform3D &p_transform) { body->set_transform(p_transform); } -Transform BulletPhysicsDirectBodyState3D::get_transform() const { +Transform3D BulletPhysicsDirectBodyState3D::get_transform() const { return body->get_transform(); } diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h index 843ff4a7af..606df7134b 100644 --- a/modules/bullet/rigid_body_bullet.h +++ b/modules/bullet/rigid_body_bullet.h @@ -107,8 +107,8 @@ public: virtual void set_angular_velocity(const Vector3 &p_velocity) override; virtual Vector3 get_angular_velocity() const override; - virtual void set_transform(const Transform &p_transform) override; - virtual Transform get_transform() const override; + virtual void set_transform(const Transform3D &p_transform) override; + virtual Transform3D get_transform() const override; virtual void add_central_force(const Vector3 &p_force) override; virtual void add_force(const Vector3 &p_force, const Vector3 &p_position = Vector3()) override; diff --git a/modules/bullet/slider_joint_bullet.cpp b/modules/bullet/slider_joint_bullet.cpp index 45c892851b..1d83118468 100644 --- a/modules/bullet/slider_joint_bullet.cpp +++ b/modules/bullet/slider_joint_bullet.cpp @@ -40,16 +40,16 @@ @author AndreaCatania */ -SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB) : +SliderJointBullet::SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &frameInA, const Transform3D &frameInB) : JointBullet() { - Transform scaled_AFrame(frameInA.scaled(rbA->get_body_scale())); + Transform3D scaled_AFrame(frameInA.scaled(rbA->get_body_scale())); scaled_AFrame.basis.rotref_posscale_decomposition(scaled_AFrame.basis); btTransform btFrameA; G_TO_B(scaled_AFrame, btFrameA); if (rbB) { - Transform scaled_BFrame(frameInB.scaled(rbB->get_body_scale())); + Transform3D scaled_BFrame(frameInB.scaled(rbB->get_body_scale())); scaled_BFrame.basis.rotref_posscale_decomposition(scaled_BFrame.basis); btTransform btFrameB; @@ -70,44 +70,44 @@ const RigidBodyBullet *SliderJointBullet::getRigidBodyB() const { return static_cast(sliderConstraint->getRigidBodyB().getUserPointer()); } -const Transform SliderJointBullet::getCalculatedTransformA() const { +const Transform3D SliderJointBullet::getCalculatedTransformA() const { btTransform btTransform = sliderConstraint->getCalculatedTransformA(); - Transform gTrans; + Transform3D gTrans; B_TO_G(btTransform, gTrans); return gTrans; } -const Transform SliderJointBullet::getCalculatedTransformB() const { +const Transform3D SliderJointBullet::getCalculatedTransformB() const { btTransform btTransform = sliderConstraint->getCalculatedTransformB(); - Transform gTrans; + Transform3D gTrans; B_TO_G(btTransform, gTrans); return gTrans; } -const Transform SliderJointBullet::getFrameOffsetA() const { +const Transform3D SliderJointBullet::getFrameOffsetA() const { btTransform btTransform = sliderConstraint->getFrameOffsetA(); - Transform gTrans; + Transform3D gTrans; B_TO_G(btTransform, gTrans); return gTrans; } -const Transform SliderJointBullet::getFrameOffsetB() const { +const Transform3D SliderJointBullet::getFrameOffsetB() const { btTransform btTransform = sliderConstraint->getFrameOffsetB(); - Transform gTrans; + Transform3D gTrans; B_TO_G(btTransform, gTrans); return gTrans; } -Transform SliderJointBullet::getFrameOffsetA() { +Transform3D SliderJointBullet::getFrameOffsetA() { btTransform btTransform = sliderConstraint->getFrameOffsetA(); - Transform gTrans; + Transform3D gTrans; B_TO_G(btTransform, gTrans); return gTrans; } -Transform SliderJointBullet::getFrameOffsetB() { +Transform3D SliderJointBullet::getFrameOffsetB() { btTransform btTransform = sliderConstraint->getFrameOffsetB(); - Transform gTrans; + Transform3D gTrans; B_TO_G(btTransform, gTrans); return gTrans; } diff --git a/modules/bullet/slider_joint_bullet.h b/modules/bullet/slider_joint_bullet.h index 90964671c2..0c93558449 100644 --- a/modules/bullet/slider_joint_bullet.h +++ b/modules/bullet/slider_joint_bullet.h @@ -44,18 +44,18 @@ class SliderJointBullet : public JointBullet { public: /// Reference frame is A - SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform &frameInA, const Transform &frameInB); + SliderJointBullet(RigidBodyBullet *rbA, RigidBodyBullet *rbB, const Transform3D &frameInA, const Transform3D &frameInB); virtual PhysicsServer3D::JointType get_type() const { return PhysicsServer3D::JOINT_SLIDER; } const RigidBodyBullet *getRigidBodyA() const; const RigidBodyBullet *getRigidBodyB() const; - const Transform getCalculatedTransformA() const; - const Transform getCalculatedTransformB() const; - const Transform getFrameOffsetA() const; - const Transform getFrameOffsetB() const; - Transform getFrameOffsetA(); - Transform getFrameOffsetB(); + const Transform3D getCalculatedTransformA() const; + const Transform3D getCalculatedTransformB() const; + const Transform3D getFrameOffsetA() const; + const Transform3D getFrameOffsetB() const; + Transform3D getFrameOffsetA(); + Transform3D getFrameOffsetB(); real_t getLowerLinLimit() const; void setLowerLinLimit(real_t lowerLimit); real_t getUpperLinLimit() const; diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 2c8727baf2..bbbb0e7851 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -136,7 +136,7 @@ void SoftBodyBullet::destroy_soft_body() { bt_soft_body = nullptr; } -void SoftBodyBullet::set_soft_transform(const Transform &p_transform) { +void SoftBodyBullet::set_soft_transform(const Transform3D &p_transform) { reset_all_node_positions(); move_all_nodes(p_transform); } @@ -159,7 +159,7 @@ AABB SoftBodyBullet::get_bounds() const { return aabb; } -void SoftBodyBullet::move_all_nodes(const Transform &p_transform) { +void SoftBodyBullet::move_all_nodes(const Transform3D &p_transform) { if (!bt_soft_body) { return; } diff --git a/modules/bullet/soft_body_bullet.h b/modules/bullet/soft_body_bullet.h index 87023b2517..63708b57a7 100644 --- a/modules/bullet/soft_body_bullet.h +++ b/modules/bullet/soft_body_bullet.h @@ -104,11 +104,11 @@ public: void destroy_soft_body(); // Special function. This function has bad performance - void set_soft_transform(const Transform &p_transform); + void set_soft_transform(const Transform3D &p_transform); AABB get_bounds() const; - void move_all_nodes(const Transform &p_transform); + void move_all_nodes(const Transform3D &p_transform); void set_node_position(int node_index, const Vector3 &p_global_position); void set_node_position(int node_index, const btVector3 &p_global_position); void get_node_position(int node_index, Vector3 &r_position) const; diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index bdaec4a09e..712ecb3e22 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -117,7 +117,7 @@ bool BulletPhysicsDirectSpaceState::intersect_ray(const Vector3 &p_from, const V } } -int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { +int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Transform3D &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { if (p_result_max <= 0) { return 0; } @@ -152,7 +152,7 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra return btQuery.m_count; } -bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &r_closest_safe, real_t &r_closest_unsafe, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, ShapeRestInfo *r_info) { +bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transform3D &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &r_closest_safe, real_t &r_closest_unsafe, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas, ShapeRestInfo *r_info) { r_closest_safe = 0.0f; r_closest_unsafe = 0.0f; btVector3 bt_motion; @@ -214,7 +214,7 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf } /// Returns the list of contacts pairs in this order: Local contact, other body contact -bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { +bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform3D &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { if (p_result_max <= 0) { return false; } @@ -250,7 +250,7 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform & return btQuery.m_count; } -bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { +bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform3D &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set &p_exclude, uint32_t p_collision_mask, bool p_collide_with_bodies, bool p_collide_with_areas) { ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape); ERR_FAIL_COND_V(!shape, false); @@ -908,7 +908,7 @@ static Ref red_mat; static Ref blue_mat; #endif -bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes) { +bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform3D &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes) { #if debug_test_motion /// Yes I know this is not good, but I've used it as fast debugging hack. /// I'm leaving it here just for speedup the other eventual debugs @@ -1062,7 +1062,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f return has_penetration; } -int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, real_t p_margin) { +int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform3D &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, real_t p_margin) { btTransform body_transform; G_TO_B(p_transform, body_transform); UNSCALE_BT_BASIS(body_transform); diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h index 87aa2b9e93..36d0538e6b 100644 --- a/modules/bullet/space_bullet.h +++ b/modules/bullet/space_bullet.h @@ -78,11 +78,11 @@ public: virtual int intersect_point(const Vector3 &p_point, ShapeResult *r_results, int p_result_max, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) override; virtual bool intersect_ray(const Vector3 &p_from, const Vector3 &p_to, RayResult &r_result, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, bool p_pick_ray = false) override; - virtual int intersect_shape(const RID &p_shape, const Transform &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) override; - virtual bool cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &r_closest_safe, real_t &r_closest_unsafe, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = nullptr) override; + virtual int intersect_shape(const RID &p_shape, const Transform3D &p_xform, real_t p_margin, ShapeResult *r_results, int p_result_max, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) override; + virtual bool cast_motion(const RID &p_shape, const Transform3D &p_xform, const Vector3 &p_motion, real_t p_margin, real_t &r_closest_safe, real_t &r_closest_unsafe, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false, ShapeRestInfo *r_info = nullptr) override; /// Returns the list of contacts pairs in this order: Local contact, other body contact - virtual bool collide_shape(RID p_shape, const Transform &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) override; - virtual bool rest_info(RID p_shape, const Transform &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) override; + virtual bool collide_shape(RID p_shape, const Transform3D &p_shape_xform, real_t p_margin, Vector3 *r_results, int p_result_max, int &r_result_count, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) override; + virtual bool rest_info(RID p_shape, const Transform3D &p_shape_xform, real_t p_margin, ShapeRestInfo *r_info, const Set &p_exclude = Set(), uint32_t p_collision_mask = 0xFFFFFFFF, bool p_collide_with_bodies = true, bool p_collide_with_areas = false) override; virtual Vector3 get_closest_point_to_object_volume(RID p_object, const Vector3 p_point) const override; }; @@ -188,8 +188,8 @@ public: real_t get_linear_damp() const { return linear_damp; } real_t get_angular_damp() const { return angular_damp; } - bool test_body_motion(RigidBodyBullet *p_body, const Transform &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes); - int test_ray_separation(RigidBodyBullet *p_body, const Transform &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, real_t p_margin); + bool test_body_motion(RigidBodyBullet *p_body, const Transform3D &p_from, const Vector3 &p_motion, bool p_infinite_inertia, PhysicsServer3D::MotionResult *r_result, bool p_exclude_raycast_shapes); + int test_ray_separation(RigidBodyBullet *p_body, const Transform3D &p_transform, bool p_infinite_inertia, Vector3 &r_recover_motion, PhysicsServer3D::SeparationResult *r_results, int p_result_max, real_t p_margin); private: void create_empty_world(bool p_create_soft_world); diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp index 7387842259..5a37486568 100644 --- a/modules/csg/csg.cpp +++ b/modules/csg/csg.cpp @@ -265,7 +265,7 @@ void CSGBrush::build_from_faces(const Vector &p_vertices, const Vector< _regen_face_aabbs(); } -void CSGBrush::copy_from(const CSGBrush &p_brush, const Transform &p_xform) { +void CSGBrush::copy_from(const CSGBrush &p_brush, const Transform3D &p_xform) { faces = p_brush.faces; materials = p_brush.materials; diff --git a/modules/csg/csg.h b/modules/csg/csg.h index 3fbed66e5c..37a11eea90 100644 --- a/modules/csg/csg.h +++ b/modules/csg/csg.h @@ -60,7 +60,7 @@ struct CSGBrush { // Create a brush from faces. void build_from_faces(const Vector &p_vertices, const Vector &p_uvs, const Vector &p_smooth, const Vector> &p_materials, const Vector &p_invert_faces); - void copy_from(const CSGBrush &p_brush, const Transform &p_xform); + void copy_from(const CSGBrush &p_brush, const Transform3D &p_xform); }; struct CSGBrushOperation { @@ -165,8 +165,8 @@ struct CSGBrushOperation { Vector vertices; Vector faces; Plane plane; - Transform to_2D; - Transform to_3D; + Transform3D to_2D; + Transform3D to_3D; float vertex_snap2 = 0.0; inline int _get_point_idx(const Vector2 &p_point); diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 8a46dcca65..37a7d96de5 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -99,9 +99,9 @@ Variant CSGShape3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int void CSGShape3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) { CSGShape3D *cs = Object::cast_to(p_gizmo->get_spatial_node()); - Transform gt = cs->get_global_transform(); + Transform3D gt = cs->get_global_transform(); //gt.orthonormalize(); - Transform gi = gt.affine_inverse(); + Transform3D gi = gt.affine_inverse(); Vector3 ray_from = p_camera->project_ray_origin(p_point); Vector3 ray_dir = p_camera->project_ray_normal(p_point); diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 67dfdfb5eb..d6690bb96c 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -578,7 +578,7 @@ Array CSGShape3D::get_meshes() const { if (root_mesh.is_valid()) { Array arr; arr.resize(2); - arr[0] = Transform(); + arr[0] = Transform3D(); arr[1] = root_mesh; return arr; } @@ -1978,13 +1978,13 @@ CSGBrush *CSGPolygon3D::_build_brush() { float u1 = 0.0; float u2 = path_continuous_u ? 0.0 : 1.0; - Transform path_to_this; + Transform3D path_to_this; if (!path_local) { // center on paths origin path_to_this = get_global_transform().affine_inverse() * path->get_global_transform(); } - Transform prev_xf; + Transform3D prev_xf; Vector3 lookat_dir; @@ -2006,7 +2006,7 @@ CSGBrush *CSGPolygon3D::_build_brush() { ofs = 0.0; } - Transform xf; + Transform3D xf; xf.origin = curve->interpolate_baked(ofs); Vector3 local_dir; diff --git a/modules/fbx/README.md b/modules/fbx/README.md index 69a50d4bea..8eca4bd3c9 100644 --- a/modules/fbx/README.md +++ b/modules/fbx/README.md @@ -79,23 +79,23 @@ enum RotOrder { // references: ComputePivotTransform / run the calculation // This is the local pivot transform for the node, not the global transforms Transform ComputePivotTransform( - Transform chain[TransformationComp_MAXIMUM], - Transform &geometric_transform) { + Transform3D chain[TransformationComp_MAXIMUM], + Transform3D &geometric_transform) { // Maya pivots - Transform T = chain[TransformationComp_Translation]; - Transform Roff = chain[TransformationComp_RotationOffset]; - Transform Rp = chain[TransformationComp_RotationPivot]; - Transform Rpre = chain[TransformationComp_PreRotation]; - Transform R = chain[TransformationComp_Rotation]; - Transform Rpost = chain[TransformationComp_PostRotation]; - Transform Soff = chain[TransformationComp_ScalingOffset]; - Transform Sp = chain[TransformationComp_ScalingPivot]; - Transform S = chain[TransformationComp_Scaling]; + Transform3D T = chain[TransformationComp_Translation]; + Transform3D Roff = chain[TransformationComp_RotationOffset]; + Transform3D Rp = chain[TransformationComp_RotationPivot]; + Transform3D Rpre = chain[TransformationComp_PreRotation]; + Transform3D R = chain[TransformationComp_Rotation]; + Transform3D Rpost = chain[TransformationComp_PostRotation]; + Transform3D Soff = chain[TransformationComp_ScalingOffset]; + Transform3D Sp = chain[TransformationComp_ScalingPivot]; + Transform3D S = chain[TransformationComp_Scaling]; // 3DS Max Pivots - Transform OT = chain[TransformationComp_GeometricTranslation]; - Transform OR = chain[TransformationComp_GeometricRotation]; - Transform OS = chain[TransformationComp_GeometricScaling]; + Transform3D OT = chain[TransformationComp_GeometricTranslation]; + Transform3D OR = chain[TransformationComp_GeometricRotation]; + Transform3D OS = chain[TransformationComp_GeometricScaling]; // Calculate 3DS max pivot transform - use geometric space (e.g doesn't effect children nodes only the current node) geometric_transform = OT * OR * OS; diff --git a/modules/fbx/data/pivot_transform.cpp b/modules/fbx/data/pivot_transform.cpp index f4055c830f..3e4e197fbf 100644 --- a/modules/fbx/data/pivot_transform.cpp +++ b/modules/fbx/data/pivot_transform.cpp @@ -116,8 +116,8 @@ void PivotTransform::ReadTransformChain() { } } -Transform PivotTransform::ComputeLocalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const { - Transform T, Roff, Rp, Soff, Sp, S; +Transform3D PivotTransform::ComputeLocalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const { + Transform3D T, Roff, Rp, Soff, Sp, S; // Here I assume this is the operation which needs done. // Its WorldTransform * V @@ -132,29 +132,29 @@ Transform PivotTransform::ComputeLocalTransform(Vector3 p_translation, Quat p_ro // Scaling node S.scale(p_scaling); // Rotation pivots - Transform Rpre = Transform(pre_rotation); - Transform R = Transform(p_rotation); - Transform Rpost = Transform(post_rotation); + Transform3D Rpre = Transform3D(pre_rotation); + Transform3D R = Transform3D(p_rotation); + Transform3D Rpost = Transform3D(post_rotation); return T * Roff * Rp * Rpre * R * Rpost.affine_inverse() * Rp.affine_inverse() * Soff * Sp * S * Sp.affine_inverse(); } -Transform PivotTransform::ComputeGlobalTransform(Transform t) const { +Transform3D PivotTransform::ComputeGlobalTransform(Transform3D t) const { Vector3 pos = t.origin; Vector3 scale = t.basis.get_scale(); Quat rot = t.basis.get_rotation_quat(); return ComputeGlobalTransform(pos, rot, scale); } -Transform PivotTransform::ComputeLocalTransform(Transform t) const { +Transform3D PivotTransform::ComputeLocalTransform(Transform3D t) const { Vector3 pos = t.origin; Vector3 scale = t.basis.get_scale(); Quat rot = t.basis.get_rotation_quat(); return ComputeLocalTransform(pos, rot, scale); } -Transform PivotTransform::ComputeGlobalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const { - Transform T, Roff, Rp, Soff, Sp, S; +Transform3D PivotTransform::ComputeGlobalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const { + Transform3D T, Roff, Rp, Soff, Sp, S; // Here I assume this is the operation which needs done. // Its WorldTransform * V @@ -170,26 +170,26 @@ Transform PivotTransform::ComputeGlobalTransform(Vector3 p_translation, Quat p_r S.scale(p_scaling); // Rotation pivots - Transform Rpre = Transform(pre_rotation); - Transform R = Transform(p_rotation); - Transform Rpost = Transform(post_rotation); + Transform3D Rpre = Transform3D(pre_rotation); + Transform3D R = Transform3D(p_rotation); + Transform3D Rpost = Transform3D(post_rotation); - Transform parent_global_xform; - Transform parent_local_scaling_m; + Transform3D parent_global_xform; + Transform3D parent_local_scaling_m; if (parent_transform.is_valid()) { parent_global_xform = parent_transform->GlobalTransform; parent_local_scaling_m = parent_transform->Local_Scaling_Matrix; } - Transform local_rotation_m, parent_global_rotation_m; + Transform3D local_rotation_m, parent_global_rotation_m; Quat parent_global_rotation = parent_global_xform.basis.get_rotation_quat(); parent_global_rotation_m.basis.set_quat(parent_global_rotation); local_rotation_m = Rpre * R * Rpost; //Basis parent_global_rotation = Basis(parent_global_xform.get_basis().get_rotation_quat().normalized()); - Transform local_shear_scaling, parent_shear_scaling, parent_shear_rotation, parent_shear_translation; + Transform3D local_shear_scaling, parent_shear_scaling, parent_shear_rotation, parent_shear_translation; Vector3 parent_translation = parent_global_xform.get_origin(); parent_shear_translation.origin = parent_translation; parent_shear_rotation = parent_shear_translation.affine_inverse() * parent_global_xform; @@ -197,26 +197,26 @@ Transform PivotTransform::ComputeGlobalTransform(Vector3 p_translation, Quat p_r local_shear_scaling = S; // Inherit type handler - we don't care about T here, just reordering RSrs etc. - Transform global_rotation_scale; + Transform3D global_rotation_scale; if (inherit_type == FBXDocParser::Transform_RrSs) { global_rotation_scale = parent_global_rotation_m * local_rotation_m * parent_shear_scaling * local_shear_scaling; } else if (inherit_type == FBXDocParser::Transform_RSrs) { global_rotation_scale = parent_global_rotation_m * parent_shear_scaling * local_rotation_m * local_shear_scaling; } else if (inherit_type == FBXDocParser::Transform_Rrs) { - Transform parent_global_shear_m_noLocal = parent_shear_scaling * parent_local_scaling_m.affine_inverse(); + Transform3D parent_global_shear_m_noLocal = parent_shear_scaling * parent_local_scaling_m.affine_inverse(); global_rotation_scale = parent_global_rotation_m * local_rotation_m * parent_global_shear_m_noLocal * local_shear_scaling; } - Transform local_transform = T * Roff * Rp * Rpre * R * Rpost.affine_inverse() * Rp.affine_inverse() * Soff * Sp * S * Sp.affine_inverse(); - //Transform local_translation_pivoted = Transform(Basis(), LocalTransform.origin); + Transform3D local_transform = T * Roff * Rp * Rpre * R * Rpost.affine_inverse() * Rp.affine_inverse() * Soff * Sp * S * Sp.affine_inverse(); + //Transform3D local_translation_pivoted = Transform3D(Basis(), LocalTransform.origin); - ERR_FAIL_COND_V_MSG(local_transform.basis.determinant() == 0, Transform(), "Det == 0 prevented in scene file"); + ERR_FAIL_COND_V_MSG(local_transform.basis.determinant() == 0, Transform3D(), "Det == 0 prevented in scene file"); // manual hack to force SSC not to be compensated for - until we can handle it properly with tests return parent_global_xform * local_transform; } void PivotTransform::ComputePivotTransform() { - Transform T, Roff, Rp, Soff, Sp, S; + Transform3D T, Roff, Rp, Soff, Sp, S; // Here I assume this is the operation which needs done. // Its WorldTransform * V @@ -237,26 +237,26 @@ void PivotTransform::ComputePivotTransform() { Local_Scaling_Matrix = S; // copy for when node / child is looking for the value of this. // Rotation pivots - Transform Rpre = Transform(pre_rotation); - Transform R = Transform(rotation); - Transform Rpost = Transform(post_rotation); + Transform3D Rpre = Transform3D(pre_rotation); + Transform3D R = Transform3D(rotation); + Transform3D Rpost = Transform3D(post_rotation); - Transform parent_global_xform; - Transform parent_local_scaling_m; + Transform3D parent_global_xform; + Transform3D parent_local_scaling_m; if (parent_transform.is_valid()) { parent_global_xform = parent_transform->GlobalTransform; parent_local_scaling_m = parent_transform->Local_Scaling_Matrix; } - Transform local_rotation_m, parent_global_rotation_m; + Transform3D local_rotation_m, parent_global_rotation_m; Quat parent_global_rotation = parent_global_xform.basis.get_rotation_quat(); parent_global_rotation_m.basis.set_quat(parent_global_rotation); local_rotation_m = Rpre * R * Rpost; //Basis parent_global_rotation = Basis(parent_global_xform.get_basis().get_rotation_quat().normalized()); - Transform local_shear_scaling, parent_shear_scaling, parent_shear_rotation, parent_shear_translation; + Transform3D local_shear_scaling, parent_shear_scaling, parent_shear_rotation, parent_shear_translation; Vector3 parent_translation = parent_global_xform.get_origin(); parent_shear_translation.origin = parent_translation; parent_shear_rotation = parent_shear_translation.affine_inverse() * parent_global_xform; @@ -264,24 +264,24 @@ void PivotTransform::ComputePivotTransform() { local_shear_scaling = S; // Inherit type handler - we don't care about T here, just reordering RSrs etc. - Transform global_rotation_scale; + Transform3D global_rotation_scale; if (inherit_type == FBXDocParser::Transform_RrSs) { global_rotation_scale = parent_global_rotation_m * local_rotation_m * parent_shear_scaling * local_shear_scaling; } else if (inherit_type == FBXDocParser::Transform_RSrs) { global_rotation_scale = parent_global_rotation_m * parent_shear_scaling * local_rotation_m * local_shear_scaling; } else if (inherit_type == FBXDocParser::Transform_Rrs) { - Transform parent_global_shear_m_noLocal = parent_shear_scaling * parent_local_scaling_m.inverse(); + Transform3D parent_global_shear_m_noLocal = parent_shear_scaling * parent_local_scaling_m.inverse(); global_rotation_scale = parent_global_rotation_m * local_rotation_m * parent_global_shear_m_noLocal * local_shear_scaling; } - LocalTransform = Transform(); + LocalTransform = Transform3D(); LocalTransform = T * Roff * Rp * Rpre * R * Rpost.affine_inverse() * Rp.affine_inverse() * Soff * Sp * S * Sp.affine_inverse(); ERR_FAIL_COND_MSG(LocalTransform.basis.determinant() == 0, "invalid scale reset"); - Transform local_translation_pivoted = Transform(Basis(), LocalTransform.origin); - GlobalTransform = Transform(); + Transform3D local_translation_pivoted = Transform3D(Basis(), LocalTransform.origin); + GlobalTransform = Transform3D(); //GlobalTransform = parent_global_xform * LocalTransform; - Transform global_origin = Transform(Basis(), parent_translation); + Transform3D global_origin = Transform3D(Basis(), parent_translation); GlobalTransform = (global_origin * local_translation_pivoted) * global_rotation_scale; ImportUtils::debug_xform("local xform calculation", LocalTransform); diff --git a/modules/fbx/data/pivot_transform.h b/modules/fbx/data/pivot_transform.h index 9996027870..c3b6accd5b 100644 --- a/modules/fbx/data/pivot_transform.h +++ b/modules/fbx/data/pivot_transform.h @@ -85,10 +85,10 @@ struct PivotTransform : Reference, ModelAbstraction { print_verbose("raw post_rotation " + raw_post_rotation * (180 / Math_PI)); } - Transform ComputeGlobalTransform(Transform t) const; - Transform ComputeLocalTransform(Transform t) const; - Transform ComputeGlobalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const; - Transform ComputeLocalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const; + Transform3D ComputeGlobalTransform(Transform3D t) const; + Transform3D ComputeLocalTransform(Transform3D t) const; + Transform3D ComputeGlobalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const; + Transform3D ComputeLocalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const; /* Extract into xforms and calculate once */ void ComputePivotTransform(); @@ -105,10 +105,10 @@ struct PivotTransform : Reference, ModelAbstraction { //Transform chain[TransformationComp_MAXIMUM]; // cached for later use - Transform GlobalTransform = Transform(); - Transform LocalTransform = Transform(); - Transform Local_Scaling_Matrix = Transform(); // used for inherit type. - Transform GeometricTransform = Transform(); // 3DS max only + Transform3D GlobalTransform = Transform3D(); + Transform3D LocalTransform = Transform3D(); + Transform3D Local_Scaling_Matrix = Transform3D(); // used for inherit type. + Transform3D GeometricTransform = Transform3D(); // 3DS max only FBXDocParser::TransformInheritance inherit_type = FBXDocParser::TransformInheritance_MAX; // maya fbx requires this - sorry <3 }; diff --git a/modules/fbx/editor_scene_importer_fbx.cpp b/modules/fbx/editor_scene_importer_fbx.cpp index f60277f60a..b9eaedb8a6 100644 --- a/modules/fbx/editor_scene_importer_fbx.cpp +++ b/modules/fbx/editor_scene_importer_fbx.cpp @@ -1023,7 +1023,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene( bone = state.fbx_bone_map[target_id]; } - Transform target_transform; + Transform3D target_transform; if (state.fbx_target_map.has(target_id)) { Ref node_ref = state.fbx_target_map[target_id]; @@ -1165,7 +1165,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene( } bool valid_rest = false; - Transform bone_rest; + Transform3D bone_rest; int skeleton_bone = -1; if (state.fbx_bone_map.has(target_id)) { if (bone.is_valid() && bone->fbx_skeleton.is_valid()) { @@ -1208,10 +1208,10 @@ Node3D *EditorSceneImporterFBX::_generate_scene( // node animations must also include pivots if (skeleton_bone >= 0) { - Transform xform = Transform(); + Transform3D xform = Transform3D(); xform.basis.set_quat_scale(rot, scale); xform.origin = pos; - const Transform t = bone_rest.affine_inverse() * xform; + const Transform3D t = bone_rest.affine_inverse() * xform; // populate this again rot = t.basis.get_rotation_quat(); diff --git a/modules/fbx/fbx_parser/FBXDocument.h b/modules/fbx/fbx_parser/FBXDocument.h index e01e0471aa..8aa4cdf479 100644 --- a/modules/fbx/fbx_parser/FBXDocument.h +++ b/modules/fbx/fbx_parser/FBXDocument.h @@ -242,13 +242,13 @@ public: return target_id; } - Transform GetBindPose() const { + Transform3D GetBindPose() const { return transform; } private: uint64_t target_id = 0; - Transform transform; + Transform3D transform; }; /** DOM base class for FBX cameras attached to a node */ @@ -905,11 +905,11 @@ public: } /** */ - const Transform &GetTransform() const { + const Transform3D &GetTransform() const { return transform; } - const Transform &TransformLink() const { + const Transform3D &TransformLink() const { return transformLink; } @@ -917,7 +917,7 @@ public: return node; } - const Transform &TransformAssociateModel() const { + const Transform3D &TransformAssociateModel() const { return transformAssociateModel; } @@ -941,9 +941,9 @@ private: std::vector weights; std::vector indices; - Transform transform; - Transform transformLink; - Transform transformAssociateModel; + Transform3D transform; + Transform3D transformLink; + Transform3D transformAssociateModel; SkinLinkMode link_mode; bool valid_transformAssociateModel = false; const Model *node = nullptr; diff --git a/modules/fbx/fbx_parser/FBXParser.cpp b/modules/fbx/fbx_parser/FBXParser.cpp index 98435b5c0f..2d8b190779 100644 --- a/modules/fbx/fbx_parser/FBXParser.cpp +++ b/modules/fbx/fbx_parser/FBXParser.cpp @@ -1157,7 +1157,7 @@ void ParseVectorDataArray(std::vector &out, const ElementPtr el) { } // ------------------------------------------------------------------------------------------------ -Transform ReadMatrix(const ElementPtr element) { +Transform3D ReadMatrix(const ElementPtr element) { std::vector values; ParseVectorDataArray(values, element); @@ -1172,7 +1172,7 @@ Transform ReadMatrix(const ElementPtr element) { } } - Transform xform; + Transform3D xform; Basis basis; basis.set( diff --git a/modules/fbx/fbx_parser/FBXParser.h b/modules/fbx/fbx_parser/FBXParser.h index 8b248e8791..d1f1f93d5f 100644 --- a/modules/fbx/fbx_parser/FBXParser.h +++ b/modules/fbx/fbx_parser/FBXParser.h @@ -264,7 +264,7 @@ TokenPtr GetRequiredToken(const ElementPtr el, unsigned int index); // ------------------------------------------------------------------------------------------------ // read a 4x4 matrix from an array of 16 floats -Transform ReadMatrix(const ElementPtr element); +Transform3D ReadMatrix(const ElementPtr element); } // namespace FBXDocParser #endif // FBX_PARSER_H diff --git a/modules/fbx/tools/import_utils.cpp b/modules/fbx/tools/import_utils.cpp index 368aa09a75..259000d2a4 100644 --- a/modules/fbx/tools/import_utils.cpp +++ b/modules/fbx/tools/import_utils.cpp @@ -121,9 +121,9 @@ Vector3 ImportUtils::QuaternionToEuler(FBXDocParser::Model::RotOrder mode, const return BasisToEuler(mode, p_rotation); } -Transform get_unscaled_transform(const Transform &p_initial, real_t p_scale) { - Transform unscaled = Transform(p_initial.basis, p_initial.origin * p_scale); - ERR_FAIL_COND_V_MSG(unscaled.basis.determinant() == 0, Transform(), "det is zero unscaled?"); +Transform3D get_unscaled_transform(const Transform3D &p_initial, real_t p_scale) { + Transform3D unscaled = Transform3D(p_initial.basis, p_initial.origin * p_scale); + ERR_FAIL_COND_V_MSG(unscaled.basis.determinant() == 0, Transform3D(), "det is zero unscaled?"); return unscaled; } diff --git a/modules/fbx/tools/import_utils.h b/modules/fbx/tools/import_utils.h index cf0f811e35..3972f7520e 100644 --- a/modules/fbx/tools/import_utils.h +++ b/modules/fbx/tools/import_utils.h @@ -64,7 +64,7 @@ public: /// Converts quaternion into rotation order vector (in rad). static Vector3 QuaternionToEuler(FBXDocParser::Model::RotOrder mode, const Quat &p_rotation); - static void debug_xform(String name, const Transform &t) { + static void debug_xform(String name, const Transform3D &t) { print_verbose(name + " " + t.origin + " rotation: " + (t.basis.get_euler() * (180 / Math_PI))); } @@ -391,7 +391,7 @@ public: }; // Apply the transforms so the basis will have scale 1. -Transform get_unscaled_transform(const Transform &p_initial, real_t p_scale); +Transform3D get_unscaled_transform(const Transform3D &p_initial, real_t p_scale); /// Uses the Newell's method to compute any polygon normal. /// The polygon must be at least size of 3 or bigger. diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp index bfaaa13db2..1a6be4b521 100644 --- a/modules/gdnative/gdnative/transform.cpp +++ b/modules/gdnative/gdnative/transform.cpp @@ -32,18 +32,18 @@ #include "core/math/transform.h" -static_assert(sizeof(godot_transform) == sizeof(Transform), "Transform size mismatch"); +static_assert(sizeof(godot_transform) == sizeof(Transform3D), "Transform3D size mismatch"); #ifdef __cplusplus extern "C" { #endif void GDAPI godot_transform_new(godot_transform *p_self) { - memnew_placement(p_self, Transform); + memnew_placement(p_self, Transform3D); } void GDAPI godot_transform_new_copy(godot_transform *r_dest, const godot_transform *p_src) { - memnew_placement(r_dest, Transform(*(Transform *)p_src)); + memnew_placement(r_dest, Transform3D(*(Transform3D *)p_src)); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 7801e21ab2..1256d05c24 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -163,7 +163,7 @@ void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_b void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans) { Variant *dest = (Variant *)r_dest; - const Transform *trans = (const Transform *)p_trans; + const Transform3D *trans = (const Transform3D *)p_trans; memnew_placement_custom(dest, Variant, Variant(*trans)); } @@ -405,7 +405,7 @@ godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self) { godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self) { godot_transform raw_dest; const Variant *self = (const Variant *)p_self; - Transform *dest = (Transform *)&raw_dest; + Transform3D *dest = (Transform3D *)&raw_dest; *dest = *self; return raw_dest; } diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index d08bde9e23..cf19c0c44c 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -363,7 +363,7 @@ void unregister_gdnative_types() { print_line(String("aabb:\t") + itos(sizeof(AABB))); print_line(String("rid:\t") + itos(sizeof(RID))); print_line(String("string:\t") + itos(sizeof(String))); - print_line(String("transform:\t") + itos(sizeof(Transform))); + print_line(String("transform:\t") + itos(sizeof(Transform3D))); print_line(String("transfo2D:\t") + itos(sizeof(Transform2D))); print_line(String("variant:\t") + itos(sizeof(Variant))); print_line(String("vector2:\t") + itos(sizeof(Vector2))); diff --git a/modules/gdnative/xr/xr_interface_gdnative.cpp b/modules/gdnative/xr/xr_interface_gdnative.cpp index 122cb5849b..21bd3093a4 100644 --- a/modules/gdnative/xr/xr_interface_gdnative.cpp +++ b/modules/gdnative/xr/xr_interface_gdnative.cpp @@ -173,14 +173,14 @@ Size2 XRInterfaceGDNative::get_render_targetsize() { return *vec; } -Transform XRInterfaceGDNative::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) { - Transform *ret; +Transform3D XRInterfaceGDNative::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) { + Transform3D *ret; - ERR_FAIL_COND_V(interface == nullptr, Transform()); + ERR_FAIL_COND_V(interface == nullptr, Transform3D()); godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform); - ret = (Transform *)&t; + ret = (Transform3D *)&t; return *ret; } @@ -243,13 +243,13 @@ godot_float GDAPI godot_xr_get_worldscale() { godot_transform GDAPI godot_xr_get_reference_frame() { godot_transform reference_frame; - Transform *reference_frame_ptr = (Transform *)&reference_frame; + Transform3D *reference_frame_ptr = (Transform3D *)&reference_frame; XRServer *xr_server = XRServer::get_singleton(); if (xr_server != nullptr) { *reference_frame_ptr = xr_server->get_reference_frame(); } else { - memnew_placement(&reference_frame, Transform); + memnew_placement(&reference_frame, Transform3D); } return reference_frame; @@ -362,7 +362,7 @@ void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_tr Ref tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, p_controller_id); if (tracker.is_valid()) { - Transform *transform = (Transform *)p_transform; + Transform3D *transform = (Transform3D *)p_transform; if (p_tracks_orientation) { tracker->set_orientation(transform->basis); } diff --git a/modules/gdnative/xr/xr_interface_gdnative.h b/modules/gdnative/xr/xr_interface_gdnative.h index 84bd8fc731..42098ebeff 100644 --- a/modules/gdnative/xr/xr_interface_gdnative.h +++ b/modules/gdnative/xr/xr_interface_gdnative.h @@ -73,7 +73,7 @@ public: /** rendering and internal **/ virtual Size2 get_render_targetsize() override; virtual bool is_stereo() override; - virtual Transform get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) override; + virtual Transform3D get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) override; // we expose a Vector version of this function to GDNative Vector _get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); diff --git a/modules/gdnavigation/gd_navigation_server.cpp b/modules/gdnavigation/gd_navigation_server.cpp index 88ef434e0f..d5e6e5e69f 100644 --- a/modules/gdnavigation/gd_navigation_server.cpp +++ b/modules/gdnavigation/gd_navigation_server.cpp @@ -270,7 +270,7 @@ COMMAND_2(region_set_map, RID, p_region, RID, p_map) { } } -COMMAND_2(region_set_transform, RID, p_region, Transform, p_transform) { +COMMAND_2(region_set_transform, RID, p_region, Transform3D, p_transform) { NavRegion *region = region_owner.getornull(p_region); ERR_FAIL_COND(region == nullptr); diff --git a/modules/gdnavigation/gd_navigation_server.h b/modules/gdnavigation/gd_navigation_server.h index 2f51f6431e..759d15e508 100644 --- a/modules/gdnavigation/gd_navigation_server.h +++ b/modules/gdnavigation/gd_navigation_server.h @@ -113,7 +113,7 @@ public: COMMAND_2(region_set_map, RID, p_region, RID, p_map); COMMAND_2(region_set_layers, RID, p_region, uint32_t, p_layers); virtual uint32_t region_get_layers(RID p_region) const; - COMMAND_2(region_set_transform, RID, p_region, Transform, p_transform); + COMMAND_2(region_set_transform, RID, p_region, Transform3D, p_transform); COMMAND_2(region_set_navmesh, RID, p_region, Ref, p_nav_mesh); virtual void region_bake_navmesh(Ref r_mesh, Node *p_node) const; virtual int region_get_connections_count(RID p_region) const; diff --git a/modules/gdnavigation/nav_region.cpp b/modules/gdnavigation/nav_region.cpp index c1690b2a4b..81b15a49f5 100644 --- a/modules/gdnavigation/nav_region.cpp +++ b/modules/gdnavigation/nav_region.cpp @@ -52,7 +52,7 @@ uint32_t NavRegion::get_layers() const { return layers; } -void NavRegion::set_transform(Transform p_transform) { +void NavRegion::set_transform(Transform3D p_transform) { transform = p_transform; polygons_dirty = true; } diff --git a/modules/gdnavigation/nav_region.h b/modules/gdnavigation/nav_region.h index 527b2500ac..f8b067e638 100644 --- a/modules/gdnavigation/nav_region.h +++ b/modules/gdnavigation/nav_region.h @@ -46,7 +46,7 @@ class NavRegion; class NavRegion : public NavRid { NavMap *map = nullptr; - Transform transform; + Transform3D transform; Ref mesh; uint32_t layers = 1; Vector connections; @@ -71,8 +71,8 @@ public: void set_layers(uint32_t p_layers); uint32_t get_layers() const; - void set_transform(Transform transform); - const Transform &get_transform() const { + void set_transform(Transform3D transform); + const Transform3D &get_transform() const { return transform; } diff --git a/modules/gdnavigation/navigation_mesh_generator.cpp b/modules/gdnavigation/navigation_mesh_generator.cpp index 7d30ce0f44..d69c9114b9 100644 --- a/modules/gdnavigation/navigation_mesh_generator.cpp +++ b/modules/gdnavigation/navigation_mesh_generator.cpp @@ -68,7 +68,7 @@ void NavigationMeshGenerator::_add_vertex(const Vector3 &p_vec3, Vector & p_verticies.push_back(p_vec3.z); } -void NavigationMeshGenerator::_add_mesh(const Ref &p_mesh, const Transform &p_xform, Vector &p_verticies, Vector &p_indices) { +void NavigationMeshGenerator::_add_mesh(const Ref &p_mesh, const Transform3D &p_xform, Vector &p_verticies, Vector &p_indices) { int current_vertex_count; for (int i = 0; i < p_mesh->get_surface_count(); i++) { @@ -123,7 +123,7 @@ void NavigationMeshGenerator::_add_mesh(const Ref &p_mesh, const Transform } } -void NavigationMeshGenerator::_add_faces(const PackedVector3Array &p_faces, const Transform &p_xform, Vector &p_verticies, Vector &p_indices) { +void NavigationMeshGenerator::_add_faces(const PackedVector3Array &p_faces, const Transform3D &p_xform, Vector &p_verticies, Vector &p_indices) { int face_count = p_faces.size() / 3; int current_vertex_count = p_verticies.size() / 3; @@ -138,7 +138,7 @@ void NavigationMeshGenerator::_add_faces(const PackedVector3Array &p_faces, cons } } -void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, Node *p_node, Vector &p_verticies, Vector &p_indices, int p_generate_from, uint32_t p_collision_mask, bool p_recurse_children) { +void NavigationMeshGenerator::_parse_geometry(Transform3D p_accumulated_transform, Node *p_node, Vector &p_verticies, Vector &p_indices, int p_generate_from, uint32_t p_collision_mask, bool p_recurse_children) { if (Object::cast_to(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { MeshInstance3D *mesh_instance = Object::cast_to(p_node); Ref mesh = mesh_instance->get_mesh(); @@ -169,7 +169,7 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, if (Object::cast_to(child)) { CollisionShape3D *col_shape = Object::cast_to(child); - Transform transform = p_accumulated_transform * static_body->get_transform() * col_shape->get_transform(); + Transform3D transform = p_accumulated_transform * static_body->get_transform() * col_shape->get_transform(); Ref mesh; Ref s = col_shape->get_shape(); @@ -251,7 +251,7 @@ void NavigationMeshGenerator::_parse_geometry(Transform p_accumulated_transform, if (Object::cast_to(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) { GridMap *gridmap_instance = Object::cast_to(p_node); Array meshes = gridmap_instance->get_meshes(); - Transform xform = gridmap_instance->get_transform(); + Transform3D xform = gridmap_instance->get_transform(); for (int i = 0; i < meshes.size(); i += 2) { Ref mesh = meshes[i + 1]; if (mesh.is_valid()) { @@ -513,7 +513,7 @@ void NavigationMeshGenerator::bake(Ref p_nav_mesh, Node *p_node) p_node->get_tree()->get_nodes_in_group(p_nav_mesh->get_source_group_name(), &parse_nodes); } - Transform navmesh_xform = Object::cast_to(p_node)->get_transform().affine_inverse(); + Transform3D navmesh_xform = Object::cast_to(p_node)->get_transform().affine_inverse(); for (const List::Element *E = parse_nodes.front(); E; E = E->next()) { int geometry_type = p_nav_mesh->get_parsed_geometry_type(); uint32_t collision_mask = p_nav_mesh->get_collision_mask(); diff --git a/modules/gdnavigation/navigation_mesh_generator.h b/modules/gdnavigation/navigation_mesh_generator.h index 88ccdb1c41..847c7d097b 100644 --- a/modules/gdnavigation/navigation_mesh_generator.h +++ b/modules/gdnavigation/navigation_mesh_generator.h @@ -50,9 +50,9 @@ protected: static void _bind_methods(); static void _add_vertex(const Vector3 &p_vec3, Vector &p_verticies); - static void _add_mesh(const Ref &p_mesh, const Transform &p_xform, Vector &p_verticies, Vector &p_indices); - static void _add_faces(const PackedVector3Array &p_faces, const Transform &p_xform, Vector &p_verticies, Vector &p_indices); - static void _parse_geometry(Transform p_accumulated_transform, Node *p_node, Vector &p_verticies, Vector &p_indices, int p_generate_from, uint32_t p_collision_mask, bool p_recurse_children); + static void _add_mesh(const Ref &p_mesh, const Transform3D &p_xform, Vector &p_verticies, Vector &p_indices); + static void _add_faces(const PackedVector3Array &p_faces, const Transform3D &p_xform, Vector &p_verticies, Vector &p_indices); + static void _parse_geometry(Transform3D p_accumulated_transform, Node *p_node, Vector &p_verticies, Vector &p_indices, int p_generate_from, uint32_t p_collision_mask, bool p_recurse_children); static void _convert_detail_mesh_to_native_navigation_mesh(const rcPolyMeshDetail *p_detail_mesh, Ref p_nav_mesh); static void _build_recast_navigation_mesh( diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 56b0f6db83..921cefb99e 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -169,7 +169,7 @@ void (*type_init_function_table[])(Variant *) = { &VariantInitializer::init, // QUAT. &VariantInitializer::init, // AABB. &VariantInitializer::init, // BASIS. - &VariantInitializer::init, // TRANSFORM. + &VariantInitializer::init, // TRANSFORM3D. &VariantInitializer::init, // COLOR. &VariantInitializer::init, // STRING_NAME. &VariantInitializer::init, // NODE_PATH. @@ -3153,7 +3153,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_TYPE_ADJUST(QUAT, Quat); OPCODE_TYPE_ADJUST(AABB, AABB); OPCODE_TYPE_ADJUST(BASIS, Basis); - OPCODE_TYPE_ADJUST(TRANSFORM, Transform); + OPCODE_TYPE_ADJUST(TRANSFORM, Transform3D); OPCODE_TYPE_ADJUST(COLOR, Color); OPCODE_TYPE_ADJUST(STRING_NAME, StringName); OPCODE_TYPE_ADJUST(NODE_PATH, NodePath); diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index abac0a2e17..6ca1c357c2 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -357,10 +357,10 @@ static Quat _arr_to_quat(const Array &p_array) { return Quat(p_array[0], p_array[1], p_array[2], p_array[3]); } -static Transform _arr_to_xform(const Array &p_array) { - ERR_FAIL_COND_V(p_array.size() != 16, Transform()); +static Transform3D _arr_to_xform(const Array &p_array) { + ERR_FAIL_COND_V(p_array.size() != 16, Transform3D()); - Transform xform; + Transform3D xform; xform.basis.set_axis(Vector3::AXIS_X, Vector3(p_array[0], p_array[1], p_array[2])); xform.basis.set_axis(Vector3::AXIS_Y, Vector3(p_array[4], p_array[5], p_array[6])); xform.basis.set_axis(Vector3::AXIS_Z, Vector3(p_array[8], p_array[9], p_array[10])); @@ -369,7 +369,7 @@ static Transform _arr_to_xform(const Array &p_array) { return xform; } -static Vector _xform_to_array(const Transform p_transform) { +static Vector _xform_to_array(const Transform3D p_transform) { Vector array; array.resize(16); Vector3 axis_x = p_transform.get_basis().get_axis(Vector3::AXIS_X); @@ -421,7 +421,7 @@ Error GLTFDocument::_serialize_nodes(Ref state) { } if (n->skeleton != -1 && n->skin < 0) { } - if (n->xform != Transform()) { + if (n->xform != Transform3D()) { node["matrix"] = _xform_to_array(n->xform); } @@ -1939,7 +1939,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_vec3(Ref state, c return state->accessors.size() - 1; } -GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref state, const Vector p_attribs, const bool p_for_vertex) { +GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref state, const Vector p_attribs, const bool p_for_vertex) { if (p_attribs.size() == 0) { return -1; } @@ -1953,7 +1953,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_xform(Ref state, Vector type_min; type_min.resize(element_count); for (int i = 0; i < p_attribs.size(); i++) { - Transform attrib = p_attribs[i]; + Transform3D attrib = p_attribs[i]; Basis basis = attrib.get_basis(); Vector3 axis_0 = basis.get_axis(Vector3::AXIS_X); @@ -2107,9 +2107,9 @@ Vector GLTFDocument::_decode_accessor_as_basis(Ref state, cons return ret; } -Vector GLTFDocument::_decode_accessor_as_xform(Ref state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { +Vector GLTFDocument::_decode_accessor_as_xform(Ref state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) { const Vector attribs = _decode_accessor(state, p_accessor, p_for_vertex); - Vector ret; + Vector ret; if (attribs.size() == 0) { return ret; @@ -4279,7 +4279,7 @@ Error GLTFDocument::_create_skins(Ref state) { GLTFNodeIndex node = gltf_skin->joints_original[joint_i]; String bone_name = state->nodes[node]->get_name(); - Transform xform; + Transform3D xform; if (has_ibms) { xform = gltf_skin->inverse_binds[joint_i]; } @@ -4323,8 +4323,8 @@ bool GLTFDocument::_skins_are_same(const Ref skin_a, const Ref skin_ return false; } - Transform a_xform = skin_a->get_bind_pose(i); - Transform b_xform = skin_b->get_bind_pose(i); + Transform3D a_xform = skin_a->get_bind_pose(i); + Transform3D b_xform = skin_b->get_bind_pose(i); if (a_xform != b_xform) { return false; @@ -5075,7 +5075,7 @@ GLTFSkeletonIndex GLTFDocument::_convert_skeleton(Ref state, Skeleton } void GLTFDocument::_convert_spatial(Ref state, Node3D *p_spatial, Ref p_node) { - Transform xform = p_spatial->get_transform(); + Transform3D xform = p_spatial->get_transform(); p_node->scale = xform.basis.get_scale(); p_node->rotation = xform.basis.get_rotation_quat(); p_node->translation = xform.origin; @@ -5240,7 +5240,7 @@ void GLTFDocument::_convert_grid_map_to_gltf(Node *p_scene_parent, const GLTFNod Vector3(cell_location.x, cell_location.y, cell_location.z)); EditorSceneImporterMeshNode3D *import_mesh_node = memnew(EditorSceneImporterMeshNode3D); import_mesh_node->set_mesh(grid_map->get_mesh_library()->get_item_mesh(cell)); - Transform cell_xform; + Transform3D cell_xform; cell_xform.basis.set_orthogonal_index( grid_map->get_cell_item_orientation( Vector3(cell_location.x, cell_location.y, cell_location.z))); @@ -5268,7 +5268,7 @@ void GLTFDocument::_convert_mult_mesh_instance_to_gltf(Node *p_scene_parent, con for (int32_t instance_i = 0; instance_i < multi_mesh->get_instance_count(); instance_i++) { GLTFNode *new_gltf_node = memnew(GLTFNode); - Transform transform; + Transform3D transform; if (multi_mesh->get_transform_format() == MultiMesh::TRANSFORM_2D) { Transform2D xform_2d = multi_mesh->get_instance_transform_2d(instance_i); transform.origin = @@ -5715,7 +5715,7 @@ void GLTFDocument::_import_animation(Ref state, AnimationPlayer *ap, } if (gltf_node->skeleton >= 0) { - Transform xform; + Transform3D xform; xform.basis.set_quat_scale(rot, scale); xform.origin = pos; @@ -5808,7 +5808,7 @@ void GLTFDocument::_convert_mesh_instances(Ref state) { } MeshInstance3D *mi = Object::cast_to(mi_element->get()); ERR_CONTINUE(!mi); - Transform mi_xform = mi->get_transform(); + Transform3D mi_xform = mi->get_transform(); node->scale = mi_xform.basis.get_scale(); node->rotation = mi_xform.basis.get_rotation_quat(); node->translation = mi_xform.origin; @@ -5872,7 +5872,7 @@ void GLTFDocument::_convert_mesh_instances(Ref state) { String gltf_bone_name = _gen_unique_bone_name(state, skeleton_gltf_i, godot_bone_name); joint_node->set_name(gltf_bone_name); - Transform bone_rest_xform = skeleton->get_bone_rest(bone_index); + Transform3D bone_rest_xform = skeleton->get_bone_rest(bone_index); joint_node->scale = bone_rest_xform.basis.get_scale(); joint_node->rotation = bone_rest_xform.basis.get_rotation_quat(); joint_node->translation = bone_rest_xform.origin; @@ -5995,12 +5995,12 @@ void GLTFDocument::_process_mesh_instances(Ref state, Node *scene_roo mi->set_skin(state->skins.write[skin_i]->godot_skin); mi->set_skeleton_path(mi->get_path_to(skeleton)); - mi->set_transform(Transform()); + mi->set_transform(Transform3D()); } } } -GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref state, GLTFAnimation::Track p_track, Ref p_animation, Transform p_bone_rest, int32_t p_track_i, GLTFNodeIndex p_node_i) { +GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref state, GLTFAnimation::Track p_track, Ref p_animation, Transform3D p_bone_rest, int32_t p_track_i, GLTFNodeIndex p_node_i) { Animation::InterpolationType interpolation = p_animation->track_get_interpolation_type(p_track_i); GLTFAnimation::Interpolation gltf_interpolation = GLTFAnimation::INTERP_LINEAR; @@ -6040,7 +6040,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref state Vector3 scale; Error err = p_animation->transform_track_get_key(p_track_i, key_i, &translation, &rotation, &scale); ERR_CONTINUE(err != OK); - Transform xform; + Transform3D xform; xform.basis.set_quat_scale(rotation, scale); xform.origin = translation; xform = p_bone_rest * xform; @@ -6063,7 +6063,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref state p_track.rotation_track.values.resize(key_count); p_track.rotation_track.interpolation = gltf_interpolation; for (int32_t key_i = 0; key_i < key_count; key_i++) { - Transform xform = p_animation->track_get_key_value(p_track_i, key_i); + Transform3D xform = p_animation->track_get_key_value(p_track_i, key_i); p_track.translation_track.values.write[key_i] = xform.get_origin(); p_track.rotation_track.values.write[key_i] = xform.basis.get_rotation_quat(); p_track.scale_track.values.write[key_i] = xform.basis.get_scale(); @@ -6210,7 +6210,7 @@ void GLTFDocument::_convert_animation(Ref state, AnimationPlayer *ap, if (translation_track_i) { track = translation_track_i->get(); } - track = _convert_animation_track(state, track, animation, Transform(), track_i, node_index); + track = _convert_animation_track(state, track, animation, Transform3D(), track_i, node_index); gltf_animation->get_tracks().insert(node_index, track); } } @@ -6226,7 +6226,7 @@ void GLTFDocument::_convert_animation(Ref state, AnimationPlayer *ap, if (rotation_degree_track_i) { track = rotation_degree_track_i->get(); } - track = _convert_animation_track(state, track, animation, Transform(), track_i, node_index); + track = _convert_animation_track(state, track, animation, Transform3D(), track_i, node_index); gltf_animation->get_tracks().insert(node_index, track); } } @@ -6242,7 +6242,7 @@ void GLTFDocument::_convert_animation(Ref state, AnimationPlayer *ap, if (scale_track_i) { track = scale_track_i->get(); } - track = _convert_animation_track(state, track, animation, Transform(), track_i, node_index); + track = _convert_animation_track(state, track, animation, Transform3D(), track_i, node_index); gltf_animation->get_tracks().insert(node_index, track); } } @@ -6253,7 +6253,7 @@ void GLTFDocument::_convert_animation(Ref state, AnimationPlayer *ap, for (Map::Element *transform_track_i = state->scene_nodes.front(); transform_track_i; transform_track_i = transform_track_i->next()) { if (transform_track_i->get() == node) { GLTFAnimation::Track track; - track = _convert_animation_track(state, track, animation, Transform(), track_i, transform_track_i->key()); + track = _convert_animation_track(state, track, animation, Transform3D(), track_i, transform_track_i->key()); gltf_animation->get_tracks().insert(transform_track_i->key(), track); } } @@ -6341,7 +6341,7 @@ void GLTFDocument::_convert_animation(Ref state, AnimationPlayer *ap, Ref skeleton_gltf = state->skeletons[skeleton_gltf_i]; int32_t bone = skeleton->find_bone(suffix); ERR_CONTINUE(bone == -1); - Transform xform = skeleton->get_bone_rest(bone); + Transform3D xform = skeleton->get_bone_rest(bone); if (!skeleton_gltf->godot_bone_node.has(bone)) { continue; } @@ -6368,7 +6368,7 @@ void GLTFDocument::_convert_animation(Ref state, AnimationPlayer *ap, if (node_track_i) { track = node_track_i->get(); } - track = _convert_animation_track(state, track, animation, Transform(), track_i, node_index); + track = _convert_animation_track(state, track, animation, Transform3D(), track_i, node_index); gltf_animation->get_tracks().insert(node_index, track); break; } diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index 900c367010..3076ddb8ad 100644 --- a/modules/gltf/gltf_document.h +++ b/modules/gltf/gltf_document.h @@ -214,7 +214,7 @@ private: Vector _decode_accessor_as_basis(Ref state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); - Vector _decode_accessor_as_xform(Ref state, + Vector _decode_accessor_as_xform(Ref state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex); Error _parse_meshes(Ref state); @@ -317,7 +317,7 @@ private: const Vector p_attribs, const bool p_for_vertex); GLTFAccessorIndex _encode_accessor_as_xform(Ref state, - const Vector p_attribs, + const Vector p_attribs, const bool p_for_vertex); Error _encode_buffer_view(Ref state, const double *src, const int count, const GLTFType type, @@ -333,7 +333,7 @@ private: String interpolation_to_string(const GLTFAnimation::Interpolation p_interp); GLTFAnimation::Track _convert_animation_track(Ref state, GLTFAnimation::Track p_track, - Ref p_animation, Transform p_bone_rest, + Ref p_animation, Transform3D p_bone_rest, int32_t p_track_i, GLTFNodeIndex p_node_i); Error _encode_buffer_bins(Ref state, const String &p_path); diff --git a/modules/gltf/gltf_node.cpp b/modules/gltf/gltf_node.cpp index f6f33ef009..c13b05b3c9 100644 --- a/modules/gltf/gltf_node.cpp +++ b/modules/gltf/gltf_node.cpp @@ -60,7 +60,7 @@ void GLTFNode::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "parent"), "set_parent", "get_parent"); // GLTFNodeIndex ADD_PROPERTY(PropertyInfo(Variant::INT, "height"), "set_height", "get_height"); // int - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "xform"), "set_xform", "get_xform"); // Transform + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "xform"), "set_xform", "get_xform"); // Transform3D ADD_PROPERTY(PropertyInfo(Variant::INT, "mesh"), "set_mesh", "get_mesh"); // GLTFMeshIndex ADD_PROPERTY(PropertyInfo(Variant::INT, "camera"), "set_camera", "get_camera"); // GLTFCameraIndex ADD_PROPERTY(PropertyInfo(Variant::INT, "skin"), "set_skin", "get_skin"); // GLTFSkinIndex @@ -89,11 +89,11 @@ void GLTFNode::set_height(int p_height) { height = p_height; } -Transform GLTFNode::get_xform() { +Transform3D GLTFNode::get_xform() { return xform; } -void GLTFNode::set_xform(Transform p_xform) { +void GLTFNode::set_xform(Transform3D p_xform) { xform = p_xform; } diff --git a/modules/gltf/gltf_node.h b/modules/gltf/gltf_node.h index 3a5689d004..6e6d9d5248 100644 --- a/modules/gltf/gltf_node.h +++ b/modules/gltf/gltf_node.h @@ -43,7 +43,7 @@ private: // matrices need to be transformed to this GLTFNodeIndex parent = -1; int height = -1; - Transform xform; + Transform3D xform; GLTFMeshIndex mesh = -1; GLTFCameraIndex camera = -1; GLTFSkinIndex skin = -1; @@ -65,8 +65,8 @@ public: int get_height(); void set_height(int p_height); - Transform get_xform(); - void set_xform(Transform p_xform); + Transform3D get_xform(); + void set_xform(Transform3D p_xform); GLTFMeshIndex get_mesh(); void set_mesh(GLTFMeshIndex p_mesh); diff --git a/modules/gltf/gltf_skin.cpp b/modules/gltf/gltf_skin.cpp index 5a61e5778c..5cf17135ac 100644 --- a/modules/gltf/gltf_skin.cpp +++ b/modules/gltf/gltf_skin.cpp @@ -54,7 +54,7 @@ void GLTFSkin::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "skin_root"), "set_skin_root", "get_skin_root"); // GLTFNodeIndex ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "joints_original"), "set_joints_original", "get_joints_original"); // Vector - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "inverse_binds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL), "set_inverse_binds", "get_inverse_binds"); // Vector + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "inverse_binds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL), "set_inverse_binds", "get_inverse_binds"); // Vector ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "joints"), "set_joints", "get_joints"); // Vector ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "non_joints"), "set_non_joints", "get_non_joints"); // Vector ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "roots"), "set_roots", "get_roots"); // Vector diff --git a/modules/gltf/gltf_skin.h b/modules/gltf/gltf_skin.h index 7cc09d85bc..e32e2d397c 100644 --- a/modules/gltf/gltf_skin.h +++ b/modules/gltf/gltf_skin.h @@ -43,7 +43,7 @@ private: GLTFNodeIndex skin_root = -1; Vector joints_original; - Vector inverse_binds; + Vector inverse_binds; // Note: joints + non_joints should form a complete subtree, or subtrees // with a common parent diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index eaceaac33c..45af59622f 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -446,7 +446,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { * and set said multimesh bounding box to one containing all cells which have this item */ - Map>> multimesh_items; + Map>> multimesh_items; for (Set::Element *E = g.cells.front(); E; E = E->next()) { ERR_CONTINUE(!cell_map.has(E->get())); @@ -459,7 +459,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { Vector3 cellpos = Vector3(E->get().x, E->get().y, E->get().z); Vector3 ofs = _get_offset(); - Transform xform; + Transform3D xform; xform.basis.set_orthogonal_index(c.rot); xform.set_origin(cellpos * cell_size + ofs); @@ -467,10 +467,10 @@ bool GridMap::_octant_update(const OctantKey &p_key) { if (baked_meshes.size() == 0) { if (mesh_library->get_item_mesh(c.item).is_valid()) { if (!multimesh_items.has(c.item)) { - multimesh_items[c.item] = List>(); + multimesh_items[c.item] = List>(); } - Pair p; + Pair p; p.first = xform; p.second = E->get(); multimesh_items[c.item].push_back(p); @@ -511,7 +511,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { //update multimeshes, only if not baked if (baked_meshes.size() == 0) { - for (Map>>::Element *E = multimesh_items.front(); E; E = E->next()) { + for (Map>>::Element *E = multimesh_items.front(); E; E = E->next()) { Octant::MultimeshInstance mmi; RID mm = RS::get_singleton()->multimesh_create(); @@ -519,7 +519,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid()); int idx = 0; - for (List>::Element *F = E->get().front(); F; F = F->next()) { + for (List>::Element *F = E->get().front(); F; F = F->next()) { RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F->get().first); #ifdef TOOLS_ENABLED @@ -672,7 +672,7 @@ void GridMap::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - Transform new_xform = get_global_transform(); + Transform3D new_xform = get_global_transform(); if (new_xform == last_transform) { break; } @@ -686,7 +686,6 @@ void GridMap::_notification(int p_what) { for (int i = 0; i < baked_meshes.size(); i++) { RS::get_singleton()->instance_set_transform(baked_meshes[i].instance, get_global_transform()); } - } break; case NOTIFICATION_EXIT_WORLD: { for (Map::Element *E = octant_map.front(); E; E = E->next()) { @@ -934,7 +933,7 @@ Array GridMap::get_meshes() { Vector3 cellpos = Vector3(ik.x, ik.y, ik.z); - Transform xform; + Transform3D xform; xform.basis.set_orthogonal_index(E->get().rot); @@ -988,7 +987,7 @@ void GridMap::make_baked_meshes(bool p_gen_lightmap_uv, float p_lightmap_uv_texe Vector3 cellpos = Vector3(key.x, key.y, key.z); Vector3 ofs = _get_offset(); - Transform xform; + Transform3D xform; xform.basis.set_orthogonal_index(E->get().rot); xform.set_origin(cellpos * cell_size + ofs); @@ -1057,7 +1056,7 @@ Array GridMap::get_bake_meshes() { Array arr; for (int i = 0; i < baked_meshes.size(); i++) { arr.push_back(baked_meshes[i].mesh); - arr.push_back(Transform()); + arr.push_back(Transform3D()); } return arr; diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 4c04d492f7..8cd82e1f4c 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -89,7 +89,7 @@ class GridMap : public Node3D { struct Octant { struct NavMesh { RID region; - Transform xform; + Transform3D xform; }; struct MultimeshInstance { @@ -97,7 +97,7 @@ class GridMap : public Node3D { RID multimesh; struct Item { int index = 0; - Transform transform; + Transform3D transform; IndexKey key; }; @@ -137,7 +137,7 @@ class GridMap : public Node3D { bool bake_navigation = false; uint32_t navigation_layers = 1; - Transform last_transform; + Transform3D last_transform; bool _in_tree = false; Vector3 cell_size = Vector3(2, 2, 2); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 813b4b9689..a47ed6652d 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -255,7 +255,7 @@ void GridMapEditor::_menu_option(int p_option) { } void GridMapEditor::_update_cursor_transform() { - cursor_transform = Transform(); + cursor_transform = Transform3D(); cursor_transform.origin = cursor_origin; cursor_transform.basis.set_orthogonal_index(cursor_rot); cursor_transform.basis *= node->get_cell_scale(); @@ -268,7 +268,7 @@ void GridMapEditor::_update_cursor_transform() { } void GridMapEditor::_update_selection_transform() { - Transform xf_zero; + Transform3D xf_zero; xf_zero.basis.set_zero(); if (!selection.active) { @@ -279,7 +279,7 @@ void GridMapEditor::_update_selection_transform() { return; } - Transform xf; + Transform3D xf; xf.scale((Vector3(1, 1, 1) + (selection.end - selection.begin)) * node->get_cell_size()); xf.origin = selection.begin * node->get_cell_size(); @@ -297,7 +297,7 @@ void GridMapEditor::_update_selection_transform() { scale *= node->get_cell_size(); position *= node->get_cell_size(); - Transform xf2; + Transform3D xf2; xf2.basis.scale(scale); xf2.origin = position; @@ -362,7 +362,7 @@ bool GridMapEditor::do_input_action(Camera3D *p_camera, const Point2 &p_point, b Camera3D *camera = p_camera; Vector3 from = camera->project_ray_origin(p_point); Vector3 normal = camera->project_ray_normal(p_point); - Transform local_xform = node->get_global_transform().affine_inverse(); + Transform3D local_xform = node->get_global_transform().affine_inverse(); Vector planes = camera->get_frustum(); from = local_xform.xform(from); normal = local_xform.basis.xform(normal).normalized(); @@ -540,7 +540,7 @@ void GridMapEditor::_set_clipboard_data() { void GridMapEditor::_update_paste_indicator() { if (input_action != INPUT_PASTE) { - Transform xf; + Transform3D xf; xf.basis.set_zero(); RenderingServer::get_singleton()->instance_set_transform(paste_instance, xf); return; @@ -548,7 +548,7 @@ void GridMapEditor::_update_paste_indicator() { Vector3 center = 0.5 * Vector3(real_t(node->get_center_x()), real_t(node->get_center_y()), real_t(node->get_center_z())); Vector3 scale = (Vector3(1, 1, 1) + (paste_indicator.end - paste_indicator.begin)) * node->get_cell_size(); - Transform xf; + Transform3D xf; xf.scale(scale); xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size(); Basis rot; @@ -561,7 +561,7 @@ void GridMapEditor::_update_paste_indicator() { for (List::Element *E = clipboard_items.front(); E; E = E->next()) { ClipboardItem &item = E->get(); - xf = Transform(); + xf = Transform3D(); xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size(); xf.basis = rot * xf.basis; xf.translate(item.grid_offset * node->get_cell_size()); @@ -1068,7 +1068,7 @@ void GridMapEditor::_notification(int p_what) { return; } - Transform xf = node->get_global_transform(); + Transform3D xf = node->get_global_transform(); if (xf != grid_xform) { for (int i = 0; i < 3; i++) { diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index 6c7f0bedf6..0e29c88d26 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -95,8 +95,8 @@ class GridMapEditor : public VBoxContainer { ClipMode clip_mode = CLIP_DISABLED; bool lock_view = false; - Transform grid_xform; - Transform edit_grid_xform; + Transform3D grid_xform; + Transform3D edit_grid_xform; Vector3::Axis edit_axis; int edit_floor[3]; Vector3 grid_ofs; @@ -146,7 +146,7 @@ class GridMapEditor : public VBoxContainer { PasteIndicator paste_indicator; bool cursor_visible = false; - Transform cursor_transform; + Transform3D cursor_transform; Vector3 cursor_origin; diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index 5140cfbbaf..a0731f90f3 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -361,10 +361,10 @@ Size2 MobileVRInterface::get_render_targetsize() { return target_size; }; -Transform MobileVRInterface::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) { +Transform3D MobileVRInterface::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) { _THREAD_SAFE_METHOD_ - Transform transform_for_eye; + Transform3D transform_for_eye; XRServer *xr_server = XRServer::get_singleton(); ERR_FAIL_NULL_V(xr_server, transform_for_eye); @@ -383,7 +383,7 @@ Transform MobileVRInterface::get_transform_for_eye(XRInterface::Eyes p_eye, cons }; // just scale our origin point of our transform - Transform hmd_transform; + Transform3D hmd_transform; hmd_transform.basis = orientation; hmd_transform.origin = Vector3(0.0, eye_height * world_scale, 0.0); diff --git a/modules/mobile_vr/mobile_vr_interface.h b/modules/mobile_vr/mobile_vr_interface.h index d28c2196af..aad40ebb5b 100644 --- a/modules/mobile_vr/mobile_vr_interface.h +++ b/modules/mobile_vr/mobile_vr_interface.h @@ -139,7 +139,7 @@ public: virtual Size2 get_render_targetsize() override; virtual bool is_stereo() override; - virtual Transform get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) override; + virtual Transform3D get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) override; virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) override; virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override; diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index b48e5df9eb..d4b04408ba 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -3124,8 +3124,8 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; } break; case Variant::TRANSFORM: { - Transform transform = p_val.operator Transform(); - if (transform == Transform()) { + Transform3D transform = p_val.operator Transform3D(); + if (transform == Transform3D()) { r_iarg.default_argument = "Transform.Identity"; } else { Basis basis = transform.basis; @@ -3197,7 +3197,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { INSERT_STRUCT_TYPE(Vector3i) INSERT_STRUCT_TYPE(Basis) INSERT_STRUCT_TYPE(Quat) - INSERT_STRUCT_TYPE(Transform) + INSERT_STRUCT_TYPE(Transform3D) INSERT_STRUCT_TYPE(AABB) INSERT_STRUCT_TYPE(Color) INSERT_STRUCT_TYPE(Plane) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs index ac47f6029f..9e5ff2b315 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs @@ -19,7 +19,7 @@ namespace Godot /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Transform : IEquatable + public struct Transform3D : IEquatable { /// /// The of this transform. Contains the X, Y, and Z basis @@ -107,10 +107,10 @@ namespace Godot /// the transformation is composed of rotation, scaling, and translation. /// /// The inverse transformation matrix. - public Transform AffineInverse() + public Transform3D AffineInverse() { Basis basisInv = basis.Inverse(); - return new Transform(basisInv, basisInv.Xform(-origin)); + return new Transform3D(basisInv, basisInv.Xform(-origin)); } /// @@ -119,7 +119,7 @@ namespace Godot /// The other transform. /// A value on the range of 0.0 to 1.0, representing the amount of interpolation. /// The interpolated transform. - public Transform InterpolateWith(Transform transform, real_t weight) + public Transform3D InterpolateWith(Transform3D transform, real_t weight) { /* not sure if very "efficient" but good enough? */ @@ -131,7 +131,7 @@ namespace Godot Quat destinationRotation = transform.basis.RotationQuat(); Vector3 destinationLocation = transform.origin; - var interpolated = new Transform(); + var interpolated = new Transform3D(); interpolated.basis.SetQuatScale(sourceRotation.Slerp(destinationRotation, weight).Normalized(), sourceScale.Lerp(destinationScale, weight)); interpolated.origin = sourceLocation.Lerp(destinationLocation, weight); @@ -144,10 +144,10 @@ namespace Godot /// (no scaling, use for transforms with scaling). /// /// The inverse matrix. - public Transform Inverse() + public Transform3D Inverse() { Basis basisTr = basis.Transposed(); - return new Transform(basisTr, basisTr.Xform(-origin)); + return new Transform3D(basisTr, basisTr.Xform(-origin)); } /// @@ -163,7 +163,7 @@ namespace Godot /// The object to look at. /// The relative up direction /// The resulting transform. - public Transform LookingAt(Vector3 target, Vector3 up) + public Transform3D LookingAt(Vector3 target, Vector3 up) { var t = this; t.SetLookAt(origin, target, up); @@ -175,9 +175,9 @@ namespace Godot /// and normalized axis vectors (scale of 1 or -1). /// /// The orthonormalized transform. - public Transform Orthonormalized() + public Transform3D Orthonormalized() { - return new Transform(basis.Orthonormalized(), origin); + return new Transform3D(basis.Orthonormalized(), origin); } /// @@ -187,9 +187,9 @@ namespace Godot /// The axis to rotate around. Must be normalized. /// The angle to rotate, in radians. /// The rotated transformation matrix. - public Transform Rotated(Vector3 axis, real_t phi) + public Transform3D Rotated(Vector3 axis, real_t phi) { - return new Transform(new Basis(axis, phi), new Vector3()) * this; + return new Transform3D(new Basis(axis, phi), new Vector3()) * this; } /// @@ -197,9 +197,9 @@ namespace Godot /// /// The scale to introduce. /// The scaled transformation matrix. - public Transform Scaled(Vector3 scale) + public Transform3D Scaled(Vector3 scale) { - return new Transform(basis.Scaled(scale), origin * scale); + return new Transform3D(basis.Scaled(scale), origin * scale); } private void SetLookAt(Vector3 eye, Vector3 target, Vector3 up) @@ -234,9 +234,9 @@ namespace Godot /// /// The offset to translate by. /// The translated matrix. - public Transform Translated(Vector3 offset) + public Transform3D Translated(Vector3 offset) { - return new Transform(basis, new Vector3 + return new Transform3D(basis, new Vector3 ( origin[0] += basis.Row0.Dot(offset), origin[1] += basis.Row1.Dot(offset), @@ -280,10 +280,10 @@ namespace Godot } // Constants - private static readonly Transform _identity = new Transform(Basis.Identity, Vector3.Zero); - private static readonly Transform _flipX = new Transform(new Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1), Vector3.Zero); - private static readonly Transform _flipY = new Transform(new Basis(1, 0, 0, 0, -1, 0, 0, 0, 1), Vector3.Zero); - private static readonly Transform _flipZ = new Transform(new Basis(1, 0, 0, 0, 1, 0, 0, 0, -1), Vector3.Zero); + private static readonly Transform3D _identity = new Transform3D(Basis.Identity, Vector3.Zero); + private static readonly Transform3D _flipX = new Transform3D(new Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1), Vector3.Zero); + private static readonly Transform3D _flipY = new Transform3D(new Basis(1, 0, 0, 0, -1, 0, 0, 0, 1), Vector3.Zero); + private static readonly Transform3D _flipZ = new Transform3D(new Basis(1, 0, 0, 0, 1, 0, 0, 0, -1), Vector3.Zero); /// /// The identity transform, with no translation, rotation, or scaling applied. @@ -291,22 +291,22 @@ namespace Godot /// Do not use `new Transform()` with no arguments in C#, because it sets all values to zero. /// /// Equivalent to `new Transform(Vector3.Right, Vector3.Up, Vector3.Back, Vector3.Zero)`. - public static Transform Identity { get { return _identity; } } + public static Transform3D Identity { get { return _identity; } } /// /// The transform that will flip something along the X axis. /// /// Equivalent to `new Transform(Vector3.Left, Vector3.Up, Vector3.Back, Vector3.Zero)`. - public static Transform FlipX { get { return _flipX; } } + public static Transform3D FlipX { get { return _flipX; } } /// /// The transform that will flip something along the Y axis. /// /// Equivalent to `new Transform(Vector3.Right, Vector3.Down, Vector3.Back, Vector3.Zero)`. - public static Transform FlipY { get { return _flipY; } } + public static Transform3D FlipY { get { return _flipY; } } /// /// The transform that will flip something along the Z axis. /// /// Equivalent to `new Transform(Vector3.Right, Vector3.Up, Vector3.Forward, Vector3.Zero)`. - public static Transform FlipZ { get { return _flipZ; } } + public static Transform3D FlipZ { get { return _flipZ; } } /// /// Constructs a transformation matrix from 4 vectors (matrix columns). @@ -315,7 +315,7 @@ namespace Godot /// The Y vector, or column index 1. /// The Z vector, or column index 2. /// The origin vector, or column index 3. - public Transform(Vector3 column0, Vector3 column1, Vector3 column2, Vector3 origin) + public Transform3D(Vector3 column0, Vector3 column1, Vector3 column2, Vector3 origin) { basis = new Basis(column0, column1, column2); this.origin = origin; @@ -326,7 +326,7 @@ namespace Godot /// /// The to create the basis from. /// The origin vector, or column index 3. - public Transform(Quat quat, Vector3 origin) + public Transform3D(Quat quat, Vector3 origin) { basis = new Basis(quat); this.origin = origin; @@ -337,40 +337,40 @@ namespace Godot /// /// The to create the basis from. /// The origin vector, or column index 3. - public Transform(Basis basis, Vector3 origin) + public Transform3D(Basis basis, Vector3 origin) { this.basis = basis; this.origin = origin; } - public static Transform operator *(Transform left, Transform right) + public static Transform3D operator *(Transform3D left, Transform3D right) { left.origin = left.Xform(right.origin); left.basis *= right.basis; return left; } - public static bool operator ==(Transform left, Transform right) + public static bool operator ==(Transform3D left, Transform3D right) { return left.Equals(right); } - public static bool operator !=(Transform left, Transform right) + public static bool operator !=(Transform3D left, Transform3D right) { return !left.Equals(right); } public override bool Equals(object obj) { - if (obj is Transform) + if (obj is Transform3D) { - return Equals((Transform)obj); + return Equals((Transform3D)obj); } return false; } - public bool Equals(Transform other) + public bool Equals(Transform3D other) { return basis.Equals(other.basis) && origin.Equals(other.origin); } @@ -381,7 +381,7 @@ namespace Godot /// /// The other transform to compare. /// Whether or not the matrices are approximately equal. - public bool IsEqualApprox(Transform other) + public bool IsEqualApprox(Transform3D other) { return basis.IsEqualApprox(other.basis) && origin.IsEqualApprox(other.origin); } diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp index d66cc29b9a..adb0518cd6 100644 --- a/modules/mono/mono_gd/gd_mono_cache.cpp +++ b/modules/mono/mono_gd/gd_mono_cache.cpp @@ -110,7 +110,7 @@ void CachedData::clear_godot_api_cache() { class_Vector3i = nullptr; class_Basis = nullptr; class_Quat = nullptr; - class_Transform = nullptr; + class_Transform3D = nullptr; class_AABB = nullptr; class_Color = nullptr; class_Plane = nullptr; @@ -239,7 +239,7 @@ void update_godot_api_cache() { CACHE_CLASS_AND_CHECK(Vector3i, GODOT_API_CLASS(Vector3i)); CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis)); CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat)); - CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform)); + CACHE_CLASS_AND_CHECK(Transform3D, GODOT_API_CLASS(Transform3D)); CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB)); CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color)); CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane)); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 1d4d52dfce..4bbecc2062 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -152,8 +152,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ break; } - if (tclass == CACHED_CLASS(Transform)) { - GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform, p_value.operator ::Transform()); + if (tclass == CACHED_CLASS(Transform3D)) { + GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform3D, p_value.operator ::Transform3D()); mono_field_set_value(p_object, mono_field, &from); break; } @@ -349,7 +349,7 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ mono_field_set_value(p_object, mono_field, &from); } break; case Variant::TRANSFORM: { - GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform, p_value.operator ::Transform()); + GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform3D, p_value.operator ::Transform3D()); mono_field_set_value(p_object, mono_field, &from); } break; case Variant::COLOR: { diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 359f6bba4d..03715315b4 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -108,7 +108,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_ return Variant::QUAT; } - if (vtclass == CACHED_CLASS(Transform)) { + if (vtclass == CACHED_CLASS(Transform3D)) { return Variant::TRANSFORM; } @@ -1040,8 +1040,8 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type return MARSHALLED_IN(Quat, unbox_addr(p_obj)); } - if (vtclass == CACHED_CLASS(Transform)) { - return MARSHALLED_IN(Transform, unbox_addr(p_obj)); + if (vtclass == CACHED_CLASS(Transform3D)) { + return MARSHALLED_IN(Transform3D, unbox_addr(p_obj)); } if (vtclass == CACHED_CLASS(AABB)) { diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index 668809ae5d..141d6a66bd 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -269,9 +269,9 @@ enum { offsetof(Quat, z) == (sizeof(real_t) * 2) && offsetof(Quat, w) == (sizeof(real_t) * 3)), - MATCHES_Transform = (MATCHES_Basis && MATCHES_Vector3 && (sizeof(Transform) == (sizeof(Basis) + sizeof(Vector3))) && - offsetof(Transform, basis) == 0 && - offsetof(Transform, origin) == sizeof(Basis)), + MATCHES_Transform3D = (MATCHES_Basis && MATCHES_Vector3 && (sizeof(Transform3D) == (sizeof(Basis) + sizeof(Vector3))) && + offsetof(Transform3D, basis) == 0 && + offsetof(Transform3D, origin) == sizeof(Basis)), MATCHES_AABB = (MATCHES_Vector3 && (sizeof(AABB) == (sizeof(Vector3) * 2)) && offsetof(AABB, position) == (sizeof(Vector3) * 0) && @@ -292,7 +292,7 @@ enum { #ifdef GD_MONO_FORCE_INTEROP_STRUCT_COPY /* clang-format off */ static_assert(MATCHES_Vector2 && MATCHES_Rect2 && MATCHES_Transform2D && MATCHES_Vector3 && - MATCHES_Basis && MATCHES_Quat && MATCHES_Transform && MATCHES_AABB && MATCHES_Color && + MATCHES_Basis && MATCHES_Quat && MATCHES_Transform3D && MATCHES_AABB && MATCHES_Color && MATCHES_Plane && MATCHES_Vector2i && MATCHES_Rect2i && MATCHES_Vector3i); /* clang-format on */ #endif @@ -433,16 +433,16 @@ struct M_Quat { } }; -struct M_Transform { +struct M_Transform3D { M_Basis basis; M_Vector3 origin; - static _FORCE_INLINE_ Transform convert_to(const M_Transform &p_from) { - return Transform(M_Basis::convert_to(p_from.basis), M_Vector3::convert_to(p_from.origin)); + static _FORCE_INLINE_ Transform3D convert_to(const M_Transform3D &p_from) { + return Transform3D(M_Basis::convert_to(p_from.basis), M_Vector3::convert_to(p_from.origin)); } - static _FORCE_INLINE_ M_Transform convert_from(const Transform &p_from) { - M_Transform ret = { M_Basis::convert_from(p_from.basis), M_Vector3::convert_from(p_from.origin) }; + static _FORCE_INLINE_ M_Transform3D convert_from(const Transform3D &p_from) { + M_Transform3D ret = { M_Basis::convert_from(p_from.basis), M_Vector3::convert_from(p_from.origin) }; return ret; } }; @@ -534,7 +534,7 @@ DECL_TYPE_MARSHAL_TEMPLATES(Vector3) DECL_TYPE_MARSHAL_TEMPLATES(Vector3i) DECL_TYPE_MARSHAL_TEMPLATES(Basis) DECL_TYPE_MARSHAL_TEMPLATES(Quat) -DECL_TYPE_MARSHAL_TEMPLATES(Transform) +DECL_TYPE_MARSHAL_TEMPLATES(Transform3D) DECL_TYPE_MARSHAL_TEMPLATES(AABB) DECL_TYPE_MARSHAL_TEMPLATES(Color) DECL_TYPE_MARSHAL_TEMPLATES(Plane) diff --git a/modules/raycast/raycast_occlusion_cull.cpp b/modules/raycast/raycast_occlusion_cull.cpp index 66558efa8c..88c0145ebc 100644 --- a/modules/raycast/raycast_occlusion_cull.cpp +++ b/modules/raycast/raycast_occlusion_cull.cpp @@ -64,7 +64,7 @@ void RaycastOcclusionCull::RaycastHZBuffer::resize(const Size2i &p_size) { camera_ray_masks.resize(ray_packets_count * TILE_SIZE * TILE_SIZE); } -void RaycastOcclusionCull::RaycastHZBuffer::update_camera_rays(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_work_pool) { +void RaycastOcclusionCull::RaycastHZBuffer::update_camera_rays(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_work_pool) { CameraRayThreadData td; td.camera_matrix = p_cam_projection; td.camera_transform = p_cam_transform; @@ -82,7 +82,7 @@ void RaycastOcclusionCull::RaycastHZBuffer::_camera_rays_threaded(uint32_t p_thr _generate_camera_rays(p_data->camera_transform, p_data->camera_matrix, p_data->camera_orthogonal, from, to); } -void RaycastOcclusionCull::RaycastHZBuffer::_generate_camera_rays(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, int p_from, int p_to) { +void RaycastOcclusionCull::RaycastHZBuffer::_generate_camera_rays(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, int p_from, int p_to) { Size2i buffer_size = sizes[0]; CameraMatrix inv_camera_matrix = p_cam_projection.inverse(); @@ -227,7 +227,7 @@ void RaycastOcclusionCull::remove_scenario(RID p_scenario) { scenario.removed = true; } -void RaycastOcclusionCull::scenario_set_instance(RID p_scenario, RID p_instance, RID p_occluder, const Transform &p_xform, bool p_enabled) { +void RaycastOcclusionCull::scenario_set_instance(RID p_scenario, RID p_instance, RID p_occluder, const Transform3D &p_xform, bool p_enabled) { ERR_FAIL_COND(!scenarios.has(p_scenario)); Scenario &scenario = scenarios[p_scenario]; @@ -345,7 +345,7 @@ void RaycastOcclusionCull::Scenario::_transform_vertices_thread(uint32_t p_threa _transform_vertices_range(p_data->read, p_data->write, p_data->xform, from, to); } -void RaycastOcclusionCull::Scenario::_transform_vertices_range(const Vector3 *p_read, Vector3 *p_write, const Transform &p_xform, int p_from, int p_to) { +void RaycastOcclusionCull::Scenario::_transform_vertices_range(const Vector3 *p_read, Vector3 *p_write, const Transform3D &p_xform, int p_from, int p_to) { for (int i = p_from; i < p_to; i++) { p_write[i] = p_xform.xform(p_read[i]); } @@ -491,7 +491,7 @@ void RaycastOcclusionCull::buffer_set_size(RID p_buffer, const Vector2i &p_size) buffers[p_buffer].resize(p_size); } -void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_pool) { +void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_pool) { if (!buffers.has(p_buffer)) { return; } diff --git a/modules/raycast/raycast_occlusion_cull.h b/modules/raycast/raycast_occlusion_cull.h index acaceb9459..d9ca57cf24 100644 --- a/modules/raycast/raycast_occlusion_cull.h +++ b/modules/raycast/raycast_occlusion_cull.h @@ -52,14 +52,14 @@ public: struct CameraRayThreadData { CameraMatrix camera_matrix; - Transform camera_transform; + Transform3D camera_transform; bool camera_orthogonal; int thread_count; Size2i buffer_size; }; void _camera_rays_threaded(uint32_t p_thread, CameraRayThreadData *p_data); - void _generate_camera_rays(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, int p_from, int p_to); + void _generate_camera_rays(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, int p_from, int p_to); public: LocalVector camera_rays; @@ -69,7 +69,7 @@ public: virtual void clear() override; virtual void resize(const Size2i &p_size) override; void sort_rays(); - void update_camera_rays(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_work_pool); + void update_camera_rays(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_work_pool); }; private: @@ -99,7 +99,7 @@ private: RID occluder; LocalVector indices; LocalVector xformed_vertices; - Transform xform; + Transform3D xform; bool enabled = true; bool removed = false; }; @@ -113,7 +113,7 @@ private: struct TransformThreadData { uint32_t thread_count; uint32_t vertex_count; - Transform xform; + Transform3D xform; const Vector3 *read; Vector3 *write; }; @@ -134,7 +134,7 @@ private: void _update_dirty_instance_thread(int p_idx, RID *p_instances); void _update_dirty_instance(int p_idx, RID *p_instances, ThreadWorkPool *p_thread_pool); void _transform_vertices_thread(uint32_t p_thread, TransformThreadData *p_data); - void _transform_vertices_range(const Vector3 *p_read, Vector3 *p_write, const Transform &p_xform, int p_from, int p_to); + void _transform_vertices_range(const Vector3 *p_read, Vector3 *p_write, const Transform3D &p_xform, int p_from, int p_to); static void _commit_scene(void *p_ud); bool update(ThreadWorkPool &p_thread_pool); @@ -164,7 +164,7 @@ public: virtual void add_scenario(RID p_scenario) override; virtual void remove_scenario(RID p_scenario) override; - virtual void scenario_set_instance(RID p_scenario, RID p_instance, RID p_occluder, const Transform &p_xform, bool p_enabled) override; + virtual void scenario_set_instance(RID p_scenario, RID p_instance, RID p_occluder, const Transform3D &p_xform, bool p_enabled) override; virtual void scenario_remove_instance(RID p_scenario, RID p_instance) override; virtual void add_buffer(RID p_buffer) override; @@ -172,7 +172,7 @@ public: virtual HZBuffer *buffer_get_ptr(RID p_buffer) override; virtual void buffer_set_scenario(RID p_buffer, RID p_scenario) override; virtual void buffer_set_size(RID p_buffer, const Vector2i &p_size) override; - virtual void buffer_update(RID p_buffer, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_pool) override; + virtual void buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, ThreadWorkPool &p_thread_pool) override; virtual RID buffer_get_debug_texture(RID p_buffer) override; virtual void set_build_quality(RS::ViewportOcclusionCullingBuildQuality p_quality) override; diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 06f3fe6284..a628cb0549 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -266,7 +266,7 @@ void WebXRInterfaceJS::uninitialize() { }; Transform WebXRInterfaceJS::_js_matrix_to_transform(float *p_js_matrix) { - Transform transform; + Transform3D transform; transform.basis.elements[0].x = p_js_matrix[0]; transform.basis.elements[1].x = p_js_matrix[1]; @@ -305,8 +305,8 @@ Size2 WebXRInterfaceJS::get_render_targetsize() { return render_targetsize; }; -Transform WebXRInterfaceJS::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) { - Transform transform_for_eye; +Transform WebXRInterfaceJS::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) { + Transform3D transform_for_eye; XRServer *xr_server = XRServer::get_singleton(); ERR_FAIL_NULL_V(xr_server, transform_for_eye); @@ -399,7 +399,7 @@ void WebXRInterfaceJS::_update_tracker(int p_controller_id) { float *tracker_matrix = godot_webxr_get_controller_transform(p_controller_id); if (tracker_matrix) { - Transform transform = _js_matrix_to_transform(tracker_matrix); + Transform3D transform = _js_matrix_to_transform(tracker_matrix); tracker->set_position(transform.origin); tracker->set_orientation(transform.basis); free(tracker_matrix); diff --git a/modules/webxr/webxr_interface_js.h b/modules/webxr/webxr_interface_js.h index 7c841c1911..e9274a06e4 100644 --- a/modules/webxr/webxr_interface_js.h +++ b/modules/webxr/webxr_interface_js.h @@ -56,7 +56,7 @@ private: bool controllers_state[2]; Size2 render_targetsize; - Transform _js_matrix_to_transform(float *p_js_matrix); + Transform3D _js_matrix_to_transform(float *p_js_matrix); void _update_tracker(int p_controller_id); public: @@ -84,7 +84,7 @@ public: virtual Size2 get_render_targetsize() override; virtual bool is_stereo() override; - virtual Transform get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) override; + virtual Transform get_transform_for_eye(XRInterface::Eyes p_eye, const Transform3D &p_cam_transform) override; virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) override; virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye) override; virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override; -- cgit v1.2.3 From 08a85352fbf03e392d9fe9ffa2db067d1fea8488 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Wed, 28 Apr 2021 03:36:08 -0400 Subject: Rename Variant TRANSFORM to TRANSFORM3D Also _transform to _transform3d --- core/core_constants.cpp | 2 +- core/io/marshalls.cpp | 4 +- core/io/packed_data_container.cpp | 2 +- core/io/resource_format_binary.cpp | 2 +- core/math/math_fieldwise.cpp | 2 +- core/variant/type_info.h | 2 +- core/variant/typed_array.h | 4 +- core/variant/variant.cpp | 60 +++++++++++++------------- core/variant/variant.h | 6 +-- core/variant/variant_call.cpp | 8 ++-- core/variant/variant_internal.h | 14 +++--- core/variant/variant_op.cpp | 24 +++++------ core/variant/variant_parser.cpp | 2 +- core/variant/variant_setget.cpp | 4 +- editor/animation_track_editor.cpp | 4 +- editor/connections_dialog.cpp | 4 +- editor/editor_properties.cpp | 2 +- editor/editor_properties_array_dict.cpp | 2 +- editor/property_editor.cpp | 8 ++-- editor/shader_globals_editor.cpp | 2 +- modules/gdscript/gdscript_analyzer.cpp | 4 +- modules/gdscript/gdscript_byte_codegen.cpp | 6 +-- modules/gdscript/gdscript_disassembler.cpp | 2 +- modules/gdscript/gdscript_function.h | 2 +- modules/gdscript/gdscript_parser.cpp | 2 +- modules/gdscript/gdscript_vm.cpp | 6 +-- modules/gltf/gltf_node.cpp | 2 +- modules/mono/csharp_script.cpp | 2 +- modules/mono/editor/bindings_generator.cpp | 4 +- modules/mono/mono_gd/gd_mono_cache.h | 2 +- modules/mono/mono_gd/gd_mono_field.cpp | 6 +-- modules/mono/mono_gd/gd_mono_marshal.cpp | 14 +++--- modules/visual_script/visual_script_editor.cpp | 4 +- modules/visual_script/visual_script_nodes.cpp | 2 +- platform/windows/godot.natvis | 4 +- scene/3d/node_3d.cpp | 6 +-- scene/3d/physics_body_3d.cpp | 4 +- scene/3d/skeleton_3d.cpp | 4 +- scene/3d/skeleton_ik_3d.cpp | 2 +- scene/animation/tween.cpp | 6 +-- scene/main/shader_globals_override.cpp | 2 +- scene/resources/mesh_library.cpp | 4 +- scene/resources/skin.cpp | 2 +- scene/resources/visual_shader.cpp | 2 +- scene/resources/visual_shader_nodes.cpp | 4 +- servers/physics_server_3d.cpp | 4 +- servers/rendering/shader_language.cpp | 2 +- tests/test_class_db.h | 2 +- 48 files changed, 132 insertions(+), 132 deletions(-) (limited to 'modules') diff --git a/core/core_constants.cpp b/core/core_constants.cpp index a0a41015dc..30c2ed80ac 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -583,7 +583,7 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS); - BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM", Variant::TRANSFORM); + BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM3D", Variant::TRANSFORM3D); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME); BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH); diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 901dbda90e..de32ffbcdc 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -325,7 +325,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int } } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { ERR_FAIL_COND_V(len < 4 * 12, ERR_INVALID_DATA); Transform3D val; for (int i = 0; i < 3; i++) { @@ -1138,7 +1138,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 9 * 4; } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { if (buf) { Transform3D val = p_variant; for (int i = 0; i < 3; i++) { diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp index 52169987fd..7565e8e01a 100644 --- a/core/io/packed_data_container.cpp +++ b/core/io/packed_data_container.cpp @@ -230,7 +230,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector &tmpd case Variant::QUAT: case Variant::AABB: case Variant::BASIS: - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: case Variant::PACKED_BYTE_ARRAY: case Variant::PACKED_INT32_ARRAY: case Variant::PACKED_INT64_ARRAY: diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index e168e29a9f..14eb296f4d 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1416,7 +1416,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia f->store_real(val.elements[2].z); } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { f->store_32(VARIANT_TRANSFORM); Transform3D val = p_property; f->store_real(val.basis.elements[0].x); diff --git a/core/math/math_fieldwise.cpp b/core/math/math_fieldwise.cpp index afdc9279c2..f2baef1a59 100644 --- a/core/math/math_fieldwise.cpp +++ b/core/math/math_fieldwise.cpp @@ -141,7 +141,7 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const return target; } - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { SETUP_TYPE(Transform3D) /**/ TRY_TRANSFER_FIELD("xx", basis.elements[0][0]) diff --git a/core/variant/type_info.h b/core/variant/type_info.h index 8329c1a880..5712c90f4c 100644 --- a/core/variant/type_info.h +++ b/core/variant/type_info.h @@ -149,7 +149,7 @@ MAKE_TYPE_INFO(Plane, Variant::PLANE) MAKE_TYPE_INFO(Quat, Variant::QUAT) MAKE_TYPE_INFO(AABB, Variant::AABB) MAKE_TYPE_INFO(Basis, Variant::BASIS) -MAKE_TYPE_INFO(Transform3D, Variant::TRANSFORM) +MAKE_TYPE_INFO(Transform3D, Variant::TRANSFORM3D) MAKE_TYPE_INFO(Color, Variant::COLOR) MAKE_TYPE_INFO(StringName, Variant::STRING_NAME) MAKE_TYPE_INFO(NodePath, Variant::NODE_PATH) diff --git a/core/variant/typed_array.h b/core/variant/typed_array.h index b79e3cae14..95c0578543 100644 --- a/core/variant/typed_array.h +++ b/core/variant/typed_array.h @@ -101,7 +101,7 @@ MAKE_TYPED_ARRAY(Plane, Variant::PLANE) MAKE_TYPED_ARRAY(Quat, Variant::QUAT) MAKE_TYPED_ARRAY(AABB, Variant::AABB) MAKE_TYPED_ARRAY(Basis, Variant::BASIS) -MAKE_TYPED_ARRAY(Transform3D, Variant::TRANSFORM) +MAKE_TYPED_ARRAY(Transform3D, Variant::TRANSFORM3D) MAKE_TYPED_ARRAY(Color, Variant::COLOR) MAKE_TYPED_ARRAY(StringName, Variant::STRING_NAME) MAKE_TYPED_ARRAY(NodePath, Variant::NODE_PATH) @@ -199,7 +199,7 @@ MAKE_TYPED_ARRAY_INFO(Plane, Variant::PLANE) MAKE_TYPED_ARRAY_INFO(Quat, Variant::QUAT) MAKE_TYPED_ARRAY_INFO(AABB, Variant::AABB) MAKE_TYPED_ARRAY_INFO(Basis, Variant::BASIS) -MAKE_TYPED_ARRAY_INFO(Transform3D, Variant::TRANSFORM) +MAKE_TYPED_ARRAY_INFO(Transform3D, Variant::TRANSFORM3D) MAKE_TYPED_ARRAY_INFO(Color, Variant::COLOR) MAKE_TYPED_ARRAY_INFO(StringName, Variant::STRING_NAME) MAKE_TYPED_ARRAY_INFO(NodePath, Variant::NODE_PATH) diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 6b57b4f196..d77b7ef140 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -99,7 +99,7 @@ String Variant::get_type_name(Variant::Type p_type) { return "Basis"; } break; - case TRANSFORM: { + case TRANSFORM3D: { return "Transform3D"; } break; @@ -275,7 +275,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { } break; case TRANSFORM2D: { static const Type valid[] = { - TRANSFORM, + TRANSFORM3D, NIL }; @@ -319,7 +319,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { valid_types = valid; } break; - case TRANSFORM: { + case TRANSFORM3D: { static const Type valid[] = { TRANSFORM2D, QUAT, @@ -582,7 +582,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type } break; case TRANSFORM2D: { static const Type valid[] = { - TRANSFORM, + TRANSFORM3D, NIL }; @@ -626,7 +626,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - case TRANSFORM: { + case TRANSFORM3D: { static const Type valid[] = { TRANSFORM2D, QUAT, @@ -881,8 +881,8 @@ bool Variant::is_zero() const { return *_data._basis == Basis(); } break; - case TRANSFORM: { - return *_data._transform == Transform3D(); + case TRANSFORM3D: { + return *_data._transform3d == Transform3D(); } break; @@ -1100,8 +1100,8 @@ void Variant::reference(const Variant &p_variant) { _data._basis = memnew(Basis(*p_variant._data._basis)); } break; - case TRANSFORM: { - _data._transform = memnew(Transform3D(*p_variant._data._transform)); + case TRANSFORM3D: { + _data._transform3d = memnew(Transform3D(*p_variant._data._transform3d)); } break; // misc types @@ -1289,8 +1289,8 @@ void Variant::_clear_internal() { case BASIS: { memdelete(_data._basis); } break; - case TRANSFORM: { - memdelete(_data._transform); + case TRANSFORM3D: { + memdelete(_data._transform3d); } break; // misc types @@ -1682,7 +1682,7 @@ String Variant::stringify(List &stack) const { return mtx + ")"; } break; - case TRANSFORM: + case TRANSFORM3D: return operator Transform3D(); case STRING_NAME: return operator StringName(); @@ -1960,8 +1960,8 @@ Variant::operator Basis() const { return *reinterpret_cast(_data._mem); } else if (type == VECTOR3) { return Basis(*reinterpret_cast(_data._mem)); - } else if (type == TRANSFORM) { // unexposed in Variant::can_convert? - return _data._transform->basis; + } else if (type == TRANSFORM3D) { // unexposed in Variant::can_convert? + return _data._transform3d->basis; } else { return Basis(); } @@ -1972,16 +1972,16 @@ Variant::operator Quat() const { return *reinterpret_cast(_data._mem); } else if (type == BASIS) { return *_data._basis; - } else if (type == TRANSFORM) { - return _data._transform->basis; + } else if (type == TRANSFORM3D) { + return _data._transform3d->basis; } else { return Quat(); } } Variant::operator Transform3D() const { - if (type == TRANSFORM) { - return *_data._transform; + if (type == TRANSFORM3D) { + return *_data._transform3d; } else if (type == BASIS) { return Transform3D(*_data._basis, Vector3()); } else if (type == QUAT) { @@ -2004,8 +2004,8 @@ Variant::operator Transform3D() const { Variant::operator Transform2D() const { if (type == TRANSFORM2D) { return *_data._transform2d; - } else if (type == TRANSFORM) { - const Transform3D &t = *_data._transform; + } else if (type == TRANSFORM3D) { + const Transform3D &t = *_data._transform3d; Transform2D m; m.elements[0][0] = t.basis.elements[0][0]; m.elements[0][1] = t.basis.elements[1][0]; @@ -2501,8 +2501,8 @@ Variant::Variant(const Quat &p_quat) { } Variant::Variant(const Transform3D &p_transform) { - type = TRANSFORM; - _data._transform = memnew(Transform3D(p_transform)); + type = TRANSFORM3D; + _data._transform3d = memnew(Transform3D(p_transform)); } Variant::Variant(const Transform2D &p_transform) { @@ -2745,8 +2745,8 @@ void Variant::operator=(const Variant &p_variant) { case BASIS: { *_data._basis = *(p_variant._data._basis); } break; - case TRANSFORM: { - *_data._transform = *(p_variant._data._transform); + case TRANSFORM3D: { + *_data._transform3d = *(p_variant._data._transform3d); } break; // misc types @@ -2934,13 +2934,13 @@ uint32_t Variant::hash() const { return hash; } break; - case TRANSFORM: { + case TRANSFORM3D: { uint32_t hash = 5831; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - hash = hash_djb2_one_float(_data._transform->basis.elements[i][j], hash); + hash = hash_djb2_one_float(_data._transform3d->basis.elements[i][j], hash); } - hash = hash_djb2_one_float(_data._transform->origin[i], hash); + hash = hash_djb2_one_float(_data._transform3d->origin[i], hash); } return hash; @@ -3255,9 +3255,9 @@ bool Variant::hash_compare(const Variant &p_variant) const { return true; } break; - case TRANSFORM: { - const Transform3D *l = _data._transform; - const Transform3D *r = p_variant._data._transform; + case TRANSFORM3D: { + const Transform3D *l = _data._transform3d; + const Transform3D *r = p_variant._data._transform3d; for (int i = 0; i < 3; i++) { if (!(hash_compare_vector3(l->basis.elements[i], r->basis.elements[i]))) { diff --git a/core/variant/variant.h b/core/variant/variant.h index 8cae34d50e..2b41ab5402 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -91,7 +91,7 @@ public: QUAT, AABB, BASIS, - TRANSFORM, + TRANSFORM3D, // misc types COLOR, @@ -200,7 +200,7 @@ private: Transform2D *_transform2d; ::AABB *_aabb; Basis *_basis; - Transform3D *_transform; + Transform3D *_transform3d; PackedArrayRefBase *packed_array; void *_ptr; //generic pointer uint8_t _mem[sizeof(ObjData) > (sizeof(real_t) * 4) ? sizeof(ObjData) : (sizeof(real_t) * 4)]; @@ -322,8 +322,8 @@ public: operator ::AABB() const; operator Quat() const; operator Basis() const; - operator Transform3D() const; operator Transform2D() const; + operator Transform3D() const; operator Color() const; operator NodePath() const; diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index c7ef893640..986f61c550 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -2023,10 +2023,10 @@ static void _register_variant_builtin_methods() { Transform3D flip_x_transform = Transform3D(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0); Transform3D flip_y_transform = Transform3D(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0); Transform3D flip_z_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0); - _VariantCall::add_variant_constant(Variant::TRANSFORM, "IDENTITY", identity_transform); - _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_X", flip_x_transform); - _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Y", flip_y_transform); - _VariantCall::add_variant_constant(Variant::TRANSFORM, "FLIP_Z", flip_z_transform); + _VariantCall::add_variant_constant(Variant::TRANSFORM3D, "IDENTITY", identity_transform); + _VariantCall::add_variant_constant(Variant::TRANSFORM3D, "FLIP_X", flip_x_transform); + _VariantCall::add_variant_constant(Variant::TRANSFORM3D, "FLIP_Y", flip_y_transform); + _VariantCall::add_variant_constant(Variant::TRANSFORM3D, "FLIP_Z", flip_z_transform); Basis identity_basis = Basis(); Basis flip_x_basis = Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1); diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h index 62e93833bc..1eaa211b37 100644 --- a/core/variant/variant_internal.h +++ b/core/variant/variant_internal.h @@ -55,7 +55,7 @@ public: case Variant::BASIS: init_basis(v); break; - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: init_transform(v); break; case Variant::STRING_NAME: @@ -144,8 +144,8 @@ public: _FORCE_INLINE_ static const ::AABB *get_aabb(const Variant *v) { return v->_data._aabb; } _FORCE_INLINE_ static Basis *get_basis(Variant *v) { return v->_data._basis; } _FORCE_INLINE_ static const Basis *get_basis(const Variant *v) { return v->_data._basis; } - _FORCE_INLINE_ static Transform3D *get_transform(Variant *v) { return v->_data._transform; } - _FORCE_INLINE_ static const Transform3D *get_transform(const Variant *v) { return v->_data._transform; } + _FORCE_INLINE_ static Transform3D *get_transform(Variant *v) { return v->_data._transform3d; } + _FORCE_INLINE_ static const Transform3D *get_transform(const Variant *v) { return v->_data._transform3d; } // Misc types. _FORCE_INLINE_ static Color *get_color(Variant *v) { return reinterpret_cast(v->_data._mem); } @@ -217,8 +217,8 @@ public: v->type = Variant::BASIS; } _FORCE_INLINE_ static void init_transform(Variant *v) { - v->_data._transform = memnew(Transform3D); - v->type = Variant::TRANSFORM; + v->_data._transform3d = memnew(Transform3D); + v->type = Variant::TRANSFORM3D; } _FORCE_INLINE_ static void init_string_name(Variant *v) { memnew_placement(v->_data._mem, StringName); @@ -320,7 +320,7 @@ public: return get_rect2(v); case Variant::RECT2I: return get_rect2i(v); - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: return get_transform(v); case Variant::TRANSFORM2D: return get_transform2d(v); @@ -398,7 +398,7 @@ public: return get_rect2(v); case Variant::RECT2I: return get_rect2i(v); - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: return get_transform(v); case Variant::TRANSFORM2D: return get_transform2d(v); diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index debe9b77a5..cce0177e20 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -1465,13 +1465,13 @@ void Variant::_register_variant_operators() { register_op, Transform2D, Vector>>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::PACKED_VECTOR2_ARRAY); register_op, Vector, Transform2D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR2_ARRAY, Variant::TRANSFORM2D); - register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::TRANSFORM); - register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::VECTOR3); - register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::TRANSFORM); - register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::AABB); - register_op>(Variant::OP_MULTIPLY, Variant::AABB, Variant::TRANSFORM); - register_op, Transform3D, Vector>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::PACKED_VECTOR3_ARRAY); - register_op, Vector, Transform3D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR3_ARRAY, Variant::TRANSFORM); + register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::TRANSFORM3D); + register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::VECTOR3); + register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::TRANSFORM3D); + register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::AABB); + register_op>(Variant::OP_MULTIPLY, Variant::AABB, Variant::TRANSFORM3D); + register_op, Transform3D, Vector>>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::PACKED_VECTOR3_ARRAY); + register_op, Vector, Transform3D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR3_ARRAY, Variant::TRANSFORM3D); register_op>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::BASIS); register_op>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::VECTOR3); @@ -1547,7 +1547,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_MODULE, Variant::STRING, Variant::QUAT); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::AABB); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::BASIS); - register_op>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM); + register_op>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM3D); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::COLOR); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::STRING_NAME); @@ -1615,7 +1615,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_EQUAL, Variant::QUAT, Variant::QUAT); register_op>(Variant::OP_EQUAL, Variant::AABB, Variant::AABB); register_op>(Variant::OP_EQUAL, Variant::BASIS, Variant::BASIS); - register_op>(Variant::OP_EQUAL, Variant::TRANSFORM, Variant::TRANSFORM); + register_op>(Variant::OP_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D); register_op>(Variant::OP_EQUAL, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::STRING); @@ -1661,7 +1661,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_NOT_EQUAL, Variant::QUAT, Variant::QUAT); register_op>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::AABB); register_op>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::BASIS); - register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM, Variant::TRANSFORM); + register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D); register_op>(Variant::OP_NOT_EQUAL, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::STRING); @@ -1852,7 +1852,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_IN, Variant::QUAT, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::AABB, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::BASIS, Variant::DICTIONARY); - register_op>(Variant::OP_IN, Variant::TRANSFORM, Variant::DICTIONARY); + register_op>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::COLOR, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::STRING_NAME, Variant::DICTIONARY); @@ -1889,7 +1889,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_IN, Variant::QUAT, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::AABB, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::BASIS, Variant::ARRAY); - register_op>(Variant::OP_IN, Variant::TRANSFORM, Variant::ARRAY); + register_op>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::COLOR, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::STRING_NAME, Variant::ARRAY); diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp index 6c2e9c9088..8152b46226 100644 --- a/core/variant/variant_parser.cpp +++ b/core/variant/variant_parser.cpp @@ -1489,7 +1489,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, s + " )"); } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { String s = "Transform3D( "; Transform3D t = p_variant; Basis &m3 = t.basis; diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index 9f2c0f38b2..c3f667d9a7 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -2307,8 +2307,8 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & r_dst = Transform3D(*a._data._basis).interpolate_with(Transform3D(*b._data._basis), c).basis; } return; - case TRANSFORM: { - r_dst = a._data._transform->interpolate_with(*b._data._transform, c); + case TRANSFORM3D: { + r_dst = a._data._transform3d->interpolate_with(*b._data._transform3d, c); } return; case COLOR: { diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 2d688bb37a..f62dab6896 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3915,7 +3915,7 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD h.type == Variant::COLOR || h.type == Variant::PLANE || h.type == Variant::TRANSFORM2D || - h.type == Variant::TRANSFORM) { + h.type == Variant::TRANSFORM3D) { update_mode = Animation::UPDATE_CONTINUOUS; } @@ -4468,7 +4468,7 @@ void AnimationTrackEditor::_new_track_property_selected(String p_name) { h.type == Variant::COLOR || h.type == Variant::PLANE || h.type == Variant::TRANSFORM2D || - h.type == Variant::TRANSFORM) { + h.type == Variant::TRANSFORM3D) { update_mode = Animation::UPDATE_CONTINUOUS; } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index fcd937e72c..5fcee1851d 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -212,7 +212,7 @@ void ConnectDialog::_add_bind() { case Variant::BASIS: value = Basis(); break; - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: value = Transform3D(); break; case Variant::COLOR: @@ -446,7 +446,7 @@ ConnectDialog::ConnectDialog() { type_list->add_item("Quat", Variant::QUAT); type_list->add_item("AABB", Variant::AABB); type_list->add_item("Basis", Variant::BASIS); - type_list->add_item("Transform", Variant::TRANSFORM); + type_list->add_item("Transform", Variant::TRANSFORM3D); type_list->add_item("Color", Variant::COLOR); type_list->select(0); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 66180b8653..4436c431d9 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3107,7 +3107,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(min, max, step, hide_slider); add_property_editor(p_path, editor); } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { EditorPropertyTransform *editor = memnew(EditorPropertyTransform); double min = -65535, max = 65535, step = default_float_step; bool hide_slider = true; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 3bc29856f1..2958c379b7 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -868,7 +868,7 @@ void EditorPropertyDictionary::update_property() { prop = editor; } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { EditorPropertyTransform *editor = memnew(EditorPropertyTransform); editor->setup(-100000, 100000, 0.001, true); prop = editor; diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 287d9aa4d9..ea2a800a10 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -791,7 +791,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { field_names.push_back("xx"); field_names.push_back("xy"); field_names.push_back("xz"); @@ -1557,7 +1557,7 @@ void CustomPropertyEditor::_modified(String p_string) { _emit_changed_whole_or_field(); } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { Basis basis; for (int i = 0; i < 9; i++) { basis.elements[i / 3][i % 3] = _parse_real_expression(value_editor[(i / 3) * 4 + i % 3]->get_text()); @@ -1639,7 +1639,7 @@ void CustomPropertyEditor::_focus_enter() { case Variant::AABB: case Variant::TRANSFORM2D: case Variant::BASIS: - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { for (int i = 0; i < MAX_VALUE_EDITORS; ++i) { if (value_editor[i]->has_focus()) { focused_value_editor = i; @@ -1665,7 +1665,7 @@ void CustomPropertyEditor::_focus_exit() { case Variant::AABB: case Variant::TRANSFORM2D: case Variant::BASIS: - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { for (int i = 0; i < MAX_VALUE_EDITORS; ++i) { value_editor[i]->select(0, 0); } diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp index 50e6cea4a2..1893c6b6bb 100644 --- a/editor/shader_globals_editor.cpp +++ b/editor/shader_globals_editor.cpp @@ -199,7 +199,7 @@ protected: pinfo.type = Variant::TRANSFORM2D; } break; case RS::GLOBAL_VAR_TYPE_TRANSFORM: { - pinfo.type = Variant::TRANSFORM; + pinfo.type = Variant::TRANSFORM3D; } break; case RS::GLOBAL_VAR_TYPE_MAT4: { pinfo.type = Variant::PACKED_INT32_ARRAY; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index d8d60b35c6..a4786c5396 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -2836,8 +2836,8 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri case Variant::VECTOR2I: case Variant::VECTOR3: case Variant::VECTOR3I: - case Variant::TRANSFORM: case Variant::TRANSFORM2D: + case Variant::TRANSFORM3D: error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::FLOAT && index_type.builtin_type != Variant::STRING; break; @@ -2933,7 +2933,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri result_type.builtin_type = Variant::VECTOR3; break; // Depends on the index. - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: case Variant::PLANE: case Variant::COLOR: case Variant::DICTIONARY: diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index 77a972ef12..6d7d0951b0 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -88,7 +88,7 @@ uint32_t GDScriptByteCodeGenerator::add_temporary(const GDScriptDataType &p_type case Variant::QUAT: case Variant::AABB: case Variant::BASIS: - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: case Variant::COLOR: case Variant::STRING_NAME: case Variant::NODE_PATH: @@ -467,7 +467,7 @@ void GDScriptByteCodeGenerator::write_type_adjust(const Address &p_target, Varia case Variant::BASIS: append(GDScriptFunction::OPCODE_TYPE_ADJUST_BASIS, 1); break; - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: append(GDScriptFunction::OPCODE_TYPE_ADJUST_TRANSFORM, 1); break; case Variant::COLOR: @@ -1100,7 +1100,7 @@ void GDScriptByteCodeGenerator::write_call_ptrcall(const Address &p_target, cons CASE_TYPE(PLANE); CASE_TYPE(AABB); CASE_TYPE(BASIS); - CASE_TYPE(TRANSFORM); + CASE_TYPE(TRANSFORM3D); CASE_TYPE(COLOR); CASE_TYPE(STRING_NAME); CASE_TYPE(NODE_PATH); diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp index eee713aa45..8aa64d7dcc 100644 --- a/modules/gdscript/gdscript_disassembler.cpp +++ b/modules/gdscript/gdscript_disassembler.cpp @@ -620,7 +620,7 @@ void GDScriptFunction::disassemble(const Vector &p_code_lines) const { DISASSEMBLE_PTRCALL(PLANE); DISASSEMBLE_PTRCALL(AABB); DISASSEMBLE_PTRCALL(BASIS); - DISASSEMBLE_PTRCALL(TRANSFORM); + DISASSEMBLE_PTRCALL(TRANSFORM3D); DISASSEMBLE_PTRCALL(COLOR); DISASSEMBLE_PTRCALL(STRING_NAME); DISASSEMBLE_PTRCALL(NODE_PATH); diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index 26b8809337..658be9f364 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -281,7 +281,7 @@ public: OPCODE_CALL_PTRCALL_QUAT, OPCODE_CALL_PTRCALL_AABB, OPCODE_CALL_PTRCALL_BASIS, - OPCODE_CALL_PTRCALL_TRANSFORM, + OPCODE_CALL_PTRCALL_TRANSFORM3D, OPCODE_CALL_PTRCALL_COLOR, OPCODE_CALL_PTRCALL_STRING_NAME, OPCODE_CALL_PTRCALL_NODE_PATH, diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index b61b469fbc..152b1ba23c 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -63,7 +63,7 @@ Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) { builtin_types["Plane"] = Variant::PLANE; builtin_types["Quat"] = Variant::QUAT; builtin_types["Basis"] = Variant::BASIS; - builtin_types["Transform"] = Variant::TRANSFORM; + builtin_types["Transform"] = Variant::TRANSFORM3D; builtin_types["Color"] = Variant::COLOR; builtin_types["RID"] = Variant::RID; builtin_types["Object"] = Variant::OBJECT; diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 921cefb99e..d45d50287e 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -251,7 +251,7 @@ void (*type_init_function_table[])(Variant *) = { &&OPCODE_CALL_PTRCALL_QUAT, \ &&OPCODE_CALL_PTRCALL_AABB, \ &&OPCODE_CALL_PTRCALL_BASIS, \ - &&OPCODE_CALL_PTRCALL_TRANSFORM, \ + &&OPCODE_CALL_PTRCALL_TRANSFORM3D, \ &&OPCODE_CALL_PTRCALL_COLOR, \ &&OPCODE_CALL_PTRCALL_STRING_NAME, \ &&OPCODE_CALL_PTRCALL_NODE_PATH, \ @@ -416,7 +416,7 @@ void (*type_init_function_table[])(Variant *) = { #define OP_GET_PACKED_VECTOR2_ARRAY get_vector2_array #define OP_GET_PACKED_VECTOR3_ARRAY get_vector3_array #define OP_GET_PACKED_COLOR_ARRAY get_color_array -#define OP_GET_TRANSFORM get_transform +#define OP_GET_TRANSFORM3D get_transform #define OP_GET_TRANSFORM2D get_transform2d #define OP_GET_PLANE get_plane #define OP_GET_AABB get_aabb @@ -1736,7 +1736,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_CALL_PTR(QUAT); OPCODE_CALL_PTR(AABB); OPCODE_CALL_PTR(BASIS); - OPCODE_CALL_PTR(TRANSFORM); + OPCODE_CALL_PTR(TRANSFORM3D); OPCODE_CALL_PTR(COLOR); OPCODE_CALL_PTR(STRING_NAME); OPCODE_CALL_PTR(NODE_PATH); diff --git a/modules/gltf/gltf_node.cpp b/modules/gltf/gltf_node.cpp index c13b05b3c9..759b52619d 100644 --- a/modules/gltf/gltf_node.cpp +++ b/modules/gltf/gltf_node.cpp @@ -60,7 +60,7 @@ void GLTFNode::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "parent"), "set_parent", "get_parent"); // GLTFNodeIndex ADD_PROPERTY(PropertyInfo(Variant::INT, "height"), "set_height", "get_height"); // int - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "xform"), "set_xform", "get_xform"); // Transform3D + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "xform"), "set_xform", "get_xform"); // Transform3D ADD_PROPERTY(PropertyInfo(Variant::INT, "mesh"), "set_mesh", "get_mesh"); // GLTFMeshIndex ADD_PROPERTY(PropertyInfo(Variant::INT, "camera"), "set_camera", "get_camera"); // GLTFCameraIndex ADD_PROPERTY(PropertyInfo(Variant::INT, "skin"), "set_skin", "get_skin"); // GLTFSkinIndex diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index b6a7a7579c..1f07f58ecc 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -499,7 +499,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { Variant::QUAT, Variant::AABB, Variant::BASIS, - Variant::TRANSFORM, + Variant::TRANSFORM3D, Variant::COLOR, Variant::STRING_NAME, Variant::NODE_PATH, diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index d4b04408ba..72e26070e1 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -2520,8 +2520,8 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant & p_arg_type.name == name_cache.type_NodePath; case Variant::NODE_PATH: return p_arg_type.name == name_cache.type_NodePath; - case Variant::TRANSFORM: case Variant::TRANSFORM2D: + case Variant::TRANSFORM3D: case Variant::BASIS: case Variant::QUAT: case Variant::PLANE: @@ -3123,7 +3123,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar } r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { Transform3D transform = p_val.operator Transform3D(); if (transform == Transform3D()) { r_iarg.default_argument = "Transform.Identity"; diff --git a/modules/mono/mono_gd/gd_mono_cache.h b/modules/mono/mono_gd/gd_mono_cache.h index 51370da452..a332d492b9 100644 --- a/modules/mono/mono_gd/gd_mono_cache.h +++ b/modules/mono/mono_gd/gd_mono_cache.h @@ -81,7 +81,7 @@ struct CachedData { GDMonoClass *class_Vector3i; GDMonoClass *class_Basis; GDMonoClass *class_Quat; - GDMonoClass *class_Transform; + GDMonoClass *class_Transform3D; GDMonoClass *class_AABB; GDMonoClass *class_Color; GDMonoClass *class_Plane; diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 4bbecc2062..97e3fe1677 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -153,7 +153,7 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ } if (tclass == CACHED_CLASS(Transform3D)) { - GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform3D, p_value.operator ::Transform3D()); + GDMonoMarshal::M_Transform3D from = MARSHALLED_OUT(Transform3D, p_value.operator ::Transform3D()); mono_field_set_value(p_object, mono_field, &from); break; } @@ -348,8 +348,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ GDMonoMarshal::M_Basis from = MARSHALLED_OUT(Basis, p_value.operator ::Basis()); mono_field_set_value(p_object, mono_field, &from); } break; - case Variant::TRANSFORM: { - GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform3D, p_value.operator ::Transform3D()); + case Variant::TRANSFORM3D: { + GDMonoMarshal::M_Transform3D from = MARSHALLED_OUT(Transform3D, p_value.operator ::Transform3D()); mono_field_set_value(p_object, mono_field, &from); } break; case Variant::COLOR: { diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 03715315b4..0623755263 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -109,7 +109,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_ } if (vtclass == CACHED_CLASS(Transform3D)) { - return Variant::TRANSFORM; + return Variant::TRANSFORM3D; } if (vtclass == CACHED_CLASS(AABB)) { @@ -520,9 +520,9 @@ MonoObject *variant_to_mono_object(const Variant &p_var) { GDMonoMarshal::M_Basis from = MARSHALLED_OUT(Basis, p_var.operator ::Basis()); return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Basis), &from); } - case Variant::TRANSFORM: { - GDMonoMarshal::M_Transform from = MARSHALLED_OUT(Transform, p_var.operator ::Transform()); - return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform), &from); + case Variant::TRANSFORM3D: { + GDMonoMarshal::M_Transform3D from = MARSHALLED_OUT(Transform3D, p_var.operator ::Transform3D()); + return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Transform3D), &from); } case Variant::COLOR: { GDMonoMarshal::M_Color from = MARSHALLED_OUT(Color, p_var.operator ::Color()); @@ -620,7 +620,7 @@ size_t variant_get_managed_unboxed_size(const ManagedType &p_type) { RETURN_CHECK_FOR_STRUCT(Vector3i); RETURN_CHECK_FOR_STRUCT(Basis); RETURN_CHECK_FOR_STRUCT(Quat); - RETURN_CHECK_FOR_STRUCT(Transform); + RETURN_CHECK_FOR_STRUCT(Transform3D); RETURN_CHECK_FOR_STRUCT(AABB); RETURN_CHECK_FOR_STRUCT(Color); RETURN_CHECK_FOR_STRUCT(Plane); @@ -725,7 +725,7 @@ void *variant_to_managed_unboxed(const Variant &p_var, const ManagedType &p_type RETURN_CHECK_FOR_STRUCT(Vector3i); RETURN_CHECK_FOR_STRUCT(Basis); RETURN_CHECK_FOR_STRUCT(Quat); - RETURN_CHECK_FOR_STRUCT(Transform); + RETURN_CHECK_FOR_STRUCT(Transform3D); RETURN_CHECK_FOR_STRUCT(AABB); RETURN_CHECK_FOR_STRUCT(Color); RETURN_CHECK_FOR_STRUCT(Plane); @@ -881,7 +881,7 @@ MonoObject *variant_to_mono_object(const Variant &p_var, const ManagedType &p_ty RETURN_CHECK_FOR_STRUCT(Vector3i); RETURN_CHECK_FOR_STRUCT(Basis); RETURN_CHECK_FOR_STRUCT(Quat); - RETURN_CHECK_FOR_STRUCT(Transform); + RETURN_CHECK_FOR_STRUCT(Transform3D); RETURN_CHECK_FOR_STRUCT(AABB); RETURN_CHECK_FOR_STRUCT(Color); RETURN_CHECK_FOR_STRUCT(Plane); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 7432440603..779f366c86 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -390,7 +390,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::BASIS: color = Color(0.89, 0.93, 0.41); break; - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: color = Color(0.96, 0.66, 0.43); break; @@ -496,7 +496,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::BASIS: color = Color(0.7, 0.73, 0.1); break; - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: color = Color(0.96, 0.56, 0.28); break; diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index fed6637acb..2dd18a492c 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -3921,7 +3921,7 @@ void register_visual_script_nodes() { VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::QUAT), create_node_deconst_typed); VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::AABB), create_node_deconst_typed); VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::BASIS), create_node_deconst_typed); - VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::TRANSFORM), create_node_deconst_typed); + VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::TRANSFORM3D), create_node_deconst_typed); VisualScriptLanguage::singleton->add_register_func("functions/compose_array", create_node_generic); for (int i = 1; i < Variant::VARIANT_MAX; i++) { diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis index 857c6a88f1..793265dc6f 100644 --- a/platform/windows/godot.natvis +++ b/platform/windows/godot.natvis @@ -40,7 +40,7 @@ {_data._transform2d} {_data._aabb} {_data._basis} - {_data._transform} + {_data._transform} {*(String *)_data._mem} {*(Vector2 *)_data._mem} {*(Rect2 *)_data._mem} @@ -72,7 +72,7 @@ _data._transform2d _data._aabb _data._basis - _data._transform + _data._transform *(String *)_data._mem *(Vector2 *)_data._mem *(Rect2 *)_data._mem diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index 3b05190eb9..d6ce8e99dc 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -756,16 +756,16 @@ void Node3D::_bind_methods() { BIND_CONSTANT(NOTIFICATION_EXIT_WORLD); BIND_CONSTANT(NOTIFICATION_VISIBILITY_CHANGED); - //ADD_PROPERTY( PropertyInfo(Variant::TRANSFORM,"transform/global",PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR ), "set_global_transform", "get_global_transform") ; + //ADD_PROPERTY( PropertyInfo(Variant::TRANSFORM3D,"transform/global",PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR ), "set_global_transform", "get_global_transform") ; ADD_GROUP("Transform", ""); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "global_transform", PROPERTY_HINT_NONE, "", 0), "set_global_transform", "get_global_transform"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "global_transform", PROPERTY_HINT_NONE, "", 0), "set_global_transform", "get_global_transform"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "translation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_translation", "get_translation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation_degrees", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_rotation_degrees", "get_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "rotation", PROPERTY_HINT_NONE, "", 0), "set_rotation", "get_rotation"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_scale", "get_scale"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "top_level"), "set_as_top_level", "is_set_as_top_level"); ADD_GROUP("Matrix", ""); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform", PROPERTY_HINT_NONE, ""), "set_transform", "get_transform"); ADD_GROUP("Visibility", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "visible"), "set_visible", "is_visible"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "gizmo", PROPERTY_HINT_RESOURCE_TYPE, "Node3DGizmo", 0), "set_gizmo", "get_gizmo"); diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 1db1602c20..c0c3419efe 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -2053,11 +2053,11 @@ void PhysicalBone3D::_bind_methods() { ADD_GROUP("Joint", "joint_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "joint_type", PROPERTY_HINT_ENUM, "None,PinJoint,ConeJoint,HingeJoint,SliderJoint,6DOFJoint"), "set_joint_type", "get_joint_type"); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "joint_offset"), "set_joint_offset", "get_joint_offset"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "joint_offset"), "set_joint_offset", "get_joint_offset"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "joint_rotation_degrees", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_joint_rotation_degrees", "get_joint_rotation_degrees"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "joint_rotation", PROPERTY_HINT_NONE, "", 0), "set_joint_rotation", "get_joint_rotation"); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "body_offset"), "set_body_offset", "get_body_offset"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "body_offset"), "set_body_offset", "get_body_offset"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mass", PROPERTY_HINT_EXP_RANGE, "0.01,65535,0.01"), "set_mass", "get_mass"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "friction", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_friction", "get_friction"); diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp index 5a09ebf8b2..2229232270 100644 --- a/scene/3d/skeleton_3d.cpp +++ b/scene/3d/skeleton_3d.cpp @@ -135,9 +135,9 @@ void Skeleton3D::_get_property_list(List *p_list) const { String prep = "bones/" + itos(i) + "/"; p_list->push_back(PropertyInfo(Variant::STRING, prep + "name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::INT, prep + "parent", PROPERTY_HINT_RANGE, "-1," + itos(bones.size() - 1) + ",1", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::TRANSFORM, prep + "rest", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, prep + "rest", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); p_list->push_back(PropertyInfo(Variant::BOOL, prep + "enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); - p_list->push_back(PropertyInfo(Variant::TRANSFORM, prep + "pose", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); + p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, prep + "pose", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR)); } } diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp index 8928dd20b2..1005d51e63 100644 --- a/scene/3d/skeleton_ik_3d.cpp +++ b/scene/3d/skeleton_ik_3d.cpp @@ -397,7 +397,7 @@ void SkeletonIK3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "root_bone"), "set_root_bone", "get_root_bone"); ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "tip_bone"), "set_tip_bone", "get_tip_bone"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "interpolation", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_interpolation", "get_interpolation"); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "target"), "set_target_transform", "get_target_transform"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "target"), "set_target_transform", "get_target_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "override_tip_basis"), "set_override_tip_basis", "is_override_tip_basis"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_magnet"), "set_use_magnet", "is_using_magnet"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "magnet"), "set_magnet_position", "get_magnet_position"); diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 5e843d3027..3a3bae085b 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -571,7 +571,7 @@ Variant Tween::_run_equation(InterpolateData &p_data) { result = r; } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { // Get the transforms for the initial and delta values Transform3D i = initial_val; Transform3D d = delta_val; @@ -1229,7 +1229,7 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final f.elements[2][2] - i.elements[2][2]); } break; - case Variant::TRANSFORM: { + case Variant::TRANSFORM3D: { // Build a new transform which is the difference between the initial and final values Transform3D i = initial_val; Transform3D f = final_val; @@ -1269,7 +1269,7 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final Variant::QUAT, Variant::AABB, Variant::BASIS, - Variant::TRANSFORM, + Variant::TRANSFORM3D, Variant::COLOR, }; diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp index cb3b2cb392..3d65c12cb7 100644 --- a/scene/main/shader_globals_override.cpp +++ b/scene/main/shader_globals_override.cpp @@ -169,7 +169,7 @@ void ShaderGlobalsOverride::_get_property_list(List *p_list) const pinfo.type = Variant::TRANSFORM2D; } break; case RS::GLOBAL_VAR_TYPE_TRANSFORM: { - pinfo.type = Variant::TRANSFORM; + pinfo.type = Variant::TRANSFORM3D; } break; case RS::GLOBAL_VAR_TYPE_MAT4: { pinfo.type = Variant::PACKED_INT32_ARRAY; diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index 332ac18dc1..33c9ca6d1e 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -97,10 +97,10 @@ void MeshLibrary::_get_property_list(List *p_list) const { String name = "item/" + itos(E->key()) + "/"; p_list->push_back(PropertyInfo(Variant::STRING, name + "name")); p_list->push_back(PropertyInfo(Variant::OBJECT, name + "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh")); - p_list->push_back(PropertyInfo(Variant::TRANSFORM, name + "mesh_transform")); + p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, name + "mesh_transform")); p_list->push_back(PropertyInfo(Variant::ARRAY, name + "shapes")); p_list->push_back(PropertyInfo(Variant::OBJECT, name + "navmesh", PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh")); - p_list->push_back(PropertyInfo(Variant::TRANSFORM, name + "navmesh_transform")); + p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, name + "navmesh_transform")); p_list->push_back(PropertyInfo(Variant::OBJECT, name + "preview", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_HELPER)); } } diff --git a/scene/resources/skin.cpp b/scene/resources/skin.cpp index 62a985061f..710612ae05 100644 --- a/scene/resources/skin.cpp +++ b/scene/resources/skin.cpp @@ -134,7 +134,7 @@ void Skin::_get_property_list(List *p_list) const { for (int i = 0; i < get_bind_count(); i++) { p_list->push_back(PropertyInfo(Variant::STRING_NAME, "bind/" + itos(i) + "/name")); p_list->push_back(PropertyInfo(Variant::INT, "bind/" + itos(i) + "/bone", PROPERTY_HINT_RANGE, "0,16384,1,or_greater", get_bind_name(i) != StringName() ? PROPERTY_USAGE_NOEDITOR : PROPERTY_USAGE_DEFAULT)); - p_list->push_back(PropertyInfo(Variant::TRANSFORM, "bind/" + itos(i) + "/pose")); + p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, "bind/" + itos(i) + "/pose")); } } diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 7bceed22ba..b6caae1e30 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -1412,7 +1412,7 @@ Error VisualShader::_write_node(Type type, StringBuilder &global_code, StringBui Vector3 val = defval; inputs[i] = "n_in" + itos(node) + "p" + itos(i); code += "\tvec3 " + inputs[i] + " = " + vformat("vec3(%.5f, %.5f, %.5f);\n", val.x, val.y, val.z); - } else if (defval.get_type() == Variant::TRANSFORM) { + } else if (defval.get_type() == Variant::TRANSFORM3D) { Transform3D val = defval; val.basis.transpose(); inputs[i] = "n_in" + itos(node) + "p" + itos(i); diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index a934417650..998fae0ae9 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -402,7 +402,7 @@ void VisualShaderNodeTransformConstant::_bind_methods() { ClassDB::bind_method(D_METHOD("set_constant", "value"), &VisualShaderNodeTransformConstant::set_constant); ClassDB::bind_method(D_METHOD("get_constant"), &VisualShaderNodeTransformConstant::get_constant); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "constant"), "set_constant", "get_constant"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "constant"), "set_constant", "get_constant"); } VisualShaderNodeTransformConstant::VisualShaderNodeTransformConstant() { @@ -4342,7 +4342,7 @@ void VisualShaderNodeTransformUniform::_bind_methods() { ClassDB::bind_method(D_METHOD("get_default_value"), &VisualShaderNodeTransformUniform::get_default_value); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "default_value_enabled"), "set_default_value_enabled", "is_default_value_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "default_value"), "set_default_value", "get_default_value"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "default_value"), "set_default_value", "get_default_value"); } bool VisualShaderNodeTransformUniform::is_show_prop_names() const { diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index 9d17c4b8e3..752a3b72d7 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -128,7 +128,7 @@ void PhysicsDirectBodyState3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "angular_velocity"), "set_angular_velocity", "get_angular_velocity"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "linear_velocity"), "set_linear_velocity", "get_linear_velocity"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "sleeping"), "set_sleep_state", "is_sleeping"); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform"), "set_transform", "get_transform"); } PhysicsDirectBodyState3D::PhysicsDirectBodyState3D() {} @@ -242,7 +242,7 @@ void PhysicsShapeQueryParameters3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0,100,0.01"), "set_margin", "get_margin"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape3D"), "set_shape", "get_shape"); ADD_PROPERTY(PropertyInfo(Variant::RID, "shape_rid"), "set_shape_rid", "get_shape_rid"); - ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform"); + ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "transform"), "set_transform", "get_transform"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_bodies"), "set_collide_with_bodies", "is_collide_with_bodies_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "collide_with_areas"), "set_collide_with_areas", "is_collide_with_areas_enabled"); } diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 519f147ed9..f485d79fb0 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -3040,7 +3040,7 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform pi.type = Variant::BASIS; break; case ShaderLanguage::TYPE_MAT4: - pi.type = Variant::TRANSFORM; + pi.type = Variant::TRANSFORM3D; break; case ShaderLanguage::TYPE_SAMPLER2D: case ShaderLanguage::TYPE_ISAMPLER2D: diff --git a/tests/test_class_db.h b/tests/test_class_db.h index 9ef4569c14..1e88792a85 100644 --- a/tests/test_class_db.h +++ b/tests/test_class_db.h @@ -240,7 +240,7 @@ bool arg_default_value_is_assignable_to_type(const Context &p_context, const Var p_arg_type.name == p_context.names_cache.node_path_type; case Variant::NODE_PATH: return p_arg_type.name == p_context.names_cache.node_path_type; - case Variant::TRANSFORM: + case Variant::TRANSFORM3D: case Variant::TRANSFORM2D: case Variant::BASIS: case Variant::QUAT: -- cgit v1.2.3 From a3c29ed899b7d99d5ca6ed41d55e8a60a5c33343 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Fri, 26 Feb 2021 23:26:56 -0500 Subject: Rename files and the exposed name for Transform3D --- core/math/camera_matrix.h | 2 +- core/math/face3.h | 2 +- core/math/transform.cpp | 212 ----------- core/math/transform.h | 232 ------------ core/math/transform_3d.cpp | 212 +++++++++++ core/math/transform_3d.h | 232 ++++++++++++ core/variant/variant.h | 2 +- modules/bullet/bullet_types_converter.h | 2 +- modules/bullet/collision_object_bullet.h | 2 +- modules/csg/csg.h | 2 +- modules/fbx/data/pivot_transform.h | 2 +- modules/fbx/fbx_parser/FBXDeformer.cpp | 2 +- modules/fbx/fbx_parser/FBXDocument.h | 2 +- modules/fbx/fbx_parser/FBXParser.cpp | 2 +- modules/fbx/fbx_parser/FBXParser.h | 2 +- modules/gdnative/gdnative/transform.cpp | 4 +- modules/gdnative/include/gdnative/transform.h | 2 +- modules/mono/editor/bindings_generator.cpp | 4 +- .../glue/GodotSharp/GodotSharp/Core/Transform.cs | 412 --------------------- .../glue/GodotSharp/GodotSharp/Core/Transform3D.cs | 412 +++++++++++++++++++++ .../glue/GodotSharp/GodotSharp/GodotSharp.csproj | 2 +- scene/3d/skeleton_ik_3d.h | 2 +- servers/navigation_server_2d.cpp | 2 +- servers/physics_3d/joints/jacobian_entry_3d_sw.h | 2 +- tests/test_math.cpp | 2 +- 25 files changed, 877 insertions(+), 877 deletions(-) delete mode 100644 core/math/transform.cpp delete mode 100644 core/math/transform.h create mode 100644 core/math/transform_3d.cpp create mode 100644 core/math/transform_3d.h delete mode 100644 modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs create mode 100644 modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs (limited to 'modules') diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index 7576f90224..786d46055a 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -32,7 +32,7 @@ #define CAMERA_MATRIX_H #include "core/math/rect2.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" struct CameraMatrix { enum Planes { diff --git a/core/math/face3.h b/core/math/face3.h index 7335e6eff8..5091b338ef 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -33,7 +33,7 @@ #include "core/math/aabb.h" #include "core/math/plane.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/math/vector3.h" class Face3 { diff --git a/core/math/transform.cpp b/core/math/transform.cpp deleted file mode 100644 index d5a78a7749..0000000000 --- a/core/math/transform.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/*************************************************************************/ -/* transform.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "transform.h" - -#include "core/math/math_funcs.h" -#include "core/string/print_string.h" - -void Transform3D::affine_invert() { - basis.invert(); - origin = basis.xform(-origin); -} - -Transform3D Transform3D::affine_inverse() const { - Transform3D ret = *this; - ret.affine_invert(); - return ret; -} - -void Transform3D::invert() { - basis.transpose(); - origin = basis.xform(-origin); -} - -Transform3D Transform3D::inverse() const { - // FIXME: this function assumes the basis is a rotation matrix, with no scaling. - // Transform3D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. - Transform3D ret = *this; - ret.invert(); - return ret; -} - -void Transform3D::rotate(const Vector3 &p_axis, real_t p_phi) { - *this = rotated(p_axis, p_phi); -} - -Transform3D Transform3D::rotated(const Vector3 &p_axis, real_t p_phi) const { - return Transform3D(Basis(p_axis, p_phi), Vector3()) * (*this); -} - -void Transform3D::rotate_basis(const Vector3 &p_axis, real_t p_phi) { - basis.rotate(p_axis, p_phi); -} - -Transform3D Transform3D::looking_at(const Vector3 &p_target, const Vector3 &p_up) const { - Transform3D t = *this; - t.set_look_at(origin, p_target, p_up); - return t; -} - -void Transform3D::set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up) { -#ifdef MATH_CHECKS - ERR_FAIL_COND(p_eye == p_target); - ERR_FAIL_COND(p_up.length() == 0); -#endif - // Reference: MESA source code - Vector3 v_x, v_y, v_z; - - /* Make rotation matrix */ - - /* Z vector */ - v_z = p_eye - p_target; - - v_z.normalize(); - - v_y = p_up; - - v_x = v_y.cross(v_z); -#ifdef MATH_CHECKS - ERR_FAIL_COND(v_x.length() == 0); -#endif - - /* Recompute Y = Z cross X */ - v_y = v_z.cross(v_x); - - v_x.normalize(); - v_y.normalize(); - - basis.set(v_x, v_y, v_z); - - origin = p_eye; -} - -Transform3D Transform3D::interpolate_with(const Transform3D &p_transform, real_t p_c) const { - /* not sure if very "efficient" but good enough? */ - - Vector3 src_scale = basis.get_scale(); - Quat src_rot = basis.get_rotation_quat(); - Vector3 src_loc = origin; - - Vector3 dst_scale = p_transform.basis.get_scale(); - Quat dst_rot = p_transform.basis.get_rotation_quat(); - Vector3 dst_loc = p_transform.origin; - - Transform3D interp; - interp.basis.set_quat_scale(src_rot.slerp(dst_rot, p_c).normalized(), src_scale.lerp(dst_scale, p_c)); - interp.origin = src_loc.lerp(dst_loc, p_c); - - return interp; -} - -void Transform3D::scale(const Vector3 &p_scale) { - basis.scale(p_scale); - origin *= p_scale; -} - -Transform3D Transform3D::scaled(const Vector3 &p_scale) const { - Transform3D t = *this; - t.scale(p_scale); - return t; -} - -void Transform3D::scale_basis(const Vector3 &p_scale) { - basis.scale(p_scale); -} - -void Transform3D::translate(real_t p_tx, real_t p_ty, real_t p_tz) { - translate(Vector3(p_tx, p_ty, p_tz)); -} - -void Transform3D::translate(const Vector3 &p_translation) { - for (int i = 0; i < 3; i++) { - origin[i] += basis[i].dot(p_translation); - } -} - -Transform3D Transform3D::translated(const Vector3 &p_translation) const { - Transform3D t = *this; - t.translate(p_translation); - return t; -} - -void Transform3D::orthonormalize() { - basis.orthonormalize(); -} - -Transform3D Transform3D::orthonormalized() const { - Transform3D _copy = *this; - _copy.orthonormalize(); - return _copy; -} - -bool Transform3D::is_equal_approx(const Transform3D &p_transform) const { - return basis.is_equal_approx(p_transform.basis) && origin.is_equal_approx(p_transform.origin); -} - -bool Transform3D::operator==(const Transform3D &p_transform) const { - return (basis == p_transform.basis && origin == p_transform.origin); -} - -bool Transform3D::operator!=(const Transform3D &p_transform) const { - return (basis != p_transform.basis || origin != p_transform.origin); -} - -void Transform3D::operator*=(const Transform3D &p_transform) { - origin = xform(p_transform.origin); - basis *= p_transform.basis; -} - -Transform3D Transform3D::operator*(const Transform3D &p_transform) const { - Transform3D t = *this; - t *= p_transform; - return t; -} - -Transform3D::operator String() const { - return basis.operator String() + " - " + origin.operator String(); -} - -Transform3D::Transform3D(const Basis &p_basis, const Vector3 &p_origin) : - basis(p_basis), - origin(p_origin) { -} - -Transform3D::Transform3D(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin) : - origin(p_origin) { - basis.set_axis(0, p_x); - basis.set_axis(1, p_y); - basis.set_axis(2, p_z); -} - -Transform3D::Transform3D(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz) { - basis = Basis(xx, xy, xz, yx, yy, yz, zx, zy, zz); - origin = Vector3(ox, oy, oz); -} diff --git a/core/math/transform.h b/core/math/transform.h deleted file mode 100644 index 5db7069a04..0000000000 --- a/core/math/transform.h +++ /dev/null @@ -1,232 +0,0 @@ -/*************************************************************************/ -/* transform.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef TRANSFORM_H -#define TRANSFORM_H - -#include "core/math/aabb.h" -#include "core/math/basis.h" -#include "core/math/plane.h" - -class Transform3D { -public: - Basis basis; - Vector3 origin; - - void invert(); - Transform3D inverse() const; - - void affine_invert(); - Transform3D affine_inverse() const; - - Transform3D rotated(const Vector3 &p_axis, real_t p_phi) const; - - void rotate(const Vector3 &p_axis, real_t p_phi); - void rotate_basis(const Vector3 &p_axis, real_t p_phi); - - void set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0)); - Transform3D looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0)) const; - - void scale(const Vector3 &p_scale); - Transform3D scaled(const Vector3 &p_scale) const; - void scale_basis(const Vector3 &p_scale); - void translate(real_t p_tx, real_t p_ty, real_t p_tz); - void translate(const Vector3 &p_translation); - Transform3D translated(const Vector3 &p_translation) const; - - const Basis &get_basis() const { return basis; } - void set_basis(const Basis &p_basis) { basis = p_basis; } - - const Vector3 &get_origin() const { return origin; } - void set_origin(const Vector3 &p_origin) { origin = p_origin; } - - void orthonormalize(); - Transform3D orthonormalized() const; - bool is_equal_approx(const Transform3D &p_transform) const; - - bool operator==(const Transform3D &p_transform) const; - bool operator!=(const Transform3D &p_transform) const; - - _FORCE_INLINE_ Vector3 xform(const Vector3 &p_vector) const; - _FORCE_INLINE_ Vector3 xform_inv(const Vector3 &p_vector) const; - - _FORCE_INLINE_ Plane xform(const Plane &p_plane) const; - _FORCE_INLINE_ Plane xform_inv(const Plane &p_plane) const; - - _FORCE_INLINE_ AABB xform(const AABB &p_aabb) const; - _FORCE_INLINE_ AABB xform_inv(const AABB &p_aabb) const; - - _FORCE_INLINE_ Vector xform(const Vector &p_array) const; - _FORCE_INLINE_ Vector xform_inv(const Vector &p_array) const; - - void operator*=(const Transform3D &p_transform); - Transform3D operator*(const Transform3D &p_transform) const; - - Transform3D interpolate_with(const Transform3D &p_transform, real_t p_c) const; - - _FORCE_INLINE_ Transform3D inverse_xform(const Transform3D &t) const { - Vector3 v = t.origin - origin; - return Transform3D(basis.transpose_xform(t.basis), - basis.xform(v)); - } - - void set(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t tx, real_t ty, real_t tz) { - basis.set(xx, xy, xz, yx, yy, yz, zx, zy, zz); - origin.x = tx; - origin.y = ty; - origin.z = tz; - } - - operator String() const; - - Transform3D() {} - Transform3D(const Basis &p_basis, const Vector3 &p_origin = Vector3()); - Transform3D(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin); - Transform3D(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz); -}; - -_FORCE_INLINE_ Vector3 Transform3D::xform(const Vector3 &p_vector) const { - return Vector3( - basis[0].dot(p_vector) + origin.x, - basis[1].dot(p_vector) + origin.y, - basis[2].dot(p_vector) + origin.z); -} - -_FORCE_INLINE_ Vector3 Transform3D::xform_inv(const Vector3 &p_vector) const { - Vector3 v = p_vector - origin; - - return Vector3( - (basis.elements[0][0] * v.x) + (basis.elements[1][0] * v.y) + (basis.elements[2][0] * v.z), - (basis.elements[0][1] * v.x) + (basis.elements[1][1] * v.y) + (basis.elements[2][1] * v.z), - (basis.elements[0][2] * v.x) + (basis.elements[1][2] * v.y) + (basis.elements[2][2] * v.z)); -} - -_FORCE_INLINE_ Plane Transform3D::xform(const Plane &p_plane) const { - Vector3 point = p_plane.normal * p_plane.d; - Vector3 point_dir = point + p_plane.normal; - point = xform(point); - point_dir = xform(point_dir); - - Vector3 normal = point_dir - point; - normal.normalize(); - real_t d = normal.dot(point); - - return Plane(normal, d); -} - -_FORCE_INLINE_ Plane Transform3D::xform_inv(const Plane &p_plane) const { - Vector3 point = p_plane.normal * p_plane.d; - Vector3 point_dir = point + p_plane.normal; - point = xform_inv(point); - point_dir = xform_inv(point_dir); - - Vector3 normal = point_dir - point; - normal.normalize(); - real_t d = normal.dot(point); - - return Plane(normal, d); -} - -_FORCE_INLINE_ AABB Transform3D::xform(const AABB &p_aabb) const { - /* http://dev.theomader.com/transform-bounding-boxes/ */ - Vector3 min = p_aabb.position; - Vector3 max = p_aabb.position + p_aabb.size; - Vector3 tmin, tmax; - for (int i = 0; i < 3; i++) { - tmin[i] = tmax[i] = origin[i]; - for (int j = 0; j < 3; j++) { - real_t e = basis[i][j] * min[j]; - real_t f = basis[i][j] * max[j]; - if (e < f) { - tmin[i] += e; - tmax[i] += f; - } else { - tmin[i] += f; - tmax[i] += e; - } - } - } - AABB r_aabb; - r_aabb.position = tmin; - r_aabb.size = tmax - tmin; - return r_aabb; -} - -_FORCE_INLINE_ AABB Transform3D::xform_inv(const AABB &p_aabb) const { - /* define vertices */ - Vector3 vertices[8] = { - Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z), - Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z), - Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z), - Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z), - Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z), - Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z), - Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z), - Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z) - }; - - AABB ret; - - ret.position = xform_inv(vertices[0]); - - for (int i = 1; i < 8; i++) { - ret.expand_to(xform_inv(vertices[i])); - } - - return ret; -} - -Vector Transform3D::xform(const Vector &p_array) const { - Vector array; - array.resize(p_array.size()); - - const Vector3 *r = p_array.ptr(); - Vector3 *w = array.ptrw(); - - for (int i = 0; i < p_array.size(); ++i) { - w[i] = xform(r[i]); - } - return array; -} - -Vector Transform3D::xform_inv(const Vector &p_array) const { - Vector array; - array.resize(p_array.size()); - - const Vector3 *r = p_array.ptr(); - Vector3 *w = array.ptrw(); - - for (int i = 0; i < p_array.size(); ++i) { - w[i] = xform_inv(r[i]); - } - return array; -} - -#endif // TRANSFORM_H diff --git a/core/math/transform_3d.cpp b/core/math/transform_3d.cpp new file mode 100644 index 0000000000..2611d6accf --- /dev/null +++ b/core/math/transform_3d.cpp @@ -0,0 +1,212 @@ +/*************************************************************************/ +/* transform_3d.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "transform_3d.h" + +#include "core/math/math_funcs.h" +#include "core/string/print_string.h" + +void Transform3D::affine_invert() { + basis.invert(); + origin = basis.xform(-origin); +} + +Transform3D Transform3D::affine_inverse() const { + Transform3D ret = *this; + ret.affine_invert(); + return ret; +} + +void Transform3D::invert() { + basis.transpose(); + origin = basis.xform(-origin); +} + +Transform3D Transform3D::inverse() const { + // FIXME: this function assumes the basis is a rotation matrix, with no scaling. + // Transform3D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. + Transform3D ret = *this; + ret.invert(); + return ret; +} + +void Transform3D::rotate(const Vector3 &p_axis, real_t p_phi) { + *this = rotated(p_axis, p_phi); +} + +Transform3D Transform3D::rotated(const Vector3 &p_axis, real_t p_phi) const { + return Transform3D(Basis(p_axis, p_phi), Vector3()) * (*this); +} + +void Transform3D::rotate_basis(const Vector3 &p_axis, real_t p_phi) { + basis.rotate(p_axis, p_phi); +} + +Transform3D Transform3D::looking_at(const Vector3 &p_target, const Vector3 &p_up) const { + Transform3D t = *this; + t.set_look_at(origin, p_target, p_up); + return t; +} + +void Transform3D::set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up) { +#ifdef MATH_CHECKS + ERR_FAIL_COND(p_eye == p_target); + ERR_FAIL_COND(p_up.length() == 0); +#endif + // Reference: MESA source code + Vector3 v_x, v_y, v_z; + + /* Make rotation matrix */ + + /* Z vector */ + v_z = p_eye - p_target; + + v_z.normalize(); + + v_y = p_up; + + v_x = v_y.cross(v_z); +#ifdef MATH_CHECKS + ERR_FAIL_COND(v_x.length() == 0); +#endif + + /* Recompute Y = Z cross X */ + v_y = v_z.cross(v_x); + + v_x.normalize(); + v_y.normalize(); + + basis.set(v_x, v_y, v_z); + + origin = p_eye; +} + +Transform3D Transform3D::interpolate_with(const Transform3D &p_transform, real_t p_c) const { + /* not sure if very "efficient" but good enough? */ + + Vector3 src_scale = basis.get_scale(); + Quat src_rot = basis.get_rotation_quat(); + Vector3 src_loc = origin; + + Vector3 dst_scale = p_transform.basis.get_scale(); + Quat dst_rot = p_transform.basis.get_rotation_quat(); + Vector3 dst_loc = p_transform.origin; + + Transform3D interp; + interp.basis.set_quat_scale(src_rot.slerp(dst_rot, p_c).normalized(), src_scale.lerp(dst_scale, p_c)); + interp.origin = src_loc.lerp(dst_loc, p_c); + + return interp; +} + +void Transform3D::scale(const Vector3 &p_scale) { + basis.scale(p_scale); + origin *= p_scale; +} + +Transform3D Transform3D::scaled(const Vector3 &p_scale) const { + Transform3D t = *this; + t.scale(p_scale); + return t; +} + +void Transform3D::scale_basis(const Vector3 &p_scale) { + basis.scale(p_scale); +} + +void Transform3D::translate(real_t p_tx, real_t p_ty, real_t p_tz) { + translate(Vector3(p_tx, p_ty, p_tz)); +} + +void Transform3D::translate(const Vector3 &p_translation) { + for (int i = 0; i < 3; i++) { + origin[i] += basis[i].dot(p_translation); + } +} + +Transform3D Transform3D::translated(const Vector3 &p_translation) const { + Transform3D t = *this; + t.translate(p_translation); + return t; +} + +void Transform3D::orthonormalize() { + basis.orthonormalize(); +} + +Transform3D Transform3D::orthonormalized() const { + Transform3D _copy = *this; + _copy.orthonormalize(); + return _copy; +} + +bool Transform3D::is_equal_approx(const Transform3D &p_transform) const { + return basis.is_equal_approx(p_transform.basis) && origin.is_equal_approx(p_transform.origin); +} + +bool Transform3D::operator==(const Transform3D &p_transform) const { + return (basis == p_transform.basis && origin == p_transform.origin); +} + +bool Transform3D::operator!=(const Transform3D &p_transform) const { + return (basis != p_transform.basis || origin != p_transform.origin); +} + +void Transform3D::operator*=(const Transform3D &p_transform) { + origin = xform(p_transform.origin); + basis *= p_transform.basis; +} + +Transform3D Transform3D::operator*(const Transform3D &p_transform) const { + Transform3D t = *this; + t *= p_transform; + return t; +} + +Transform3D::operator String() const { + return basis.operator String() + " - " + origin.operator String(); +} + +Transform3D::Transform3D(const Basis &p_basis, const Vector3 &p_origin) : + basis(p_basis), + origin(p_origin) { +} + +Transform3D::Transform3D(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin) : + origin(p_origin) { + basis.set_axis(0, p_x); + basis.set_axis(1, p_y); + basis.set_axis(2, p_z); +} + +Transform3D::Transform3D(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz) { + basis = Basis(xx, xy, xz, yx, yy, yz, zx, zy, zz); + origin = Vector3(ox, oy, oz); +} diff --git a/core/math/transform_3d.h b/core/math/transform_3d.h new file mode 100644 index 0000000000..078a2ca11a --- /dev/null +++ b/core/math/transform_3d.h @@ -0,0 +1,232 @@ +/*************************************************************************/ +/* transform_3d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef TRANSFORM_H +#define TRANSFORM_H + +#include "core/math/aabb.h" +#include "core/math/basis.h" +#include "core/math/plane.h" + +class Transform3D { +public: + Basis basis; + Vector3 origin; + + void invert(); + Transform3D inverse() const; + + void affine_invert(); + Transform3D affine_inverse() const; + + Transform3D rotated(const Vector3 &p_axis, real_t p_phi) const; + + void rotate(const Vector3 &p_axis, real_t p_phi); + void rotate_basis(const Vector3 &p_axis, real_t p_phi); + + void set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0)); + Transform3D looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0)) const; + + void scale(const Vector3 &p_scale); + Transform3D scaled(const Vector3 &p_scale) const; + void scale_basis(const Vector3 &p_scale); + void translate(real_t p_tx, real_t p_ty, real_t p_tz); + void translate(const Vector3 &p_translation); + Transform3D translated(const Vector3 &p_translation) const; + + const Basis &get_basis() const { return basis; } + void set_basis(const Basis &p_basis) { basis = p_basis; } + + const Vector3 &get_origin() const { return origin; } + void set_origin(const Vector3 &p_origin) { origin = p_origin; } + + void orthonormalize(); + Transform3D orthonormalized() const; + bool is_equal_approx(const Transform3D &p_transform) const; + + bool operator==(const Transform3D &p_transform) const; + bool operator!=(const Transform3D &p_transform) const; + + _FORCE_INLINE_ Vector3 xform(const Vector3 &p_vector) const; + _FORCE_INLINE_ Vector3 xform_inv(const Vector3 &p_vector) const; + + _FORCE_INLINE_ Plane xform(const Plane &p_plane) const; + _FORCE_INLINE_ Plane xform_inv(const Plane &p_plane) const; + + _FORCE_INLINE_ AABB xform(const AABB &p_aabb) const; + _FORCE_INLINE_ AABB xform_inv(const AABB &p_aabb) const; + + _FORCE_INLINE_ Vector xform(const Vector &p_array) const; + _FORCE_INLINE_ Vector xform_inv(const Vector &p_array) const; + + void operator*=(const Transform3D &p_transform); + Transform3D operator*(const Transform3D &p_transform) const; + + Transform3D interpolate_with(const Transform3D &p_transform, real_t p_c) const; + + _FORCE_INLINE_ Transform3D inverse_xform(const Transform3D &t) const { + Vector3 v = t.origin - origin; + return Transform3D(basis.transpose_xform(t.basis), + basis.xform(v)); + } + + void set(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t tx, real_t ty, real_t tz) { + basis.set(xx, xy, xz, yx, yy, yz, zx, zy, zz); + origin.x = tx; + origin.y = ty; + origin.z = tz; + } + + operator String() const; + + Transform3D() {} + Transform3D(const Basis &p_basis, const Vector3 &p_origin = Vector3()); + Transform3D(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin); + Transform3D(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz, real_t ox, real_t oy, real_t oz); +}; + +_FORCE_INLINE_ Vector3 Transform3D::xform(const Vector3 &p_vector) const { + return Vector3( + basis[0].dot(p_vector) + origin.x, + basis[1].dot(p_vector) + origin.y, + basis[2].dot(p_vector) + origin.z); +} + +_FORCE_INLINE_ Vector3 Transform3D::xform_inv(const Vector3 &p_vector) const { + Vector3 v = p_vector - origin; + + return Vector3( + (basis.elements[0][0] * v.x) + (basis.elements[1][0] * v.y) + (basis.elements[2][0] * v.z), + (basis.elements[0][1] * v.x) + (basis.elements[1][1] * v.y) + (basis.elements[2][1] * v.z), + (basis.elements[0][2] * v.x) + (basis.elements[1][2] * v.y) + (basis.elements[2][2] * v.z)); +} + +_FORCE_INLINE_ Plane Transform3D::xform(const Plane &p_plane) const { + Vector3 point = p_plane.normal * p_plane.d; + Vector3 point_dir = point + p_plane.normal; + point = xform(point); + point_dir = xform(point_dir); + + Vector3 normal = point_dir - point; + normal.normalize(); + real_t d = normal.dot(point); + + return Plane(normal, d); +} + +_FORCE_INLINE_ Plane Transform3D::xform_inv(const Plane &p_plane) const { + Vector3 point = p_plane.normal * p_plane.d; + Vector3 point_dir = point + p_plane.normal; + point = xform_inv(point); + point_dir = xform_inv(point_dir); + + Vector3 normal = point_dir - point; + normal.normalize(); + real_t d = normal.dot(point); + + return Plane(normal, d); +} + +_FORCE_INLINE_ AABB Transform3D::xform(const AABB &p_aabb) const { + /* http://dev.theomader.com/transform-bounding-boxes/ */ + Vector3 min = p_aabb.position; + Vector3 max = p_aabb.position + p_aabb.size; + Vector3 tmin, tmax; + for (int i = 0; i < 3; i++) { + tmin[i] = tmax[i] = origin[i]; + for (int j = 0; j < 3; j++) { + real_t e = basis[i][j] * min[j]; + real_t f = basis[i][j] * max[j]; + if (e < f) { + tmin[i] += e; + tmax[i] += f; + } else { + tmin[i] += f; + tmax[i] += e; + } + } + } + AABB r_aabb; + r_aabb.position = tmin; + r_aabb.size = tmax - tmin; + return r_aabb; +} + +_FORCE_INLINE_ AABB Transform3D::xform_inv(const AABB &p_aabb) const { + /* define vertices */ + Vector3 vertices[8] = { + Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z), + Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z), + Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z), + Vector3(p_aabb.position.x + p_aabb.size.x, p_aabb.position.y, p_aabb.position.z), + Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z + p_aabb.size.z), + Vector3(p_aabb.position.x, p_aabb.position.y + p_aabb.size.y, p_aabb.position.z), + Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z + p_aabb.size.z), + Vector3(p_aabb.position.x, p_aabb.position.y, p_aabb.position.z) + }; + + AABB ret; + + ret.position = xform_inv(vertices[0]); + + for (int i = 1; i < 8; i++) { + ret.expand_to(xform_inv(vertices[i])); + } + + return ret; +} + +Vector Transform3D::xform(const Vector &p_array) const { + Vector array; + array.resize(p_array.size()); + + const Vector3 *r = p_array.ptr(); + Vector3 *w = array.ptrw(); + + for (int i = 0; i < p_array.size(); ++i) { + w[i] = xform(r[i]); + } + return array; +} + +Vector Transform3D::xform_inv(const Vector &p_array) const { + Vector array; + array.resize(p_array.size()); + + const Vector3 *r = p_array.ptr(); + Vector3 *w = array.ptrw(); + + for (int i = 0; i < p_array.size(); ++i) { + w[i] = xform_inv(r[i]); + } + return array; +} + +#endif // TRANSFORM_H diff --git a/core/variant/variant.h b/core/variant/variant.h index 2b41ab5402..4945e967eb 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -38,8 +38,8 @@ #include "core/math/face3.h" #include "core/math/plane.h" #include "core/math/quat.h" -#include "core/math/transform.h" #include "core/math/transform_2d.h" +#include "core/math/transform_3d.h" #include "core/math/vector3.h" #include "core/math/vector3i.h" #include "core/object/object_id.h" diff --git a/modules/bullet/bullet_types_converter.h b/modules/bullet/bullet_types_converter.h index 74cdabd717..e184fe1769 100644 --- a/modules/bullet/bullet_types_converter.h +++ b/modules/bullet/bullet_types_converter.h @@ -32,7 +32,7 @@ #define BULLET_TYPES_CONVERTER_H #include "core/math/basis.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/math/vector3.h" #include "core/typedefs.h" diff --git a/modules/bullet/collision_object_bullet.h b/modules/bullet/collision_object_bullet.h index 67be2fd6da..944ab89b87 100644 --- a/modules/bullet/collision_object_bullet.h +++ b/modules/bullet/collision_object_bullet.h @@ -31,7 +31,7 @@ #ifndef COLLISION_OBJECT_BULLET_H #define COLLISION_OBJECT_BULLET_H -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/math/vector3.h" #include "core/object/class_db.h" #include "core/templates/vset.h" diff --git a/modules/csg/csg.h b/modules/csg/csg.h index 37a11eea90..4bd79e15a9 100644 --- a/modules/csg/csg.h +++ b/modules/csg/csg.h @@ -33,7 +33,7 @@ #include "core/math/aabb.h" #include "core/math/plane.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/math/vector2.h" #include "core/math/vector3.h" #include "core/object/reference.h" diff --git a/modules/fbx/data/pivot_transform.h b/modules/fbx/data/pivot_transform.h index c3b6accd5b..8ed8358b70 100644 --- a/modules/fbx/data/pivot_transform.h +++ b/modules/fbx/data/pivot_transform.h @@ -31,7 +31,7 @@ #ifndef PIVOT_TRANSFORM_H #define PIVOT_TRANSFORM_H -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/object/reference.h" #include "model_abstraction.h" diff --git a/modules/fbx/fbx_parser/FBXDeformer.cpp b/modules/fbx/fbx_parser/FBXDeformer.cpp index 039718ae15..4220ba62a7 100644 --- a/modules/fbx/fbx_parser/FBXDeformer.cpp +++ b/modules/fbx/fbx_parser/FBXDeformer.cpp @@ -78,7 +78,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "FBXMeshGeometry.h" #include "FBXParser.h" #include "core/math/math_funcs.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include diff --git a/modules/fbx/fbx_parser/FBXDocument.h b/modules/fbx/fbx_parser/FBXDocument.h index 8aa4cdf479..885ff8fca4 100644 --- a/modules/fbx/fbx_parser/FBXDocument.h +++ b/modules/fbx/fbx_parser/FBXDocument.h @@ -37,7 +37,7 @@ #include "FBXCommon.h" #include "FBXParser.h" #include "FBXProperties.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/math/vector2.h" #include "core/math/vector3.h" #include "core/string/print_string.h" diff --git a/modules/fbx/fbx_parser/FBXParser.cpp b/modules/fbx/fbx_parser/FBXParser.cpp index 2d8b190779..163518d18f 100644 --- a/modules/fbx/fbx_parser/FBXParser.cpp +++ b/modules/fbx/fbx_parser/FBXParser.cpp @@ -82,7 +82,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "FBXParser.h" #include "FBXTokenizer.h" #include "core/math/math_defs.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/math/vector3.h" #include "core/string/print_string.h" diff --git a/modules/fbx/fbx_parser/FBXParser.h b/modules/fbx/fbx_parser/FBXParser.h index d1f1f93d5f..93836c2205 100644 --- a/modules/fbx/fbx_parser/FBXParser.h +++ b/modules/fbx/fbx_parser/FBXParser.h @@ -81,7 +81,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "core/math/color.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/math/vector2.h" #include "core/math/vector3.h" diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp index 1a6be4b521..de47b2fe0a 100644 --- a/modules/gdnative/gdnative/transform.cpp +++ b/modules/gdnative/gdnative/transform.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* transform.cpp */ +/* transform_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -30,7 +30,7 @@ #include "gdnative/transform.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" static_assert(sizeof(godot_transform) == sizeof(Transform3D), "Transform3D size mismatch"); diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h index 3861b5683a..f9acb52377 100644 --- a/modules/gdnative/include/gdnative/transform.h +++ b/modules/gdnative/include/gdnative/transform.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* transform.h */ +/* transform_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 72e26070e1..c2707e46d9 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -3126,10 +3126,10 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar case Variant::TRANSFORM3D: { Transform3D transform = p_val.operator Transform3D(); if (transform == Transform3D()) { - r_iarg.default_argument = "Transform.Identity"; + r_iarg.default_argument = "Transform3D.Identity"; } else { Basis basis = transform.basis; - r_iarg.default_argument = "new Transform(new Vector3" + basis.get_column(0).operator String() + ", new Vector3" + basis.get_column(1).operator String() + ", new Vector3" + basis.get_column(2).operator String() + ", new Vector3" + transform.origin.operator String() + ")"; + r_iarg.default_argument = "new Transform3D(new Vector3" + basis.get_column(0).operator String() + ", new Vector3" + basis.get_column(1).operator String() + ", new Vector3" + basis.get_column(2).operator String() + ", new Vector3" + transform.origin.operator String() + ")"; } r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL; } break; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs deleted file mode 100644 index 9e5ff2b315..0000000000 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform.cs +++ /dev/null @@ -1,412 +0,0 @@ -using System; -using System.Runtime.InteropServices; -#if REAL_T_IS_DOUBLE -using real_t = System.Double; -#else -using real_t = System.Single; -#endif - -namespace Godot -{ - /// - /// 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. - /// It can represent transformations such as translation, rotation, or scaling. - /// It consists of a (first 3 columns) and a - /// for the origin (last column). - /// - /// For more information, read this documentation article: - /// https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html - /// - [Serializable] - [StructLayout(LayoutKind.Sequential)] - public struct Transform3D : IEquatable - { - /// - /// The of this transform. Contains the X, Y, and Z basis - /// vectors (columns 0 to 2) and is responsible for rotation and scale. - /// - public Basis basis; - - /// - /// The origin vector (column 3, the fourth column). Equivalent to array index `[3]`. - /// - public Vector3 origin; - - /// - /// Access whole columns in the form of Vector3. The fourth column is the origin vector. - /// - /// Which column vector. - public Vector3 this[int column] - { - get - { - switch (column) - { - case 0: - return basis.Column0; - case 1: - return basis.Column1; - case 2: - return basis.Column2; - case 3: - return origin; - default: - throw new IndexOutOfRangeException(); - } - } - set - { - switch (column) - { - case 0: - basis.Column0 = value; - return; - case 1: - basis.Column1 = value; - return; - case 2: - basis.Column2 = value; - return; - case 3: - origin = value; - return; - default: - throw new IndexOutOfRangeException(); - } - } - } - - /// - /// Access matrix elements in column-major order. The fourth column is the origin vector. - /// - /// Which column, the matrix horizontal position. - /// Which row, the matrix vertical position. - public real_t this[int column, int row] - { - get - { - if (column == 3) - { - return origin[row]; - } - return basis[column, row]; - } - set - { - if (column == 3) - { - origin[row] = value; - return; - } - basis[column, row] = value; - } - } - - /// - /// Returns the inverse of the transform, under the assumption that - /// the transformation is composed of rotation, scaling, and translation. - /// - /// The inverse transformation matrix. - public Transform3D AffineInverse() - { - Basis basisInv = basis.Inverse(); - return new Transform3D(basisInv, basisInv.Xform(-origin)); - } - - /// - /// Interpolates this transform to the other `transform` by `weight`. - /// - /// The other transform. - /// A value on the range of 0.0 to 1.0, representing the amount of interpolation. - /// The interpolated transform. - public Transform3D InterpolateWith(Transform3D transform, real_t weight) - { - /* not sure if very "efficient" but good enough? */ - - Vector3 sourceScale = basis.Scale; - Quat sourceRotation = basis.RotationQuat(); - Vector3 sourceLocation = origin; - - Vector3 destinationScale = transform.basis.Scale; - Quat destinationRotation = transform.basis.RotationQuat(); - Vector3 destinationLocation = transform.origin; - - var interpolated = new Transform3D(); - interpolated.basis.SetQuatScale(sourceRotation.Slerp(destinationRotation, weight).Normalized(), sourceScale.Lerp(destinationScale, weight)); - interpolated.origin = sourceLocation.Lerp(destinationLocation, weight); - - return interpolated; - } - - /// - /// Returns the inverse of the transform, under the assumption that - /// the transformation is composed of rotation and translation - /// (no scaling, use for transforms with scaling). - /// - /// The inverse matrix. - public Transform3D Inverse() - { - Basis basisTr = basis.Transposed(); - return new Transform3D(basisTr, basisTr.Xform(-origin)); - } - - /// - /// Returns a copy of the transform rotated such that its - /// -Z axis (forward) points towards the target position. - /// - /// The transform will first be rotated around the given up vector, - /// and then fully aligned to the target by a further rotation around - /// an axis perpendicular to both the target and up vectors. - /// - /// Operations take place in global space. - /// - /// The object to look at. - /// The relative up direction - /// The resulting transform. - public Transform3D LookingAt(Vector3 target, Vector3 up) - { - var t = this; - t.SetLookAt(origin, target, up); - return t; - } - - /// - /// Returns the transform with the basis orthogonal (90 degrees), - /// and normalized axis vectors (scale of 1 or -1). - /// - /// The orthonormalized transform. - public Transform3D Orthonormalized() - { - return new Transform3D(basis.Orthonormalized(), origin); - } - - /// - /// Rotates the transform around the given `axis` by `phi` (in radians), - /// using matrix multiplication. The axis must be a normalized vector. - /// - /// The axis to rotate around. Must be normalized. - /// The angle to rotate, in radians. - /// The rotated transformation matrix. - public Transform3D Rotated(Vector3 axis, real_t phi) - { - return new Transform3D(new Basis(axis, phi), new Vector3()) * this; - } - - /// - /// Scales the transform by the given 3D scaling factor, using matrix multiplication. - /// - /// The scale to introduce. - /// The scaled transformation matrix. - public Transform3D Scaled(Vector3 scale) - { - return new Transform3D(basis.Scaled(scale), origin * scale); - } - - private void SetLookAt(Vector3 eye, Vector3 target, Vector3 up) - { - // Make rotation matrix - // Z vector - Vector3 column2 = eye - target; - - column2.Normalize(); - - Vector3 column1 = up; - - Vector3 column0 = column1.Cross(column2); - - // Recompute Y = Z cross X - column1 = column2.Cross(column0); - - column0.Normalize(); - column1.Normalize(); - - basis = new Basis(column0, column1, column2); - - origin = eye; - } - - /// - /// Translates the transform by the given `offset`, - /// relative to the transform's basis vectors. - /// - /// Unlike and , - /// this does not use matrix multiplication. - /// - /// The offset to translate by. - /// The translated matrix. - public Transform3D Translated(Vector3 offset) - { - return new Transform3D(basis, new Vector3 - ( - origin[0] += basis.Row0.Dot(offset), - origin[1] += basis.Row1.Dot(offset), - origin[2] += basis.Row2.Dot(offset) - )); - } - - /// - /// Returns a vector transformed (multiplied) by this transformation matrix. - /// - /// A vector to transform. - /// The transformed vector. - public Vector3 Xform(Vector3 v) - { - return new Vector3 - ( - basis.Row0.Dot(v) + origin.x, - basis.Row1.Dot(v) + origin.y, - basis.Row2.Dot(v) + origin.z - ); - } - - /// - /// Returns a vector transformed (multiplied) by the transposed transformation matrix. - /// - /// Note: This results in a multiplication by the inverse of the - /// transformation matrix only if it represents a rotation-reflection. - /// - /// A vector to inversely transform. - /// The inversely transformed vector. - public Vector3 XformInv(Vector3 v) - { - Vector3 vInv = v - origin; - - return new Vector3 - ( - basis.Row0[0] * vInv.x + basis.Row1[0] * vInv.y + basis.Row2[0] * vInv.z, - basis.Row0[1] * vInv.x + basis.Row1[1] * vInv.y + basis.Row2[1] * vInv.z, - basis.Row0[2] * vInv.x + basis.Row1[2] * vInv.y + basis.Row2[2] * vInv.z - ); - } - - // Constants - private static readonly Transform3D _identity = new Transform3D(Basis.Identity, Vector3.Zero); - private static readonly Transform3D _flipX = new Transform3D(new Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1), Vector3.Zero); - private static readonly Transform3D _flipY = new Transform3D(new Basis(1, 0, 0, 0, -1, 0, 0, 0, 1), Vector3.Zero); - private static readonly Transform3D _flipZ = new Transform3D(new Basis(1, 0, 0, 0, 1, 0, 0, 0, -1), Vector3.Zero); - - /// - /// The identity transform, with no translation, rotation, or scaling applied. - /// This is used as a replacement for `Transform()` in GDScript. - /// Do not use `new Transform()` with no arguments in C#, because it sets all values to zero. - /// - /// Equivalent to `new Transform(Vector3.Right, Vector3.Up, Vector3.Back, Vector3.Zero)`. - public static Transform3D Identity { get { return _identity; } } - /// - /// The transform that will flip something along the X axis. - /// - /// Equivalent to `new Transform(Vector3.Left, Vector3.Up, Vector3.Back, Vector3.Zero)`. - public static Transform3D FlipX { get { return _flipX; } } - /// - /// The transform that will flip something along the Y axis. - /// - /// Equivalent to `new Transform(Vector3.Right, Vector3.Down, Vector3.Back, Vector3.Zero)`. - public static Transform3D FlipY { get { return _flipY; } } - /// - /// The transform that will flip something along the Z axis. - /// - /// Equivalent to `new Transform(Vector3.Right, Vector3.Up, Vector3.Forward, Vector3.Zero)`. - public static Transform3D FlipZ { get { return _flipZ; } } - - /// - /// Constructs a transformation matrix from 4 vectors (matrix columns). - /// - /// The X vector, or column index 0. - /// The Y vector, or column index 1. - /// The Z vector, or column index 2. - /// The origin vector, or column index 3. - public Transform3D(Vector3 column0, Vector3 column1, Vector3 column2, Vector3 origin) - { - basis = new Basis(column0, column1, column2); - this.origin = origin; - } - - /// - /// Constructs a transformation matrix from the given quaternion and origin vector. - /// - /// The to create the basis from. - /// The origin vector, or column index 3. - public Transform3D(Quat quat, Vector3 origin) - { - basis = new Basis(quat); - this.origin = origin; - } - - /// - /// Constructs a transformation matrix from the given basis and origin vector. - /// - /// The to create the basis from. - /// The origin vector, or column index 3. - public Transform3D(Basis basis, Vector3 origin) - { - this.basis = basis; - this.origin = origin; - } - - public static Transform3D operator *(Transform3D left, Transform3D right) - { - left.origin = left.Xform(right.origin); - left.basis *= right.basis; - return left; - } - - public static bool operator ==(Transform3D left, Transform3D right) - { - return left.Equals(right); - } - - public static bool operator !=(Transform3D left, Transform3D right) - { - return !left.Equals(right); - } - - public override bool Equals(object obj) - { - if (obj is Transform3D) - { - return Equals((Transform3D)obj); - } - - return false; - } - - public bool Equals(Transform3D other) - { - return basis.Equals(other.basis) && origin.Equals(other.origin); - } - - /// - /// Returns true if this transform and `other` are approximately equal, by running - /// on each component. - /// - /// The other transform to compare. - /// Whether or not the matrices are approximately equal. - public bool IsEqualApprox(Transform3D other) - { - return basis.IsEqualApprox(other.basis) && origin.IsEqualApprox(other.origin); - } - - public override int GetHashCode() - { - return basis.GetHashCode() ^ origin.GetHashCode(); - } - - public override string ToString() - { - return String.Format("{0} - {1}", new object[] - { - basis.ToString(), - origin.ToString() - }); - } - - public string ToString(string format) - { - return String.Format("{0} - {1}", new object[] - { - basis.ToString(format), - origin.ToString(format) - }); - } - } -} diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs new file mode 100644 index 0000000000..9e5ff2b315 --- /dev/null +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs @@ -0,0 +1,412 @@ +using System; +using System.Runtime.InteropServices; +#if REAL_T_IS_DOUBLE +using real_t = System.Double; +#else +using real_t = System.Single; +#endif + +namespace Godot +{ + /// + /// 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. + /// It can represent transformations such as translation, rotation, or scaling. + /// It consists of a (first 3 columns) and a + /// for the origin (last column). + /// + /// For more information, read this documentation article: + /// https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html + /// + [Serializable] + [StructLayout(LayoutKind.Sequential)] + public struct Transform3D : IEquatable + { + /// + /// The of this transform. Contains the X, Y, and Z basis + /// vectors (columns 0 to 2) and is responsible for rotation and scale. + /// + public Basis basis; + + /// + /// The origin vector (column 3, the fourth column). Equivalent to array index `[3]`. + /// + public Vector3 origin; + + /// + /// Access whole columns in the form of Vector3. The fourth column is the origin vector. + /// + /// Which column vector. + public Vector3 this[int column] + { + get + { + switch (column) + { + case 0: + return basis.Column0; + case 1: + return basis.Column1; + case 2: + return basis.Column2; + case 3: + return origin; + default: + throw new IndexOutOfRangeException(); + } + } + set + { + switch (column) + { + case 0: + basis.Column0 = value; + return; + case 1: + basis.Column1 = value; + return; + case 2: + basis.Column2 = value; + return; + case 3: + origin = value; + return; + default: + throw new IndexOutOfRangeException(); + } + } + } + + /// + /// Access matrix elements in column-major order. The fourth column is the origin vector. + /// + /// Which column, the matrix horizontal position. + /// Which row, the matrix vertical position. + public real_t this[int column, int row] + { + get + { + if (column == 3) + { + return origin[row]; + } + return basis[column, row]; + } + set + { + if (column == 3) + { + origin[row] = value; + return; + } + basis[column, row] = value; + } + } + + /// + /// Returns the inverse of the transform, under the assumption that + /// the transformation is composed of rotation, scaling, and translation. + /// + /// The inverse transformation matrix. + public Transform3D AffineInverse() + { + Basis basisInv = basis.Inverse(); + return new Transform3D(basisInv, basisInv.Xform(-origin)); + } + + /// + /// Interpolates this transform to the other `transform` by `weight`. + /// + /// The other transform. + /// A value on the range of 0.0 to 1.0, representing the amount of interpolation. + /// The interpolated transform. + public Transform3D InterpolateWith(Transform3D transform, real_t weight) + { + /* not sure if very "efficient" but good enough? */ + + Vector3 sourceScale = basis.Scale; + Quat sourceRotation = basis.RotationQuat(); + Vector3 sourceLocation = origin; + + Vector3 destinationScale = transform.basis.Scale; + Quat destinationRotation = transform.basis.RotationQuat(); + Vector3 destinationLocation = transform.origin; + + var interpolated = new Transform3D(); + interpolated.basis.SetQuatScale(sourceRotation.Slerp(destinationRotation, weight).Normalized(), sourceScale.Lerp(destinationScale, weight)); + interpolated.origin = sourceLocation.Lerp(destinationLocation, weight); + + return interpolated; + } + + /// + /// Returns the inverse of the transform, under the assumption that + /// the transformation is composed of rotation and translation + /// (no scaling, use for transforms with scaling). + /// + /// The inverse matrix. + public Transform3D Inverse() + { + Basis basisTr = basis.Transposed(); + return new Transform3D(basisTr, basisTr.Xform(-origin)); + } + + /// + /// Returns a copy of the transform rotated such that its + /// -Z axis (forward) points towards the target position. + /// + /// The transform will first be rotated around the given up vector, + /// and then fully aligned to the target by a further rotation around + /// an axis perpendicular to both the target and up vectors. + /// + /// Operations take place in global space. + /// + /// The object to look at. + /// The relative up direction + /// The resulting transform. + public Transform3D LookingAt(Vector3 target, Vector3 up) + { + var t = this; + t.SetLookAt(origin, target, up); + return t; + } + + /// + /// Returns the transform with the basis orthogonal (90 degrees), + /// and normalized axis vectors (scale of 1 or -1). + /// + /// The orthonormalized transform. + public Transform3D Orthonormalized() + { + return new Transform3D(basis.Orthonormalized(), origin); + } + + /// + /// Rotates the transform around the given `axis` by `phi` (in radians), + /// using matrix multiplication. The axis must be a normalized vector. + /// + /// The axis to rotate around. Must be normalized. + /// The angle to rotate, in radians. + /// The rotated transformation matrix. + public Transform3D Rotated(Vector3 axis, real_t phi) + { + return new Transform3D(new Basis(axis, phi), new Vector3()) * this; + } + + /// + /// Scales the transform by the given 3D scaling factor, using matrix multiplication. + /// + /// The scale to introduce. + /// The scaled transformation matrix. + public Transform3D Scaled(Vector3 scale) + { + return new Transform3D(basis.Scaled(scale), origin * scale); + } + + private void SetLookAt(Vector3 eye, Vector3 target, Vector3 up) + { + // Make rotation matrix + // Z vector + Vector3 column2 = eye - target; + + column2.Normalize(); + + Vector3 column1 = up; + + Vector3 column0 = column1.Cross(column2); + + // Recompute Y = Z cross X + column1 = column2.Cross(column0); + + column0.Normalize(); + column1.Normalize(); + + basis = new Basis(column0, column1, column2); + + origin = eye; + } + + /// + /// Translates the transform by the given `offset`, + /// relative to the transform's basis vectors. + /// + /// Unlike and , + /// this does not use matrix multiplication. + /// + /// The offset to translate by. + /// The translated matrix. + public Transform3D Translated(Vector3 offset) + { + return new Transform3D(basis, new Vector3 + ( + origin[0] += basis.Row0.Dot(offset), + origin[1] += basis.Row1.Dot(offset), + origin[2] += basis.Row2.Dot(offset) + )); + } + + /// + /// Returns a vector transformed (multiplied) by this transformation matrix. + /// + /// A vector to transform. + /// The transformed vector. + public Vector3 Xform(Vector3 v) + { + return new Vector3 + ( + basis.Row0.Dot(v) + origin.x, + basis.Row1.Dot(v) + origin.y, + basis.Row2.Dot(v) + origin.z + ); + } + + /// + /// Returns a vector transformed (multiplied) by the transposed transformation matrix. + /// + /// Note: This results in a multiplication by the inverse of the + /// transformation matrix only if it represents a rotation-reflection. + /// + /// A vector to inversely transform. + /// The inversely transformed vector. + public Vector3 XformInv(Vector3 v) + { + Vector3 vInv = v - origin; + + return new Vector3 + ( + basis.Row0[0] * vInv.x + basis.Row1[0] * vInv.y + basis.Row2[0] * vInv.z, + basis.Row0[1] * vInv.x + basis.Row1[1] * vInv.y + basis.Row2[1] * vInv.z, + basis.Row0[2] * vInv.x + basis.Row1[2] * vInv.y + basis.Row2[2] * vInv.z + ); + } + + // Constants + private static readonly Transform3D _identity = new Transform3D(Basis.Identity, Vector3.Zero); + private static readonly Transform3D _flipX = new Transform3D(new Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1), Vector3.Zero); + private static readonly Transform3D _flipY = new Transform3D(new Basis(1, 0, 0, 0, -1, 0, 0, 0, 1), Vector3.Zero); + private static readonly Transform3D _flipZ = new Transform3D(new Basis(1, 0, 0, 0, 1, 0, 0, 0, -1), Vector3.Zero); + + /// + /// The identity transform, with no translation, rotation, or scaling applied. + /// This is used as a replacement for `Transform()` in GDScript. + /// Do not use `new Transform()` with no arguments in C#, because it sets all values to zero. + /// + /// Equivalent to `new Transform(Vector3.Right, Vector3.Up, Vector3.Back, Vector3.Zero)`. + public static Transform3D Identity { get { return _identity; } } + /// + /// The transform that will flip something along the X axis. + /// + /// Equivalent to `new Transform(Vector3.Left, Vector3.Up, Vector3.Back, Vector3.Zero)`. + public static Transform3D FlipX { get { return _flipX; } } + /// + /// The transform that will flip something along the Y axis. + /// + /// Equivalent to `new Transform(Vector3.Right, Vector3.Down, Vector3.Back, Vector3.Zero)`. + public static Transform3D FlipY { get { return _flipY; } } + /// + /// The transform that will flip something along the Z axis. + /// + /// Equivalent to `new Transform(Vector3.Right, Vector3.Up, Vector3.Forward, Vector3.Zero)`. + public static Transform3D FlipZ { get { return _flipZ; } } + + /// + /// Constructs a transformation matrix from 4 vectors (matrix columns). + /// + /// The X vector, or column index 0. + /// The Y vector, or column index 1. + /// The Z vector, or column index 2. + /// The origin vector, or column index 3. + public Transform3D(Vector3 column0, Vector3 column1, Vector3 column2, Vector3 origin) + { + basis = new Basis(column0, column1, column2); + this.origin = origin; + } + + /// + /// Constructs a transformation matrix from the given quaternion and origin vector. + /// + /// The to create the basis from. + /// The origin vector, or column index 3. + public Transform3D(Quat quat, Vector3 origin) + { + basis = new Basis(quat); + this.origin = origin; + } + + /// + /// Constructs a transformation matrix from the given basis and origin vector. + /// + /// The to create the basis from. + /// The origin vector, or column index 3. + public Transform3D(Basis basis, Vector3 origin) + { + this.basis = basis; + this.origin = origin; + } + + public static Transform3D operator *(Transform3D left, Transform3D right) + { + left.origin = left.Xform(right.origin); + left.basis *= right.basis; + return left; + } + + public static bool operator ==(Transform3D left, Transform3D right) + { + return left.Equals(right); + } + + public static bool operator !=(Transform3D left, Transform3D right) + { + return !left.Equals(right); + } + + public override bool Equals(object obj) + { + if (obj is Transform3D) + { + return Equals((Transform3D)obj); + } + + return false; + } + + public bool Equals(Transform3D other) + { + return basis.Equals(other.basis) && origin.Equals(other.origin); + } + + /// + /// Returns true if this transform and `other` are approximately equal, by running + /// on each component. + /// + /// The other transform to compare. + /// Whether or not the matrices are approximately equal. + public bool IsEqualApprox(Transform3D other) + { + return basis.IsEqualApprox(other.basis) && origin.IsEqualApprox(other.origin); + } + + public override int GetHashCode() + { + return basis.GetHashCode() ^ origin.GetHashCode(); + } + + public override string ToString() + { + return String.Format("{0} - {1}", new object[] + { + basis.ToString(), + origin.ToString() + }); + } + + public string ToString(string format) + { + return String.Format("{0} - {1}", new object[] + { + basis.ToString(format), + origin.ToString(format) + }); + } + } +} diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj index 54aaaf1f92..c3dd13d84b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj +++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj @@ -58,8 +58,8 @@ - + diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h index 80f4ac32bd..81dfe675c3 100644 --- a/scene/3d/skeleton_ik_3d.h +++ b/scene/3d/skeleton_ik_3d.h @@ -37,7 +37,7 @@ * @author AndreaCatania */ -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "scene/3d/skeleton_3d.h" class FabrikInverseKinematic { diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp index f1131db15b..ef2635c188 100644 --- a/servers/navigation_server_2d.cpp +++ b/servers/navigation_server_2d.cpp @@ -29,8 +29,8 @@ /*************************************************************************/ #include "servers/navigation_server_2d.h" -#include "core/math/transform.h" #include "core/math/transform_2d.h" +#include "core/math/transform_3d.h" #include "servers/navigation_server_3d.h" /** diff --git a/servers/physics_3d/joints/jacobian_entry_3d_sw.h b/servers/physics_3d/joints/jacobian_entry_3d_sw.h index 2829a5caf7..6afa70c816 100644 --- a/servers/physics_3d/joints/jacobian_entry_3d_sw.h +++ b/servers/physics_3d/joints/jacobian_entry_3d_sw.h @@ -50,7 +50,7 @@ subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ -#include "core/math/transform.h" +#include "core/math/transform_3d.h" class JacobianEntry3DSW { public: diff --git a/tests/test_math.cpp b/tests/test_math.cpp index 88c32713ed..aae8ce08e8 100644 --- a/tests/test_math.cpp +++ b/tests/test_math.cpp @@ -35,7 +35,7 @@ #include "core/math/delaunay_3d.h" #include "core/math/geometry_2d.h" #include "core/math/math_funcs.h" -#include "core/math/transform.h" +#include "core/math/transform_3d.h" #include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" -- cgit v1.2.3 From 39e28c49edb30e0d755afb2b2649c0f36f609a68 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 3 May 2020 05:47:42 -0400 Subject: Rename Transform to Transform3D in GDNative --- modules/gdnative/gdnative/transform.cpp | 51 -------------------- modules/gdnative/gdnative/transform_3d.cpp | 51 ++++++++++++++++++++ modules/gdnative/gdnative/variant.cpp | 6 +-- modules/gdnative/gdnative_api.json | 22 ++++----- modules/gdnative/include/gdnative/gdnative.h | 4 +- modules/gdnative/include/gdnative/transform.h | 58 ----------------------- modules/gdnative/include/gdnative/transform_3d.h | 60 ++++++++++++++++++++++++ modules/gdnative/include/gdnative/variant.h | 6 +-- modules/gdnative/include/xr/godot_xr.h | 6 +-- modules/gdnative/xr/xr_interface_gdnative.cpp | 8 ++-- 10 files changed, 137 insertions(+), 135 deletions(-) delete mode 100644 modules/gdnative/gdnative/transform.cpp create mode 100644 modules/gdnative/gdnative/transform_3d.cpp delete mode 100644 modules/gdnative/include/gdnative/transform.h create mode 100644 modules/gdnative/include/gdnative/transform_3d.h (limited to 'modules') diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp deleted file mode 100644 index de47b2fe0a..0000000000 --- a/modules/gdnative/gdnative/transform.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************/ -/* transform_3d.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "gdnative/transform.h" - -#include "core/math/transform_3d.h" - -static_assert(sizeof(godot_transform) == sizeof(Transform3D), "Transform3D size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_transform_new(godot_transform *p_self) { - memnew_placement(p_self, Transform3D); -} - -void GDAPI godot_transform_new_copy(godot_transform *r_dest, const godot_transform *p_src) { - memnew_placement(r_dest, Transform3D(*(Transform3D *)p_src)); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/transform_3d.cpp b/modules/gdnative/gdnative/transform_3d.cpp new file mode 100644 index 0000000000..8bd2a68d63 --- /dev/null +++ b/modules/gdnative/gdnative/transform_3d.cpp @@ -0,0 +1,51 @@ +/*************************************************************************/ +/* transform_3d.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "gdnative/transform_3d.h" + +#include "core/math/transform_3d.h" + +static_assert(sizeof(godot_transform3d) == sizeof(Transform3D), "Transform3D size mismatch"); + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_transform3d_new(godot_transform3d *p_self) { + memnew_placement(p_self, Transform3D); +} + +void GDAPI godot_transform3d_new_copy(godot_transform3d *r_dest, const godot_transform3d *p_src) { + memnew_placement(r_dest, Transform3D(*(Transform3D *)p_src)); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 1256d05c24..c588704627 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -161,7 +161,7 @@ void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_b memnew_placement_custom(dest, Variant, Variant(*basis)); } -void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans) { +void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans) { Variant *dest = (Variant *)r_dest; const Transform3D *trans = (const Transform3D *)p_trans; memnew_placement_custom(dest, Variant, Variant(*trans)); @@ -402,8 +402,8 @@ godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self) { return raw_dest; } -godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self) { - godot_transform raw_dest; +godot_transform3d GDAPI godot_variant_as_transform3d(const godot_variant *p_self) { + godot_transform3d raw_dest; const Variant *self = (const Variant *)p_self; Transform3D *dest = (Transform3D *)&raw_dest; *dest = *self; diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 489083e795..ec825229ac 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -511,7 +511,7 @@ ] }, { - "name": "godot_variant_new_transform", + "name": "godot_variant_new_transform3d", "return_type": "void", "arguments": [ [ @@ -519,7 +519,7 @@ "r_dest" ], [ - "const godot_transform *", + "const godot_transform3d *", "p_trans" ] ] @@ -923,8 +923,8 @@ ] }, { - "name": "godot_variant_as_transform", - "return_type": "godot_transform", + "name": "godot_variant_as_transform3d", + "return_type": "godot_transform3d", "arguments": [ [ "const godot_variant *", @@ -4344,25 +4344,25 @@ ] }, { - "name": "godot_transform_new", + "name": "godot_transform3d_new", "return_type": "void", "arguments": [ [ - "godot_transform *", + "godot_transform3d *", "r_dest" ] ] }, { - "name": "godot_transform_new_copy", + "name": "godot_transform3d_new_copy", "return_type": "void", "arguments": [ [ - "godot_transform *", + "godot_transform3d *", "r_dest" ], [ - "const godot_transform *", + "const godot_transform3d *", "p_src" ] ] @@ -5073,7 +5073,7 @@ }, { "name": "godot_xr_get_reference_frame", - "return_type": "godot_transform", + "return_type": "godot_transform3d", "arguments": [] }, { @@ -5145,7 +5145,7 @@ "p_controller_id" ], [ - "godot_transform *", + "godot_transform3d *", "p_transform" ], [ diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 9af9226a79..1937748bd4 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -161,9 +161,9 @@ typedef void godot_object; #include -/////// Transform +/////// Transform3D -#include +#include /////// Color diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h deleted file mode 100644 index f9acb52377..0000000000 --- a/modules/gdnative/include/gdnative/transform.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* transform_3d.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef GODOT_TRANSFORM_H -#define GODOT_TRANSFORM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_TRANSFORM_SIZE (sizeof(godot_real_t) * 12) - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_TRANSFORM_SIZE]; -} godot_transform; -#endif - -#include - -void GDAPI godot_transform_new(godot_transform *p_self); -void GDAPI godot_transform_new_copy(godot_transform *r_dest, const godot_transform *p_src); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_TRANSFORM_H diff --git a/modules/gdnative/include/gdnative/transform_3d.h b/modules/gdnative/include/gdnative/transform_3d.h new file mode 100644 index 0000000000..97ad451e9b --- /dev/null +++ b/modules/gdnative/include/gdnative/transform_3d.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* transform_3d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_TRANSFORM3D_H +#define GODOT_TRANSFORM3D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define GODOT_TRANSFORM3D_SIZE (sizeof(godot_real_t) * 12) + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM3D_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_TRANSFORM3D_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_TRANSFORM3D_SIZE]; +} godot_transform3d; +#endif + +#include + +void GDAPI godot_transform3d_new(godot_transform3d *p_self); +void GDAPI godot_transform3d_new_copy(godot_transform3d *r_dest, const godot_transform3d *p_src); +godot_vector3 GDAPI *godot_transform3d_operator_index(godot_transform3d *p_self, godot_int p_index); +const godot_vector3 GDAPI *godot_transform3d_operator_index_const(const godot_transform3d *p_self, godot_int p_index); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_TRANSFORM3D_H diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index 3e06ed9aa4..60392e0cd7 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -183,8 +183,8 @@ typedef void (*godot_ptr_utility_function)(void *r_return, const void **p_argume #include #include #include -#include #include +#include #include #include #include @@ -211,7 +211,7 @@ void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_p void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat); void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb); void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis); -void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans); +void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans); void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color); void GDAPI godot_variant_new_string_name(godot_variant *r_dest, const godot_string_name *p_s); void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np); @@ -246,7 +246,7 @@ godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self); godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self); godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self); godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self); -godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self); +godot_transform3d GDAPI godot_variant_as_transform3d(const godot_variant *p_self); godot_color GDAPI godot_variant_as_color(const godot_variant *p_self); godot_string_name GDAPI godot_variant_as_string_name(const godot_variant *p_self); godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self); diff --git a/modules/gdnative/include/xr/godot_xr.h b/modules/gdnative/include/xr/godot_xr.h index 7eaf1c7ec3..e09244f3f9 100644 --- a/modules/gdnative/include/xr/godot_xr.h +++ b/modules/gdnative/include/xr/godot_xr.h @@ -57,7 +57,7 @@ typedef struct { godot_bool (*initialize)(void *); void (*uninitialize)(void *); godot_vector2 (*get_render_targetsize)(const void *); - godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *); + godot_transform3d (*get_transform_for_eye)(void *, godot_int, godot_transform3d *); void (*fill_projection_for_eye)(void *, godot_float *, godot_int, godot_float, godot_float, godot_float); void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *); void (*process)(void *); @@ -70,7 +70,7 @@ void GDAPI godot_xr_register_interface(const godot_xr_interface_gdnative *p_inte // helper functions to access XRServer data godot_float GDAPI godot_xr_get_worldscale(); -godot_transform GDAPI godot_xr_get_reference_frame(); +godot_transform3d GDAPI godot_xr_get_reference_frame(); // helper functions for rendering void GDAPI godot_xr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect); @@ -79,7 +79,7 @@ godot_int GDAPI godot_xr_get_texid(godot_rid *p_render_target); // helper functions for updating XR controllers godot_int GDAPI godot_xr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position); void GDAPI godot_xr_remove_controller(godot_int p_controller_id); -void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position); +void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform3d *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position); void GDAPI godot_xr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed); void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_float p_value, godot_bool p_can_be_negative); godot_float GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id); diff --git a/modules/gdnative/xr/xr_interface_gdnative.cpp b/modules/gdnative/xr/xr_interface_gdnative.cpp index 21bd3093a4..258fb75000 100644 --- a/modules/gdnative/xr/xr_interface_gdnative.cpp +++ b/modules/gdnative/xr/xr_interface_gdnative.cpp @@ -178,7 +178,7 @@ Transform3D XRInterfaceGDNative::get_transform_for_eye(XRInterface::Eyes p_eye, ERR_FAIL_COND_V(interface == nullptr, Transform3D()); - godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform); + godot_transform3d t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform3d *)&p_cam_transform); ret = (Transform3D *)&t; @@ -241,8 +241,8 @@ godot_float GDAPI godot_xr_get_worldscale() { return xr_server->get_world_scale(); } -godot_transform GDAPI godot_xr_get_reference_frame() { - godot_transform reference_frame; +godot_transform3d GDAPI godot_xr_get_reference_frame() { + godot_transform3d reference_frame; Transform3D *reference_frame_ptr = (Transform3D *)&reference_frame; XRServer *xr_server = XRServer::get_singleton(); @@ -356,7 +356,7 @@ void GDAPI godot_xr_remove_controller(godot_int p_controller_id) { } } -void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { +void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform3d *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { XRServer *xr_server = XRServer::get_singleton(); ERR_FAIL_NULL(xr_server); -- cgit v1.2.3 From 0ac4051c00898b316ae11e7075d3f3a9e3c46be3 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 3 May 2020 04:27:36 -0400 Subject: Update documentation for Transform3D --- doc/classes/@GlobalScope.xml | 4 +- doc/classes/AABB.xml | 2 +- doc/classes/AnimationTree.xml | 4 +- doc/classes/ArrayMesh.xml | 2 +- doc/classes/Basis.xml | 2 +- doc/classes/Camera3D.xml | 2 +- doc/classes/CollisionObject3D.xml | 8 +- doc/classes/GIProbeData.xml | 4 +- doc/classes/GPUParticles3D.xml | 2 +- doc/classes/KinematicBody3D.xml | 4 +- doc/classes/Listener3D.xml | 4 +- doc/classes/MeshLibrary.xml | 8 +- doc/classes/MultiMesh.xml | 8 +- doc/classes/NavigationServer3D.xml | 2 +- doc/classes/Node3D.xml | 14 +- doc/classes/PackedVector3Array.xml | 2 +- doc/classes/PhysicalBone3D.xml | 4 +- doc/classes/PhysicsDirectBodyState3D.xml | 2 +- doc/classes/PhysicsServer3D.xml | 32 +-- doc/classes/PhysicsShapeQueryParameters3D.xml | 2 +- doc/classes/RemoteTransform3D.xml | 4 +- doc/classes/RenderingServer.xml | 28 +-- doc/classes/Skeleton3D.xml | 26 +-- doc/classes/SkeletonIK3D.xml | 2 +- doc/classes/Skin.xml | 6 +- doc/classes/SurfaceTool.xml | 4 +- doc/classes/Transform.xml | 216 --------------------- doc/classes/Transform2D.xml | 2 +- doc/classes/Transform3D.xml | 216 +++++++++++++++++++++ doc/classes/Vector3.xml | 2 +- doc/classes/VisualInstance3D.xml | 2 +- doc/classes/VisualShaderNodeDeterminant.xml | 2 +- doc/classes/VisualShaderNodeTransformCompose.xml | 2 +- doc/classes/VisualShaderNodeTransformConstant.xml | 8 +- doc/classes/VisualShaderNodeTransformDecompose.xml | 2 +- doc/classes/VisualShaderNodeTransformFunc.xml | 8 +- doc/classes/VisualShaderNodeTransformMult.xml | 2 +- doc/classes/VisualShaderNodeTransformUniform.xml | 4 +- doc/classes/VisualShaderNodeTransformVecMult.xml | 2 +- doc/classes/XRPositionalTracker.xml | 2 +- doc/classes/XRServer.xml | 4 +- modules/csg/doc_classes/CSGShape3D.xml | 2 +- modules/gltf/doc_classes/GLTFNode.xml | 2 +- modules/gridmap/doc_classes/GridMap.xml | 4 +- 44 files changed, 332 insertions(+), 332 deletions(-) delete mode 100644 doc/classes/Transform.xml create mode 100644 doc/classes/Transform3D.xml (limited to 'modules') diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index e210fa8808..00bfb3dbb9 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2605,8 +2605,8 @@ Variable is of type [Basis]. - - Variable is of type [Transform]. + + Variable is of type [Transform3D]. Variable is of type [Color]. diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index a28bde9946..af34a948f5 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -242,7 +242,7 @@ - + diff --git a/doc/classes/AnimationTree.xml b/doc/classes/AnimationTree.xml index 2517941133..07ce30db5d 100644 --- a/doc/classes/AnimationTree.xml +++ b/doc/classes/AnimationTree.xml @@ -21,10 +21,10 @@ - + - Retrieve the motion of the [member root_motion_track] as a [Transform] that can be used elsewhere. If [member root_motion_track] is not a path to a track of type [constant Animation.TYPE_TRANSFORM], returns an identity transformation. + Retrieve the motion of the [member root_motion_track] as a [Transform3D] that can be used elsewhere. If [member root_motion_track] is not a path to a track of type [constant Animation.TYPE_TRANSFORM], returns an identity transformation. diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 7c1c4656f8..7826932179 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -113,7 +113,7 @@ - + diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index 55ae58ee3a..f01a11e399 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -4,7 +4,7 @@ 3×3 matrix datatype. - 3×3 matrix used for 3D rotation and scale. Almost always used as an orthogonal basis for a Transform. + 3×3 matrix used for 3D rotation and scale. Almost always used as an orthogonal basis for a [Transform3D]. Contains 3 vector fields X, Y and Z as its columns, which are typically interpreted as the local basis vectors of a transformation. For such use, it is composed of a scaling and a rotation matrix, in that order (M = R.S). Can also be accessed as array of 3D vectors. These vectors are normally orthogonal to each other, but are not necessarily normalized (due to scaling). For more information, read the "Matrices and transforms" documentation article. diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml index 9f1d6d8e31..30f6c2b951 100644 --- a/doc/classes/Camera3D.xml +++ b/doc/classes/Camera3D.xml @@ -27,7 +27,7 @@ - + Gets the camera transform. Subclassed cameras such as [ClippedCamera3D] may provide different transforms than the [Node] transform. diff --git a/doc/classes/CollisionObject3D.xml b/doc/classes/CollisionObject3D.xml index 522eec5cbe..eb71407cf2 100644 --- a/doc/classes/CollisionObject3D.xml +++ b/doc/classes/CollisionObject3D.xml @@ -179,12 +179,12 @@ - + - Returns the shape owner's [Transform]. + Returns the shape owner's [Transform3D]. @@ -214,10 +214,10 @@ - + - Sets the [Transform] of the given shape owner. + Sets the [Transform3D] of the given shape owner. diff --git a/doc/classes/GIProbeData.xml b/doc/classes/GIProbeData.xml index 693df8f819..8549011b19 100644 --- a/doc/classes/GIProbeData.xml +++ b/doc/classes/GIProbeData.xml @@ -11,7 +11,7 @@ - + @@ -59,7 +59,7 @@ - + diff --git a/doc/classes/GPUParticles3D.xml b/doc/classes/GPUParticles3D.xml index 76f0fdb406..47bdd9d745 100644 --- a/doc/classes/GPUParticles3D.xml +++ b/doc/classes/GPUParticles3D.xml @@ -22,7 +22,7 @@ - + diff --git a/doc/classes/KinematicBody3D.xml b/doc/classes/KinematicBody3D.xml index efd3f58f88..1a197be0fb 100644 --- a/doc/classes/KinematicBody3D.xml +++ b/doc/classes/KinematicBody3D.xml @@ -155,14 +155,14 @@ - + - Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur. + Checks for collisions without moving the body. Virtually sets the node's position, scale and rotation to that of the given [Transform3D], then tries to move the body along the vector [code]rel_vec[/code]. Returns [code]true[/code] if a collision would occur. diff --git a/doc/classes/Listener3D.xml b/doc/classes/Listener3D.xml index 998ea757ff..b2fcbe534d 100644 --- a/doc/classes/Listener3D.xml +++ b/doc/classes/Listener3D.xml @@ -18,10 +18,10 @@ - + - Returns the listener's global orthonormalized [Transform]. + Returns the listener's global orthonormalized [Transform3D]. diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml index ad8bd6991d..b33bcc89e3 100644 --- a/doc/classes/MeshLibrary.xml +++ b/doc/classes/MeshLibrary.xml @@ -72,7 +72,7 @@ - + @@ -96,7 +96,7 @@ Returns an item's collision shapes. - The array consists of each [Shape3D] followed by its [Transform]. + The array consists of each [Shape3D] followed by its [Transform3D]. @@ -154,7 +154,7 @@ - + Sets the transform to apply to the item's navigation mesh. @@ -180,7 +180,7 @@ Sets an item's collision shapes. - The array should consist of [Shape3D] objects, each followed by a [Transform] that will be applied to it. For shapes that should not have a transform, use [constant Transform.IDENTITY]. + The array should consist of [Shape3D] objects, each followed by a [Transform3D] that will be applied to it. For shapes that should not have a transform, use [constant Transform3D.IDENTITY]. diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml index 2adebdb306..02628f4960 100644 --- a/doc/classes/MultiMesh.xml +++ b/doc/classes/MultiMesh.xml @@ -40,12 +40,12 @@ - + - Returns the [Transform] of a specific instance. + Returns the [Transform3D] of a specific instance. @@ -86,10 +86,10 @@ - + - Sets the [Transform] for a specific instance. + Sets the [Transform3D] for a specific instance. diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index b098a7fc20..ef9efcb99c 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -413,7 +413,7 @@ - + Sets the global transformation for the region. diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml index 5c29c0d48f..6cc5bf61e9 100644 --- a/doc/classes/Node3D.xml +++ b/doc/classes/Node3D.xml @@ -4,7 +4,7 @@ Most basic 3D game object, parent of all 3D-related nodes. - Most basic 3D game object, with a 3D [Transform] and visibility settings. All other 3D game objects inherit from Node3D. Use [Node3D] as a parent node to move, scale, rotate and show/hide children in a 3D project. + Most basic 3D game object, with a 3D [Transform3D] and visibility settings. All other 3D game objects inherit from Node3D. Use [Node3D] as a parent node to move, scale, rotate and show/hide children in a 3D project. Affine operations (rotate, scale, translate) happen in parent's local coordinate system, unless the [Node3D] object is set as top-level. Affine operations in this coordinate system correspond to direct affine operations on the [Node3D]'s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the [Node3D] object itself is referred to as object-local coordinate system. [b]Note:[/b] Unless otherwise specified, all methods that have angle parameters must have angles specified as [i]radians[/i]. To convert degrees to radians, use [method @GlobalScope.deg2rad]. @@ -128,7 +128,7 @@ - Resets this node's transformations (like scale, skew and taper) preserving its rotation and translation by performing Gram-Schmidt orthonormalization on this node's [Transform]. + Resets this node's transformations (like scale, skew and taper) preserving its rotation and translation by performing Gram-Schmidt orthonormalization on this node's [Transform3D]. @@ -202,7 +202,7 @@ - Reset all transformations for this node (sets its [Transform] to the identity matrix). + Reset all transformations for this node (sets its [Transform3D] to the identity matrix). @@ -288,8 +288,8 @@ The [Node3DGizmo] for this node. Used for example in [EditorNode3DGizmo] as custom visualization and editing handles in Editor. - - World3D space (global) [Transform] of this node. + + World3D space (global) [Transform3D] of this node. Rotation part of the local transformation in radians, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle). @@ -304,8 +304,8 @@ If [code]true[/code], the node will not inherit its transformations from its parent. Node transformations are only in global space. - - Local space [Transform] of this node, with respect to the parent node. + + Local space [Transform3D] of this node, with respect to the parent node. Local translation of this node. diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index 85d41d7519..00ded39082 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -106,7 +106,7 @@ - + diff --git a/doc/classes/PhysicalBone3D.xml b/doc/classes/PhysicalBone3D.xml index 38d9f722b1..656bcfc15c 100644 --- a/doc/classes/PhysicalBone3D.xml +++ b/doc/classes/PhysicalBone3D.xml @@ -84,7 +84,7 @@ Lock the body's movement in the Z axis. - + Sets the body's transform. @@ -99,7 +99,7 @@ This is multiplied by the global 3D gravity setting found in [b]Project > Project Settings > Physics > 3d[/b] to produce the body's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object. - + Sets the joint's transform. diff --git a/doc/classes/PhysicsDirectBodyState3D.xml b/doc/classes/PhysicsDirectBodyState3D.xml index eea681e696..09cc230253 100644 --- a/doc/classes/PhysicsDirectBodyState3D.xml +++ b/doc/classes/PhysicsDirectBodyState3D.xml @@ -214,7 +214,7 @@ The rate at which the body stops moving, if there are not any other forces moving it. - + The body's transformation matrix. diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml index 46de9e5282..18194d53a0 100644 --- a/doc/classes/PhysicsServer3D.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -16,7 +16,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -258,7 +258,7 @@ - + Sets the transform matrix for an area shape. @@ -291,7 +291,7 @@ - + Sets the transform matrix for an area. @@ -337,7 +337,7 @@ - + @@ -510,7 +510,7 @@ - + @@ -760,7 +760,7 @@ - + Sets the transform matrix for a body shape. @@ -1017,11 +1017,11 @@ - + - + @@ -1033,11 +1033,11 @@ - + - + @@ -1049,11 +1049,11 @@ - + - + @@ -1081,11 +1081,11 @@ - + - + diff --git a/doc/classes/PhysicsShapeQueryParameters3D.xml b/doc/classes/PhysicsShapeQueryParameters3D.xml index 4b43ea66fc..79bc29057f 100644 --- a/doc/classes/PhysicsShapeQueryParameters3D.xml +++ b/doc/classes/PhysicsShapeQueryParameters3D.xml @@ -60,7 +60,7 @@ [/csharp] [/codeblocks] - + The queried shape's transform matrix. diff --git a/doc/classes/RemoteTransform3D.xml b/doc/classes/RemoteTransform3D.xml index bd3da2aea9..453177496f 100644 --- a/doc/classes/RemoteTransform3D.xml +++ b/doc/classes/RemoteTransform3D.xml @@ -1,10 +1,10 @@ - RemoteTransform3D pushes its own [Transform] to another [Node3D] derived Node in the scene. + RemoteTransform3D pushes its own [Transform3D] to another [Node3D] derived Node in the scene. - RemoteTransform3D pushes its own [Transform] to another [Node3D] derived Node (called the remote node) in the scene. + RemoteTransform3D pushes its own [Transform3D] to another [Node3D] derived Node (called the remote node) in the scene. It can be set to update another Node's position, rotation and/or scale. It can use either global or local coordinates. diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 7a345f726d..02130333f9 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -130,10 +130,10 @@ - + - Sets [Transform] of camera. + Sets [Transform3D] of camera. @@ -1335,7 +1335,7 @@ - + Sets the world space transform of the instance. Equivalent to [member Node3D.transform]. @@ -1894,14 +1894,14 @@ - + - Returns the [Transform] of the specified instance. + Returns the [Transform3D] of the specified instance. @@ -1948,10 +1948,10 @@ - + - Sets the [Transform] for this instance. Equivalent to [method MultiMesh.set_instance_transform]. + Sets the [Transform3D] for this instance. Equivalent to [method MultiMesh.set_instance_transform]. @@ -2142,10 +2142,10 @@ - + - Sets the [Transform] that will be used by the particles when they first emit. + Sets the [Transform3D] that will be used by the particles when they first emit. @@ -2590,14 +2590,14 @@ - + - Returns the [Transform] set for a specific bone of this skeleton. + Returns the [Transform3D] set for a specific bone of this skeleton. @@ -2618,10 +2618,10 @@ - + - Sets the [Transform] for a specific bone of this skeleton. + Sets the [Transform3D] for a specific bone of this skeleton. @@ -3267,7 +3267,7 @@ Use [Transform2D] to store MultiMesh transform. - Use [Transform] to store MultiMesh transform. + Use [Transform3D] to store MultiMesh transform. Is a directional (sun) light. diff --git a/doc/classes/Skeleton3D.xml b/doc/classes/Skeleton3D.xml index 44ad460459..d8b35ad272 100644 --- a/doc/classes/Skeleton3D.xml +++ b/doc/classes/Skeleton3D.xml @@ -23,9 +23,9 @@ - + - + Takes the given bone pose/transform and converts it to a world transform, relative to the [Skeleton3D] node. @@ -63,7 +63,7 @@ - + @@ -72,7 +72,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -124,7 +124,7 @@ - + @@ -199,7 +199,7 @@ - + Sets the custom pose transform, [code]custom_pose[/code], for the bone at [code]bone_idx[/code]. This pose is an addition to the bone rest pose. @@ -222,7 +222,7 @@ - + @@ -261,7 +261,7 @@ - + Sets the pose transform for bone [code]bone_idx[/code]. @@ -273,7 +273,7 @@ - + Sets the rest transform for bone [code]bone_idx[/code]. @@ -289,9 +289,9 @@ - + - + Takes the given world transform, relative to the [Skeleton3D], and converts it to a bone pose/transform. diff --git a/doc/classes/SkeletonIK3D.xml b/doc/classes/SkeletonIK3D.xml index 5193109447..5949ad54fd 100644 --- a/doc/classes/SkeletonIK3D.xml +++ b/doc/classes/SkeletonIK3D.xml @@ -48,7 +48,7 @@ - + diff --git a/doc/classes/Skin.xml b/doc/classes/Skin.xml index e22feb42f0..f409b6c80c 100644 --- a/doc/classes/Skin.xml +++ b/doc/classes/Skin.xml @@ -12,7 +12,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -86,7 +86,7 @@ - + diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml index 1195e4aa2b..d434f5c2c9 100644 --- a/doc/classes/SurfaceTool.xml +++ b/doc/classes/SurfaceTool.xml @@ -76,10 +76,10 @@ - + - Append vertices from a given [Mesh] surface onto the current vertex array with specified [Transform]. + Append vertices from a given [Mesh] surface onto the current vertex array with specified [Transform3D]. diff --git a/doc/classes/Transform.xml b/doc/classes/Transform.xml deleted file mode 100644 index 9d8721e2de..0000000000 --- a/doc/classes/Transform.xml +++ /dev/null @@ -1,216 +0,0 @@ - - - - 3D transformation (3×4 matrix). - - - 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a [member basis] (first 3 columns) and a [Vector3] for the [member origin] (last column). - For more information, read the "Matrices and transforms" documentation article. - - - https://docs.godotengine.org/en/latest/tutorials/math/index.html - https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html - https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html - https://godotengine.org/asset-library/asset/584 - https://godotengine.org/asset-library/asset/125 - https://godotengine.org/asset-library/asset/583 - - - - - - - Constructs a default-initialized [Transform] set to [constant IDENTITY]. - - - - - - - - - Constructs a [Transform] as a copy of the given [Transform]. - - - - - - - - - - - Constructs a Transform from a [Basis] and [Vector3]. - - - - - - - - - - - - - - - Constructs a Transform from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled). - - - - - - - Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation. - - - - - - - - - - - Interpolates the transform to other Transform by weight amount (on the range of 0.0 to 1.0). - - - - - - - Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling). - - - - - - - - - Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. - - - - - - - - - - - Returns a copy of the transform rotated such that its -Z axis points towards the [code]target[/code] position. - The transform will first be rotated around the given [code]up[/code] vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the [code]target[/code] and [code]up[/code] vectors. - Operations take place in global space. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors. - - - - - - - - - - - Rotates the transform around the given axis by the given angle (in radians), using matrix multiplication. The axis must be a normalized vector. - - - - - - - - - Scales basis and origin of the transform by the given scale factor, using matrix multiplication. - - - - - - - - - Translates the transform by the given offset, relative to the transform's basis vectors. - Unlike [method rotated] and [method scaled], this does not use matrix multiplication. - - - - - - The basis is a matrix containing 3 [Vector3] as its columns: X axis, Y axis, and Z axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object. - - - The translation offset of the transform (column 3, the fourth column). Equivalent to array index [code]3[/code]. - - - - - [Transform] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation. - - - [Transform] with mirroring applied perpendicular to the YZ plane. - - - [Transform] with mirroring applied perpendicular to the XZ plane. - - - [Transform] with mirroring applied perpendicular to the XY plane. - - - diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index 6ae7fbcf79..e748ceb281 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -18,7 +18,7 @@ - Constructs a default-initialized [Transform] set to [constant IDENTITY]. + Constructs a default-initialized [Transform2D] set to [constant IDENTITY]. diff --git a/doc/classes/Transform3D.xml b/doc/classes/Transform3D.xml new file mode 100644 index 0000000000..0d49255523 --- /dev/null +++ b/doc/classes/Transform3D.xml @@ -0,0 +1,216 @@ + + + + 3D transformation (3×4 matrix). + + + 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a [member basis] (first 3 columns) and a [Vector3] for the [member origin] (last column). + For more information, read the "Matrices and transforms" documentation article. + + + https://docs.godotengine.org/en/latest/tutorials/math/index.html + https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html + https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html + https://godotengine.org/asset-library/asset/584 + https://godotengine.org/asset-library/asset/125 + https://godotengine.org/asset-library/asset/583 + + + + + + + Constructs a default-initialized [Transform3D] set to [constant IDENTITY]. + + + + + + + + + Constructs a [Transform3D] as a copy of the given [Transform3D]. + + + + + + + + + + + Constructs a Transform3D from a [Basis] and [Vector3]. + + + + + + + + + + + + + + + Constructs a Transform3D from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled). + + + + + + + Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation. + + + + + + + + + + + Interpolates the transform to other Transform3D by weight amount (on the range of 0.0 to 1.0). + + + + + + + Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling). + + + + + + + + + Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. + + + + + + + + + + + Returns a copy of the transform rotated such that its -Z axis points towards the [code]target[/code] position. + The transform will first be rotated around the given [code]up[/code] vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the [code]target[/code] and [code]up[/code] vectors. + Operations take place in global space. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors. + + + + + + + + + + + Rotates the transform around the given axis by the given angle (in radians), using matrix multiplication. The axis must be a normalized vector. + + + + + + + + + Scales basis and origin of the transform by the given scale factor, using matrix multiplication. + + + + + + + + + Translates the transform by the given offset, relative to the transform's basis vectors. + Unlike [method rotated] and [method scaled], this does not use matrix multiplication. + + + + + + The basis is a matrix containing 3 [Vector3] as its columns: X axis, Y axis, and Z axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object. + + + The translation offset of the transform (column 3, the fourth column). Equivalent to array index [code]3[/code]. + + + + + [Transform3D] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation. + + + [Transform3D] with mirroring applied perpendicular to the YZ plane. + + + [Transform3D] with mirroring applied perpendicular to the XZ plane. + + + [Transform3D] with mirroring applied perpendicular to the XY plane. + + + diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 0a86369506..db837d3f0c 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -274,7 +274,7 @@ - + diff --git a/doc/classes/VisualInstance3D.xml b/doc/classes/VisualInstance3D.xml index 01d569d9c8..2a12254b71 100644 --- a/doc/classes/VisualInstance3D.xml +++ b/doc/classes/VisualInstance3D.xml @@ -44,7 +44,7 @@ Returns the transformed [AABB] (also known as the bounding box) for this [VisualInstance3D]. - Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Node3D]'s [Transform]. See also [method get_aabb]. + Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Node3D]'s [Transform3D]. See also [method get_aabb]. diff --git a/doc/classes/VisualShaderNodeDeterminant.xml b/doc/classes/VisualShaderNodeDeterminant.xml index 6b042f6172..06b05addfa 100644 --- a/doc/classes/VisualShaderNodeDeterminant.xml +++ b/doc/classes/VisualShaderNodeDeterminant.xml @@ -1,7 +1,7 @@ - Calculates the determinant of a [Transform] within the visual shader graph. + Calculates the determinant of a [Transform3D] within the visual shader graph. Translates to [code]determinant(x)[/code] in the shader language. diff --git a/doc/classes/VisualShaderNodeTransformCompose.xml b/doc/classes/VisualShaderNodeTransformCompose.xml index 41762b0099..b82ce9bdd8 100644 --- a/doc/classes/VisualShaderNodeTransformCompose.xml +++ b/doc/classes/VisualShaderNodeTransformCompose.xml @@ -1,7 +1,7 @@ - Composes a [Transform] from four [Vector3]s within the visual shader graph. + Composes a [Transform3D] from four [Vector3]s within the visual shader graph. Creates a 4x4 transform matrix using four vectors of type [code]vec3[/code]. Each vector is one row in the matrix and the last column is a [code]vec4(0, 0, 0, 1)[/code]. diff --git a/doc/classes/VisualShaderNodeTransformConstant.xml b/doc/classes/VisualShaderNodeTransformConstant.xml index b8f054e914..550ed829c9 100644 --- a/doc/classes/VisualShaderNodeTransformConstant.xml +++ b/doc/classes/VisualShaderNodeTransformConstant.xml @@ -1,18 +1,18 @@ - A [Transform] constant for use within the visual shader graph. + A [Transform3D] constant for use within the visual shader graph. - A constant [Transform], which can be used as an input node. + A constant [Transform3D], which can be used as an input node. - - A [Transform] constant which represents the state of this node. + + A [Transform3D] constant which represents the state of this node. diff --git a/doc/classes/VisualShaderNodeTransformDecompose.xml b/doc/classes/VisualShaderNodeTransformDecompose.xml index c8d893db00..b815efc67a 100644 --- a/doc/classes/VisualShaderNodeTransformDecompose.xml +++ b/doc/classes/VisualShaderNodeTransformDecompose.xml @@ -1,7 +1,7 @@ - Decomposes a [Transform] into four [Vector3]s within the visual shader graph. + Decomposes a [Transform3D] into four [Vector3]s within the visual shader graph. Takes a 4x4 transform matrix and decomposes it into four [code]vec3[/code] values, one from each row of the matrix. diff --git a/doc/classes/VisualShaderNodeTransformFunc.xml b/doc/classes/VisualShaderNodeTransformFunc.xml index d0b5c5129d..41a58e1458 100644 --- a/doc/classes/VisualShaderNodeTransformFunc.xml +++ b/doc/classes/VisualShaderNodeTransformFunc.xml @@ -1,10 +1,10 @@ - Computes a [Transform] function within the visual shader graph. + Computes a [Transform3D] function within the visual shader graph. - Computes an inverse or transpose function on the provided [Transform]. + Computes an inverse or transpose function on the provided [Transform3D]. @@ -17,10 +17,10 @@ - Perform the inverse operation on the [Transform] matrix. + Perform the inverse operation on the [Transform3D] matrix. - Perform the transpose operation on the [Transform] matrix. + Perform the transpose operation on the [Transform3D] matrix. diff --git a/doc/classes/VisualShaderNodeTransformMult.xml b/doc/classes/VisualShaderNodeTransformMult.xml index 02b6e0cd1c..f26f60a1f3 100644 --- a/doc/classes/VisualShaderNodeTransformMult.xml +++ b/doc/classes/VisualShaderNodeTransformMult.xml @@ -1,7 +1,7 @@ - Multiplies [Transform] by [Transform] within the visual shader graph. + Multiplies [Transform3D] by [Transform3D] within the visual shader graph. A multiplication operation on two transforms (4x4 matrices), with support for different multiplication operators. diff --git a/doc/classes/VisualShaderNodeTransformUniform.xml b/doc/classes/VisualShaderNodeTransformUniform.xml index ff6246618d..1f1cc4b630 100644 --- a/doc/classes/VisualShaderNodeTransformUniform.xml +++ b/doc/classes/VisualShaderNodeTransformUniform.xml @@ -1,7 +1,7 @@ - A [Transform] uniform for use within the visual shader graph. + A [Transform3D] uniform for use within the visual shader graph. Translated to [code]uniform mat4[/code] in the shader language. @@ -11,7 +11,7 @@ - + A default value to be assigned within the shader. diff --git a/doc/classes/VisualShaderNodeTransformVecMult.xml b/doc/classes/VisualShaderNodeTransformVecMult.xml index 3d5f87f727..2c9c115d9c 100644 --- a/doc/classes/VisualShaderNodeTransformVecMult.xml +++ b/doc/classes/VisualShaderNodeTransformVecMult.xml @@ -1,7 +1,7 @@ - Multiplies a [Transform] and a [Vector3] within the visual shader graph. + Multiplies a [Transform3D] and a [Vector3] within the visual shader graph. A multiplication operation on a transform (4x4 matrix) and a vector, with support for different multiplication operators. diff --git a/doc/classes/XRPositionalTracker.xml b/doc/classes/XRPositionalTracker.xml index 5274d952fd..2cf8e1d6f5 100644 --- a/doc/classes/XRPositionalTracker.xml +++ b/doc/classes/XRPositionalTracker.xml @@ -69,7 +69,7 @@ - + diff --git a/doc/classes/XRServer.xml b/doc/classes/XRServer.xml index d0edf91fed..8284fa4a89 100644 --- a/doc/classes/XRServer.xml +++ b/doc/classes/XRServer.xml @@ -63,7 +63,7 @@ - + Returns the primary interface's transformation. @@ -114,7 +114,7 @@ - + Returns the reference frame transform. Mostly used internally and exposed for GDNative build interfaces. diff --git a/modules/csg/doc_classes/CSGShape3D.xml b/modules/csg/doc_classes/CSGShape3D.xml index dac556c7f1..01ec46e707 100644 --- a/modules/csg/doc_classes/CSGShape3D.xml +++ b/modules/csg/doc_classes/CSGShape3D.xml @@ -31,7 +31,7 @@ - Returns an [Array] with two elements, the first is the [Transform] of this node and the second is the root [Mesh] of this node. Only works when this node is the root shape. + Returns an [Array] with two elements, the first is the [Transform3D] of this node and the second is the root [Mesh] of this node. Only works when this node is the root shape. diff --git a/modules/gltf/doc_classes/GLTFNode.xml b/modules/gltf/doc_classes/GLTFNode.xml index af7be55e4b..33aad0028e 100644 --- a/modules/gltf/doc_classes/GLTFNode.xml +++ b/modules/gltf/doc_classes/GLTFNode.xml @@ -33,7 +33,7 @@ - + diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 9b6fa138e5..fb0a2c9953 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -41,7 +41,7 @@ - Returns an array of [ArrayMesh]es and [Transform] references of all bake meshes that exist within the current GridMap. + Returns an array of [ArrayMesh]es and [Transform3D] references of all bake meshes that exist within the current GridMap. @@ -84,7 +84,7 @@ - Returns an array of [Transform] and [Mesh] references corresponding to the non-empty cells in the grid. The transforms are specified in world space. + Returns an array of [Transform3D] and [Mesh] references corresponding to the non-empty cells in the grid. The transforms are specified in world space. -- cgit v1.2.3