String and math fixes

- Added missing static String constructors
- Implemented String operator for math types
- Added XYZ and YXZ euler angles methods
- Fixed wrong det checks in Basis
- Fixed operator Quat in Basis
This commit is contained in:
Marc Gilleron
2018-01-23 00:24:23 +01:00
parent 411d2f6d1f
commit 4f4bb8deff
11 changed files with 270 additions and 67 deletions

View File

@@ -64,9 +64,13 @@ public:
Vector3 get_scale() const;
Vector3 get_euler() const;
Vector3 get_euler_xyz() const;
void set_euler_xyz(const Vector3 &p_euler);
Vector3 get_euler_yxz() const;
void set_euler_yxz(const Vector3 &p_euler);
void set_euler(const Vector3& p_euler);
inline Vector3 get_euler() const { return get_euler_yxz(); }
inline void set_euler(const Vector3& p_euler) { set_euler_yxz(p_euler); }
// transposed dot products
real_t tdotx(const Vector3& v) const;

View File

@@ -23,12 +23,16 @@ public:
Quat inverse() const;
void set_euler(const Vector3& p_euler);
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;
inline void set_euler(const Vector3& p_euler) { set_euler_yxz(p_euler); }
inline Vector3 get_euler() const { return get_euler_yxz(); }
real_t dot(const Quat& q) const;
Vector3 get_euler() const;
Quat slerp(const Quat& q, const real_t& t) const;
Quat slerpni(const Quat& q, const real_t& t) const;

View File

@@ -37,6 +37,14 @@ public:
~String();
static String num(double p_num, int p_decimals = -1);
static String num_scientific(double p_num);
static String num_real(double p_num);
static String num_int64(int64_t p_num, int base = 10, bool capitalize_hex = false);
static String chr(godot_char_type p_char);
static String md5(const uint8_t *p_md5);
static String hex_encode_buffer(const uint8_t *p_buffer, int p_len);
wchar_t &operator[](const int idx);
wchar_t operator[](const int idx) const;