+ [2.3. GLM\_FORCE\_XYZW\_ONLY: Only exposes x, y, z and w components](#section2_3)
@ -98,7 +98,7 @@
### The Happy Bunny License (Modified MIT License)
Copyright (c) 2005 - 2017 G-Truc Creation
Copyright (c) 2005 - G-Truc Creation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
@ -126,7 +126,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
### The MIT License
Copyright (c) 2005 - 2017 G-Truc Creation
Copyright (c) 2005 - G-Truc Creation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
@ -152,11 +152,36 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
## <aname="section1"></a> 1. Getting started
### <aname="section1_1"></a> 1.1. Setup
### <aname="section1_1"></a> 1.1. Using global headers
GLM is a header-only library, and thus does not need to be compiled. We can use GLM's implementation of GLSL's mathematics functionality by including the `<glm/glm.hpp>` header. The library can also be installed with CMake, though the details of doing so will differ depending on the target build system.
GLM is a header-only library, and thus does not need to be compiled. We can use GLM's implementation of GLSL's mathematics functionality by including the `<glm/glm.hpp>` header:
Features can also be included individually to shorten compilation times.
### <aname="section1_2"></a> 1.2. Using separated headers
GLM relies on C++ templates heavily, and may significantly increase compilation times for projects that use it. Hence, user projects could only include the features they actually use:
```cpp
#include<glm/vec2.hpp> // vec2, bvec2, dvec2, ivec2 and uvec2
@ -171,44 +196,48 @@ Features can also be included individually to shorten compilation times.
#include<glm/mat4x2.hpp> // mat4x2, dmat4x2
#include<glm/mat4x3.hpp> // mat4x3, dmat4x3
#include<glm/mat4x4.hpp> // mat4, dmat4
#include<glm/common.hpp> // all the GLSL common functions
#include<glm/exponential.hpp> // all the GLSL exponential functions
#include<glm/geometry.hpp> // all the GLSL geometry functions
#include<glm/integer.hpp> // all the GLSL integer functions
#include<glm/matrix.hpp> // all the GLSL matrix functions
#include<glm/packing.hpp> // all the GLSL packing functions
#include<glm/trigonometric.hpp> // all the GLSL trigonometric functions
#include<glm/vector_relational.hpp> // all the GLSL vector relational functions
#include<glm/common.hpp>// all the GLSL common functions: abs, min, mix, isnan, fma, etc.
#include<glm/exponential.hpp>// all the GLSL exponential functions: pow, log, exp2, sqrt, etc.
#include<glm/geometry.hpp>// all the GLSL geometry functions: dot, cross, reflect, etc.
#include<glm/integer.hpp>// all the GLSL integer functions: findMSB, bitfieldExtract, etc.
#include<glm/matrix.hpp>// all the GLSL matrix functions: transpose, inverse, etc.
#include<glm/packing.hpp>// all the GLSL packing functions: packUnorm4x8, unpackHalf2x16, etc.
#include<glm/trigonometric.hpp>// all the GLSL trigonometric functions: radians, cos, asin, etc.
#include<glm/vector_relational.hpp>// all the GLSL vector relational functions: equal, less, etc.
GLM uses C++ templates heavily, and may significantly increase compilation times for projects that use it. Hence, source files should only include the headers they actually use.
To reduce compilation time, we can include `<glm/fwd.hpp>`, which forward-declares all types should their definitions not be needed.
Using GLM through headers including features separated following the structure of GLSL specifications:
```cpp
// Header file (forward declarations only)
#include<glm/fwd.hpp>
// At this point, we don't care what exactly makes up a vec2; that won't matter