Browse Source

Lesson 15.6

Godzil 3 years ago
parent
commit
c7afcb107b
1 changed files with 42 additions and 0 deletions
  1. 42 0
      source/include/matrix.h

+ 42 - 0
source/include/matrix.h

@@ -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 */