Skip to content

Latest commit

History

History
313 lines (221 loc) 路 10.2 KB

cam.rst

File metadata and controls

313 lines (221 loc) 路 10.2 KB

C

camera

Header: cglm/cam.h

There are many convenient functions for camera. For instance :cglm_look is just wrapper for :cglm_lookat. Sometimes you only have direction instead of target, so that makes easy to build view matrix using direction. There is also :cglm_look_anyup function which can help build view matrix without providing UP axis. It uses :cglm_vec3_ortho to get a UP axis and builds view matrix.

You can also _default versions of ortho and perspective to build projection fast if you don't care specific projection values.

_decomp means decompose; these function can help to decompose projection matrices.

Note

Be careful when working with high range (very small near, very large far) projection matrices. You may not get exact value you gave. float type cannot store very high precision so you will lose precision. Also your projection matrix will be inaccurate due to losing precision

Table of contents (click to go):

Functions:

  1. :cglm_frustum
  2. :cglm_ortho
  3. :cglm_ortho_aabb
  4. :cglm_ortho_aabb_p
  5. :cglm_ortho_aabb_pz
  6. :cglm_ortho_default
  7. :cglm_ortho_default_s
  8. :cglm_perspective
  9. :cglm_persp_move_far
  10. :cglm_perspective_default
  11. :cglm_perspective_resize
  12. :cglm_lookat
  13. :cglm_look
  14. :cglm_look_anyup
  15. :cglm_persp_decomp
  16. :cglm_persp_decompv
  17. :cglm_persp_decomp_x
  18. :cglm_persp_decomp_y
  19. :cglm_persp_decomp_z
  20. :cglm_persp_decomp_far
  21. :cglm_persp_decomp_near
  22. :cglm_persp_fovy
  23. :cglm_persp_aspect
  24. :cglm_persp_sizes

Functions documentation

Parameters:
[in] aspect aspect aspect ratio ( width / height )
[out] dest result matrix