summaryrefslogtreecommitdiff
path: root/libs/cglm/include/cglm/clipspace/view_rh_zo.h
blob: 1ad5c91bd96dcac4c78e3ac24fc1b3556bd6a8bf (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
/*
 * Copyright (c), Recep Aslantas.
 *
 * MIT License (MIT), http://opensource.org/licenses/MIT
 * Full license can be found in the LICENSE file
 */

/*
 Functions:
   CGLM_INLINE void glm_lookat_rh_zo(vec3 eye, vec3 center, vec3 up, mat4 dest)
   CGLM_INLINE void glm_look_rh_zo(vec3 eye, vec3 dir, vec3 up, mat4 dest)
   CGLM_INLINE void glm_look_anyup_rh_zo(vec3 eye, vec3 dir, mat4 dest)
 */

#ifndef cglm_view_rh_zo_h
#define cglm_view_rh_zo_h

#include "../common.h"
#include "view_rh.h"

/*!
 * @brief set up view matrix with right handed coordinate system.
 *
 * NOTE: The UP vector must not be parallel to the line of sight from
 *       the eye point to the reference point
 *
 * @param[in]  eye    eye vector
 * @param[in]  center center vector
 * @param[in]  up     up vector
 * @param[out] dest   result matrix
 */
CGLM_INLINE
void
glm_lookat_rh_zo(vec3 eye, vec3 center, vec3 up, mat4 dest) {
  glm_lookat_rh(eye, center, up, dest);
}

/*!
 * @brief set up view matrix with right handed coordinate system.
 *
 * convenient wrapper for lookat: if you only have direction not target self
 * then this might be useful. Because you need to get target from direction.
 *
 * NOTE: The UP vector must not be parallel to the line of sight from
 *       the eye point to the reference point
 *
 * @param[in]  eye    eye vector
 * @param[in]  dir    direction vector
 * @param[in]  up     up vector
 * @param[out] dest   result matrix
 */
CGLM_INLINE
void
glm_look_rh_zo(vec3 eye, vec3 dir, vec3 up, mat4 dest) {
  glm_look_rh(eye, dir, up, dest);
}

/*!
 * @brief set up view matrix with right handed coordinate system.
 *
 * convenient wrapper for look: if you only have direction and if you don't
 * care what UP vector is then this might be useful to create view matrix
 *
 * @param[in]  eye    eye vector
 * @param[in]  dir    direction vector
 * @param[out] dest   result matrix
 */
CGLM_INLINE
void
glm_look_anyup_rh_zo(vec3 eye, vec3 dir, mat4 dest) {
  glm_look_anyup_rh(eye, dir, dest);
}

#endif /*cglm_view_rh_zo_h*/