diff options
Diffstat (limited to 'Runtime/Math')
-rw-r--r-- | Runtime/Math/Matrix44.cpp | 4 | ||||
-rw-r--r-- | Runtime/Math/Matrix44.h | 16 | ||||
-rw-r--r-- | Runtime/Math/Rect.h | 9 | ||||
-rw-r--r-- | Runtime/Math/Vector3.cpp | 3 | ||||
-rw-r--r-- | Runtime/Math/Vector3.h | 11 | ||||
-rw-r--r-- | Runtime/Math/Vector4.cpp | 4 | ||||
-rw-r--r-- | Runtime/Math/Vector4.h | 32 |
7 files changed, 73 insertions, 6 deletions
diff --git a/Runtime/Math/Matrix44.cpp b/Runtime/Math/Matrix44.cpp index e69de29..5b72342 100644 --- a/Runtime/Math/Matrix44.cpp +++ b/Runtime/Math/Matrix44.cpp @@ -0,0 +1,4 @@ +#include "Matrix44.h"
+
+
+Internal::Matrix44 Internal::Matrix44::identity;
\ No newline at end of file diff --git a/Runtime/Math/Matrix44.h b/Runtime/Math/Matrix44.h index 1ec92fd..0fbf4a7 100644 --- a/Runtime/Math/Matrix44.h +++ b/Runtime/Math/Matrix44.h @@ -2,8 +2,20 @@ namespace Internal { - class Matrix44 + struct Matrix44 { + Matrix44() + { + m[0][0] = 1; + m[1][1] = 1; + m[2][2] = 1; + m[3][3] = 1; + } + + float m[4][4]; // ÐÐÖ÷Ïî + + static Matrix44 identity; }; -} + +}
\ No newline at end of file diff --git a/Runtime/Math/Rect.h b/Runtime/Math/Rect.h index 4725375..80170d6 100644 --- a/Runtime/Math/Rect.h +++ b/Runtime/Math/Rect.h @@ -1,6 +1,9 @@ #pragma once -struct Rect +namespace Internal { - int x, y, width, height; -};
\ No newline at end of file + struct Rect + { + int x, y, width, height; + }; +}
\ No newline at end of file diff --git a/Runtime/Math/Vector3.cpp b/Runtime/Math/Vector3.cpp index 8b13789..13bc9fd 100644 --- a/Runtime/Math/Vector3.cpp +++ b/Runtime/Math/Vector3.cpp @@ -1 +1,4 @@ +#include "Vector3.h" +Internal::Vector3 Internal::Vector3::one = Internal::Vector3(1, 1, 1); +Internal::Vector3 Internal::Vector3::zero = Internal::Vector3(0, 0, 0); diff --git a/Runtime/Math/Vector3.h b/Runtime/Math/Vector3.h index c0a35f3..e81e880 100644 --- a/Runtime/Math/Vector3.h +++ b/Runtime/Math/Vector3.h @@ -7,7 +7,12 @@ namespace Internal struct Vector3 { float x, y, z; - + Vector3(float x = 0, float y = 0, float z = 0) + { + this->x = x; + this->y = y; + this->z = z; + } inline void Set(float x, float y, float z) { this->x = x; @@ -15,6 +20,10 @@ namespace Internal this->z = z; } + + static Vector3 zero; + static Vector3 one; + }; diff --git a/Runtime/Math/Vector4.cpp b/Runtime/Math/Vector4.cpp new file mode 100644 index 0000000..1d392b7 --- /dev/null +++ b/Runtime/Math/Vector4.cpp @@ -0,0 +1,4 @@ +#include "Vector4.h" + +Internal::Vector4 Internal::Vector4::one = Internal::Vector4(1, 1, 1, 1); +Internal::Vector4 Internal::Vector4::zero = Internal::Vector4(0, 0, 0, 0); diff --git a/Runtime/Math/Vector4.h b/Runtime/Math/Vector4.h new file mode 100644 index 0000000..c0f99f2 --- /dev/null +++ b/Runtime/Math/Vector4.h @@ -0,0 +1,32 @@ +#pragma once + +namespace Internal +{ + + struct Vector4 + { + float x, y, z, w; + + Vector4(float x = 0, float y = 0, float z = 0, float w = 0) + { + this->x = x; + this->y = y; + this->z = z; + this->w = w; + } + + inline void Set(float x, float y, float z, float w) + { + this->x = x; + this->y = y; + this->z = z; + this->w = w; + } + + + static Vector4 zero; + static Vector4 one; + }; + + +} |