|
@@ -0,0 +1,42 @@
|
|
|
+/*
|
|
|
+ * 3D Engine
|
|
|
+ * matrice.h:
|
|
|
+ * Based on pikuma.com 3D software renderer in C
|
|
|
+ * Copyright (c) 2021 986-Studio. All rights reserved.
|
|
|
+ *
|
|
|
+ * Created by Manoël Trapier on 06/03/2021.
|
|
|
+ */
|
|
|
+
|
|
|
+#ifndef THREEDENGINE_SOURCE_INCLUDE_MATRICE_H
|
|
|
+#define THREEDENGINE_SOURCE_INCLUDE_MATRICE_H
|
|
|
+
|
|
|
+#include <vector.h>
|
|
|
+
|
|
|
+/***********************************************************************************************************************
|
|
|
+ * Data types
|
|
|
+ **********************************************************************************************************************/
|
|
|
+typedef struct matrix4_t
|
|
|
+{
|
|
|
+ double v[4*4];
|
|
|
+} matrix4_t;
|
|
|
+
|
|
|
+/***********************************************************************************************************************
|
|
|
+ * Global variables
|
|
|
+ **********************************************************************************************************************/
|
|
|
+static const struct matrix4_t mat4Identity =
|
|
|
+{
|
|
|
+ 1, 0, 0, 0,
|
|
|
+ 0, 1, 0, 0,
|
|
|
+ 0, 0, 1, 0,
|
|
|
+ 0, 0, 0, 1
|
|
|
+};
|
|
|
+
|
|
|
+/***********************************************************************************************************************
|
|
|
+ * Prototypes
|
|
|
+ **********************************************************************************************************************/
|
|
|
+#define FastGet4(_m, _x, _y) ((_m).v[4 * (_x) + (_y)])
|
|
|
+matrix4_t mat4Scale(double scaleX, double scaleY, double scaleZ);
|
|
|
+
|
|
|
+vec4_t mat4ProdVec4(matrix4_t mat, vec4_t v);
|
|
|
+
|
|
|
+#endif /* THREEDENGINE_SOURCE_INCLUDE_MATRICE_H */
|