1
0

view_lh_no.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c), Recep Aslantas.
  3. *
  4. * MIT License (MIT), http://opensource.org/licenses/MIT
  5. * Full license can be found in the LICENSE file
  6. */
  7. /*
  8. Functions:
  9. CGLM_INLINE mat4s glms_lookat_lh_no(vec3s eye, vec3s center, vec3s up)
  10. CGLM_INLINE mat4s glms_look_lh_no(vec3s eye, vec3s dir, vec3s up)
  11. CGLM_INLINE mat4s glms_look_anyup_lh_no(vec3s eye, vec3s dir)
  12. */
  13. #ifndef cglms_view_lh_no_h
  14. #define cglms_view_lh_no_h
  15. #include "../../common.h"
  16. #include "../../types-struct.h"
  17. #include "../../plane.h"
  18. #include "../../cam.h"
  19. #include "../../clipspace/view_lh_no.h"
  20. /*!
  21. * @brief set up view matrix
  22. * with a left-hand coordinate system and a
  23. * clip-space of [-1, 1].
  24. *
  25. * NOTE: The UP vector must not be parallel to the line of sight from
  26. * the eye point to the reference point
  27. *
  28. * @param[in] eye eye vector
  29. * @param[in] center center vector
  30. * @param[in] up up vector
  31. * @returns result matrix
  32. */
  33. CGLM_INLINE
  34. mat4s
  35. glms_lookat_lh_no(vec3s eye, vec3s center, vec3s up) {
  36. mat4s dest;
  37. glm_lookat_lh_no(eye.raw, center.raw, up.raw, dest.raw);
  38. return dest;
  39. }
  40. /*!
  41. * @brief set up view matrix
  42. * with a left-hand coordinate system and a
  43. * clip-space of [-1, 1].
  44. *
  45. * convenient wrapper for lookat: if you only have direction not target self
  46. * then this might be useful. Because you need to get target from direction.
  47. *
  48. * NOTE: The UP vector must not be parallel to the line of sight from
  49. * the eye point to the reference point
  50. *
  51. * @param[in] eye eye vector
  52. * @param[in] dir direction vector
  53. * @param[in] up up vector
  54. * @returns result matrix
  55. */
  56. CGLM_INLINE
  57. mat4s
  58. glms_look_lh_no(vec3s eye, vec3s dir, vec3s up) {
  59. mat4s dest;
  60. glm_look_lh_no(eye.raw, dir.raw, up.raw, dest.raw);
  61. return dest;
  62. }
  63. /*!
  64. * @brief set up view matrix
  65. * with a left-hand coordinate system and a
  66. * clip-space of [-1, 1].
  67. *
  68. * convenient wrapper for look: if you only have direction and if you don't
  69. * care what UP vector is then this might be useful to create view matrix
  70. *
  71. * @param[in] eye eye vector
  72. * @param[in] dir direction vector
  73. * @returns result matrix
  74. */
  75. CGLM_INLINE
  76. mat4s
  77. glms_look_anyup_lh_no(vec3s eye, vec3s dir) {
  78. mat4s dest;
  79. glm_look_anyup_lh_no(eye.raw, dir.raw, dest.raw);
  80. return dest;
  81. }
  82. #endif /* cglms_view_lh_no_h */