From ffd3dd5b685be092d28100523b598223bccc809b Mon Sep 17 00:00:00 2001 From: MindSpunk Date: Sat, 15 Dec 2018 14:36:49 +1100 Subject: [PATCH] More compile options docs --- nalgebra-glm/src/lib.rs | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/nalgebra-glm/src/lib.rs b/nalgebra-glm/src/lib.rs index 71ffc251..d0cf4330 100644 --- a/nalgebra-glm/src/lib.rs +++ b/nalgebra-glm/src/lib.rs @@ -91,6 +91,74 @@ This must be used with care! This is actually the recommended method to convert between homogeneous transformations generated by `nalgebra-glm` and specific transformation types from **nalgebra** like `Isometry3`. Just be careful you know your conversions make sense. + ### Compile Features/Options + There are a few compile features that alters the default behaviour of some functions. The current set of compile options includes: + * opengl_projection + * vulkan_projection + * directx_projection + * projection_y_flip + * left_hand_default + * right_hand_default + * zero_to_one_clip_default + * negone_to_one_clip_default + + The default is to compile with the `opengl_projection` feature enabled + + #### opengl_projection + This is a "macro" feature that exists as an alias to `right_hand_default` and + `negone_to_one_clip_default` + + #### vulkan_projection + This is a "macro" feature that exists as an alias to `right_hand_default`, + `zero_to_one_clip_default` and `projection_y_flip` + + #### directx_projection + This is a "macro" feature that exists as an alias to `left_hand_default` and + `zero_to_one_clip_default` + + #### projection_y_flip + Applies an implicit `mat[(1,1)] *= -1` to all projection matrices created through the + nalgebra-glm interface. This feature should be enabled when using Vulkan so the generated + matrices conform to Vulkan's NDC (normalized device coordinates). + + #### left_hand_default / right_hand_default + These two options are used to change the default handedness of the coordinate system the library + will use. Depending on which option is set it would cause a function like `ortho` to switch + between using `ortho_rh` and `ortho_lh`. + + DO NOT set both of these options at the same time. There is no guarantee that all functions will + follow the same convention if you were to do so + + #### zero_to_one_clip_default / negone_to_one_clip_default + These options are used to change the default depth range for projection matrices generated by + the nalgebra-glm interface. Depending on which option is set functions like `ortho` will + statically switch between calling `ortho_zo` and `ortho_no`. + + DO NOT set both of these options at the same time. There is no guarantee that all functions will + follow the same convention if you were to do so + + #### Functions Affected + + * [`perspective`](fn.perspective.html) + * [`perspective_no`](fn.perspective_no.html) + * [`perspective_zo`](fn.perspective_zo.html) + * [`perspective_rh`](fn.perspective_rh.html) + * [`perspective_lh`](fn.perspective_lh.html) + * [`perspective_fov`](fn.perspective_fov.html) + * [`perspective_fov_no`](fn.perspective_fov_no.html) + * [`perspective_fov_zo`](fn.perspective_fov_zo.html) + * [`perspective_fov_rh`](fn.perspective_fov_rh.html) + * [`perspective_fov_lh`](fn.perspective_fov_lh.html) + * [`ortho`](fn.ortho.html) + * [`ortho_no`](fn.ortho_no.html) + * [`ortho_zo`](fn.ortho_zo.html) + * [`ortho_rh`](fn.ortho_rh.html) + * [`ortho_lh`](fn.ortho_lh.html) + * [`project`](fn.project.html) + * [`unproject`](fn.unproject.html) + * [`look_at`](fn.look_at.html) + * [`quat_look_at`](fn.quat_look_at.html) + ### Should I use nalgebra or nalgebra-glm? Well that depends on your tastes and your background. **nalgebra** is more powerful overall since it allows stronger typing, and goes much further than simple computer graphics math. However, has a bit of a learning curve for