1
///////////////////////////////////////////////////////////////////////////////////
2
/// OpenGL Mathematics (glm.g-truc.net)
4
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
5
/// Permission is hereby granted, free of charge, to any person obtaining a copy
6
/// of this software and associated documentation files (the "Software"), to deal
7
/// in the Software without restriction, including without limitation the rights
8
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
/// copies of the Software, and to permit persons to whom the Software is
10
/// furnished to do so, subject to the following conditions:
12
/// The above copyright notice and this permission notice shall be included in
13
/// all copies or substantial portions of the Software.
15
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
/// @file glm/gtc/type_ptr.hpp
25
/// @date 2009-05-06 / 2011-06-05
26
/// @author Christophe Riccio
28
/// @see core (dependence)
29
/// @see gtc_half_float (dependence)
30
/// @see gtc_quaternion (dependence)
32
/// @defgroup gtc_type_ptr GLM_GTC_type_ptr: Memory layout access
35
/// @brief Handles the interaction between pointers and vector, matrix types.
37
/// This extension defines an overloaded function, glm::value_ptr, which
38
/// takes any of the \ref core_template "core template types". It returns
39
/// a pointer to the memory layout of the object. Matrix types store their values
40
/// in column-major order.
42
/// This is useful for uploading data to matrices or copying data to buffer objects.
46
/// #include <glm/glm.hpp>
47
/// #include <glm/gtc/type_ptr.hpp>
49
/// glm::vec3 aVector(3);
50
/// glm::mat4 someMatrix(1.0);
52
/// glUniform3fv(uniformLoc, 1, glm::value_ptr(aVector));
53
/// glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, glm::value_ptr(someMatrix));
56
/// <glm/gtc/type_ptr.hpp> need to be included to use these functionalities.
57
///////////////////////////////////////////////////////////////////////////////////
59
#ifndef GLM_GTC_type_ptr
60
#define GLM_GTC_type_ptr GLM_VERSION
64
#include "../gtc/half_float.hpp"
65
#include "../gtc/quaternion.hpp"
68
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
69
# pragma message("GLM: GLM_GTC_type_ptr extension included")
74
/// @addtogroup gtc_type_ptr
77
/// Return the constant address to the data of the input parameter.
79
template<typename genType>
80
typename genType::value_type const * value_ptr(genType const & vec);
82
/// Build a vector from a pointer.
85
detail::tvec2<T> make_vec2(T const * const ptr);
87
/// Build a vector from a pointer.
90
detail::tvec3<T> make_vec3(T const * const ptr);
92
/// Build a vector from a pointer.
95
detail::tvec4<T> make_vec4(T const * const ptr);
97
/// Build a matrix from a pointer.
100
detail::tmat2x2<T> make_mat2x2(T const * const ptr);
102
/// Build a matrix from a pointer.
103
/// @see gtc_type_ptr
105
detail::tmat2x3<T> make_mat2x3(T const * const ptr);
107
/// Build a matrix from a pointer.
108
/// @see gtc_type_ptr
110
detail::tmat2x4<T> make_mat2x4(T const * const ptr);
112
/// Build a matrix from a pointer.
113
/// @see gtc_type_ptr
115
detail::tmat3x2<T> make_mat3x2(T const * const ptr);
117
/// Build a matrix from a pointer.
118
/// @see gtc_type_ptr
120
detail::tmat3x3<T> make_mat3x3(T const * const ptr);
122
/// Build a matrix from a pointer.
123
/// @see gtc_type_ptr
125
detail::tmat3x4<T> make_mat3x4(T const * const ptr);
127
/// Build a matrix from a pointer.
128
/// @see gtc_type_ptr
130
detail::tmat4x2<T> make_mat4x2(
131
T const * const ptr);
133
/// Build a matrix from a pointer.
134
/// @see gtc_type_ptr
136
detail::tmat4x3<T> make_mat4x3(T const * const ptr);
138
/// Build a matrix from a pointer.
139
/// @see gtc_type_ptr
141
detail::tmat4x4<T> make_mat4x4(T const * const ptr);
143
/// Build a matrix from a pointer.
144
/// @see gtc_type_ptr
146
detail::tmat2x2<T> make_mat2(T const * const ptr);
148
/// Build a matrix from a pointer.
149
/// @see gtc_type_ptr
151
detail::tmat3x3<T> make_mat3(T const * const ptr);
153
/// Build a matrix from a pointer.
154
/// @see gtc_type_ptr
156
detail::tmat4x4<T> make_mat4(T const * const ptr);
158
/// Build a quaternion from a pointer.
159
/// @see gtc_type_ptr
161
detail::tquat<T> make_quat(T const * const ptr);
166
#include "type_ptr.inl"
168
#endif//GLM_GTC_type_ptr