aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/math')
-rw-r--r--src/libjin/math/je_bbox.h30
-rw-r--r--src/libjin/math/je_matrix.cpp4
-rw-r--r--src/libjin/math/je_matrix.h18
-rw-r--r--src/libjin/math/je_quad.h1
4 files changed, 43 insertions, 10 deletions
diff --git a/src/libjin/math/je_bbox.h b/src/libjin/math/je_bbox.h
new file mode 100644
index 0000000..ce88080
--- /dev/null
+++ b/src/libjin/math/je_bbox.h
@@ -0,0 +1,30 @@
+#ifndef __JE_BBOX_H__
+#define __JE_BBOX_H__
+
+namespace JinEngine
+{
+ namespace Math
+ {
+
+ ///
+ ///
+ ///
+ struct BBox
+ {
+ BBox()
+ : l(0), r(0), t(0), b(0)
+ {
+ }
+
+ BBox(float _l, float _r, float _t, float _b)
+ : l(+l), r(_r), t(_t), b(_b)
+ {
+ }
+
+ float l, r, t, b;
+ };
+
+ } // namespace Math
+} // namespace JinEngine
+
+#endif // __JE_BBOX_H__ \ No newline at end of file
diff --git a/src/libjin/math/je_matrix.cpp b/src/libjin/math/je_matrix.cpp
index f51ef5d..f422002 100644
--- a/src/libjin/math/je_matrix.cpp
+++ b/src/libjin/math/je_matrix.cpp
@@ -1,3 +1,5 @@
+#include "../graphics/je_vertex.h"
+
#include "je_matrix.h"
#include <cstring> // memcpy
@@ -177,7 +179,7 @@ namespace JinEngine
// | e2 e6 e10 e14 |
// | e3 e7 e11 e15 |
- void Matrix::transform(vertex * dst, const vertex * src, int size) const
+ void Matrix::transform(Graphics::Vertex* dst, const Graphics::Vertex* src, int size) const
{
for (int i = 0; i<size; ++i)
{
diff --git a/src/libjin/math/je_matrix.h b/src/libjin/math/je_matrix.h
index 65f080b..7955de1 100644
--- a/src/libjin/math/je_matrix.h
+++ b/src/libjin/math/je_matrix.h
@@ -3,21 +3,21 @@
namespace JinEngine
{
- namespace Math
+
+ // Forward declarations.
+ namespace Graphics
{
+ struct Vertex;
+ }
- struct vertex
- {
- unsigned char r, g, b, a;
- float x, y;
- float s, t;
- };
+ namespace Math
+ {
///
/// This class is the basis for all transformations in LOVE. Althought not
/// really needed for 2D, it contains 4x4 elements to be compatible with
/// OpenGL without conversions.
- /// Ҫתõľ
+ /// ҪתõOpenGL
/// https://blog.csdn.net/candycat1992/article/details/8830894
///
class Matrix
@@ -150,7 +150,7 @@ namespace JinEngine
/// @param src The source vertices.
/// @param size The number of vertices.
///
- void transform(vertex * dst, const vertex * src, int size) const;
+ void transform(Graphics::Vertex* dst, const Graphics::Vertex * src, int size) const;
};
diff --git a/src/libjin/math/je_quad.h b/src/libjin/math/je_quad.h
index e62f370..5bda125 100644
--- a/src/libjin/math/je_quad.h
+++ b/src/libjin/math/je_quad.h
@@ -22,6 +22,7 @@ namespace JinEngine
}
float x, y, w, h;
+
};
} // namespace Math