GL4Dummies  0.1.7
Référence du fichier gl4dm.inl

Fonctions de gestion de matrix (inline). Plus de détails...

Ce graphe montre quels fichiers incluent directement ou indirectement ce fichier :

Aller au code source de ce fichier.

Fonctions

INLINE GL4DMMatrix gl4dmMatrixXMatrix (GL4DMMatrix mat1, GL4DMMatrix mat2)
 
INLINE GL4DMVector gl4dmMatrixXVector (GL4DMMatrix mat, GL4DMVector vec)
 
INLINE GL4DMVector gl4dmVectorXVector (GL4DMVector vec1, GL4DMVector vec2)
 
INLINE GL4DMMatrix gl4dmMatrixTranspose (GL4DMMatrix mat)
 
INLINE GL4DMVector gl4dmVector3Cross (GL4DMVector vec1, GL4DMVector vec2)
 
INLINE float gl4dmVector2Dot (GL4DMVector vec1, GL4DMVector vec2)
 
INLINE float gl4dmVector3Dot (GL4DMVector vec1, GL4DMVector vec2)
 
INLINE float gl4dmVector4Dot (GL4DMVector vec1, GL4DMVector vec2)
 
INLINE GL4DMVector gl4dmVector2Normalize (GL4DMVector vec)
 
INLINE GL4DMVector gl4dmVector3Normalize (GL4DMVector vec)
 
INLINE GL4DMVector gl4dmVector4Normalize (GL4DMVector vec)
 
INLINE GL4DMMatrix gl4dmMatrixIdentity (void)
 
INLINE GL4DMMatrix gl4dmMatrixTranslate (float x, float y, float z)
 
INLINE GL4DMMatrix gl4dmMatrixRotate (float angle, float x, float y, float z)
 
INLINE GL4DMMatrix gl4dmMatrixScale (float x, float y, float z)
 
INLINE GL4DMMatrix gl4dmMatrixLookAt (float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
 
INLINE GL4DMMatrix gl4dmMatrixPerspective (float fovy, float aspect, float znear, float zfar)
 
INLINE GL4DMMatrix gl4dmMatrixOrtho (float left, float right, float bottom, float top, float nearVal, float farVal)
 
INLINE GL4DMMatrix gl4dmMatrixInverse (GL4DMMatrix mat)
 
INLINE void gl4dmPrintVector (GL4DMVector vec)
 
INLINE void gl4dmPrintMatrix (GL4DMMatrix mat)
 

Description détaillée

Fonctions de gestion de matrix (inline).

Auteur
Kevin HAVRANEK mzart.nosp@m.ek@h.nosp@m.otmai.nosp@m.l.fr
Date
Mars 21, 2015

Définition dans le fichier gl4dm.inl.

Documentation des fonctions

◆ gl4dmMatrixIdentity()

INLINE GL4DMMatrix gl4dmMatrixIdentity ( void  )
141  {
142  GL4DMMatrix res;
143 
144  memset(&res, 0, sizeof res);
145 
146  res.r[0].x = 1.0f;
147  res.r[1].y = 1.0f;
148  res.r[2].z = 1.0f;
149  res.r[3].w = 1.0f;
150 
151  return res;
152 }

Références GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

Référencé par gl4dmMatrixTranslate().

◆ gl4dmMatrixInverse()

INLINE GL4DMMatrix gl4dmMatrixInverse ( GL4DMMatrix  mat)
262  {
263  GL4DMMatrix res;
264  float det;
265  int i;
266  //0
267  res.r[0].x =
268  mat.r[1].y * mat.r[2].z * mat.r[3].w -
269  mat.r[1].y * mat.r[3].z * mat.r[2].w -
270  mat.r[1].z * mat.r[2].y * mat.r[3].w +
271  mat.r[1].z * mat.r[3].y * mat.r[2].w +
272  mat.r[1].w * mat.r[2].y * mat.r[3].z -
273  mat.r[1].w * mat.r[3].y * mat.r[2].z;
274 
275  //1
276  res.r[0].y =
277  -mat.r[0].y * mat.r[2].z * mat.r[3].w +
278  mat.r[0].y * mat.r[3].z * mat.r[2].w +
279  mat.r[0].z * mat.r[2].y * mat.r[3].w -
280  mat.r[0].z * mat.r[3].y * mat.r[2].w -
281  mat.r[0].w * mat.r[2].y * mat.r[3].z +
282  mat.r[0].w * mat.r[3].y * mat.r[2].z;
283 
284  //2
285  res.r[0].z =
286  mat.r[0].y * mat.r[1].z * mat.r[3].w -
287  mat.r[0].y * mat.r[3].z * mat.r[1].w -
288  mat.r[0].z * mat.r[1].y * mat.r[3].w +
289  mat.r[0].z * mat.r[3].y * mat.r[1].w +
290  mat.r[0].w * mat.r[1].y * mat.r[3].z -
291  mat.r[0].w * mat.r[3].y * mat.r[1].z;
292 
293  //3
294  res.r[0].w =
295  -mat.r[0].y * mat.r[1].z * mat.r[2].w +
296  mat.r[0].y * mat.r[2].z * mat.r[1].w +
297  mat.r[0].z * mat.r[1].y * mat.r[2].w -
298  mat.r[0].z * mat.r[2].y * mat.r[1].w -
299  mat.r[0].w * mat.r[1].y * mat.r[2].z +
300  mat.r[0].w * mat.r[2].y * mat.r[1].z;
301 
302  //4
303  res.r[1].x =
304  -mat.r[1].x * mat.r[2].z * mat.r[3].w +
305  mat.r[1].x * mat.r[3].z * mat.r[2].w +
306  mat.r[1].z * mat.r[2].x * mat.r[3].w -
307  mat.r[1].z * mat.r[3].x * mat.r[2].w -
308  mat.r[1].w * mat.r[2].x * mat.r[3].z +
309  mat.r[1].w * mat.r[3].x * mat.r[2].z;
310 
311  //5
312  res.r[1].y =
313  mat.r[0].x * mat.r[2].z * mat.r[3].w -
314  mat.r[0].x * mat.r[3].z * mat.r[2].w -
315  mat.r[0].z * mat.r[2].x * mat.r[3].w +
316  mat.r[0].z * mat.r[3].x * mat.r[2].w +
317  mat.r[0].w * mat.r[2].x * mat.r[3].z -
318  mat.r[0].w * mat.r[3].x * mat.r[2].z;
319 
320  //6
321  res.r[1].z =
322  -mat.r[0].x * mat.r[1].z * mat.r[3].w +
323  mat.r[0].x * mat.r[3].z * mat.r[1].w +
324  mat.r[0].z * mat.r[1].x * mat.r[3].w -
325  mat.r[0].z * mat.r[3].x * mat.r[1].w -
326  mat.r[0].w * mat.r[1].x * mat.r[3].z +
327  mat.r[0].w * mat.r[3].x * mat.r[1].z;
328 
329  //7
330  res.r[1].w =
331  mat.r[0].x * mat.r[1].z * mat.r[2].w -
332  mat.r[0].x * mat.r[2].z * mat.r[1].w -
333  mat.r[0].z * mat.r[1].x * mat.r[2].w +
334  mat.r[0].z * mat.r[2].x * mat.r[1].w +
335  mat.r[0].w * mat.r[1].x * mat.r[2].z -
336  mat.r[0].w * mat.r[2].x * mat.r[1].z;
337 
338  //8
339  res.r[2].x =
340  mat.r[1].x * mat.r[2].y * mat.r[3].w -
341  mat.r[1].x * mat.r[3].y * mat.r[2].w -
342  mat.r[1].y * mat.r[2].x * mat.r[3].w +
343  mat.r[1].y * mat.r[3].x * mat.r[2].w +
344  mat.r[1].w * mat.r[2].x * mat.r[3].y -
345  mat.r[1].w * mat.r[3].x * mat.r[2].y;
346 
347  //9
348  res.r[2].y =
349  -mat.r[0].x * mat.r[2].y * mat.r[3].w +
350  mat.r[0].x * mat.r[3].y * mat.r[2].w +
351  mat.r[0].y * mat.r[2].x * mat.r[3].w -
352  mat.r[0].y * mat.r[3].x * mat.r[2].w -
353  mat.r[0].w * mat.r[2].x * mat.r[3].y +
354  mat.r[0].w * mat.r[3].x * mat.r[2].y;
355 
356  //10
357  res.r[2].z =
358  mat.r[0].x * mat.r[1].y * mat.r[3].w -
359  mat.r[0].x * mat.r[3].y * mat.r[1].w -
360  mat.r[0].y * mat.r[1].x * mat.r[3].w +
361  mat.r[0].y * mat.r[3].x * mat.r[1].w +
362  mat.r[0].w * mat.r[1].x * mat.r[3].y -
363  mat.r[0].w * mat.r[3].x * mat.r[1].y;
364 
365  //11
366  res.r[2].w =
367  -mat.r[0].x * mat.r[1].y * mat.r[2].w +
368  mat.r[0].x * mat.r[2].y * mat.r[1].w +
369  mat.r[0].y * mat.r[1].x * mat.r[2].w -
370  mat.r[0].y * mat.r[2].x * mat.r[1].w -
371  mat.r[0].w * mat.r[1].x * mat.r[2].y +
372  mat.r[0].w * mat.r[2].x * mat.r[1].y;
373 
374  //12
375  res.r[3].x =
376  -mat.r[1].x * mat.r[2].y * mat.r[3].z +
377  mat.r[1].x * mat.r[3].y * mat.r[2].z +
378  mat.r[1].y * mat.r[2].x * mat.r[3].z -
379  mat.r[1].y * mat.r[3].x * mat.r[2].z -
380  mat.r[1].z * mat.r[2].x * mat.r[3].y +
381  mat.r[1].z * mat.r[3].x * mat.r[2].y;
382 
383  //13
384  res.r[3].y =
385  mat.r[0].x * mat.r[2].y * mat.r[3].z -
386  mat.r[0].x * mat.r[3].y * mat.r[2].z -
387  mat.r[0].y * mat.r[2].x * mat.r[3].z +
388  mat.r[0].y * mat.r[3].x * mat.r[2].z +
389  mat.r[0].z * mat.r[2].x * mat.r[3].y -
390  mat.r[0].z * mat.r[3].x * mat.r[2].y;
391 
392  //14
393  res.r[3].z =
394  -mat.r[0].x * mat.r[1].y * mat.r[3].z +
395  mat.r[0].x * mat.r[3].y * mat.r[1].z +
396  mat.r[0].y * mat.r[1].x * mat.r[3].z -
397  mat.r[0].y * mat.r[3].x * mat.r[1].z -
398  mat.r[0].z * mat.r[1].x * mat.r[3].y +
399  mat.r[0].z * mat.r[3].x * mat.r[1].y;
400 
401  //15
402  res.r[3].w =
403  mat.r[0].x * mat.r[1].y * mat.r[2].z -
404  mat.r[0].x * mat.r[2].y * mat.r[1].z -
405  mat.r[0].y * mat.r[1].x * mat.r[2].z +
406  mat.r[0].y * mat.r[2].x * mat.r[1].z +
407  mat.r[0].z * mat.r[1].x * mat.r[2].y -
408  mat.r[0].z * mat.r[2].x * mat.r[1].y;
409 
410  det = mat.r[0].x * res.r[0].x + mat.r[1].x * res.r[0].y + mat.r[2].x * res.r[0].z + mat.r[3].x * res.r[0].w;
411 
412  if (det == 0) return mat;
413 
414  det = 1.0f / det;
415 
416  for (i = 0; i < 4; i++) {
417  res.r[i].x *= det;
418  res.r[i].y *= det;
419  res.r[i].z *= det;
420  res.r[i].w *= det;
421  }
422 
423  return res;
424 }

Références GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmMatrixLookAt()

INLINE GL4DMMatrix gl4dmMatrixLookAt ( float  eyeX,
float  eyeY,
float  eyeZ,
float  centerX,
float  centerY,
float  centerZ,
float  upX,
float  upY,
float  upZ 
)
201  {
202  GL4DMMatrix res;
203  GL4DMVector f = {centerX - eyeX, centerY - eyeY, centerZ - eyeZ, 1.0f};
204  GL4DMVector up = {upX, upY, upZ, 1.0f};
205  GL4DMVector s;
206  GL4DMVector u;
207 
208  memset(&res, 0, sizeof res);
209 
210  f = gl4dmVector3Normalize(f);
211  up = gl4dmVector3Normalize(up);
213  u = gl4dmVector3Cross(s, f);
214 
215  res.r[0].x = s.x;
216  res.r[0].y = s.y;
217  res.r[0].z = s.z;
218  res.r[1].x = u.x;
219  res.r[1].y = u.y;
220  res.r[1].z = u.z;
221  res.r[2].x = -f.x;
222  res.r[2].y = -f.y;
223  res.r[2].z = -f.z;
224  res.r[3].w = 1.0f;
225 
226  res = gl4dmMatrixXMatrix(res, gl4dmMatrixTranslate(-eyeX, -eyeY, -eyeZ));
227 
228  return res;
229 }

Références gl4dmMatrixTranslate(), gl4dmMatrixXMatrix(), gl4dmVector3Cross(), gl4dmVector3Normalize(), GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmMatrixOrtho()

INLINE GL4DMMatrix gl4dmMatrixOrtho ( float  left,
float  right,
float  bottom,
float  top,
float  nearVal,
float  farVal 
)
246  {
247  GL4DMMatrix res;
248 
249  memset(&res, 0, sizeof res);
250 
251  res.r[0].x = 2.0f / (right - left);
252  res.r[1].y = 2.0f / (top - bottom);
253  res.r[2].z = -2.0f / (farVal - nearVal);
254  res.r[3].w = 1.0f;
255  res.r[0].w = -((right + left) / (right - left));
256  res.r[1].w = -((top + bottom) / (top - bottom));
257  res.r[2].w = -((farVal + nearVal) / (farVal - nearVal));
258 
259  return res;
260 }

Références GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmMatrixPerspective()

INLINE GL4DMMatrix gl4dmMatrixPerspective ( float  fovy,
float  aspect,
float  znear,
float  zfar 
)
231  {
232  GL4DMMatrix res;
233  float f = COTANGENT(fovy / 2.0f);
234 
235  memset(&res, 0, sizeof res);
236 
237  res.r[0].x = f / aspect;
238  res.r[1].y = f;
239  res.r[2].z = (zfar + znear) / (znear - zfar);
240  res.r[2].w = (2.0f * zfar * znear) / (znear - zfar);
241  res.r[3].z = -1.0f;
242 
243  return res;
244 }

Références COTANGENT, GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmMatrixRotate()

INLINE GL4DMMatrix gl4dmMatrixRotate ( float  angle,
float  x,
float  y,
float  z 
)
164  {
165  GL4DMMatrix res;
166  float c = cosf(angle);
167  float s = sinf(angle);
168  GL4DMVector axe = {x, y, z, 1.0f};
169 
170  memset(&res, 0, sizeof res);
171 
172  axe = gl4dmVector3Normalize(axe);
173 
174  res.r[0].x = (SQUARE(axe.x) * (1.0f - c)) + c;
175  res.r[0].y = (axe.x * axe.y * (1.0f - c)) - (axe.z * s);
176  res.r[0].z = (axe.x * axe.z * (1.0f - c)) + (axe.y * s);
177  res.r[1].x = (axe.y * axe.x * (1.0f - c)) + (axe.z * s);
178  res.r[1].y = (SQUARE(axe.y) * (1.0f - c)) + c;
179  res.r[1].z = (axe.y * axe.z * (1.0f - c)) - (axe.x * s);
180  res.r[2].x = (axe.x * axe.z * (1.0f - c)) - (axe.y * s);
181  res.r[2].y = (axe.y * axe.z * (1.0f - c)) + (axe.x * s);
182  res.r[2].z = (SQUARE(axe.z) * (1.0f - c)) + c;
183  res.r[3].w = 1.0f;
184 
185  return res;
186 }

Références gl4dmVector3Normalize(), GL4DMMatrix::r, SQUARE, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmMatrixScale()

INLINE GL4DMMatrix gl4dmMatrixScale ( float  x,
float  y,
float  z 
)
188  {
189  GL4DMMatrix res;
190 
191  memset(&res, 0, sizeof res);
192 
193  res.r[0].x = x;
194  res.r[1].y = y;
195  res.r[2].z = z;
196  res.r[3].w = 1.0f;
197 
198  return res;
199 }

Références GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmMatrixTranslate()

INLINE GL4DMMatrix gl4dmMatrixTranslate ( float  x,
float  y,
float  z 
)
154  {
156 
157  res.r[0].w = x;
158  res.r[1].w = y;
159  res.r[2].w = z;
160 
161  return res;
162 }

Références gl4dmMatrixIdentity(), GL4DMMatrix::r, et GL4DMVector::w.

Référencé par gl4dmMatrixLookAt().

◆ gl4dmMatrixTranspose()

INLINE GL4DMMatrix gl4dmMatrixTranspose ( GL4DMMatrix  mat)
56  {
57  GL4DMMatrix res;
58 
59  res.r[0].x = mat.r[0].x;
60  res.r[0].y = mat.r[1].x;
61  res.r[0].z = mat.r[2].x;
62  res.r[0].w = mat.r[3].x;
63 
64  res.r[1].x = mat.r[0].y;
65  res.r[1].y = mat.r[1].y;
66  res.r[1].z = mat.r[2].y;
67  res.r[1].w = mat.r[3].y;
68 
69  res.r[2].x = mat.r[0].z;
70  res.r[2].y = mat.r[1].z;
71  res.r[2].z = mat.r[2].z;
72  res.r[2].w = mat.r[3].z;
73 
74  res.r[3].x = mat.r[0].w;
75  res.r[3].y = mat.r[1].w;
76  res.r[3].z = mat.r[2].w;
77  res.r[3].w = mat.r[3].w;
78 
79  return res;
80 }

Références GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmMatrixXMatrix()

INLINE GL4DMMatrix gl4dmMatrixXMatrix ( GL4DMMatrix  mat1,
GL4DMMatrix  mat2 
)
8  {
9  GL4DMMatrix res;
10 
11  res.r[0].x = mat1.r[0].x * mat2.r[0].x + mat1.r[0].y * mat2.r[1].x + mat1.r[0].z * mat2.r[2].x + mat1.r[0].w * mat2.r[3].x;
12  res.r[0].y = mat1.r[0].x * mat2.r[0].y + mat1.r[0].y * mat2.r[1].y + mat1.r[0].z * mat2.r[2].y + mat1.r[0].w * mat2.r[3].y;
13  res.r[0].z = mat1.r[0].x * mat2.r[0].z + mat1.r[0].y * mat2.r[1].z + mat1.r[0].z * mat2.r[2].z + mat1.r[0].w * mat2.r[3].z;
14  res.r[0].w = mat1.r[0].x * mat2.r[0].w + mat1.r[0].y * mat2.r[1].w + mat1.r[0].z * mat2.r[2].w + mat1.r[0].w * mat2.r[3].w;
15 
16  res.r[1].x = mat1.r[1].x * mat2.r[0].x + mat1.r[1].y * mat2.r[1].x + mat1.r[1].z * mat2.r[2].x + mat1.r[1].w * mat2.r[3].x;
17  res.r[1].y = mat1.r[1].x * mat2.r[0].y + mat1.r[1].y * mat2.r[1].y + mat1.r[1].z * mat2.r[2].y + mat1.r[1].w * mat2.r[3].y;
18  res.r[1].z = mat1.r[1].x * mat2.r[0].z + mat1.r[1].y * mat2.r[1].z + mat1.r[1].z * mat2.r[2].z + mat1.r[1].w * mat2.r[3].z;
19  res.r[1].w = mat1.r[1].x * mat2.r[0].w + mat1.r[1].y * mat2.r[1].w + mat1.r[1].z * mat2.r[2].w + mat1.r[1].w * mat2.r[3].w;
20 
21  res.r[2].x = mat1.r[2].x * mat2.r[0].x + mat1.r[2].y * mat2.r[1].x + mat1.r[2].z * mat2.r[2].x + mat1.r[2].w * mat2.r[3].x;
22  res.r[2].y = mat1.r[2].x * mat2.r[0].y + mat1.r[2].y * mat2.r[1].y + mat1.r[2].z * mat2.r[2].y + mat1.r[2].w * mat2.r[3].y;
23  res.r[2].z = mat1.r[2].x * mat2.r[0].z + mat1.r[2].y * mat2.r[1].z + mat1.r[2].z * mat2.r[2].z + mat1.r[2].w * mat2.r[3].z;
24  res.r[2].w = mat1.r[2].x * mat2.r[0].w + mat1.r[2].y * mat2.r[1].w + mat1.r[2].z * mat2.r[2].w + mat1.r[2].w * mat2.r[3].w;
25 
26  res.r[3].x = mat1.r[3].x * mat2.r[0].x + mat1.r[3].y * mat2.r[1].x + mat1.r[3].z * mat2.r[2].x + mat1.r[3].w * mat2.r[3].x;
27  res.r[3].y = mat1.r[3].x * mat2.r[0].y + mat1.r[3].y * mat2.r[1].y + mat1.r[3].z * mat2.r[2].y + mat1.r[3].w * mat2.r[3].y;
28  res.r[3].z = mat1.r[3].x * mat2.r[0].z + mat1.r[3].y * mat2.r[1].z + mat1.r[3].z * mat2.r[2].z + mat1.r[3].w * mat2.r[3].z;
29  res.r[3].w = mat1.r[3].x * mat2.r[0].w + mat1.r[3].y * mat2.r[1].w + mat1.r[3].z * mat2.r[2].w + mat1.r[3].w * mat2.r[3].w;
30 
31  return res;
32 }

Références GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

Référencé par gl4dmMatrixLookAt().

◆ gl4dmMatrixXVector()

INLINE GL4DMVector gl4dmMatrixXVector ( GL4DMMatrix  mat,
GL4DMVector  vec 
)
34  {
35  GL4DMVector res;
36 
37  res.x = mat.r[0].x * vec.x + mat.r[0].y * vec.y + mat.r[0].z * vec.z + mat.r[0].w * vec.w;
38  res.y = mat.r[1].x * vec.x + mat.r[1].y * vec.y + mat.r[1].z * vec.z + mat.r[1].w * vec.w;
39  res.z = mat.r[2].x * vec.x + mat.r[2].y * vec.y + mat.r[2].z * vec.z + mat.r[2].w * vec.w;
40  res.w = mat.r[3].x * vec.x + mat.r[3].y * vec.y + mat.r[3].z * vec.z + mat.r[3].w * vec.w;
41 
42  return res;
43 }

Références GL4DMMatrix::r, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmPrintMatrix()

INLINE void gl4dmPrintMatrix ( GL4DMMatrix  mat)
430  {
431  int i;
432  for (i = 0; i < 4; i++) gl4dmPrintVector(mat.r[i]);
433 }

Références gl4dmPrintVector(), et GL4DMMatrix::r.

◆ gl4dmPrintVector()

INLINE void gl4dmPrintVector ( GL4DMVector  vec)
426  {
427  printf("%f %f %f %f\n", vec.x, vec.y, vec.z, vec.w);
428 }

Références GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

Référencé par gl4dmPrintMatrix().

◆ gl4dmVector2Dot()

INLINE float gl4dmVector2Dot ( GL4DMVector  vec1,
GL4DMVector  vec2 
)
93  {
94  return vec1.x * vec2.x + vec1.y * vec2.y;
95 }

Références GL4DMVector::x, et GL4DMVector::y.

Référencé par gl4dmVector3Dot().

◆ gl4dmVector2Normalize()

INLINE GL4DMVector gl4dmVector2Normalize ( GL4DMVector  vec)
105  {
106  GL4DMVector res;
107  float length = sqrt(SQUARE(vec.x) + SQUARE(vec.y));
108 
109  res.x = vec.x / length;
110  res.y = vec.y / length;
111  res.z = 0.0f;
112  res.w = 0.0f;
113 
114  return res;
115 }

Références SQUARE, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmVector3Cross()

INLINE GL4DMVector gl4dmVector3Cross ( GL4DMVector  vec1,
GL4DMVector  vec2 
)
82  {
83  GL4DMVector res;
84 
85  res.x = vec1.y * vec2.z - vec1.z * vec2.y;
86  res.y = vec1.z * vec2.x - vec1.x * vec2.z;
87  res.z = vec1.x * vec2.y - vec1.y * vec2.x;
88  res.w = 1.0f;
89 
90  return res;
91 }

Références GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

Référencé par gl4dmMatrixLookAt().

◆ gl4dmVector3Dot()

INLINE float gl4dmVector3Dot ( GL4DMVector  vec1,
GL4DMVector  vec2 
)
97  {
98  return gl4dmVector2Dot(vec1, vec2) + vec1.z * vec2.z;
99 }

Références gl4dmVector2Dot(), et GL4DMVector::z.

Référencé par gl4dmVector4Dot().

◆ gl4dmVector3Normalize()

INLINE GL4DMVector gl4dmVector3Normalize ( GL4DMVector  vec)
117  {
118  GL4DMVector res;
119  float length = sqrt(SQUARE(vec.x) + SQUARE(vec.y) + SQUARE(vec.z));
120 
121  res.x = vec.x / length;
122  res.y = vec.y / length;
123  res.z = vec.z / length;
124  res.w = 0.0f;
125 
126  return res;
127 }

Références SQUARE, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

Référencé par gl4dmMatrixLookAt(), et gl4dmMatrixRotate().

◆ gl4dmVector4Dot()

INLINE float gl4dmVector4Dot ( GL4DMVector  vec1,
GL4DMVector  vec2 
)
101  {
102  return gl4dmVector3Dot(vec1, vec2) + vec1.w * vec2.w;
103 }

Références gl4dmVector3Dot(), et GL4DMVector::w.

◆ gl4dmVector4Normalize()

INLINE GL4DMVector gl4dmVector4Normalize ( GL4DMVector  vec)
129  {
130  GL4DMVector res;
131  float length = sqrt(SQUARE(vec.x) + SQUARE(vec.y) + SQUARE(vec.z) + SQUARE(vec.w));
132 
133  res.x = vec.x / length;
134  res.y = vec.y / length;
135  res.z = vec.z / length;
136  res.w = vec.w / length;
137 
138  return res;
139 }

Références SQUARE, GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

◆ gl4dmVectorXVector()

INLINE GL4DMVector gl4dmVectorXVector ( GL4DMVector  vec1,
GL4DMVector  vec2 
)
45  {
46  GL4DMVector res;
47 
48  res.x = vec1.x * vec2.x;
49  res.y = vec1.y * vec2.y;
50  res.z = vec1.z * vec2.z;
51  res.w = vec1.w * vec2.w;
52 
53  return res;
54 }

Références GL4DMVector::w, GL4DMVector::x, GL4DMVector::y, et GL4DMVector::z.

gl4dmVector3Cross
INLINE GL4DMVector gl4dmVector3Cross(GL4DMVector vec1, GL4DMVector vec2)
Definition: gl4dm.inl:82
GL4DMVector
Méthodes alternative utilisant des fonctions inline (compatible seulement a partir de la norme c99)
Definition: gl4dm.h:360
gl4dmMatrixXMatrix
INLINE GL4DMMatrix gl4dmMatrixXMatrix(GL4DMMatrix mat1, GL4DMMatrix mat2)
Definition: gl4dm.inl:8
COTANGENT
#define COTANGENT(X)
Definition: gl4dm.h:61
GL4DMMatrix
Definition: gl4dm.h:365
gl4dmVector2Dot
INLINE float gl4dmVector2Dot(GL4DMVector vec1, GL4DMVector vec2)
Definition: gl4dm.inl:93
gl4dmPrintVector
INLINE void gl4dmPrintVector(GL4DMVector vec)
Definition: gl4dm.inl:426
GL4DMVector::y
float y
Definition: gl4dm.h:362
GL4DMVector::z
float z
Definition: gl4dm.h:362
gl4dmVector3Dot
INLINE float gl4dmVector3Dot(GL4DMVector vec1, GL4DMVector vec2)
Definition: gl4dm.inl:97
GL4DMVector::w
float w
Definition: gl4dm.h:362
GL4DMMatrix::r
GL4DMVector r[4]
Definition: gl4dm.h:367
gl4dmMatrixTranslate
INLINE GL4DMMatrix gl4dmMatrixTranslate(float x, float y, float z)
Definition: gl4dm.inl:154
SQUARE
#define SQUARE(X)
Definition: gl4dm.h:60
gl4dmMatrixIdentity
INLINE GL4DMMatrix gl4dmMatrixIdentity(void)
Definition: gl4dm.inl:141
gl4dmVector3Normalize
INLINE GL4DMVector gl4dmVector3Normalize(GL4DMVector vec)
Definition: gl4dm.inl:117
GL4DMVector::x
float x
Definition: gl4dm.h:362