123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /*
- * 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 =
- {
- .v =
- {
- 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);
- matrix4_t mat4Translate(double tX, double tY, double tZ);
- matrix4_t mat4RotationX(double angle);
- matrix4_t mat4RotationY(double angle);
- matrix4_t mat4RotationZ(double angle);
- vec4_t mat4ProdVec4(matrix4_t mat, vec4_t v);
- #endif /* THREEDENGINE_SOURCE_INCLUDE_MATRICE_H */
|