1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#ifndef __MATH33_H__
#define __MATH33_H__
#include "types33.h"
typedef f64 Vec2[2];
typedef f64 Vec3[3];
typedef f64 Vec4[4];
typedef f64 Mat4[16];
#define V4PRINT( x, y, v ) {\
QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf, %.2lf]", v[0], v[1], v[2], v[3] );\
}
#define V3PRINT( x, y, v ) {\
QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf]", v[0], v[1], v[2] );\
}
#define V2PRINT( x, y, v ) {\
QPRINTF( x, y, "[%.2lf, %.2lf]", v[0], v[1] );\
}
#define M2PRINT( x, y, m ) {\
QPRINTF( x, y, "[%.2lf, %.2lf]", m[0], m[1] );\
QPRINTF( x, y+defFont.h, "[%.2lf, %.2lf]", m[4], m[5] );\
}
#define M3PRINT( x, y, m ) {\
const Size Y = defFont.h;\
QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf]", m[0], m[1], m[2] );\
QPRINTF( x, y+Y, "[%.2lf, %.2lf, %.2lf]", m[4], m[5], m[6] );\
QPRINTF( x, y+Y+Y, "[%.2lf, %.2lf, %.2lf]", m[8], m[9], m[10] );\
}
#define M4PRINT( x, y, m ) {\
const Size Y = defFont.h;\
QPRINTF( x, y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[0], m[1], m[2], m[3] );\
QPRINTF( x, y+Y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[4], m[5], m[6], m[7] );\
QPRINTF( x, y+Y+Y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[8], m[9], m[10], m[11] );\
QPRINTF( x, y+Y+Y+Y, "[%.2lf, %.2lf, %.2lf, %.2lf]", m[12], m[13], m[14], m[15] );\
}
void M4I( Mat4 m );
void V4xMt( Vec4 dst, Vec4 v, Mat4 m );
void MxM4( Mat4 a, Mat4 b );
void VxP( Mat4 v, Mat4 p );
void math33_create_translation_matrix( f64 x, f64 y, f64 z, Mat4 m );
void math33_create_view_rotation_matrix( f64 x, f64 y, Mat4 m );
void math33_create_view_matrix( Vec3 t, Vec3 r, Mat4 m );
void math33_create_rotation_matrix( f64 x, f64 y, f64 z, Mat4 m );
void math33_create_scale_matrix( f64 x, f64 y, f64 z, Mat4 m );
void math33_create_world_matrix( Vec3 t, Vec3 r, Vec3 s, Mat4 m );
#endif /** MATH33_H **/
|