summaryrefslogtreecommitdiffstats
path: root/include/core
diff options
context:
space:
mode:
authorMarc <marc.gilleron@gmail.com>2021-01-31 20:02:06 +0000
committerGitHub <noreply@github.com>2021-01-31 20:02:06 +0000
commite76efdd3ab18092f65a2bea8ca92e604420fce2f (patch)
treef8e4f63e1f5e99552534e4a604ce9146b7593bf6 /include/core
parent18e1b262ff503543912a9fb39a2502e5bb9a865d (diff)
parent8e1cc29c66cc4dd28721a0367ef2f55464e9f026 (diff)
downloadredot-cpp-e76efdd3ab18092f65a2bea8ca92e604420fce2f.tar.gz
Merge pull request #481 from Zylann/vec_constants
Added missing constants to Vector2, Vector3, Basis and Quat
Diffstat (limited to 'include/core')
-rw-r--r--include/core/Basis.hpp5
-rw-r--r--include/core/Quat.hpp2
-rw-r--r--include/core/Transform.hpp5
-rw-r--r--include/core/Transform2D.hpp4
-rw-r--r--include/core/Vector2.hpp15
-rw-r--r--include/core/Vector3.hpp13
6 files changed, 44 insertions, 0 deletions
diff --git a/include/core/Basis.hpp b/include/core/Basis.hpp
index 76a345b..0fd697e 100644
--- a/include/core/Basis.hpp
+++ b/include/core/Basis.hpp
@@ -13,6 +13,11 @@ class Quat;
class Basis {
private:
+ static const Basis IDENTITY;
+ static const Basis FLIP_X;
+ static const Basis FLIP_Y;
+ static const Basis FLIP_Z;
+
// This helper template is for mimicking the behavior difference between the engine
// and script interfaces that logically script sees matrices as column major, while
// the engine stores them in row major to efficiently take advantage of SIMD
diff --git a/include/core/Quat.hpp b/include/core/Quat.hpp
index f047178..4add6be 100644
--- a/include/core/Quat.hpp
+++ b/include/core/Quat.hpp
@@ -11,6 +11,8 @@ namespace godot {
class Quat {
public:
+ static const Quat IDENTITY;
+
real_t x, y, z, w;
real_t length_squared() const;
diff --git a/include/core/Transform.hpp b/include/core/Transform.hpp
index 9da6366..836792c 100644
--- a/include/core/Transform.hpp
+++ b/include/core/Transform.hpp
@@ -10,6 +10,11 @@ namespace godot {
class Transform {
public:
+ static const Transform IDENTITY;
+ static const Transform FLIP_X;
+ static const Transform FLIP_Y;
+ static const Transform FLIP_Z;
+
Basis basis;
Vector3 origin;
diff --git a/include/core/Transform2D.hpp b/include/core/Transform2D.hpp
index ae01b7f..6a5010f 100644
--- a/include/core/Transform2D.hpp
+++ b/include/core/Transform2D.hpp
@@ -10,6 +10,10 @@ typedef Vector2 Size2;
struct Rect2;
struct Transform2D {
+ static const Transform2D IDENTITY;
+ static const Transform2D FLIP_X;
+ static const Transform2D FLIP_Y;
+
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of elements array, the basis matrix looks like "on paper":
// M = (elements[0][0] elements[1][0])
// (elements[0][1] elements[1][1])
diff --git a/include/core/Vector2.hpp b/include/core/Vector2.hpp
index 031d47f..3c2a403 100644
--- a/include/core/Vector2.hpp
+++ b/include/core/Vector2.hpp
@@ -12,6 +12,21 @@ namespace godot {
class String;
struct Vector2 {
+ enum Axis {
+ AXIS_X = 0,
+ AXIS_Y,
+ AXIS_COUNT
+ };
+
+ static const Vector2 ZERO;
+ static const Vector2 ONE;
+ static const Vector2 INF;
+
+ // Coordinate system of the 2D engine
+ static const Vector2 LEFT;
+ static const Vector2 RIGHT;
+ static const Vector2 UP;
+ static const Vector2 DOWN;
union {
real_t x;
diff --git a/include/core/Vector3.hpp b/include/core/Vector3.hpp
index 5971787..cbd4f75 100644
--- a/include/core/Vector3.hpp
+++ b/include/core/Vector3.hpp
@@ -19,8 +19,21 @@ struct Vector3 {
AXIS_X,
AXIS_Y,
AXIS_Z,
+ AXIS_COUNT
};
+ static const Vector3 ZERO;
+ static const Vector3 ONE;
+ static const Vector3 INF;
+
+ // Coordinate system of the 3D engine
+ static const Vector3 LEFT;
+ static const Vector3 RIGHT;
+ static const Vector3 UP;
+ static const Vector3 DOWN;
+ static const Vector3 FORWARD;
+ static const Vector3 BACK;
+
union {
struct {
real_t x;