Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where is glm_camera_lookat defined? #294

Open
badasahog opened this issue Apr 25, 2023 · 2 comments
Open

where is glm_camera_lookat defined? #294

badasahog opened this issue Apr 25, 2023 · 2 comments
Labels

Comments

@badasahog
Copy link

I'm looking for the cglm equivalent of DirectX's XMMatrixLookAtLH, and found glm_camera_lookat in the test list, which seems promising, but it doesn't seem to be defined anywhere.

Even searching for it in the repo via github gets me nowhere. (https://github.com/recp/cglm/search?q=glm_camera_lookat)

Where is it defined?

@recp
Copy link
Owner

recp commented Apr 25, 2023

Hi @badasahog,

In test/tests.h file, TEST_DECLARE(glm_camera_lookat) declares test_glm_camera_lookat() and TEST_ENTRY(glm_camera_lookat) in same file add its to test list.

In test/src/test_cam.h file, TEST_IMPL(GLM_PREFIX, camera_lookat) { defines the test function body. TEST_IMPL Macro adds prefix of the name by GLM_PREFIX e.g. test_glm_camera_lookat, test_glmc_camera_lookat ...

This is how tests work in cglm, make check should run tests...

The actual camera functions are glm_lookat(), glm_look()... which are defined in include/cglm headers...

Hope it helps

@recp recp added the Q & A label Apr 25, 2023
@recp
Copy link
Owner

recp commented Apr 25, 2023

Also you can use both LH and RH by including (or define CGLM_CLIPSPACE_INCLUDE_ALL to include all) related headers at cglm/clipspace/view_lh.h, cglm/clipspace/view_rh.h, cglm/clipspace/view_lh_zo.h, cglm/clipspace/view_no.h... or just define CGLM_CONFIG_CLIP_CONTROL macro as CGLM_CLIP_CONTROL_LH_ZO, CGLM_CLIP_CONTROL_LH_NO... to switch between them without using lh/rh, no/zo suffixes...

Default is CGLM_CLIP_CONTROL_RH_NO:

#ifdef CGLM_FORCE_DEPTH_ZERO_TO_ONE
#  ifdef CGLM_FORCE_LEFT_HANDED
#    define CGLM_CONFIG_CLIP_CONTROL CGLM_CLIP_CONTROL_LH_ZO
#  else
#    define CGLM_CONFIG_CLIP_CONTROL CGLM_CLIP_CONTROL_RH_ZO
#  endif
#else
#  ifdef CGLM_FORCE_LEFT_HANDED
#    define CGLM_CONFIG_CLIP_CONTROL CGLM_CLIP_CONTROL_LH_NO
#  else
#    define CGLM_CONFIG_CLIP_CONTROL CGLM_CLIP_CONTROL_RH_NO
#  endif
#endif

the configuration macros must be defined before including cglm headers...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants