From 4e28ea8eff11b84a936975f89dadcb2947c1920a Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sun, 6 Dec 2015 16:23:34 -0500 Subject: [PATCH] Add in a section about the static constants --- doc/glm.tex | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/glm.tex b/doc/glm.tex index cece9f6a..1fd455cf 100644 --- a/doc/glm.tex +++ b/doc/glm.tex @@ -589,6 +589,23 @@ void foo() } \end{cppcode} +\subsection{Static Constants} + +Occasionally, you may need certain common vectors or matrices with unit-sized components, e.g. for working with coordinate systems. To enable them, define \verb|GLM_STATIC_CONST_MEMBERS|. + +\begin{cppcode} +#define GLM_STATIC_CONST_MEMBERS +#include + +void foo() +{ + glm::ivec4 a = glm::ivec4::X + glm::ivec4::Z; + assert(a == glm::ivec4::XZ); +} +\end{cppcode} + +For vectors and quaternions, constants for all possible combinations of the component's values being zero and one are defined. For example, \verb|vec3::XYZ == vec3(1.0f)|. For matrices, the identity and zero matrices are defined. + \newpage{} \section{Stable Extensions}