Merge pull request #38430 from aaronfranke/transform3d
This commit is contained in:
commit
5d9cab3aeb
324 changed files with 2018 additions and 2021 deletions
|
@ -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);
|
||||
|
|
|
@ -325,9 +325,9 @@ 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);
|
||||
Transform val;
|
||||
Transform3D val;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
val.basis.elements[i][j] = decode_float(&buf[(i * 3 + j) * 4]);
|
||||
|
@ -1138,9 +1138,9 @@ 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) {
|
||||
Transform val = p_variant;
|
||||
Transform3D val = p_variant;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
memcpy(&buf[(i * 3 + j) * 4], &val.basis.elements[i][j], sizeof(float));
|
||||
|
|
|
@ -230,7 +230,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &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:
|
||||
|
|
|
@ -245,7 +245,7 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
|
|||
|
||||
} break;
|
||||
case VARIANT_TRANSFORM: {
|
||||
Transform v;
|
||||
Transform3D v;
|
||||
v.basis.elements[0].x = f->get_real();
|
||||
v.basis.elements[0].y = f->get_real();
|
||||
v.basis.elements[0].z = f->get_real();
|
||||
|
@ -1416,9 +1416,9 @@ 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);
|
||||
Transform val = p_property;
|
||||
Transform3D val = p_property;
|
||||
f->store_real(val.basis.elements[0].x);
|
||||
f->store_real(val.basis.elements[0].y);
|
||||
f->store_real(val.basis.elements[0].z);
|
||||
|
|
|
@ -315,8 +315,8 @@ Vector2 CameraMatrix::get_far_plane_half_extents() const {
|
|||
return Vector2(res.x, res.y);
|
||||
}
|
||||
|
||||
bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8points) const {
|
||||
Vector<Plane> planes = get_projection_planes(Transform());
|
||||
bool CameraMatrix::get_endpoints(const Transform3D &p_transform, Vector3 *p_8points) const {
|
||||
Vector<Plane> planes = get_projection_planes(Transform3D());
|
||||
const Planes intersections[8][3] = {
|
||||
{ PLANE_FAR, PLANE_LEFT, PLANE_TOP },
|
||||
{ PLANE_FAR, PLANE_LEFT, PLANE_BOTTOM },
|
||||
|
@ -338,7 +338,7 @@ bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8point
|
|||
return true;
|
||||
}
|
||||
|
||||
Vector<Plane> CameraMatrix::get_projection_planes(const Transform &p_transform) const {
|
||||
Vector<Plane> CameraMatrix::get_projection_planes(const Transform3D &p_transform) const {
|
||||
/** Fast Plane Extraction from combined modelview/projection matrices.
|
||||
* References:
|
||||
* https://web.archive.org/web/20011221205252/http://www.markmorley.com/opengl/frustumculling.html
|
||||
|
@ -707,8 +707,8 @@ void CameraMatrix::scale_translate_to_fit(const AABB &p_aabb) {
|
|||
matrix[3][3] = 1;
|
||||
}
|
||||
|
||||
CameraMatrix::operator Transform() const {
|
||||
Transform tr;
|
||||
CameraMatrix::operator Transform3D() const {
|
||||
Transform3D tr;
|
||||
const real_t *m = &matrix[0][0];
|
||||
|
||||
tr.basis.elements[0][0] = m[0];
|
||||
|
@ -730,8 +730,8 @@ CameraMatrix::operator Transform() const {
|
|||
return tr;
|
||||
}
|
||||
|
||||
CameraMatrix::CameraMatrix(const Transform &p_transform) {
|
||||
const Transform &tr = p_transform;
|
||||
CameraMatrix::CameraMatrix(const Transform3D &p_transform) {
|
||||
const Transform3D &tr = p_transform;
|
||||
real_t *m = &matrix[0][0];
|
||||
|
||||
m[0] = tr.basis.elements[0][0];
|
||||
|
|
|
@ -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 {
|
||||
|
@ -71,9 +71,9 @@ struct CameraMatrix {
|
|||
real_t get_fov() const;
|
||||
bool is_orthogonal() const;
|
||||
|
||||
Vector<Plane> get_projection_planes(const Transform &p_transform) const;
|
||||
Vector<Plane> get_projection_planes(const Transform3D &p_transform) const;
|
||||
|
||||
bool get_endpoints(const Transform &p_transform, Vector3 *p_8points) const;
|
||||
bool get_endpoints(const Transform3D &p_transform, Vector3 *p_8points) const;
|
||||
Vector2 get_viewport_half_extents() const;
|
||||
Vector2 get_far_plane_half_extents() const;
|
||||
|
||||
|
@ -90,7 +90,7 @@ struct CameraMatrix {
|
|||
void scale_translate_to_fit(const AABB &p_aabb);
|
||||
void make_scale(const Vector3 &p_scale);
|
||||
int get_pixels_per_meter(int p_for_pixel_width) const;
|
||||
operator Transform() const;
|
||||
operator Transform3D() const;
|
||||
|
||||
void flip_y();
|
||||
|
||||
|
@ -112,7 +112,7 @@ struct CameraMatrix {
|
|||
float get_lod_multiplier() const;
|
||||
|
||||
CameraMatrix();
|
||||
CameraMatrix(const Transform &p_transform);
|
||||
CameraMatrix(const Transform3D &p_transform);
|
||||
~CameraMatrix();
|
||||
};
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ bool Face3::intersects_aabb(const AABB &p_aabb) const {
|
|||
|
||||
real_t minA, maxA, minB, maxB;
|
||||
p_aabb.project_range_in_plane(Plane(axis, 0), minA, maxA);
|
||||
project_range(axis, Transform(), minB, maxB);
|
||||
project_range(axis, Transform3D(), minB, maxB);
|
||||
|
||||
if (maxA < minB || maxB < minA) {
|
||||
return false;
|
||||
|
@ -244,7 +244,7 @@ Face3::operator String() const {
|
|||
return String() + vertex[0] + ", " + vertex[1] + ", " + vertex[2];
|
||||
}
|
||||
|
||||
void Face3::project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const {
|
||||
void Face3::project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Vector3 v = p_transform.xform(vertex[i]);
|
||||
real_t d = p_normal.dot(v);
|
||||
|
@ -259,7 +259,7 @@ void Face3::project_range(const Vector3 &p_normal, const Transform &p_transform,
|
|||
}
|
||||
}
|
||||
|
||||
void Face3::get_support(const Vector3 &p_normal, const Transform &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const {
|
||||
void Face3::get_support(const Vector3 &p_normal, const Transform3D &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const {
|
||||
#define _FACE_IS_VALID_SUPPORT_THRESHOLD 0.98
|
||||
#define _EDGE_IS_VALID_SUPPORT_THRESHOLD 0.05
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
@ -74,8 +74,8 @@ public:
|
|||
|
||||
ClockDirection get_clock_dir() const; ///< todo, test if this is returning the proper clockwisity
|
||||
|
||||
void get_support(const Vector3 &p_normal, const Transform &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const;
|
||||
void project_range(const Vector3 &p_normal, const Transform &p_transform, real_t &r_min, real_t &r_max) const;
|
||||
void get_support(const Vector3 &p_normal, const Transform3D &p_transform, Vector3 *p_vertices, int *p_count, int p_max) const;
|
||||
void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const;
|
||||
|
||||
AABB get_aabb() const {
|
||||
AABB aabb(vertex[0], Vector3());
|
||||
|
|
|
@ -141,8 +141,8 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
|
|||
return target;
|
||||
}
|
||||
|
||||
case Variant::TRANSFORM: {
|
||||
SETUP_TYPE(Transform)
|
||||
case Variant::TRANSFORM3D: {
|
||||
SETUP_TYPE(Transform3D)
|
||||
|
||||
/**/ TRY_TRANSFER_FIELD("xx", basis.elements[0][0])
|
||||
else TRY_TRANSFER_FIELD("xy", basis.elements[0][1])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* transform.cpp */
|
||||
/* transform_3d.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -28,54 +28,54 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "transform.h"
|
||||
#include "transform_3d.h"
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
void Transform::affine_invert() {
|
||||
void Transform3D::affine_invert() {
|
||||
basis.invert();
|
||||
origin = basis.xform(-origin);
|
||||
}
|
||||
|
||||
Transform Transform::affine_inverse() const {
|
||||
Transform ret = *this;
|
||||
Transform3D Transform3D::affine_inverse() const {
|
||||
Transform3D ret = *this;
|
||||
ret.affine_invert();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Transform::invert() {
|
||||
void Transform3D::invert() {
|
||||
basis.transpose();
|
||||
origin = basis.xform(-origin);
|
||||
}
|
||||
|
||||
Transform Transform::inverse() const {
|
||||
Transform3D Transform3D::inverse() const {
|
||||
// FIXME: this function assumes the basis is a rotation matrix, with no scaling.
|
||||
// Transform::affine_inverse can handle matrices with scaling, so GDScript should eventually use that.
|
||||
Transform ret = *this;
|
||||
// Transform3D::affine_inverse can handle matrices with scaling, so GDScript should eventually use that.
|
||||
Transform3D ret = *this;
|
||||
ret.invert();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Transform::rotate(const Vector3 &p_axis, real_t p_phi) {
|
||||
void Transform3D::rotate(const Vector3 &p_axis, real_t p_phi) {
|
||||
*this = rotated(p_axis, p_phi);
|
||||
}
|
||||
|
||||
Transform Transform::rotated(const Vector3 &p_axis, real_t p_phi) const {
|
||||
return Transform(Basis(p_axis, p_phi), Vector3()) * (*this);
|
||||
Transform3D Transform3D::rotated(const Vector3 &p_axis, real_t p_phi) const {
|
||||
return Transform3D(Basis(p_axis, p_phi), Vector3()) * (*this);
|
||||
}
|
||||
|
||||
void Transform::rotate_basis(const Vector3 &p_axis, real_t p_phi) {
|
||||
void Transform3D::rotate_basis(const Vector3 &p_axis, real_t p_phi) {
|
||||
basis.rotate(p_axis, p_phi);
|
||||
}
|
||||
|
||||
Transform Transform::looking_at(const Vector3 &p_target, const Vector3 &p_up) const {
|
||||
Transform t = *this;
|
||||
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 Transform::set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up) {
|
||||
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);
|
||||
|
@ -108,7 +108,7 @@ void Transform::set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const
|
|||
origin = p_eye;
|
||||
}
|
||||
|
||||
Transform Transform::interpolate_with(const Transform &p_transform, real_t p_c) const {
|
||||
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();
|
||||
|
@ -119,94 +119,94 @@ Transform Transform::interpolate_with(const Transform &p_transform, real_t p_c)
|
|||
Quat dst_rot = p_transform.basis.get_rotation_quat();
|
||||
Vector3 dst_loc = p_transform.origin;
|
||||
|
||||
Transform interp;
|
||||
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 Transform::scale(const Vector3 &p_scale) {
|
||||
void Transform3D::scale(const Vector3 &p_scale) {
|
||||
basis.scale(p_scale);
|
||||
origin *= p_scale;
|
||||
}
|
||||
|
||||
Transform Transform::scaled(const Vector3 &p_scale) const {
|
||||
Transform t = *this;
|
||||
Transform3D Transform3D::scaled(const Vector3 &p_scale) const {
|
||||
Transform3D t = *this;
|
||||
t.scale(p_scale);
|
||||
return t;
|
||||
}
|
||||
|
||||
void Transform::scale_basis(const Vector3 &p_scale) {
|
||||
void Transform3D::scale_basis(const Vector3 &p_scale) {
|
||||
basis.scale(p_scale);
|
||||
}
|
||||
|
||||
void Transform::translate(real_t p_tx, real_t p_ty, real_t p_tz) {
|
||||
void Transform3D::translate(real_t p_tx, real_t p_ty, real_t p_tz) {
|
||||
translate(Vector3(p_tx, p_ty, p_tz));
|
||||
}
|
||||
|
||||
void Transform::translate(const Vector3 &p_translation) {
|
||||
void Transform3D::translate(const Vector3 &p_translation) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
origin[i] += basis[i].dot(p_translation);
|
||||
}
|
||||
}
|
||||
|
||||
Transform Transform::translated(const Vector3 &p_translation) const {
|
||||
Transform t = *this;
|
||||
Transform3D Transform3D::translated(const Vector3 &p_translation) const {
|
||||
Transform3D t = *this;
|
||||
t.translate(p_translation);
|
||||
return t;
|
||||
}
|
||||
|
||||
void Transform::orthonormalize() {
|
||||
void Transform3D::orthonormalize() {
|
||||
basis.orthonormalize();
|
||||
}
|
||||
|
||||
Transform Transform::orthonormalized() const {
|
||||
Transform _copy = *this;
|
||||
Transform3D Transform3D::orthonormalized() const {
|
||||
Transform3D _copy = *this;
|
||||
_copy.orthonormalize();
|
||||
return _copy;
|
||||
}
|
||||
|
||||
bool Transform::is_equal_approx(const Transform &p_transform) const {
|
||||
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 Transform::operator==(const Transform &p_transform) const {
|
||||
bool Transform3D::operator==(const Transform3D &p_transform) const {
|
||||
return (basis == p_transform.basis && origin == p_transform.origin);
|
||||
}
|
||||
|
||||
bool Transform::operator!=(const Transform &p_transform) const {
|
||||
bool Transform3D::operator!=(const Transform3D &p_transform) const {
|
||||
return (basis != p_transform.basis || origin != p_transform.origin);
|
||||
}
|
||||
|
||||
void Transform::operator*=(const Transform &p_transform) {
|
||||
void Transform3D::operator*=(const Transform3D &p_transform) {
|
||||
origin = xform(p_transform.origin);
|
||||
basis *= p_transform.basis;
|
||||
}
|
||||
|
||||
Transform Transform::operator*(const Transform &p_transform) const {
|
||||
Transform t = *this;
|
||||
Transform3D Transform3D::operator*(const Transform3D &p_transform) const {
|
||||
Transform3D t = *this;
|
||||
t *= p_transform;
|
||||
return t;
|
||||
}
|
||||
|
||||
Transform::operator String() const {
|
||||
Transform3D::operator String() const {
|
||||
return basis.operator String() + " - " + origin.operator String();
|
||||
}
|
||||
|
||||
Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) :
|
||||
Transform3D::Transform3D(const Basis &p_basis, const Vector3 &p_origin) :
|
||||
basis(p_basis),
|
||||
origin(p_origin) {
|
||||
}
|
||||
|
||||
Transform::Transform(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &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);
|
||||
}
|
||||
|
||||
Transform::Transform(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) {
|
||||
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);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*************************************************************************/
|
||||
/* transform.h */
|
||||
/* transform_3d.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
@ -35,31 +35,31 @@
|
|||
#include "core/math/basis.h"
|
||||
#include "core/math/plane.h"
|
||||
|
||||
class Transform {
|
||||
class Transform3D {
|
||||
public:
|
||||
Basis basis;
|
||||
Vector3 origin;
|
||||
|
||||
void invert();
|
||||
Transform inverse() const;
|
||||
Transform3D inverse() const;
|
||||
|
||||
void affine_invert();
|
||||
Transform affine_inverse() const;
|
||||
Transform3D affine_inverse() const;
|
||||
|
||||
Transform rotated(const Vector3 &p_axis, real_t p_phi) 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));
|
||||
Transform looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0)) const;
|
||||
Transform3D looking_at(const Vector3 &p_target, const Vector3 &p_up = Vector3(0, 1, 0)) const;
|
||||
|
||||
void scale(const Vector3 &p_scale);
|
||||
Transform scaled(const Vector3 &p_scale) const;
|
||||
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);
|
||||
Transform translated(const Vector3 &p_translation) const;
|
||||
Transform3D translated(const Vector3 &p_translation) const;
|
||||
|
||||
const Basis &get_basis() const { return basis; }
|
||||
void set_basis(const Basis &p_basis) { basis = p_basis; }
|
||||
|
@ -68,11 +68,11 @@ public:
|
|||
void set_origin(const Vector3 &p_origin) { origin = p_origin; }
|
||||
|
||||
void orthonormalize();
|
||||
Transform orthonormalized() const;
|
||||
bool is_equal_approx(const Transform &p_transform) const;
|
||||
Transform3D orthonormalized() const;
|
||||
bool is_equal_approx(const Transform3D &p_transform) const;
|
||||
|
||||
bool operator==(const Transform &p_transform) const;
|
||||
bool operator!=(const Transform &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;
|
||||
|
@ -86,14 +86,14 @@ public:
|
|||
_FORCE_INLINE_ Vector<Vector3> xform(const Vector<Vector3> &p_array) const;
|
||||
_FORCE_INLINE_ Vector<Vector3> xform_inv(const Vector<Vector3> &p_array) const;
|
||||
|
||||
void operator*=(const Transform &p_transform);
|
||||
Transform operator*(const Transform &p_transform) const;
|
||||
void operator*=(const Transform3D &p_transform);
|
||||
Transform3D operator*(const Transform3D &p_transform) const;
|
||||
|
||||
Transform interpolate_with(const Transform &p_transform, real_t p_c) const;
|
||||
Transform3D interpolate_with(const Transform3D &p_transform, real_t p_c) const;
|
||||
|
||||
_FORCE_INLINE_ Transform inverse_xform(const Transform &t) const {
|
||||
_FORCE_INLINE_ Transform3D inverse_xform(const Transform3D &t) const {
|
||||
Vector3 v = t.origin - origin;
|
||||
return Transform(basis.transpose_xform(t.basis),
|
||||
return Transform3D(basis.transpose_xform(t.basis),
|
||||
basis.xform(v));
|
||||
}
|
||||
|
||||
|
@ -106,20 +106,20 @@ public:
|
|||
|
||||
operator String() const;
|
||||
|
||||
Transform() {}
|
||||
Transform(const Basis &p_basis, const Vector3 &p_origin = Vector3());
|
||||
Transform(const Vector3 &p_x, const Vector3 &p_y, const Vector3 &p_z, const Vector3 &p_origin);
|
||||
Transform(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);
|
||||
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 Transform::xform(const Vector3 &p_vector) const {
|
||||
_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 Transform::xform_inv(const Vector3 &p_vector) const {
|
||||
_FORCE_INLINE_ Vector3 Transform3D::xform_inv(const Vector3 &p_vector) const {
|
||||
Vector3 v = p_vector - origin;
|
||||
|
||||
return Vector3(
|
||||
|
@ -128,7 +128,7 @@ _FORCE_INLINE_ Vector3 Transform::xform_inv(const Vector3 &p_vector) const {
|
|||
(basis.elements[0][2] * v.x) + (basis.elements[1][2] * v.y) + (basis.elements[2][2] * v.z));
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Plane Transform::xform(const Plane &p_plane) const {
|
||||
_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);
|
||||
|
@ -141,7 +141,7 @@ _FORCE_INLINE_ Plane Transform::xform(const Plane &p_plane) const {
|
|||
return Plane(normal, d);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const {
|
||||
_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);
|
||||
|
@ -154,7 +154,7 @@ _FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const {
|
|||
return Plane(normal, d);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ AABB Transform::xform(const AABB &p_aabb) const {
|
||||
_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;
|
||||
|
@ -179,7 +179,7 @@ _FORCE_INLINE_ AABB Transform::xform(const AABB &p_aabb) const {
|
|||
return r_aabb;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ AABB Transform::xform_inv(const AABB &p_aabb) const {
|
||||
_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),
|
||||
|
@ -203,7 +203,7 @@ _FORCE_INLINE_ AABB Transform::xform_inv(const AABB &p_aabb) const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
Vector<Vector3> Transform::xform(const Vector<Vector3> &p_array) const {
|
||||
Vector<Vector3> Transform3D::xform(const Vector<Vector3> &p_array) const {
|
||||
Vector<Vector3> array;
|
||||
array.resize(p_array.size());
|
||||
|
||||
|
@ -216,7 +216,7 @@ Vector<Vector3> Transform::xform(const Vector<Vector3> &p_array) const {
|
|||
return array;
|
||||
}
|
||||
|
||||
Vector<Vector3> Transform::xform_inv(const Vector<Vector3> &p_array) const {
|
||||
Vector<Vector3> Transform3D::xform_inv(const Vector<Vector3> &p_array) const {
|
||||
Vector<Vector3> array;
|
||||
array.resize(p_array.size());
|
||||
|
|
@ -600,7 +600,7 @@ bool TriangleMesh::inside_convex_shape(const Plane *p_planes, int p_plane_count,
|
|||
const Vector3 *vertexptr = vertices.ptr();
|
||||
const BVH *bvhptr = bvh.ptr();
|
||||
|
||||
Transform scale(Basis().scaled(p_scale));
|
||||
Transform3D scale(Basis().scaled(p_scale));
|
||||
|
||||
int pos = bvh.size() - 1;
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ MAKE_PTRARG_BY_REFERENCE(Plane);
|
|||
MAKE_PTRARG(Quat);
|
||||
MAKE_PTRARG_BY_REFERENCE(AABB);
|
||||
MAKE_PTRARG_BY_REFERENCE(Basis);
|
||||
MAKE_PTRARG_BY_REFERENCE(Transform);
|
||||
MAKE_PTRARG_BY_REFERENCE(Transform3D);
|
||||
MAKE_PTRARG_BY_REFERENCE(Color);
|
||||
MAKE_PTRARG(StringName);
|
||||
MAKE_PTRARG(NodePath);
|
||||
|
|
|
@ -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(Transform, 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)
|
||||
|
|
|
@ -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(Transform, 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(Transform, 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)
|
||||
|
|
|
@ -99,8 +99,8 @@ String Variant::get_type_name(Variant::Type p_type) {
|
|||
return "Basis";
|
||||
|
||||
} break;
|
||||
case TRANSFORM: {
|
||||
return "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 == Transform();
|
||||
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(Transform(*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,8 +1682,8 @@ String Variant::stringify(List<const void *> &stack) const {
|
|||
|
||||
return mtx + ")";
|
||||
} break;
|
||||
case TRANSFORM:
|
||||
return operator Transform();
|
||||
case TRANSFORM3D:
|
||||
return operator Transform3D();
|
||||
case STRING_NAME:
|
||||
return operator StringName();
|
||||
case NODE_PATH:
|
||||
|
@ -1960,8 +1960,8 @@ Variant::operator Basis() const {
|
|||
return *reinterpret_cast<const Quat *>(_data._mem);
|
||||
} else if (type == VECTOR3) {
|
||||
return Basis(*reinterpret_cast<const Vector3 *>(_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,23 +1972,23 @@ Variant::operator Quat() const {
|
|||
return *reinterpret_cast<const Quat *>(_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 Transform() const {
|
||||
if (type == TRANSFORM) {
|
||||
return *_data._transform;
|
||||
Variant::operator Transform3D() const {
|
||||
if (type == TRANSFORM3D) {
|
||||
return *_data._transform3d;
|
||||
} else if (type == BASIS) {
|
||||
return Transform(*_data._basis, Vector3());
|
||||
return Transform3D(*_data._basis, Vector3());
|
||||
} else if (type == QUAT) {
|
||||
return Transform(Basis(*reinterpret_cast<const Quat *>(_data._mem)), Vector3());
|
||||
return Transform3D(Basis(*reinterpret_cast<const Quat *>(_data._mem)), Vector3());
|
||||
} else if (type == TRANSFORM2D) {
|
||||
const Transform2D &t = *_data._transform2d;
|
||||
Transform m;
|
||||
Transform3D m;
|
||||
m.basis.elements[0][0] = t.elements[0][0];
|
||||
m.basis.elements[1][0] = t.elements[0][1];
|
||||
m.basis.elements[0][1] = t.elements[1][0];
|
||||
|
@ -1997,15 +1997,15 @@ Variant::operator Transform() const {
|
|||
m.origin[1] = t.elements[2][1];
|
||||
return m;
|
||||
} else {
|
||||
return Transform();
|
||||
return Transform3D();
|
||||
}
|
||||
}
|
||||
|
||||
Variant::operator Transform2D() const {
|
||||
if (type == TRANSFORM2D) {
|
||||
return *_data._transform2d;
|
||||
} else if (type == TRANSFORM) {
|
||||
const Transform &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];
|
||||
|
@ -2500,9 +2500,9 @@ Variant::Variant(const Quat &p_quat) {
|
|||
memnew_placement(_data._mem, Quat(p_quat));
|
||||
}
|
||||
|
||||
Variant::Variant(const Transform &p_transform) {
|
||||
type = TRANSFORM;
|
||||
_data._transform = memnew(Transform(p_transform));
|
||||
Variant::Variant(const 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 Transform *l = _data._transform;
|
||||
const Transform *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]))) {
|
||||
|
|
|
@ -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"
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
QUAT,
|
||||
AABB,
|
||||
BASIS,
|
||||
TRANSFORM,
|
||||
TRANSFORM3D,
|
||||
|
||||
// misc types
|
||||
COLOR,
|
||||
|
@ -200,7 +200,7 @@ private:
|
|||
Transform2D *_transform2d;
|
||||
::AABB *_aabb;
|
||||
Basis *_basis;
|
||||
Transform *_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 Transform() const;
|
||||
operator Transform2D() const;
|
||||
operator Transform3D() const;
|
||||
|
||||
operator Color() const;
|
||||
operator NodePath() const;
|
||||
|
@ -395,7 +395,7 @@ public:
|
|||
Variant(const Quat &p_quat);
|
||||
Variant(const Basis &p_matrix);
|
||||
Variant(const Transform2D &p_transform);
|
||||
Variant(const Transform &p_transform);
|
||||
Variant(const Transform3D &p_transform);
|
||||
Variant(const Color &p_color);
|
||||
Variant(const NodePath &p_node_path);
|
||||
Variant(const ::RID &p_rid);
|
||||
|
|
|
@ -1696,17 +1696,17 @@ static void _register_variant_builtin_methods() {
|
|||
bind_methodv(AABB, intersects_segment, &AABB::intersects_segment_bind, sarray("from", "to"), varray());
|
||||
bind_methodv(AABB, intersects_ray, &AABB::intersects_ray_bind, sarray("from", "dir"), varray());
|
||||
|
||||
/* Transform */
|
||||
/* Transform3D */
|
||||
|
||||
bind_method(Transform, inverse, sarray(), varray());
|
||||
bind_method(Transform, affine_inverse, sarray(), varray());
|
||||
bind_method(Transform, orthonormalized, sarray(), varray());
|
||||
bind_method(Transform, rotated, sarray("axis", "phi"), varray());
|
||||
bind_method(Transform, scaled, sarray("scale"), varray());
|
||||
bind_method(Transform, translated, sarray("offset"), varray());
|
||||
bind_method(Transform, looking_at, sarray("target", "up"), varray(Vector3(0, 1, 0)));
|
||||
bind_method(Transform, interpolate_with, sarray("xform", "weight"), varray());
|
||||
bind_method(Transform, is_equal_approx, sarray("xform"), varray());
|
||||
bind_method(Transform3D, inverse, sarray(), varray());
|
||||
bind_method(Transform3D, affine_inverse, sarray(), varray());
|
||||
bind_method(Transform3D, orthonormalized, sarray(), varray());
|
||||
bind_method(Transform3D, rotated, sarray("axis", "phi"), varray());
|
||||
bind_method(Transform3D, scaled, sarray("scale"), varray());
|
||||
bind_method(Transform3D, translated, sarray("offset"), varray());
|
||||
bind_method(Transform3D, looking_at, sarray("target", "up"), varray(Vector3(0, 1, 0)));
|
||||
bind_method(Transform3D, interpolate_with, sarray("xform", "weight"), varray());
|
||||
bind_method(Transform3D, is_equal_approx, sarray("xform"), varray());
|
||||
|
||||
/* Dictionary */
|
||||
|
||||
|
@ -2025,14 +2025,14 @@ static void _register_variant_builtin_methods() {
|
|||
_VariantCall::add_variant_constant(Variant::TRANSFORM2D, "FLIP_X", Transform2D(-1, 0, 0, 1, 0, 0));
|
||||
_VariantCall::add_variant_constant(Variant::TRANSFORM2D, "FLIP_Y", Transform2D(1, 0, 0, -1, 0, 0));
|
||||
|
||||
Transform identity_transform = Transform();
|
||||
Transform flip_x_transform = Transform(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
|
||||
Transform flip_y_transform = Transform(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0);
|
||||
Transform flip_z_transform = Transform(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);
|
||||
Transform3D identity_transform = Transform3D();
|
||||
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::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);
|
||||
|
|
|
@ -65,7 +65,7 @@ MAKE_PTRCONSTRUCT(Plane);
|
|||
MAKE_PTRCONSTRUCT(Quat);
|
||||
MAKE_PTRCONSTRUCT(AABB);
|
||||
MAKE_PTRCONSTRUCT(Basis);
|
||||
MAKE_PTRCONSTRUCT(Transform);
|
||||
MAKE_PTRCONSTRUCT(Transform3D);
|
||||
MAKE_PTRCONSTRUCT(Color);
|
||||
MAKE_PTRCONSTRUCT(StringName);
|
||||
MAKE_PTRCONSTRUCT(NodePath);
|
||||
|
@ -678,10 +678,10 @@ void Variant::_register_variant_constructors() {
|
|||
add_constructor<VariantConstructor<Basis, Vector3, double>>(sarray("axis", "phi"));
|
||||
add_constructor<VariantConstructor<Basis, Vector3, Vector3, Vector3>>(sarray("x_axis", "y_axis", "z_axis"));
|
||||
|
||||
add_constructor<VariantConstructNoArgs<Transform>>(sarray());
|
||||
add_constructor<VariantConstructor<Transform, Transform>>(sarray("from"));
|
||||
add_constructor<VariantConstructor<Transform, Basis, Vector3>>(sarray("basis", "origin"));
|
||||
add_constructor<VariantConstructor<Transform, Vector3, Vector3, Vector3, Vector3>>(sarray("x_axis", "y_axis", "z_axis", "origin"));
|
||||
add_constructor<VariantConstructNoArgs<Transform3D>>(sarray());
|
||||
add_constructor<VariantConstructor<Transform3D, Transform3D>>(sarray("from"));
|
||||
add_constructor<VariantConstructor<Transform3D, Basis, Vector3>>(sarray("basis", "origin"));
|
||||
add_constructor<VariantConstructor<Transform3D, Vector3, Vector3, Vector3, Vector3>>(sarray("x_axis", "y_axis", "z_axis", "origin"));
|
||||
|
||||
add_constructor<VariantConstructNoArgs<Color>>(sarray());
|
||||
add_constructor<VariantConstructor<Color, Color>>(sarray("from"));
|
||||
|
|
|
@ -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 Transform *get_transform(Variant *v) { return v->_data._transform; }
|
||||
_FORCE_INLINE_ static const Transform *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<Color *>(v->_data._mem); }
|
||||
|
@ -217,8 +217,8 @@ public:
|
|||
v->type = Variant::BASIS;
|
||||
}
|
||||
_FORCE_INLINE_ static void init_transform(Variant *v) {
|
||||
v->_data._transform = memnew(Transform);
|
||||
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);
|
||||
|
@ -590,9 +590,9 @@ struct VariantGetInternalPtr<Transform2D> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct VariantGetInternalPtr<Transform> {
|
||||
static Transform *get_ptr(Variant *v) { return VariantInternal::get_transform(v); }
|
||||
static const Transform *get_ptr(const Variant *v) { return VariantInternal::get_transform(v); }
|
||||
struct VariantGetInternalPtr<Transform3D> {
|
||||
static Transform3D *get_ptr(Variant *v) { return VariantInternal::get_transform(v); }
|
||||
static const Transform3D *get_ptr(const Variant *v) { return VariantInternal::get_transform(v); }
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -819,9 +819,9 @@ struct VariantInternalAccessor<Transform2D> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct VariantInternalAccessor<Transform> {
|
||||
static _FORCE_INLINE_ const Transform &get(const Variant *v) { return *VariantInternal::get_transform(v); }
|
||||
static _FORCE_INLINE_ void set(Variant *v, const Transform &p_value) { *VariantInternal::get_transform(v) = p_value; }
|
||||
struct VariantInternalAccessor<Transform3D> {
|
||||
static _FORCE_INLINE_ const Transform3D &get(const Variant *v) { return *VariantInternal::get_transform(v); }
|
||||
static _FORCE_INLINE_ void set(Variant *v, const Transform3D &p_value) { *VariantInternal::get_transform(v) = p_value; }
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -1082,7 +1082,7 @@ struct VariantInitializer<Basis> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct VariantInitializer<Transform> {
|
||||
struct VariantInitializer<Transform3D> {
|
||||
static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_transform(v); }
|
||||
};
|
||||
|
||||
|
@ -1256,8 +1256,8 @@ struct VariantZeroAssigner<Basis> {
|
|||
};
|
||||
|
||||
template <>
|
||||
struct VariantZeroAssigner<Transform> {
|
||||
static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_transform(v) = Transform(); }
|
||||
struct VariantZeroAssigner<Transform3D> {
|
||||
static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_transform(v) = Transform3D(); }
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -1465,13 +1465,13 @@ void Variant::_register_variant_operators() {
|
|||
register_op<OperatorEvaluatorXForm<Vector<Vector2>, Transform2D, Vector<Vector2>>>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::PACKED_VECTOR2_ARRAY);
|
||||
register_op<OperatorEvaluatorXFormInv<Vector<Vector2>, Vector<Vector2>, Transform2D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR2_ARRAY, Variant::TRANSFORM2D);
|
||||
|
||||
register_op<OperatorEvaluatorMul<Transform, Transform, Transform>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::TRANSFORM);
|
||||
register_op<OperatorEvaluatorXForm<Vector3, Transform, Vector3>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::VECTOR3);
|
||||
register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Transform>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::TRANSFORM);
|
||||
register_op<OperatorEvaluatorXForm<::AABB, Transform, ::AABB>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::AABB);
|
||||
register_op<OperatorEvaluatorXFormInv<::AABB, ::AABB, Transform>>(Variant::OP_MULTIPLY, Variant::AABB, Variant::TRANSFORM);
|
||||
register_op<OperatorEvaluatorXForm<Vector<Vector3>, Transform, Vector<Vector3>>>(Variant::OP_MULTIPLY, Variant::TRANSFORM, Variant::PACKED_VECTOR3_ARRAY);
|
||||
register_op<OperatorEvaluatorXFormInv<Vector<Vector3>, Vector<Vector3>, Transform>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR3_ARRAY, Variant::TRANSFORM);
|
||||
register_op<OperatorEvaluatorMul<Transform3D, Transform3D, Transform3D>>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::TRANSFORM3D);
|
||||
register_op<OperatorEvaluatorXForm<Vector3, Transform3D, Vector3>>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::VECTOR3);
|
||||
register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Transform3D>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::TRANSFORM3D);
|
||||
register_op<OperatorEvaluatorXForm<::AABB, Transform3D, ::AABB>>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::AABB);
|
||||
register_op<OperatorEvaluatorXFormInv<::AABB, ::AABB, Transform3D>>(Variant::OP_MULTIPLY, Variant::AABB, Variant::TRANSFORM3D);
|
||||
register_op<OperatorEvaluatorXForm<Vector<Vector3>, Transform3D, Vector<Vector3>>>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::PACKED_VECTOR3_ARRAY);
|
||||
register_op<OperatorEvaluatorXFormInv<Vector<Vector3>, Vector<Vector3>, Transform3D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR3_ARRAY, Variant::TRANSFORM3D);
|
||||
|
||||
register_op<OperatorEvaluatorMul<Basis, Basis, Basis>>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::BASIS);
|
||||
register_op<OperatorEvaluatorXForm<Vector3, Basis, Vector3>>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::VECTOR3);
|
||||
|
@ -1547,7 +1547,7 @@ void Variant::_register_variant_operators() {
|
|||
register_op<OperatorEvaluatorStringModT<Quat>>(Variant::OP_MODULE, Variant::STRING, Variant::QUAT);
|
||||
register_op<OperatorEvaluatorStringModT<::AABB>>(Variant::OP_MODULE, Variant::STRING, Variant::AABB);
|
||||
register_op<OperatorEvaluatorStringModT<Basis>>(Variant::OP_MODULE, Variant::STRING, Variant::BASIS);
|
||||
register_op<OperatorEvaluatorStringModT<Transform>>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM);
|
||||
register_op<OperatorEvaluatorStringModT<Transform3D>>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM3D);
|
||||
|
||||
register_op<OperatorEvaluatorStringModT<Color>>(Variant::OP_MODULE, Variant::STRING, Variant::COLOR);
|
||||
register_op<OperatorEvaluatorStringModT<StringName>>(Variant::OP_MODULE, Variant::STRING, Variant::STRING_NAME);
|
||||
|
@ -1615,7 +1615,7 @@ void Variant::_register_variant_operators() {
|
|||
register_op<OperatorEvaluatorEqual<Quat, Quat>>(Variant::OP_EQUAL, Variant::QUAT, Variant::QUAT);
|
||||
register_op<OperatorEvaluatorEqual<::AABB, ::AABB>>(Variant::OP_EQUAL, Variant::AABB, Variant::AABB);
|
||||
register_op<OperatorEvaluatorEqual<Basis, Basis>>(Variant::OP_EQUAL, Variant::BASIS, Variant::BASIS);
|
||||
register_op<OperatorEvaluatorEqual<Transform, Transform>>(Variant::OP_EQUAL, Variant::TRANSFORM, Variant::TRANSFORM);
|
||||
register_op<OperatorEvaluatorEqual<Transform3D, Transform3D>>(Variant::OP_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D);
|
||||
register_op<OperatorEvaluatorEqual<Color, Color>>(Variant::OP_EQUAL, Variant::COLOR, Variant::COLOR);
|
||||
|
||||
register_op<OperatorEvaluatorEqual<StringName, String>>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::STRING);
|
||||
|
@ -1661,7 +1661,7 @@ void Variant::_register_variant_operators() {
|
|||
register_op<OperatorEvaluatorNotEqual<Quat, Quat>>(Variant::OP_NOT_EQUAL, Variant::QUAT, Variant::QUAT);
|
||||
register_op<OperatorEvaluatorNotEqual<::AABB, ::AABB>>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::AABB);
|
||||
register_op<OperatorEvaluatorNotEqual<Basis, Basis>>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::BASIS);
|
||||
register_op<OperatorEvaluatorNotEqual<Transform, Transform>>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM, Variant::TRANSFORM);
|
||||
register_op<OperatorEvaluatorNotEqual<Transform3D, Transform3D>>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D);
|
||||
register_op<OperatorEvaluatorNotEqual<Color, Color>>(Variant::OP_NOT_EQUAL, Variant::COLOR, Variant::COLOR);
|
||||
|
||||
register_op<OperatorEvaluatorNotEqual<StringName, String>>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::STRING);
|
||||
|
@ -1852,7 +1852,7 @@ void Variant::_register_variant_operators() {
|
|||
register_op<OperatorEvaluatorInDictionaryHas<Quat>>(Variant::OP_IN, Variant::QUAT, Variant::DICTIONARY);
|
||||
register_op<OperatorEvaluatorInDictionaryHas<::AABB>>(Variant::OP_IN, Variant::AABB, Variant::DICTIONARY);
|
||||
register_op<OperatorEvaluatorInDictionaryHas<Basis>>(Variant::OP_IN, Variant::BASIS, Variant::DICTIONARY);
|
||||
register_op<OperatorEvaluatorInDictionaryHas<Transform>>(Variant::OP_IN, Variant::TRANSFORM, Variant::DICTIONARY);
|
||||
register_op<OperatorEvaluatorInDictionaryHas<Transform3D>>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::DICTIONARY);
|
||||
|
||||
register_op<OperatorEvaluatorInDictionaryHas<Color>>(Variant::OP_IN, Variant::COLOR, Variant::DICTIONARY);
|
||||
register_op<OperatorEvaluatorInDictionaryHas<StringName>>(Variant::OP_IN, Variant::STRING_NAME, Variant::DICTIONARY);
|
||||
|
@ -1889,7 +1889,7 @@ void Variant::_register_variant_operators() {
|
|||
register_op<OperatorEvaluatorInArrayFind<Quat, Array>>(Variant::OP_IN, Variant::QUAT, Variant::ARRAY);
|
||||
register_op<OperatorEvaluatorInArrayFind<::AABB, Array>>(Variant::OP_IN, Variant::AABB, Variant::ARRAY);
|
||||
register_op<OperatorEvaluatorInArrayFind<Basis, Array>>(Variant::OP_IN, Variant::BASIS, Variant::ARRAY);
|
||||
register_op<OperatorEvaluatorInArrayFind<Transform, Array>>(Variant::OP_IN, Variant::TRANSFORM, Variant::ARRAY);
|
||||
register_op<OperatorEvaluatorInArrayFind<Transform3D, Array>>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::ARRAY);
|
||||
|
||||
register_op<OperatorEvaluatorInArrayFind<Color, Array>>(Variant::OP_IN, Variant::COLOR, Variant::ARRAY);
|
||||
register_op<OperatorEvaluatorInArrayFind<StringName, Array>>(Variant::OP_IN, Variant::STRING_NAME, Variant::ARRAY);
|
||||
|
|
|
@ -653,7 +653,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|||
}
|
||||
|
||||
value = Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
|
||||
} else if (id == "Transform") {
|
||||
} else if (id == "Transform3D") {
|
||||
Vector<real_t> args;
|
||||
Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
|
||||
if (err) {
|
||||
|
@ -665,7 +665,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
|
||||
value = Transform(Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]), Vector3(args[9], args[10], args[11]));
|
||||
value = Transform3D(Basis(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]), Vector3(args[9], args[10], args[11]));
|
||||
} else if (id == "Color") {
|
||||
Vector<float> args;
|
||||
Error err = _parse_construct<float>(p_stream, args, line, r_err_str);
|
||||
|
@ -1489,9 +1489,9 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
|
|||
p_store_string_func(p_store_string_ud, s + " )");
|
||||
|
||||
} break;
|
||||
case Variant::TRANSFORM: {
|
||||
String s = "Transform( ";
|
||||
Transform t = p_variant;
|
||||
case Variant::TRANSFORM3D: {
|
||||
String s = "Transform3D( ";
|
||||
Transform3D t = p_variant;
|
||||
Basis &m3 = t.basis;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
|
|
|
@ -288,8 +288,8 @@ SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, x, set_axis, get_axis, 0)
|
|||
SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, y, set_axis, get_axis, 1)
|
||||
SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, z, set_axis, get_axis, 2)
|
||||
|
||||
SETGET_STRUCT(Transform, Basis, basis)
|
||||
SETGET_STRUCT(Transform, Vector3, origin)
|
||||
SETGET_STRUCT(Transform3D, Basis, basis)
|
||||
SETGET_STRUCT(Transform3D, Vector3, origin)
|
||||
|
||||
SETGET_NUMBER_STRUCT(Color, double, r)
|
||||
SETGET_NUMBER_STRUCT(Color, double, g)
|
||||
|
@ -383,8 +383,8 @@ void register_named_setters_getters() {
|
|||
REGISTER_MEMBER(Basis, y);
|
||||
REGISTER_MEMBER(Basis, z);
|
||||
|
||||
REGISTER_MEMBER(Transform, basis);
|
||||
REGISTER_MEMBER(Transform, origin);
|
||||
REGISTER_MEMBER(Transform3D, basis);
|
||||
REGISTER_MEMBER(Transform3D, origin);
|
||||
|
||||
REGISTER_MEMBER(Color, r);
|
||||
REGISTER_MEMBER(Color, g);
|
||||
|
@ -2304,11 +2304,11 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
|
|||
}
|
||||
return;
|
||||
case BASIS: {
|
||||
r_dst = Transform(*a._data._basis).interpolate_with(Transform(*b._data._basis), c).basis;
|
||||
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: {
|
||||
|
|
|
@ -2605,8 +2605,8 @@
|
|||
<constant name="TYPE_BASIS" value="15" enum="Variant.Type">
|
||||
Variable is of type [Basis].
|
||||
</constant>
|
||||
<constant name="TYPE_TRANSFORM" value="16" enum="Variant.Type">
|
||||
Variable is of type [Transform].
|
||||
<constant name="TYPE_TRANSFORM3D" value="16" enum="Variant.Type">
|
||||
Variable is of type [Transform3D].
|
||||
</constant>
|
||||
<constant name="TYPE_COLOR" value="17" enum="Variant.Type">
|
||||
Variable is of type [Color].
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
<method name="operator *" qualifiers="operator">
|
||||
<return type="AABB">
|
||||
</return>
|
||||
<argument index="0" name="right" type="Transform">
|
||||
<argument index="0" name="right" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_root_motion_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="rename_parameter">
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
<method name="lightmap_unwrap">
|
||||
<return type="int" enum="Error">
|
||||
</return>
|
||||
<argument index="0" name="transform" type="Transform">
|
||||
<argument index="0" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="1" name="texel_size" type="float">
|
||||
</argument>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
3×3 matrix datatype.
|
||||
</brief_description>
|
||||
<description>
|
||||
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.
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_camera_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
Gets the camera transform. Subclassed cameras such as [ClippedCamera3D] may provide different transforms than the [Node] transform.
|
||||
|
|
|
@ -179,12 +179,12 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="shape_owner_get_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="owner_id" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the shape owner's [Transform].
|
||||
Returns the shape owner's [Transform3D].
|
||||
</description>
|
||||
</method>
|
||||
<method name="shape_owner_remove_shape">
|
||||
|
@ -214,10 +214,10 @@
|
|||
</return>
|
||||
<argument index="0" name="owner_id" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="transform" type="Transform">
|
||||
<argument index="1" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the [Transform] of the given shape owner.
|
||||
Sets the [Transform3D] of the given shape owner.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<method name="allocate">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="to_cell_xform" type="Transform">
|
||||
<argument index="0" name="to_cell_xform" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="1" name="aabb" type="AABB">
|
||||
</argument>
|
||||
|
@ -59,7 +59,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_to_cell_xform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<method name="emit_particle">
|
||||
<return type="void">
|
||||
</return>
|
||||
<argument index="0" name="xform" type="Transform">
|
||||
<argument index="0" name="xform" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="1" name="velocity" type="Vector3">
|
||||
</argument>
|
||||
|
|
|
@ -155,14 +155,14 @@
|
|||
<method name="test_move">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="from" type="Transform">
|
||||
<argument index="0" name="from" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="1" name="rel_vec" type="Vector3">
|
||||
</argument>
|
||||
<argument index="2" name="infinite_inertia" type="bool" default="true">
|
||||
</argument>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_listener_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the listener's global orthonormalized [Transform].
|
||||
Returns the listener's global orthonormalized [Transform3D].
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_current" qualifiers="const">
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_item_navmesh_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="id" type="int">
|
||||
</argument>
|
||||
|
@ -96,7 +96,7 @@
|
|||
</argument>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_last_unused_item_id" qualifiers="const">
|
||||
|
@ -154,7 +154,7 @@
|
|||
</return>
|
||||
<argument index="0" name="id" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="navmesh" type="Transform">
|
||||
<argument index="1" name="navmesh" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the transform to apply to the item's navigation mesh.
|
||||
|
@ -180,7 +180,7 @@
|
|||
</argument>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
|
@ -40,12 +40,12 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_instance_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="instance" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the [Transform] of a specific instance.
|
||||
Returns the [Transform3D] of a specific instance.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_instance_transform_2d" qualifiers="const">
|
||||
|
@ -86,10 +86,10 @@
|
|||
</return>
|
||||
<argument index="0" name="instance" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="transform" type="Transform">
|
||||
<argument index="1" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the [Transform] for a specific instance.
|
||||
Sets the [Transform3D] for a specific instance.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_instance_transform_2d">
|
||||
|
|
|
@ -413,7 +413,7 @@
|
|||
</return>
|
||||
<argument index="0" name="region" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="transform" type="Transform">
|
||||
<argument index="1" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the global transformation for the region.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Most basic 3D game object, parent of all 3D-related nodes.
|
||||
</brief_description>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
|
@ -128,7 +128,7 @@
|
|||
<return type="void">
|
||||
</return>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="rotate">
|
||||
|
@ -202,7 +202,7 @@
|
|||
<return type="void">
|
||||
</return>
|
||||
<description>
|
||||
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).
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_ignore_transform_notification">
|
||||
|
@ -288,8 +288,8 @@
|
|||
<member name="gizmo" type="Node3DGizmo" setter="set_gizmo" getter="get_gizmo">
|
||||
The [Node3DGizmo] for this node. Used for example in [EditorNode3DGizmo] as custom visualization and editing handles in Editor.
|
||||
</member>
|
||||
<member name="global_transform" type="Transform" setter="set_global_transform" getter="get_global_transform">
|
||||
World3D space (global) [Transform] of this node.
|
||||
<member name="global_transform" type="Transform3D" setter="set_global_transform" getter="get_global_transform">
|
||||
World3D space (global) [Transform3D] of this node.
|
||||
</member>
|
||||
<member name="rotation" type="Vector3" setter="set_rotation" getter="get_rotation">
|
||||
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 @@
|
|||
<member name="top_level" type="bool" setter="set_as_top_level" getter="is_set_as_top_level" default="false">
|
||||
If [code]true[/code], the node will not inherit its transformations from its parent. Node transformations are only in global space.
|
||||
</member>
|
||||
<member name="transform" type="Transform" setter="set_transform" getter="get_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
Local space [Transform] of this node, with respect to the parent node.
|
||||
<member name="transform" type="Transform3D" setter="set_transform" getter="get_transform" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
Local space [Transform3D] of this node, with respect to the parent node.
|
||||
</member>
|
||||
<member name="translation" type="Vector3" setter="set_translation" getter="get_translation" default="Vector3( 0, 0, 0 )">
|
||||
Local translation of this node.
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
<method name="operator *" qualifiers="operator">
|
||||
<return type="PackedVector3Array">
|
||||
</return>
|
||||
<argument index="0" name="right" type="Transform">
|
||||
<argument index="0" name="right" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<member name="axis_lock_linear_z" type="bool" setter="set_axis_lock" getter="get_axis_lock" default="false">
|
||||
Lock the body's movement in the Z axis.
|
||||
</member>
|
||||
<member name="body_offset" type="Transform" setter="set_body_offset" getter="get_body_offset" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
<member name="body_offset" type="Transform3D" setter="set_body_offset" getter="get_body_offset" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
Sets the body's transform.
|
||||
</member>
|
||||
<member name="bounce" type="float" setter="set_bounce" getter="get_bounce" default="0.0">
|
||||
|
@ -99,7 +99,7 @@
|
|||
<member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale" default="1.0">
|
||||
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.
|
||||
</member>
|
||||
<member name="joint_offset" type="Transform" setter="set_joint_offset" getter="get_joint_offset" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
<member name="joint_offset" type="Transform3D" setter="set_joint_offset" getter="get_joint_offset" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
Sets the joint's transform.
|
||||
</member>
|
||||
<member name="joint_rotation" type="Vector3" setter="set_joint_rotation" getter="get_joint_rotation">
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
<member name="total_linear_damp" type="float" setter="" getter="get_total_linear_damp">
|
||||
The rate at which the body stops moving, if there are not any other forces moving it.
|
||||
</member>
|
||||
<member name="transform" type="Transform" setter="set_transform" getter="get_transform">
|
||||
<member name="transform" type="Transform3D" setter="set_transform" getter="get_transform">
|
||||
The body's transformation matrix.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</argument>
|
||||
<argument index="1" name="shape" type="RID">
|
||||
</argument>
|
||||
<argument index="2" name="transform" type="Transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
<argument index="2" name="transform" type="Transform3D" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
</argument>
|
||||
<argument index="3" name="disabled" type="bool" default="false">
|
||||
</argument>
|
||||
|
@ -92,7 +92,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="area_get_shape_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="area" type="RID">
|
||||
</argument>
|
||||
|
@ -121,7 +121,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="area_get_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="area" type="RID">
|
||||
</argument>
|
||||
|
@ -258,7 +258,7 @@
|
|||
</argument>
|
||||
<argument index="1" name="shape_idx" type="int">
|
||||
</argument>
|
||||
<argument index="2" name="transform" type="Transform">
|
||||
<argument index="2" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the transform matrix for an area shape.
|
||||
|
@ -291,7 +291,7 @@
|
|||
</return>
|
||||
<argument index="0" name="area" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="transform" type="Transform">
|
||||
<argument index="1" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the transform matrix for an area.
|
||||
|
@ -337,7 +337,7 @@
|
|||
</argument>
|
||||
<argument index="1" name="shape" type="RID">
|
||||
</argument>
|
||||
<argument index="2" name="transform" type="Transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
<argument index="2" name="transform" type="Transform3D" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
</argument>
|
||||
<argument index="3" name="disabled" type="bool" default="false">
|
||||
</argument>
|
||||
|
@ -510,7 +510,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="body_get_shape_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="body" type="RID">
|
||||
</argument>
|
||||
|
@ -760,7 +760,7 @@
|
|||
</argument>
|
||||
<argument index="1" name="shape_idx" type="int">
|
||||
</argument>
|
||||
<argument index="2" name="transform" type="Transform">
|
||||
<argument index="2" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the transform matrix for a body shape.
|
||||
|
@ -1017,11 +1017,11 @@
|
|||
</argument>
|
||||
<argument index="1" name="body_A" type="RID">
|
||||
</argument>
|
||||
<argument index="2" name="local_ref_A" type="Transform">
|
||||
<argument index="2" name="local_ref_A" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="3" name="body_B" type="RID">
|
||||
</argument>
|
||||
<argument index="4" name="local_ref_B" type="Transform">
|
||||
<argument index="4" name="local_ref_B" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -1033,11 +1033,11 @@
|
|||
</argument>
|
||||
<argument index="1" name="body_A" type="RID">
|
||||
</argument>
|
||||
<argument index="2" name="local_ref_A" type="Transform">
|
||||
<argument index="2" name="local_ref_A" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="3" name="body_B" type="RID">
|
||||
</argument>
|
||||
<argument index="4" name="local_ref_B" type="Transform">
|
||||
<argument index="4" name="local_ref_B" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -1049,11 +1049,11 @@
|
|||
</argument>
|
||||
<argument index="1" name="body_A" type="RID">
|
||||
</argument>
|
||||
<argument index="2" name="hinge_A" type="Transform">
|
||||
<argument index="2" name="hinge_A" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="3" name="body_B" type="RID">
|
||||
</argument>
|
||||
<argument index="4" name="hinge_B" type="Transform">
|
||||
<argument index="4" name="hinge_B" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -1081,11 +1081,11 @@
|
|||
</argument>
|
||||
<argument index="1" name="body_A" type="RID">
|
||||
</argument>
|
||||
<argument index="2" name="local_ref_A" type="Transform">
|
||||
<argument index="2" name="local_ref_A" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="3" name="body_B" type="RID">
|
||||
</argument>
|
||||
<argument index="4" name="local_ref_B" type="Transform">
|
||||
<argument index="4" name="local_ref_B" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
[/csharp]
|
||||
[/codeblocks]
|
||||
</member>
|
||||
<member name="transform" type="Transform" setter="set_transform" getter="get_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
<member name="transform" type="Transform3D" setter="set_transform" getter="get_transform" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
The queried shape's transform matrix.
|
||||
</member>
|
||||
</members>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="RemoteTransform3D" inherits="Node3D" version="4.0">
|
||||
<brief_description>
|
||||
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.
|
||||
</brief_description>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
<tutorials>
|
||||
|
|
|
@ -130,10 +130,10 @@
|
|||
</return>
|
||||
<argument index="0" name="camera" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="transform" type="Transform">
|
||||
<argument index="1" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets [Transform] of camera.
|
||||
Sets [Transform3D] of camera.
|
||||
</description>
|
||||
</method>
|
||||
<method name="camera_set_use_vertical_aspect">
|
||||
|
@ -1335,7 +1335,7 @@
|
|||
</return>
|
||||
<argument index="0" name="instance" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="transform" type="Transform">
|
||||
<argument index="1" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the world space transform of the instance. Equivalent to [member Node3D.transform].
|
||||
|
@ -1894,14 +1894,14 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="multimesh_instance_get_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="multimesh" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="index" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the [Transform] of the specified instance.
|
||||
Returns the [Transform3D] of the specified instance.
|
||||
</description>
|
||||
</method>
|
||||
<method name="multimesh_instance_get_transform_2d" qualifiers="const">
|
||||
|
@ -1948,10 +1948,10 @@
|
|||
</argument>
|
||||
<argument index="1" name="index" type="int">
|
||||
</argument>
|
||||
<argument index="2" name="transform" type="Transform">
|
||||
<argument index="2" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="multimesh_instance_set_transform_2d">
|
||||
|
@ -2142,10 +2142,10 @@
|
|||
</return>
|
||||
<argument index="0" name="particles" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="transform" type="Transform">
|
||||
<argument index="1" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="particles_set_emitting">
|
||||
|
@ -2590,14 +2590,14 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="skeleton_bone_get_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="skeleton" type="RID">
|
||||
</argument>
|
||||
<argument index="1" name="bone" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Returns the [Transform] set for a specific bone of this skeleton.
|
||||
Returns the [Transform3D] set for a specific bone of this skeleton.
|
||||
</description>
|
||||
</method>
|
||||
<method name="skeleton_bone_get_transform_2d" qualifiers="const">
|
||||
|
@ -2618,10 +2618,10 @@
|
|||
</argument>
|
||||
<argument index="1" name="bone" type="int">
|
||||
</argument>
|
||||
<argument index="2" name="transform" type="Transform">
|
||||
<argument index="2" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the [Transform] for a specific bone of this skeleton.
|
||||
Sets the [Transform3D] for a specific bone of this skeleton.
|
||||
</description>
|
||||
</method>
|
||||
<method name="skeleton_bone_set_transform_2d">
|
||||
|
@ -3267,7 +3267,7 @@
|
|||
Use [Transform2D] to store MultiMesh transform.
|
||||
</constant>
|
||||
<constant name="MULTIMESH_TRANSFORM_3D" value="1" enum="MultimeshTransformFormat">
|
||||
Use [Transform] to store MultiMesh transform.
|
||||
Use [Transform3D] to store MultiMesh transform.
|
||||
</constant>
|
||||
<constant name="LIGHT_DIRECTIONAL" value="0" enum="LightType">
|
||||
Is a directional (sun) light.
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="bone_transform_to_world_transform">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="bone_transform" type="Transform">
|
||||
<argument index="0" name="bone_transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Takes the given bone pose/transform and converts it to a world transform, relative to the [Skeleton3D] node.
|
||||
|
@ -63,7 +63,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_bone_custom_pose" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
|
@ -72,7 +72,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_bone_global_pose" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
|
@ -81,7 +81,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_bone_global_pose_no_override" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
|
@ -109,7 +109,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_bone_pose" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
|
@ -124,7 +124,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_bone_rest" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
|
@ -199,7 +199,7 @@
|
|||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="custom_pose" type="Transform">
|
||||
<argument index="1" name="custom_pose" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
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 @@
|
|||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="pose" type="Transform">
|
||||
<argument index="1" name="pose" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="2" name="amount" type="float">
|
||||
</argument>
|
||||
|
@ -261,7 +261,7 @@
|
|||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="pose" type="Transform">
|
||||
<argument index="1" name="pose" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the pose transform for bone [code]bone_idx[/code].
|
||||
|
@ -273,7 +273,7 @@
|
|||
</return>
|
||||
<argument index="0" name="bone_idx" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="rest" type="Transform">
|
||||
<argument index="1" name="rest" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Sets the rest transform for bone [code]bone_idx[/code].
|
||||
|
@ -289,9 +289,9 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="world_transform_to_bone_transform">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="world_transform" type="Transform">
|
||||
<argument index="0" name="world_transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Takes the given world transform, relative to the [Skeleton3D], and converts it to a bone pose/transform.
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</member>
|
||||
<member name="root_bone" type="StringName" setter="set_root_bone" getter="get_root_bone" default="@""">
|
||||
</member>
|
||||
<member name="target" type="Transform" setter="set_target_transform" getter="get_target_transform" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
<member name="target" type="Transform3D" setter="set_target_transform" getter="get_target_transform" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
</member>
|
||||
<member name="target_node" type="NodePath" setter="set_target_node" getter="get_target_node" default="NodePath("")">
|
||||
</member>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</return>
|
||||
<argument index="0" name="bone" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="pose" type="Transform">
|
||||
<argument index="1" name="pose" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -46,7 +46,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_bind_pose" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="bind_index" type="int">
|
||||
</argument>
|
||||
|
@ -86,7 +86,7 @@
|
|||
</return>
|
||||
<argument index="0" name="bind_index" type="int">
|
||||
</argument>
|
||||
<argument index="1" name="pose" type="Transform">
|
||||
<argument index="1" name="pose" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -76,10 +76,10 @@
|
|||
</argument>
|
||||
<argument index="1" name="surface" type="int">
|
||||
</argument>
|
||||
<argument index="2" name="transform" type="Transform">
|
||||
<argument index="2" name="transform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="begin">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<return type="Transform2D">
|
||||
</return>
|
||||
<description>
|
||||
Constructs a default-initialized [Transform] set to [constant IDENTITY].
|
||||
Constructs a default-initialized [Transform2D] set to [constant IDENTITY].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform2D" qualifiers="constructor">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="Transform" version="4.0">
|
||||
<class name="Transform3D" version="4.0">
|
||||
<brief_description>
|
||||
3D transformation (3×4 matrix).
|
||||
</brief_description>
|
||||
|
@ -16,35 +16,35 @@
|
|||
<link title="2.5D Demo">https://godotengine.org/asset-library/asset/583</link>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="Transform" qualifiers="constructor">
|
||||
<return type="Transform">
|
||||
<method name="Transform3D" qualifiers="constructor">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
Constructs a default-initialized [Transform] set to [constant IDENTITY].
|
||||
Constructs a default-initialized [Transform3D] set to [constant IDENTITY].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform" qualifiers="constructor">
|
||||
<return type="Transform">
|
||||
<method name="Transform3D" qualifiers="constructor">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="from" type="Transform">
|
||||
<argument index="0" name="from" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs a [Transform] as a copy of the given [Transform].
|
||||
Constructs a [Transform3D] as a copy of the given [Transform3D].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform" qualifiers="constructor">
|
||||
<return type="Transform">
|
||||
<method name="Transform3D" qualifiers="constructor">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="basis" type="Basis">
|
||||
</argument>
|
||||
<argument index="1" name="origin" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs a Transform from a [Basis] and [Vector3].
|
||||
Constructs a Transform3D from a [Basis] and [Vector3].
|
||||
</description>
|
||||
</method>
|
||||
<method name="Transform" qualifiers="constructor">
|
||||
<return type="Transform">
|
||||
<method name="Transform3D" qualifiers="constructor">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="x_axis" type="Vector3">
|
||||
</argument>
|
||||
|
@ -55,29 +55,29 @@
|
|||
<argument index="3" name="origin" type="Vector3">
|
||||
</argument>
|
||||
<description>
|
||||
Constructs a Transform from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled).
|
||||
Constructs a Transform3D from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled).
|
||||
</description>
|
||||
</method>
|
||||
<method name="affine_inverse" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
|
||||
</description>
|
||||
</method>
|
||||
<method name="interpolate_with" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="xform" type="Transform">
|
||||
<argument index="0" name="xform" type="Transform3D">
|
||||
</argument>
|
||||
<argument index="1" name="weight" type="float">
|
||||
</argument>
|
||||
<description>
|
||||
Interpolates the transform to other Transform by weight amount (on the range of 0.0 to 1.0).
|
||||
Interpolates the transform to other Transform3D by weight amount (on the range of 0.0 to 1.0).
|
||||
</description>
|
||||
</method>
|
||||
<method name="inverse" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
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).
|
||||
|
@ -86,14 +86,14 @@
|
|||
<method name="is_equal_approx" qualifiers="const">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="xform" type="Transform">
|
||||
<argument index="0" name="xform" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
|
||||
</description>
|
||||
</method>
|
||||
<method name="looking_at" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="target" type="Vector3">
|
||||
</argument>
|
||||
|
@ -108,7 +108,7 @@
|
|||
<method name="operator !=" qualifiers="operator">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="right" type="Transform">
|
||||
<argument index="0" name="right" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -122,9 +122,9 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="operator *" qualifiers="operator">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="right" type="Transform">
|
||||
<argument index="0" name="right" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
@ -148,20 +148,20 @@
|
|||
<method name="operator ==" qualifiers="operator">
|
||||
<return type="bool">
|
||||
</return>
|
||||
<argument index="0" name="right" type="Transform">
|
||||
<argument index="0" name="right" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="orthonormalized" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
|
||||
</description>
|
||||
</method>
|
||||
<method name="rotated" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="axis" type="Vector3">
|
||||
</argument>
|
||||
|
@ -172,7 +172,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="scaled" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="scale" type="Vector3">
|
||||
</argument>
|
||||
|
@ -181,7 +181,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="translated" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="offset" type="Vector3">
|
||||
</argument>
|
||||
|
@ -200,17 +200,17 @@
|
|||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="IDENTITY" value="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
[Transform] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
|
||||
<constant name="IDENTITY" value="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
[Transform3D] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
|
||||
</constant>
|
||||
<constant name="FLIP_X" value="Transform( -1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
[Transform] with mirroring applied perpendicular to the YZ plane.
|
||||
<constant name="FLIP_X" value="Transform3D( -1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
[Transform3D] with mirroring applied perpendicular to the YZ plane.
|
||||
</constant>
|
||||
<constant name="FLIP_Y" value="Transform( 1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
[Transform] with mirroring applied perpendicular to the XZ plane.
|
||||
<constant name="FLIP_Y" value="Transform3D( 1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
[Transform3D] with mirroring applied perpendicular to the XZ plane.
|
||||
</constant>
|
||||
<constant name="FLIP_Z" value="Transform( 1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0 )">
|
||||
[Transform] with mirroring applied perpendicular to the XY plane.
|
||||
<constant name="FLIP_Z" value="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0 )">
|
||||
[Transform3D] with mirroring applied perpendicular to the XY plane.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
|
@ -294,7 +294,7 @@
|
|||
<method name="operator *" qualifiers="operator">
|
||||
<return type="Vector3">
|
||||
</return>
|
||||
<argument index="0" name="right" type="Transform">
|
||||
<argument index="0" name="right" type="Transform3D">
|
||||
</argument>
|
||||
<description>
|
||||
</description>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</return>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_base">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeDeterminant" inherits="VisualShaderNode" version="4.0">
|
||||
<brief_description>
|
||||
Calculates the determinant of a [Transform] within the visual shader graph.
|
||||
Calculates the determinant of a [Transform3D] within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
Translates to [code]determinant(x)[/code] in the shader language.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeTransformCompose" inherits="VisualShaderNode" version="4.0">
|
||||
<brief_description>
|
||||
Composes a [Transform] from four [Vector3]s within the visual shader graph.
|
||||
Composes a [Transform3D] from four [Vector3]s within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
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].
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeTransformConstant" inherits="VisualShaderNodeConstant" version="4.0">
|
||||
<brief_description>
|
||||
A [Transform] constant for use within the visual shader graph.
|
||||
A [Transform3D] constant for use within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
A constant [Transform], which can be used as an input node.
|
||||
A constant [Transform3D], which can be used as an input node.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="constant" type="Transform" setter="set_constant" getter="get_constant" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
A [Transform] constant which represents the state of this node.
|
||||
<member name="constant" type="Transform3D" setter="set_constant" getter="get_constant" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
A [Transform3D] constant which represents the state of this node.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeTransformDecompose" inherits="VisualShaderNode" version="4.0">
|
||||
<brief_description>
|
||||
Decomposes a [Transform] into four [Vector3]s within the visual shader graph.
|
||||
Decomposes a [Transform3D] into four [Vector3]s within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
Takes a 4x4 transform matrix and decomposes it into four [code]vec3[/code] values, one from each row of the matrix.
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeTransformFunc" inherits="VisualShaderNode" version="4.0">
|
||||
<brief_description>
|
||||
Computes a [Transform] function within the visual shader graph.
|
||||
Computes a [Transform3D] function within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
Computes an inverse or transpose function on the provided [Transform].
|
||||
Computes an inverse or transpose function on the provided [Transform3D].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -17,10 +17,10 @@
|
|||
</members>
|
||||
<constants>
|
||||
<constant name="FUNC_INVERSE" value="0" enum="Function">
|
||||
Perform the inverse operation on the [Transform] matrix.
|
||||
Perform the inverse operation on the [Transform3D] matrix.
|
||||
</constant>
|
||||
<constant name="FUNC_TRANSPOSE" value="1" enum="Function">
|
||||
Perform the transpose operation on the [Transform] matrix.
|
||||
Perform the transpose operation on the [Transform3D] matrix.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeTransformMult" inherits="VisualShaderNode" version="4.0">
|
||||
<brief_description>
|
||||
Multiplies [Transform] by [Transform] within the visual shader graph.
|
||||
Multiplies [Transform3D] by [Transform3D] within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
A multiplication operation on two transforms (4x4 matrices), with support for different multiplication operators.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeTransformUniform" inherits="VisualShaderNodeUniform" version="4.0">
|
||||
<brief_description>
|
||||
A [Transform] uniform for use within the visual shader graph.
|
||||
A [Transform3D] uniform for use within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
Translated to [code]uniform mat4[/code] in the shader language.
|
||||
|
@ -11,7 +11,7 @@
|
|||
<methods>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="default_value" type="Transform" setter="set_default_value" getter="get_default_value" default="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
<member name="default_value" type="Transform3D" setter="set_default_value" getter="get_default_value" default="Transform3D( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
|
||||
A default value to be assigned within the shader.
|
||||
</member>
|
||||
<member name="default_value_enabled" type="bool" setter="set_default_value_enabled" getter="is_default_value_enabled" default="false">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="VisualShaderNodeTransformVecMult" inherits="VisualShaderNode" version="4.0">
|
||||
<brief_description>
|
||||
Multiplies a [Transform] and a [Vector3] within the visual shader graph.
|
||||
Multiplies a [Transform3D] and a [Vector3] within the visual shader graph.
|
||||
</brief_description>
|
||||
<description>
|
||||
A multiplication operation on a transform (4x4 matrix) and a vector, with support for different multiplication operators.
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_transform" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<argument index="0" name="adjust_by_reference_frame" type="bool">
|
||||
</argument>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_hmd_transform">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the primary interface's transformation.
|
||||
|
@ -114,7 +114,7 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_reference_frame" qualifiers="const">
|
||||
<return type="Transform">
|
||||
<return type="Transform3D">
|
||||
</return>
|
||||
<description>
|
||||
Returns the reference frame transform. Mostly used internally and exposed for GDNative build interfaces.
|
||||
|
|
|
@ -3459,7 +3459,7 @@ void AnimationTrackEditor::_insert_delay(bool p_create_reset, bool p_create_bezi
|
|||
insert_queue = false;
|
||||
}
|
||||
|
||||
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Transform &p_xform) {
|
||||
void AnimationTrackEditor::insert_transform_key(Node3D *p_node, const String &p_sub, const Transform3D &p_xform) {
|
||||
if (!keying) {
|
||||
return;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -3946,7 +3946,7 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
|
|||
|
||||
} break;
|
||||
case Animation::TYPE_TRANSFORM: {
|
||||
Transform tr = p_id.value;
|
||||
Transform3D tr = p_id.value;
|
||||
Dictionary d;
|
||||
d["location"] = tr.origin;
|
||||
d["scale"] = tr.basis.get_scale();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -4560,7 +4560,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
|
|||
return;
|
||||
}
|
||||
|
||||
Transform xf = base->get_transform();
|
||||
Transform3D xf = base->get_transform();
|
||||
|
||||
Vector3 loc = xf.get_origin();
|
||||
Vector3 scale = xf.basis.get_scale_local();
|
||||
|
|
|
@ -526,7 +526,7 @@ public:
|
|||
void set_anim_pos(float p_pos);
|
||||
void insert_node_value_key(Node *p_node, const String &p_property, const Variant &p_value, bool p_only_if_exists = false);
|
||||
void insert_value_key(const String &p_property, const Variant &p_value, bool p_advance);
|
||||
void insert_transform_key(Node3D *p_node, const String &p_sub, const Transform &p_xform);
|
||||
void insert_transform_key(Node3D *p_node, const String &p_sub, const Transform3D &p_xform);
|
||||
|
||||
void show_select_node_warning(bool p_show);
|
||||
|
||||
|
|
|
@ -212,8 +212,8 @@ void ConnectDialog::_add_bind() {
|
|||
case Variant::BASIS:
|
||||
value = Basis();
|
||||
break;
|
||||
case Variant::TRANSFORM:
|
||||
value = Transform();
|
||||
case Variant::TRANSFORM3D:
|
||||
value = Transform3D();
|
||||
break;
|
||||
case Variant::COLOR:
|
||||
value = 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);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ Array EditorInterface::_make_mesh_previews(const Array &p_meshes, int p_preview_
|
|||
return ret;
|
||||
}
|
||||
|
||||
Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>> &p_meshes, Vector<Transform> *p_transforms, int p_preview_size) {
|
||||
Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh>> &p_meshes, Vector<Transform3D> *p_transforms, int p_preview_size) {
|
||||
int size = p_preview_size;
|
||||
|
||||
RID scenario = RS::get_singleton()->scenario_create();
|
||||
|
@ -94,7 +94,7 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
|
|||
continue;
|
||||
}
|
||||
|
||||
Transform mesh_xform;
|
||||
Transform3D mesh_xform;
|
||||
if (p_transforms != nullptr) {
|
||||
mesh_xform = (*p_transforms)[i];
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
|
|||
AABB aabb = mesh->get_aabb();
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
aabb.position -= ofs;
|
||||
Transform xform;
|
||||
Transform3D xform;
|
||||
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI / 6);
|
||||
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI / 6) * xform.basis;
|
||||
AABB rot_aabb = xform.xform(aabb);
|
||||
|
@ -119,11 +119,11 @@ Vector<Ref<Texture2D>> EditorInterface::make_mesh_previews(const Vector<Ref<Mesh
|
|||
xform.invert();
|
||||
xform = mesh_xform * xform;
|
||||
|
||||
RS::get_singleton()->camera_set_transform(camera, xform * Transform(Basis(), Vector3(0, 0, 3)));
|
||||
RS::get_singleton()->camera_set_transform(camera, xform * Transform3D(Basis(), Vector3(0, 0, 3)));
|
||||
RS::get_singleton()->camera_set_orthogonal(camera, m * 2, 0.01, 1000.0);
|
||||
|
||||
RS::get_singleton()->instance_set_transform(light_instance, xform * Transform().looking_at(Vector3(-2, -1, -1), Vector3(0, 1, 0)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, xform * Transform().looking_at(Vector3(+1, -1, -2), Vector3(0, 1, 0)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance, xform * Transform3D().looking_at(Vector3(-2, -1, -1), Vector3(0, 1, 0)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, xform * Transform3D().looking_at(Vector3(+1, -1, -2), Vector3(0, 1, 0)));
|
||||
|
||||
ep.step(TTR("Thumbnail..."), i);
|
||||
Main::iteration();
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
Error save_scene();
|
||||
void save_scene_as(const String &p_scene, bool p_with_preview = true);
|
||||
|
||||
Vector<Ref<Texture2D>> make_mesh_previews(const Vector<Ref<Mesh>> &p_meshes, Vector<Transform> *p_transforms, int p_preview_size);
|
||||
Vector<Ref<Texture2D>> make_mesh_previews(const Vector<Ref<Mesh>> &p_meshes, Vector<Transform3D> *p_transforms, int p_preview_size);
|
||||
|
||||
void set_main_screen_editor(const String &p_name);
|
||||
void set_distraction_free_mode(bool p_enter);
|
||||
|
|
|
@ -2083,7 +2083,7 @@ void EditorPropertyTransform::_value_changed(double val, const String &p_name) {
|
|||
return;
|
||||
}
|
||||
|
||||
Transform p;
|
||||
Transform3D p;
|
||||
p.basis[0][0] = spin[0]->get_value();
|
||||
p.basis[1][0] = spin[1]->get_value();
|
||||
p.basis[2][0] = spin[2]->get_value();
|
||||
|
@ -2104,7 +2104,7 @@ void EditorPropertyTransform::update_property() {
|
|||
update_using_transform(get_edited_object()->get(get_edited_property()));
|
||||
}
|
||||
|
||||
void EditorPropertyTransform::update_using_transform(Transform p_transform) {
|
||||
void EditorPropertyTransform::update_using_transform(Transform3D p_transform) {
|
||||
setting = true;
|
||||
spin[0]->set_value(p_transform.basis[0][0]);
|
||||
spin[1]->set_value(p_transform.basis[1][0]);
|
||||
|
@ -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;
|
||||
|
|
|
@ -541,7 +541,7 @@ protected:
|
|||
|
||||
public:
|
||||
virtual void update_property() override;
|
||||
virtual void update_using_transform(Transform p_transform);
|
||||
virtual void update_using_transform(Transform3D p_transform);
|
||||
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
||||
EditorPropertyTransform();
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -50,8 +50,8 @@ String Collada::Effect::get_texture_path(const String &p_source, Collada &state)
|
|||
return state.state.image_map[image].path;
|
||||
}
|
||||
|
||||
Transform Collada::get_root_transform() const {
|
||||
Transform unit_scale_transform;
|
||||
Transform3D Collada::get_root_transform() const {
|
||||
Transform3D unit_scale_transform;
|
||||
#ifndef COLLADA_IMPORT_SCALE_SCENE
|
||||
unit_scale_transform.scale(Vector3(state.unit_scale, state.unit_scale, state.unit_scale));
|
||||
#endif
|
||||
|
@ -74,8 +74,8 @@ static String _uri_to_id(const String &p_uri) {
|
|||
|
||||
/** HELPER FUNCTIONS **/
|
||||
|
||||
Transform Collada::fix_transform(const Transform &p_transform) {
|
||||
Transform tr = p_transform;
|
||||
Transform3D Collada::fix_transform(const Transform3D &p_transform) {
|
||||
Transform3D tr = p_transform;
|
||||
|
||||
#ifndef NO_UP_AXIS_SWAP
|
||||
|
||||
|
@ -102,8 +102,8 @@ Transform Collada::fix_transform(const Transform &p_transform) {
|
|||
//return state.matrix_fix * p_transform;
|
||||
}
|
||||
|
||||
static Transform _read_transform_from_array(const Vector<float> &array, int ofs = 0) {
|
||||
Transform tr;
|
||||
static Transform3D _read_transform_from_array(const Vector<float> &array, int ofs = 0) {
|
||||
Transform3D tr;
|
||||
// i wonder why collada matrices are transposed, given that's opposed to opengl..
|
||||
tr.basis.elements[0][0] = array[0 + ofs];
|
||||
tr.basis.elements[0][1] = array[1 + ofs];
|
||||
|
@ -122,11 +122,11 @@ static Transform _read_transform_from_array(const Vector<float> &array, int ofs
|
|||
|
||||
/* STRUCTURES */
|
||||
|
||||
Transform Collada::Node::compute_transform(Collada &state) const {
|
||||
Transform xform;
|
||||
Transform3D Collada::Node::compute_transform(Collada &state) const {
|
||||
Transform3D xform;
|
||||
|
||||
for (int i = 0; i < xform_list.size(); i++) {
|
||||
Transform xform_step;
|
||||
Transform3D xform_step;
|
||||
const XForm &xf = xform_list[i];
|
||||
switch (xf.op) {
|
||||
case XForm::OP_ROTATE: {
|
||||
|
@ -165,11 +165,11 @@ Transform Collada::Node::compute_transform(Collada &state) const {
|
|||
return xform;
|
||||
}
|
||||
|
||||
Transform Collada::Node::get_transform() const {
|
||||
Transform3D Collada::Node::get_transform() const {
|
||||
return default_transform;
|
||||
}
|
||||
|
||||
Transform Collada::Node::get_global_transform() const {
|
||||
Transform3D Collada::Node::get_global_transform() const {
|
||||
if (parent) {
|
||||
return parent->get_global_transform() * default_transform;
|
||||
} else {
|
||||
|
@ -201,14 +201,14 @@ Vector<float> Collada::AnimationTrack::get_value_at_time(float p_time) const {
|
|||
|
||||
if (keys[i].data.size() == 16) {
|
||||
//interpolate a matrix
|
||||
Transform src = _read_transform_from_array(keys[i - 1].data);
|
||||
Transform dst = _read_transform_from_array(keys[i].data);
|
||||
Transform3D src = _read_transform_from_array(keys[i - 1].data);
|
||||
Transform3D dst = _read_transform_from_array(keys[i].data);
|
||||
|
||||
Transform interp = c < 0.001 ? src : src.interpolate_with(dst, c);
|
||||
Transform3D interp = c < 0.001 ? src : src.interpolate_with(dst, c);
|
||||
|
||||
Vector<float> ret;
|
||||
ret.resize(16);
|
||||
Transform tr;
|
||||
Transform3D tr;
|
||||
// i wonder why collada matrices are transposed, given that's opposed to opengl..
|
||||
ret.write[0] = interp.basis.elements[0][0];
|
||||
ret.write[1] = interp.basis.elements[0][1];
|
||||
|
@ -410,10 +410,9 @@ Vector<String> Collada::_read_string_array(XMLParser &parser) {
|
|||
return array;
|
||||
}
|
||||
|
||||
Transform Collada::_read_transform(XMLParser &parser) {
|
||||
if (parser.is_empty()) {
|
||||
return Transform();
|
||||
}
|
||||
Transform3D Collada::_read_transform(XMLParser &parser) {
|
||||
if (parser.is_empty())
|
||||
return Transform3D();
|
||||
|
||||
Vector<String> array;
|
||||
while (parser.read() == OK) {
|
||||
|
@ -429,7 +428,7 @@ Transform Collada::_read_transform(XMLParser &parser) {
|
|||
}
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(array.size() != 16, Transform());
|
||||
ERR_FAIL_COND_V(array.size() != 16, Transform3D());
|
||||
Vector<float> farr;
|
||||
farr.resize(16);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
|
@ -1197,7 +1196,7 @@ void Collada::_parse_skin_controller(XMLParser &parser, String p_id) {
|
|||
|
||||
/* STORE REST MATRICES */
|
||||
|
||||
Vector<Transform> rests;
|
||||
Vector<Transform3D> rests;
|
||||
ERR_FAIL_COND(!skindata.joints.sources.has("JOINT"));
|
||||
ERR_FAIL_COND(!skindata.joints.sources.has("INV_BIND_MATRIX"));
|
||||
|
||||
|
@ -1214,7 +1213,7 @@ void Collada::_parse_skin_controller(XMLParser &parser, String p_id) {
|
|||
|
||||
for (int i = 0; i < joint_source.sarray.size(); i++) {
|
||||
String name = joint_source.sarray[i];
|
||||
Transform xform = _read_transform_from_array(ibm_source.array, i * 16); //<- this is a mistake, it must be applied to vertices
|
||||
Transform3D xform = _read_transform_from_array(ibm_source.array, i * 16); //<- this is a mistake, it must be applied to vertices
|
||||
xform.affine_invert(); // inverse for rest, because it's an inverse
|
||||
#ifdef COLLADA_IMPORT_SCALE_SCENE
|
||||
xform.origin *= state.unit_scale;
|
||||
|
@ -2096,7 +2095,7 @@ void Collada::_merge_skeletons2(VisualScene *p_vscene) {
|
|||
|
||||
NodeSkeleton *skeleton = nullptr;
|
||||
|
||||
for (Map<String, Transform>::Element *F = cd.bone_rest_map.front(); F; F = F->next()) {
|
||||
for (Map<String, Transform3D>::Element *F = cd.bone_rest_map.front(); F; F = F->next()) {
|
||||
String name;
|
||||
|
||||
if (!state.sid_to_node_map.has(F->key())) {
|
||||
|
@ -2240,11 +2239,11 @@ bool Collada::_move_geometry_to_skeletons(VisualScene *p_vscene, Node *p_node, L
|
|||
//this should be correct
|
||||
ERR_FAIL_COND_V(!state.skin_controller_data_map.has(ng->source), false);
|
||||
SkinControllerData &skin = state.skin_controller_data_map[ng->source];
|
||||
Transform skel_inv = sk->get_global_transform().affine_inverse();
|
||||
Transform3D skel_inv = sk->get_global_transform().affine_inverse();
|
||||
p_node->default_transform = skel_inv * (skin.bind_shape /* p_node->get_global_transform()*/); // i honestly have no idea what to do with a previous model xform.. most exporters ignore it
|
||||
|
||||
//make rests relative to the skeleton (they seem to be always relative to world)
|
||||
for (Map<String, Transform>::Element *E = skin.bone_rest_map.front(); E; E = E->next()) {
|
||||
for (Map<String, Transform3D>::Element *E = skin.bone_rest_map.front(); E; E = E->next()) {
|
||||
E->get() = skel_inv * E->get(); //make the bone rest local to the skeleton
|
||||
state.bone_rest_map[E->key()] = E->get(); // make it remember where the bone is globally, now that it's relative
|
||||
}
|
||||
|
@ -2252,7 +2251,7 @@ bool Collada::_move_geometry_to_skeletons(VisualScene *p_vscene, Node *p_node, L
|
|||
//but most exporters seem to work only if i do this..
|
||||
//p_node->default_transform = p_node->get_global_transform();
|
||||
|
||||
//p_node->default_transform=Transform(); //this seems to be correct, because bind shape makes the object local to the skeleton
|
||||
//p_node->default_transform=Transform3D(); //this seems to be correct, because bind shape makes the object local to the skeleton
|
||||
p_node->ignore_anim = true; // collada may animate this later, if it does, then this is not supported (redo your original asset and don't animate the base mesh)
|
||||
p_node->parent = sk;
|
||||
//sk->children.push_back(0,p_node); //avoid INFINITE loop
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
String base;
|
||||
bool use_idrefs = false;
|
||||
|
||||
Transform bind_shape;
|
||||
Transform3D bind_shape;
|
||||
|
||||
struct Source {
|
||||
Vector<String> sarray; //maybe for names
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
int count = 0;
|
||||
} weights;
|
||||
|
||||
Map<String, Transform> bone_rest_map;
|
||||
Map<String, Transform3D> bone_rest_map;
|
||||
|
||||
SkinControllerData() {}
|
||||
};
|
||||
|
@ -342,15 +342,15 @@ public:
|
|||
String empty_draw_type;
|
||||
bool noname = false;
|
||||
Vector<XForm> xform_list;
|
||||
Transform default_transform;
|
||||
Transform post_transform;
|
||||
Transform3D default_transform;
|
||||
Transform3D post_transform;
|
||||
Vector<Node *> children;
|
||||
|
||||
Node *parent = nullptr;
|
||||
|
||||
Transform compute_transform(Collada &state) const;
|
||||
Transform get_global_transform() const;
|
||||
Transform get_transform() const;
|
||||
Transform3D compute_transform(Collada &state) const;
|
||||
Transform3D get_global_transform() const;
|
||||
Transform3D get_transform() const;
|
||||
|
||||
bool ignore_anim = false;
|
||||
|
||||
|
@ -497,7 +497,7 @@ public:
|
|||
Map<String, String> sid_to_node_map;
|
||||
//Map<String,NodeJoint*> bone_map;
|
||||
|
||||
Map<String, Transform> bone_rest_map;
|
||||
Map<String, Transform3D> bone_rest_map;
|
||||
|
||||
String local_path;
|
||||
String root_visual_scene;
|
||||
|
@ -517,9 +517,9 @@ public:
|
|||
|
||||
Collada();
|
||||
|
||||
Transform fix_transform(const Transform &p_transform);
|
||||
Transform3D fix_transform(const Transform3D &p_transform);
|
||||
|
||||
Transform get_root_transform() const;
|
||||
Transform3D get_root_transform() const;
|
||||
|
||||
int get_uv_channel(String p_name);
|
||||
|
||||
|
@ -557,7 +557,7 @@ private: // private stuff
|
|||
Variant _parse_param(XMLParser &parser);
|
||||
Vector<float> _read_float_array(XMLParser &parser);
|
||||
Vector<String> _read_string_array(XMLParser &parser);
|
||||
Transform _read_transform(XMLParser &parser);
|
||||
Transform3D _read_transform(XMLParser &parser);
|
||||
String _read_empty_draw_type(XMLParser &parser);
|
||||
|
||||
void _joint_set_owner(Collada::Node *p_node, NodeSkeleton *p_owner);
|
||||
|
|
|
@ -87,7 +87,7 @@ struct ColladaImport {
|
|||
Error _create_scene(Collada::Node *p_node, Node3D *p_parent);
|
||||
Error _create_resources(Collada::Node *p_node, bool p_use_compression);
|
||||
Error _create_material(const String &p_target);
|
||||
Error _create_mesh_surfaces(bool p_optimize, Ref<EditorSceneImporterMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<EditorSceneImporterMesh>> p_morph_meshes = Vector<Ref<EditorSceneImporterMesh>>(), bool p_use_compression = false, bool p_use_mesh_material = false);
|
||||
Error _create_mesh_surfaces(bool p_optimize, Ref<EditorSceneImporterMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform3D &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<EditorSceneImporterMesh>> p_morph_meshes = Vector<Ref<EditorSceneImporterMesh>>(), bool p_use_compression = false, bool p_use_mesh_material = false);
|
||||
Error load(const String &p_path, int p_flags, bool p_force_make_tangents = false, bool p_use_compression = false);
|
||||
void _fix_param_animation_tracks();
|
||||
void create_animation(int p_clip, bool p_make_tracks_in_all_bones, bool p_import_value_tracks);
|
||||
|
@ -300,7 +300,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Node3D *p_parent) {
|
|||
nm.node = node;
|
||||
node_map[p_node->id] = nm;
|
||||
node_name_map[node->get_name()] = p_node->id;
|
||||
Transform xf = p_node->default_transform;
|
||||
Transform3D xf = p_node->default_transform;
|
||||
|
||||
xf = collada.fix_transform(xf) * p_node->post_transform;
|
||||
node->set_transform(xf);
|
||||
|
@ -457,7 +457,7 @@ Error ColladaImport::_create_material(const String &p_target) {
|
|||
return OK;
|
||||
}
|
||||
|
||||
Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<EditorSceneImporterMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<EditorSceneImporterMesh>> p_morph_meshes, bool p_use_compression, bool p_use_mesh_material) {
|
||||
Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<EditorSceneImporterMesh> &p_mesh, const Map<String, Collada::NodeGeometry::Material> &p_material_map, const Collada::MeshData &meshdata, const Transform3D &p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_controller, const Collada::MorphControllerData *p_morph_data, Vector<Ref<EditorSceneImporterMesh>> p_morph_meshes, bool p_use_compression, bool p_use_mesh_material) {
|
||||
bool local_xform_mirror = p_local_xform.basis.determinant() < 0;
|
||||
|
||||
if (p_morph_data) {
|
||||
|
@ -811,7 +811,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<EditorSceneImpor
|
|||
|
||||
if (has_weights) {
|
||||
//if skeleton, localize
|
||||
Transform local_xform = p_local_xform;
|
||||
Transform3D local_xform = p_local_xform;
|
||||
for (int i = 0; i < vertex_array.size(); i++) {
|
||||
vertex_array.write[i].vertex = local_xform.xform(vertex_array[i].vertex);
|
||||
vertex_array.write[i].normal = local_xform.basis.xform(vertex_array[i].normal).normalized();
|
||||
|
@ -1037,7 +1037,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
|
|||
Collada::SkinControllerData *skin = nullptr;
|
||||
Collada::MorphControllerData *morph = nullptr;
|
||||
String meshid;
|
||||
Transform apply_xform;
|
||||
Transform3D apply_xform;
|
||||
Vector<int> bone_remap;
|
||||
Vector<Ref<EditorSceneImporterMesh>> morphs;
|
||||
|
||||
|
@ -1073,9 +1073,9 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
|
|||
|
||||
if (apply_mesh_xform_to_vertices) {
|
||||
apply_xform = collada.fix_transform(p_node->default_transform);
|
||||
node->set_transform(Transform());
|
||||
node->set_transform(Transform3D());
|
||||
} else {
|
||||
apply_xform = Transform();
|
||||
apply_xform = Transform3D();
|
||||
}
|
||||
|
||||
ERR_FAIL_COND_V(!skin->weights.sources.has("JOINT"), ERR_INVALID_DATA);
|
||||
|
@ -1530,7 +1530,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
|
|||
}
|
||||
}
|
||||
|
||||
Transform xform = cn->compute_transform(collada);
|
||||
Transform3D xform = cn->compute_transform(collada);
|
||||
xform = collada.fix_transform(xform) * cn->post_transform;
|
||||
|
||||
if (nm.bone >= 0) {
|
||||
|
@ -1589,7 +1589,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
|
|||
animation->track_set_path(track, path);
|
||||
animation->track_set_imported(track, true); //helps merging later
|
||||
|
||||
Transform xform = cn->compute_transform(collada);
|
||||
Transform3D xform = cn->compute_transform(collada);
|
||||
xform = collada.fix_transform(xform) * cn->post_transform;
|
||||
|
||||
xform = sk->get_bone_rest(nm.bone).affine_inverse() * xform;
|
||||
|
|
|
@ -433,7 +433,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
|
|||
p_node->replace_by(rigid_body);
|
||||
rigid_body->set_transform(mi->get_transform());
|
||||
p_node = rigid_body;
|
||||
mi->set_transform(Transform());
|
||||
mi->set_transform(Transform3D());
|
||||
rigid_body->add_child(mi);
|
||||
mi->set_owner(rigid_body->get_owner());
|
||||
|
||||
|
@ -632,7 +632,7 @@ Node *ResourceImporterScene::_post_fix_node(Node *p_node, Node *p_root, Map<Ref<
|
|||
p_node->replace_by(rigid_body);
|
||||
rigid_body->set_transform(mi->get_transform());
|
||||
p_node = rigid_body;
|
||||
mi->set_transform(Transform());
|
||||
mi->set_transform(Transform3D());
|
||||
rigid_body->add_child(mi);
|
||||
mi->set_owner(rigid_body->get_owner());
|
||||
base = rigid_body;
|
||||
|
@ -1209,7 +1209,7 @@ void ResourceImporterScene::_generate_meshes(Node *p_node, const Dictionary &p_m
|
|||
}
|
||||
|
||||
if (bake_lightmaps) {
|
||||
Transform xf;
|
||||
Transform3D xf;
|
||||
Node3D *n = src_mesh_node;
|
||||
while (n) {
|
||||
xf = n->get_transform() * xf;
|
||||
|
|
|
@ -317,7 +317,7 @@ void SceneImportSettings::_fill_scene(Node *p_node, TreeItem *p_parent_item) {
|
|||
if (mesh_node && mesh_node->get_mesh().is_valid()) {
|
||||
_fill_mesh(scene_tree, mesh_node->get_mesh(), item);
|
||||
|
||||
Transform accum_xform;
|
||||
Transform3D accum_xform;
|
||||
Node3D *base = mesh_node;
|
||||
while (base) {
|
||||
accum_xform = base->get_transform() * accum_xform;
|
||||
|
@ -379,7 +379,7 @@ void SceneImportSettings::_update_camera() {
|
|||
|
||||
camera->set_orthogonal(camera_size * zoom, 0.0001, camera_size * 2);
|
||||
|
||||
Transform xf;
|
||||
Transform3D xf;
|
||||
xf.basis = Basis(Vector3(0, 1, 0), rot_y) * Basis(Vector3(1, 0, 0), rot_x);
|
||||
xf.origin = center;
|
||||
xf.translate(0, 0, camera_size);
|
||||
|
@ -493,7 +493,7 @@ void SceneImportSettings::_select(Tree *p_from, String p_type, String p_id) {
|
|||
Ref<Mesh> base_mesh = mi->get_mesh();
|
||||
if (base_mesh.is_valid()) {
|
||||
AABB aabb = base_mesh->get_aabb();
|
||||
Transform aabb_xf;
|
||||
Transform3D aabb_xf;
|
||||
aabb_xf.basis.scale(aabb.size);
|
||||
aabb_xf.origin = aabb.position;
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ SceneImportSettings::SceneImportSettings() {
|
|||
camera->make_current();
|
||||
|
||||
light = memnew(DirectionalLight3D);
|
||||
light->set_transform(Transform().looking_at(Vector3(-1, -2, -0.6), Vector3(0, 1, 0)));
|
||||
light->set_transform(Transform3D().looking_at(Vector3(-1, -2, -0.6), Vector3(0, 1, 0)));
|
||||
base_viewport->add_child(light);
|
||||
light->set_shadow(true);
|
||||
|
||||
|
|
|
@ -612,7 +612,7 @@ struct EditorSceneImporterMeshLightmapSurface {
|
|||
String name;
|
||||
};
|
||||
|
||||
Error EditorSceneImporterMesh::lightmap_unwrap_cached(const Transform &p_base_transform, float p_texel_size, const Vector<uint8_t> &p_src_cache, Vector<uint8_t> &r_dst_cache) {
|
||||
Error EditorSceneImporterMesh::lightmap_unwrap_cached(const Transform3D &p_base_transform, float p_texel_size, const Vector<uint8_t> &p_src_cache, Vector<uint8_t> &r_dst_cache) {
|
||||
ERR_FAIL_COND_V(!array_mesh_lightmap_unwrap_callback, ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V_MSG(blend_shapes.size() != 0, ERR_UNAVAILABLE, "Can't unwrap mesh with blend shapes.");
|
||||
|
||||
|
@ -628,7 +628,7 @@ Error EditorSceneImporterMesh::lightmap_unwrap_cached(const Transform &p_base_tr
|
|||
Basis basis = p_base_transform.get_basis();
|
||||
Vector3 scale = Vector3(basis.get_axis(0).length(), basis.get_axis(1).length(), basis.get_axis(2).length());
|
||||
|
||||
Transform transform;
|
||||
Transform3D transform;
|
||||
transform.scale(scale);
|
||||
|
||||
Basis normal_basis = transform.basis.inverse().transposed();
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
Vector<Ref<Shape3D>> convex_decompose() const;
|
||||
Ref<Shape3D> create_trimesh_shape() const;
|
||||
Ref<NavigationMesh> create_navigation_mesh();
|
||||
Error lightmap_unwrap_cached(const Transform &p_base_transform, float p_texel_size, const Vector<uint8_t> &p_src_cache, Vector<uint8_t> &r_dst_cache);
|
||||
Error lightmap_unwrap_cached(const Transform3D &p_base_transform, float p_texel_size, const Vector<uint8_t> &p_src_cache, Vector<uint8_t> &r_dst_cache);
|
||||
|
||||
void set_lightmap_size_hint(const Size2i &p_size);
|
||||
Size2i get_lightmap_size_hint() const;
|
||||
|
|
|
@ -313,7 +313,7 @@ void InspectorDock::_property_keyed(const String &p_keyed, const Variant &p_valu
|
|||
AnimationPlayerEditor::singleton->get_track_editor()->insert_value_key(p_keyed, p_value, p_advance);
|
||||
}
|
||||
|
||||
void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Transform &p_key) {
|
||||
void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Transform3D &p_key) {
|
||||
Node3D *s = Object::cast_to<Node3D>(sp);
|
||||
if (!s) {
|
||||
return;
|
||||
|
|
|
@ -112,7 +112,7 @@ class InspectorDock : public VBoxContainer {
|
|||
void _prepare_history();
|
||||
|
||||
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
|
||||
void _transform_keyed(Object *sp, const String &p_sub, const Transform &p_key);
|
||||
void _transform_keyed(Object *sp, const String &p_sub, const Transform3D &p_key);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
|
|
@ -455,7 +455,7 @@ bool EditorNode3DGizmo::intersect_frustum(const Camera3D *p_camera, const Vector
|
|||
|
||||
int vc = collision_segments.size();
|
||||
const Vector3 *vptr = collision_segments.ptr();
|
||||
Transform t = spatial_node->get_global_transform();
|
||||
Transform3D t = spatial_node->get_global_transform();
|
||||
|
||||
bool any_out = false;
|
||||
for (int j = 0; j < fc; j++) {
|
||||
|
@ -477,12 +477,12 @@ bool EditorNode3DGizmo::intersect_frustum(const Camera3D *p_camera, const Vector
|
|||
}
|
||||
|
||||
if (collision_mesh.is_valid()) {
|
||||
Transform t = spatial_node->get_global_transform();
|
||||
Transform3D t = spatial_node->get_global_transform();
|
||||
|
||||
Vector3 mesh_scale = t.get_basis().get_scale();
|
||||
t.orthonormalize();
|
||||
|
||||
Transform it = t.affine_inverse();
|
||||
Transform3D it = t.affine_inverse();
|
||||
|
||||
Vector<Plane> transformed_frustum;
|
||||
|
||||
|
@ -508,7 +508,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
|
|||
}
|
||||
|
||||
if (r_gizmo_handle && !hidden) {
|
||||
Transform t = spatial_node->get_global_transform();
|
||||
Transform3D t = spatial_node->get_global_transform();
|
||||
if (billboard_handle) {
|
||||
t.set_look_at(t.origin, t.origin - p_camera->get_transform().basis.get_axis(2), p_camera->get_transform().basis.get_axis(1));
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
|
|||
}
|
||||
|
||||
if (selectable_icon_size > 0.0f) {
|
||||
Transform t = spatial_node->get_global_transform();
|
||||
Transform3D t = spatial_node->get_global_transform();
|
||||
Vector3 camera_position = p_camera->get_camera_transform().origin;
|
||||
if (camera_position.distance_squared_to(t.origin) > 0.01) {
|
||||
t.set_look_at(t.origin, camera_position);
|
||||
|
@ -576,7 +576,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
|
|||
|
||||
Point2 center = p_camera->unproject_position(t.origin);
|
||||
|
||||
Transform orig_camera_transform = p_camera->get_camera_transform();
|
||||
Transform3D orig_camera_transform = p_camera->get_camera_transform();
|
||||
|
||||
if (orig_camera_transform.origin.distance_squared_to(t.origin) > 0.01 &&
|
||||
ABS(orig_camera_transform.basis.get_axis(Vector3::AXIS_Z).dot(Vector3(0, 1, 0))) < 0.99) {
|
||||
|
@ -609,7 +609,7 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
|
|||
|
||||
int vc = collision_segments.size();
|
||||
const Vector3 *vptr = collision_segments.ptr();
|
||||
Transform t = spatial_node->get_global_transform();
|
||||
Transform3D t = spatial_node->get_global_transform();
|
||||
if (billboard_handle) {
|
||||
t.set_look_at(t.origin, t.origin - p_camera->get_transform().basis.get_axis(2), p_camera->get_transform().basis.get_axis(1));
|
||||
}
|
||||
|
@ -657,13 +657,13 @@ bool EditorNode3DGizmo::intersect_ray(Camera3D *p_camera, const Point2 &p_point,
|
|||
}
|
||||
|
||||
if (collision_mesh.is_valid()) {
|
||||
Transform gt = spatial_node->get_global_transform();
|
||||
Transform3D gt = spatial_node->get_global_transform();
|
||||
|
||||
if (billboard_handle) {
|
||||
gt.set_look_at(gt.origin, gt.origin - p_camera->get_transform().basis.get_axis(2), p_camera->get_transform().basis.get_axis(1));
|
||||
}
|
||||
|
||||
Transform ai = gt.affine_inverse();
|
||||
Transform3D ai = gt.affine_inverse();
|
||||
Vector3 ray_from = ai.xform(p_camera->project_ray_origin(p_point));
|
||||
Vector3 ray_dir = ai.basis.xform(p_camera->project_ray_normal(p_point)).normalized();
|
||||
Vector3 rpos, rnorm;
|
||||
|
@ -826,7 +826,7 @@ Variant Light3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_i
|
|||
return Variant();
|
||||
}
|
||||
|
||||
static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vector3 &p_to, float p_arc_radius, const Transform &p_arc_xform) {
|
||||
static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vector3 &p_to, float p_arc_radius, const Transform3D &p_arc_xform) {
|
||||
//bleh, discrete is simpler
|
||||
static const int arc_test_points = 64;
|
||||
float min_d = 1e20;
|
||||
|
@ -855,8 +855,8 @@ static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vec
|
|||
|
||||
void Light3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
Light3D *light = Object::cast_to<Light3D>(p_gizmo->get_spatial_node());
|
||||
Transform gt = light->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = light->get_global_transform();
|
||||
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);
|
||||
|
@ -1084,8 +1084,8 @@ Variant AudioStreamPlayer3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gi
|
|||
void AudioStreamPlayer3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
AudioStreamPlayer3D *player = Object::cast_to<AudioStreamPlayer3D>(p_gizmo->get_spatial_node());
|
||||
|
||||
Transform gt = player->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = player->get_global_transform();
|
||||
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);
|
||||
|
@ -1230,8 +1230,8 @@ Variant Camera3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_
|
|||
void Camera3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
Camera3D *camera = Object::cast_to<Camera3D>(p_gizmo->get_spatial_node());
|
||||
|
||||
Transform gt = camera->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = camera->get_global_transform();
|
||||
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);
|
||||
|
@ -1239,7 +1239,7 @@ void Camera3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Came
|
|||
Vector3 s[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 4096) };
|
||||
|
||||
if (camera->get_projection() == Camera3D::PROJECTION_PERSPECTIVE) {
|
||||
Transform gt2 = camera->get_global_transform();
|
||||
Transform3D gt2 = camera->get_global_transform();
|
||||
float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt2);
|
||||
camera->set("fov", CLAMP(a * 2.0, 1, 179));
|
||||
} else {
|
||||
|
@ -1418,7 +1418,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
lines.push_back(cam_pos);
|
||||
}
|
||||
|
||||
Transform local = camera->get_global_transform().affine_inverse();
|
||||
Transform3D local = camera->get_global_transform().affine_inverse();
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
lines.write[i] = local.xform(lines[i]);
|
||||
}
|
||||
|
@ -1617,7 +1617,7 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
|
||||
surface_tool->begin(Mesh::PRIMITIVE_LINES);
|
||||
surface_tool->set_material(material);
|
||||
Vector<Transform> grests;
|
||||
Vector<Transform3D> grests;
|
||||
grests.resize(skel->get_bone_count());
|
||||
|
||||
Vector<int> bones;
|
||||
|
@ -1749,7 +1749,7 @@ void Skeleton3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
bones.write[0] = i;
|
||||
}
|
||||
/*
|
||||
Transform t = grests[i];
|
||||
Transform3D t = grests[i];
|
||||
t.orthonormalize();
|
||||
|
||||
for (int i=0;i<6;i++) {
|
||||
|
@ -2196,9 +2196,9 @@ Variant VisibilityNotifier3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_g
|
|||
void VisibilityNotifier3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
VisibilityNotifier3D *notifier = Object::cast_to<VisibilityNotifier3D>(p_gizmo->get_spatial_node());
|
||||
|
||||
Transform gt = notifier->get_global_transform();
|
||||
Transform3D gt = notifier->get_global_transform();
|
||||
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
bool move = p_idx >= 3;
|
||||
p_idx = p_idx % 3;
|
||||
|
@ -2388,8 +2388,8 @@ Variant GPUParticles3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo,
|
|||
void GPUParticles3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
GPUParticles3D *particles = Object::cast_to<GPUParticles3D>(p_gizmo->get_spatial_node());
|
||||
|
||||
Transform gt = particles->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = particles->get_global_transform();
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
bool move = p_idx >= 3;
|
||||
p_idx = p_idx % 3;
|
||||
|
@ -2555,8 +2555,8 @@ Variant GPUParticlesCollision3DGizmoPlugin::get_handle_value(EditorNode3DGizmo *
|
|||
void GPUParticlesCollision3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
Node3D *sn = p_gizmo->get_spatial_node();
|
||||
|
||||
Transform gt = sn->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = sn->get_global_transform();
|
||||
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);
|
||||
|
@ -2814,9 +2814,9 @@ Variant ReflectionProbeGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo,
|
|||
|
||||
void ReflectionProbeGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
ReflectionProbe *probe = Object::cast_to<ReflectionProbe>(p_gizmo->get_spatial_node());
|
||||
Transform gt = probe->get_global_transform();
|
||||
Transform3D gt = probe->get_global_transform();
|
||||
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
if (p_idx < 3) {
|
||||
Vector3 extents = probe->get_extents();
|
||||
|
@ -2993,9 +2993,9 @@ Variant DecalGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_idx
|
|||
|
||||
void DecalGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
Decal *decal = Object::cast_to<Decal>(p_gizmo->get_spatial_node());
|
||||
Transform gt = decal->get_global_transform();
|
||||
Transform3D gt = decal->get_global_transform();
|
||||
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
Vector3 extents = decal->get_extents();
|
||||
|
||||
|
@ -3135,8 +3135,8 @@ Variant GIProbeGizmoPlugin::get_handle_value(EditorNode3DGizmo *p_gizmo, int p_i
|
|||
void GIProbeGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_idx, Camera3D *p_camera, const Point2 &p_point) {
|
||||
GIProbe *probe = Object::cast_to<GIProbe>(p_gizmo->get_spatial_node());
|
||||
|
||||
Transform gt = probe->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = probe->get_global_transform();
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
|
||||
Vector3 extents = probe->get_extents();
|
||||
|
||||
|
@ -3583,7 +3583,7 @@ void CollisionObject3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
co->get_shape_owners(&owners);
|
||||
for (List<uint32_t>::Element *E = owners.front(); E; E = E->next()) {
|
||||
uint32_t owner_id = E->get();
|
||||
Transform xform = co->shape_owner_get_transform(owner_id);
|
||||
Transform3D xform = co->shape_owner_get_transform(owner_id);
|
||||
Object *owner = co->shape_owner_get_owner(owner_id);
|
||||
// Exclude CollisionShape3D and CollisionPolygon3D as they have their gizmo.
|
||||
if (!Object::cast_to<CollisionShape3D>(owner) && !Object::cast_to<CollisionPolygon3D>(owner)) {
|
||||
|
@ -3701,8 +3701,8 @@ void CollisionShape3DGizmoPlugin::set_handle(EditorNode3DGizmo *p_gizmo, int p_i
|
|||
return;
|
||||
}
|
||||
|
||||
Transform gt = cs->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = cs->get_global_transform();
|
||||
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);
|
||||
|
@ -4369,7 +4369,7 @@ void NavigationRegion3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
#define BODY_A_RADIUS 0.25
|
||||
#define BODY_B_RADIUS 0.27
|
||||
|
||||
Basis JointGizmosDrawer::look_body(const Transform &p_joint_transform, const Transform &p_body_transform) {
|
||||
Basis JointGizmosDrawer::look_body(const Transform3D &p_joint_transform, const Transform3D &p_body_transform) {
|
||||
const Vector3 &p_eye(p_joint_transform.origin);
|
||||
const Vector3 &p_target(p_body_transform.origin);
|
||||
|
||||
|
@ -4394,7 +4394,7 @@ Basis JointGizmosDrawer::look_body(const Transform &p_joint_transform, const Tra
|
|||
return base;
|
||||
}
|
||||
|
||||
Basis JointGizmosDrawer::look_body_toward(Vector3::Axis p_axis, const Transform &joint_transform, const Transform &body_transform) {
|
||||
Basis JointGizmosDrawer::look_body_toward(Vector3::Axis p_axis, const Transform3D &joint_transform, const Transform3D &body_transform) {
|
||||
switch (p_axis) {
|
||||
case Vector3::AXIS_X:
|
||||
return look_body_toward_x(joint_transform, body_transform);
|
||||
|
@ -4407,7 +4407,7 @@ Basis JointGizmosDrawer::look_body_toward(Vector3::Axis p_axis, const Transform
|
|||
}
|
||||
}
|
||||
|
||||
Basis JointGizmosDrawer::look_body_toward_x(const Transform &p_joint_transform, const Transform &p_body_transform) {
|
||||
Basis JointGizmosDrawer::look_body_toward_x(const Transform3D &p_joint_transform, const Transform3D &p_body_transform) {
|
||||
const Vector3 &p_eye(p_joint_transform.origin);
|
||||
const Vector3 &p_target(p_body_transform.origin);
|
||||
|
||||
|
@ -4438,7 +4438,7 @@ Basis JointGizmosDrawer::look_body_toward_x(const Transform &p_joint_transform,
|
|||
return base;
|
||||
}
|
||||
|
||||
Basis JointGizmosDrawer::look_body_toward_y(const Transform &p_joint_transform, const Transform &p_body_transform) {
|
||||
Basis JointGizmosDrawer::look_body_toward_y(const Transform3D &p_joint_transform, const Transform3D &p_body_transform) {
|
||||
const Vector3 &p_eye(p_joint_transform.origin);
|
||||
const Vector3 &p_target(p_body_transform.origin);
|
||||
|
||||
|
@ -4469,7 +4469,7 @@ Basis JointGizmosDrawer::look_body_toward_y(const Transform &p_joint_transform,
|
|||
return base;
|
||||
}
|
||||
|
||||
Basis JointGizmosDrawer::look_body_toward_z(const Transform &p_joint_transform, const Transform &p_body_transform) {
|
||||
Basis JointGizmosDrawer::look_body_toward_z(const Transform3D &p_joint_transform, const Transform3D &p_body_transform) {
|
||||
const Vector3 &p_eye(p_joint_transform.origin);
|
||||
const Vector3 &p_target(p_body_transform.origin);
|
||||
|
||||
|
@ -4500,7 +4500,7 @@ Basis JointGizmosDrawer::look_body_toward_z(const Transform &p_joint_transform,
|
|||
return base;
|
||||
}
|
||||
|
||||
void JointGizmosDrawer::draw_circle(Vector3::Axis p_axis, real_t p_radius, const Transform &p_offset, const Basis &p_base, real_t p_limit_lower, real_t p_limit_upper, Vector<Vector3> &r_points, bool p_inverse) {
|
||||
void JointGizmosDrawer::draw_circle(Vector3::Axis p_axis, real_t p_radius, const Transform3D &p_offset, const Basis &p_base, real_t p_limit_lower, real_t p_limit_upper, Vector<Vector3> &r_points, bool p_inverse) {
|
||||
if (p_limit_lower == p_limit_upper) {
|
||||
r_points.push_back(p_offset.translated(Vector3()).origin);
|
||||
r_points.push_back(p_offset.translated(p_base.xform(Vector3(0.5, 0, 0))).origin);
|
||||
|
@ -4562,7 +4562,7 @@ void JointGizmosDrawer::draw_circle(Vector3::Axis p_axis, real_t p_radius, const
|
|||
}
|
||||
}
|
||||
|
||||
void JointGizmosDrawer::draw_cone(const Transform &p_offset, const Basis &p_base, real_t p_swing, real_t p_twist, Vector<Vector3> &r_points) {
|
||||
void JointGizmosDrawer::draw_cone(const Transform3D &p_offset, const Basis &p_base, real_t p_swing, real_t p_twist, Vector<Vector3> &r_points) {
|
||||
float r = 1.0;
|
||||
float w = r * Math::sin(p_swing);
|
||||
float d = r * Math::cos(p_swing);
|
||||
|
@ -4666,7 +4666,7 @@ void Joint3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
Vector<Vector3> body_b_points;
|
||||
|
||||
if (Object::cast_to<PinJoint3D>(joint)) {
|
||||
CreatePinJointGizmo(Transform(), points);
|
||||
CreatePinJointGizmo(Transform3D(), points);
|
||||
p_gizmo->add_collision_segments(points);
|
||||
p_gizmo->add_lines(points, common_material);
|
||||
}
|
||||
|
@ -4674,10 +4674,10 @@ void Joint3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
HingeJoint3D *hinge = Object::cast_to<HingeJoint3D>(joint);
|
||||
if (hinge) {
|
||||
CreateHingeJointGizmo(
|
||||
Transform(),
|
||||
Transform3D(),
|
||||
hinge->get_global_transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform3D(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform3D(),
|
||||
hinge->get_param(HingeJoint3D::PARAM_LIMIT_LOWER),
|
||||
hinge->get_param(HingeJoint3D::PARAM_LIMIT_UPPER),
|
||||
hinge->get_flag(HingeJoint3D::FLAG_USE_LIMIT),
|
||||
|
@ -4697,10 +4697,10 @@ void Joint3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
SliderJoint3D *slider = Object::cast_to<SliderJoint3D>(joint);
|
||||
if (slider) {
|
||||
CreateSliderJointGizmo(
|
||||
Transform(),
|
||||
Transform3D(),
|
||||
slider->get_global_transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform3D(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform3D(),
|
||||
slider->get_param(SliderJoint3D::PARAM_ANGULAR_LIMIT_LOWER),
|
||||
slider->get_param(SliderJoint3D::PARAM_ANGULAR_LIMIT_UPPER),
|
||||
slider->get_param(SliderJoint3D::PARAM_LINEAR_LIMIT_LOWER),
|
||||
|
@ -4721,10 +4721,10 @@ void Joint3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
ConeTwistJoint3D *cone = Object::cast_to<ConeTwistJoint3D>(joint);
|
||||
if (cone) {
|
||||
CreateConeTwistJointGizmo(
|
||||
Transform(),
|
||||
Transform3D(),
|
||||
cone->get_global_transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform3D(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform3D(),
|
||||
cone->get_param(ConeTwistJoint3D::PARAM_SWING_SPAN),
|
||||
cone->get_param(ConeTwistJoint3D::PARAM_TWIST_SPAN),
|
||||
node_body_a ? &body_a_points : nullptr,
|
||||
|
@ -4740,10 +4740,10 @@ void Joint3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
Generic6DOFJoint3D *gen = Object::cast_to<Generic6DOFJoint3D>(joint);
|
||||
if (gen) {
|
||||
CreateGeneric6DOFJointGizmo(
|
||||
Transform(),
|
||||
Transform3D(),
|
||||
gen->get_global_transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform(),
|
||||
node_body_a ? node_body_a->get_global_transform() : Transform3D(),
|
||||
node_body_b ? node_body_b->get_global_transform() : Transform3D(),
|
||||
|
||||
gen->get_param_x(Generic6DOFJoint3D::PARAM_ANGULAR_LOWER_LIMIT),
|
||||
gen->get_param_x(Generic6DOFJoint3D::PARAM_ANGULAR_UPPER_LIMIT),
|
||||
|
@ -4780,7 +4780,7 @@ void Joint3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||
}
|
||||
}
|
||||
|
||||
void Joint3DGizmoPlugin::CreatePinJointGizmo(const Transform &p_offset, Vector<Vector3> &r_cursor_points) {
|
||||
void Joint3DGizmoPlugin::CreatePinJointGizmo(const Transform3D &p_offset, Vector<Vector3> &r_cursor_points) {
|
||||
float cs = 0.25;
|
||||
|
||||
r_cursor_points.push_back(p_offset.translated(Vector3(+cs, 0, 0)).origin);
|
||||
|
@ -4791,7 +4791,7 @@ void Joint3DGizmoPlugin::CreatePinJointGizmo(const Transform &p_offset, Vector<V
|
|||
r_cursor_points.push_back(p_offset.translated(Vector3(0, 0, -cs)).origin);
|
||||
}
|
||||
|
||||
void Joint3DGizmoPlugin::CreateHingeJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_limit_lower, real_t p_limit_upper, bool p_use_limit, Vector<Vector3> &r_common_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) {
|
||||
void Joint3DGizmoPlugin::CreateHingeJointGizmo(const Transform3D &p_offset, const Transform3D &p_trs_joint, const Transform3D &p_trs_body_a, const Transform3D &p_trs_body_b, real_t p_limit_lower, real_t p_limit_upper, bool p_use_limit, Vector<Vector3> &r_common_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) {
|
||||
r_common_points.push_back(p_offset.translated(Vector3(0, 0, 0.5)).origin);
|
||||
r_common_points.push_back(p_offset.translated(Vector3(0, 0, -0.5)).origin);
|
||||
|
||||
|
@ -4821,7 +4821,7 @@ void Joint3DGizmoPlugin::CreateHingeJointGizmo(const Transform &p_offset, const
|
|||
}
|
||||
}
|
||||
|
||||
void Joint3DGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_angular_limit_lower, real_t p_angular_limit_upper, real_t p_linear_limit_lower, real_t p_linear_limit_upper, Vector<Vector3> &r_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) {
|
||||
void Joint3DGizmoPlugin::CreateSliderJointGizmo(const Transform3D &p_offset, const Transform3D &p_trs_joint, const Transform3D &p_trs_body_a, const Transform3D &p_trs_body_b, real_t p_angular_limit_lower, real_t p_angular_limit_upper, real_t p_linear_limit_lower, real_t p_linear_limit_upper, Vector<Vector3> &r_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) {
|
||||
p_linear_limit_lower = -p_linear_limit_lower;
|
||||
p_linear_limit_upper = -p_linear_limit_upper;
|
||||
|
||||
|
@ -4880,7 +4880,7 @@ void Joint3DGizmoPlugin::CreateSliderJointGizmo(const Transform &p_offset, const
|
|||
}
|
||||
}
|
||||
|
||||
void Joint3DGizmoPlugin::CreateConeTwistJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_swing, real_t p_twist, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) {
|
||||
void Joint3DGizmoPlugin::CreateConeTwistJointGizmo(const Transform3D &p_offset, const Transform3D &p_trs_joint, const Transform3D &p_trs_body_a, const Transform3D &p_trs_body_b, real_t p_swing, real_t p_twist, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points) {
|
||||
if (r_body_a_points) {
|
||||
JointGizmosDrawer::draw_cone(
|
||||
p_offset,
|
||||
|
@ -4901,10 +4901,10 @@ void Joint3DGizmoPlugin::CreateConeTwistJointGizmo(const Transform &p_offset, co
|
|||
}
|
||||
|
||||
void Joint3DGizmoPlugin::CreateGeneric6DOFJointGizmo(
|
||||
const Transform &p_offset,
|
||||
const Transform &p_trs_joint,
|
||||
const Transform &p_trs_body_a,
|
||||
const Transform &p_trs_body_b,
|
||||
const Transform3D &p_offset,
|
||||
const Transform3D &p_trs_joint,
|
||||
const Transform3D &p_trs_body_a,
|
||||
const Transform3D &p_trs_body_b,
|
||||
real_t p_angular_limit_lower_x,
|
||||
real_t p_angular_limit_upper_x,
|
||||
real_t p_linear_limit_lower_x,
|
||||
|
|
|
@ -428,17 +428,17 @@ public:
|
|||
|
||||
class JointGizmosDrawer {
|
||||
public:
|
||||
static Basis look_body(const Transform &p_joint_transform, const Transform &p_body_transform);
|
||||
static Basis look_body_toward(Vector3::Axis p_axis, const Transform &joint_transform, const Transform &body_transform);
|
||||
static Basis look_body_toward_x(const Transform &p_joint_transform, const Transform &p_body_transform);
|
||||
static Basis look_body_toward_y(const Transform &p_joint_transform, const Transform &p_body_transform);
|
||||
static Basis look_body(const Transform3D &p_joint_transform, const Transform3D &p_body_transform);
|
||||
static Basis look_body_toward(Vector3::Axis p_axis, const Transform3D &joint_transform, const Transform3D &body_transform);
|
||||
static Basis look_body_toward_x(const Transform3D &p_joint_transform, const Transform3D &p_body_transform);
|
||||
static Basis look_body_toward_y(const Transform3D &p_joint_transform, const Transform3D &p_body_transform);
|
||||
/// Special function just used for physics joints, it returns a basis constrained toward Joint Z axis
|
||||
/// with axis X and Y that are looking toward the body and oriented toward up
|
||||
static Basis look_body_toward_z(const Transform &p_joint_transform, const Transform &p_body_transform);
|
||||
static Basis look_body_toward_z(const Transform3D &p_joint_transform, const Transform3D &p_body_transform);
|
||||
|
||||
// Draw circle around p_axis
|
||||
static void draw_circle(Vector3::Axis p_axis, real_t p_radius, const Transform &p_offset, const Basis &p_base, real_t p_limit_lower, real_t p_limit_upper, Vector<Vector3> &r_points, bool p_inverse = false);
|
||||
static void draw_cone(const Transform &p_offset, const Basis &p_base, real_t p_swing, real_t p_twist, Vector<Vector3> &r_points);
|
||||
static void draw_circle(Vector3::Axis p_axis, real_t p_radius, const Transform3D &p_offset, const Basis &p_base, real_t p_limit_lower, real_t p_limit_upper, Vector<Vector3> &r_points, bool p_inverse = false);
|
||||
static void draw_cone(const Transform3D &p_offset, const Basis &p_base, real_t p_swing, real_t p_twist, Vector<Vector3> &r_points);
|
||||
};
|
||||
|
||||
class Joint3DGizmoPlugin : public EditorNode3DGizmoPlugin {
|
||||
|
@ -455,15 +455,15 @@ public:
|
|||
int get_priority() const override;
|
||||
void redraw(EditorNode3DGizmo *p_gizmo) override;
|
||||
|
||||
static void CreatePinJointGizmo(const Transform &p_offset, Vector<Vector3> &r_cursor_points);
|
||||
static void CreateHingeJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_limit_lower, real_t p_limit_upper, bool p_use_limit, Vector<Vector3> &r_common_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points);
|
||||
static void CreateSliderJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_angular_limit_lower, real_t p_angular_limit_upper, real_t p_linear_limit_lower, real_t p_linear_limit_upper, Vector<Vector3> &r_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points);
|
||||
static void CreateConeTwistJointGizmo(const Transform &p_offset, const Transform &p_trs_joint, const Transform &p_trs_body_a, const Transform &p_trs_body_b, real_t p_swing, real_t p_twist, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points);
|
||||
static void CreatePinJointGizmo(const Transform3D &p_offset, Vector<Vector3> &r_cursor_points);
|
||||
static void CreateHingeJointGizmo(const Transform3D &p_offset, const Transform3D &p_trs_joint, const Transform3D &p_trs_body_a, const Transform3D &p_trs_body_b, real_t p_limit_lower, real_t p_limit_upper, bool p_use_limit, Vector<Vector3> &r_common_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points);
|
||||
static void CreateSliderJointGizmo(const Transform3D &p_offset, const Transform3D &p_trs_joint, const Transform3D &p_trs_body_a, const Transform3D &p_trs_body_b, real_t p_angular_limit_lower, real_t p_angular_limit_upper, real_t p_linear_limit_lower, real_t p_linear_limit_upper, Vector<Vector3> &r_points, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points);
|
||||
static void CreateConeTwistJointGizmo(const Transform3D &p_offset, const Transform3D &p_trs_joint, const Transform3D &p_trs_body_a, const Transform3D &p_trs_body_b, real_t p_swing, real_t p_twist, Vector<Vector3> *r_body_a_points, Vector<Vector3> *r_body_b_points);
|
||||
static void CreateGeneric6DOFJointGizmo(
|
||||
const Transform &p_offset,
|
||||
const Transform &p_trs_joint,
|
||||
const Transform &p_trs_body_a,
|
||||
const Transform &p_trs_body_b,
|
||||
const Transform3D &p_offset,
|
||||
const Transform3D &p_trs_joint,
|
||||
const Transform3D &p_trs_body_a,
|
||||
const Transform3D &p_trs_body_b,
|
||||
real_t p_angular_limit_lower_x,
|
||||
real_t p_angular_limit_upper_x,
|
||||
real_t p_linear_limit_lower_x,
|
||||
|
|
|
@ -108,8 +108,8 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
|||
return false;
|
||||
}
|
||||
|
||||
Transform gt = node->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = node->get_global_transform();
|
||||
Transform3D gi = gt.affine_inverse();
|
||||
float depth = _get_depth() * 0.5;
|
||||
Vector3 n = gt.basis.get_axis(2).normalized();
|
||||
Plane p(gt.origin + n * depth, n);
|
||||
|
@ -516,7 +516,7 @@ CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) {
|
|||
mode = MODE_EDIT;
|
||||
wip_active = false;
|
||||
imgeom = memnew(ImmediateGeometry3D);
|
||||
imgeom->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
|
||||
imgeom->set_transform(Transform3D(Basis(), Vector3(0, 0, 0.00001)));
|
||||
|
||||
line_material = Ref<StandardMaterial3D>(memnew(StandardMaterial3D));
|
||||
line_material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
|
||||
|
@ -539,7 +539,7 @@ CollisionPolygon3DEditor::CollisionPolygon3DEditor(EditorNode *p_editor) {
|
|||
imgeom->add_child(pointsm);
|
||||
m.instance();
|
||||
pointsm->set_mesh(m);
|
||||
pointsm->set_transform(Transform(Basis(), Vector3(0, 0, 0.00001)));
|
||||
pointsm->set_transform(Transform3D(Basis(), Vector3(0, 0, 0.00001)));
|
||||
|
||||
snap_ignore = false;
|
||||
}
|
||||
|
|
|
@ -359,12 +359,12 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
|
|||
|
||||
camera = RS::get_singleton()->camera_create();
|
||||
RS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
RS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
|
||||
RS::get_singleton()->camera_set_transform(camera, Transform3D(Basis(), Vector3(0, 0, 3)));
|
||||
RS::get_singleton()->camera_set_perspective(camera, 45, 0.1, 10);
|
||||
|
||||
light = RS::get_singleton()->directional_light_create();
|
||||
light_instance = RS::get_singleton()->instance_create2(light, scenario);
|
||||
RS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance, Transform3D().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
|
||||
light2 = RS::get_singleton()->directional_light_create();
|
||||
RS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
|
@ -372,7 +372,7 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
|
|||
|
||||
light_instance2 = RS::get_singleton()->instance_create2(light2, scenario);
|
||||
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, Transform3D().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
|
||||
sphere = RS::get_singleton()->mesh_create();
|
||||
sphere_instance = RS::get_singleton()->instance_create2(sphere, scenario);
|
||||
|
@ -720,7 +720,7 @@ Ref<Texture2D> EditorMeshPreviewPlugin::generate(const RES &p_from, const Size2
|
|||
AABB aabb = mesh->get_aabb();
|
||||
Vector3 ofs = aabb.position + aabb.size * 0.5;
|
||||
aabb.position -= ofs;
|
||||
Transform xform;
|
||||
Transform3D xform;
|
||||
xform.basis = Basis().rotated(Vector3(0, 1, 0), -Math_PI * 0.125);
|
||||
xform.basis = Basis().rotated(Vector3(1, 0, 0), Math_PI * 0.125) * xform.basis;
|
||||
AABB rot_aabb = xform.xform(aabb);
|
||||
|
@ -780,20 +780,20 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() {
|
|||
|
||||
camera = RS::get_singleton()->camera_create();
|
||||
RS::get_singleton()->viewport_attach_camera(viewport, camera);
|
||||
RS::get_singleton()->camera_set_transform(camera, Transform(Basis(), Vector3(0, 0, 3)));
|
||||
RS::get_singleton()->camera_set_transform(camera, Transform3D(Basis(), Vector3(0, 0, 3)));
|
||||
//RS::get_singleton()->camera_set_perspective(camera,45,0.1,10);
|
||||
RS::get_singleton()->camera_set_orthogonal(camera, 1.0, 0.01, 1000.0);
|
||||
|
||||
light = RS::get_singleton()->directional_light_create();
|
||||
light_instance = RS::get_singleton()->instance_create2(light, scenario);
|
||||
RS::get_singleton()->instance_set_transform(light_instance, Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance, Transform3D().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
|
||||
light2 = RS::get_singleton()->directional_light_create();
|
||||
RS::get_singleton()->light_set_color(light2, Color(0.7, 0.7, 0.7));
|
||||
//RS::get_singleton()->light_set_color(light2, RS::LIGHT_COLOR_SPECULAR, Color(0.0, 0.0, 0.0));
|
||||
light_instance2 = RS::get_singleton()->instance_create2(light2, scenario);
|
||||
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
RS::get_singleton()->instance_set_transform(light_instance2, Transform3D().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
|
||||
//sphere = RS::get_singleton()->mesh_create();
|
||||
mesh_instance = RS::get_singleton()->instance_create();
|
||||
|
|
|
@ -177,7 +177,7 @@ void GPUParticles3DEditorBase::_node_selected(const NodePath &p_path) {
|
|||
return;
|
||||
}
|
||||
|
||||
Transform geom_xform = base_node->get_global_transform().affine_inverse() * vi->get_global_transform();
|
||||
Transform3D geom_xform = base_node->get_global_transform().affine_inverse() * vi->get_global_transform();
|
||||
|
||||
int gc = geometry.size();
|
||||
Face3 *w = geometry.ptrw();
|
||||
|
|
|
@ -119,17 +119,17 @@ MaterialEditor::MaterialEditor() {
|
|||
viewport->set_msaa(Viewport::MSAA_4X);
|
||||
|
||||
camera = memnew(Camera3D);
|
||||
camera->set_transform(Transform(Basis(), Vector3(0, 0, 3)));
|
||||
camera->set_transform(Transform3D(Basis(), Vector3(0, 0, 3)));
|
||||
camera->set_perspective(45, 0.1, 10);
|
||||
camera->make_current();
|
||||
viewport->add_child(camera);
|
||||
|
||||
light1 = memnew(DirectionalLight3D);
|
||||
light1->set_transform(Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
light1->set_transform(Transform3D().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
viewport->add_child(light1);
|
||||
|
||||
light2 = memnew(DirectionalLight3D);
|
||||
light2->set_transform(Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
light2->set_transform(Transform3D().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
light2->set_color(Color(0.7, 0.7, 0.7));
|
||||
viewport->add_child(light2);
|
||||
|
||||
|
@ -139,7 +139,7 @@ MaterialEditor::MaterialEditor() {
|
|||
box_instance = memnew(MeshInstance3D);
|
||||
viewport->add_child(box_instance);
|
||||
|
||||
Transform box_xform;
|
||||
Transform3D box_xform;
|
||||
box_xform.basis.rotate(Vector3(1, 0, 0), Math::deg2rad(25.0));
|
||||
box_xform.basis = box_xform.basis * Basis().rotated(Vector3(0, 1, 0), Math::deg2rad(-25.0));
|
||||
box_xform.basis.scale(Vector3(0.8, 0.8, 0.8));
|
||||
|
|
|
@ -65,7 +65,7 @@ void MeshEditor::_notification(int p_what) {
|
|||
}
|
||||
|
||||
void MeshEditor::_update_rotation() {
|
||||
Transform t;
|
||||
Transform3D t;
|
||||
t.basis.rotate(Vector3(0, 1, 0), -rot_y);
|
||||
t.basis.rotate(Vector3(1, 0, 0), -rot_x);
|
||||
rotation->set_transform(t);
|
||||
|
@ -85,7 +85,7 @@ void MeshEditor::edit(Ref<Mesh> p_mesh) {
|
|||
if (m != 0) {
|
||||
m = 1.0 / m;
|
||||
m *= 0.5;
|
||||
Transform xform;
|
||||
Transform3D xform;
|
||||
xform.basis.scale(Vector3(m, m, m));
|
||||
xform.origin = -xform.basis.xform(ofs); //-ofs*m;
|
||||
//xform.origin.z -= aabb.get_longest_axis_size() * 2;
|
||||
|
@ -117,16 +117,16 @@ MeshEditor::MeshEditor() {
|
|||
viewport->set_msaa(Viewport::MSAA_2X);
|
||||
set_stretch(true);
|
||||
camera = memnew(Camera3D);
|
||||
camera->set_transform(Transform(Basis(), Vector3(0, 0, 1.1)));
|
||||
camera->set_transform(Transform3D(Basis(), Vector3(0, 0, 1.1)));
|
||||
camera->set_perspective(45, 0.1, 10);
|
||||
viewport->add_child(camera);
|
||||
|
||||
light1 = memnew(DirectionalLight3D);
|
||||
light1->set_transform(Transform().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
light1->set_transform(Transform3D().looking_at(Vector3(-1, -1, -1), Vector3(0, 1, 0)));
|
||||
viewport->add_child(light1);
|
||||
|
||||
light2 = memnew(DirectionalLight3D);
|
||||
light2->set_transform(Transform().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
light2->set_transform(Transform3D().looking_at(Vector3(0, 1, 0), Vector3(0, 0, 1)));
|
||||
light2->set_color(Color(0.7, 0.7, 0.7));
|
||||
viewport->add_child(light2);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
|
|||
continue;
|
||||
}
|
||||
|
||||
//Transform shape_transform = sb->shape_owner_get_transform(E->get());
|
||||
//Transform3D shape_transform = sb->shape_owner_get_transform(E->get());
|
||||
|
||||
//shape_transform.set_origin(shape_transform.get_origin() - phys_offset);
|
||||
|
||||
|
@ -147,7 +147,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
|
|||
p_library->set_item_shapes(id, collisions);
|
||||
|
||||
Ref<NavigationMesh> navmesh;
|
||||
Transform navmesh_transform;
|
||||
Transform3D navmesh_transform;
|
||||
for (int j = 0; j < mi->get_child_count(); j++) {
|
||||
Node *child2 = mi->get_child(j);
|
||||
if (!Object::cast_to<NavigationRegion3D>(child2)) {
|
||||
|
@ -170,7 +170,7 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library,
|
|||
|
||||
if (true) {
|
||||
Vector<Ref<Mesh>> meshes;
|
||||
Vector<Transform> transforms;
|
||||
Vector<Transform3D> transforms;
|
||||
Vector<int> ids = p_library->get_item_list();
|
||||
for (int i = 0; i < ids.size(); i++) {
|
||||
if (mesh_instances.find(ids[i])) {
|
||||
|
|
|
@ -111,7 +111,7 @@ void MultiMeshEditor::_populate() {
|
|||
return;
|
||||
}
|
||||
|
||||
Transform geom_xform = node->get_global_transform().affine_inverse() * ss_instance->get_global_transform();
|
||||
Transform3D geom_xform = node->get_global_transform().affine_inverse() * ss_instance->get_global_transform();
|
||||
|
||||
Vector<Face3> geometry = ss_instance->get_faces(VisualInstance3D::FACES_SOLID);
|
||||
|
||||
|
@ -167,7 +167,7 @@ void MultiMeshEditor::_populate() {
|
|||
float _scale = populate_scale->get_value();
|
||||
int axis = populate_axis->get_selected();
|
||||
|
||||
Transform axis_xform;
|
||||
Transform3D axis_xform;
|
||||
if (axis == Vector3::AXIS_Z) {
|
||||
axis_xform.rotate(Vector3(1, 0, 0), -Math_PI * 0.5);
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ void MultiMeshEditor::_populate() {
|
|||
Vector3 normal = face.get_plane().normal;
|
||||
Vector3 op_axis = (face.vertex[0] - face.vertex[1]).normalized();
|
||||
|
||||
Transform xform;
|
||||
Transform3D xform;
|
||||
|
||||
xform.set_look_at(pos, pos + op_axis, normal);
|
||||
xform = xform * axis_xform;
|
||||
|
|
|
@ -361,8 +361,8 @@ void Node3DEditorViewport::_update_camera(float p_interp_delta) {
|
|||
}
|
||||
}
|
||||
|
||||
Transform Node3DEditorViewport::to_camera_transform(const Cursor &p_cursor) const {
|
||||
Transform camera_transform;
|
||||
Transform3D Node3DEditorViewport::to_camera_transform(const Cursor &p_cursor) const {
|
||||
Transform3D camera_transform;
|
||||
camera_transform.translate(p_cursor.pos);
|
||||
camera_transform.basis.rotate(Vector3(1, 0, 0), -p_cursor.x_rot);
|
||||
camera_transform.basis.rotate(Vector3(0, 1, 0), -p_cursor.y_rot);
|
||||
|
@ -410,7 +410,7 @@ float Node3DEditorViewport::get_fov() const {
|
|||
return CLAMP(spatial_editor->get_fov(), MIN_FOV, MAX_FOV);
|
||||
}
|
||||
|
||||
Transform Node3DEditorViewport::_get_camera_transform() const {
|
||||
Transform3D Node3DEditorViewport::_get_camera_transform() const {
|
||||
return camera->get_global_transform();
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ Vector3 Node3DEditorViewport::_get_screen_to_space(const Vector3 &p_vector3) {
|
|||
}
|
||||
Vector2 screen_he = cm.get_viewport_half_extents();
|
||||
|
||||
Transform camera_transform;
|
||||
Transform3D camera_transform;
|
||||
camera_transform.translate(cursor.pos);
|
||||
camera_transform.basis.rotate(Vector3(1, 0, 0), -cursor.x_rot);
|
||||
camera_transform.basis.rotate(Vector3(0, 1, 0), -cursor.y_rot);
|
||||
|
@ -829,7 +829,7 @@ bool Node3DEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_high
|
|||
Vector3 ray_pos = _get_ray_pos(Vector2(p_screenpos.x, p_screenpos.y));
|
||||
Vector3 ray = _get_ray(Vector2(p_screenpos.x, p_screenpos.y));
|
||||
|
||||
Transform gt = spatial_editor->get_gizmo_transform();
|
||||
Transform3D gt = spatial_editor->get_gizmo_transform();
|
||||
float gs = gizmo_scale;
|
||||
|
||||
if (spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_MOVE) {
|
||||
|
@ -1579,10 +1579,10 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
continue;
|
||||
}
|
||||
|
||||
Transform original = se->original;
|
||||
Transform original_local = se->original_local;
|
||||
Transform base = Transform(Basis(), _edit.center);
|
||||
Transform t;
|
||||
Transform3D original = se->original;
|
||||
Transform3D original_local = se->original_local;
|
||||
Transform3D base = Transform3D(Basis(), _edit.center);
|
||||
Transform3D t;
|
||||
Vector3 local_scale;
|
||||
|
||||
if (local_coords) {
|
||||
|
@ -1608,7 +1608,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
motion.snap(Vector3(snap, snap, snap));
|
||||
}
|
||||
|
||||
Transform r;
|
||||
Transform3D r;
|
||||
r.basis.scale(motion + Vector3(1, 1, 1));
|
||||
t = base * (r * (base.inverse() * original));
|
||||
|
||||
|
@ -1701,8 +1701,8 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
continue;
|
||||
}
|
||||
|
||||
Transform original = se->original;
|
||||
Transform t;
|
||||
Transform3D original = se->original;
|
||||
Transform3D t;
|
||||
|
||||
if (local_coords) {
|
||||
if (_edit.snap || spatial_editor->is_snap_enabled()) {
|
||||
|
@ -1797,10 +1797,10 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
continue;
|
||||
}
|
||||
|
||||
Transform t;
|
||||
Transform3D t;
|
||||
|
||||
if (local_coords) {
|
||||
Transform original_local = se->original_local;
|
||||
Transform3D original_local = se->original_local;
|
||||
Basis rot = Basis(axis, angle);
|
||||
|
||||
t.basis = original_local.get_basis().orthonormalized() * rot;
|
||||
|
@ -1811,9 +1811,9 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
sp->set_scale(original_local.basis.get_scale()); // re-apply original scale
|
||||
|
||||
} else {
|
||||
Transform original = se->original;
|
||||
Transform r;
|
||||
Transform base = Transform(Basis(), _edit.center);
|
||||
Transform3D original = se->original;
|
||||
Transform3D r;
|
||||
Transform3D base = Transform3D(Basis(), _edit.center);
|
||||
|
||||
r.basis.rotate(plane.normal, angle);
|
||||
t = base * r * base.inverse() * original;
|
||||
|
@ -2057,7 +2057,7 @@ void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const
|
|||
pan_speed *= pan_speed_modifier;
|
||||
}
|
||||
|
||||
Transform camera_transform;
|
||||
Transform3D camera_transform;
|
||||
|
||||
camera_transform.translate(cursor.pos);
|
||||
camera_transform.basis.rotate(Vector3(1, 0, 0), -cursor.x_rot);
|
||||
|
@ -2145,7 +2145,7 @@ void Node3DEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const
|
|||
const bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y_axis");
|
||||
|
||||
// Note: do NOT assume the camera has the "current" transform, because it is interpolated and may have "lag".
|
||||
const Transform prev_camera_transform = to_camera_transform(cursor);
|
||||
const Transform3D prev_camera_transform = to_camera_transform(cursor);
|
||||
|
||||
if (invert_y_axis) {
|
||||
cursor.x_rot -= p_relative.y * radians_per_pixel;
|
||||
|
@ -2158,7 +2158,7 @@ void Node3DEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const
|
|||
cursor.y_rot += p_relative.x * radians_per_pixel;
|
||||
|
||||
// Look is like the opposite of Orbit: the focus point rotates around the camera
|
||||
Transform camera_transform = to_camera_transform(cursor);
|
||||
Transform3D camera_transform = to_camera_transform(cursor);
|
||||
Vector3 pos = camera_transform.xform(Vector3(0, 0, 0));
|
||||
Vector3 prev_pos = prev_camera_transform.xform(Vector3(0, 0, 0));
|
||||
Vector3 diff = prev_pos - pos;
|
||||
|
@ -2444,7 +2444,7 @@ void Node3DEditorViewport::_notification(int p_what) {
|
|||
continue;
|
||||
}
|
||||
|
||||
Transform t = sp->get_global_gizmo_transform();
|
||||
Transform3D t = sp->get_global_gizmo_transform();
|
||||
VisualInstance3D *vi = Object::cast_to<VisualInstance3D>(sp);
|
||||
AABB new_aabb = vi ? vi->get_aabb() : _calculate_spatial_bounds(sp);
|
||||
|
||||
|
@ -2878,7 +2878,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
|
|||
break;
|
||||
}
|
||||
|
||||
Transform camera_transform = camera->get_global_transform();
|
||||
Transform3D camera_transform = camera->get_global_transform();
|
||||
|
||||
List<Node *> &selection = editor_selection->get_selected_node_list();
|
||||
|
||||
|
@ -2895,7 +2895,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
|
|||
continue;
|
||||
}
|
||||
|
||||
Transform xform;
|
||||
Transform3D xform;
|
||||
if (orthogonal) {
|
||||
xform = sp->get_global_transform();
|
||||
xform.basis.set_euler(camera_transform.basis.get_euler());
|
||||
|
@ -2915,7 +2915,7 @@ void Node3DEditorViewport::_menu_option(int p_option) {
|
|||
break;
|
||||
}
|
||||
|
||||
Transform camera_transform = camera->get_global_transform();
|
||||
Transform3D camera_transform = camera->get_global_transform();
|
||||
|
||||
List<Node *> &selection = editor_selection->get_selected_node_list();
|
||||
|
||||
|
@ -3315,9 +3315,9 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
|
|||
return;
|
||||
}
|
||||
|
||||
Transform xform = spatial_editor->get_gizmo_transform();
|
||||
Transform3D xform = spatial_editor->get_gizmo_transform();
|
||||
|
||||
Transform camera_xform = camera->get_transform();
|
||||
Transform3D camera_xform = camera->get_transform();
|
||||
|
||||
if (xform.origin.distance_squared_to(camera_xform.origin) < 0.01) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
@ -3800,7 +3800,7 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po
|
|||
|
||||
Node3D *node3d = Object::cast_to<Node3D>(instanced_scene);
|
||||
if (node3d) {
|
||||
Transform global_transform;
|
||||
Transform3D global_transform;
|
||||
Node3D *parent_node3d = Object::cast_to<Node3D>(parent);
|
||||
if (parent_node3d) {
|
||||
global_transform = parent_node3d->get_global_gizmo_transform();
|
||||
|
@ -3900,7 +3900,7 @@ bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant
|
|||
}
|
||||
|
||||
if (can_instance) {
|
||||
Transform global_transform = Transform(Basis(), _get_instance_position(p_point));
|
||||
Transform3D global_transform = Transform3D(Basis(), _get_instance_position(p_point));
|
||||
preview_node->set_global_transform(global_transform);
|
||||
}
|
||||
|
||||
|
@ -4574,7 +4574,7 @@ void Node3DEditor::update_transform_gizmo() {
|
|||
continue;
|
||||
}
|
||||
|
||||
Transform xf = se->sp->get_global_gizmo_transform();
|
||||
Transform3D xf = se->sp->get_global_gizmo_transform();
|
||||
|
||||
if (first) {
|
||||
center.position = xf.origin;
|
||||
|
@ -4955,7 +4955,7 @@ void Node3DEditor::_snap_update() {
|
|||
}
|
||||
|
||||
void Node3DEditor::_xform_dialog_action() {
|
||||
Transform t;
|
||||
Transform3D t;
|
||||
//translation
|
||||
Vector3 scale;
|
||||
Vector3 rotate;
|
||||
|
@ -4988,7 +4988,7 @@ void Node3DEditor::_xform_dialog_action() {
|
|||
|
||||
bool post = xform_type->get_selected() > 0;
|
||||
|
||||
Transform tr = sp->get_global_gizmo_transform();
|
||||
Transform3D tr = sp->get_global_gizmo_transform();
|
||||
if (post) {
|
||||
tr = tr * t;
|
||||
} else {
|
||||
|
@ -6180,7 +6180,7 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
|
|||
|
||||
if (ss->intersect_ray(from, to, result, excluded)) {
|
||||
Vector3 position_offset = d["position_offset"];
|
||||
Transform new_transform = sp->get_global_transform();
|
||||
Transform3D new_transform = sp->get_global_transform();
|
||||
|
||||
new_transform.origin.y = result.position.y;
|
||||
new_transform.origin = new_transform.origin - position_offset;
|
||||
|
@ -6556,7 +6556,7 @@ void Node3DEditor::_preview_settings_changed() {
|
|||
}
|
||||
|
||||
{ // preview sun
|
||||
Transform t;
|
||||
Transform3D t;
|
||||
t.basis = sun_rotation;
|
||||
preview_sun->set_transform(t);
|
||||
sun_direction->update();
|
||||
|
|
|
@ -322,7 +322,7 @@ private:
|
|||
Vector3 _get_ray_pos(const Vector2 &p_pos) const;
|
||||
Vector3 _get_ray(const Vector2 &p_pos) const;
|
||||
Point2 _point_to_screen(const Vector3 &p_point);
|
||||
Transform _get_camera_transform() const;
|
||||
Transform3D _get_camera_transform() const;
|
||||
int get_selected_count() const;
|
||||
|
||||
Vector3 _get_camera_position() const;
|
||||
|
@ -380,7 +380,7 @@ private:
|
|||
struct EditData {
|
||||
TransformMode mode;
|
||||
TransformPlane plane;
|
||||
Transform original;
|
||||
Transform3D original;
|
||||
Vector3 click_ray;
|
||||
Vector3 click_ray_pos;
|
||||
Vector3 center;
|
||||
|
@ -432,7 +432,7 @@ private:
|
|||
|
||||
//
|
||||
void _update_camera(float p_interp_delta);
|
||||
Transform to_camera_transform(const Cursor &p_cursor) const;
|
||||
Transform3D to_camera_transform(const Cursor &p_cursor) const;
|
||||
void _draw();
|
||||
|
||||
void _surface_mouse_enter();
|
||||
|
@ -505,9 +505,9 @@ class Node3DEditorSelectedItem : public Object {
|
|||
|
||||
public:
|
||||
AABB aabb;
|
||||
Transform original; // original location when moving
|
||||
Transform original_local;
|
||||
Transform last_xform; // last transform
|
||||
Transform3D original; // original location when moving
|
||||
Transform3D original_local;
|
||||
Transform3D last_xform; // last transform
|
||||
bool last_xform_dirty;
|
||||
Node3D *sp;
|
||||
RID sbox_instance;
|
||||
|
@ -641,7 +641,7 @@ private:
|
|||
struct Gizmo {
|
||||
bool visible = false;
|
||||
float scale = 0;
|
||||
Transform transform;
|
||||
Transform3D transform;
|
||||
} gizmo;
|
||||
|
||||
enum MenuOption {
|
||||
|
@ -824,7 +824,7 @@ public:
|
|||
float get_zfar() const { return settings_zfar->get_value(); }
|
||||
float get_fov() const { return settings_fov->get_value(); }
|
||||
|
||||
Transform get_gizmo_transform() const { return gizmo.transform; }
|
||||
Transform3D get_gizmo_transform() const { return gizmo.transform; }
|
||||
bool is_gizmo_visible() const { return gizmo.visible; }
|
||||
|
||||
ToolMode get_tool_mode() const { return tool_mode; }
|
||||
|
|
|
@ -94,8 +94,8 @@ void Path3DGizmo::set_handle(int p_idx, Camera3D *p_camera, const Point2 &p_poin
|
|||
return;
|
||||
}
|
||||
|
||||
Transform gt = path->get_global_transform();
|
||||
Transform gi = gt.affine_inverse();
|
||||
Transform3D gt = path->get_global_transform();
|
||||
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);
|
||||
|
||||
|
@ -302,8 +302,8 @@ bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref
|
|||
if (c.is_null()) {
|
||||
return false;
|
||||
}
|
||||
Transform gt = path->get_global_transform();
|
||||
Transform it = gt.affine_inverse();
|
||||
Transform3D gt = path->get_global_transform();
|
||||
Transform3D it = gt.affine_inverse();
|
||||
|
||||
static const int click_dist = 10; //should make global
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ void BoneTransformEditor::_value_changed(const double p_value) {
|
|||
return;
|
||||
}
|
||||
|
||||
Transform tform = compute_transform_from_vector3s();
|
||||
Transform3D tform = compute_transform_from_vector3s();
|
||||
_change_transform(tform);
|
||||
}
|
||||
|
||||
|
@ -179,30 +179,30 @@ void BoneTransformEditor::_value_changed_vector3(const String p_property_name, c
|
|||
if (updating) {
|
||||
return;
|
||||
}
|
||||
Transform tform = compute_transform_from_vector3s();
|
||||
Transform3D tform = compute_transform_from_vector3s();
|
||||
_change_transform(tform);
|
||||
}
|
||||
|
||||
Transform BoneTransformEditor::compute_transform_from_vector3s() const {
|
||||
Transform3D BoneTransformEditor::compute_transform_from_vector3s() const {
|
||||
// Convert rotation from degrees to radians.
|
||||
Vector3 prop_rotation = rotation_property->get_vector();
|
||||
prop_rotation.x = Math::deg2rad(prop_rotation.x);
|
||||
prop_rotation.y = Math::deg2rad(prop_rotation.y);
|
||||
prop_rotation.z = Math::deg2rad(prop_rotation.z);
|
||||
|
||||
return Transform(
|
||||
return Transform3D(
|
||||
Basis(prop_rotation, scale_property->get_vector()),
|
||||
translation_property->get_vector());
|
||||
}
|
||||
|
||||
void BoneTransformEditor::_value_changed_transform(const String p_property_name, const Transform p_transform, const StringName p_edited_property_name, const bool p_boolean) {
|
||||
void BoneTransformEditor::_value_changed_transform(const String p_property_name, const Transform3D p_transform, const StringName p_edited_property_name, const bool p_boolean) {
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
_change_transform(p_transform);
|
||||
}
|
||||
|
||||
void BoneTransformEditor::_change_transform(Transform p_new_transform) {
|
||||
void BoneTransformEditor::_change_transform(Transform3D p_new_transform) {
|
||||
if (property.get_slicec('/', 0) == "bones" && property.get_slicec('/', 2) == "custom_pose") {
|
||||
undo_redo->create_action(TTR("Set Custom Bone Pose Transform"), UndoRedo::MERGE_ENDS);
|
||||
undo_redo->add_undo_method(skeleton, "set_bone_custom_pose", property.get_slicec('/', 1).to_int(), skeleton->get_bone_custom_pose(property.get_slicec('/', 1).to_int()));
|
||||
|
@ -235,7 +235,7 @@ void BoneTransformEditor::_update_properties() {
|
|||
|
||||
updating = true;
|
||||
|
||||
Transform tform = skeleton->get(property);
|
||||
Transform3D tform = skeleton->get(property);
|
||||
_update_transform_properties(tform);
|
||||
}
|
||||
|
||||
|
@ -250,11 +250,11 @@ void BoneTransformEditor::_update_custom_pose_properties() {
|
|||
|
||||
updating = true;
|
||||
|
||||
Transform tform = skeleton->get_bone_custom_pose(property.to_int());
|
||||
Transform3D tform = skeleton->get_bone_custom_pose(property.to_int());
|
||||
_update_transform_properties(tform);
|
||||
}
|
||||
|
||||
void BoneTransformEditor::_update_transform_properties(Transform tform) {
|
||||
void BoneTransformEditor::_update_transform_properties(Transform3D tform) {
|
||||
Basis rotation_basis = tform.get_basis();
|
||||
Vector3 rotation_radians = rotation_basis.get_rotation_euler();
|
||||
Vector3 rotation_degrees = Vector3(Math::rad2deg(rotation_radians.x), Math::rad2deg(rotation_radians.y), Math::rad2deg(rotation_radians.z));
|
||||
|
@ -306,7 +306,7 @@ void BoneTransformEditor::_key_button_pressed() {
|
|||
}
|
||||
|
||||
// Need to normalize the basis before you key it
|
||||
Transform tform = compute_transform_from_vector3s();
|
||||
Transform3D tform = compute_transform_from_vector3s();
|
||||
tform.orthonormalize();
|
||||
AnimationPlayerEditor::singleton->get_track_editor()->insert_transform_key(skeleton, name, tform);
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ void Skeleton3DEditor::create_physical_skeleton() {
|
|||
}
|
||||
|
||||
PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_child_id, const Vector<BoneInfo> &bones_infos) {
|
||||
const Transform child_rest = skeleton->get_bone_rest(bone_child_id);
|
||||
const Transform3D child_rest = skeleton->get_bone_rest(bone_child_id);
|
||||
|
||||
const real_t half_height(child_rest.origin.length() * 0.5);
|
||||
const real_t radius(half_height * 0.2);
|
||||
|
@ -392,15 +392,15 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi
|
|||
CollisionShape3D *bone_shape = memnew(CollisionShape3D);
|
||||
bone_shape->set_shape(bone_shape_capsule);
|
||||
|
||||
Transform capsule_transform;
|
||||
Transform3D capsule_transform;
|
||||
capsule_transform.basis = Basis(Vector3(1, 0, 0), Vector3(0, 0, 1), Vector3(0, -1, 0));
|
||||
bone_shape->set_transform(capsule_transform);
|
||||
|
||||
Transform body_transform;
|
||||
Transform3D body_transform;
|
||||
body_transform.set_look_at(Vector3(0, 0, 0), child_rest.origin);
|
||||
body_transform.origin = body_transform.basis.xform(Vector3(0, 0, -half_height));
|
||||
|
||||
Transform joint_transform;
|
||||
Transform3D joint_transform;
|
||||
joint_transform.origin = Vector3(0, 0, half_height);
|
||||
|
||||
PhysicalBone3D *physical_bone = memnew(PhysicalBone3D);
|
||||
|
|
|
@ -78,11 +78,11 @@ class BoneTransformEditor : public VBoxContainer {
|
|||
// Called when the one of the EditorPropertyVector3 are updated.
|
||||
void _value_changed_vector3(const String p_property_name, const Vector3 p_vector, const StringName p_edited_property_name, const bool p_boolean);
|
||||
// Called when the transform_property is updated.
|
||||
void _value_changed_transform(const String p_property_name, const Transform p_transform, const StringName p_edited_property_name, const bool p_boolean);
|
||||
void _value_changed_transform(const String p_property_name, const Transform3D p_transform, const StringName p_edited_property_name, const bool p_boolean);
|
||||
// Changes the transform to the given transform and updates the UI accordingly.
|
||||
void _change_transform(Transform p_new_transform);
|
||||
void _change_transform(Transform3D p_new_transform);
|
||||
// Creates a Transform using the EditorPropertyVector3 properties.
|
||||
Transform compute_transform_from_vector3s() const;
|
||||
Transform3D compute_transform_from_vector3s() const;
|
||||
|
||||
void update_enabled_checkbox();
|
||||
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
void _update_properties();
|
||||
void _update_custom_pose_properties();
|
||||
void _update_transform_properties(Transform p_transform);
|
||||
void _update_transform_properties(Transform3D p_transform);
|
||||
|
||||
// Can/cannot modify the spinner values for the Transform
|
||||
void set_read_only(const bool p_read_only);
|
||||
|
@ -127,7 +127,7 @@ class Skeleton3DEditor : public VBoxContainer {
|
|||
|
||||
struct BoneInfo {
|
||||
PhysicalBone3D *physical_bone = nullptr;
|
||||
Transform relative_rest; // Relative to skeleton node
|
||||
Transform3D relative_rest; // Relative to skeleton node
|
||||
};
|
||||
|
||||
EditorNode *editor;
|
||||
|
|
|
@ -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");
|
||||
|
@ -806,7 +806,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
|
|||
field_names.push_back("zo");
|
||||
config_value_editors(12, 4, 16, field_names);
|
||||
|
||||
Transform tr = v;
|
||||
Transform3D tr = v;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
value_editor[(i / 3) * 4 + i % 3]->set_text(String::num(tr.basis.elements[i / 3][i % 3]));
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -1569,7 +1569,7 @@ void CustomPropertyEditor::_modified(String p_string) {
|
|||
origin.y = _parse_real_expression(value_editor[7]->get_text());
|
||||
origin.z = _parse_real_expression(value_editor[11]->get_text());
|
||||
|
||||
v = Transform(basis, origin);
|
||||
v = Transform3D(basis, origin);
|
||||
_emit_changed_whole_or_field();
|
||||
|
||||
} break;
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -326,7 +326,7 @@ static Variant create_var(RS::GlobalVariableType p_type) {
|
|||
return Transform2D();
|
||||
}
|
||||
case RS::GLOBAL_VAR_TYPE_TRANSFORM: {
|
||||
return Transform();
|
||||
return Transform3D();
|
||||
}
|
||||
case RS::GLOBAL_VAR_TYPE_MAT4: {
|
||||
Vector<real_t> xform;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue