mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 19:34:36 +00:00
Improved manual and API documentations
This commit is contained in:
parent
8177cf4aa3
commit
99eb6b3cc6
@ -6,9 +6,9 @@
|
||||
/// @defgroup core_func_common Common functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/common.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///
|
||||
/// Include <glm/common.hpp> to use these core features.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
/// @defgroup core_func_integer Integer functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/integer.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
/// The notation [a, b] means the set of bits from bit-number a through bit-number
|
||||
/// b, inclusive. The lowest-order bit is bit 0.
|
||||
///
|
||||
/// Include <glm/integer.hpp> to use these core features.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -6,13 +6,13 @@
|
||||
/// @defgroup core_func_matrix Matrix functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/matrix.hpp> to use these core features.
|
||||
///
|
||||
/// For each of the following built-in matrix functions, there is both a
|
||||
/// single-qualifier floating point version, where all arguments and return values
|
||||
/// are single qualifier, and a double-qualifier floating version, where all
|
||||
/// arguments and return values are double qualifier. Only the single-qualifier
|
||||
/// floating point version is shown.
|
||||
///
|
||||
/// Include <glm/matrix.hpp> to use these core features.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/packing.hpp> to use these core features.
|
||||
///
|
||||
/// These functions do not operate component-wise, rather as described in each case.
|
||||
///
|
||||
/// Include <glm/packing.hpp> to use these core features.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
52
manual.md
52
manual.md
@ -463,7 +463,7 @@ Additionally, GLM provides a low level SIMD API in glm/simd directory for users
|
||||
|
||||
C++ does not provide a way to implement GLSL default precision selection (as defined in GLSL 4.10 specification section 4.5.3) with GLSL-like syntax.
|
||||
|
||||
```cpp
|
||||
```glsl
|
||||
precision mediump int;
|
||||
precision highp float;
|
||||
```
|
||||
@ -508,7 +508,7 @@ Some platforms (Dreamcast) doesn't support double precision floating point value
|
||||
|
||||
Shader languages like GLSL often feature so-called swizzle expressions, which may be used to freely select and arrange a vector's components. For example, `variable.x`, `variable.xzy` and `variable.zxyy` respectively form a scalar, a 3D vector and a 4D vector. The result of a swizzle expression in GLSL can be either an R-value or an L-value. Swizzle expressions can be written with characters from exactly one of `xyzw` (usually for positions), `rgba` (usually for colors), and `stpq` (usually for texture coordinates).
|
||||
|
||||
```cpp
|
||||
```glsl
|
||||
vec4 A;
|
||||
vec2 B;
|
||||
|
||||
@ -700,6 +700,19 @@ Include `<glm/ext/scalar_int_sized.hpp>` to use these features.
|
||||
|
||||
This extension exposes sized and unsigned integer types.
|
||||
|
||||
```cpp
|
||||
#include <glm/ext/scalar_common.hpp>
|
||||
|
||||
glm::uint64 pack(glm::uint32 A, glm::uint16 B, glm::uint8 C, glm::uint8 D)
|
||||
{
|
||||
glm::uint64 ShiftA = 0;
|
||||
glm::uint64 ShiftB = sizeof(glm::uint32) * 8;
|
||||
glm::uint64 ShiftC = (sizeof(glm::uint32) + sizeof(glm::uint16)) * 8;
|
||||
glm::uint64 ShiftD = (sizeof(glm::uint32) + sizeof(glm::uint16) + sizeof(glm::uint8)) * 8;
|
||||
return (glm::uint64(A) << ShiftA) | (glm::uint64(B) << ShiftB) | (glm::uint64(C) << ShiftC) | (glm::uint64(D) << ShiftD);
|
||||
}
|
||||
```
|
||||
|
||||
Include `<glm/ext/scalar_uint_sized.hpp>` to use these features.
|
||||
|
||||
### <a name="section3_2"></a> 3.2. Scalar functions
|
||||
@ -850,17 +863,44 @@ Include `<glm/ext/matrix_relational.hpp>` to use these features.
|
||||
|
||||
#### 3.6.2. GLM_EXT_matrix_transform
|
||||
|
||||
TODO
|
||||
This extension exposes matrix transformation functions: `translate`, `rotate` and `scale`.
|
||||
|
||||
```cpp
|
||||
#include <glm/ext/vector_float2.hpp> // vec2
|
||||
#include <glm/ext/vector_float3.hpp> // vec3
|
||||
#include <glm/ext/matrix_float4x4.hpp> // mat4x4
|
||||
#include <glm/ext/matrix_transform.hpp> // translate, rotate, scale, identity
|
||||
|
||||
glm::mat4 computeModelViewMatrix(float Translate, glm::vec2 const & Rotate)
|
||||
{
|
||||
glm::mat4 View = glm::translate(glm::identity(), glm::vec3(0.0f, 0.0f, -Translate));
|
||||
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
|
||||
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
glm::mat4 Model = glm::scale(glm::identity(), glm::vec3(0.5f));
|
||||
return View * Model;
|
||||
}
|
||||
```
|
||||
|
||||
Include `<glm/ext/matrix_transform.hpp>` to use these features.
|
||||
|
||||
#### 3.6.3. GLM_EXT_matrix_clip_space
|
||||
#### 3.6.4. GLM_EXT_matrix_clip_space
|
||||
|
||||
TODO
|
||||
This extension exposes functions to transform scenes into the clip space.
|
||||
|
||||
```cpp
|
||||
#include <glm/ext/matrix_float4x4.hpp> // mat4x4
|
||||
#include <glm/ext/matrix_clip_space.hpp> // perspective
|
||||
#include <glm/trigonometric.hpp> // radians
|
||||
|
||||
glm::mat4 computeProjection(float Width, float Height)
|
||||
{
|
||||
return glm::perspective(glm::radians(45.0f), Width / Height, 0.1f, 100.f);
|
||||
}
|
||||
```
|
||||
|
||||
Include `<glm/ext/matrix_clip_space.hpp>` to use these features.
|
||||
|
||||
#### 3.6.4. GLM_EXT_matrix_projection
|
||||
#### 3.6.3. GLM_EXT_matrix_projection
|
||||
|
||||
TODO
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user