source: trunk/sys/TinyGL/src/zmath.h @ 230

Last change on this file since 230 was 1, checked in by alain, 8 years ago

First import

File size: 921 bytes
RevLine 
[1]1#ifndef __ZMATH__
2#define __ZMATH__
3
4/* Matrix & Vertex */
5
6typedef struct {
7        float m[4][4];
8} M4;
9
10typedef struct {
11        float m[3][3];
12} M3;
13
14typedef struct {
15         float m[3][4];
16} M34;
17
18
19#define X v[0]
20#define Y v[1]
21#define Z v[2]
22#define W v[3]
23
24typedef struct {
25         float v[3];
26} V3;
27
28typedef struct {
29         float v[4];
30} V4;
31       
32void gl_M4_Id(M4 *a);
33int gl_M4_IsId(M4 *a);
34void gl_M4_Move(M4 *a,M4 *b);
35void gl_MoveV3(V3 *a,V3 *b);
36void gl_MulM4V3(V3 *a,M4 *b,V3 *c);
37void gl_MulM3V3(V3 *a,M4 *b,V3 *c);
38
39void gl_M4_MulV4(V4 * a,M4 *b,V4 * c);
40void gl_M4_InvOrtho(M4 *a,M4 b);
41void gl_M4_Inv(M4 *a,M4 *b);
42void gl_M4_Mul(M4 *c,M4 *a,M4 *b);
43void gl_M4_MulLeft(M4 *c,M4 *a);
44void gl_M4_Transpose(M4 *a,M4 *b);
45void gl_M4_Rotate(M4 *c,float t,int u);
46int  gl_V3_Norm(V3 *a);
47
48V3 gl_V3_New(float x,float y,float z);
49V4 gl_V4_New(float x,float y,float z,float w);
50
51int gl_Matrix_Inv(float *r,float *m,int n);
52
53#endif /* __ZMATH__*/
Note: See TracBrowser for help on using the repository browser.