From 86da41e55028216b755b2f2141d09c9c38ab6e8d Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 31 May 2023 02:05:24 +0200 Subject: [PATCH] Added the missing methods in Transform and Transform2D. --- gdnative/transform.cpp | 30 ++++++++++++++++++++++++++++++ gdnative/transform2d.cpp | 29 +++++++++++++++++++++++++++++ include/gdn/transform.h | 10 +++++----- include/gdn/transform2d.h | 8 ++++---- 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/gdnative/transform.cpp b/gdnative/transform.cpp index 2cdb4f3..635536c 100644 --- a/gdnative/transform.cpp +++ b/gdnative/transform.cpp @@ -244,6 +244,21 @@ pandemonium_aabb GDAPI pandemonium_transform_xform_aabb(const pandemonium_transf return raw_dest; } +pandemonium_pool_vector3_array GDAPI pandemonium_transform_xform_pool_vector3(const pandemonium_transform *p_self, const pandemonium_pool_vector3_array *p_array) { + pandemonium_pool_vector3_array dest; + const Transform *self = (const Transform *)p_self; + const PoolVector3Array *array = (const PoolVector3Array *)p_array; + memnew_placement(&dest, PoolVector(self->xform(*array))); + return dest; +} +pandemonium_pool_vector3i_array GDAPI pandemonium_transform_xform_pool_vector3i(const pandemonium_transform *p_self, const pandemonium_pool_vector3i_array *p_array) { + pandemonium_pool_vector3i_array dest; + const Transform *self = (const Transform *)p_self; + const PoolVector3iArray *array = (const PoolVector3iArray *)p_array; + memnew_placement(&dest, PoolVector(self->xform(*array))); + return dest; +} + pandemonium_vector3 GDAPI pandemonium_transform_xform_inv_vector3(const pandemonium_transform *p_self, const pandemonium_vector3 *p_v) { pandemonium_vector3 raw_dest; Vector3 *dest = (Vector3 *)&raw_dest; @@ -270,6 +285,21 @@ pandemonium_aabb GDAPI pandemonium_transform_xform_inv_aabb(const pandemonium_tr return raw_dest; } +pandemonium_pool_vector3_array GDAPI pandemonium_transform_xform_inv_pool_vector3(const pandemonium_transform *p_self, const pandemonium_pool_vector3_array *p_array) { + pandemonium_pool_vector3_array dest; + const Transform *self = (const Transform *)p_self; + const PoolVector3Array *array = (const PoolVector3Array *)p_array; + memnew_placement(&dest, PoolVector(self->xform_inv(*array))); + return dest; +} +pandemonium_pool_vector3i_array GDAPI pandemonium_transform_xform_inv_pool_vector3i(const pandemonium_transform *p_self, const pandemonium_pool_vector3i_array *p_array) { + pandemonium_pool_vector3i_array dest; + const Transform *self = (const Transform *)p_self; + const PoolVector3iArray *array = (const PoolVector3iArray *)p_array; + memnew_placement(&dest, PoolVector(self->xform_inv(*array))); + return dest; +} + pandemonium_plane GDAPI pandemonium_transform_xform_plane(const pandemonium_transform *p_self, const pandemonium_plane *p_v) { pandemonium_plane raw_dest; Plane *dest = (Plane *)&raw_dest; diff --git a/gdnative/transform2d.cpp b/gdnative/transform2d.cpp index 63e522f..acc0a0a 100644 --- a/gdnative/transform2d.cpp +++ b/gdnative/transform2d.cpp @@ -384,6 +384,35 @@ pandemonium_vector2i GDAPI pandemonium_transform2d_xform_inv_vector2i(const pand return dest; } +pandemonium_pool_vector2_array GDAPI pandemonium_transform_xform_pool_vector2(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2_array *p_array) { + pandemonium_pool_vector2_array dest; + const Transform2D *self = (const Transform2D *)p_self; + const PoolVector2Array *array = (const PoolVector2Array *)p_array; + memnew_placement(&dest, PoolVector(self->xform(*array))); + return dest; +} +pandemonium_pool_vector2i_array GDAPI pandemonium_transform_xform_pool_vector2i(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2i_array *p_array) { + pandemonium_pool_vector2i_array dest; + const Transform2D *self = (const Transform2D *)p_self; + const PoolVector2iArray *array = (const PoolVector2iArray *)p_array; + memnew_placement(&dest, PoolVector(self->xform(*array))); + return dest; +} +pandemonium_pool_vector2_array GDAPI pandemonium_transform_xform_inv_pool_vector2(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2_array *p_array) { + pandemonium_pool_vector2_array dest; + const Transform2D *self = (const Transform2D *)p_self; + const PoolVector2Array *array = (const PoolVector2Array *)p_array; + memnew_placement(&dest, PoolVector(self->xform_inv(*array))); + return dest; +} +pandemonium_pool_vector2i_array GDAPI pandemonium_transform_xform_inv_pool_vector2i(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2i_array *p_array) { + pandemonium_pool_vector2i_array dest; + const Transform2D *self = (const Transform2D *)p_self; + const PoolVector2iArray *array = (const PoolVector2iArray *)p_array; + memnew_placement(&dest, PoolVector(self->xform_inv(*array))); + return dest; +} + pandemonium_string GDAPI pandemonium_transform2d_as_string(const pandemonium_transform2d *p_self) { pandemonium_string ret; const Transform2D *self = (const Transform2D *)p_self; diff --git a/include/gdn/transform.h b/include/gdn/transform.h index 8fee291..e98f146 100644 --- a/include/gdn/transform.h +++ b/include/gdn/transform.h @@ -53,10 +53,10 @@ typedef struct { #include #include +#include #include #include #include -#include #ifdef __cplusplus extern "C" { @@ -107,14 +107,14 @@ pandemonium_bool GDAPI pandemonium_transform_operator_equal(const pandemonium_tr pandemonium_vector3 GDAPI pandemonium_transform_xform_vector3(const pandemonium_transform *p_self, const pandemonium_vector3 *p_v); pandemonium_vector3i GDAPI pandemonium_transform_xform_vector3i(const pandemonium_transform *p_self, const pandemonium_vector3i *p_vector); pandemonium_aabb GDAPI pandemonium_transform_xform_aabb(const pandemonium_transform *p_self, const pandemonium_aabb *p_v); -//_FORCE_INLINE_ PoolVector xform(const PoolVector &p_array) const; -//_FORCE_INLINE_ PoolVector xform(const PoolVector &p_array) const; +pandemonium_pool_vector3_array GDAPI pandemonium_transform_xform_pool_vector3(const pandemonium_transform *p_self, const pandemonium_pool_vector3_array *p_array); +pandemonium_pool_vector3i_array GDAPI pandemonium_transform_xform_pool_vector3i(const pandemonium_transform *p_self, const pandemonium_pool_vector3i_array *p_array); pandemonium_vector3 GDAPI pandemonium_transform_xform_inv_vector3(const pandemonium_transform *p_self, const pandemonium_vector3 *p_v); pandemonium_vector3i GDAPI pandemonium_transform_xform_inv_vector3i(const pandemonium_transform *p_self, const pandemonium_vector3i *p_vector); pandemonium_aabb GDAPI pandemonium_transform_xform_inv_aabb(const pandemonium_transform *p_self, const pandemonium_aabb *p_v); -//_FORCE_INLINE_ PoolVector xform_inv(const PoolVector &p_array) const; -//_FORCE_INLINE_ PoolVector xform_inv(const PoolVector &p_array) const; +pandemonium_pool_vector3_array GDAPI pandemonium_transform_xform_inv_pool_vector3(const pandemonium_transform *p_self, const pandemonium_pool_vector3_array *p_array); +pandemonium_pool_vector3i_array GDAPI pandemonium_transform_xform_inv_pool_vector3i(const pandemonium_transform *p_self, const pandemonium_pool_vector3i_array *p_array); pandemonium_plane GDAPI pandemonium_transform_xform_plane(const pandemonium_transform *p_self, const pandemonium_plane *p_v); pandemonium_plane GDAPI pandemonium_transform_xform_inv_plane(const pandemonium_transform *p_self, const pandemonium_plane *p_v); diff --git a/include/gdn/transform2d.h b/include/gdn/transform2d.h index 2f54727..d411381 100644 --- a/include/gdn/transform2d.h +++ b/include/gdn/transform2d.h @@ -135,10 +135,10 @@ pandemonium_vector2i GDAPI pandemonium_transform2d_basis_xform_inv(const pandemo pandemonium_vector2i GDAPI pandemonium_transform2d_xform_vector2i(const pandemonium_transform2d *p_self, const pandemonium_vector2i *p_vec); pandemonium_vector2i GDAPI pandemonium_transform2d_xform_inv_vector2i(const pandemonium_transform2d *p_self, const pandemonium_vector2i *p_vec); -//_FORCE_INLINE_ PoolVector xform(const PoolVector &p_array) const; -//_FORCE_INLINE_ PoolVector xform_inv(const PoolVector &p_array) const; -//_FORCE_INLINE_ PoolVector xform(const PoolVector &p_array) const; -//_FORCE_INLINE_ PoolVector xform_inv(const PoolVector &p_array) const; +pandemonium_pool_vector2_array GDAPI pandemonium_transform_xform_pool_vector2(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2_array *p_array); +pandemonium_pool_vector2_array GDAPI pandemonium_transform_xform_inv_pool_vector2(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2_array *p_array); +pandemonium_pool_vector2i_array GDAPI pandemonium_transform_xform_inv_pool_vector2i(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2i_array *p_array); +pandemonium_pool_vector2i_array GDAPI pandemonium_transform_xform_pool_vector2i(const pandemonium_transform2d *p_self, const pandemonium_pool_vector2i_array *p_array); pandemonium_string GDAPI pandemonium_transform2d_as_string(const pandemonium_transform2d *p_self);