summaryrefslogtreecommitdiffstats
path: root/src/VBox/GuestHost/OpenGL/include/cr_matrix.h
blob: 7bc2c9d9eb02f9c03759d597a1242fe866671307 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef CR_MATRIX_H
#define CR_MATRIX_H

#include "chromium.h"

#include <iprt/cdefs.h>

/*
 * Note: m[col][row] matches OpenGL's column-major memory layout
 */
typedef struct {
	float m00, m01, m02, m03;
	float m10, m11, m12, m13;
	float m20, m21, m22, m23;
	float m30, m31, m32, m33;
} CRmatrix;

typedef struct { GLfloat x,y,z,w; } GLvectorf;
typedef struct { GLdouble x,y,z,w; } GLvectord;

#ifdef __cplusplus
extern "C" {
#endif

extern DECLEXPORT(void)
crMatrixInit(CRmatrix *m);

extern DECLEXPORT(void)
crMatrixInitFromString(CRmatrix *m, const char *s);

extern DECLEXPORT(void)
crMatrixInitFromFloats(CRmatrix *m, const float *v);

extern DECLEXPORT(void)
crMatrixInitFromDoubles(CRmatrix *m, const double *v);

extern DECLEXPORT(void)
crMatrixPrint(const char *msg, const CRmatrix *m);

extern DECLEXPORT(void)
crMatrixGetFloats(float *values, const CRmatrix *m);

extern DECLEXPORT(int)
crMatrixIsEqual(const CRmatrix *m, const CRmatrix *n);

extern DECLEXPORT(int)
crMatrixIsIdentity(const CRmatrix *m);

extern DECLEXPORT(int)
crMatrixIsOrthographic(const CRmatrix *m);

extern DECLEXPORT(void)
crMatrixCopy(CRmatrix *dest, const CRmatrix *src);

extern DECLEXPORT(void)
crMatrixMultiply(CRmatrix *p, const CRmatrix *a, const CRmatrix *b);

extern DECLEXPORT(void)
crMatrixTransformPointf(const CRmatrix *m, GLvectorf *p);

extern DECLEXPORT(void)
crMatrixTransformPointd(const CRmatrix *m, GLvectord *p);

extern DECLEXPORT(void)
crMatrixInvertTranspose(CRmatrix *inv, const CRmatrix *mat);

extern DECLEXPORT(void)
crMatrixTranspose(CRmatrix *t, const CRmatrix *m);

extern DECLEXPORT(void)
crMatrixTranslate(CRmatrix *m, float x, float y, float z);

extern DECLEXPORT(void)
crMatrixRotate(CRmatrix *m, float angle, float x, float y, float z);

extern DECLEXPORT(void)
crMatrixScale(CRmatrix *m, float x, float y, float z);

extern DECLEXPORT(void)
crMatrixFrustum(CRmatrix *m,
								float left, float right,
								float bottom, float top, 
								float zNear, float zFar);

extern DECLEXPORT(void)
crMatrixOrtho(CRmatrix *m,
							float left, float right,
							float bottom, float top,
							float znear, float zfar);

#ifdef __cplusplus
}
#endif

#endif