Updated manual

This commit is contained in:
Christophe Riccio 2016-11-01 12:46:33 +01:00
parent 936069aa56
commit 3ca24a12a1

133
manual.md
View File

@ -104,108 +104,68 @@ reports](https://github.com/g-truc/glm/issues) for bugs and feature
requests. Any feedback is welcome at
[*glm@g-truc.net*](mailto:glm@g-truc.net).
1. Getting started {#getting-started .HeadingA}
==================
---
## 1. Getting started
### 1.1. Setup
1.1. Setup {#setup .HeadingB}
----------
GLM is a header only library. Hence, there is nothing to build to use
it. To use GLM, a programmer only has to include <glm/glm.hpp> in
his program. This include provides all the GLSL features implemented by
GLM is a header only library. Hence, there is nothing to build to use it. To use GLM, a programmer only has to include <glm/glm.hpp> in his program. This include provides all the GLSL features implemented by
GLM.
Core GLM features can be included using individual headers to allow
faster user program compilations.
Core GLM features can be included using individual headers to allow faster user program compilations.
<glm/vec2.hpp>: vec2, bvec2, dvec2, ivec2 and uvec2
* <glm/vec2.hpp>: vec2, bvec2, dvec2, ivec2 and uvec2
* <glm/vec3.hpp>: vec3, bvec3, dvec3, ivec3 and uvec3
* <glm/vec4.hpp>: vec4, bvec4, dvec4, ivec4 and uvec4
* <glm/mat2x2.hpp>: mat2, dmat2
* <glm/mat2x3.hpp>: mat2x3, dmat2x3
* <glm/mat2x4.hpp>: mat2x4, dmat2x4
* <glm/mat3x2.hpp>: mat3x2, dmat3x2
* <glm/mat3x3.hpp>: mat3, dmat3
* <glm/mat3x4.hpp>: mat3x4, dmat2
* <glm/mat4x2.hpp>: mat4x2, dmat4x2
* <glm/mat4x3.hpp>: mat4x3, dmat4x3
* <glm/mat4x4.hpp>: mat4, dmat4
* <glm/common.hpp>: all the GLSL common functions
* <glm/exponential.hpp>: all the GLSL exponential functions
* <glm/geometry.hpp>: all the GLSL geometry functions
* <glm/integer.hpp>: all the GLSL integer functions
* <glm/matrix.hpp>: all the GLSL matrix functions
* <glm/packing.hpp>: all the GLSL packing functions
* <glm/trigonometric.hpp>: all the GLSL trigonometric functions
* <glm/vector\_relational.hpp>: all the GLSL vector relational functions
<glm/vec3.hpp>: vec3, bvec3, dvec3, ivec3 and uvec3
<glm/vec4.hpp>: vec4, bvec4, dvec4, ivec4 and uvec4
<glm/mat2x2.hpp>: mat2, dmat2
<glm/mat2x3.hpp>: mat2x3, dmat2x3
<glm/mat2x4.hpp>: mat2x4, dmat2x4
<glm/mat3x2.hpp>: mat3x2, dmat3x2
<glm/mat3x3.hpp>: mat3, dmat3
<glm/mat3x4.hpp>: mat3x4, dmat2
<glm/mat4x2.hpp>: mat4x2, dmat4x2
<glm/mat4x3.hpp>: mat4x3, dmat4x3
<glm/mat4x4.hpp>: mat4, dmat4
<glm/common.hpp>: all the GLSL common functions
<glm/exponential.hpp>: all the GLSL exponential functions
<glm/geometry.hpp>: all the GLSL geometry functions
<glm/integer.hpp>: all the GLSL integer functions
<glm/matrix.hpp>: all the GLSL matrix functions
<glm/packing.hpp>: all the GLSL packing functions
<glm/trigonometric.hpp>: all the GLSL trigonometric functions
<glm/vector\_relational.hpp>: all the GLSL vector relational
functions
1.2. Faster program compilation {#faster-program-compilation .HeadingB}
-------------------------------
### 1.2. Faster program compilation
GLM is a header only library that makes a heavy usage of C++ templates.
This design may significantly increase the compile time for files that
use GLM. Hence, it is important to limit GLM inclusion to header and
source files that actually use it. Likewise, GLM extensions should be
included only in program sources using them.
This design may significantly increase the compile time for files that use GLM. Hence, it is important to limit GLM inclusion to header and source files that actually use it. Likewise, GLM extensions should be
included only in program sources using them.
To further help compilation time, GLM 0.9.5 introduced
<glm/fwd.hpp> that provides forward declarations of GLM types.
-------------------------------
// Header file
```cpp
// Header file
#include <glm/fwd.hpp>
\#include &lt;glm/fwd.hpp&gt;
// Source file
#include <glm/glm.hpp>;
```
// Source file
### 1.3. Use sample of GLM core
\#include &lt;glm/glm.hpp&gt;
-------------------------------
-------------------------------
```cpp
// Include GLM core features
\#include &lt;glm/vec3.hpp&gt;
\#include &lt;glm/vec4.hpp&gt;
\#include &lt;glm/mat4x4.hpp&gt;
\#include &lt;glm/trigonometric.hpp&gt;
1.3. Use sample of GLM core {#use-sample-of-glm-core .HeadingB}
---------------------------
---------------------------------------------------------------------------
// Include GLM core features
\#include &lt;glm/vec3.hpp&gt;
\#include &lt;glm/vec4.hpp&gt;
\#include &lt;glm/mat4x4.hpp&gt;
\#include &lt;glm/trigonometric.hpp&gt;
// Include GLM extensions
\#include &lt;glm/gtc/matrix\_transform.hpp&gt;
glm::mat4 transform(
// Include GLM extensions
\#include &lt;glm/gtc/matrix\_transform.hpp&gt;
glm::mat4 transform(
glm::vec2 const& Orientation,
glm::vec3 const& Translate,
glm::vec3 const& Up)
{
@ -223,10 +183,9 @@ To further help compilation time, GLM 0.9.5 introduced
return Proj \* View \* Model;
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
```
1.4. Dependencies {#dependencies .HeadingB}
### 1.4. Dependencies {#dependencies .HeadingB}
-----------------
When &lt;glm/glm.hpp&gt; is included, GLM provides all the GLSL features