mirror of
https://github.com/Relintai/gdnative.git
synced 2024-11-14 04:57:22 +01:00
IMplemented new apis for the Quaternion.
This commit is contained in:
parent
74f7f98da0
commit
eae96ca1d8
@ -107,12 +107,64 @@ pandemonium_quaternion GDAPI pandemonium_quaternion_inverse(const pandemonium_qu
|
||||
*((Quaternion *)&dest) = self->inverse();
|
||||
return dest;
|
||||
}
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_log(const pandemonium_quaternion *p_self) {
|
||||
pandemonium_quaternion dest;
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
*((Quaternion *)&dest) = self->log();
|
||||
return dest;
|
||||
}
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_exp(const pandemonium_quaternion *p_self) {
|
||||
pandemonium_quaternion dest;
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
*((Quaternion *)&dest) = self->exp();
|
||||
return dest;
|
||||
}
|
||||
|
||||
pandemonium_real GDAPI pandemonium_quaternion_dot(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_b) {
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
const Quaternion *b = (const Quaternion *)p_b;
|
||||
return self->dot(*b);
|
||||
}
|
||||
pandemonium_real GDAPI pandemonium_quaternion_angle_to(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_to) {
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
const Quaternion *to = (const Quaternion *)p_to;
|
||||
return self->angle_to(*to);
|
||||
}
|
||||
|
||||
void GDAPI pandemonium_quaternion_set_euler_xyz(pandemonium_quaternion *p_self, const pandemonium_vector3 *p_euler) {
|
||||
Quaternion *self = (Quaternion *)p_self;
|
||||
const Vector3 *euler = (const Vector3 *)p_euler;
|
||||
self->set_euler_xyz(*euler);
|
||||
}
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_euler_xyz(const pandemonium_quaternion *p_self) {
|
||||
pandemonium_vector3 dest;
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_euler_xyz();
|
||||
return dest;
|
||||
}
|
||||
void GDAPI pandemonium_quaternion_set_euler_yxz(pandemonium_quaternion *p_self, const pandemonium_vector3 *p_euler) {
|
||||
Quaternion *self = (Quaternion *)p_self;
|
||||
const Vector3 *euler = (const Vector3 *)p_euler;
|
||||
self->set_euler_yxz(*euler);
|
||||
}
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_euler_yxz(const pandemonium_quaternion *p_self) {
|
||||
pandemonium_vector3 dest;
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_euler_yxz();
|
||||
return dest;
|
||||
}
|
||||
|
||||
void GDAPI pandemonium_quaternion_set_euler(pandemonium_quaternion *p_self, const pandemonium_vector3 *p_euler) {
|
||||
Quaternion *self = (Quaternion *)p_self;
|
||||
const Vector3 *euler = (const Vector3 *)p_euler;
|
||||
self->set_euler(*euler);
|
||||
}
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_euler(const pandemonium_quaternion *p_self) {
|
||||
pandemonium_vector3 dest;
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_euler();
|
||||
return dest;
|
||||
}
|
||||
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_xform(const pandemonium_quaternion *p_self, const pandemonium_vector3 *p_v) {
|
||||
pandemonium_vector3 dest;
|
||||
@ -148,6 +200,27 @@ pandemonium_quaternion GDAPI pandemonium_quaternion_cubic_slerp(const pandemoniu
|
||||
return dest;
|
||||
}
|
||||
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_spherical_cubic_interpolate(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_b, const pandemonium_quaternion *p_pre_a, const pandemonium_quaternion *p_post_b, const pandemonium_real p_weight) {
|
||||
pandemonium_quaternion dest;
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
const Quaternion *b = (const Quaternion *)p_b;
|
||||
const Quaternion *pre_a = (const Quaternion *)p_pre_a;
|
||||
const Quaternion *post_b = (const Quaternion *)p_post_b;
|
||||
*((Quaternion *)&dest) = self->spherical_cubic_interpolate(*b, *pre_a, *post_b, p_weight);
|
||||
return dest;
|
||||
}
|
||||
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_axis(const pandemonium_quaternion *p_self) {
|
||||
pandemonium_vector3 dest;
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
*((Vector3 *)&dest) = self->get_axis();
|
||||
return dest;
|
||||
}
|
||||
pandemonium_real GDAPI pandemonium_quaternion_get_angle(const pandemonium_quaternion *p_self) {
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
return self->get_angle();
|
||||
}
|
||||
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_operator_multiply(const pandemonium_quaternion *p_self, const pandemonium_real p_b) {
|
||||
pandemonium_quaternion raw_dest;
|
||||
Quaternion *dest = (Quaternion *)&raw_dest;
|
||||
@ -201,6 +274,17 @@ void GDAPI pandemonium_quaternion_set_axis_angle(pandemonium_quaternion *p_self,
|
||||
const Vector3 *axis = (const Vector3 *)p_axis;
|
||||
self->set_axis_angle(*axis, p_angle);
|
||||
}
|
||||
void GDAPI pandemonium_quaternion_get_axis_angle(const pandemonium_quaternion *p_self, pandemonium_vector3 *r_axis, pandemonium_real r_angle) {
|
||||
const Quaternion *self = (const Quaternion *)p_self;
|
||||
Vector3 *axis = (Vector3 *)r_axis;
|
||||
self->get_axis_angle(*axis, r_angle);
|
||||
}
|
||||
|
||||
void GDAPI pandemonium_quaternion_operator_mul_eq(pandemonium_quaternion *p_self, const pandemonium_quaternion *p_q) {
|
||||
Quaternion *self = (Quaternion *)p_self;
|
||||
const Quaternion *q = (const Quaternion *)p_q;
|
||||
self->operator*=(*q);
|
||||
}
|
||||
|
||||
pandemonium_string GDAPI pandemonium_quaternion_as_string(const pandemonium_quaternion *p_self) {
|
||||
pandemonium_string ret;
|
||||
@ -209,6 +293,11 @@ pandemonium_string GDAPI pandemonium_quaternion_as_string(const pandemonium_quat
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GDAPI pandemonium_quaternion_set(pandemonium_quaternion *p_self, pandemonium_real p_x, pandemonium_real p_y, pandemonium_real p_z, pandemonium_real p_w) {
|
||||
Quaternion *self = (Quaternion *)p_self;
|
||||
self->set(p_x, p_y, p_z, p_w);
|
||||
}
|
||||
|
||||
void GDAPI pandemonium_quaternion_new(pandemonium_quaternion *r_dest, const pandemonium_real p_x, const pandemonium_real p_y, const pandemonium_real p_z, const pandemonium_real p_w) {
|
||||
Quaternion *dest = (Quaternion *)r_dest;
|
||||
*dest = Quaternion(p_x, p_y, p_z, p_w);
|
||||
@ -232,6 +321,13 @@ void GDAPI pandemonium_quaternion_new_with_euler(pandemonium_quaternion *r_dest,
|
||||
*dest = Quaternion(*euler);
|
||||
}
|
||||
|
||||
void GDAPI pandemonium_quaternion_new_shortest_arc(pandemonium_quaternion *r_dest, const pandemonium_vector3 *p_v0, const pandemonium_vector3 *p_v1) {
|
||||
const Vector3 *v0 = (const Vector3 *)p_v0;
|
||||
const Vector3 *v1 = (const Vector3 *)p_v1;
|
||||
Quaternion *dest = (Quaternion *)r_dest;
|
||||
*dest = Quaternion(*v0, *v1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -78,31 +78,31 @@ pandemonium_quaternion GDAPI pandemonium_quaternion_normalized(const pandemonium
|
||||
pandemonium_bool GDAPI pandemonium_quaternion_is_normalized(const pandemonium_quaternion *p_self);
|
||||
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_inverse(const pandemonium_quaternion *p_self);
|
||||
//Quaternion log() const;
|
||||
//Quaternion exp() const;
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_log(const pandemonium_quaternion *p_self);
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_exp(const pandemonium_quaternion *p_self);
|
||||
pandemonium_real GDAPI pandemonium_quaternion_dot(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_b);
|
||||
//real_t angle_to(const Quaternion &p_to) const;
|
||||
pandemonium_real GDAPI pandemonium_quaternion_angle_to(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_to);
|
||||
|
||||
//void set_euler_xyz(const Vector3 &p_euler);
|
||||
//Vector3 get_euler_xyz() const;
|
||||
//void set_euler_yxz(const Vector3 &p_euler);
|
||||
//Vector3 get_euler_yxz() const;
|
||||
void GDAPI pandemonium_quaternion_set_euler_xyz(pandemonium_quaternion *p_self, const pandemonium_vector3 *p_euler);
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_euler_xyz(const pandemonium_quaternion *p_self);
|
||||
void GDAPI pandemonium_quaternion_set_euler_yxz(pandemonium_quaternion *p_self, const pandemonium_vector3 *p_euler);
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_euler_yxz(const pandemonium_quaternion *p_self);
|
||||
|
||||
//void set_euler(const Vector3 &p_euler) { set_euler_yxz(p_euler); };
|
||||
//Vector3 get_euler() const { return get_euler_yxz(); };
|
||||
void GDAPI pandemonium_quaternion_set_euler(pandemonium_quaternion *p_self, const pandemonium_vector3 *p_euler);
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_euler(const pandemonium_quaternion *p_self);
|
||||
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_slerp(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_b, const pandemonium_real p_t);
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_slerpni(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_b, const pandemonium_real p_t);
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_cubic_slerp(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_b, const pandemonium_quaternion *p_pre_a, const pandemonium_quaternion *p_post_b, const pandemonium_real p_t);
|
||||
//Quaternion spherical_cubic_interpolate(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, const real_t &p_weight) const;
|
||||
pandemonium_quaternion GDAPI pandemonium_quaternion_spherical_cubic_interpolate(const pandemonium_quaternion *p_self, const pandemonium_quaternion *p_b, const pandemonium_quaternion *p_pre_a, const pandemonium_quaternion *p_post_b, const pandemonium_real p_weight);
|
||||
|
||||
//Vector3 get_axis() const;
|
||||
//float get_angle() const;
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_get_axis(const pandemonium_quaternion *p_self);
|
||||
pandemonium_real GDAPI pandemonium_quaternion_get_angle(const pandemonium_quaternion *p_self);
|
||||
|
||||
void GDAPI pandemonium_quaternion_set_axis_angle(pandemonium_quaternion *p_self, const pandemonium_vector3 *p_axis, const pandemonium_real p_angle);
|
||||
//_FORCE_INLINE_ void get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
|
||||
void GDAPI pandemonium_quaternion_get_axis_angle(const pandemonium_quaternion *p_self, pandemonium_vector3 *r_axis, pandemonium_real r_angle);
|
||||
|
||||
//void operator*=(const Quaternion &p_q);
|
||||
void GDAPI pandemonium_quaternion_operator_mul_eq(pandemonium_quaternion *p_self, const pandemonium_quaternion *p_q);
|
||||
|
||||
pandemonium_vector3 GDAPI pandemonium_quaternion_xform(const pandemonium_quaternion *p_self, const pandemonium_vector3 *p_v);
|
||||
|
||||
@ -118,13 +118,13 @@ pandemonium_bool GDAPI pandemonium_quaternion_operator_equal(const pandemonium_q
|
||||
|
||||
pandemonium_string GDAPI pandemonium_quaternion_as_string(const pandemonium_quaternion *p_self);
|
||||
|
||||
//inline void set(real_t p_x, real_t p_y, real_t p_z, real_t p_w) {
|
||||
void GDAPI pandemonium_quaternion_set(pandemonium_quaternion *p_self, pandemonium_real p_x, pandemonium_real p_y, pandemonium_real p_z, pandemonium_real p_w);
|
||||
|
||||
void GDAPI pandemonium_quaternion_new(pandemonium_quaternion *r_dest, const pandemonium_real p_x, const pandemonium_real p_y, const pandemonium_real p_z, const pandemonium_real p_w);
|
||||
void GDAPI pandemonium_quaternion_new_with_axis_angle(pandemonium_quaternion *r_dest, const pandemonium_vector3 *p_axis, const pandemonium_real p_angle);
|
||||
void GDAPI pandemonium_quaternion_new_with_basis(pandemonium_quaternion *r_dest, const pandemonium_basis *p_basis);
|
||||
void GDAPI pandemonium_quaternion_new_with_euler(pandemonium_quaternion *r_dest, const pandemonium_vector3 *p_euler);
|
||||
//Quaternion(const Vector3 &v0, const Vector3 &v1) // shortest arc
|
||||
void GDAPI pandemonium_quaternion_new_shortest_arc(pandemonium_quaternion *r_dest, const pandemonium_vector3 *p_v0, const pandemonium_vector3 *p_v1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user