summaryrefslogtreecommitdiff
path: root/include/glu3.h
blob: 68bf7efefea59579f862a39a949ac9b1a9c27cb4 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
 * Copyright © 2009 Ian D. Romanick
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

#ifndef __glu3_h__
#define __glu3_h__

#include <GL/gl.h>

#define GLU_VERSION_3_0

struct GLUmat4;

struct GLUvec4 {
	GLfloat values[4];

#ifdef __cplusplus
	inline GLUvec4(void)
	{
	}

	inline GLUvec4(GLfloat x , GLfloat y, GLfloat z, GLfloat w)
	{
		values[0] = x;
		values[1] = y;
		values[2] = z;
		values[3] = w;
	}

	inline GLUvec4(const GLUvec4 &v)
	{
		values[0] = v.values[0];
		values[1] = v.values[1];
		values[2] = v.values[2];
		values[3] = v.values[3];
	}

	GLUvec4 operator *(const GLUmat4 &) const;
	GLUvec4 operator *(const GLUvec4 &) const;
	GLUvec4 operator *(GLfloat) const;

	GLUvec4 operator +(const GLUvec4 &) const;
	GLUvec4 operator -(const GLUvec4 &) const;
#endif /* __cplusplus */
};


struct GLUmat4 {
	struct GLUvec4 col[4];

#ifdef __cplusplus
	inline GLUmat4(void)
	{
	}

	inline GLUmat4(const GLUvec4 & c0, const GLUvec4 & c1,
		       const GLUvec4 & c2, const GLUvec4 & c3)
	{
		col[0] = c0;
		col[1] = c1;
		col[2] = c2;
		col[3] = c3;
	}

	inline GLUmat4(const GLUmat4 &m)
	{
		col[0] = m.col[0];
		col[1] = m.col[1];
		col[2] = m.col[2];
		col[3] = m.col[3];
	}


	GLUvec4 operator *(const GLUvec4 &) const;
	GLUmat4 operator *(const GLUmat4 &) const;
	GLUmat4 operator *(GLfloat) const;

	GLUmat4 operator +(const GLUmat4 &) const;
	GLUmat4 operator -(const GLUmat4 &) const;
#endif	/* __cplusplus */
};

#define GLU_MAX_STACK_DEPTH 32

struct GLUmat4Stack {
	struct GLUmat4 stack[GLU_MAX_STACK_DEPTH];
	unsigned top;

#ifdef __cplusplus
	GLUmat4Stack() : top(0)
	{
		/* empty */
	}
#endif	/* __cplusplus */
};

#ifndef __cplusplus
typedef struct GLUvec4 GLUvec4;
typedef struct GLUmat4 GLUmat4;
typedef struct GLUmat4Stack GLUmat4Stack;
#endif /*  __cplusplus */


#ifdef __cplusplus
extern "C" {
#endif

GLfloat gluDot4_4v(const GLUvec4 *, const GLUvec4 *);
GLfloat gluDot3_4v(const GLUvec4 *, const GLUvec4 *);
GLfloat gluDot2_4v(const GLUvec4 *, const GLUvec4 *);

GLUvec4 gluCross4v(const GLUvec4 *, const GLUvec4 *);
GLUvec4 gluNormalize4v(const GLUvec4 *);
GLfloat gluLength4v(const GLUvec4 *);
GLfloat gluLengthSqr4v(const GLUvec4 *);
GLUmat4 gluOuter4v(const GLUvec4 *, const GLUvec4 *);


GLUvec4 gluMult4v_4v(const GLUvec4 *, const GLUvec4 *);
GLUvec4 gluDiv4v_4v(const GLUvec4 *, const GLUvec4 *);
GLUvec4 gluAdd4v_4v(const GLUvec4 *, const GLUvec4 *);
GLUvec4 gluSub4v_4v(const GLUvec4 *, const GLUvec4 *);

GLUvec4 gluMult4v_f(const GLUvec4 *, GLfloat);
GLUvec4 gluDiv4v_f(const GLUvec4 *, GLfloat);
GLUvec4 gluAdd4v_f(const GLUvec4 *, GLfloat);
GLUvec4 gluSub4v_f(const GLUvec4 *, GLfloat);

GLUmat4 gluMult4m_4m(const GLUmat4 *, const GLUmat4 *);
GLUmat4 gluAdd4m_4m(const GLUmat4 *, const GLUmat4 *);
GLUmat4 gluSub4m_4m(const GLUmat4 *, const GLUmat4 *);
GLUvec4 gluMult4m_4v(const GLUmat4 *m, const GLUvec4 *v);

GLUmat4 gluMult4m_f(const GLUmat4 *, GLfloat);

GLUmat4 gluScale4v(const GLUvec4 *);
GLUmat4 gluTranslate3(GLfloat x, GLfloat y, GLfloat z);
GLUmat4 gluTranslate4v(const GLUvec4 *);
GLUmat4 gluRotate4v(const GLUvec4 *axis, GLfloat angle);
GLUmat4 gluLookAt4v(const GLUvec4 *eye, const GLUvec4 *center,
		    const GLUvec4 *up);
GLUmat4 gluPerspective4(GLfloat fovy, GLfloat aspect, GLfloat near,
			GLfloat far);
GLUmat4 gluTranspose4(const GLUmat4 *m);

extern const GLUmat4 gluIdentityMatrix;

#ifdef __cplusplus
};
#endif

#ifdef __cplusplus
GLfloat gluDot4(const GLUvec4 &, const GLUvec4 &);
GLfloat gluDot3(const GLUvec4 &, const GLUvec4 &);
GLfloat gluDot2(const GLUvec4 &, const GLUvec4 &);

GLUvec4 gluCross(const GLUvec4 &, const GLUvec4 &);
GLUvec4 gluNormalize(const GLUvec4 &);
GLfloat gluLength(const GLUvec4 &);
GLfloat gluLengthSqr(const GLUvec4 &);
#endif /* __cplusplus */

#include "glu3_scalar.h"

#endif /* __glu3_h__ */