diff --git a/core/math/projection.cpp b/core/math/projection.cpp index 39948e27eb5..811596015a0 100644 --- a/core/math/projection.cpp +++ b/core/math/projection.cpp @@ -984,6 +984,13 @@ Projection::Projection(const Vector4 &p_x, const Vector4 &p_y, const Vector4 &p_ columns[3] = p_w; } +Projection::Projection(real_t p_xx, real_t p_xy, real_t p_xz, real_t p_xw, real_t p_yx, real_t p_yy, real_t p_yz, real_t p_yw, real_t p_zx, real_t p_zy, real_t p_zz, real_t p_zw, real_t p_wx, real_t p_wy, real_t p_wz, real_t p_ww) { + columns[0] = Vector4(p_xx, p_xy, p_xz, p_xw); + columns[1] = Vector4(p_yx, p_yy, p_yz, p_yw); + columns[2] = Vector4(p_zx, p_zy, p_zz, p_zw); + columns[3] = Vector4(p_wx, p_wy, p_wz, p_ww); +} + Projection::Projection(const Transform3D &p_transform) { const Transform3D &tr = p_transform; real_t *m = &columns[0][0]; diff --git a/core/math/projection.h b/core/math/projection.h index 82008b77248..01a56735492 100644 --- a/core/math/projection.h +++ b/core/math/projection.h @@ -153,6 +153,7 @@ struct [[nodiscard]] Projection { Projection(); Projection(const Vector4 &p_x, const Vector4 &p_y, const Vector4 &p_z, const Vector4 &p_w); + Projection(real_t p_xx, real_t p_xy, real_t p_xz, real_t p_xw, real_t p_yx, real_t p_yy, real_t p_yz, real_t p_yw, real_t p_zx, real_t p_zy, real_t p_zz, real_t p_zw, real_t p_wx, real_t p_wy, real_t p_wz, real_t p_ww); Projection(const Transform3D &p_transform); ~Projection(); }; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs index fed0eb5e784..3f4eca551e6 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs @@ -845,6 +845,33 @@ namespace Godot W = w; } + /// + /// Constructs a projection from 16 scalars. + /// + /// The X column vector's X component, accessed via p.X.X or [0][0]. + /// The X column vector's Y component, accessed via p.X.Y or [0][1]. + /// The X column vector's Z component, accessed via p.X.Z or [0][2]. + /// The X column vector's W component, accessed via p.X.W or [0][3]. + /// The Y column vector's X component, accessed via p.Y.X or [1][0]. + /// The Y column vector's Y component, accessed via p.Y.Y or [1][1]. + /// The Y column vector's Z component, accessed via p.Y.Z or [1][2]. + /// The Y column vector's W component, accessed via p.Y.W or [1][3]. + /// The Z column vector's X component, accessed via p.Z.X or [2][0]. + /// The Z column vector's Y component, accessed via p.Z.Y or [2][1]. + /// The Z column vector's Z component, accessed via p.Z.Z or [2][2]. + /// The Z column vector's W component, accessed via p.Z.W or [2][3]. + /// The W column vector's X component, accessed via p.W.X or [3][0]. + /// The W column vector's Y component, accessed via p.W.Y or [3][1]. + /// The W column vector's Z component, accessed via p.W.Z or [3][2]. + /// The W column vector's W component, accessed via p.W.W or [3][3]. + public Projection(real_t xx, real_t xy, real_t xz, real_t xw, real_t yx, real_t yy, real_t yz, real_t yw, real_t zx, real_t zy, real_t zz, real_t zw, real_t wx, real_t wy, real_t wz, real_t ww) + { + X = new Vector4(xx, xy, xz, xw); + Y = new Vector4(yx, yy, yz, yw); + Z = new Vector4(zx, zy, zz, zw); + W = new Vector4(wx, wy, wz, ww); + } + /// /// Constructs a new from a . ///