File: zmath.h

package info (click to toggle)
residualvm 0.1.1%2Bdfsg-3
  • links: PTS, VCS
  • area: contrib
  • in suites: jessie, jessie-kfreebsd
  • size: 18,456 kB
  • ctags: 20,564
  • sloc: cpp: 122,088; sh: 6,057; perl: 977; xml: 974; asm: 729; python: 564; makefile: 147; sed: 11; php: 1
file content (57 lines) | stat: -rw-r--r-- 999 bytes parent folder | download
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
57
#ifndef GRAPHICS_TINYGL_ZMATH_H
#define GRAPHICS_TINYGL_ZMATH_H

namespace TinyGL {

// Matrix & Vertex

typedef struct {
	float m[4][4];
} M4;

typedef struct {
	float m[3][3];
} M3;

typedef struct {
	float m[3][4];
} M34;


#define X v[0]
#define Y v[1]
#define Z v[2]
#define W v[3]

typedef struct {
	float v[3];
} V3;

typedef struct {
	float v[4];
} V4;
	
void gl_M4_Id(M4 *a);
int gl_M4_IsId(M4 *a);
void gl_M4_Move(M4 *a, M4 *b);
void gl_MoveV3(V3 *a, V3 *b);
void gl_MulM4V3(V3 *a, M4 *b, V3 *c);
void gl_MulM3V3(V3 *a, M4 *b, V3 *c);

void gl_M4_MulV4(V4 *a, M4 *b, V4 * c);
void gl_M4_InvOrtho(M4 *a, M4 b);
void gl_M4_Inv(M4 *a, M4 *b);
void gl_M4_Mul(M4 *c, M4 *a, M4 *b);
void gl_M4_MulLeft(M4 *c, M4 *a);
void gl_M4_Transpose(M4 *a, M4 *b);
void gl_M4_Rotate(M4 *c, float t, int u);
int gl_V3_Norm(V3 *a);

V3 gl_V3_New(float x, float y, float z);
V4 gl_V4_New(float x, float y, float z, float w);

int gl_Matrix_Inv(float *r, float *m, int n);

} // end of namespace TinyGL

#endif