diff --git a/CMakeLists.txt b/CMakeLists.txt index 4115667c..e5f3c7be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,13 @@ if(CMAKE_COMPILER_IS_GNUCXX) #add_definitions(-mfpmath=387) #add_definitions(-ffast-math) #add_definitions(-O3) + + #add_definitions(-fprofile-arcs -ftest-coverage) gcov + #ctest_enable_coverage() endif() include_directories(".") +include_directories("./test/external") add_subdirectory(glm) add_subdirectory(test) diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 00000000..d3388358 --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,13 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## # The following are required to uses Dart and the Cdash dashboard +## ENABLE_TESTING() +## INCLUDE(CTest) +set(CTEST_PROJECT_NAME "GLM") +set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "my.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=GLM") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/doc/coreModules.doxy b/doc/coreModules.doxy deleted file mode 100644 index 1961ff71..00000000 --- a/doc/coreModules.doxy +++ /dev/null @@ -1,64 +0,0 @@ -/*! - \defgroup core GLM Core - - \brief The core of GLM, which implements exactly and only the GLSL specification to the degree possible. - - The GLM core consists of \ref core_types "C++ types that mirror GLSL types", - \ref core_funcs "C++ functions that mirror the GLSL functions". It also includes - \ref core_precision "a set of precision-based types" that can be used in the appropriate - functions. The C++ types are all based on a basic set of \ref core_template "template types". - - The best documentation for GLM Core is the current GLSL specification, - version 4.1 - (pdf file). - There are a few \ref pg_differences "differences" between GLM core and GLSL. -**/ - - -/*! - \defgroup core_types Types - - \brief The standard types defined by the specification. - - These types are all typedefs of more generalized, template types. To see the definiton - of these template types, go to \ref core_template. - - \ingroup core -**/ - -/*! - \defgroup core_precision Precision types - - \brief Non-GLSL types that are used to define precision-based types. - - The GLSL language allows the user to define the precision of a particular variable. - In OpenGL's GLSL, these precision qualifiers have no effect; they are there for compatibility - with OpenGL ES's precision qualifiers, where they \em do have an effect. - - C++ has no language equivalent to precision qualifiers. So GLM provides the next-best thing: - a number of typedefs of the \ref core_template that use a particular precision. - - None of these types make any guarantees about the actual precision used. - - \ingroup core -**/ - -/*! - \defgroup core_template Template types - - \brief The generic template types used as the basis for the core types. - - These types are all templates used to define the actual \ref core_types. - These templetes are implementation details of GLM types and should not be used explicitly. - - \ingroup core -**/ - -/*! - \defgroup core_funcs Functions - - \brief The functions defined by the specification. - - \ingroup core -**/ - diff --git a/doc/gtcModules.doxy b/doc/gtcModules.doxy deleted file mode 100644 index 3c4e49d2..00000000 --- a/doc/gtcModules.doxy +++ /dev/null @@ -1,108 +0,0 @@ -/*! - \defgroup gtc GTC Extensions (Stable) - - \brief Functions and types that the GLSL specification doesn't define, but useful to have for a C++ program. - - GTC extensions aim to be stable. - - Even if it's highly unrecommended, it's possible to include all the extensions at once by - including . Otherwise, each extension needs to be included a specific file. -**/ - -/*! - \defgroup gtc_half_float GLM_GTC_half_float: Half-precision floating-point based types and functions. - \ingroup gtc - - Defines the half-precision floating-point type, along with various typedefs for vectors and matrices. - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtc_matrix_access GLM_GTC_matrix_access: Access matrix rows and columns. - \ingroup gtc - - Defines functions to access rows or columns of a matrix easily. - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtc_matrix_integer GLM_GTC_matrix_integer: Integer matrix types. - \ingroup gtc - - Defines a number of matrices with integer types. - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse: Additional matrix inverse function - \ingroup gtc - - Defines additional matrix inverting functions. - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtc_matrix_transform GLM_GTC_matrix_transform: Matrix transform functions. - \ingroup gtc - - \brief Defines functions that generate common transformation matrices. - - The matrices generated by this extension use standard OpenGL fixed-function - conventions. For example, the lookAt function generates a transform from world - space into the specific eye space that the projective matrix functions ( - perspective, ortho, etc) are designed to expect. The OpenGL compatibility - specifications defines the particular layout of this eye space. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtc_quaternion GLM_GTC_quaternion: Quaternion types and functions - \ingroup gtc - - \brief Defines a templated quaternion type and several quaternion operations. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtc_type_precision GLM_GTC_type_precision: Vector and matrix types with defined precisions. - \ingroup gtc - - \brief Defines specific C++-based precision types. - - \ref core_precision defines types based on GLSL's precision qualifiers. This - extension defines types based on explicitly-sized C++ data types. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtc_type_ptr GLM_GTC_type_ptr: Memory layout access. - \ingroup gtc - - \brief Used to get a pointer to the memory layout of a basic type. - - This extension defines an overloaded function, glm::value_ptr, which - takes any of the \ref core_template "core template types". It returns - a pointer to the memory layout of the object. Matrix types store their values - in column-major order. - - This is useful for uploading data to matrices or copying data to buffer objects. - - Example: - - \code -#include -#include - -glm::vec3 aVector(3); -glm::mat4 someMatrix(1.0); - -glUniform3fv(uniformLoc, 1, glm::value_ptr(aVector)); -glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, glm::value_ptr(someMatrix)); - \endcode - - need to be included to use these functionalities. -**/ - diff --git a/doc/gtxModules.doxy b/doc/gtxModules.doxy deleted file mode 100644 index d585cf8b..00000000 --- a/doc/gtxModules.doxy +++ /dev/null @@ -1,498 +0,0 @@ -/*! - \defgroup gtx GTX Extensions (Experimental) - - \brief Functions and types that the GLSL specification doesn't define, but useful to have for a C++ program. - - Experimental extensions are useful functions and types, but the development of - their API and functionality is not necessarily stable. They can change substantially - between versions. Backwards compatibility is not much of an issue for them. - - Even if it's highly unrecommended, it's possible to include all the extensions at once by - including . Otherwise, each extension needs to be included a specific file. -**/ - -/*! - \defgroup gtx_associated_min_max GLM_GTX_associated_min_max: Associated Min/Max - \ingroup gtx - - \brief Min and max functions that return associated values not the compared onces. - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_bit GLM_GTX_bit: Extended bitwise operations - \ingroup gtx - - \brief Allow to perform bit operations on integer values - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_closest_point GLM_GTX_closest_point: Find closest point - \ingroup gtx - - \brief Find the point on a straight line which is the closet of a point. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_color_cast GLM_GTX_color_cast: Color conversion - \ingroup gtx - - \brief Conversion between two color types. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_color_space GLM_GTX_color_space: RGB to HSV conversion - \ingroup gtx - - \brief Related to RGB to HSV conversions and operations. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_color_space_YCoCg GLM_GTX_color_space_YCoCg: RGB to YCoCg conversion - \ingroup gtx - - \brief RGB to YCoCg conversions and operations - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_compatibility GLM_GTX_compatibility: Cg and HLSL compatibility - \ingroup gtx - - \brief Provide functions to increase the compatibility with Cg and HLSL languages - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_component_wise GLM_GTX_component_wise: Component wise - \ingroup gtx - - \brief Operations between components of a type - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_epsilon GLM_GTX_epsilon: Epsilon comparison - \ingroup gtx - - \brief Comparison functions for a user defined epsilon values. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_euler_angles GLM_GTX_euler_angles: Matrix from euler angles - \ingroup gtx - - \brief Build matrices from Euler angles. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_extend GLM_GTX_extend: Position extending - \ingroup gtx - - \brief Extend a position from a source to a position at a defined length. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_extented_min_max GLM_GTX_extented_min_max: Extended min max - \ingroup gtx - - \brief Min and max functions for 3 to 4 parameters. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_fast_exponential GLM_GTX_fast_exponential: Fast exponentiation functions - \ingroup gtx - - \brief Fast but less accurate implementations of exponential based functions. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_fast_square_root GLM_GTX_fast_square_root: Fast square root functions - \ingroup gtx - - \brief Fast but less accurate implementations of square root based functions. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_fast_trigonometry GLM_GTX_fast_trigonometry: Fast trigonometric functions - \ingroup gtx - - \brief Fast but less accurate implementations of trigonometric functions. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space: Space Handedness - \ingroup gtx - - \brief To know if a set of three basis vectors defines a right or left-handed coordinate system. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_inertia GLM_GTX_inertia: Intertial matrix - \ingroup gtx - - \brief Create inertia matrices - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_int_10_10_10_2 GLM_GTX_int_10_10_10_2: Packed integer - \ingroup gtx - - \brief Pack vector to 1010102 integers. Storage only. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_integer GLM_GTX_integer: Extended integer functions - \ingroup gtx - - \brief Add support for integer for core functions - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_intersect GLM_GTX_intersect: Intersection tests - \ingroup gtx - - \brief Add intersection functions - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_log_base GLM_GTX_log_base: Log with base - \ingroup gtx - - \brief Logarithm for any base. base can be a vector or a scalar. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product: Cross product matrix form - \ingroup gtx - - \brief Build cross product matrices - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_matrix_major_storage GLM_GTX_matrix_major_storage: Build matrix - \ingroup gtx - - \brief Build matrices with specific matrix order, row or column - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_matrix_operation GLM_GTX_matrix_operation: Extended matrix operations - \ingroup gtx - - \brief Build diagonal matrices from vectors. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_matrix_query GLM_GTX_matrix_query: Query matrix properties - \ingroup gtx - - \brief Query to evaluate matrix properties - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_mixed_product GLM_GTX_mixed_producte: Mixed product - \ingroup gtx - - \brief Mixed product of 3 vectors. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_multiple GLM_GTX_multiple: Multiples - \ingroup gtx - - \brief Find the closest number of a number multiple of other number. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_norm GLM_GTX_norm: Vector norm calculations - \ingroup gtx - - \brief Various way to compute vector norms. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_normal GLM_GTX_normal: Compute normals - \ingroup gtx - - \brief Compute the normal of a triangle. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_normalize_dot GLM_GTX_normalize_dot: Normalize dot product - \ingroup gtx - - \brief Dot product of vectors that need to be normalize with a single square root. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_number_precision GLM_GTX_number_precision: Number precision - \ingroup gtx - - \brief Defined size types. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_ocl_type GLM_GTX_ocl_type: OpenCL types - \ingroup gtx - - \brief OpenCL types. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_optimum_pow GLM_GTX_optimum_pow: Optimum pow - \ingroup gtx - - \brief Integer exponentiation of power functions. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_orthonormalize GLM_GTX_orthonormalize: Orthonormalize - \ingroup gtx - - \brief Orthonormalize matrices. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_perpendicular GLM_GTX_perpendicular: Perpendicular - \ingroup gtx - - \brief Perpendicular of a vector from other one - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates: Polar coordinates - \ingroup gtx - - \brief Conversion from Euclidean space to polar space and revert. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_projection GLM_GTX_projection: Projection - \ingroup gtx - - \brief Projection of a vector to other one - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_quaternion GLM_GTX_quaternion: Extented quaternion types and functions - \ingroup gtx - - \brief Extented quaternion types and functions - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_random GLM_GTX_random: Random - \ingroup gtx - - \brief Generate random number from various distribution methods - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_raw_data GLM_GTX_raw_data: Raw data - \ingroup gtx - - \brief Projection of a vector to other one - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_reciprocal GLM_GTX_reciprocal: Reciprocal - \ingroup gtx - - \brief Define secant, cosecant and cotangent functions. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_rotate_vector GLM_GTX_rotate_vector: Rotate vector - \ingroup gtx - - \brief Function to directly rotate a vector - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_simd_mat4 GLM_GTX_simd_mat4: SIMD mat4 type and functions - \ingroup gtx - - \brief SIMD implementation of mat4 type. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_simd_vec4 GLM_GTX_simd_vec4: SIMD vec4 type and functions - \ingroup gtx - - \brief SIMD implementation of vec4 type. - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_spline GLM_GTX_spline: Spline - \ingroup gtx - - \brief Spline functions - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_string_cast GLM_GTX_string_cast: String cast - \ingroup gtx - - \brief Setup strings for GLM type values - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_transform GLM_GTX_transform: Extented transformation matrices - \ingroup gtx - - \brief Add transformation matrices - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_transform2 GLM_GTX_transform2: Extra transformation matrices - \ingroup gtx - - \brief Add extra transformation matrices - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_unsigned_int GLM_GTX_unsigned_int: Unsigned int - \ingroup gtx - - \brief Add support for unsigned integer for core functions - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_vector_access GLM_GTX_vector_access: Vector access - \ingroup gtx - - \brief Function to set values to vectors - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_vector_angle GLM_GTX_vector_angle: Vector angle - \ingroup gtx - - \brief Compute angle between vectors - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_vector_query GLM_GTX_vector_query: Vector query - \ingroup gtx - - \brief Query informations of vector types - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_verbose_operator GLM_GTX_verbose_operator: Verbose operator - \ingroup gtx - - \brief Use words to replace operators - - need to be included to use these functionalities. -**/ - -/*! - \defgroup gtx_wrap GLM_GTX_wrap: Texture coordinate wrap modes - \ingroup gtx - - \brief Wrapping mode of texture coordinates. - - need to be included to use these functionalities. -**/ - diff --git a/doc/man.doxy b/doc/man.doxy index e9d6d3f1..546e0c5c 100644 --- a/doc/man.doxy +++ b/doc/man.doxy @@ -31,7 +31,7 @@ PROJECT_NAME = # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.9.2 +PROJECT_NUMBER = 0.9.3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/doc/pages.doxy b/doc/pages.doxy index 8fa428c7..1115d6ab 100644 --- a/doc/pages.doxy +++ b/doc/pages.doxy @@ -311,38 +311,38 @@ void foo()
glRotate[fd]
-
\link glm::gtc::matrix_transform::rotate glm::rotate \endlink
+
\ref rotate()
glScale[fd]
-
\link glm::gtc::matrix_transform::scale glm::scale \endlink
+
\ref scale()
glTranslate[fd]
-
\link glm::gtc::matrix_transform::translate glm::translate \endlink
+
\ref translate()
glLoadIdentity
The default constructor of all matrix types creates an identity matrix.
glMultMatrix[fd]
Per the GLSL specification, the multiplication operator is overloaded for all matrix types. Multiplying two matrices together will perform matrix multiplication.
glLoadTransposeMatrix[fd]
-
\link glm::core::function::matrix::transpose glm::transpose \endlink
+
\ref transpose()
glMultTransposeMatrix
Combine the last two.
glFrustum
-
\link glm::gtc::matrix_transform::frustum glm::frustum \endlink
+
\ref frustum()
glOrtho
-
\link glm::gtc::matrix_transform::ortho glm::ortho \endlink
+
\ref ortho()
gluLookAt
-
\link glm::gtc::matrix_transform::lookAt glm::lookAt \endlink
+
\ref lookAt()
\section deprecated_glu GLU function replacements
gluOrtho2D
-
\link glm::gtc::matrix_transform::ortho glm::ortho \endlink
+
\ref ortho()
gluPerspective
-
\link glm::gtc::matrix_transform::perspective glm::perspective \endlink
+
\ref perspective()
gluProject
-
\link glm::gtc::matrix_transform::project glm::project \endlink
+
\ref project()
gluUnProject
-
\link glm::gtc::matrix_transform::unProject glm::unProject \endlink
+
\ref unProject()
**/ @@ -407,7 +407,7 @@ void foo() \section faq7 Should I use 'using namespace glm;'? This is unwise. Chances are that if 'using namespace glm;' is called, name collisions will happen. - GLSL names for functions are fairly generic, so it is entirely likely that there is another function called, for example, \link glm::sqrt sqrt \endlink. + GLSL names for functions are fairly generic, so it is entirely likely that there is another function called, for example, \link glm::sqrt() sqrt \endlink. For frequent use of particular types, they can be brough into the global namespace with a 'using' declaration like this: diff --git a/doc/virtrevModules.doxy b/doc/virtrevModules.doxy deleted file mode 100644 index b617cb90..00000000 --- a/doc/virtrevModules.doxy +++ /dev/null @@ -1,14 +0,0 @@ -/*! - \defgroup virtrev VIRTREV Extensions - - \brief Extensions develop and maintain by Mathieu [matrem] Roumillac (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showprofile&User=22660). -**/ - -/*! - \defgroup virtrev_xstream GLM_VIRTREV_xstream: xml like output - \ingroup virtrev - - \brief Streaming vector and matrix in a xml way. - - Include for this functionality. -**/ diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp index 4d6a57ed..e6d2e128 100644 --- a/glm/core/_detail.hpp +++ b/glm/core/_detail.hpp @@ -1,17 +1,39 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-07-24 -// Updated : 2008-08-31 -// Licence : This source is under MIT License -// File : glm/core/_detail.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/_detail.hpp +/// @date 2008-07-24 / 2011-06-14 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_detail #define glm_core_detail #include "setup.hpp" #include +#if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) +#include +#endif namespace glm{ namespace detail @@ -305,25 +327,26 @@ namespace detail is_bool = is_bool::_YES }; }; - + ////////////////// // type - + typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef detail::sint64 int64; - + typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef detail::uint64 uint64; - + typedef detail::thalf float16; typedef float float32; typedef double float64; - + }//namespace detail + }//namespace glm #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005)) diff --git a/glm/core/_fixes.hpp b/glm/core/_fixes.hpp index ba708003..e1c2b14f 100644 --- a/glm/core/_fixes.hpp +++ b/glm/core/_fixes.hpp @@ -1,11 +1,30 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2011-02-21 -// Updated : 2011-02-21 -// Licence : This source is under MIT License -// File : glm/core/_fixes.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/_fixes.hpp +/// @date 2011-02-21 / 2011-02-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// //! Workaround for compatibility with other libraries #ifdef max diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index e5dcf492..aaf18caa 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -1,11 +1,30 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2006-04-20 -// Updated : 2008-08-22 -// Licence : This source is under MIT License -// File : glm/core/_swizzle.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/_swizzle.hpp +/// @date 2006-04-20 / 2011-02-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_swizzle #define glm_core_swizzle @@ -30,515 +49,515 @@ namespace glm }//namespace glm -namespace glm{ -namespace detail -{ - //! Internal class for implementing swizzle operators - /*! - Template parameters: - - Type = type of scalar values (e.g. float, double) - Class = class the swizzle is applies to (e.g. vector3f) - N = number of components in the vector (e.g. 3) - E0...3 = what index the n-th element of this swizzle refers to - */ - template - struct swizzle_base - { - swizzle_base& operator= (const Class& that) - { - static const int offset_dst[4] = { E0, E1, E2, E3 }; - - Type t[N]; - for (int i = 0; i < N; ++i) - t[i] = that[i]; - for (int i = 0; i < N; ++i) - elem(offset_dst[i]) = t[i]; - - return *this; - } - - swizzle_base& operator= (const Type& t) - { - static const int offset_dst[4] = { E0, E1, E2, E3 }; - - for (int i = 0; i < N; ++i) - elem(offset_dst[i]) = t; - - return *this; - } - - protected: - Type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } - - // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. - // Otherwise, a vec4 containg all swizzles might end up with 1000s of - // constructor calls - char _buffer[sizeof(Type) * N]; - }; - - template - struct swizzle_base - { - struct Stub {}; - swizzle_base& operator= (const Stub& that) {} - - protected: - Type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } - char _buffer[sizeof(Type) * N]; - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle2 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1)); } - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle2_3 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2)); } - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle2_4 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle3 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2)); } - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle3_2 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1)); } - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle3_4 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle4 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } - }; - - //! Internal class for implementing swizzle operators - template - struct swizzle4_2 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1)); } - }; - - - //! Internal class for implementing swizzle operators - template - struct swizzle4_3 : public swizzle_base - { - using swizzle_base::operator=; - operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2)); } - }; - -}//namespace detail -}//namespace glm - -#define _GLM_SWIZZLE2_2_MEMBERS(T,P,E0,E1) \ - struct { glm::detail::swizzle2 E0 ## E0; }; \ - struct { glm::detail::swizzle2 E0 ## E1; }; \ - struct { glm::detail::swizzle2 E1 ## E0; }; \ - struct { glm::detail::swizzle2 E1 ## E1; }; - -#define _GLM_SWIZZLE2_3_MEMBERS(T,P2,E0,E1) \ - struct { glm::detail::swizzle2_3 E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle2_3 E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle2_3 E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle2_3 E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle2_3 E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle2_3 E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle2_3 E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle2_3 E1 ## E1 ## E1; }; - - -#define _GLM_SWIZZLE3_3_MEMBERS(T,P,E0,E1,E2) \ - struct { glm::detail::swizzle3 E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3 E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3 E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3 E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3 E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3 E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3 E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3 E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3 E0 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle3 E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3 E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3 E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3 E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3 E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3 E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3 E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3 E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3 E1 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle3 E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3 E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3 E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3 E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3 E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3 E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3 E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3 E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3 E2 ## E2 ## E2; }; - -#define _GLM_SWIZZLE3_2_MEMBERS(T,P2,E0,E1,E2) \ - struct { glm::detail::swizzle3_2 E0 ## E0; }; \ - struct { glm::detail::swizzle3_2 E0 ## E1; }; \ - struct { glm::detail::swizzle3_2 E0 ## E2; }; \ - struct { glm::detail::swizzle3_2 E1 ## E0; }; \ - struct { glm::detail::swizzle3_2 E1 ## E1; }; \ - struct { glm::detail::swizzle3_2 E1 ## E2; }; \ - struct { glm::detail::swizzle3_2 E2 ## E0; }; \ - struct { glm::detail::swizzle3_2 E2 ## E1; }; \ - struct { glm::detail::swizzle3_2 E2 ## E2; }; - -#define _GLM_SWIZZLE3_4_MEMBERS(T,P2,E0,E1,E2) \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E0 ## E2 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E1 ## E2 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle3_4 E2 ## E2 ## E2 ## E2; }; \ - - -#define _GLM_SWIZZLE2_4_MEMBERS(T,P2,E0,E1) \ - struct { glm::detail::swizzle2_4 E0 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle2_4 E0 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle2_4 E0 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle2_4 E0 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle2_4 E0 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle2_4 E0 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle2_4 E0 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle2_4 E0 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle2_4 E1 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle2_4 E1 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle2_4 E1 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle2_4 E1 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle2_4 E1 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle2_4 E1 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle2_4 E1 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle2_4 E1 ## E1 ## E1 ## E1; }; - - -#define _GLM_SWIZZLE4_2_MEMBERS(T,P,E0,E1,E2,E3) \ - struct { glm::detail::swizzle4_2 E0 ## E0; }; \ - struct { glm::detail::swizzle4_2 E0 ## E1; }; \ - struct { glm::detail::swizzle4_2 E0 ## E2; }; \ - struct { glm::detail::swizzle4_2 E0 ## E3; }; \ - struct { glm::detail::swizzle4_2 E1 ## E0; }; \ - struct { glm::detail::swizzle4_2 E1 ## E1; }; \ - struct { glm::detail::swizzle4_2 E1 ## E2; }; \ - struct { glm::detail::swizzle4_2 E1 ## E3; }; \ - struct { glm::detail::swizzle4_2 E2 ## E0; }; \ - struct { glm::detail::swizzle4_2 E2 ## E1; }; \ - struct { glm::detail::swizzle4_2 E2 ## E2; }; \ - struct { glm::detail::swizzle4_2 E2 ## E3; }; \ - struct { glm::detail::swizzle4_2 E3 ## E0; }; \ - struct { glm::detail::swizzle4_2 E3 ## E1; }; \ - struct { glm::detail::swizzle4_2 E3 ## E2; }; \ - struct { glm::detail::swizzle4_2 E3 ## E3; }; - -#define _GLM_SWIZZLE4_3_MEMBERS(T,P,E0,E1,E2,E3) \ - struct { glm::detail::swizzle4_3 E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4_3 E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4_3 E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4_3 E0 ## E0 ## E3; }; \ - struct { glm::detail::swizzle4_3 E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4_3 E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4_3 E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4_3 E0 ## E1 ## E3; }; \ - struct { glm::detail::swizzle4_3 E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4_3 E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4_3 E0 ## E2 ## E2; }; \ - struct { glm::detail::swizzle4_3 E0 ## E2 ## E3; }; \ - struct { glm::detail::swizzle4_3 E0 ## E3 ## E0; }; \ - struct { glm::detail::swizzle4_3 E0 ## E3 ## E1; }; \ - struct { glm::detail::swizzle4_3 E0 ## E3 ## E2; }; \ - struct { glm::detail::swizzle4_3 E0 ## E3 ## E3; }; \ - \ - struct { glm::detail::swizzle4_3 E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4_3 E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4_3 E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4_3 E1 ## E0 ## E3; }; \ - struct { glm::detail::swizzle4_3 E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4_3 E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4_3 E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4_3 E1 ## E1 ## E3; }; \ - struct { glm::detail::swizzle4_3 E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4_3 E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4_3 E1 ## E2 ## E2; }; \ - struct { glm::detail::swizzle4_3 E1 ## E2 ## E3; }; \ - struct { glm::detail::swizzle4_3 E1 ## E3 ## E0; }; \ - struct { glm::detail::swizzle4_3 E1 ## E3 ## E1; }; \ - struct { glm::detail::swizzle4_3 E1 ## E3 ## E2; }; \ - struct { glm::detail::swizzle4_3 E1 ## E3 ## E3; }; \ - \ - struct { glm::detail::swizzle4_3 E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4_3 E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4_3 E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4_3 E2 ## E0 ## E3; }; \ - struct { glm::detail::swizzle4_3 E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4_3 E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4_3 E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4_3 E2 ## E1 ## E3; }; \ - struct { glm::detail::swizzle4_3 E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4_3 E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4_3 E2 ## E2 ## E2; }; \ - struct { glm::detail::swizzle4_3 E2 ## E2 ## E3; }; \ - struct { glm::detail::swizzle4_3 E2 ## E3 ## E0; }; \ - struct { glm::detail::swizzle4_3 E2 ## E3 ## E1; }; \ - struct { glm::detail::swizzle4_3 E2 ## E3 ## E2; }; \ - struct { glm::detail::swizzle4_3 E2 ## E3 ## E3; }; \ - \ - struct { glm::detail::swizzle4_3 E3 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4_3 E3 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4_3 E3 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4_3 E3 ## E0 ## E3; }; \ - struct { glm::detail::swizzle4_3 E3 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4_3 E3 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4_3 E3 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4_3 E3 ## E1 ## E3; }; \ - struct { glm::detail::swizzle4_3 E3 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4_3 E3 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4_3 E3 ## E2 ## E2; }; \ - struct { glm::detail::swizzle4_3 E3 ## E2 ## E3; }; \ - struct { glm::detail::swizzle4_3 E3 ## E3 ## E0; }; \ - struct { glm::detail::swizzle4_3 E3 ## E3 ## E1; }; \ - struct { glm::detail::swizzle4_3 E3 ## E3 ## E2; }; \ - struct { glm::detail::swizzle4_3 E3 ## E3 ## E3; }; - - -#define _GLM_SWIZZLE4_4_MEMBERS(T,P,E0,E1,E2,E3) \ - struct { glm::detail::swizzle4 E0 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E0 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E0 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E1 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E0 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E0 ## E2 ## E2 ## E2; }; \ - \ - \ - struct { glm::detail::swizzle4 E1 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E0 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E1 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E1 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E1 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E1 ## E2 ## E2 ## E2; }; \ - \ - \ - struct { glm::detail::swizzle4 E2 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E0 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E2 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E1 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E2 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E2 ## E2 ## E2 ## E2; }; \ - \ - \ - struct { glm::detail::swizzle4 E3 ## E0 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E0 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E3 ## E1 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E1 ## E2 ## E2; }; \ - \ - struct { glm::detail::swizzle4 E3 ## E2 ## E0 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E0 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E0 ## E2; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E1 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E1 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E1 ## E2; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E2 ## E0; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E2 ## E1; }; \ - struct { glm::detail::swizzle4 E3 ## E2 ## E2 ## E2; }; +namespace glm{ +namespace detail +{ + //! Internal class for implementing swizzle operators + /*! + Template parameters: + + Type = type of scalar values (e.g. float, double) + Class = class the swizzle is applies to (e.g. vector3f) + N = number of components in the vector (e.g. 3) + E0...3 = what index the n-th element of this swizzle refers to + */ + template + struct swizzle_base + { + swizzle_base& operator= (const Class& that) + { + static const int offset_dst[4] = { E0, E1, E2, E3 }; + + Type t[N]; + for (int i = 0; i < N; ++i) + t[i] = that[i]; + for (int i = 0; i < N; ++i) + elem(offset_dst[i]) = t[i]; + + return *this; + } + + swizzle_base& operator= (const Type& t) + { + static const int offset_dst[4] = { E0, E1, E2, E3 }; + + for (int i = 0; i < N; ++i) + elem(offset_dst[i]) = t; + + return *this; + } + + protected: + Type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } + + // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. + // Otherwise, a vec4 containg all swizzles might end up with 1000s of + // constructor calls + char _buffer[sizeof(Type) * N]; + }; + + template + struct swizzle_base + { + struct Stub {}; + swizzle_base& operator= (const Stub& that) {} + + protected: + Type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } + char _buffer[sizeof(Type) * N]; + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle2 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1)); } + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle2_3 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2)); } + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle2_4 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle3 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2)); } + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle3_2 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1)); } + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle3_4 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle4 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + }; + + //! Internal class for implementing swizzle operators + template + struct swizzle4_2 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1)); } + }; + + + //! Internal class for implementing swizzle operators + template + struct swizzle4_3 : public swizzle_base + { + using swizzle_base::operator=; + operator P () { return P(this->elem(E0), this->elem(E1), this->elem(E2)); } + }; + +}//namespace detail +}//namespace glm + +#define _GLM_SWIZZLE2_2_MEMBERS(T,P,E0,E1) \ + struct { glm::detail::swizzle2 E0 ## E0; }; \ + struct { glm::detail::swizzle2 E0 ## E1; }; \ + struct { glm::detail::swizzle2 E1 ## E0; }; \ + struct { glm::detail::swizzle2 E1 ## E1; }; + +#define _GLM_SWIZZLE2_3_MEMBERS(T,P2,E0,E1) \ + struct { glm::detail::swizzle2_3 E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle2_3 E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle2_3 E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle2_3 E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle2_3 E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle2_3 E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle2_3 E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle2_3 E1 ## E1 ## E1; }; + + +#define _GLM_SWIZZLE3_3_MEMBERS(T,P,E0,E1,E2) \ + struct { glm::detail::swizzle3 E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3 E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3 E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3 E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3 E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3 E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3 E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3 E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3 E0 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle3 E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3 E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3 E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3 E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3 E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3 E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3 E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3 E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3 E1 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle3 E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3 E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3 E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3 E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3 E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3 E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3 E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3 E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3 E2 ## E2 ## E2; }; + +#define _GLM_SWIZZLE3_2_MEMBERS(T,P2,E0,E1,E2) \ + struct { glm::detail::swizzle3_2 E0 ## E0; }; \ + struct { glm::detail::swizzle3_2 E0 ## E1; }; \ + struct { glm::detail::swizzle3_2 E0 ## E2; }; \ + struct { glm::detail::swizzle3_2 E1 ## E0; }; \ + struct { glm::detail::swizzle3_2 E1 ## E1; }; \ + struct { glm::detail::swizzle3_2 E1 ## E2; }; \ + struct { glm::detail::swizzle3_2 E2 ## E0; }; \ + struct { glm::detail::swizzle3_2 E2 ## E1; }; \ + struct { glm::detail::swizzle3_2 E2 ## E2; }; + +#define _GLM_SWIZZLE3_4_MEMBERS(T,P2,E0,E1,E2) \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E0 ## E2 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E1 ## E2 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle3_4 E2 ## E2 ## E2 ## E2; }; \ + + +#define _GLM_SWIZZLE2_4_MEMBERS(T,P2,E0,E1) \ + struct { glm::detail::swizzle2_4 E0 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle2_4 E0 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle2_4 E0 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle2_4 E0 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle2_4 E0 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle2_4 E0 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle2_4 E0 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle2_4 E0 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle2_4 E1 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle2_4 E1 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle2_4 E1 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle2_4 E1 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle2_4 E1 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle2_4 E1 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle2_4 E1 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle2_4 E1 ## E1 ## E1 ## E1; }; + + +#define _GLM_SWIZZLE4_2_MEMBERS(T,P,E0,E1,E2,E3) \ + struct { glm::detail::swizzle4_2 E0 ## E0; }; \ + struct { glm::detail::swizzle4_2 E0 ## E1; }; \ + struct { glm::detail::swizzle4_2 E0 ## E2; }; \ + struct { glm::detail::swizzle4_2 E0 ## E3; }; \ + struct { glm::detail::swizzle4_2 E1 ## E0; }; \ + struct { glm::detail::swizzle4_2 E1 ## E1; }; \ + struct { glm::detail::swizzle4_2 E1 ## E2; }; \ + struct { glm::detail::swizzle4_2 E1 ## E3; }; \ + struct { glm::detail::swizzle4_2 E2 ## E0; }; \ + struct { glm::detail::swizzle4_2 E2 ## E1; }; \ + struct { glm::detail::swizzle4_2 E2 ## E2; }; \ + struct { glm::detail::swizzle4_2 E2 ## E3; }; \ + struct { glm::detail::swizzle4_2 E3 ## E0; }; \ + struct { glm::detail::swizzle4_2 E3 ## E1; }; \ + struct { glm::detail::swizzle4_2 E3 ## E2; }; \ + struct { glm::detail::swizzle4_2 E3 ## E3; }; + +#define _GLM_SWIZZLE4_3_MEMBERS(T,P,E0,E1,E2,E3) \ + struct { glm::detail::swizzle4_3 E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4_3 E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4_3 E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4_3 E0 ## E0 ## E3; }; \ + struct { glm::detail::swizzle4_3 E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4_3 E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4_3 E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4_3 E0 ## E1 ## E3; }; \ + struct { glm::detail::swizzle4_3 E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4_3 E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4_3 E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle4_3 E0 ## E2 ## E3; }; \ + struct { glm::detail::swizzle4_3 E0 ## E3 ## E0; }; \ + struct { glm::detail::swizzle4_3 E0 ## E3 ## E1; }; \ + struct { glm::detail::swizzle4_3 E0 ## E3 ## E2; }; \ + struct { glm::detail::swizzle4_3 E0 ## E3 ## E3; }; \ + \ + struct { glm::detail::swizzle4_3 E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4_3 E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4_3 E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4_3 E1 ## E0 ## E3; }; \ + struct { glm::detail::swizzle4_3 E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4_3 E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4_3 E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4_3 E1 ## E1 ## E3; }; \ + struct { glm::detail::swizzle4_3 E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4_3 E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4_3 E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle4_3 E1 ## E2 ## E3; }; \ + struct { glm::detail::swizzle4_3 E1 ## E3 ## E0; }; \ + struct { glm::detail::swizzle4_3 E1 ## E3 ## E1; }; \ + struct { glm::detail::swizzle4_3 E1 ## E3 ## E2; }; \ + struct { glm::detail::swizzle4_3 E1 ## E3 ## E3; }; \ + \ + struct { glm::detail::swizzle4_3 E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4_3 E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4_3 E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4_3 E2 ## E0 ## E3; }; \ + struct { glm::detail::swizzle4_3 E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4_3 E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4_3 E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4_3 E2 ## E1 ## E3; }; \ + struct { glm::detail::swizzle4_3 E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4_3 E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4_3 E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle4_3 E2 ## E2 ## E3; }; \ + struct { glm::detail::swizzle4_3 E2 ## E3 ## E0; }; \ + struct { glm::detail::swizzle4_3 E2 ## E3 ## E1; }; \ + struct { glm::detail::swizzle4_3 E2 ## E3 ## E2; }; \ + struct { glm::detail::swizzle4_3 E2 ## E3 ## E3; }; \ + \ + struct { glm::detail::swizzle4_3 E3 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4_3 E3 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4_3 E3 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4_3 E3 ## E0 ## E3; }; \ + struct { glm::detail::swizzle4_3 E3 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4_3 E3 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4_3 E3 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4_3 E3 ## E1 ## E3; }; \ + struct { glm::detail::swizzle4_3 E3 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4_3 E3 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4_3 E3 ## E2 ## E2; }; \ + struct { glm::detail::swizzle4_3 E3 ## E2 ## E3; }; \ + struct { glm::detail::swizzle4_3 E3 ## E3 ## E0; }; \ + struct { glm::detail::swizzle4_3 E3 ## E3 ## E1; }; \ + struct { glm::detail::swizzle4_3 E3 ## E3 ## E2; }; \ + struct { glm::detail::swizzle4_3 E3 ## E3 ## E3; }; + + +#define _GLM_SWIZZLE4_4_MEMBERS(T,P,E0,E1,E2,E3) \ + struct { glm::detail::swizzle4 E0 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E0 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E0 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E1 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E0 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E0 ## E2 ## E2 ## E2; }; \ + \ + \ + struct { glm::detail::swizzle4 E1 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E0 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E1 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E1 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E1 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E1 ## E2 ## E2 ## E2; }; \ + \ + \ + struct { glm::detail::swizzle4 E2 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E0 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E2 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E1 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E2 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E2 ## E2 ## E2 ## E2; }; \ + \ + \ + struct { glm::detail::swizzle4 E3 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E0 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E3 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E1 ## E2 ## E2; }; \ + \ + struct { glm::detail::swizzle4 E3 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle4 E3 ## E2 ## E2 ## E2; }; diff --git a/glm/core/dummy.cpp b/glm/core/dummy.cpp index 3c603ff3..d6abc261 100644 --- a/glm/core/dummy.cpp +++ b/glm/core/dummy.cpp @@ -1,13 +1,33 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2011-01-19 -// Updated : 2011-01-19 -// Licence : This source is under MIT License -// File : glm/setup.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// -// GLM is a header only library. There is nothing to compile. -// dummy.cpp exist only a wordaround for CMake file. +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/dummy.cpp +/// @date 2011-01-19 / 2011-06-15 +/// @author Christophe Riccio +/// +/// GLM is a header only library. There is nothing to compile. +/// dummy.cpp exist only a wordaround for CMake file. +/////////////////////////////////////////////////////////////////////////////////// #include "../glm.hpp" #include "../ext.hpp" diff --git a/glm/core/func_common.hpp b/glm/core/func_common.hpp index 4203583f..9832319c 100644 --- a/glm/core/func_common.hpp +++ b/glm/core/func_common.hpp @@ -1,52 +1,74 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-03-08 -// Updated : 2010-01-26 -// Licence : This source is under MIT License -// File : glm/core/func_common.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_common.hpp +/// @date 2008-03-08 / 2010-01-26 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.10.6 specification, section 8.2 +/// +/// @defgroup core_func_common Common functions +/// @ingroup core +/// +/// These all operate component-wise. The description is per component. +/////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_common -#define glm_core_func_common +#ifndef GLM_CORE_func_common +#define GLM_CORE_func_common GLM_VERSION #include "_fixes.hpp" namespace glm { - namespace core{ - namespace function{ - namespace common{ //!< Define common functions from Section 8.3 of GLSL 1.30.8 specification. Included in glm namespace. - - /// \addtogroup core_funcs + /// @addtogroup core_func_common /// @{ - //! Returns x if x >= 0; otherwise, it returns -x. - //! - //! \li GLSL abs man page - //! \li GLSL 1.30.08 specification, section 8.3 - template + /// Returns x if x >= 0; otherwise, it returns -x. + /// + /// @see - GLSL abs man page + /// @see - GLSL 4.20.8 specification, section 8.3 + template genFIType abs(genFIType const & x); - //! Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. - //! - //! \li GLSL sign man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. + /// + /// @see - GLSL sign man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genFIType sign(genFIType const & x); //! Returns a value equal to the nearest integer that is less then or equal to x. //! - //! \li GLSL floor man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL floor man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType floor(genType const & x); //! Returns a value equal to the nearest integer to x //! whose absolute value is not larger than the absolute value of x. //! - //! \li GLSL trunc man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL trunc man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType trunc(genType const & x); @@ -56,8 +78,8 @@ namespace glm //! This includes the possibility that round(x) returns the //! same value as roundEven(x) for all values of x. //! - //! \li GLSL round man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL round man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType round(genType const & x); @@ -65,31 +87,31 @@ namespace glm //! A fractional part of 0.5 will round toward the nearest even //! integer. (Both 3.5 and 4.5 for x will return 4.0.) //! - //! \li GLSL roundEven man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL roundEven man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType roundEven(genType const & x); //! Returns a value equal to the nearest integer //! that is greater than or equal to x. //! - //! \li GLSL ceil man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL ceil man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType ceil(genType const & x); //! Return x - floor(x). //! - //! \li GLSL fract man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL fract man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType fract(genType const & x); //! Modulus. Returns x - y * floor(x / y) //! for each component in x using the floating point value y. //! - //! \li GLSL mod man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL mod man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType mod( genType const & x, @@ -98,8 +120,8 @@ namespace glm //! Modulus. Returns x - y * floor(x / y) //! for each component in x using the floating point value y. //! - //! \li GLSL mod man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL mod man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType mod( genType const & x, @@ -110,17 +132,17 @@ namespace glm //! return value and the output parameter will have the same //! sign as x. //! - //! \li GLSL modf man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL modf man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType modf( genType const & x, genType & i); - //! Returns y if y < x; otherwise, it returns x. - //! - //! \li GLSL min man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// Returns y if y < x; otherwise, it returns x. + /// + /// @see - GLSL min man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType min( genType const & x, @@ -131,10 +153,10 @@ namespace glm genType const & x, typename genType::value_type const & y); - //! Returns y if x < y; otherwise, it returns x. - //! - //! \li GLSL max man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// Returns y if x < y; otherwise, it returns x. + /// + /// @see - GLSL max man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType max( genType const & x, @@ -148,8 +170,8 @@ namespace glm //! Returns min(max(x, minVal), maxVal) for each component in x //! using the floating-point values minVal and maxVal. //! - //! \li GLSL clamp man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL clamp man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType clamp( genType const & x, @@ -162,12 +184,12 @@ namespace glm typename genType::value_type const & minVal, typename genType::value_type const & maxVal); - //! \return If genTypeU is a floating scalar or vector: + //! @return If genTypeU is a floating scalar or vector: //! Returns x * (1.0 - a) + y * a, i.e., the linear blend of //! x and y using the floating-point value a. //! The value for a is not restricted to the range [0, 1]. - //! - //! \return If genTypeU is a boolean scalar or vector: + //! + //! @return If genTypeU is a boolean scalar or vector: //! Selects which vector each returned component comes //! from. For a component of a that is false, the //! corresponding component of x is returned. For a @@ -178,22 +200,39 @@ namespace glm //! provides different functionality than //! genType mix(genType x, genType y, genType(a)) //! where a is a Boolean vector. - //! - //! \li GLSL mix man page - //! \li GLSL 1.30.08 specification, section 8.3 - //! - //! \param[in] x Floating point scalar or vector. - //! \param[in] y Floating point scalar or vector. - //! \param[in] a Floating point or boolean scalar or vector. - //! - // \todo Test when 'a' is a boolean. + /// + /// @see - GLSL mix man page + /// @see - GLSL 4.20.8 specification, section 8.3 + /// + /// @param[in] x Value to interpolate. + /// @param[in] y Value to interpolate. + /// @param[in] a Interpolant. + /// + /// @tparam genTypeT Floating point scalar or vector. + /// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT. + /// + /// @code + /// #include + /// ... + /// float a; + /// bool b; + /// glm::dvec3 e; + /// glm::dvec3 f; + /// glm::vec4 g; + /// glm::vec4 h; + /// ... + /// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors. + /// glm::vec4 s = glm::mix(g, h, b); // Teturns g or h; + /// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second. + /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. + /// @endcode template genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a); //! Returns 0.0 if x < edge, otherwise it returns 1.0. //! - //! \li GLSL step man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL step man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType step( genType const & edge, @@ -214,8 +253,8 @@ namespace glm //! return t * t * (3 – 2 * t); //! Results are undefined if edge0 >= edge1. //! - //! \li GLSL smoothstep man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL smoothstep man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType smoothstep( genType const & edge0, @@ -234,8 +273,8 @@ namespace glm //! including for implementations with no NaN //! representations. //! - //! \li GLSL isnan man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL isnan man page + /// @see - GLSL 4.20.8 specification, section 8.3 template typename genType::bool_type isnan(genType const & x); @@ -245,8 +284,8 @@ namespace glm //! otherwise, including for implementations with no infinity //! representations. //! - //! \li GLSL isinf man page - //! \li GLSL 1.30.08 specification, section 8.3 + /// @see - GLSL isinf man page + /// @see - GLSL 4.20.8 specification, section 8.3 template typename genType::bool_type isinf(genType const & x); @@ -254,8 +293,8 @@ namespace glm //! the encoding of a floating-point value. The floatingpoint //! value's bit-level representation is preserved. //! - //! \li GLSL floatBitsToInt man page - //! \li GLSL 4.00.08 specification, section 8.3 + /// @see - GLSL floatBitsToInt man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genIType floatBitsToInt(genType const & value); @@ -263,8 +302,8 @@ namespace glm //! the encoding of a floating-point value. The floatingpoint //! value's bit-level representation is preserved. //! - //! \li GLSL floatBitsToUint man page - //! \li GLSL 4.00.08 specification, section 8.3 + /// @see - GLSL floatBitsToUint man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genUType floatBitsToUint(genType const & value); @@ -274,8 +313,8 @@ namespace glm //! resulting floating point value is unspecified. Otherwise, //! the bit-level representation is preserved. //! - //! \li GLSL intBitsToFloat man page - //! \li GLSL 4.00.08 specification, section 8.3 + /// @see - GLSL intBitsToFloat man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType intBitsToFloat(genIType const & value); @@ -285,15 +324,15 @@ namespace glm //! resulting floating point value is unspecified. Otherwise, //! the bit-level representation is preserved. //! - //! \li GLSL uintBitsToFloat man page - //! \li GLSL 4.00.08 specification, section 8.3 + /// @see - GLSL uintBitsToFloat man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType uintBitsToFloat(genUType const & value); //! Computes and returns a * b + c. //! - //! \li GLSL fma man page - //! \li GLSL 4.00.08 specification, section 8.3 + /// @see - GLSL fma man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType fma(genType const & a, genType const & b, genType const & c); @@ -307,8 +346,8 @@ namespace glm //! are both zero. For a floating-point value that is an //! infinity or is not a number, the results are undefined. //! - //! \li GLSL frexp man page - //! \li GLSL 4.00.08 specification, section 8.3 + /// @see - GLSL frexp man page + /// @see - GLSL 4.20.8 specification, section 8.3 template genType frexp(genType const & x, genIType & exp); @@ -319,19 +358,14 @@ namespace glm //! If this product is too large to be represented in the //! floating-point type, the result is undefined. //! - //! \li GLSL ldexp man page; - //! \li GLSL 4.00.08 specification, section 8.3 + /// @see - GLSL ldexp man page; + /// @see - GLSL 4.20.8 specification, section 8.3 template genType ldexp(genType const & x, genIType const & exp); - ///@} - }//namespace common - }//namespace function - }//namespace core - - using namespace core::function::common; + /// @} }//namespace glm #include "func_common.inl" -#endif//glm_core_func_common +#endif//GLM_CORE_func_common diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index 4695bdff..d7943873 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -1,49 +1,61 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-03 -// Updated : 2010-01-26 -// Licence : This source is under MIT License -// File : glm/core/func_common.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_common.inl +/// @date 2008-08-03 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ +namespace detail { - namespace detail - { - template - struct Abs_ - { - }; + template + struct Abs_ + {}; - template - struct Abs_ - { - static genFIType get(genFIType const & x) - { - GLM_STATIC_ASSERT( - detail::type::is_float || - detail::type::is_int, "'abs' only accept floating-point and integer inputs"); - return x >= genFIType(0) ? x : -x; - } - }; + template + struct Abs_ + { + static genFIType get(genFIType const & x) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int, "'abs' only accept floating-point and integer inputs"); + return x >= genFIType(0) ? x : -x; + } + }; - template - struct Abs_ - { - static genFIType get(genFIType const & x) - { - GLM_STATIC_ASSERT( + template + struct Abs_ + { + static genFIType get(genFIType const & x) + { + GLM_STATIC_ASSERT( detail::type::is_uint, "'abs' only accept floating-point and integer inputs"); - - return x; - } - }; - }//namespace detail - - namespace core{ - namespace function{ - namespace common{ + return x; + } + }; +}//namespace detail // abs template @@ -146,7 +158,7 @@ namespace glm template <> GLM_FUNC_QUALIFIER detail::thalf floor(detail::thalf const& x) { - return detail::thalf(::std::floor(float(x))); + return detail::thalf(::std::floor(x.toFloat())); } template @@ -256,7 +268,7 @@ namespace glm round(x.z), round(x.w)); } - +/* // roundEven template GLM_FUNC_QUALIFIER genType roundEven(genType const& x) @@ -265,7 +277,22 @@ namespace glm return genType(int(x + genType(int(x) % 2))); } - +*/ + // roundEven + template + GLM_FUNC_QUALIFIER genType roundEven(genType const& x) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'roundEven' only accept floating-point inputs"); + + genType RoundValue(0.5); + if(fract(x) == genType(0.5) && int(x) % 2) + RoundValue = genType(-0.5); + + if(x < genType(0.0)) + return genType(int(x - RoundValue)); + return genType(int(x + RoundValue)); + } + template GLM_FUNC_QUALIFIER detail::tvec2 roundEven(detail::tvec2 const& x) { @@ -735,7 +762,7 @@ namespace glm //if(x >= maxVal) return maxVal; //if(x <= minVal) return minVal; //return x; - return glm::max(glm::min(x, maxVal), minVal); + return max(min(x, maxVal), minVal); } template @@ -1335,7 +1362,7 @@ namespace glm floatBitsToInt(value.z)); } - GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt + GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt ( detail::tvec4 const & value ) @@ -1404,7 +1431,8 @@ namespace glm return fi.f; } - GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat + GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat + ( detail::tvec2 const & value ) @@ -1414,7 +1442,7 @@ namespace glm intBitsToFloat(value.y)); } - GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat + GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat ( detail::tvec3 const & value ) @@ -1573,7 +1601,4 @@ namespace glm return std::frexp(x, exp); } - }//namespace common - }//namespace function - }//namespace core }//namespace glm diff --git a/glm/core/func_exponential.hpp b/glm/core/func_exponential.hpp index c3bc0bd2..b59f191f 100644 --- a/glm/core/func_exponential.hpp +++ b/glm/core/func_exponential.hpp @@ -1,84 +1,99 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-08 -// Updated : 2010-02-04 -// Licence : This source is under MIT License -// File : glm/core/func_exponential.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_exponential.hpp +/// @date 2008-08-08 / 2011-06-14 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.20.8 specification, section 8.2 +/// +/// @defgroup core_func_exponential Exponential functions +/// @ingroup core +/// +/// These all operate component-wise. The description is per component. +/////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_exponential -#define glm_core_func_exponential +#define glm_core_func_exponential GLM_VERSION namespace glm { - namespace core{ - namespace function{ - //! Define all exponential functions from Section 8.2 of GLSL 1.30.8 specification. Included in glm namespace. - namespace exponential{ + /// @addtogroup core_func_exponential + /// @{ - /// \addtogroup core_funcs - ///@{ - - //! Returns x raised to the y power. - //! - //! \li GLSL pow man page - //! \li GLSL 1.30.08 specification, section 8.2 + /// Returns x raised to the y power. + /// + /// @see - GLSL pow man page + /// @see - GLSL 4.20.8 specification, section 8.2 template genType pow(genType const & x, genType const & y); - //! Returns the natural exponentiation of x, i.e., e^x. - //! - //! \li GLSL exp man page - //! \li GLSL 1.30.08 specification, section 8.2 + /// Returns the natural exponentiation of x, i.e., e^x. + /// + /// @see - GLSL exp man page + /// @see - GLSL 4.20.8 specification, section 8.2 template genType exp(genType const & x); - //! Returns the natural logarithm of x, i.e., - //! returns the value y which satisfies the equation x = e^y. - //! Results are undefined if x <= 0. - //! - //! \li GLSL log man page - //! \li GLSL 1.30.08 specification, section 8.2 + /// Returns the natural logarithm of x, i.e., + /// returns the value y which satisfies the equation x = e^y. + /// Results are undefined if x <= 0. + /// + /// @see - GLSL log man page + /// @see - GLSL 4.20.8 specification, section 8.2 template genType log(genType const & x); - //! Returns 2 raised to the x power. - //! - //! \li GLSL exp2 man page - //! \li GLSL 1.30.08 specification, section 8.2 + /// Returns 2 raised to the x power. + /// + /// @see - GLSL exp2 man page + /// @see - GLSL 4.20.8 specification, section 8.2 template genType exp2(genType const & x); - //! Returns the base 2 log of x, i.e., returns the value y, - //! which satisfies the equation x = 2 ^ y. - //! - //! \li GLSL log2 man page - //! \li GLSL 1.30.08 specification, section 8.2 + /// Returns the base 2 log of x, i.e., returns the value y, + /// which satisfies the equation x = 2 ^ y. + /// + /// @see - GLSL log2 man page + /// @see - GLSL 4.20.8 specification, section 8.2 template genType log2(genType const & x); - //! Returns the positive square root of x. - //! - //! \li GLSL sqrt man page - //! \li GLSL 1.30.08 specification, section 8.2 + /// Returns the positive square root of x. + /// + /// @see - GLSL sqrt man page + /// @see - GLSL 4.20.8 specification, section 8.2 template genType sqrt(genType const & x); - //! Returns the reciprocal of the positive square root of x. - //! - //! \li GLSL inversesqrt man page - //! \li GLSL 1.30.08 specification, section 8.2 + /// Returns the reciprocal of the positive square root of x. + /// + /// @see - GLSL inversesqrt man page + /// @see - GLSL 4.20.8 specification, section 8.2 template genType inversesqrt(genType const & x); - ///@} - - }//namespace exponential - }//namespace function - }//namespace core - - using namespace core::function::exponential; + /// @} }//namespace glm #include "func_exponential.inl" diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl index d3bc59ea..c8c385f7 100644 --- a/glm/core/func_exponential.inl +++ b/glm/core/func_exponential.inl @@ -1,18 +1,33 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-03 -// Updated : 2010-02-04 -// Licence : This source is under MIT License -// File : glm/core/func_exponential.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_exponential.inl +/// @date 2008-08-03 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// namespace glm { - namespace core{ - namespace function{ - namespace exponential{ - // pow template GLM_FUNC_QUALIFIER genType pow @@ -276,8 +291,8 @@ namespace glm ) { return detail::tvec2( - sqrt(x.x), - sqrt(x.y)); + glm::sqrt(x.x), + glm::sqrt(x.y)); } template @@ -287,9 +302,9 @@ namespace glm ) { return detail::tvec3( - sqrt(x.x), - sqrt(x.y), - sqrt(x.z)); + glm::sqrt(x.x), + glm::sqrt(x.y), + glm::sqrt(x.z)); } template @@ -299,10 +314,10 @@ namespace glm ) { return detail::tvec4( - sqrt(x.x), - sqrt(x.y), - sqrt(x.z), - sqrt(x.w)); + glm::sqrt(x.x), + glm::sqrt(x.y), + glm::sqrt(x.z), + glm::sqrt(x.w)); } template @@ -352,7 +367,4 @@ namespace glm inversesqrt(x.w)); } - }//namespace exponential - }//namespace function - }//namespace core }//namespace glm diff --git a/glm/core/func_geometric.hpp b/glm/core/func_geometric.hpp index bf572338..9cea45de 100644 --- a/glm/core/func_geometric.hpp +++ b/glm/core/func_geometric.hpp @@ -1,106 +1,122 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-03 -// Updated : 2010-02-04 -// Licence : This source is under MIT License -// File : glm/core/func_geometric.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_geometric.hpp +/// @date 2008-08-03 / 2011-06-14 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.20.8 specification, section 8.5 +/// +/// @defgroup core_func_geometric Geometric functions +/// @ingroup core +/// +/// These operate on vectors as vectors, not component-wise. +/////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_geometric -#define glm_core_func_geometric +#define glm_core_func_geometric GLM_VERSION namespace glm { - namespace core{ - namespace function{ - namespace geometric{ //!< Define all geometric functions from Section 8.4 of GLSL 1.30.8 specification. Included in glm namespace. + /// @addtogroup core_func_geometric + /// @{ - /// \addtogroup core_funcs - ///@{ - - //! Returns the length of x, i.e., sqrt(x * x). - //! - //! \li GLSL length man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// Returns the length of x, i.e., sqrt(x * x). + /// + /// @see - GLSL length man page + /// @see - GLSL 4.20.8 specification, section 8.5 template - typename genType::value_type length( + typename genType::value_type length( genType const & x); - //! Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). - //! - //! \li GLSL distance man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). + /// + /// @see - GLSL distance man page + /// @see - GLSL 4.20.8 specification, section 8.5 template typename genType::value_type distance( genType const & p0, genType const & p1); - //! Returns the dot product of x and y, i.e., result = x * y. - //! - //! \li GLSL dot man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// Returns the dot product of x and y, i.e., result = x * y. + /// + /// @see - GLSL dot man page + /// @see - GLSL 4.20.8 specification, section 8.5 template typename genType::value_type dot( genType const & x, genType const & y); - //! Returns the cross product of x and y. - //! - //! \li GLSL cross man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// Returns the cross product of x and y. + /// + /// @see - GLSL cross man page + /// @see - GLSL 4.20.8 specification, section 8.5 template detail::tvec3 cross( detail::tvec3 const & x, detail::tvec3 const & y); - //! Returns a vector in the same direction as x but with length of 1. - //! - //! \li GLSL normalize man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// Returns a vector in the same direction as x but with length of 1. + /// + /// @see - GLSL normalize man page + /// @see - GLSL 4.20.8 specification, section 8.5 template genType normalize( genType const & x); - //! If dot(Nref, I) < 0.0, return N, otherwise, return -N. - //! - //! \li GLSL faceforward man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// If dot(Nref, I) < 0.0, return N, otherwise, return -N. + /// + /// @see - GLSL faceforward man page + /// @see - GLSL 4.20.8 specification, section 8.5 template genType faceforward( genType const & N, genType const & I, genType const & Nref); - //! For the incident vector I and surface orientation N, - //! returns the reflection direction : result = I - 2.0 * dot(N, I) * N. - //! - //! \li GLSL reflect man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// For the incident vector I and surface orientation N, + /// returns the reflection direction : result = I - 2.0 * dot(N, I) * N. + /// + /// @see - GLSL reflect man page + /// @see - GLSL 4.20.8 specification, section 8.5 template genType reflect( genType const & I, genType const & N); - //! For the incident vector I and surface normal N, - //! and the ratio of indices of refraction eta, - //! return the refraction vector. - //! - //! \li GLSL refract man page - //! \li GLSL 1.30.08 specification, section 8.4 + /// For the incident vector I and surface normal N, + /// and the ratio of indices of refraction eta, + /// return the refraction vector. + /// + /// @see - GLSL refract man page + /// @see - GLSL 4.20.8 specification, section 8.5 template genType refract( genType const & I, genType const & N, typename genType::value_type const & eta); - ///@} - - }//namespace geometric - }//namespace function - }//namespace core - - using namespace core::function::geometric; + /// @} }//namespace glm #include "func_geometric.inl" diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl index 086b5220..f83b590c 100644 --- a/glm/core/func_geometric.inl +++ b/glm/core/func_geometric.inl @@ -1,18 +1,33 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-03 -// Updated : 2010-02-04 -// Licence : This source is under MIT License -// File : glm/core/func_geometric.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_geometric.inl +/// @date 2008-08-03 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// namespace glm { - namespace core{ - namespace function{ - namespace geometric{ - // length template GLM_FUNC_QUALIFIER genType length @@ -284,7 +299,4 @@ namespace glm return eta * I - (eta * dotValue + sqrt(k)) * N; } - }//namespace geometric - }//namespace function - }//namespace core }//namespace glm diff --git a/glm/core/func_integer.hpp b/glm/core/func_integer.hpp index f75593a9..6f30d4f2 100644 --- a/glm/core/func_integer.hpp +++ b/glm/core/func_integer.hpp @@ -1,155 +1,172 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2010-03-17 -// Updated : 2010-03-31 -// Licence : This source is under MIT License -// File : glm/core/func_integer.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_integer.hpp +/// @date 2010-03-17 / 2011-06-18 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.20.8 specification, section 8.8 +/// +/// @defgroup core_func_integer Integer functions +/// @ingroup core +/// +/// 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. +/////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_integer -#define glm_core_func_integer +#define glm_core_func_integer GLM_VERSION namespace glm { - namespace core{ - namespace function{ - //! Define integer functions from Section 8.8 of GLSL 4.00.8 specification. - namespace integer{ + /// @addtogroup core_func_integer + /// @{ - /// \addtogroup core_funcs - ///@{ + //! Adds 32-bit unsigned integer x and y, returning the sum + //! modulo pow(2, 32). The value carry is set to 0 if the sum was + //! less than pow(2, 32), or to 1 otherwise. + //! + /// @see - GLSL uaddCarry man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template + genUType uaddCarry( + genUType const & x, + genUType const & y, + genUType & carry); - //! Adds 32-bit unsigned integer x and y, returning the sum - //! modulo pow(2, 32). The value carry is set to 0 if the sum was - //! less than pow(2, 32), or to 1 otherwise. - //! - //! \li GLSL uaddCarry man page - //! \li GLSL 4.00.08 specification, section 8.8 - template - genUType uaddCarry( - genUType const & x, - genUType const & y, - genUType & carry); - - //! Subtracts the 32-bit unsigned integer y from x, returning - //! the difference if non-negative, or pow(2, 32) plus the difference - //! otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise. - //! - //! \li GLSL usubBorrow man page - //! \li GLSL 4.00.08 specification, section 8.8 - template - genUType usubBorrow( - genUType const & x, - genUType const & y, - genUType & borrow); + //! Subtracts the 32-bit unsigned integer y from x, returning + //! the difference if non-negative, or pow(2, 32) plus the difference + //! otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise. + //! + /// @see - GLSL usubBorrow man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template + genUType usubBorrow( + genUType const & x, + genUType const & y, + genUType & borrow); - //! Multiplies 32-bit integers x and y, producing a 64-bit - //! result. The 32 least-significant bits are returned in lsb. - //! The 32 most-significant bits are returned in msb. - //! - //! \li GLSL umulExtended man page - //! \li GLSL 4.00.08 specification, section 8.8 - template - void umulExtended( - genUType const & x, - genUType const & y, - genUType & msb, - genUType & lsb); + //! Multiplies 32-bit integers x and y, producing a 64-bit + //! result. The 32 least-significant bits are returned in lsb. + //! The 32 most-significant bits are returned in msb. + //! + /// @see - GLSL umulExtended man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template + void umulExtended( + genUType const & x, + genUType const & y, + genUType & msb, + genUType & lsb); - //! Multiplies 32-bit integers x and y, producing a 64-bit - //! result. The 32 least-significant bits are returned in lsb. - //! The 32 most-significant bits are returned in msb. - //! - //! \li GLSL imulExtended man page - //! \li GLSL 4.00.08 specification, section 8.8 - template - void imulExtended( - genIType const & x, - genIType const & y, - genIType & msb, - genIType & lsb); + //! Multiplies 32-bit integers x and y, producing a 64-bit + //! result. The 32 least-significant bits are returned in lsb. + //! The 32 most-significant bits are returned in msb. + //! + /// @see - GLSL imulExtended man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template + void imulExtended( + genIType const & x, + genIType const & y, + genIType & msb, + genIType & lsb); - //! Extracts bits [offset, offset + bits - 1] from value, - //! returning them in the least significant bits of the result. - //! For unsigned data types, the most significant bits of the - //! result will be set to zero. For signed data types, the - //! most significant bits will be set to the value of bit offset + base – 1. - //! - //! If bits is zero, the result will be zero. The result will be - //! undefined if offset or bits is negative, or if the sum of - //! offset and bits is greater than the number of bits used - //! to store the operand. - //! - //! \li GLSL bitfieldExtract man page - //! \li GLSL 4.00.08 specification, section 8.8 - template - genIUType bitfieldExtract( - genIUType const & Value, - int const & Offset, - int const & Bits); + //! Extracts bits [offset, offset + bits - 1] from value, + //! returning them in the least significant bits of the result. + //! For unsigned data types, the most significant bits of the + //! result will be set to zero. For signed data types, the + //! most significant bits will be set to the value of bit offset + base – 1. + //! + //! If bits is zero, the result will be zero. The result will be + //! undefined if offset or bits is negative, or if the sum of + //! offset and bits is greater than the number of bits used + //! to store the operand. + //! + /// @see - GLSL bitfieldExtract man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template + genIUType bitfieldExtract( + genIUType const & Value, + int const & Offset, + int const & Bits); - //! Returns the insertion the bits least-significant bits of insert into base. - //! - //! The result will have bits [offset, offset + bits - 1] taken - //! from bits [0, bits – 1] of insert, and all other bits taken - //! directly from the corresponding bits of base. If bits is - //! zero, the result will simply be base. The result will be - //! undefined if offset or bits is negative, or if the sum of - //! offset and bits is greater than the number of bits used to - //! store the operand. - //! - //! \li GLSL bitfieldInsert man page - //! \li GLSL 4.00.08 specification, section 8.8 - template - genIUType bitfieldInsert( - genIUType const & Base, - genIUType const & Insert, - int const & Offset, - int const & Bits); + //! Returns the insertion the bits least-significant bits of insert into base. + //! + //! The result will have bits [offset, offset + bits - 1] taken + //! from bits [0, bits – 1] of insert, and all other bits taken + //! directly from the corresponding bits of base. If bits is + //! zero, the result will simply be base. The result will be + //! undefined if offset or bits is negative, or if the sum of + //! offset and bits is greater than the number of bits used to + //! store the operand. + //! + /// @see - GLSL bitfieldInsert man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template + genIUType bitfieldInsert( + genIUType const & Base, + genIUType const & Insert, + int const & Offset, + int const & Bits); - //! Returns the reversal of the bits of value. - //! The bit numbered n of the result will be taken from bit (bits - 1) - n of value, - //! where bits is the total number of bits used to represent value. - //! - //! \li GLSL bitfieldReverse man page - //! \li GLSL 4.00.08 specification, section 8.8 - template - genIUType bitfieldReverse(genIUType const & value); + //! Returns the reversal of the bits of value. + //! The bit numbered n of the result will be taken from bit (bits - 1) - n of value, + //! where bits is the total number of bits used to represent value. + //! + /// @see - GLSL bitfieldReverse man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template + genIUType bitfieldReverse(genIUType const & value); - //! Returns the number of bits set to 1 in the binary representation of value. - //! - //! \li GLSL bitCount man page - //! \li GLSL 4.00.08 specification, section 8.8 - template class C> - typename C::signed_type bitCount(C const & Value); + //! Returns the number of bits set to 1 in the binary representation of value. + //! + /// @see - GLSL bitCount man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template class C> + typename C::signed_type bitCount(C const & Value); - //! Returns the bit number of the least significant bit set to - //! 1 in the binary representation of value. - //! If value is zero, -1 will be returned. - //! - //! \li GLSL findLSB man page - //! \li GLSL 4.00.08 specification, section 8.8 - template class C> - typename C::signed_type findLSB(C const & Value); + //! Returns the bit number of the least significant bit set to + //! 1 in the binary representation of value. + //! If value is zero, -1 will be returned. + //! + /// @see - GLSL findLSB man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template class C> + typename C::signed_type findLSB(C const & Value); - //! Returns the bit number of the most significant bit in the binary representation of value. - //! For positive integers, the result will be the bit number of the most significant bit set to 1. - //! For negative integers, the result will be the bit number of the most significant - //! bit set to 0. For a value of zero or negative one, -1 will be returned. - //! - //! \li GLSL findMSB man page - //! \li GLSL 4.00.08 specification, section 8.8 - template class C> - typename C::signed_type findMSB(C const & Value); + //! Returns the bit number of the most significant bit in the binary representation of value. + //! For positive integers, the result will be the bit number of the most significant bit set to 1. + //! For negative integers, the result will be the bit number of the most significant + //! bit set to 0. For a value of zero or negative one, -1 will be returned. + //! + /// @see - GLSL findMSB man page + /// @see - GLSL 4.20.8 specification, section 8.8 + template class C> + typename C::signed_type findMSB(C const & Value); - ///@} - - }//namespace integer - }//namespace function - }//namespace core - - using namespace core::function::integer; + /// @} }//namespace glm #include "func_integer.inl" diff --git a/glm/core/func_integer.inl b/glm/core/func_integer.inl index 0e30aa2a..fb91defc 100644 --- a/glm/core/func_integer.inl +++ b/glm/core/func_integer.inl @@ -1,597 +1,603 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2010-03-17 -// Updated : 2010-03-31 -// Licence : This source is under MIT License -// File : glm/core/func_integer.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_integer.inl +/// @date 2010-03-17 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// namespace glm { - namespace detail + // uaddCarry + template + GLM_FUNC_QUALIFIER genUType uaddCarry + ( + genUType const & x, + genUType const & y, + genUType & Carry + ) { - - }//namespace detail + detail::highp_uint_t Value64 = detail::highp_uint_t(x) + detail::highp_uint_t(y); + genUType Result = genUType(Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))); + Carry = (Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))) > 1 ? 1 : 0; + return Result; + } - namespace core{ - namespace function{ - namespace integer + template + GLM_FUNC_QUALIFIER detail::tvec2 uaddCarry + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & Carry + ) { - // uaddCarry - template - GLM_FUNC_QUALIFIER genUType uaddCarry - ( - genUType const & x, - genUType const & y, - genUType & Carry - ) + return detail::tvec2( + uaddCarry(x[0], y[0], Carry[0]), + uaddCarry(x[1], y[1], Carry[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 uaddCarry + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & Carry + ) + { + return detail::tvec3( + uaddCarry(x[0], y[0], Carry[0]), + uaddCarry(x[1], y[1], Carry[1]), + uaddCarry(x[2], y[2], Carry[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 uaddCarry + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & Carry + ) + { + return detail::tvec4( + uaddCarry(x[0], y[0], Carry[0]), + uaddCarry(x[1], y[1], Carry[1]), + uaddCarry(x[2], y[2], Carry[2]), + uaddCarry(x[3], y[3], Carry[3])); + } + + // usubBorrow + template + GLM_FUNC_QUALIFIER genUType usubBorrow + ( + genUType const & x, + genUType const & y, + genUType & Borrow + ) + { + Borrow = x >= y ? 0 : 1; + if(x > y) + return genUType(detail::highp_int_t(x) - detail::highp_int_t(y)); + else + return genUType(detail::highp_int_t(1) << detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 usubBorrow + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & Borrow + ) + { + return detail::tvec2( + usubBorrow(x[0], y[0], Borrow[0]), + usubBorrow(x[1], y[1], Borrow[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 usubBorrow + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & Borrow + ) + { + return detail::tvec3( + usubBorrow(x[0], y[0], Borrow[0]), + usubBorrow(x[1], y[1], Borrow[1]), + usubBorrow(x[2], y[2], Borrow[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 usubBorrow + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & Borrow + ) + { + return detail::tvec4( + usubBorrow(x[0], y[0], Borrow[0]), + usubBorrow(x[1], y[1], Borrow[1]), + usubBorrow(x[2], y[2], Borrow[2]), + usubBorrow(x[3], y[3], Borrow[3])); + } + + // umulExtended + template + GLM_FUNC_QUALIFIER void umulExtended + ( + genUType const & x, + genUType const & y, + genUType & msb, + genUType & lsb + ) + { + detail::highp_uint_t ValueX64 = x; + detail::highp_uint_t ValueY64 = y; + detail::highp_uint_t Value64 = ValueX64 * ValueY64; + msb = *(genUType*)&genUType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); + lsb = *(genUType*)&genUType(Value64 >> detail::highp_uint_t(32)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 umulExtended + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & msb, + detail::tvec2 & lsb + ) + { + return detail::tvec2( + umulExtended(x[0], y[0], msb, lsb), + umulExtended(x[1], y[1], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 umulExtended + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & msb, + detail::tvec3 & lsb + ) + { + return detail::tvec3( + umulExtended(x[0], y[0], msb, lsb), + umulExtended(x[1], y[1], msb, lsb), + umulExtended(x[2], y[2], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 umulExtended + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & msb, + detail::tvec4 & lsb + ) + { + return detail::tvec4( + umulExtended(x[0], y[0], msb, lsb), + umulExtended(x[1], y[1], msb, lsb), + umulExtended(x[2], y[2], msb, lsb), + umulExtended(x[3], y[3], msb, lsb)); + } + + // imulExtended + template + GLM_FUNC_QUALIFIER void imulExtended + ( + genIType const & x, + genIType const & y, + genIType & msb, + genIType & lsb + ) + { + detail::highp_int_t ValueX64 = x; + detail::highp_int_t ValueY64 = y; + detail::highp_int_t Value64 = ValueX64 * ValueY64; + msb = *(genIType*)&genIType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); + lsb = *(genIType*)&genIType(Value64 >> detail::highp_uint_t(32)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 imulExtended + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 & msb, + detail::tvec2 & lsb + ) + { + return detail::tvec2( + imulExtended(x[0], y[0], msb, lsb), + imulExtended(x[1], y[1], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 imulExtended + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 & msb, + detail::tvec3 & lsb + ) + { + return detail::tvec3( + imulExtended(x[0], y[0], msb, lsb), + imulExtended(x[1], y[1], msb, lsb), + imulExtended(x[2], y[2], msb, lsb)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 imulExtended + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 & msb, + detail::tvec4 & lsb + ) + { + return detail::tvec4( + imulExtended(x[0], y[0], msb, lsb), + imulExtended(x[1], y[1], msb, lsb), + imulExtended(x[2], y[2], msb, lsb), + imulExtended(x[3], y[3], msb, lsb)); + } + + // bitfieldExtract + template + GLM_FUNC_QUALIFIER genIUType bitfieldExtract + ( + genIUType const & Value, + int const & Offset, + int const & Bits + ) + { + int GenSize = int(sizeof(genIUType)) << int(3); + + assert(Offset + Bits <= GenSize); + + genIUType ShiftLeft = Bits ? Value << (GenSize - (Bits + Offset)) : genIUType(0); + genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Bits); + + return ShiftBack; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 bitfieldExtract + ( + detail::tvec2 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec2( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 bitfieldExtract + ( + detail::tvec3 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec3( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1]), + bitfieldExtract(Value[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 bitfieldExtract + ( + detail::tvec4 const & Value, + int const & Offset, + int const & Bits + ) + { + return detail::tvec4( + bitfieldExtract(Value[0]), + bitfieldExtract(Value[1]), + bitfieldExtract(Value[2]), + bitfieldExtract(Value[3])); + } + + // bitfieldInsert + template + GLM_FUNC_QUALIFIER genIUType bitfieldInsert + ( + genIUType const & Base, + genIUType const & Insert, + int const & Offset, + int const & Bits + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldInsert' only accept integer values"); + assert(Offset + Bits <= sizeof(genIUType)); + + if(Bits == 0) + return Base; + + genIUType Mask = 0; + for(int Bit = Offset; Bit < Offset + Bits; ++Bit) + Mask |= (1 << Bit); + + return (Base & ~Mask) | (Insert & Mask); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 bitfieldInsert + ( + detail::tvec2 const & Base, + detail::tvec2 const & Insert, + int const & Offset, + int const & Bits + ) + { + return detail::tvec2( + bitfieldInsert(Base[0], Insert[0], Offset, Bits), + bitfieldInsert(Base[1], Insert[1], Offset, Bits)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 bitfieldInsert + ( + detail::tvec3 const & Base, + detail::tvec3 const & Insert, + int const & Offset, + int const & Bits + ) + { + return detail::tvec3( + bitfieldInsert(Base[0], Insert[0], Offset, Bits), + bitfieldInsert(Base[1], Insert[1], Offset, Bits), + bitfieldInsert(Base[2], Insert[2], Offset, Bits)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 bitfieldInsert + ( + detail::tvec4 const & Base, + detail::tvec4 const & Insert, + int const & Offset, + int const & Bits + ) + { + return detail::tvec4( + bitfieldInsert(Base[0], Insert[0], Offset, Bits), + bitfieldInsert(Base[1], Insert[1], Offset, Bits), + bitfieldInsert(Base[2], Insert[2], Offset, Bits), + bitfieldInsert(Base[3], Insert[3], Offset, Bits)); + } + + // bitfieldReverse + template + GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldReverse' only accept integer values"); + + genIUType Out = 0; + std::size_t BitSize = sizeof(genIUType) * 8; + for(std::size_t i = 0; i < BitSize; ++i) + if(Value & (genIUType(1) << i)) + Out |= genIUType(1) << (BitSize - 1 - i); + return Out; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 bitfieldReverse + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + bitfieldReverse(value[0]), + bitfieldReverse(value[1])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 bitfieldReverse + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + bitfieldReverse(value[0]), + bitfieldReverse(value[1]), + bitfieldReverse(value[2])); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 bitfieldReverse + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + bitfieldReverse(value[0]), + bitfieldReverse(value[1]), + bitfieldReverse(value[2]), + bitfieldReverse(value[3])); + } + + // bitCount + template + GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitCount' only accept integer values"); + + int Count = 0; + for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i) { - detail::highp_uint_t Value64 = detail::highp_uint_t(x) + detail::highp_uint_t(y); - genUType Result = genUType(Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))); - Carry = (Value64 % (detail::highp_uint_t(1) << detail::highp_uint_t(32))) > 1 ? 1 : 0; - return Result; + if(Value & (1 << i)) + ++Count; } + return Count; + } - template - GLM_FUNC_QUALIFIER detail::tvec2 uaddCarry - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & Carry - ) - { - return detail::tvec2( - uaddCarry(x[0], y[0], Carry[0]), - uaddCarry(x[1], y[1], Carry[1])); - } + template + GLM_FUNC_QUALIFIER detail::tvec2 bitCount + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + bitCount(value[0]), + bitCount(value[1])); + } - template - GLM_FUNC_QUALIFIER detail::tvec3 uaddCarry - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & Carry - ) - { - return detail::tvec3( - uaddCarry(x[0], y[0], Carry[0]), - uaddCarry(x[1], y[1], Carry[1]), - uaddCarry(x[2], y[2], Carry[2])); - } + template + GLM_FUNC_QUALIFIER detail::tvec3 bitCount + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + bitCount(value[0]), + bitCount(value[1]), + bitCount(value[2])); + } - template - GLM_FUNC_QUALIFIER detail::tvec4 uaddCarry - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & Carry - ) - { - return detail::tvec4( - uaddCarry(x[0], y[0], Carry[0]), - uaddCarry(x[1], y[1], Carry[1]), - uaddCarry(x[2], y[2], Carry[2]), - uaddCarry(x[3], y[3], Carry[3])); - } + template + GLM_FUNC_QUALIFIER detail::tvec4 bitCount + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + bitCount(value[0]), + bitCount(value[1]), + bitCount(value[2]), + bitCount(value[3])); + } - // usubBorrow - template - GLM_FUNC_QUALIFIER genUType usubBorrow - ( - genUType const & x, - genUType const & y, - genUType & Borrow - ) - { - Borrow = x >= y ? 0 : 1; - if(x > y) - return genUType(detail::highp_int_t(x) - detail::highp_int_t(y)); - else - return genUType(detail::highp_int_t(1) << detail::highp_int_t(32) + detail::highp_int_t(x) - detail::highp_int_t(y)); - } + // findLSB + template + GLM_FUNC_QUALIFIER int findLSB + ( + genIUType const & Value + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findLSB' only accept integer values"); + if(Value == 0) + return -1; - template - GLM_FUNC_QUALIFIER detail::tvec2 usubBorrow - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & Borrow - ) - { - return detail::tvec2( - usubBorrow(x[0], y[0], Borrow[0]), - usubBorrow(x[1], y[1], Borrow[1])); - } + genIUType Bit; + for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){} + return Bit; + } - template - GLM_FUNC_QUALIFIER detail::tvec3 usubBorrow - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & Borrow - ) - { - return detail::tvec3( - usubBorrow(x[0], y[0], Borrow[0]), - usubBorrow(x[1], y[1], Borrow[1]), - usubBorrow(x[2], y[2], Borrow[2])); - } + template + GLM_FUNC_QUALIFIER detail::tvec2 findLSB + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + findLSB(value[0]), + findLSB(value[1])); + } - template - GLM_FUNC_QUALIFIER detail::tvec4 usubBorrow - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & Borrow - ) - { - return detail::tvec4( - usubBorrow(x[0], y[0], Borrow[0]), - usubBorrow(x[1], y[1], Borrow[1]), - usubBorrow(x[2], y[2], Borrow[2]), - usubBorrow(x[3], y[3], Borrow[3])); - } + template + GLM_FUNC_QUALIFIER detail::tvec3 findLSB + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + findLSB(value[0]), + findLSB(value[1]), + findLSB(value[2])); + } - // umulExtended - template - GLM_FUNC_QUALIFIER void umulExtended - ( - genUType const & x, - genUType const & y, - genUType & msb, - genUType & lsb - ) - { - detail::highp_uint_t ValueX64 = x; - detail::highp_uint_t ValueY64 = y; - detail::highp_uint_t Value64 = ValueX64 * ValueY64; - msb = *(genUType*)&genUType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); - lsb = *(genUType*)&genUType(Value64 >> detail::highp_uint_t(32)); - } + template + GLM_FUNC_QUALIFIER detail::tvec4 findLSB + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + findLSB(value[0]), + findLSB(value[1]), + findLSB(value[2]), + findLSB(value[3])); + } - template - GLM_FUNC_QUALIFIER detail::tvec2 umulExtended - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & msb, - detail::tvec2 & lsb - ) - { - return detail::tvec2( - umulExtended(x[0], y[0], msb, lsb), - umulExtended(x[1], y[1], msb, lsb)); - } + // findMSB + template + GLM_FUNC_QUALIFIER int findMSB + ( + genIUType const & Value + ) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findMSB' only accept integer values"); + if(Value == 0) + return -1; - template - GLM_FUNC_QUALIFIER detail::tvec3 umulExtended - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & msb, - detail::tvec3 & lsb - ) - { - return detail::tvec3( - umulExtended(x[0], y[0], msb, lsb), - umulExtended(x[1], y[1], msb, lsb), - umulExtended(x[2], y[2], msb, lsb)); - } + genIUType bit = genIUType(-1); + for(genIUType tmp = Value; tmp; tmp >>= 1, ++bit){} + return bit; + } - template - GLM_FUNC_QUALIFIER detail::tvec4 umulExtended - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & msb, - detail::tvec4 & lsb - ) - { - return detail::tvec4( - umulExtended(x[0], y[0], msb, lsb), - umulExtended(x[1], y[1], msb, lsb), - umulExtended(x[2], y[2], msb, lsb), - umulExtended(x[3], y[3], msb, lsb)); - } + template + GLM_FUNC_QUALIFIER detail::tvec2 findMSB + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + findMSB(value[0]), + findMSB(value[1])); + } - // imulExtended - template - GLM_FUNC_QUALIFIER void imulExtended - ( - genIType const & x, - genIType const & y, - genIType & msb, - genIType & lsb - ) - { - detail::highp_int_t ValueX64 = x; - detail::highp_int_t ValueY64 = y; - detail::highp_int_t Value64 = ValueX64 * ValueY64; - msb = *(genIType*)&genIType(Value64 & ((detail::highp_uint_t(1) << detail::highp_uint_t(32)) - detail::highp_uint_t(1))); - lsb = *(genIType*)&genIType(Value64 >> detail::highp_uint_t(32)); - } + template + GLM_FUNC_QUALIFIER detail::tvec3 findMSB + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + findMSB(value[0]), + findMSB(value[1]), + findMSB(value[2])); + } - template - GLM_FUNC_QUALIFIER detail::tvec2 imulExtended - ( - detail::tvec2 const & x, - detail::tvec2 const & y, - detail::tvec2 & msb, - detail::tvec2 & lsb - ) - { - return detail::tvec2( - imulExtended(x[0], y[0], msb, lsb), - imulExtended(x[1], y[1], msb, lsb)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 imulExtended - ( - detail::tvec3 const & x, - detail::tvec3 const & y, - detail::tvec3 & msb, - detail::tvec3 & lsb - ) - { - return detail::tvec3( - imulExtended(x[0], y[0], msb, lsb), - imulExtended(x[1], y[1], msb, lsb), - imulExtended(x[2], y[2], msb, lsb)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 imulExtended - ( - detail::tvec4 const & x, - detail::tvec4 const & y, - detail::tvec4 & msb, - detail::tvec4 & lsb - ) - { - return detail::tvec4( - imulExtended(x[0], y[0], msb, lsb), - imulExtended(x[1], y[1], msb, lsb), - imulExtended(x[2], y[2], msb, lsb), - imulExtended(x[3], y[3], msb, lsb)); - } - - // bitfieldExtract - template - GLM_FUNC_QUALIFIER genIUType bitfieldExtract - ( - genIUType const & Value, - int const & Offset, - int const & Bits - ) - { - int GenSize = int(sizeof(genIUType)) << int(3); - - assert(Offset + Bits <= GenSize); - - genIUType ShiftLeft = Bits ? Value << (GenSize - (Bits + Offset)) : genIUType(0); - genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Bits); - - return ShiftBack; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 bitfieldExtract - ( - detail::tvec2 const & Value, - int const & Offset, - int const & Bits - ) - { - return detail::tvec2( - bitfieldExtract(Value[0]), - bitfieldExtract(Value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 bitfieldExtract - ( - detail::tvec3 const & Value, - int const & Offset, - int const & Bits - ) - { - return detail::tvec3( - bitfieldExtract(Value[0]), - bitfieldExtract(Value[1]), - bitfieldExtract(Value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 bitfieldExtract - ( - detail::tvec4 const & Value, - int const & Offset, - int const & Bits - ) - { - return detail::tvec4( - bitfieldExtract(Value[0]), - bitfieldExtract(Value[1]), - bitfieldExtract(Value[2]), - bitfieldExtract(Value[3])); - } - - // bitfieldInsert - template - GLM_FUNC_QUALIFIER genIUType bitfieldInsert - ( - genIUType const & Base, - genIUType const & Insert, - int const & Offset, - int const & Bits - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldInsert' only accept integer values"); - assert(Offset + Bits <= sizeof(genIUType)); - - if(Bits == 0) - return Base; - - genIUType Mask = 0; - for(int Bit = Offset; Bit < Offset + Bits; ++Bit) - Mask |= (1 << Bit); - - return (Base & ~Mask) | (Insert & Mask); - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 bitfieldInsert - ( - detail::tvec2 const & Base, - detail::tvec2 const & Insert, - int const & Offset, - int const & Bits - ) - { - return detail::tvec2( - bitfieldInsert(Base[0], Insert[0], Offset, Bits), - bitfieldInsert(Base[1], Insert[1], Offset, Bits)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 bitfieldInsert - ( - detail::tvec3 const & Base, - detail::tvec3 const & Insert, - int const & Offset, - int const & Bits - ) - { - return detail::tvec3( - bitfieldInsert(Base[0], Insert[0], Offset, Bits), - bitfieldInsert(Base[1], Insert[1], Offset, Bits), - bitfieldInsert(Base[2], Insert[2], Offset, Bits)); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 bitfieldInsert - ( - detail::tvec4 const & Base, - detail::tvec4 const & Insert, - int const & Offset, - int const & Bits - ) - { - return detail::tvec4( - bitfieldInsert(Base[0], Insert[0], Offset, Bits), - bitfieldInsert(Base[1], Insert[1], Offset, Bits), - bitfieldInsert(Base[2], Insert[2], Offset, Bits), - bitfieldInsert(Base[3], Insert[3], Offset, Bits)); - } - - // bitfieldReverse - template - GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldReverse' only accept integer values"); - - genIUType Out = 0; - std::size_t BitSize = sizeof(genIUType) * 8; - for(std::size_t i = 0; i < BitSize; ++i) - if(Value & (genIUType(1) << i)) - Out |= genIUType(1) << (BitSize - 1 - i); - return Out; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 bitfieldReverse - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - bitfieldReverse(value[0]), - bitfieldReverse(value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 bitfieldReverse - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - bitfieldReverse(value[0]), - bitfieldReverse(value[1]), - bitfieldReverse(value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 bitfieldReverse - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - bitfieldReverse(value[0]), - bitfieldReverse(value[1]), - bitfieldReverse(value[2]), - bitfieldReverse(value[3])); - } - - // bitCount - template - GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitCount' only accept integer values"); - - int Count = 0; - for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i) - { - if(Value & (1 << i)) - ++Count; - } - return Count; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 bitCount - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - bitCount(value[0]), - bitCount(value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 bitCount - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - bitCount(value[0]), - bitCount(value[1]), - bitCount(value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 bitCount - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - bitCount(value[0]), - bitCount(value[1]), - bitCount(value[2]), - bitCount(value[3])); - } - - // findLSB - template - GLM_FUNC_QUALIFIER int findLSB - ( - genIUType const & Value - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findLSB' only accept integer values"); - if(Value == 0) - return -1; - - genIUType Bit; - for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){} - return Bit; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 findLSB - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - findLSB(value[0]), - findLSB(value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 findLSB - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - findLSB(value[0]), - findLSB(value[1]), - findLSB(value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 findLSB - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - findLSB(value[0]), - findLSB(value[1]), - findLSB(value[2]), - findLSB(value[3])); - } - - // findMSB - template - GLM_FUNC_QUALIFIER int findMSB - ( - genIUType const & Value - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'findMSB' only accept integer values"); - if(Value == 0) - return -1; - - genIUType bit = genIUType(-1); - for(genIUType tmp = Value; tmp; tmp >>= 1, ++bit){} - return bit; - } - - template - GLM_FUNC_QUALIFIER detail::tvec2 findMSB - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - findMSB(value[0]), - findMSB(value[1])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec3 findMSB - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - findMSB(value[0]), - findMSB(value[1]), - findMSB(value[2])); - } - - template - GLM_FUNC_QUALIFIER detail::tvec4 findMSB - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - findMSB(value[0]), - findMSB(value[1]), - findMSB(value[2]), - findMSB(value[3])); - } - - }//namespace integer - }//namespace function - }//namespace core + template + GLM_FUNC_QUALIFIER detail::tvec4 findMSB + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + findMSB(value[0]), + findMSB(value[1]), + findMSB(value[2]), + findMSB(value[3])); + } }//namespace glm diff --git a/glm/core/func_matrix.hpp b/glm/core/func_matrix.hpp index 14f0b91d..d50bbc13 100644 --- a/glm/core/func_matrix.hpp +++ b/glm/core/func_matrix.hpp @@ -1,111 +1,130 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-03 -// Updated : 2010-02-04 -// Licence : This source is under MIT License -// File : glm/core/func_matrix.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_matrix.hpp +/// @date 2008-08-03 / 2011-06-15 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.20.8 specification, section 8.6 +/// +/// @defgroup core_func_matrix Matrix functions +/// @ingroup core +/// +/// For each of the following built-in matrix functions, there is both a +/// single-precision floating point version, where all arguments and return values +/// are single precision, and a double-precision floating version, where all +/// arguments and return values are double precision. Only the single-precision +/// floating point version is shown. +/////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_matrix -#define glm_core_func_matrix +#ifndef GLM_CORE_func_matrix +#define GLM_CORE_func_matrix GLM_VERSION namespace glm { - namespace core{ - namespace function{ - //! Define all matrix functions from Section 8.5 of GLSL 1.30.8 specification. Included in glm namespace. - namespace matrix{ + /// @addtogroup core_func_matrix + /// @{ - /// \addtogroup core_funcs - ///@{ - - //! Multiply matrix x by matrix y component-wise, i.e., - //! result[i][j] is the scalar product of x[i][j] and y[i][j]. - //! - //! \li GLSL matrixCompMult man page - //! \li GLSL 1.30.08 specification, section 8.5 + /// Multiply matrix x by matrix y component-wise, i.e., + /// result[i][j] is the scalar product of x[i][j] and y[i][j]. + /// + /// @see - GLSL matrixCompMult man page + /// @see - GLSL 4.20.8 specification, section 8.6 template matType matrixCompMult( matType const & x, matType const & y); - //! Treats the first parameter c as a column vector - //! and the second parameter r as a row vector - //! and does a linear algebraic matrix multiply c * r. - //! - //! \li GLSL outerProduct man page - //! \li GLSL 1.30.08 specification, section 8.5 + /// Treats the first parameter c as a column vector + /// and the second parameter r as a row vector + /// and does a linear algebraic matrix multiply c * r. + /// + /// @see - GLSL outerProduct man page + /// @see - GLSL 4.20.8 specification, section 8.6 template matType outerProduct( vecType const & c, vecType const & r); - //! Returns the transposed matrix of x - //! - //! \li GLSL transpose man page - //! \li GLSL 1.30.08 specification, section 8.5 + /// Returns the transposed matrix of x + /// + /// @see - GLSL transpose man page + /// @see - GLSL 4.20.8 specification, section 8.6 template typename matType::transpose_type transpose( matType const & x); - //! Return the determinant of a mat2 matrix. - //! - //! \li GLSL determinant man page - //! \li GLSL 1.30.08 specification, section 8.5 + /// Return the determinant of a mat2 matrix. + /// + /// @see - GLSL determinant man page + /// @see - GLSL 4.20.8 specification, section 8.6 template typename detail::tmat2x2::value_type determinant( detail::tmat2x2 const & m); - //! Return the determinant of a mat3 matrix. - //! - //! \li GLSL determinant man page - //! \li GLSL 1.30.08 specification, section 8.5 + /// Return the determinant of a mat3 matrix. + /// + /// @see - GLSL determinant man page + /// @see - GLSL 4.20.8 specification, section 8.6 template typename detail::tmat3x3::value_type determinant( detail::tmat3x3 const & m); - //! Return the determinant of a mat4 matrix. - //! - //! \li GLSL determinant man page - //! \li GLSL 1.30.08 specification, section 8.5 + /// Return the determinant of a mat4 matrix. + /// + /// @see - GLSL determinant man page + /// @see - GLSL 4.20.8 specification, section 8.6 template typename detail::tmat4x4::value_type determinant( detail::tmat4x4 const & m); - //! Return the inverse of a mat2 matrix. - //! - //! \li GLSL inverse man page - //! \li GLSL 1.40.07 specification, section 8.5 + /// Return the inverse of a mat2 matrix. + /// + /// @see - GLSL inverse man page + /// @see - GLSL 4.20.8 specification, section 8.6 template detail::tmat2x2 inverse( detail::tmat2x2 const & m); - //! Return the inverse of a mat3 matrix. - //! - //! \li GLSL inverse man page - //! \li GLSL 1.40.07 specification, section 8.5 + /// Return the inverse of a mat3 matrix. + /// + /// @see - GLSL inverse man page + /// @see - GLSL 4.20.8 specification, section 8.6 template detail::tmat3x3 inverse( detail::tmat3x3 const & m); - //! Return the inverse of a mat4 matrix. - //! - //! \li GLSL inverse man page - //! \li GLSL 1.40.07 specification, section 8.5 + /// Return the inverse of a mat4 matrix. + /// + /// @see - GLSL inverse man page + /// @see - GLSL 4.20.8 specification, section 8.6 template detail::tmat4x4 inverse( detail::tmat4x4 const & m); - ///@} - - }//namespace matrix - }//namespace function - }//namespace core - - using namespace core::function::matrix; + /// @} }//namespace glm #include "func_matrix.inl" -#endif//glm_core_func_matrix +#endif//GLM_CORE_func_matrix diff --git a/glm/core/func_matrix.inl b/glm/core/func_matrix.inl index d775d96b..07bf8e2b 100644 --- a/glm/core/func_matrix.inl +++ b/glm/core/func_matrix.inl @@ -1,42 +1,57 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-03-08 -// Updated : 2010-02-04 -// Licence : This source is under MIT License -// File : glm/core/func_matrix.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_matrix.inl +/// @date 2008-03-08 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// namespace glm { - namespace core{ - namespace function{ - namespace matrix{ - - // matrixCompMult - template - GLM_FUNC_QUALIFIER matType matrixCompMult + // matrixCompMult + template + GLM_FUNC_QUALIFIER matType matrixCompMult ( matType const & x, matType const & y ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'matrixCompMult' only accept floating-point inputs"); - matType result(matType::null); + matType result(matType::null); for(typename matType::size_type i = 0; i < matType::col_size(); ++i) result[i] = x[i] * y[i]; - return result; - } + return result; + } // outerProduct - template - GLM_FUNC_QUALIFIER detail::tmat2x2 outerProduct + template + GLM_FUNC_QUALIFIER detail::tmat2x2 outerProduct ( detail::tvec2 const & c, detail::tvec2 const & r ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); detail::tmat2x2 m(detail::tmat2x2::null); @@ -44,40 +59,40 @@ namespace glm m[0][1] = c[1] * r[0]; m[1][0] = c[0] * r[1]; m[1][1] = c[1] * r[1]; - return m; - } + return m; + } - template - GLM_FUNC_QUALIFIER detail::tmat3x3 outerProduct + template + GLM_FUNC_QUALIFIER detail::tmat3x3 outerProduct ( detail::tvec3 const & c, detail::tvec3 const & r ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); detail::tmat3x3 m(detail::tmat3x3::null); for(typename detail::tmat3x3::size_type i = 0; i < detail::tmat3x3::col_size(); ++i) m[i] = c * r[i]; - return m; - } + return m; + } - template - GLM_FUNC_QUALIFIER detail::tmat4x4 outerProduct + template + GLM_FUNC_QUALIFIER detail::tmat4x4 outerProduct ( detail::tvec4 const & c, detail::tvec4 const & r ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); detail::tmat4x4 m(detail::tmat4x4::null); for(typename detail::tmat4x4::size_type i = 0; i < detail::tmat4x4::col_size(); ++i) m[i] = c * r[i]; - return m; - } + return m; + } - template + template GLM_FUNC_QUALIFIER detail::tmat2x3 outerProduct ( detail::tvec3 const & c, @@ -96,7 +111,7 @@ namespace glm return m; } - template + template GLM_FUNC_QUALIFIER detail::tmat3x2 outerProduct ( detail::tvec2 const & c, @@ -207,113 +222,113 @@ namespace glm return m; } - template - GLM_FUNC_QUALIFIER detail::tmat2x2 transpose + template + GLM_FUNC_QUALIFIER detail::tmat2x2 transpose ( detail::tmat2x2 const & m ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - detail::tmat2x2 result(detail::tmat2x2::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - return result; - } + detail::tmat2x2 result(detail::tmat2x2::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + return result; + } - template - GLM_FUNC_QUALIFIER detail::tmat3x3 transpose + template + GLM_FUNC_QUALIFIER detail::tmat3x3 transpose ( detail::tmat3x3 const & m ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - detail::tmat3x3 result(detail::tmat3x3::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; + detail::tmat3x3 result(detail::tmat3x3::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - return result; - } + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[2][2] = m[2][2]; + return result; + } - template - GLM_FUNC_QUALIFIER detail::tmat4x4 transpose + template + GLM_FUNC_QUALIFIER detail::tmat4x4 transpose ( detail::tmat4x4 const & m ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - detail::tmat4x4 result(detail::tmat4x4::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[0][2] = m[2][0]; - result[0][3] = m[3][0]; + detail::tmat4x4 result(detail::tmat4x4::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[0][2] = m[2][0]; + result[0][3] = m[3][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[1][2] = m[2][1]; - result[1][3] = m[3][1]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[1][2] = m[2][1]; + result[1][3] = m[3][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[2][2] = m[2][2]; - result[2][3] = m[3][2]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[2][2] = m[2][2]; + result[2][3] = m[3][2]; - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - result[3][2] = m[2][3]; - result[3][3] = m[3][3]; - return result; - } + result[3][0] = m[0][3]; + result[3][1] = m[1][3]; + result[3][2] = m[2][3]; + result[3][3] = m[3][3]; + return result; + } - template - GLM_FUNC_QUALIFIER detail::tmat2x3 transpose + template + GLM_FUNC_QUALIFIER detail::tmat2x3 transpose ( detail::tmat3x2 const & m ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - detail::tmat2x3 result(detail::tmat2x3::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; + detail::tmat2x3 result(detail::tmat2x3::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; result[0][2] = m[2][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; result[1][2] = m[2][1]; - return result; - } + return result; + } - template - GLM_FUNC_QUALIFIER detail::tmat3x2 transpose + template + GLM_FUNC_QUALIFIER detail::tmat3x2 transpose ( detail::tmat2x3 const & m ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - detail::tmat3x2 result(detail::tmat3x2::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - return result; - } + detail::tmat3x2 result(detail::tmat3x2::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + return result; + } - template + template GLM_FUNC_QUALIFIER detail::tmat2x4 transpose ( detail::tmat4x2 const & m @@ -322,18 +337,18 @@ namespace glm GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); detail::tmat2x4 result(detail::tmat2x4::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; result[0][2] = m[2][0]; result[0][3] = m[3][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; result[1][2] = m[2][1]; result[1][3] = m[3][1]; return result; } - template + template GLM_FUNC_QUALIFIER detail::tmat4x2 transpose ( detail::tmat2x4 const & m @@ -341,19 +356,19 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - detail::tmat4x2 result(detail::tmat4x2::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; - return result; + detail::tmat4x2 result(detail::tmat4x2::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[3][0] = m[0][3]; + result[3][1] = m[1][3]; + return result; } - template + template GLM_FUNC_QUALIFIER detail::tmat3x4 transpose ( detail::tmat4x3 const & m @@ -362,22 +377,22 @@ namespace glm GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); detail::tmat3x4 result(detail::tmat3x4::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; result[0][2] = m[2][0]; result[0][3] = m[3][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; result[1][2] = m[2][1]; result[1][3] = m[3][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; result[2][2] = m[2][2]; result[2][3] = m[3][2]; return result; } - template + template GLM_FUNC_QUALIFIER detail::tmat4x3 transpose ( detail::tmat3x4 const & m @@ -385,20 +400,20 @@ namespace glm { GLM_STATIC_ASSERT(detail::type::is_float, "'transpose' only accept floating-point inputs"); - detail::tmat4x3 result(detail::tmat4x3::null); - result[0][0] = m[0][0]; - result[0][1] = m[1][0]; + detail::tmat4x3 result(detail::tmat4x3::null); + result[0][0] = m[0][0]; + result[0][1] = m[1][0]; result[0][2] = m[2][0]; - result[1][0] = m[0][1]; - result[1][1] = m[1][1]; + result[1][0] = m[0][1]; + result[1][1] = m[1][1]; result[1][2] = m[2][1]; - result[2][0] = m[0][2]; - result[2][1] = m[1][2]; + result[2][0] = m[0][2]; + result[2][1] = m[1][2]; result[2][2] = m[2][2]; - result[3][0] = m[0][3]; - result[3][1] = m[1][3]; + result[3][0] = m[0][3]; + result[3][1] = m[1][3]; result[3][2] = m[2][3]; - return result; + return result; } template @@ -448,9 +463,9 @@ namespace glm - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05)); return m[0][0] * DetCof[0] - + m[0][1] * DetCof[1] - + m[0][2] * DetCof[2] - + m[0][3] * DetCof[3]; + + m[0][1] * DetCof[1] + + m[0][2] * DetCof[2] + + m[0][3] * DetCof[3]; } template @@ -564,8 +579,4 @@ namespace glm return Inverse; } - - }//namespace matrix - }//namespace function - }//namespace core }//namespace glm diff --git a/glm/core/func_noise.hpp b/glm/core/func_noise.hpp index 181ccee6..5e095af2 100644 --- a/glm/core/func_noise.hpp +++ b/glm/core/func_noise.hpp @@ -1,60 +1,77 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-01 -// Updated : 2008-09-10 -// Licence : This source is under MIT License -// File : glm/core/func_noise.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_noise.hpp +/// @date 2008-08-01 / 2011-06-18 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.20.8 specification, section 8.13 +/// +/// @defgroup core_func_noise Noise functions +/// @ingroup core +/// +/// Noise functions are stochastic functions that can be used to increase visual +/// complexity. Values returned by the following noise functions give the +/// appearance of randomness, but are not truly random. +/////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_noise -#define glm_core_func_noise +#define glm_core_func_noise GLM_VERSION namespace glm { - namespace core{ - namespace function{ - // Define all noise functions from Section 8.9 of GLSL 1.30.8 specification. Included in glm namespace. - namespace noise{ + /// @addtogroup core_func_noise + /// @{ - /// \addtogroup core_funcs - ///@{ - - //! Returns a 1D noise value based on the input value x. - //! - //! \li GLSL noise1 man page - //! \li GLSL 1.30.08 specification, section 8.9 + /// Returns a 1D noise value based on the input value x. + /// + /// @see - GLSL noise1 man page + /// @see - GLSL 4.20.8 specification, section 8.13 template typename genType::value_type noise1(genType const & x); - //! Returns a 2D noise value based on the input value x. - //! - //! \li GLSL noise2 man page - //! \li GLSL 1.30.08 specification, section 8.9 + /// Returns a 2D noise value based on the input value x. + /// + /// @see - GLSL noise2 man page + /// @see - GLSL 4.20.8 specification, section 8.13 template detail::tvec2 noise2(genType const & x); - //! Returns a 3D noise value based on the input value x. - //! - //! \li GLSL noise3 man page - //! \li GLSL 1.30.08 specification, section 8.9 + /// Returns a 3D noise value based on the input value x. + /// + /// @see - GLSL noise3 man page + /// @see - GLSL 4.20.8 specification, section 8.13 template detail::tvec3 noise3(genType const & x); - //! Returns a 4D noise value based on the input value x. - //! - //! \li GLSL noise4 man page - //! \li GLSL 1.30.08 specification, section 8.9 + /// Returns a 4D noise value based on the input value x. + /// + /// @see - GLSL noise4 man page + /// @see - GLSL 4.20.8 specification, section 8.13 template detail::tvec4 noise4(genType const & x); - ///@} - - }//namespace noise - }//namespace function - }//namespace core - - using namespace core::function::noise; + /// @} }//namespace glm #include "func_noise.inl" diff --git a/glm/core/func_noise.inl b/glm/core/func_noise.inl index 8e009643..d53fb299 100644 --- a/glm/core/func_noise.inl +++ b/glm/core/func_noise.inl @@ -1,21 +1,32 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-01 -// Updated : 2011-04-14 -// Licence : This source is under MIT License -// File : glm/core/func_noise.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_noise.inl +/// @date 2008-08-01 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// namespace glm { - namespace core{ - namespace function{ - namespace noise{ - - - }//namespace noise - }//namespace function - }//namespace core }//namespace glm diff --git a/glm/core/func_packing.hpp b/glm/core/func_packing.hpp index 8f589e69..1588463e 100644 --- a/glm/core/func_packing.hpp +++ b/glm/core/func_packing.hpp @@ -1,132 +1,194 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2010-03-17 -// Updated : 2010-03-17 -// Licence : This source is under MIT License -// File : glm/core/func_packing.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_packing.hpp +/// @date 2010-03-17 / 2011-06-15 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.20.8 specification, section 8.4 +/// +/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions +/// @ingroup core +/// +/// These functions do not operate component-wise, rather as described in each case. +/////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_packing -#define glm_core_func_packing +#ifndef GLM_CORE_func_packing +#define GLM_CORE_func_packing GLM_VERSION namespace glm -{ - namespace core{ - namespace function{ - //! Define packing functions from section 8.4 floating-point pack and unpack functions of GLSL 4.00.8 specification - namespace packing - { - /// \addtogroup core_funcs - ///@{ +{ + /// @addtogroup core_func_packing + /// @{ - //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. - //! Then, the results are packed into the returned 32-bit unsigned integer. - //! - //! The conversion for component c of v to fixed point is done as follows: - //! packUnorm2x16: round(clamp(c, 0, +1) * 65535.0) - //! - //! The first component of the vector will be written to the least significant bits of the output; - //! the last component will be written to the most significant bits. - //! - //! \li GLSL packUnorm2x16 man page - //! \li GLSL 4.00.08 specification, section 8.4 - detail::uint32 packUnorm2x16(detail::tvec2 const & v); + //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. + //! Then, the results are packed into the returned 32-bit unsigned integer. + //! + //! The conversion for component c of v to fixed point is done as follows: + //! packUnorm2x16: round(clamp(c, 0, +1) * 65535.0) + //! + //! The first component of the vector will be written to the least significant bits of the output; + //! the last component will be written to the most significant bits. + //! + /// @see - GLSL packUnorm2x16 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::uint32 packUnorm2x16(detail::tvec2 const & v); + + //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. + //! Then, the results are packed into the returned 32-bit unsigned integer. + //! + //! The conversion for component c of v to fixed point is done as follows: + //! packSnorm2x16: round(clamp(v, -1, +1) * 32767.0) + //! + //! The first component of the vector will be written to the least significant bits of the output; + //! the last component will be written to the most significant bits. + //! + /// @see - GLSL packSnorm2x16 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::uint32 packSnorm2x16(detail::tvec2 const & v); + + //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. + //! Then, the results are packed into the returned 32-bit unsigned integer. + //! + //! The conversion for component c of v to fixed point is done as follows: + //! packUnorm4x8: round(clamp(c, 0, +1) * 255.0) + //! + //! The first component of the vector will be written to the least significant bits of the output; + //! the last component will be written to the most significant bits. + //! + /// @see - GLSL packUnorm4x8 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::uint32 packUnorm4x8(detail::tvec4 const & v); - //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. - //! Then, the results are packed into the returned 32-bit unsigned integer. - //! - //! The conversion for component c of v to fixed point is done as follows: - //! packUnorm4x8: round(clamp(c, 0, +1) * 255.0) - //! - //! The first component of the vector will be written to the least significant bits of the output; - //! the last component will be written to the most significant bits. - //! - //! \li GLSL packUnorm4x8 man page - //! \li GLSL 4.00.08 specification, section 8.4 - detail::uint32 packUnorm4x8(detail::tvec4 const & v); + //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. + //! Then, the results are packed into the returned 32-bit unsigned integer. + //! + //! The conversion for component c of v to fixed point is done as follows: + //! packSnorm4x8: round(clamp(c, -1, +1) * 127.0) + //! + //! The first component of the vector will be written to the least significant bits of the output; + //! the last component will be written to the most significant bits. + //! + /// @see - GLSL packSnorm4x8 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::uint32 packSnorm4x8(detail::tvec4 const & v); + + //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. + //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. + //! + //! The conversion for unpacked fixed-point value f to floating point is done as follows: + //! unpackUnorm2x16: f / 65535.0 + //! + //! The first component of the returned vector will be extracted from the least significant bits of the input; + //! the last component will be extracted from the most significant bits. + //! + /// @see - GLSL unpackUnorm2x16 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::tvec2 unpackUnorm2x16(detail::uint32 const & p); + + //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. + //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. + //! + //! The conversion for unpacked fixed-point value f to floating point is done as follows: + //! unpackSnorm2x16: clamp(f / 32767.0, -1, +1) + //! + //! The first component of the returned vector will be extracted from the least significant bits of the input; + //! the last component will be extracted from the most significant bits. + //! + /// @see - GLSL unpackSnorm2x16 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::tvec2 unpackSnorm2x16(detail::uint32 const & p); + + /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. + /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. + /// + /// The conversion for unpacked fixed-point value f to floating point is done as follows: + /// unpackUnorm4x8: f / 255.0 + /// + /// The first component of the returned vector will be extracted from the least significant bits of the input; + /// the last component will be extracted from the most significant bits. + /// + /// @see - GLSL unpackUnorm4x8 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::tvec4 unpackUnorm4x8(detail::uint32 const & p); - //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. - //! Then, the results are packed into the returned 32-bit unsigned integer. - //! - //! The conversion for component c of v to fixed point is done as follows: - //! packSnorm4x8: round(clamp(c, -1, +1) * 127.0) - //! - //! The first component of the vector will be written to the least significant bits of the output; - //! the last component will be written to the most significant bits. - //! - //! \li GLSL packSnorm4x8 man page - //! \li GLSL 4.00.08 specification, section 8.4 - detail::uint32 packSnorm4x8(detail::tvec4 const & v); + /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. + /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. + /// + /// The conversion for unpacked fixed-point value f to floating point is done as follows: + /// unpackSnorm4x8: clamp(f / 127.0, -1, +1) + /// + /// The first component of the returned vector will be extracted from the least significant bits of the input; + /// the last component will be extracted from the most significant bits. + /// + /// @see - GLSL unpackSnorm4x8 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::tvec4 unpackSnorm4x8(detail::uint32 const & p); - //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. - //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. - //! - //! The conversion for unpacked fixed-point value f to floating point is done as follows: - //! unpackUnorm2x16: f / 65535.0 - //! - //! The first component of the returned vector will be extracted from the least significant bits of the input; - //! the last component will be extracted from the most significant bits. - //! - //! \li GLSL unpackUnorm2x16 man page - //! \li GLSL 4.00.08 specification, section 8.4 - detail::tvec2 unpackUnorm2x16(detail::uint32 const & p); - - //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. - //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. - //! - //! The conversion for unpacked fixed-point value f to floating point is done as follows: - //! unpackUnorm4x8: f / 255.0 - //! - //! The first component of the returned vector will be extracted from the least significant bits of the input; - //! the last component will be extracted from the most significant bits. - //! - //! \li GLSL unpackUnorm4x8 man page - //! \li GLSL 4.00.08 specification, section 8.4 - detail::tvec4 unpackUnorm4x8(detail::uint32 const & p); + /// Returns a double-precision value obtained by packing the components of v into a 64-bit value. + /// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. + /// Otherwise, the bit- level representation of v is preserved. + /// The first vector component specifies the 32 least significant bits; + /// the second component specifies the 32 most significant bits. + /// + /// @see - GLSL packDouble2x32 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + double packDouble2x32(detail::tvec2 const & v); - //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. - //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. - //! - //! The conversion for unpacked fixed-point value f to floating point is done as follows: - //! unpackSnorm4x8: clamp(f / 127.0, -1, +1) - //! - //! The first component of the returned vector will be extracted from the least significant bits of the input; - //! the last component will be extracted from the most significant bits. - //! - //! \li GLSL unpackSnorm4x8 man page - //! \li GLSL 4.00.08 specification, section 8.4 - detail::tvec4 unpackSnorm4x8(detail::uint32 const & p); + /// Returns a two-component unsigned integer vector representation of v. + /// The bit-level representation of v is preserved. + /// The first component of the vector contains the 32 least significant bits of the double; + /// the second component consists the 32 most significant bits. + /// + /// @see - GLSL unpackDouble2x32 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + detail::tvec2 unpackDouble2x32(double const & v); - //! Returns a double-precision value obtained by packing the components of v into a 64-bit value. - //! If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. - //! Otherwise, the bit- level representation of v is preserved. - //! The first vector component specifies the 32 least significant bits; - //! the second component specifies the 32 most significant bits. - //! - //! \li GLSL packDouble2x32 man page - //! \li GLSL 4.00.08 specification, section 8.4 - double packDouble2x32(detail::tvec2 const & v); - - //! Returns a two-component unsigned integer vector representation of v. - //! The bit-level representation of v is preserved. - //! The first component of the vector contains the 32 least significant bits of the double; - //! the second component consists the 32 most significant bits. - //! - //! \li GLSL unpackDouble2x32 man page - //! \li GLSL 4.00.08 specification, section 8.4 - detail::tvec2 unpackDouble2x32(double const & v); - - ///@} - - }//namespace packing - }//namespace function - }//namespace core - - using namespace core::function::packing; + + /// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector + /// to the 16-bit floating-point representation found in the OpenGL Specification, + /// and then packing these two 16- bit integers into a 32-bit unsigned integer. + /// The first vector component specifies the 16 least-significant bits of the result; + /// the second component specifies the 16 most-significant bits. + /// + /// @see - GLSL packHalf2x16 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + uint packHalf2x16(vec2 const & v); + + /// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values, + /// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification, + /// and converting them to 32-bit floating-point values. + /// The first component of the vector is obtained from the 16 least-significant bits of v; + /// the second component is obtained from the 16 most-significant bits of v. + /// + /// @see - GLSL unpackHalf2x16 man page + /// @see - GLSL 4.20.8 specification, section 8.4 + vec2 unpackHalf2x16(uint const & v); + + /// @} }//namespace glm #include "func_packing.inl" -#endif//glm_core_func_packing +#endif//GLM_CORE_func_packing diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl index 1e6ce6fa..f30f9844 100644 --- a/glm/core/func_packing.inl +++ b/glm/core/func_packing.inl @@ -1,16 +1,32 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2010-03-17 -// Updated : 2010-03-17 -// Licence : This source is under MIT License -// File : glm/core/func_packing.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_packing.inl +/// @date 2010-03-17 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// namespace glm{ -namespace core{ -namespace function{ -namespace packing{ GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2 const & v) { @@ -140,7 +156,4 @@ GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) return vec2(detail::toFloat32(Unpack.x), detail::toFloat32(Unpack.y)); } -}//namespace packing -}//namespace function -}//namespace core }//namespace glm diff --git a/glm/core/func_trigonometric.hpp b/glm/core/func_trigonometric.hpp index aa34ebe7..f6e7c98d 100644 --- a/glm/core/func_trigonometric.hpp +++ b/glm/core/func_trigonometric.hpp @@ -1,61 +1,84 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-01 -// Updated : 2008-09-10 -// Licence : This source is under MIT License -// File : glm/core/func_trigonometric.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_trigonometric.hpp +/// @date 2008-08-01 / 2011-06-15 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.20.8 specification, section 8.1 +/// +/// @defgroup core_func_trigonometric Angle and Trigonometry Functions +/// @ingroup core +/// +/// Function parameters specified as angle are assumed to be in units of radians. +/// In no case will any of these functions result in a divide by zero error. If +/// the divisor of a ratio is 0, then results will be undefined. +/// +/// These all operate component-wise. The description is per component. +/////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_trigonometric -#define glm_core_func_trigonometric +#ifndef GLM_CORE_func_trigonometric +#define GLM_CORE_func_trigonometric GLM_VERSION namespace glm { - namespace core{ - namespace function{ - //! Define Angle and trigonometry functions - //! from Section 8.1 of GLSL 1.30.8 specification. - //! Included in glm namespace. - namespace trigonometric{ - - /// \addtogroup core_funcs - ///@{ + /// @addtogroup core_func_trigonometric + /// @{ //! Converts degrees to radians and returns the result. //! - //! \li GLSL radians man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL radians man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType radians(genType const & degrees); //! Converts radians to degrees and returns the result. //! - //! \li GLSL degrees man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL degrees man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType degrees(genType const & radians); //! The standard trigonometric sine function. //! The values returned by this function will range from [-1, 1]. //! - //! \li GLSL sin man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL sin man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType sin(genType const & angle); //! The standard trigonometric cosine function. //! The values returned by this function will range from [-1, 1]. //! - //! \li GLSL cos man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL cos man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType cos(genType const & angle); //! The standard trigonometric tangent function. //! - //! \li GLSL tan man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL tan man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType tan(genType const & angle); @@ -63,8 +86,8 @@ namespace glm //! The range of values returned by this function is [-PI/2, PI/2]. //! Results are undefined if |x| > 1. //! - //! \li GLSL asin man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL asin man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType asin(genType const & x); @@ -72,8 +95,8 @@ namespace glm //! The range of values returned by this function is [0, PI]. //! Results are undefined if |x| > 1. //! - //! \li GLSL acos man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL acos man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType acos(genType const & x); @@ -83,74 +106,68 @@ namespace glm //! by this function is [-PI, PI]. Results are undefined //! if x and y are both 0. //! - //! \li GLSL atan man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL atan man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType atan(genType const & y, genType const & x); //! Arc tangent. Returns an angle whose tangent is y_over_x. //! The range of values returned by this function is [-PI/2, PI/2]. //! - //! \li GLSL atan man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL atan man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType atan(genType const & y_over_x); //! Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 //! - //! \li GLSL sinh man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL sinh man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType sinh(genType const & angle); //! Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 //! - //! \li GLSL cosh man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL cosh man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType cosh(genType const & angle); //! Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) //! - //! \li GLSL tanh man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL tanh man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType tanh(genType const & angle); //! Arc hyperbolic sine; returns the inverse of sinh. //! - //! \li GLSL asinh man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL asinh man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType asinh(genType const & x); //! Arc hyperbolic cosine; returns the non-negative inverse //! of cosh. Results are undefined if x < 1. //! - //! \li GLSL acosh man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL acosh man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType acosh(genType const & x); //! Arc hyperbolic tangent; returns the inverse of tanh. //! Results are undefined if abs(x) >= 1. //! - //! \li GLSL atanh man page - //! \li GLSL 1.30.08 specification, section 8.1 + /// @see - GLSL atanh man page + /// @see - GLSL 4.20.8 specification, section 8.1 template genType atanh(genType const & x); - ///@} - - }//namespace trigonometric - }//namespace function - }//namespace core - - using namespace core::function::trigonometric; + /// @} }//namespace glm #include "func_trigonometric.inl" -#endif//glm_core_func_trigonometric +#endif//GLM_CORE_func_trigonometric diff --git a/glm/core/func_trigonometric.inl b/glm/core/func_trigonometric.inl index 05846014..9e83a8fa 100644 --- a/glm/core/func_trigonometric.inl +++ b/glm/core/func_trigonometric.inl @@ -1,745 +1,757 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-03 -// Updated : 2008-09-14 -// Licence : This source is under MIT License -// File : glm/core/func_trigonometric.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_trigonometric.inl +/// @date 2008-08-03 / 2011-06-15 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// -namespace glm +namespace glm{ + +// radians +template +GLM_FUNC_QUALIFIER genType radians +( + genType const & degrees +) { - namespace core{ - namespace function{ - namespace trigonometric{ + GLM_STATIC_ASSERT(detail::type::is_float, "'radians' only accept floating-point input"); - // radians - template - GLM_FUNC_QUALIFIER genType radians - ( - genType const & degrees - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'radians' only accept floating-point input"); + const genType pi = genType(3.1415926535897932384626433832795); + return degrees * (pi / genType(180)); +} - const genType pi = genType(3.1415926535897932384626433832795); - return degrees * (pi / genType(180)); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 radians +( + detail::tvec2 const & degrees +) +{ + return detail::tvec2( + radians(degrees.x), + radians(degrees.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 radians - ( - detail::tvec2 const & degrees - ) - { - return detail::tvec2( - radians(degrees.x), - radians(degrees.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 radians +( + detail::tvec3 const & degrees +) +{ + return detail::tvec3( + radians(degrees.x), + radians(degrees.y), + radians(degrees.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 radians - ( - detail::tvec3 const & degrees - ) - { - return detail::tvec3( - radians(degrees.x), - radians(degrees.y), - radians(degrees.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 radians +( + detail::tvec4 const & degrees +) +{ + return detail::tvec4( + radians(degrees.x), + radians(degrees.y), + radians(degrees.z), + radians(degrees.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 radians - ( - detail::tvec4 const & degrees - ) - { - return detail::tvec4( - radians(degrees.x), - radians(degrees.y), - radians(degrees.z), - radians(degrees.w)); - } +// degrees +template +GLM_FUNC_QUALIFIER genType degrees +( + genType const & radians +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'degrees' only accept floating-point input"); - // degrees - template - GLM_FUNC_QUALIFIER genType degrees - ( - genType const & radians - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'degrees' only accept floating-point input"); + const genType pi = genType(3.1415926535897932384626433832795); + return radians * (genType(180) / pi); +} - const genType pi = genType(3.1415926535897932384626433832795); - return radians * (genType(180) / pi); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 degrees +( + detail::tvec2 const & radians +) +{ + return detail::tvec2( + degrees(radians.x), + degrees(radians.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 degrees - ( - detail::tvec2 const & radians - ) - { - return detail::tvec2( - degrees(radians.x), - degrees(radians.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 degrees +( + detail::tvec3 const & radians +) +{ + return detail::tvec3( + degrees(radians.x), + degrees(radians.y), + degrees(radians.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 degrees - ( - detail::tvec3 const & radians - ) - { - return detail::tvec3( - degrees(radians.x), - degrees(radians.y), - degrees(radians.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 degrees +( + detail::tvec4 const & radians +) +{ + return detail::tvec4( + degrees(radians.x), + degrees(radians.y), + degrees(radians.z), + degrees(radians.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 degrees - ( - detail::tvec4 const & radians - ) - { - return detail::tvec4( - degrees(radians.x), - degrees(radians.y), - degrees(radians.z), - degrees(radians.w)); - } +// sin +template +GLM_FUNC_QUALIFIER genType sin +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'sin' only accept floating-point input"); - // sin - template - GLM_FUNC_QUALIFIER genType sin - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'sin' only accept floating-point input"); + return ::std::sin(angle); +} - return ::std::sin(angle); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 sin +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + sin(angle.x), + sin(angle.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 sin - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - sin(angle.x), - sin(angle.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 sin +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + sin(angle.x), + sin(angle.y), + sin(angle.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 sin - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - sin(angle.x), - sin(angle.y), - sin(angle.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 sin +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + sin(angle.x), + sin(angle.y), + sin(angle.z), + sin(angle.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 sin - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - sin(angle.x), - sin(angle.y), - sin(angle.z), - sin(angle.w)); - } +// cos +template +GLM_FUNC_QUALIFIER genType cos(genType const & angle) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'cos' only accept floating-point input"); - // cos - template - GLM_FUNC_QUALIFIER genType cos(genType const & angle) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'cos' only accept floating-point input"); + return ::std::cos(angle); +} - return ::std::cos(angle); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 cos +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + cos(angle.x), + cos(angle.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 cos - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - cos(angle.x), - cos(angle.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 cos +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + cos(angle.x), + cos(angle.y), + cos(angle.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 cos - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - cos(angle.x), - cos(angle.y), - cos(angle.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 cos +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + cos(angle.x), + cos(angle.y), + cos(angle.z), + cos(angle.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 cos - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - cos(angle.x), - cos(angle.y), - cos(angle.z), - cos(angle.w)); - } +// tan +template +GLM_FUNC_QUALIFIER genType tan +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'tan' only accept floating-point input"); - // tan - template - GLM_FUNC_QUALIFIER genType tan - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'tan' only accept floating-point input"); + return ::std::tan(angle); +} - return ::std::tan(angle); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 tan +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + tan(angle.x), + tan(angle.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 tan - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - tan(angle.x), - tan(angle.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 tan +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + tan(angle.x), + tan(angle.y), + tan(angle.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 tan - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - tan(angle.x), - tan(angle.y), - tan(angle.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 tan +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + tan(angle.x), + tan(angle.y), + tan(angle.z), + tan(angle.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 tan - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - tan(angle.x), - tan(angle.y), - tan(angle.z), - tan(angle.w)); - } +// asin +template +GLM_FUNC_QUALIFIER genType asin +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'asin' only accept floating-point input"); - // asin - template - GLM_FUNC_QUALIFIER genType asin - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'asin' only accept floating-point input"); + return ::std::asin(x); +} - return ::std::asin(x); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 asin +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + asin(x.x), + asin(x.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 asin - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - asin(x.x), - asin(x.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 asin +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + asin(x.x), + asin(x.y), + asin(x.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 asin - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - asin(x.x), - asin(x.y), - asin(x.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 asin +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + asin(x.x), + asin(x.y), + asin(x.z), + asin(x.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 asin - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - asin(x.x), - asin(x.y), - asin(x.z), - asin(x.w)); - } +// acos +template +GLM_FUNC_QUALIFIER genType acos +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'acos' only accept floating-point input"); - // acos - template - GLM_FUNC_QUALIFIER genType acos - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'acos' only accept floating-point input"); + return ::std::acos(x); +} - return ::std::acos(x); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 acos +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + acos(x.x), + acos(x.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 acos - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - acos(x.x), - acos(x.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 acos +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + acos(x.x), + acos(x.y), + acos(x.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 acos - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - acos(x.x), - acos(x.y), - acos(x.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 acos +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + acos(x.x), + acos(x.y), + acos(x.z), + acos(x.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 acos - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - acos(x.x), - acos(x.y), - acos(x.z), - acos(x.w)); - } +// atan +template +GLM_FUNC_QUALIFIER genType atan +( + genType const & y, + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); - // atan - template - GLM_FUNC_QUALIFIER genType atan - ( - genType const & y, - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); + return ::std::atan2(y, x); +} - return ::std::atan2(y, x); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 atan +( + detail::tvec2 const & y, + detail::tvec2 const & x +) +{ + return detail::tvec2( + atan(y.x, x.x), + atan(y.y, x.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 atan - ( - detail::tvec2 const & y, - detail::tvec2 const & x - ) - { - return detail::tvec2( - atan(y.x, x.x), - atan(y.y, x.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 atan +( + detail::tvec3 const & y, + detail::tvec3 const & x +) +{ + return detail::tvec3( + atan(y.x, x.x), + atan(y.y, x.y), + atan(y.z, x.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 atan - ( - detail::tvec3 const & y, - detail::tvec3 const & x - ) - { - return detail::tvec3( - atan(y.x, x.x), - atan(y.y, x.y), - atan(y.z, x.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 atan +( + detail::tvec4 const & y, + detail::tvec4 const & x +) +{ + return detail::tvec4( + atan(y.x, x.x), + atan(y.y, x.y), + atan(y.z, x.z), + atan(y.w, x.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 atan - ( - detail::tvec4 const & y, - detail::tvec4 const & x - ) - { - return detail::tvec4( - atan(y.x, x.x), - atan(y.y, x.y), - atan(y.z, x.z), - atan(y.w, x.w)); - } +template +GLM_FUNC_QUALIFIER genType atan +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); - template - GLM_FUNC_QUALIFIER genType atan - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'atan' only accept floating-point input"); + return ::std::atan(x); +} - return ::std::atan(x); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 atan +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + atan(x.x), + atan(x.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 atan - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - atan(x.x), - atan(x.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 atan +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + atan(x.x), + atan(x.y), + atan(x.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 atan - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - atan(x.x), - atan(x.y), - atan(x.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 atan +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + atan(x.x), + atan(x.y), + atan(x.z), + atan(x.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 atan - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - atan(x.x), - atan(x.y), - atan(x.z), - atan(x.w)); - } +// sinh +template +GLM_FUNC_QUALIFIER genType sinh +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'sinh' only accept floating-point input"); - // sinh - template - GLM_FUNC_QUALIFIER genType sinh - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'sinh' only accept floating-point input"); + return std::sinh(angle); +} - return std::sinh(angle); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 sinh +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + sinh(angle.x), + sinh(angle.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 sinh - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - sinh(angle.x), - sinh(angle.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 sinh +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + sinh(angle.x), + sinh(angle.y), + sinh(angle.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 sinh - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - sinh(angle.x), - sinh(angle.y), - sinh(angle.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 sinh +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + sinh(angle.x), + sinh(angle.y), + sinh(angle.z), + sinh(angle.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 sinh - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - sinh(angle.x), - sinh(angle.y), - sinh(angle.z), - sinh(angle.w)); - } +// cosh +template +GLM_FUNC_QUALIFIER genType cosh +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'cosh' only accept floating-point input"); - // cosh - template - GLM_FUNC_QUALIFIER genType cosh - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'cosh' only accept floating-point input"); + return std::cosh(angle); +} - return std::cosh(angle); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 cosh +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + cosh(angle.x), + cosh(angle.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 cosh - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - cosh(angle.x), - cosh(angle.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 cosh +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + cosh(angle.x), + cosh(angle.y), + cosh(angle.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 cosh - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - cosh(angle.x), - cosh(angle.y), - cosh(angle.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 cosh +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + cosh(angle.x), + cosh(angle.y), + cosh(angle.z), + cosh(angle.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 cosh - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - cosh(angle.x), - cosh(angle.y), - cosh(angle.z), - cosh(angle.w)); - } +// tanh +template +GLM_FUNC_QUALIFIER genType tanh +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'tanh' only accept floating-point input"); - // tanh - template - GLM_FUNC_QUALIFIER genType tanh - ( - genType const & angle - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'tanh' only accept floating-point input"); + return std::tanh(angle); +} - return std::tanh(angle); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 tanh +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + tanh(angle.x), + tanh(angle.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 tanh - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - tanh(angle.x), - tanh(angle.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 tanh +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + tanh(angle.x), + tanh(angle.y), + tanh(angle.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 tanh - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - tanh(angle.x), - tanh(angle.y), - tanh(angle.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 tanh +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + tanh(angle.x), + tanh(angle.y), + tanh(angle.z), + tanh(angle.w)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 tanh - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - tanh(angle.x), - tanh(angle.y), - tanh(angle.z), - tanh(angle.w)); - } - - // asinh - template - GLM_FUNC_QUALIFIER genType asinh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'asinh' only accept floating-point input"); +// asinh +template +GLM_FUNC_QUALIFIER genType asinh +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'asinh' only accept floating-point input"); - return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x)); - } + return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 asinh - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - asinh(x.x), - asinh(x.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 asinh +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + asinh(x.x), + asinh(x.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 asinh - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - asinh(x.x), - asinh(x.y), - asinh(x.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 asinh +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + asinh(x.x), + asinh(x.y), + asinh(x.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 asinh - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - asinh(x.x), - asinh(x.y), - asinh(x.z), - asinh(x.w)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 asinh +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + asinh(x.x), + asinh(x.y), + asinh(x.z), + asinh(x.w)); +} - // acosh - template - GLM_FUNC_QUALIFIER genType acosh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'acosh' only accept floating-point input"); +// acosh +template +GLM_FUNC_QUALIFIER genType acosh +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'acosh' only accept floating-point input"); - if(x < genType(1)) - return genType(0); - return log(x + sqrt(x * x - genType(1))); - } + if(x < genType(1)) + return genType(0); + return log(x + sqrt(x * x - genType(1))); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 acosh - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - acosh(x.x), - acosh(x.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 acosh +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + acosh(x.x), + acosh(x.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 acosh - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - acosh(x.x), - acosh(x.y), - acosh(x.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 acosh +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + acosh(x.x), + acosh(x.y), + acosh(x.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 acosh - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - acosh(x.x), - acosh(x.y), - acosh(x.z), - acosh(x.w)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 acosh +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + acosh(x.x), + acosh(x.y), + acosh(x.z), + acosh(x.w)); +} - // atanh - template - GLM_FUNC_QUALIFIER genType atanh - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'atanh' only accept floating-point input"); +// atanh +template +GLM_FUNC_QUALIFIER genType atanh +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float, "'atanh' only accept floating-point input"); - if(abs(x) >= genType(1)) - return 0; - return genType(0.5) * log((genType(1) + x) / (genType(1) - x)); - } + if(abs(x) >= genType(1)) + return 0; + return genType(0.5) * log((genType(1) + x) / (genType(1) - x)); +} - template - GLM_FUNC_QUALIFIER detail::tvec2 atanh - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - atanh(x.x), - atanh(x.y)); - } +template +GLM_FUNC_QUALIFIER detail::tvec2 atanh +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + atanh(x.x), + atanh(x.y)); +} - template - GLM_FUNC_QUALIFIER detail::tvec3 atanh - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - atanh(x.x), - atanh(x.y), - atanh(x.z)); - } +template +GLM_FUNC_QUALIFIER detail::tvec3 atanh +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + atanh(x.x), + atanh(x.y), + atanh(x.z)); +} - template - GLM_FUNC_QUALIFIER detail::tvec4 atanh - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - atanh(x.x), - atanh(x.y), - atanh(x.z), - atanh(x.w)); - } +template +GLM_FUNC_QUALIFIER detail::tvec4 atanh +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + atanh(x.x), + atanh(x.y), + atanh(x.z), + atanh(x.w)); +} - }//namespace trigonometric - }//namespace function - }//namespace core }//namespace glm diff --git a/glm/core/func_vector_relational.hpp b/glm/core/func_vector_relational.hpp index ffdc1a26..a3cce581 100644 --- a/glm/core/func_vector_relational.hpp +++ b/glm/core/func_vector_relational.hpp @@ -1,215 +1,120 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-03 -// Updated : 2008-09-09 -// Licence : This source is under MIT License -// File : glm/core/func_vector_relational.hpp -/////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/func_vector_relational.hpp +/// @date 2008-08-03 / 2011-06-15 +/// @author Christophe Riccio +/// +/// @see - GLSL 4.10.6 specification, section 8.7 +/// +/// @defgroup core_func_vector_relational Vector Relational Functions +/// @ingroup core +/// +/// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to +/// operate on scalars and produce scalar Boolean results. For vector results, +/// use the following built-in functions. +/// +/// In all cases, the sizes of all the input and return vectors for any particular +/// call must match. +/////////////////////////////////////////////////////////////////////////////////// -#ifndef glm_core_func_vector_relational -#define glm_core_func_vector_relational +#ifndef GLM_CORE_func_vector_relational +#define GLM_CORE_func_vector_relational GLM_VERSION #include "_detail.hpp" namespace glm { - namespace core{ - namespace function{ - //! Define vector relational functions from Section 8.6 of GLSL 1.30.8 specification. - //! Included in glm namespace. - namespace vector_relational - { - /// \addtogroup core_funcs - ///@{ + /// @addtogroup core_func_vector_relational + /// @{ - //! Returns the component-wise comparison result of x < y. - //! - //! \li GLSL lessThan man page - //! \li GLSL 1.30.08 specification, section 8.6 - template class vecType> - GLM_FUNC_QUALIFIER typename vecType::bool_type lessThan - ( - vecType const & x, - vecType const & y - ) - { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, - "Invalid template instantiation of 'lessThan', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, - "Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors"); + //! Returns the component-wise comparison result of x < y. + //! + /// @see - GLSL lessThan man page + /// @see - GLSL 4.20.8 specification, section 8.7 + //template class vecType> + //GLM_FUNC_QUALIFIER typename vecType::bool_type lessThan(vecType const & x, vecType const & y); - typename vecType::bool_type Result(vecType::null); - for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) - Result[i] = x[i] < y[i]; + //! Returns the component-wise comparison of result x <= y. + //! + /// @see - GLSL lessThanEqual man page + /// @see - GLSL 4.20.8 specification, section 8.7 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y); - return Result; - } + //! Returns the component-wise comparison of result x > y. + //! + /// @see - GLSL greaterThan man page + /// @see - GLSL 4.20.8 specification, section 8.7 + template class vecType> + GLM_FUNC_QUALIFIER typename vecType::bool_type greaterThan(vecType const & x, vecType const & y); - //! Returns the component-wise comparison of result x <= y. - //! - //! \li GLSL lessThanEqual man page - //! \li GLSL 1.30.08 specification, section 8.6 - template class vecType> - GLM_FUNC_QUALIFIER typename vecType::bool_type lessThanEqual - ( - vecType const & x, - vecType const & y - ) - { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, - "Invalid template instantiation of 'lessThanEqual', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, - "Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors"); + //! Returns the component-wise comparison of result x >= y. + //! + /// @see - GLSL greaterThanEqual man page + /// @see - GLSL 4.20.8 specification, section 8.7 + template class vecType> + typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y); - typename vecType::bool_type Result(vecType::null); - for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) - Result[i] = x[i] <= y[i]; - return Result; - } + //! Returns the component-wise comparison of result x == y. + //! + /// @see - GLSL equal man page + /// @see - GLSL 4.20.8 specification, section 8.7 + //template class vecType> + //GLM_FUNC_QUALIFIER typename vecType::bool_type equal(vecType const & x, vecType const & y); - //! Returns the component-wise comparison of result x > y. - //! - //! \li GLSL greaterThan man page - //! \li GLSL 1.30.08 specification, section 8.6 - template class vecType> - GLM_FUNC_QUALIFIER typename vecType::bool_type greaterThan - ( - vecType const & x, - vecType const & y - ) - { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, - "Invalid template instantiation of 'greaterThan', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, - "Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors"); + //! Returns the component-wise comparison of result x != y. + //! + /// @see - GLSL notEqual man page + /// @see - GLSL 4.20.8 specification, section 8.7 + template class vecType> + typename vecType::bool_type notEqual(vecType const & x, vecType const & y); - typename vecType::bool_type Result(vecType::null); - for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) - Result[i] = x[i] > y[i]; - return Result; - } + //! Returns true if any component of x is true. + //! + /// @see - GLSL any man page + /// @see - GLSL 4.20.8 specification, section 8.7 + template