From 5f60e288dbf679beba082e4d3197db598b17d9ef Mon Sep 17 00:00:00 2001 From: "spartanj@gmail.com" Date: Fri, 23 Nov 2012 02:08:05 -0300 Subject: [PATCH] Striped down GLM as much as i could and updated to the lastest version. Removed some Clang compiler warnings. --- Makefile.base | 4 +- include/eepp/audio/csoundstream.hpp | 2 +- include/eepp/graphics/ctexturefont.hpp | 2 +- include/eepp/helper/glew/glxew.h | 2 +- include/eepp/helper/glm/core/_detail.hpp | 183 +- include/eepp/helper/glm/core/_fixes.hpp | 53 +- include/eepp/helper/glm/core/_swizzle.hpp | 1819 +++++------- include/eepp/helper/glm/core/_swizzle.inl | 20 - include/eepp/helper/glm/core/dummy.cpp | 20 - include/eepp/helper/glm/core/func_common.hpp | 443 ++- include/eepp/helper/glm/core/func_common.inl | 1549 ++++------ .../eepp/helper/glm/core/func_exponential.hpp | 135 +- .../eepp/helper/glm/core/func_exponential.inl | 405 +-- .../eepp/helper/glm/core/func_geometric.hpp | 155 +- .../eepp/helper/glm/core/func_geometric.inl | 296 +- include/eepp/helper/glm/core/func_integer.hpp | 146 - include/eepp/helper/glm/core/func_integer.inl | 600 ---- include/eepp/helper/glm/core/func_matrix.hpp | 189 +- include/eepp/helper/glm/core/func_matrix.inl | 353 +-- include/eepp/helper/glm/core/func_noise.hpp | 58 - include/eepp/helper/glm/core/func_noise.inl | 305 -- include/eepp/helper/glm/core/func_packing.hpp | 50 - include/eepp/helper/glm/core/func_packing.inl | 94 - .../helper/glm/core/func_trigonometric.hpp | 221 +- .../helper/glm/core/func_trigonometric.inl | 759 +---- .../glm/core/func_vector_relational.hpp | 200 -- .../glm/core/func_vector_relational.inl | 20 - include/eepp/helper/glm/core/hint.hpp | 37 +- .../eepp/helper/glm/core/intrinsic_common.hpp | 70 - .../eepp/helper/glm/core/intrinsic_common.inl | 273 -- .../helper/glm/core/intrinsic_exponential.hpp | 60 - .../helper/glm/core/intrinsic_exponential.inl | 0 .../helper/glm/core/intrinsic_geometric.hpp | 57 - .../helper/glm/core/intrinsic_geometric.inl | 123 - .../eepp/helper/glm/core/intrinsic_matrix.hpp | 50 - .../eepp/helper/glm/core/intrinsic_matrix.inl | 1087 ------- .../glm/core/intrinsic_trigonometric.hpp | 29 - .../glm/core/intrinsic_trigonometric.inl | 0 .../glm/core/intrinsic_vector_relational.hpp | 29 - .../glm/core/intrinsic_vector_relational.inl | 347 --- include/eepp/helper/glm/core/setup.hpp | 568 +++- include/eepp/helper/glm/core/type.hpp | 361 +-- include/eepp/helper/glm/core/type_float.hpp | 121 +- include/eepp/helper/glm/core/type_gentype.hpp | 35 +- include/eepp/helper/glm/core/type_gentype.inl | 347 --- include/eepp/helper/glm/core/type_half.hpp | 146 +- include/eepp/helper/glm/core/type_half.inl | 192 +- include/eepp/helper/glm/core/type_int.hpp | 204 +- include/eepp/helper/glm/core/type_mat.hpp | 35 +- include/eepp/helper/glm/core/type_mat.inl | 27 + include/eepp/helper/glm/core/type_mat2x2.hpp | 251 -- include/eepp/helper/glm/core/type_mat2x2.inl | 610 ---- include/eepp/helper/glm/core/type_mat2x3.hpp | 218 -- include/eepp/helper/glm/core/type_mat2x3.inl | 541 ---- include/eepp/helper/glm/core/type_mat2x4.hpp | 215 -- include/eepp/helper/glm/core/type_mat2x4.inl | 569 ---- include/eepp/helper/glm/core/type_mat3x2.hpp | 217 -- include/eepp/helper/glm/core/type_mat3x2.inl | 575 ---- include/eepp/helper/glm/core/type_mat3x3.hpp | 250 -- include/eepp/helper/glm/core/type_mat3x3.inl | 704 ----- include/eepp/helper/glm/core/type_mat3x4.hpp | 217 -- include/eepp/helper/glm/core/type_mat3x4.inl | 609 ---- include/eepp/helper/glm/core/type_mat4x2.hpp | 222 -- include/eepp/helper/glm/core/type_mat4x2.inl | 618 ---- include/eepp/helper/glm/core/type_mat4x3.hpp | 222 -- include/eepp/helper/glm/core/type_mat4x3.inl | 623 ---- include/eepp/helper/glm/core/type_mat4x4.hpp | 480 ++-- include/eepp/helper/glm/core/type_mat4x4.inl | 1080 ++++--- include/eepp/helper/glm/core/type_size.hpp | 35 +- include/eepp/helper/glm/core/type_vec.hpp | 35 +- include/eepp/helper/glm/core/type_vec.inl | 27 + include/eepp/helper/glm/core/type_vec1.hpp | 285 +- include/eepp/helper/glm/core/type_vec1.inl | 1611 ++++++----- include/eepp/helper/glm/core/type_vec2.hpp | 512 ++-- include/eepp/helper/glm/core/type_vec2.inl | 1963 ++++++------- include/eepp/helper/glm/core/type_vec3.hpp | 548 ++-- include/eepp/helper/glm/core/type_vec3.inl | 2174 +++++++------- include/eepp/helper/glm/core/type_vec4.hpp | 615 ++-- include/eepp/helper/glm/core/type_vec4.inl | 2529 +++++++++-------- include/eepp/helper/glm/ext.hpp | 94 - include/eepp/helper/glm/glm.hpp | 144 +- include/eepp/helper/glm/gtc/half_float.hpp | 370 --- include/eepp/helper/glm/gtc/half_float.inl | 975 ------- include/eepp/helper/glm/gtc/matrix_access.hpp | 71 - include/eepp/helper/glm/gtc/matrix_access.inl | 59 - .../eepp/helper/glm/gtc/matrix_integer.hpp | 215 -- .../eepp/helper/glm/gtc/matrix_inverse.hpp | 52 - .../eepp/helper/glm/gtc/matrix_inverse.inl | 139 - .../eepp/helper/glm/gtc/matrix_transform.hpp | 395 ++- .../eepp/helper/glm/gtc/matrix_transform.inl | 312 +- include/eepp/helper/glm/gtc/quaternion.hpp | 235 -- include/eepp/helper/glm/gtc/quaternion.inl | 557 ---- include/eepp/helper/glm/gtc/swizzle.hpp | 357 --- include/eepp/helper/glm/gtc/swizzle.inl | 177 -- .../eepp/helper/glm/gtc/type_precision.hpp | 226 -- .../eepp/helper/glm/gtc/type_precision.inl | 13 - include/eepp/helper/glm/gtc/type_ptr.hpp | 435 +-- include/eepp/helper/glm/gtc/type_ptr.inl | 462 +++ .../helper/glm/gtx/associated_min_max.hpp | 91 - .../helper/glm/gtx/associated_min_max.inl | 916 ------ include/eepp/helper/glm/gtx/bit.hpp | 112 - include/eepp/helper/glm/gtx/bit.inl | 743 ----- include/eepp/helper/glm/gtx/closest_point.hpp | 53 - include/eepp/helper/glm/gtx/closest_point.inl | 41 - include/eepp/helper/glm/gtx/color_cast.hpp | 113 - include/eepp/helper/glm/gtx/color_cast.inl | 739 ----- include/eepp/helper/glm/gtx/color_space.hpp | 84 - include/eepp/helper/glm/gtx/color_space.inl | 154 - .../eepp/helper/glm/gtx/color_space_YCoCg.hpp | 71 - .../eepp/helper/glm/gtx/color_space_YCoCg.inl | 69 - include/eepp/helper/glm/gtx/compatibility.hpp | 177 -- include/eepp/helper/glm/gtx/compatibility.inl | 141 - .../eepp/helper/glm/gtx/component_wise.hpp | 70 - .../eepp/helper/glm/gtx/component_wise.inl | 52 - include/eepp/helper/glm/gtx/epsilon.hpp | 64 - include/eepp/helper/glm/gtx/epsilon.inl | 204 -- include/eepp/helper/glm/gtx/euler_angles.hpp | 143 - include/eepp/helper/glm/gtx/euler_angles.inl | 249 -- include/eepp/helper/glm/gtx/extend.hpp | 54 - include/eepp/helper/glm/gtx/extend.inl | 60 - .../eepp/helper/glm/gtx/extented_min_max.hpp | 182 -- .../eepp/helper/glm/gtx/extented_min_max.inl | 182 -- .../eepp/helper/glm/gtx/fast_exponential.hpp | 88 - .../eepp/helper/glm/gtx/fast_exponential.inl | 294 -- .../eepp/helper/glm/gtx/fast_square_root.hpp | 75 - .../eepp/helper/glm/gtx/fast_square_root.inl | 237 -- .../eepp/helper/glm/gtx/fast_trigonometry.hpp | 88 - .../eepp/helper/glm/gtx/fast_trigonometry.inl | 272 -- .../eepp/helper/glm/gtx/gradient_paint.hpp | 57 - .../eepp/helper/glm/gtx/gradient_paint.inl | 44 - .../glm/gtx/handed_coordinate_space.hpp | 58 - .../glm/gtx/handed_coordinate_space.inl | 34 - include/eepp/helper/glm/gtx/inertia.hpp | 98 - include/eepp/helper/glm/gtx/inertia.inl | 103 - .../eepp/helper/glm/gtx/int_10_10_10_2.hpp | 49 - .../eepp/helper/glm/gtx/int_10_10_10_2.inl | 21 - include/eepp/helper/glm/gtx/integer.hpp | 59 - include/eepp/helper/glm/gtx/integer.inl | 90 - include/eepp/helper/glm/gtx/intersect.hpp | 80 - include/eepp/helper/glm/gtx/intersect.inl | 201 -- include/eepp/helper/glm/gtx/log_base.hpp | 53 - include/eepp/helper/glm/gtx/log_base.inl | 92 - .../helper/glm/gtx/matrix_cross_product.hpp | 58 - .../helper/glm/gtx/matrix_cross_product.inl | 44 - .../helper/glm/gtx/matrix_major_storage.hpp | 126 - .../helper/glm/gtx/matrix_major_storage.inl | 176 -- .../eepp/helper/glm/gtx/matrix_operation.hpp | 100 - .../eepp/helper/glm/gtx/matrix_operation.inl | 129 - include/eepp/helper/glm/gtx/matrix_query.hpp | 101 - include/eepp/helper/glm/gtx/matrix_query.inl | 144 - include/eepp/helper/glm/gtx/mixed_product.hpp | 52 - include/eepp/helper/glm/gtx/mixed_product.inl | 36 - include/eepp/helper/glm/gtx/multiple.hpp | 60 - include/eepp/helper/glm/gtx/multiple.inl | 191 -- include/eepp/helper/glm/gtx/norm.hpp | 150 - include/eepp/helper/glm/gtx/norm.inl | 130 - include/eepp/helper/glm/gtx/normal.hpp | 54 - include/eepp/helper/glm/gtx/normal.inl | 27 - include/eepp/helper/glm/gtx/normalize_dot.hpp | 62 - include/eepp/helper/glm/gtx/normalize_dot.inl | 120 - .../eepp/helper/glm/gtx/number_precision.hpp | 70 - .../eepp/helper/glm/gtx/number_precision.inl | 13 - include/eepp/helper/glm/gtx/ocl_type.hpp | 112 - include/eepp/helper/glm/gtx/ocl_type.inl | 0 include/eepp/helper/glm/gtx/optimum_pow.hpp | 77 - include/eepp/helper/glm/gtx/optimum_pow.inl | 63 - .../eepp/helper/glm/gtx/orthonormalize.hpp | 59 - .../eepp/helper/glm/gtx/orthonormalize.inl | 49 - include/eepp/helper/glm/gtx/perpendicular.hpp | 70 - include/eepp/helper/glm/gtx/perpendicular.inl | 40 - .../eepp/helper/glm/gtx/polar_coordinates.hpp | 52 - .../eepp/helper/glm/gtx/polar_coordinates.inl | 42 - include/eepp/helper/glm/gtx/projection.hpp | 67 - include/eepp/helper/glm/gtx/projection.inl | 40 - include/eepp/helper/glm/gtx/quaternion.hpp | 204 -- include/eepp/helper/glm/gtx/quaternion.inl | 251 -- include/eepp/helper/glm/gtx/random.hpp | 90 - include/eepp/helper/glm/gtx/random.inl | 536 ---- include/eepp/helper/glm/gtx/raw_data.hpp | 60 - include/eepp/helper/glm/gtx/raw_data.inl | 11 - include/eepp/helper/glm/gtx/reciprocal.hpp | 106 - include/eepp/helper/glm/gtx/reciprocal.inl | 593 ---- include/eepp/helper/glm/gtx/rotate_vector.hpp | 116 - include/eepp/helper/glm/gtx/rotate_vector.inl | 145 - include/eepp/helper/glm/gtx/simd_mat4.hpp | 187 -- include/eepp/helper/glm/gtx/simd_mat4.inl | 309 -- include/eepp/helper/glm/gtx/simd_vec4.hpp | 477 ---- include/eepp/helper/glm/gtx/simd_vec4.inl | 728 ----- include/eepp/helper/glm/gtx/spline.hpp | 76 - include/eepp/helper/glm/gtx/spline.inl | 68 - .../eepp/helper/glm/gtx/std_based_type.hpp | 78 - .../eepp/helper/glm/gtx/std_based_type.inl | 13 - include/eepp/helper/glm/gtx/string_cast.hpp | 64 - include/eepp/helper/glm/gtx/string_cast.inl | 597 ---- include/eepp/helper/glm/gtx/transform.hpp | 191 +- include/eepp/helper/glm/gtx/transform.inl | 44 +- include/eepp/helper/glm/gtx/transform2.hpp | 125 - include/eepp/helper/glm/gtx/transform2.inl | 159 -- include/eepp/helper/glm/gtx/unsigned_int.hpp | 66 - include/eepp/helper/glm/gtx/unsigned_int.inl | 45 - include/eepp/helper/glm/gtx/vec1.hpp | 128 - include/eepp/helper/glm/gtx/vec1.inl | 0 include/eepp/helper/glm/gtx/vector_access.hpp | 73 - include/eepp/helper/glm/gtx/vector_access.inl | 58 - include/eepp/helper/glm/gtx/vector_angle.hpp | 77 - include/eepp/helper/glm/gtx/vector_angle.inl | 124 - include/eepp/helper/glm/gtx/vector_query.hpp | 102 - include/eepp/helper/glm/gtx/vector_query.inl | 143 - .../eepp/helper/glm/gtx/verbose_operator.hpp | 70 - .../eepp/helper/glm/gtx/verbose_operator.inl | 129 - include/eepp/helper/glm/gtx/wrap.hpp | 61 - include/eepp/helper/glm/gtx/wrap.inl | 173 -- include/eepp/helper/glm/virtrev/xstream.hpp | 148 - projects/linux/ee.creator.user | 50 +- src/eepp/audio/csoundstream.cpp | 2 +- src/test/eetest.hpp | 3 - 216 files changed, 11613 insertions(+), 40562 deletions(-) delete mode 100644 include/eepp/helper/glm/core/_swizzle.inl delete mode 100644 include/eepp/helper/glm/core/dummy.cpp delete mode 100644 include/eepp/helper/glm/core/func_integer.hpp delete mode 100644 include/eepp/helper/glm/core/func_integer.inl delete mode 100644 include/eepp/helper/glm/core/func_noise.hpp delete mode 100644 include/eepp/helper/glm/core/func_noise.inl delete mode 100644 include/eepp/helper/glm/core/func_packing.hpp delete mode 100644 include/eepp/helper/glm/core/func_packing.inl delete mode 100644 include/eepp/helper/glm/core/func_vector_relational.hpp delete mode 100644 include/eepp/helper/glm/core/func_vector_relational.inl delete mode 100644 include/eepp/helper/glm/core/intrinsic_common.hpp delete mode 100644 include/eepp/helper/glm/core/intrinsic_common.inl delete mode 100644 include/eepp/helper/glm/core/intrinsic_exponential.hpp delete mode 100644 include/eepp/helper/glm/core/intrinsic_exponential.inl delete mode 100644 include/eepp/helper/glm/core/intrinsic_geometric.hpp delete mode 100644 include/eepp/helper/glm/core/intrinsic_geometric.inl delete mode 100644 include/eepp/helper/glm/core/intrinsic_matrix.hpp delete mode 100644 include/eepp/helper/glm/core/intrinsic_matrix.inl delete mode 100644 include/eepp/helper/glm/core/intrinsic_trigonometric.hpp delete mode 100644 include/eepp/helper/glm/core/intrinsic_trigonometric.inl delete mode 100644 include/eepp/helper/glm/core/intrinsic_vector_relational.hpp delete mode 100644 include/eepp/helper/glm/core/intrinsic_vector_relational.inl delete mode 100644 include/eepp/helper/glm/core/type_gentype.inl delete mode 100644 include/eepp/helper/glm/core/type_mat2x2.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat2x2.inl delete mode 100644 include/eepp/helper/glm/core/type_mat2x3.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat2x3.inl delete mode 100644 include/eepp/helper/glm/core/type_mat2x4.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat2x4.inl delete mode 100644 include/eepp/helper/glm/core/type_mat3x2.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat3x2.inl delete mode 100644 include/eepp/helper/glm/core/type_mat3x3.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat3x3.inl delete mode 100644 include/eepp/helper/glm/core/type_mat3x4.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat3x4.inl delete mode 100644 include/eepp/helper/glm/core/type_mat4x2.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat4x2.inl delete mode 100644 include/eepp/helper/glm/core/type_mat4x3.hpp delete mode 100644 include/eepp/helper/glm/core/type_mat4x3.inl delete mode 100644 include/eepp/helper/glm/ext.hpp delete mode 100644 include/eepp/helper/glm/gtc/half_float.hpp delete mode 100644 include/eepp/helper/glm/gtc/half_float.inl delete mode 100644 include/eepp/helper/glm/gtc/matrix_access.hpp delete mode 100644 include/eepp/helper/glm/gtc/matrix_access.inl delete mode 100644 include/eepp/helper/glm/gtc/matrix_integer.hpp delete mode 100644 include/eepp/helper/glm/gtc/matrix_inverse.hpp delete mode 100644 include/eepp/helper/glm/gtc/matrix_inverse.inl delete mode 100644 include/eepp/helper/glm/gtc/quaternion.hpp delete mode 100644 include/eepp/helper/glm/gtc/quaternion.inl delete mode 100644 include/eepp/helper/glm/gtc/swizzle.hpp delete mode 100644 include/eepp/helper/glm/gtc/swizzle.inl delete mode 100644 include/eepp/helper/glm/gtc/type_precision.hpp delete mode 100644 include/eepp/helper/glm/gtc/type_precision.inl delete mode 100644 include/eepp/helper/glm/gtx/associated_min_max.hpp delete mode 100644 include/eepp/helper/glm/gtx/associated_min_max.inl delete mode 100644 include/eepp/helper/glm/gtx/bit.hpp delete mode 100644 include/eepp/helper/glm/gtx/bit.inl delete mode 100644 include/eepp/helper/glm/gtx/closest_point.hpp delete mode 100644 include/eepp/helper/glm/gtx/closest_point.inl delete mode 100644 include/eepp/helper/glm/gtx/color_cast.hpp delete mode 100644 include/eepp/helper/glm/gtx/color_cast.inl delete mode 100644 include/eepp/helper/glm/gtx/color_space.hpp delete mode 100644 include/eepp/helper/glm/gtx/color_space.inl delete mode 100644 include/eepp/helper/glm/gtx/color_space_YCoCg.hpp delete mode 100644 include/eepp/helper/glm/gtx/color_space_YCoCg.inl delete mode 100644 include/eepp/helper/glm/gtx/compatibility.hpp delete mode 100644 include/eepp/helper/glm/gtx/compatibility.inl delete mode 100644 include/eepp/helper/glm/gtx/component_wise.hpp delete mode 100644 include/eepp/helper/glm/gtx/component_wise.inl delete mode 100644 include/eepp/helper/glm/gtx/epsilon.hpp delete mode 100644 include/eepp/helper/glm/gtx/epsilon.inl delete mode 100644 include/eepp/helper/glm/gtx/euler_angles.hpp delete mode 100644 include/eepp/helper/glm/gtx/euler_angles.inl delete mode 100644 include/eepp/helper/glm/gtx/extend.hpp delete mode 100644 include/eepp/helper/glm/gtx/extend.inl delete mode 100644 include/eepp/helper/glm/gtx/extented_min_max.hpp delete mode 100644 include/eepp/helper/glm/gtx/extented_min_max.inl delete mode 100644 include/eepp/helper/glm/gtx/fast_exponential.hpp delete mode 100644 include/eepp/helper/glm/gtx/fast_exponential.inl delete mode 100644 include/eepp/helper/glm/gtx/fast_square_root.hpp delete mode 100644 include/eepp/helper/glm/gtx/fast_square_root.inl delete mode 100644 include/eepp/helper/glm/gtx/fast_trigonometry.hpp delete mode 100644 include/eepp/helper/glm/gtx/fast_trigonometry.inl delete mode 100644 include/eepp/helper/glm/gtx/gradient_paint.hpp delete mode 100644 include/eepp/helper/glm/gtx/gradient_paint.inl delete mode 100644 include/eepp/helper/glm/gtx/handed_coordinate_space.hpp delete mode 100644 include/eepp/helper/glm/gtx/handed_coordinate_space.inl delete mode 100644 include/eepp/helper/glm/gtx/inertia.hpp delete mode 100644 include/eepp/helper/glm/gtx/inertia.inl delete mode 100644 include/eepp/helper/glm/gtx/int_10_10_10_2.hpp delete mode 100644 include/eepp/helper/glm/gtx/int_10_10_10_2.inl delete mode 100644 include/eepp/helper/glm/gtx/integer.hpp delete mode 100644 include/eepp/helper/glm/gtx/integer.inl delete mode 100644 include/eepp/helper/glm/gtx/intersect.hpp delete mode 100644 include/eepp/helper/glm/gtx/intersect.inl delete mode 100644 include/eepp/helper/glm/gtx/log_base.hpp delete mode 100644 include/eepp/helper/glm/gtx/log_base.inl delete mode 100644 include/eepp/helper/glm/gtx/matrix_cross_product.hpp delete mode 100644 include/eepp/helper/glm/gtx/matrix_cross_product.inl delete mode 100644 include/eepp/helper/glm/gtx/matrix_major_storage.hpp delete mode 100644 include/eepp/helper/glm/gtx/matrix_major_storage.inl delete mode 100644 include/eepp/helper/glm/gtx/matrix_operation.hpp delete mode 100644 include/eepp/helper/glm/gtx/matrix_operation.inl delete mode 100644 include/eepp/helper/glm/gtx/matrix_query.hpp delete mode 100644 include/eepp/helper/glm/gtx/matrix_query.inl delete mode 100644 include/eepp/helper/glm/gtx/mixed_product.hpp delete mode 100644 include/eepp/helper/glm/gtx/mixed_product.inl delete mode 100644 include/eepp/helper/glm/gtx/multiple.hpp delete mode 100644 include/eepp/helper/glm/gtx/multiple.inl delete mode 100644 include/eepp/helper/glm/gtx/norm.hpp delete mode 100644 include/eepp/helper/glm/gtx/norm.inl delete mode 100644 include/eepp/helper/glm/gtx/normal.hpp delete mode 100644 include/eepp/helper/glm/gtx/normal.inl delete mode 100644 include/eepp/helper/glm/gtx/normalize_dot.hpp delete mode 100644 include/eepp/helper/glm/gtx/normalize_dot.inl delete mode 100644 include/eepp/helper/glm/gtx/number_precision.hpp delete mode 100644 include/eepp/helper/glm/gtx/number_precision.inl delete mode 100644 include/eepp/helper/glm/gtx/ocl_type.hpp delete mode 100644 include/eepp/helper/glm/gtx/ocl_type.inl delete mode 100644 include/eepp/helper/glm/gtx/optimum_pow.hpp delete mode 100644 include/eepp/helper/glm/gtx/optimum_pow.inl delete mode 100644 include/eepp/helper/glm/gtx/orthonormalize.hpp delete mode 100644 include/eepp/helper/glm/gtx/orthonormalize.inl delete mode 100644 include/eepp/helper/glm/gtx/perpendicular.hpp delete mode 100644 include/eepp/helper/glm/gtx/perpendicular.inl delete mode 100644 include/eepp/helper/glm/gtx/polar_coordinates.hpp delete mode 100644 include/eepp/helper/glm/gtx/polar_coordinates.inl delete mode 100644 include/eepp/helper/glm/gtx/projection.hpp delete mode 100644 include/eepp/helper/glm/gtx/projection.inl delete mode 100644 include/eepp/helper/glm/gtx/quaternion.hpp delete mode 100644 include/eepp/helper/glm/gtx/quaternion.inl delete mode 100644 include/eepp/helper/glm/gtx/random.hpp delete mode 100644 include/eepp/helper/glm/gtx/random.inl delete mode 100644 include/eepp/helper/glm/gtx/raw_data.hpp delete mode 100644 include/eepp/helper/glm/gtx/raw_data.inl delete mode 100644 include/eepp/helper/glm/gtx/reciprocal.hpp delete mode 100644 include/eepp/helper/glm/gtx/reciprocal.inl delete mode 100644 include/eepp/helper/glm/gtx/rotate_vector.hpp delete mode 100644 include/eepp/helper/glm/gtx/rotate_vector.inl delete mode 100644 include/eepp/helper/glm/gtx/simd_mat4.hpp delete mode 100644 include/eepp/helper/glm/gtx/simd_mat4.inl delete mode 100644 include/eepp/helper/glm/gtx/simd_vec4.hpp delete mode 100644 include/eepp/helper/glm/gtx/simd_vec4.inl delete mode 100644 include/eepp/helper/glm/gtx/spline.hpp delete mode 100644 include/eepp/helper/glm/gtx/spline.inl delete mode 100644 include/eepp/helper/glm/gtx/std_based_type.hpp delete mode 100644 include/eepp/helper/glm/gtx/std_based_type.inl delete mode 100644 include/eepp/helper/glm/gtx/string_cast.hpp delete mode 100644 include/eepp/helper/glm/gtx/string_cast.inl delete mode 100644 include/eepp/helper/glm/gtx/transform2.hpp delete mode 100644 include/eepp/helper/glm/gtx/transform2.inl delete mode 100644 include/eepp/helper/glm/gtx/unsigned_int.hpp delete mode 100644 include/eepp/helper/glm/gtx/unsigned_int.inl delete mode 100644 include/eepp/helper/glm/gtx/vec1.hpp delete mode 100644 include/eepp/helper/glm/gtx/vec1.inl delete mode 100644 include/eepp/helper/glm/gtx/vector_access.hpp delete mode 100644 include/eepp/helper/glm/gtx/vector_access.inl delete mode 100644 include/eepp/helper/glm/gtx/vector_angle.hpp delete mode 100644 include/eepp/helper/glm/gtx/vector_angle.inl delete mode 100644 include/eepp/helper/glm/gtx/vector_query.hpp delete mode 100644 include/eepp/helper/glm/gtx/vector_query.inl delete mode 100644 include/eepp/helper/glm/gtx/verbose_operator.hpp delete mode 100644 include/eepp/helper/glm/gtx/verbose_operator.inl delete mode 100644 include/eepp/helper/glm/gtx/wrap.hpp delete mode 100644 include/eepp/helper/glm/gtx/wrap.inl delete mode 100644 include/eepp/helper/glm/virtrev/xstream.hpp diff --git a/Makefile.base b/Makefile.base index 2dd32c9fa..3f7005d74 100644 --- a/Makefile.base +++ b/Makefile.base @@ -82,7 +82,7 @@ endif export AR = $(TOOLCHAINPATH)ar -ifeq ($(LLVM_BUILD), yes) +ifeq ($(CLANG_BUILD), yes) export CC = $(TOOLCHAINPATH)clang export CPP = $(TOOLCHAINPATH)clang++ @@ -128,7 +128,7 @@ ifeq ($(DEBUGBUILD), yes) DEBUGFLAGS = -g -DDEBUG -DEE_DEBUG -DEE_MEMORY_MANAGER RELEASETYPE = debug else - ifeq ($(LLVM_BUILD), yes) + ifeq ($(CLANG_BUILD), yes) DEBUGFLAGS = -fno-strict-aliasing -O3 -DNDEBUG -ffast-math else DEBUGFLAGS = -fno-strict-aliasing -O3 -s -DNDEBUG -ffast-math diff --git a/include/eepp/audio/csoundstream.hpp b/include/eepp/audio/csoundstream.hpp index ff044280c..0bc998df6 100755 --- a/include/eepp/audio/csoundstream.hpp +++ b/include/eepp/audio/csoundstream.hpp @@ -40,7 +40,7 @@ class EE_API cSoundStream : private cThread, private cSound { Uint32 PlayingOffset() const; - void PlayingOffset( Uint32 timeOffset ); + void PlayingOffset( const Uint32& timeOffset ); /** Set the stream loop state. This parameter is disabled by default * @param Loop True to play in loop, false to play once diff --git a/include/eepp/graphics/ctexturefont.hpp b/include/eepp/graphics/ctexturefont.hpp index 34c9b5968..692b30fb0 100755 --- a/include/eepp/graphics/ctexturefont.hpp +++ b/include/eepp/graphics/ctexturefont.hpp @@ -55,7 +55,7 @@ class EE_API cTextureFont : public cFont { bool LoadFromStream( const Uint32& TexId, cIOStream& IOS, const bool& VerticalDraw ); private: - eeUint mBase, mStartChar, mTexColumns, mTexRows, mSpacing, mNumChars; + eeUint mStartChar, mTexColumns, mTexRows, mSpacing, mNumChars; eeFloat mtX, mtY, mFWidth, mFHeight; bool mLoadedCoords; diff --git a/include/eepp/helper/glew/glxew.h b/include/eepp/helper/glew/glxew.h index 2995318f6..ee483fed5 100644 --- a/include/eepp/helper/glew/glxew.h +++ b/include/eepp/helper/glew/glxew.h @@ -97,7 +97,7 @@ #include #include #include -#include +#include "glew.h" #ifdef __cplusplus extern "C" { diff --git a/include/eepp/helper/glm/core/_detail.hpp b/include/eepp/helper/glm/core/_detail.hpp index 8f1beae5a..00c29253e 100644 --- a/include/eepp/helper/glm/core/_detail.hpp +++ b/include/eepp/helper/glm/core/_detail.hpp @@ -1,49 +1,67 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 { - class thalf; + class half; -#if(GLM_COMPILER & GLM_COMPILER_VC) +#if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available + typedef int64_t sint64; + typedef uint64_t uint64; +#elif(GLM_COMPILER & GLM_COMPILER_VC) typedef signed __int64 sint64; typedef unsigned __int64 uint64; -#elif(GLM_COMPILER & GLM_COMPILER_GCC) +#elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG)) __extension__ typedef signed long long sint64; __extension__ typedef unsigned long long uint64; -//# if GLM_MODEL == GLM_MODEL_64 -// typedef signed long highp_int_t; -// typedef unsigned long highp_uint_t; -//# elif GLM_MODEL == GLM_MODEL_32 -// __extension__ typedef signed long long highp_int_t; -// __extension__ typedef unsigned long long highp_uint_t; -//# endif//GLM_MODEL #elif(GLM_COMPILER & GLM_COMPILER_BC) typedef Int64 sint64; typedef Uint64 uint64; #else//unknown compiler - typedef signed long sint64; - typedef unsigned long uint64; + typedef signed long long sint64; + typedef unsigned long long uint64; #endif//GLM_COMPILER template struct If { template - static inline T apply(F functor, const T& val) + static GLM_FUNC_QUALIFIER T apply(F functor, const T& val) { return functor(val); } @@ -53,7 +71,7 @@ namespace detail struct If { template - static inline T apply(F, const T& val) + static GLM_FUNC_QUALIFIER T apply(F, const T& val) { return val; } @@ -114,15 +132,15 @@ namespace detail union uif32 { - uif32() : + GLM_FUNC_QUALIFIER uif32() : i(0) {} - uif32(float f) : + GLM_FUNC_QUALIFIER uif32(float f) : f(f) {} - uif32(unsigned int i) : + GLM_FUNC_QUALIFIER uif32(unsigned int i) : i(i) {} @@ -132,15 +150,15 @@ namespace detail union uif64 { - uif64() : + GLM_FUNC_QUALIFIER uif64() : i(0) {} - uif64(double f) : + GLM_FUNC_QUALIFIER uif64(double f) : f(f) {} - uif64(uint64 i) : + GLM_FUNC_QUALIFIER uif64(uint64 i) : i(i) {} @@ -224,6 +242,11 @@ namespace detail }; \ } + GLM_DETAIL_IS_FLOAT(detail::half); + GLM_DETAIL_IS_FLOAT(float); + GLM_DETAIL_IS_FLOAT(double); + GLM_DETAIL_IS_FLOAT(long double); + ////////////////// // bool @@ -309,23 +332,108 @@ 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 detail::half float16; typedef float float32; typedef double float64; + + ////////////////// + // float_or_int_trait + + struct float_or_int_value + { + enum + { + GLM_ERROR, + GLM_FLOAT, + GLM_INT + }; + }; + + template + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_ERROR}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_FLOAT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_FLOAT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_FLOAT}; + }; }//namespace detail }//namespace glm @@ -336,7 +444,8 @@ namespace detail # define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct # define GLM_RESTRICT __declspec(restrict) # define GLM_RESTRICT_VAR __restrict -#elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) +# define GLM_CONSTEXPR +#elif((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) # define GLM_DEPRECATED __attribute__((__deprecated__)) # define GLM_ALIGN(x) __attribute__((aligned(x))) # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) @@ -349,12 +458,18 @@ namespace detail # endif # define GLM_RESTRICT __restrict__ # define GLM_RESTRICT_VAR __restrict__ +# if((GLM_COMPILER >= GLM_COMPILER_GCC47) && ((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X)) +# define GLM_CONSTEXPR constexpr +# else +# define GLM_CONSTEXPR +# endif #else # define GLM_DEPRECATED # define GLM_ALIGN # define GLM_ALIGNED_STRUCT(x) # define GLM_RESTRICT # define GLM_RESTRICT_VAR +# define GLM_CONSTEXPR #endif//GLM_COMPILER #endif//glm_core_detail diff --git a/include/eepp/helper/glm/core/_fixes.hpp b/include/eepp/helper/glm/core/_fixes.hpp index 50631b59c..420a3225b 100644 --- a/include/eepp/helper/glm/core/_fixes.hpp +++ b/include/eepp/helper/glm/core/_fixes.hpp @@ -1,11 +1,32 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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-11-22 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#include //! Workaround for compatibility with other libraries #ifdef max @@ -16,3 +37,19 @@ #ifdef min #undef min #endif + +//! Workaround for Android +#ifdef isnan +#undef isnan +#endif + +//! Workaround for Android +#ifdef isinf +#undef isinf +#endif + +//! Workaround for Chrone Native Client +#ifdef log2 +#undef log2 +#endif + diff --git a/include/eepp/helper/glm/core/_swizzle.hpp b/include/eepp/helper/glm/core/_swizzle.hpp index 04c85a029..65443b161 100644 --- a/include/eepp/helper/glm/core/_swizzle.hpp +++ b/include/eepp/helper/glm/core/_swizzle.hpp @@ -1,15 +1,36 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 +#include "_swizzle_func.hpp" + namespace glm { enum comp @@ -29,1057 +50,787 @@ namespace glm }; }//namespace glm -#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE)) +namespace glm{ +namespace detail +{ + // Internal class for implementing swizzle operators + template + struct _swizzle_base0 + { + typedef T value_type; -#define xx swizzle(glm::X, glm::X) -#define yx swizzle(glm::Y, glm::X) -#define zx swizzle(glm::Z, glm::X) -#define wx swizzle(glm::W, glm::X) -#define xy swizzle(glm::X, glm::Y) -#define yy swizzle(glm::Y, glm::Y) -#define zy swizzle(glm::Z, glm::Y) -#define wy swizzle(glm::W, glm::Y) -#define xz swizzle(glm::X, glm::Z) -#define yz swizzle(glm::Y, glm::Z) -#define zz swizzle(glm::Z, glm::Z) -#define wz swizzle(glm::W, glm::Z) -#define xw swizzle(glm::X, glm::W) -#define yw swizzle(glm::Y, glm::W) -#define zw swizzle(glm::Z, glm::W) -#define ww swizzle(glm::W, glm::W) + protected: + value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } + const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } -#endif + // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. + // The size 1 buffer is assumed to aligned to the actual members so that the + // elem() + char _buffer[1]; + }; -#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE)) + template + struct _swizzle_base1 : public _swizzle_base0 + { + }; -#define rr swizzle(glm::X, glm::X) -#define gr swizzle(glm::Y, glm::X) -#define br swizzle(glm::Z, glm::X) -#define ar swizzle(glm::W, glm::X) -#define rg swizzle(glm::X, glm::Y) -#define gg swizzle(glm::Y, glm::Y) -#define bg swizzle(glm::Z, glm::Y) -#define ag swizzle(glm::W, glm::Y) -#define rb swizzle(glm::X, glm::Z) -#define gb swizzle(glm::Y, glm::Z) -#define bb swizzle(glm::Z, glm::Z) -#define ab swizzle(glm::W, glm::Z) -#define ra swizzle(glm::X, glm::W) -#define ga swizzle(glm::Y, glm::W) -#define ba swizzle(glm::Z, glm::W) -#define aa swizzle(glm::W, glm::W) + template + struct _swizzle_base1 : public _swizzle_base0 + { + V operator ()() const { return V(this->elem(E0), this->elem(E1)); } + }; -#endif + template + struct _swizzle_base1 : public _swizzle_base0 + { + V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } + }; -#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE)) + template + struct _swizzle_base1 : public _swizzle_base0 + { + V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + }; -#define ss swizzle(glm::X, glm::X) -#define ts swizzle(glm::Y, glm::X) -#define ps swizzle(glm::Z, glm::X) -#define qs swizzle(glm::W, glm::X) -#define st swizzle(glm::X, glm::Y) -#define tt swizzle(glm::Y, glm::Y) -#define pt swizzle(glm::Z, glm::Y) -#define qt swizzle(glm::W, glm::Y) -#define sp swizzle(glm::X, glm::Z) -#define tp swizzle(glm::Y, glm::Z) -#define pp swizzle(glm::Z, glm::Z) -#define qp swizzle(glm::W, glm::Z) -#define sq swizzle(glm::X, glm::W) -#define tq swizzle(glm::Y, glm::W) -#define pq swizzle(glm::Z, glm::W) -#define qq swizzle(glm::W, glm::W) + // Internal class for implementing swizzle operators + /* + Template parameters: -#endif + ValueType = type of scalar values (e.g. float, double) + VecType = class the swizzle is applies to (e.g. tvec3) + N = number of components in the vector (e.g. 3) + E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec -#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE)) + DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles + containing duplicate elements so that they cannot be used as r-values). + */ + template + struct _swizzle_base2 : public _swizzle_base1 + { + typedef VecType vec_type; + typedef ValueType value_type; -#define xxx swizzle(glm::X, glm::X, glm::X) -#define yxx swizzle(glm::Y, glm::X, glm::X) -#define zxx swizzle(glm::Z, glm::X, glm::X) -#define wxx swizzle(glm::W, glm::X, glm::X) -#define xyx swizzle(glm::X, glm::Y, glm::X) -#define yyx swizzle(glm::Y, glm::Y, glm::X) -#define zyx swizzle(glm::Z, glm::Y, glm::X) -#define wyx swizzle(glm::W, glm::Y, glm::X) -#define xzx swizzle(glm::X, glm::Z, glm::X) -#define yzx swizzle(glm::Y, glm::Z, glm::X) -#define zzx swizzle(glm::Z, glm::Z, glm::X) -#define wzx swizzle(glm::W, glm::Z, glm::X) -#define xwx swizzle(glm::X, glm::W, glm::X) -#define ywx swizzle(glm::Y, glm::W, glm::X) -#define zwx swizzle(glm::Z, glm::W, glm::X) -#define wwx swizzle(glm::W, glm::W, glm::X) -#define xxy swizzle(glm::X, glm::X, glm::Y) -#define yxy swizzle(glm::Y, glm::X, glm::Y) -#define zxy swizzle(glm::Z, glm::X, glm::Y) -#define wxy swizzle(glm::W, glm::X, glm::Y) -#define xyy swizzle(glm::X, glm::Y, glm::Y) -#define yyy swizzle(glm::Y, glm::Y, glm::Y) -#define zyy swizzle(glm::Z, glm::Y, glm::Y) -#define wyy swizzle(glm::W, glm::Y, glm::Y) -#define xzy swizzle(glm::X, glm::Z, glm::Y) -#define yzy swizzle(glm::Y, glm::Z, glm::Y) -#define zzy swizzle(glm::Z, glm::Z, glm::Y) -#define wzy swizzle(glm::W, glm::Z, glm::Y) -#define xwy swizzle(glm::X, glm::W, glm::Y) -#define ywy swizzle(glm::Y, glm::W, glm::Y) -#define zwy swizzle(glm::Z, glm::W, glm::Y) -#define wwy swizzle(glm::W, glm::W, glm::Y) -#define xxz swizzle(glm::X, glm::X, glm::Z) -#define yxz swizzle(glm::Y, glm::X, glm::Z) -#define zxz swizzle(glm::Z, glm::X, glm::Z) -#define wxz swizzle(glm::W, glm::X, glm::Z) -#define xyz swizzle(glm::X, glm::Y, glm::Z) -#define yyz swizzle(glm::Y, glm::Y, glm::Z) -#define zyz swizzle(glm::Z, glm::Y, glm::Z) -#define wyz swizzle(glm::W, glm::Y, glm::Z) -#define xzz swizzle(glm::X, glm::Z, glm::Z) -#define yzz swizzle(glm::Y, glm::Z, glm::Z) -#define zzz swizzle(glm::Z, glm::Z, glm::Z) -#define wzz swizzle(glm::W, glm::Z, glm::Z) -#define xwz swizzle(glm::X, glm::W, glm::Z) -#define ywz swizzle(glm::Y, glm::W, glm::Z) -#define zwz swizzle(glm::Z, glm::W, glm::Z) -#define wwz swizzle(glm::W, glm::W, glm::Z) -#define xxw swizzle(glm::X, glm::X, glm::W) -#define yxw swizzle(glm::Y, glm::X, glm::W) -#define zxw swizzle(glm::Z, glm::X, glm::W) -#define wxw swizzle(glm::W, glm::X, glm::W) -#define xyw swizzle(glm::X, glm::Y, glm::W) -#define yyw swizzle(glm::Y, glm::Y, glm::W) -#define zyw swizzle(glm::Z, glm::Y, glm::W) -#define wyw swizzle(glm::W, glm::Y, glm::W) -#define xzw swizzle(glm::X, glm::Z, glm::W) -#define yzw swizzle(glm::Y, glm::Z, glm::W) -#define zzw swizzle(glm::Z, glm::Z, glm::W) -#define wzw swizzle(glm::W, glm::Z, glm::W) -#define xww swizzle(glm::X, glm::W, glm::W) -#define yww swizzle(glm::Y, glm::W, glm::W) -#define zww swizzle(glm::Z, glm::W, glm::W) -#define www swizzle(glm::W, glm::W, glm::W) + _swizzle_base2& operator= (const ValueType& t) + { + for (int i = 0; i < N; ++i) + (*this)[i] = t; + return *this; + } -#endif + _swizzle_base2& operator= (const VecType& that) + { + struct op { + void operator() (value_type& e, value_type& t) { e = t; } + }; + _apply_op(that, op()); + return *this; + } -#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE)) + void operator -= (const VecType& that) + { + struct op { + void operator() (value_type& e, value_type& t) { e -= t; } + }; + _apply_op(that, op()); + } -#define rrr swizzle(glm::X, glm::X, glm::X) -#define grr swizzle(glm::Y, glm::X, glm::X) -#define brr swizzle(glm::Z, glm::X, glm::X) -#define arr swizzle(glm::W, glm::X, glm::X) -#define rgr swizzle(glm::X, glm::Y, glm::X) -#define ggr swizzle(glm::Y, glm::Y, glm::X) -#define bgr swizzle(glm::Z, glm::Y, glm::X) -#define agr swizzle(glm::W, glm::Y, glm::X) -#define rbr swizzle(glm::X, glm::Z, glm::X) -#define gbr swizzle(glm::Y, glm::Z, glm::X) -#define bbr swizzle(glm::Z, glm::Z, glm::X) -#define abr swizzle(glm::W, glm::Z, glm::X) -#define rar swizzle(glm::X, glm::W, glm::X) -#define gar swizzle(glm::Y, glm::W, glm::X) -#define bar swizzle(glm::Z, glm::W, glm::X) -#define aar swizzle(glm::W, glm::W, glm::X) -#define rrg swizzle(glm::X, glm::X, glm::Y) -#define grg swizzle(glm::Y, glm::X, glm::Y) -#define brg swizzle(glm::Z, glm::X, glm::Y) -#define arg swizzle(glm::W, glm::X, glm::Y) -#define rgg swizzle(glm::X, glm::Y, glm::Y) -#define ggg swizzle(glm::Y, glm::Y, glm::Y) -#define bgg swizzle(glm::Z, glm::Y, glm::Y) -#define agg swizzle(glm::W, glm::Y, glm::Y) -#define rbg swizzle(glm::X, glm::Z, glm::Y) -#define gbg swizzle(glm::Y, glm::Z, glm::Y) -#define bbg swizzle(glm::Z, glm::Z, glm::Y) -#define abg swizzle(glm::W, glm::Z, glm::Y) -#define rag swizzle(glm::X, glm::W, glm::Y) -#define gag swizzle(glm::Y, glm::W, glm::Y) -#define bag swizzle(glm::Z, glm::W, glm::Y) -#define aag swizzle(glm::W, glm::W, glm::Y) -#define rrb swizzle(glm::X, glm::X, glm::Z) -#define grb swizzle(glm::Y, glm::X, glm::Z) -#define brb swizzle(glm::Z, glm::X, glm::Z) -#define arb swizzle(glm::W, glm::X, glm::Z) -#define rgb swizzle(glm::X, glm::Y, glm::Z) -#define ggb swizzle(glm::Y, glm::Y, glm::Z) -#define bgb swizzle(glm::Z, glm::Y, glm::Z) -#define agb swizzle(glm::W, glm::Y, glm::Z) -#define rbb swizzle(glm::X, glm::Z, glm::Z) -#define gbb swizzle(glm::Y, glm::Z, glm::Z) -#define bbb swizzle(glm::Z, glm::Z, glm::Z) -#define abb swizzle(glm::W, glm::Z, glm::Z) -#define rab swizzle(glm::X, glm::W, glm::Z) -#define gab swizzle(glm::Y, glm::W, glm::Z) -#define bab swizzle(glm::Z, glm::W, glm::Z) -#define aab swizzle(glm::W, glm::W, glm::Z) -#define rra swizzle(glm::X, glm::X, glm::W) -#define gra swizzle(glm::Y, glm::X, glm::W) -#define bra swizzle(glm::Z, glm::X, glm::W) -#define ara swizzle(glm::W, glm::X, glm::W) -#define rga swizzle(glm::X, glm::Y, glm::W) -#define gga swizzle(glm::Y, glm::Y, glm::W) -#define bga swizzle(glm::Z, glm::Y, glm::W) -#define aga swizzle(glm::W, glm::Y, glm::W) -#define rba swizzle(glm::X, glm::Z, glm::W) -#define gba swizzle(glm::Y, glm::Z, glm::W) -#define bba swizzle(glm::Z, glm::Z, glm::W) -#define aba swizzle(glm::W, glm::Z, glm::W) -#define raa swizzle(glm::X, glm::W, glm::W) -#define gaa swizzle(glm::Y, glm::W, glm::W) -#define baa swizzle(glm::Z, glm::W, glm::W) -#define aaa swizzle(glm::W, glm::W, glm::W) + void operator += (const VecType& that) + { + struct op { + void operator() (value_type& e, value_type& t) { e += t; } + }; + _apply_op(that, op()); + } -#endif + void operator *= (const VecType& that) + { + struct op { + void operator() (value_type& e, value_type& t) { e *= t; } + }; + _apply_op(that, op()); + } -#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE)) + void operator /= (const VecType& that) + { + struct op { + void operator() (value_type& e, value_type& t) { e /= t; } + }; + _apply_op(that, op()); + } -#define sss swizzle(glm::X, glm::X, glm::X) -#define tss swizzle(glm::Y, glm::X, glm::X) -#define pss swizzle(glm::Z, glm::X, glm::X) -#define qss swizzle(glm::W, glm::X, glm::X) -#define sts swizzle(glm::X, glm::Y, glm::X) -#define tts swizzle(glm::Y, glm::Y, glm::X) -#define pts swizzle(glm::Z, glm::Y, glm::X) -#define qts swizzle(glm::W, glm::Y, glm::X) -#define sps swizzle(glm::X, glm::Z, glm::X) -#define tps swizzle(glm::Y, glm::Z, glm::X) -#define pps swizzle(glm::Z, glm::Z, glm::X) -#define qps swizzle(glm::W, glm::Z, glm::X) -#define sqs swizzle(glm::X, glm::W, glm::X) -#define tqs swizzle(glm::Y, glm::W, glm::X) -#define pqs swizzle(glm::Z, glm::W, glm::X) -#define qqs swizzle(glm::W, glm::W, glm::X) -#define sst swizzle(glm::X, glm::X, glm::Y) -#define tst swizzle(glm::Y, glm::X, glm::Y) -#define pst swizzle(glm::Z, glm::X, glm::Y) -#define qst swizzle(glm::W, glm::X, glm::Y) -#define stt swizzle(glm::X, glm::Y, glm::Y) -#define ttt swizzle(glm::Y, glm::Y, glm::Y) -#define ptt swizzle(glm::Z, glm::Y, glm::Y) -#define qtt swizzle(glm::W, glm::Y, glm::Y) -#define spt swizzle(glm::X, glm::Z, glm::Y) -#define tpt swizzle(glm::Y, glm::Z, glm::Y) -#define ppt swizzle(glm::Z, glm::Z, glm::Y) -#define qpt swizzle(glm::W, glm::Z, glm::Y) -#define sqt swizzle(glm::X, glm::W, glm::Y) -#define tqt swizzle(glm::Y, glm::W, glm::Y) -#define pqt swizzle(glm::Z, glm::W, glm::Y) -#define qqt swizzle(glm::W, glm::W, glm::Y) -#define ssp swizzle(glm::X, glm::X, glm::Z) -#define tsp swizzle(glm::Y, glm::X, glm::Z) -#define psp swizzle(glm::Z, glm::X, glm::Z) -#define qsp swizzle(glm::W, glm::X, glm::Z) -#define stp swizzle(glm::X, glm::Y, glm::Z) -#define ttp swizzle(glm::Y, glm::Y, glm::Z) -#define ptp swizzle(glm::Z, glm::Y, glm::Z) -#define qtp swizzle(glm::W, glm::Y, glm::Z) -#define spp swizzle(glm::X, glm::Z, glm::Z) -#define tpp swizzle(glm::Y, glm::Z, glm::Z) -#define ppp swizzle(glm::Z, glm::Z, glm::Z) -#define qpp swizzle(glm::W, glm::Z, glm::Z) -#define sqp swizzle(glm::X, glm::W, glm::Z) -#define tqp swizzle(glm::Y, glm::W, glm::Z) -#define pqp swizzle(glm::Z, glm::W, glm::Z) -#define qqp swizzle(glm::W, glm::W, glm::Z) -#define ssq swizzle(glm::X, glm::X, glm::W) -#define tsq swizzle(glm::Y, glm::X, glm::W) -#define psq swizzle(glm::Z, glm::X, glm::W) -#define qsq swizzle(glm::W, glm::X, glm::W) -#define stq swizzle(glm::X, glm::Y, glm::W) -#define ttq swizzle(glm::Y, glm::Y, glm::W) -#define ptq swizzle(glm::Z, glm::Y, glm::W) -#define qtq swizzle(glm::W, glm::Y, glm::W) -#define spq swizzle(glm::X, glm::Z, glm::W) -#define tpq swizzle(glm::Y, glm::Z, glm::W) -#define ppq swizzle(glm::Z, glm::Z, glm::W) -#define qpq swizzle(glm::W, glm::Z, glm::W) -#define sqq swizzle(glm::X, glm::W, glm::W) -#define tqq swizzle(glm::Y, glm::W, glm::W) -#define pqq swizzle(glm::Z, glm::W, glm::W) -#define qqq swizzle(glm::W, glm::W, glm::W) + value_type& operator[] (size_t i) + { + static const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + value_type operator[] (size_t i) const + { + static const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + protected: + template + void _apply_op(const VecType& that, T op) + { + // Make a copy of the data in this == &that. + // The copier should optimize out the copy in cases where the function is + // properly inlined and the copy is not necessary. + ValueType t[N]; + for (int i = 0; i < N; ++i) + t[i] = that[i]; + for (int i = 0; i < N; ++i) + op( (*this)[i], t[i] ); + } + }; -#endif + // Specialization for swizzles containing duplicate elements. These cannot be modified. + template + struct _swizzle_base2 : public _swizzle_base1 + { + typedef VecType vec_type; + typedef ValueType value_type; -#if(defined(GLM_SWIZZLE_XYZW) || defined(GLM_SWIZZLE)) + struct Stub {}; + _swizzle_base2& operator= (Stub const &) {} -#define xxxx swizzle(glm::X, glm::X, glm::X, glm::X) -#define yxxx swizzle(glm::Y, glm::X, glm::X, glm::X) -#define zxxx swizzle(glm::Z, glm::X, glm::X, glm::X) -#define wxxx swizzle(glm::W, glm::X, glm::X, glm::X) -#define xyxx swizzle(glm::X, glm::Y, glm::X, glm::X) -#define yyxx swizzle(glm::Y, glm::Y, glm::X, glm::X) -#define zyxx swizzle(glm::Z, glm::Y, glm::X, glm::X) -#define wyxx swizzle(glm::W, glm::Y, glm::X, glm::X) -#define xzxx swizzle(glm::X, glm::Z, glm::X, glm::X) -#define yzxx swizzle(glm::Y, glm::Z, glm::X, glm::X) -#define zzxx swizzle(glm::Z, glm::Z, glm::X, glm::X) -#define wzxx swizzle(glm::W, glm::Z, glm::X, glm::X) -#define xwxx swizzle(glm::X, glm::W, glm::X, glm::X) -#define ywxx swizzle(glm::Y, glm::W, glm::X, glm::X) -#define zwxx swizzle(glm::Z, glm::W, glm::X, glm::X) -#define wwxx swizzle(glm::W, glm::W, glm::X, glm::X) -#define xxyx swizzle(glm::X, glm::X, glm::Y, glm::X) -#define yxyx swizzle(glm::Y, glm::X, glm::Y, glm::X) -#define zxyx swizzle(glm::Z, glm::X, glm::Y, glm::X) -#define wxyx swizzle(glm::W, glm::X, glm::Y, glm::X) -#define xyyx swizzle(glm::X, glm::Y, glm::Y, glm::X) -#define yyyx swizzle(glm::Y, glm::Y, glm::Y, glm::X) -#define zyyx swizzle(glm::Z, glm::Y, glm::Y, glm::X) -#define wyyx swizzle(glm::W, glm::Y, glm::Y, glm::X) -#define xzyx swizzle(glm::X, glm::Z, glm::Y, glm::X) -#define yzyx swizzle(glm::Y, glm::Z, glm::Y, glm::X) -#define zzyx swizzle(glm::Z, glm::Z, glm::Y, glm::X) -#define wzyx swizzle(glm::W, glm::Z, glm::Y, glm::X) -#define xwyx swizzle(glm::X, glm::W, glm::Y, glm::X) -#define ywyx swizzle(glm::Y, glm::W, glm::Y, glm::X) -#define zwyx swizzle(glm::Z, glm::W, glm::Y, glm::X) -#define wwyx swizzle(glm::W, glm::W, glm::Y, glm::X) -#define xxzx swizzle(glm::X, glm::X, glm::Z, glm::X) -#define yxzx swizzle(glm::Y, glm::X, glm::Z, glm::X) -#define zxzx swizzle(glm::Z, glm::X, glm::Z, glm::X) -#define wxzx swizzle(glm::W, glm::X, glm::Z, glm::X) -#define xyzx swizzle(glm::X, glm::Y, glm::Z, glm::X) -#define yyzx swizzle(glm::Y, glm::Y, glm::Z, glm::X) -#define zyzx swizzle(glm::Z, glm::Y, glm::Z, glm::X) -#define wyzx swizzle(glm::W, glm::Y, glm::Z, glm::X) -#define xzzx swizzle(glm::X, glm::Z, glm::Z, glm::X) -#define yzzx swizzle(glm::Y, glm::Z, glm::Z, glm::X) -#define zzzx swizzle(glm::Z, glm::Z, glm::Z, glm::X) -#define wzzx swizzle(glm::W, glm::Z, glm::Z, glm::X) -#define xwzx swizzle(glm::X, glm::W, glm::Z, glm::X) -#define ywzx swizzle(glm::Y, glm::W, glm::Z, glm::X) -#define zwzx swizzle(glm::Z, glm::W, glm::Z, glm::X) -#define wwzx swizzle(glm::W, glm::W, glm::Z, glm::X) -#define xxwx swizzle(glm::X, glm::X, glm::W, glm::X) -#define yxwx swizzle(glm::Y, glm::X, glm::W, glm::X) -#define zxwx swizzle(glm::Z, glm::X, glm::W, glm::X) -#define wxwx swizzle(glm::W, glm::X, glm::W, glm::X) -#define xywx swizzle(glm::X, glm::Y, glm::W, glm::X) -#define yywx swizzle(glm::Y, glm::Y, glm::W, glm::X) -#define zywx swizzle(glm::Z, glm::Y, glm::W, glm::X) -#define wywx swizzle(glm::W, glm::Y, glm::W, glm::X) -#define xzwx swizzle(glm::X, glm::Z, glm::W, glm::X) -#define yzwx swizzle(glm::Y, glm::Z, glm::W, glm::X) -#define zzwx swizzle(glm::Z, glm::Z, glm::W, glm::X) -#define wzwx swizzle(glm::W, glm::Z, glm::W, glm::X) -#define xwwx swizzle(glm::X, glm::W, glm::W, glm::X) -#define ywwx swizzle(glm::Y, glm::W, glm::W, glm::X) -#define zwwx swizzle(glm::Z, glm::W, glm::W, glm::X) -#define wwwx swizzle(glm::W, glm::W, glm::W, glm::X) -#define xxxy swizzle(glm::X, glm::X, glm::X, glm::Y) -#define yxxy swizzle(glm::Y, glm::X, glm::X, glm::Y) -#define zxxy swizzle(glm::Z, glm::X, glm::X, glm::Y) -#define wxxy swizzle(glm::W, glm::X, glm::X, glm::Y) -#define xyxy swizzle(glm::X, glm::Y, glm::X, glm::Y) -#define yyxy swizzle(glm::Y, glm::Y, glm::X, glm::Y) -#define zyxy swizzle(glm::Z, glm::Y, glm::X, glm::Y) -#define wyxy swizzle(glm::W, glm::Y, glm::X, glm::Y) -#define xzxy swizzle(glm::X, glm::Z, glm::X, glm::Y) -#define yzxy swizzle(glm::Y, glm::Z, glm::X, glm::Y) -#define zzxy swizzle(glm::Z, glm::Z, glm::X, glm::Y) -#define wzxy swizzle(glm::W, glm::Z, glm::X, glm::Y) -#define xwxy swizzle(glm::X, glm::W, glm::X, glm::Y) -#define ywxy swizzle(glm::Y, glm::W, glm::X, glm::Y) -#define zwxy swizzle(glm::Z, glm::W, glm::X, glm::Y) -#define wwxy swizzle(glm::W, glm::W, glm::X, glm::Y) -#define xxyy swizzle(glm::X, glm::X, glm::Y, glm::Y) -#define yxyy swizzle(glm::Y, glm::X, glm::Y, glm::Y) -#define zxyy swizzle(glm::Z, glm::X, glm::Y, glm::Y) -#define wxyy swizzle(glm::W, glm::X, glm::Y, glm::Y) -#define xyyy swizzle(glm::X, glm::Y, glm::Y, glm::Y) -#define yyyy swizzle(glm::Y, glm::Y, glm::Y, glm::Y) -#define zyyy swizzle(glm::Z, glm::Y, glm::Y, glm::Y) -#define wyyy swizzle(glm::W, glm::Y, glm::Y, glm::Y) -#define xzyy swizzle(glm::X, glm::Z, glm::Y, glm::Y) -#define yzyy swizzle(glm::Y, glm::Z, glm::Y, glm::Y) -#define zzyy swizzle(glm::Z, glm::Z, glm::Y, glm::Y) -#define wzyy swizzle(glm::W, glm::Z, glm::Y, glm::Y) -#define xwyy swizzle(glm::X, glm::W, glm::Y, glm::Y) -#define ywyy swizzle(glm::Y, glm::W, glm::Y, glm::Y) -#define zwyy swizzle(glm::Z, glm::W, glm::Y, glm::Y) -#define wwyy swizzle(glm::W, glm::W, glm::Y, glm::Y) -#define xxzy swizzle(glm::X, glm::X, glm::Z, glm::Y) -#define yxzy swizzle(glm::Y, glm::X, glm::Z, glm::Y) -#define zxzy swizzle(glm::Z, glm::X, glm::Z, glm::Y) -#define wxzy swizzle(glm::W, glm::X, glm::Z, glm::Y) -#define xyzy swizzle(glm::X, glm::Y, glm::Z, glm::Y) -#define yyzy swizzle(glm::Y, glm::Y, glm::Z, glm::Y) -#define zyzy swizzle(glm::Z, glm::Y, glm::Z, glm::Y) -#define wyzy swizzle(glm::W, glm::Y, glm::Z, glm::Y) -#define xzzy swizzle(glm::X, glm::Z, glm::Z, glm::Y) -#define yzzy swizzle(glm::Y, glm::Z, glm::Z, glm::Y) -#define zzzy swizzle(glm::Z, glm::Z, glm::Z, glm::Y) -#define wzzy swizzle(glm::W, glm::Z, glm::Z, glm::Y) -#define xwzy swizzle(glm::X, glm::W, glm::Z, glm::Y) -#define ywzy swizzle(glm::Y, glm::W, glm::Z, glm::Y) -#define zwzy swizzle(glm::Z, glm::W, glm::Z, glm::Y) -#define wwzy swizzle(glm::W, glm::W, glm::Z, glm::Y) -#define xxwy swizzle(glm::X, glm::X, glm::W, glm::Y) -#define yxwy swizzle(glm::Y, glm::X, glm::W, glm::Y) -#define zxwy swizzle(glm::Z, glm::X, glm::W, glm::Y) -#define wxwy swizzle(glm::W, glm::X, glm::W, glm::Y) -#define xywy swizzle(glm::X, glm::Y, glm::W, glm::Y) -#define yywy swizzle(glm::Y, glm::Y, glm::W, glm::Y) -#define zywy swizzle(glm::Z, glm::Y, glm::W, glm::Y) -#define wywy swizzle(glm::W, glm::Y, glm::W, glm::Y) -#define xzwy swizzle(glm::X, glm::Z, glm::W, glm::Y) -#define yzwy swizzle(glm::Y, glm::Z, glm::W, glm::Y) -#define zzwy swizzle(glm::Z, glm::Z, glm::W, glm::Y) -#define wzwy swizzle(glm::W, glm::Z, glm::W, glm::Y) -#define xwwy swizzle(glm::X, glm::W, glm::W, glm::Y) -#define ywwy swizzle(glm::Y, glm::W, glm::W, glm::Y) -#define zwwy swizzle(glm::Z, glm::W, glm::W, glm::Y) -#define wwwy swizzle(glm::W, glm::W, glm::W, glm::Y) -#define xxxz swizzle(glm::X, glm::X, glm::X, glm::Z) -#define yxxz swizzle(glm::Y, glm::X, glm::X, glm::Z) -#define zxxz swizzle(glm::Z, glm::X, glm::X, glm::Z) -#define wxxz swizzle(glm::W, glm::X, glm::X, glm::Z) -#define xyxz swizzle(glm::X, glm::Y, glm::X, glm::Z) -#define yyxz swizzle(glm::Y, glm::Y, glm::X, glm::Z) -#define zyxz swizzle(glm::Z, glm::Y, glm::X, glm::Z) -#define wyxz swizzle(glm::W, glm::Y, glm::X, glm::Z) -#define xzxz swizzle(glm::X, glm::Z, glm::X, glm::Z) -#define yzxz swizzle(glm::Y, glm::Z, glm::X, glm::Z) -#define zzxz swizzle(glm::Z, glm::Z, glm::X, glm::Z) -#define wzxz swizzle(glm::W, glm::Z, glm::X, glm::Z) -#define xwxz swizzle(glm::X, glm::W, glm::X, glm::Z) -#define ywxz swizzle(glm::Y, glm::W, glm::X, glm::Z) -#define zwxz swizzle(glm::Z, glm::W, glm::X, glm::Z) -#define wwxz swizzle(glm::W, glm::W, glm::X, glm::Z) -#define xxyz swizzle(glm::X, glm::X, glm::Y, glm::Z) -#define yxyz swizzle(glm::Y, glm::X, glm::Y, glm::Z) -#define zxyz swizzle(glm::Z, glm::X, glm::Y, glm::Z) -#define wxyz swizzle(glm::W, glm::X, glm::Y, glm::Z) -#define xyyz swizzle(glm::X, glm::Y, glm::Y, glm::Z) -#define yyyz swizzle(glm::Y, glm::Y, glm::Y, glm::Z) -#define zyyz swizzle(glm::Z, glm::Y, glm::Y, glm::Z) -#define wyyz swizzle(glm::W, glm::Y, glm::Y, glm::Z) -#define xzyz swizzle(glm::X, glm::Z, glm::Y, glm::Z) -#define yzyz swizzle(glm::Y, glm::Z, glm::Y, glm::Z) -#define zzyz swizzle(glm::Z, glm::Z, glm::Y, glm::Z) -#define wzyz swizzle(glm::W, glm::Z, glm::Y, glm::Z) -#define xwyz swizzle(glm::X, glm::W, glm::Y, glm::Z) -#define ywyz swizzle(glm::Y, glm::W, glm::Y, glm::Z) -#define zwyz swizzle(glm::Z, glm::W, glm::Y, glm::Z) -#define wwyz swizzle(glm::W, glm::W, glm::Y, glm::Z) -#define xxzz swizzle(glm::X, glm::X, glm::Z, glm::Z) -#define yxzz swizzle(glm::Y, glm::X, glm::Z, glm::Z) -#define zxzz swizzle(glm::Z, glm::X, glm::Z, glm::Z) -#define wxzz swizzle(glm::W, glm::X, glm::Z, glm::Z) -#define xyzz swizzle(glm::X, glm::Y, glm::Z, glm::Z) -#define yyzz swizzle(glm::Y, glm::Y, glm::Z, glm::Z) -#define zyzz swizzle(glm::Z, glm::Y, glm::Z, glm::Z) -#define wyzz swizzle(glm::W, glm::Y, glm::Z, glm::Z) -#define xzzz swizzle(glm::X, glm::Z, glm::Z, glm::Z) -#define yzzz swizzle(glm::Y, glm::Z, glm::Z, glm::Z) -#define zzzz swizzle(glm::Z, glm::Z, glm::Z, glm::Z) -#define wzzz swizzle(glm::W, glm::Z, glm::Z, glm::Z) -#define xwzz swizzle(glm::X, glm::W, glm::Z, glm::Z) -#define ywzz swizzle(glm::Y, glm::W, glm::Z, glm::Z) -#define zwzz swizzle(glm::Z, glm::W, glm::Z, glm::Z) -#define wwzz swizzle(glm::W, glm::W, glm::Z, glm::Z) -#define xxwz swizzle(glm::X, glm::X, glm::W, glm::Z) -#define yxwz swizzle(glm::Y, glm::X, glm::W, glm::Z) -#define zxwz swizzle(glm::Z, glm::X, glm::W, glm::Z) -#define wxwz swizzle(glm::W, glm::X, glm::W, glm::Z) -#define xywz swizzle(glm::X, glm::Y, glm::W, glm::Z) -#define yywz swizzle(glm::Y, glm::Y, glm::W, glm::Z) -#define zywz swizzle(glm::Z, glm::Y, glm::W, glm::Z) -#define wywz swizzle(glm::W, glm::Y, glm::W, glm::Z) -#define xzwz swizzle(glm::X, glm::Z, glm::W, glm::Z) -#define yzwz swizzle(glm::Y, glm::Z, glm::W, glm::Z) -#define zzwz swizzle(glm::Z, glm::Z, glm::W, glm::Z) -#define wzwz swizzle(glm::W, glm::Z, glm::W, glm::Z) -#define xwwz swizzle(glm::X, glm::W, glm::W, glm::Z) -#define ywwz swizzle(glm::Y, glm::W, glm::W, glm::Z) -#define zwwz swizzle(glm::Z, glm::W, glm::W, glm::Z) -#define wwwz swizzle(glm::W, glm::W, glm::W, glm::Z) -#define xxxw swizzle(glm::X, glm::X, glm::X, glm::W) -#define yxxw swizzle(glm::Y, glm::X, glm::X, glm::W) -#define zxxw swizzle(glm::Z, glm::X, glm::X, glm::W) -#define wxxw swizzle(glm::W, glm::X, glm::X, glm::W) -#define xyxw swizzle(glm::X, glm::Y, glm::X, glm::W) -#define yyxw swizzle(glm::Y, glm::Y, glm::X, glm::W) -#define zyxw swizzle(glm::Z, glm::Y, glm::X, glm::W) -#define wyxw swizzle(glm::W, glm::Y, glm::X, glm::W) -#define xzxw swizzle(glm::X, glm::Z, glm::X, glm::W) -#define yzxw swizzle(glm::Y, glm::Z, glm::X, glm::W) -#define zzxw swizzle(glm::Z, glm::Z, glm::X, glm::W) -#define wzxw swizzle(glm::W, glm::Z, glm::X, glm::W) -#define xwxw swizzle(glm::X, glm::W, glm::X, glm::W) -#define ywxw swizzle(glm::Y, glm::W, glm::X, glm::W) -#define zwxw swizzle(glm::Z, glm::W, glm::X, glm::W) -#define wwxw swizzle(glm::W, glm::W, glm::X, glm::W) -#define xxyw swizzle(glm::X, glm::X, glm::Y, glm::W) -#define yxyw swizzle(glm::Y, glm::X, glm::Y, glm::W) -#define zxyw swizzle(glm::Z, glm::X, glm::Y, glm::W) -#define wxyw swizzle(glm::W, glm::X, glm::Y, glm::W) -#define xyyw swizzle(glm::X, glm::Y, glm::Y, glm::W) -#define yyyw swizzle(glm::Y, glm::Y, glm::Y, glm::W) -#define zyyw swizzle(glm::Z, glm::Y, glm::Y, glm::W) -#define wyyw swizzle(glm::W, glm::Y, glm::Y, glm::W) -#define xzyw swizzle(glm::X, glm::Z, glm::Y, glm::W) -#define yzyw swizzle(glm::Y, glm::Z, glm::Y, glm::W) -#define zzyw swizzle(glm::Z, glm::Z, glm::Y, glm::W) -#define wzyw swizzle(glm::W, glm::Z, glm::Y, glm::W) -#define xwyw swizzle(glm::X, glm::W, glm::Y, glm::W) -#define ywyw swizzle(glm::Y, glm::W, glm::Y, glm::W) -#define zwyw swizzle(glm::Z, glm::W, glm::Y, glm::W) -#define wwyw swizzle(glm::W, glm::W, glm::Y, glm::W) -#define xxzw swizzle(glm::X, glm::X, glm::Z, glm::W) -#define yxzw swizzle(glm::Y, glm::X, glm::Z, glm::W) -#define zxzw swizzle(glm::Z, glm::X, glm::Z, glm::W) -#define wxzw swizzle(glm::W, glm::X, glm::Z, glm::W) -#define xyzw swizzle(glm::X, glm::Y, glm::Z, glm::W) -#define yyzw swizzle(glm::Y, glm::Y, glm::Z, glm::W) -#define zyzw swizzle(glm::Z, glm::Y, glm::Z, glm::W) -#define wyzw swizzle(glm::W, glm::Y, glm::Z, glm::W) -#define xzzw swizzle(glm::X, glm::Z, glm::Z, glm::W) -#define yzzw swizzle(glm::Y, glm::Z, glm::Z, glm::W) -#define zzzw swizzle(glm::Z, glm::Z, glm::Z, glm::W) -#define wzzw swizzle(glm::W, glm::Z, glm::Z, glm::W) -#define xwzw swizzle(glm::X, glm::W, glm::Z, glm::W) -#define ywzw swizzle(glm::Y, glm::W, glm::Z, glm::W) -#define zwzw swizzle(glm::Z, glm::W, glm::Z, glm::W) -#define wwzw swizzle(glm::W, glm::W, glm::Z, glm::W) -#define xxww swizzle(glm::X, glm::X, glm::W, glm::W) -#define yxww swizzle(glm::Y, glm::X, glm::W, glm::W) -#define zxww swizzle(glm::Z, glm::X, glm::W, glm::W) -#define wxww swizzle(glm::W, glm::X, glm::W, glm::W) -#define xyww swizzle(glm::X, glm::Y, glm::W, glm::W) -#define yyww swizzle(glm::Y, glm::Y, glm::W, glm::W) -#define zyww swizzle(glm::Z, glm::Y, glm::W, glm::W) -#define wyww swizzle(glm::W, glm::Y, glm::W, glm::W) -#define xzww swizzle(glm::X, glm::Z, glm::W, glm::W) -#define yzww swizzle(glm::Y, glm::Z, glm::W, glm::W) -#define zzww swizzle(glm::Z, glm::Z, glm::W, glm::W) -#define wzww swizzle(glm::W, glm::Z, glm::W, glm::W) -#define xwww swizzle(glm::X, glm::W, glm::W, glm::W) -#define ywww swizzle(glm::Y, glm::W, glm::W, glm::W) -#define zwww swizzle(glm::Z, glm::W, glm::W, glm::W) -#define wwww swizzle(glm::W, glm::W, glm::W, glm::W) + value_type operator[] (size_t i) const + { + static const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + }; -#endif + template + struct swizzle : public _swizzle_base2 + { + typedef _swizzle_base2 base_type; -#if(defined(GLM_SWIZZLE_RGBA) || defined(GLM_SWIZZLE)) + using base_type::operator=; -#define rrrr swizzle(glm::X, glm::X, glm::X, glm::X) -#define grrr swizzle(glm::Y, glm::X, glm::X, glm::X) -#define brrr swizzle(glm::Z, glm::X, glm::X, glm::X) -#define arrr swizzle(glm::W, glm::X, glm::X, glm::X) -#define rgrr swizzle(glm::X, glm::Y, glm::X, glm::X) -#define ggrr swizzle(glm::Y, glm::Y, glm::X, glm::X) -#define bgrr swizzle(glm::Z, glm::Y, glm::X, glm::X) -#define agrr swizzle(glm::W, glm::Y, glm::X, glm::X) -#define rbrr swizzle(glm::X, glm::Z, glm::X, glm::X) -#define gbrr swizzle(glm::Y, glm::Z, glm::X, glm::X) -#define bbrr swizzle(glm::Z, glm::Z, glm::X, glm::X) -#define abrr swizzle(glm::W, glm::Z, glm::X, glm::X) -#define rarr swizzle(glm::X, glm::W, glm::X, glm::X) -#define garr swizzle(glm::Y, glm::W, glm::X, glm::X) -#define barr swizzle(glm::Z, glm::W, glm::X, glm::X) -#define aarr swizzle(glm::W, glm::W, glm::X, glm::X) -#define rrgr swizzle(glm::X, glm::X, glm::Y, glm::X) -#define grgr swizzle(glm::Y, glm::X, glm::Y, glm::X) -#define brgr swizzle(glm::Z, glm::X, glm::Y, glm::X) -#define argr swizzle(glm::W, glm::X, glm::Y, glm::X) -#define rggr swizzle(glm::X, glm::Y, glm::Y, glm::X) -#define gggr swizzle(glm::Y, glm::Y, glm::Y, glm::X) -#define bggr swizzle(glm::Z, glm::Y, glm::Y, glm::X) -#define aggr swizzle(glm::W, glm::Y, glm::Y, glm::X) -#define rbgr swizzle(glm::X, glm::Z, glm::Y, glm::X) -#define gbgr swizzle(glm::Y, glm::Z, glm::Y, glm::X) -#define bbgr swizzle(glm::Z, glm::Z, glm::Y, glm::X) -#define abgr swizzle(glm::W, glm::Z, glm::Y, glm::X) -#define ragr swizzle(glm::X, glm::W, glm::Y, glm::X) -#define gagr swizzle(glm::Y, glm::W, glm::Y, glm::X) -#define bagr swizzle(glm::Z, glm::W, glm::Y, glm::X) -#define aagr swizzle(glm::W, glm::W, glm::Y, glm::X) -#define rrbr swizzle(glm::X, glm::X, glm::Z, glm::X) -#define grbr swizzle(glm::Y, glm::X, glm::Z, glm::X) -#define brbr swizzle(glm::Z, glm::X, glm::Z, glm::X) -#define arbr swizzle(glm::W, glm::X, glm::Z, glm::X) -#define rgbr swizzle(glm::X, glm::Y, glm::Z, glm::X) -#define ggbr swizzle(glm::Y, glm::Y, glm::Z, glm::X) -#define bgbr swizzle(glm::Z, glm::Y, glm::Z, glm::X) -#define agbr swizzle(glm::W, glm::Y, glm::Z, glm::X) -#define rbbr swizzle(glm::X, glm::Z, glm::Z, glm::X) -#define gbbr swizzle(glm::Y, glm::Z, glm::Z, glm::X) -#define bbbr swizzle(glm::Z, glm::Z, glm::Z, glm::X) -#define abbr swizzle(glm::W, glm::Z, glm::Z, glm::X) -#define rabr swizzle(glm::X, glm::W, glm::Z, glm::X) -#define gabr swizzle(glm::Y, glm::W, glm::Z, glm::X) -#define babr swizzle(glm::Z, glm::W, glm::Z, glm::X) -#define aabr swizzle(glm::W, glm::W, glm::Z, glm::X) -#define rrar swizzle(glm::X, glm::X, glm::W, glm::X) -#define grar swizzle(glm::Y, glm::X, glm::W, glm::X) -#define brar swizzle(glm::Z, glm::X, glm::W, glm::X) -#define arar swizzle(glm::W, glm::X, glm::W, glm::X) -#define rgar swizzle(glm::X, glm::Y, glm::W, glm::X) -#define ggar swizzle(glm::Y, glm::Y, glm::W, glm::X) -#define bgar swizzle(glm::Z, glm::Y, glm::W, glm::X) -#define agar swizzle(glm::W, glm::Y, glm::W, glm::X) -#define rbar swizzle(glm::X, glm::Z, glm::W, glm::X) -#define gbar swizzle(glm::Y, glm::Z, glm::W, glm::X) -#define bbar swizzle(glm::Z, glm::Z, glm::W, glm::X) -#define abar swizzle(glm::W, glm::Z, glm::W, glm::X) -#define raar swizzle(glm::X, glm::W, glm::W, glm::X) -#define gaar swizzle(glm::Y, glm::W, glm::W, glm::X) -#define baar swizzle(glm::Z, glm::W, glm::W, glm::X) -#define aaar swizzle(glm::W, glm::W, glm::W, glm::X) -#define rrrg swizzle(glm::X, glm::X, glm::X, glm::Y) -#define grrg swizzle(glm::Y, glm::X, glm::X, glm::Y) -#define brrg swizzle(glm::Z, glm::X, glm::X, glm::Y) -#define arrg swizzle(glm::W, glm::X, glm::X, glm::Y) -#define rgrg swizzle(glm::X, glm::Y, glm::X, glm::Y) -#define ggrg swizzle(glm::Y, glm::Y, glm::X, glm::Y) -#define bgrg swizzle(glm::Z, glm::Y, glm::X, glm::Y) -#define agrg swizzle(glm::W, glm::Y, glm::X, glm::Y) -#define rbrg swizzle(glm::X, glm::Z, glm::X, glm::Y) -#define gbrg swizzle(glm::Y, glm::Z, glm::X, glm::Y) -#define bbrg swizzle(glm::Z, glm::Z, glm::X, glm::Y) -#define abrg swizzle(glm::W, glm::Z, glm::X, glm::Y) -#define rarg swizzle(glm::X, glm::W, glm::X, glm::Y) -#define garg swizzle(glm::Y, glm::W, glm::X, glm::Y) -#define barg swizzle(glm::Z, glm::W, glm::X, glm::Y) -#define aarg swizzle(glm::W, glm::W, glm::X, glm::Y) -#define rrgg swizzle(glm::X, glm::X, glm::Y, glm::Y) -#define grgg swizzle(glm::Y, glm::X, glm::Y, glm::Y) -#define brgg swizzle(glm::Z, glm::X, glm::Y, glm::Y) -#define argg swizzle(glm::W, glm::X, glm::Y, glm::Y) -#define rggg swizzle(glm::X, glm::Y, glm::Y, glm::Y) -#define gggg swizzle(glm::Y, glm::Y, glm::Y, glm::Y) -#define bggg swizzle(glm::Z, glm::Y, glm::Y, glm::Y) -#define aggg swizzle(glm::W, glm::Y, glm::Y, glm::Y) -#define rbgg swizzle(glm::X, glm::Z, glm::Y, glm::Y) -#define gbgg swizzle(glm::Y, glm::Z, glm::Y, glm::Y) -#define bbgg swizzle(glm::Z, glm::Z, glm::Y, glm::Y) -#define abgg swizzle(glm::W, glm::Z, glm::Y, glm::Y) -#define ragg swizzle(glm::X, glm::W, glm::Y, glm::Y) -#define gagg swizzle(glm::Y, glm::W, glm::Y, glm::Y) -#define bagg swizzle(glm::Z, glm::W, glm::Y, glm::Y) -#define aagg swizzle(glm::W, glm::W, glm::Y, glm::Y) -#define rrbg swizzle(glm::X, glm::X, glm::Z, glm::Y) -#define grbg swizzle(glm::Y, glm::X, glm::Z, glm::Y) -#define brbg swizzle(glm::Z, glm::X, glm::Z, glm::Y) -#define arbg swizzle(glm::W, glm::X, glm::Z, glm::Y) -#define rgbg swizzle(glm::X, glm::Y, glm::Z, glm::Y) -#define ggbg swizzle(glm::Y, glm::Y, glm::Z, glm::Y) -#define bgbg swizzle(glm::Z, glm::Y, glm::Z, glm::Y) -#define agbg swizzle(glm::W, glm::Y, glm::Z, glm::Y) -#define rbbg swizzle(glm::X, glm::Z, glm::Z, glm::Y) -#define gbbg swizzle(glm::Y, glm::Z, glm::Z, glm::Y) -#define bbbg swizzle(glm::Z, glm::Z, glm::Z, glm::Y) -#define abbg swizzle(glm::W, glm::Z, glm::Z, glm::Y) -#define rabg swizzle(glm::X, glm::W, glm::Z, glm::Y) -#define gabg swizzle(glm::Y, glm::W, glm::Z, glm::Y) -#define babg swizzle(glm::Z, glm::W, glm::Z, glm::Y) -#define aabg swizzle(glm::W, glm::W, glm::Z, glm::Y) -#define rrag swizzle(glm::X, glm::X, glm::W, glm::Y) -#define grag swizzle(glm::Y, glm::X, glm::W, glm::Y) -#define brag swizzle(glm::Z, glm::X, glm::W, glm::Y) -#define arag swizzle(glm::W, glm::X, glm::W, glm::Y) -#define rgag swizzle(glm::X, glm::Y, glm::W, glm::Y) -#define ggag swizzle(glm::Y, glm::Y, glm::W, glm::Y) -#define bgag swizzle(glm::Z, glm::Y, glm::W, glm::Y) -#define agag swizzle(glm::W, glm::Y, glm::W, glm::Y) -#define rbag swizzle(glm::X, glm::Z, glm::W, glm::Y) -#define gbag swizzle(glm::Y, glm::Z, glm::W, glm::Y) -#define bbag swizzle(glm::Z, glm::Z, glm::W, glm::Y) -#define abag swizzle(glm::W, glm::Z, glm::W, glm::Y) -#define raag swizzle(glm::X, glm::W, glm::W, glm::Y) -#define gaag swizzle(glm::Y, glm::W, glm::W, glm::Y) -#define baag swizzle(glm::Z, glm::W, glm::W, glm::Y) -#define aaag swizzle(glm::W, glm::W, glm::W, glm::Y) -#define rrrb swizzle(glm::X, glm::X, glm::X, glm::Z) -#define grrb swizzle(glm::Y, glm::X, glm::X, glm::Z) -#define brrb swizzle(glm::Z, glm::X, glm::X, glm::Z) -#define arrb swizzle(glm::W, glm::X, glm::X, glm::Z) -#define rgrb swizzle(glm::X, glm::Y, glm::X, glm::Z) -#define ggrb swizzle(glm::Y, glm::Y, glm::X, glm::Z) -#define bgrb swizzle(glm::Z, glm::Y, glm::X, glm::Z) -#define agrb swizzle(glm::W, glm::Y, glm::X, glm::Z) -#define rbrb swizzle(glm::X, glm::Z, glm::X, glm::Z) -#define gbrb swizzle(glm::Y, glm::Z, glm::X, glm::Z) -#define bbrb swizzle(glm::Z, glm::Z, glm::X, glm::Z) -#define abrb swizzle(glm::W, glm::Z, glm::X, glm::Z) -#define rarb swizzle(glm::X, glm::W, glm::X, glm::Z) -#define garb swizzle(glm::Y, glm::W, glm::X, glm::Z) -#define barb swizzle(glm::Z, glm::W, glm::X, glm::Z) -#define aarb swizzle(glm::W, glm::W, glm::X, glm::Z) -#define rrgb swizzle(glm::X, glm::X, glm::Y, glm::Z) -#define grgb swizzle(glm::Y, glm::X, glm::Y, glm::Z) -#define brgb swizzle(glm::Z, glm::X, glm::Y, glm::Z) -#define argb swizzle(glm::W, glm::X, glm::Y, glm::Z) -#define rggb swizzle(glm::X, glm::Y, glm::Y, glm::Z) -#define gggb swizzle(glm::Y, glm::Y, glm::Y, glm::Z) -#define bggb swizzle(glm::Z, glm::Y, glm::Y, glm::Z) -#define aggb swizzle(glm::W, glm::Y, glm::Y, glm::Z) -#define rbgb swizzle(glm::X, glm::Z, glm::Y, glm::Z) -#define gbgb swizzle(glm::Y, glm::Z, glm::Y, glm::Z) -#define bbgb swizzle(glm::Z, glm::Z, glm::Y, glm::Z) -#define abgb swizzle(glm::W, glm::Z, glm::Y, glm::Z) -#define ragb swizzle(glm::X, glm::W, glm::Y, glm::Z) -#define gagb swizzle(glm::Y, glm::W, glm::Y, glm::Z) -#define bagb swizzle(glm::Z, glm::W, glm::Y, glm::Z) -#define aagb swizzle(glm::W, glm::W, glm::Y, glm::Z) -#define rrbb swizzle(glm::X, glm::X, glm::Z, glm::Z) -#define grbb swizzle(glm::Y, glm::X, glm::Z, glm::Z) -#define brbb swizzle(glm::Z, glm::X, glm::Z, glm::Z) -#define arbb swizzle(glm::W, glm::X, glm::Z, glm::Z) -#define rgbb swizzle(glm::X, glm::Y, glm::Z, glm::Z) -#define ggbb swizzle(glm::Y, glm::Y, glm::Z, glm::Z) -#define bgbb swizzle(glm::Z, glm::Y, glm::Z, glm::Z) -#define agbb swizzle(glm::W, glm::Y, glm::Z, glm::Z) -#define rbbb swizzle(glm::X, glm::Z, glm::Z, glm::Z) -#define gbbb swizzle(glm::Y, glm::Z, glm::Z, glm::Z) -#define bbbb swizzle(glm::Z, glm::Z, glm::Z, glm::Z) -#define abbb swizzle(glm::W, glm::Z, glm::Z, glm::Z) -#define rabb swizzle(glm::X, glm::W, glm::Z, glm::Z) -#define gabb swizzle(glm::Y, glm::W, glm::Z, glm::Z) -#define babb swizzle(glm::Z, glm::W, glm::Z, glm::Z) -#define aabb swizzle(glm::W, glm::W, glm::Z, glm::Z) -#define rrab swizzle(glm::X, glm::X, glm::W, glm::Z) -#define grab swizzle(glm::Y, glm::X, glm::W, glm::Z) -#define brab swizzle(glm::Z, glm::X, glm::W, glm::Z) -#define arab swizzle(glm::W, glm::X, glm::W, glm::Z) -#define rgab swizzle(glm::X, glm::Y, glm::W, glm::Z) -#define ggab swizzle(glm::Y, glm::Y, glm::W, glm::Z) -#define bgab swizzle(glm::Z, glm::Y, glm::W, glm::Z) -#define agab swizzle(glm::W, glm::Y, glm::W, glm::Z) -#define rbab swizzle(glm::X, glm::Z, glm::W, glm::Z) -#define gbab swizzle(glm::Y, glm::Z, glm::W, glm::Z) -#define bbab swizzle(glm::Z, glm::Z, glm::W, glm::Z) -#define abab swizzle(glm::W, glm::Z, glm::W, glm::Z) -#define raab swizzle(glm::X, glm::W, glm::W, glm::Z) -#define gaab swizzle(glm::Y, glm::W, glm::W, glm::Z) -#define baab swizzle(glm::Z, glm::W, glm::W, glm::Z) -#define aaab swizzle(glm::W, glm::W, glm::W, glm::Z) -#define rrra swizzle(glm::X, glm::X, glm::X, glm::W) -#define grra swizzle(glm::Y, glm::X, glm::X, glm::W) -#define brra swizzle(glm::Z, glm::X, glm::X, glm::W) -#define arra swizzle(glm::W, glm::X, glm::X, glm::W) -#define rgra swizzle(glm::X, glm::Y, glm::X, glm::W) -#define ggra swizzle(glm::Y, glm::Y, glm::X, glm::W) -#define bgra swizzle(glm::Z, glm::Y, glm::X, glm::W) -#define agra swizzle(glm::W, glm::Y, glm::X, glm::W) -#define rbra swizzle(glm::X, glm::Z, glm::X, glm::W) -#define gbra swizzle(glm::Y, glm::Z, glm::X, glm::W) -#define bbra swizzle(glm::Z, glm::Z, glm::X, glm::W) -#define abra swizzle(glm::W, glm::Z, glm::X, glm::W) -#define rara swizzle(glm::X, glm::W, glm::X, glm::W) -#define gara swizzle(glm::Y, glm::W, glm::X, glm::W) -#define bara swizzle(glm::Z, glm::W, glm::X, glm::W) -#define aara swizzle(glm::W, glm::W, glm::X, glm::W) -#define rrga swizzle(glm::X, glm::X, glm::Y, glm::W) -#define grga swizzle(glm::Y, glm::X, glm::Y, glm::W) -#define brga swizzle(glm::Z, glm::X, glm::Y, glm::W) -#define arga swizzle(glm::W, glm::X, glm::Y, glm::W) -#define rgga swizzle(glm::X, glm::Y, glm::Y, glm::W) -#define ggga swizzle(glm::Y, glm::Y, glm::Y, glm::W) -#define bgga swizzle(glm::Z, glm::Y, glm::Y, glm::W) -#define agga swizzle(glm::W, glm::Y, glm::Y, glm::W) -#define rbga swizzle(glm::X, glm::Z, glm::Y, glm::W) -#define gbga swizzle(glm::Y, glm::Z, glm::Y, glm::W) -#define bbga swizzle(glm::Z, glm::Z, glm::Y, glm::W) -#define abga swizzle(glm::W, glm::Z, glm::Y, glm::W) -#define raga swizzle(glm::X, glm::W, glm::Y, glm::W) -#define gaga swizzle(glm::Y, glm::W, glm::Y, glm::W) -#define baga swizzle(glm::Z, glm::W, glm::Y, glm::W) -#define aaga swizzle(glm::W, glm::W, glm::Y, glm::W) -#define rrba swizzle(glm::X, glm::X, glm::Z, glm::W) -#define grba swizzle(glm::Y, glm::X, glm::Z, glm::W) -#define brba swizzle(glm::Z, glm::X, glm::Z, glm::W) -#define arba swizzle(glm::W, glm::X, glm::Z, glm::W) -#define rgba swizzle(glm::X, glm::Y, glm::Z, glm::W) -#define ggba swizzle(glm::Y, glm::Y, glm::Z, glm::W) -#define bgba swizzle(glm::Z, glm::Y, glm::Z, glm::W) -#define agba swizzle(glm::W, glm::Y, glm::Z, glm::W) -#define rbba swizzle(glm::X, glm::Z, glm::Z, glm::W) -#define gbba swizzle(glm::Y, glm::Z, glm::Z, glm::W) -#define bbba swizzle(glm::Z, glm::Z, glm::Z, glm::W) -#define abba swizzle(glm::W, glm::Z, glm::Z, glm::W) -#define raba swizzle(glm::X, glm::W, glm::Z, glm::W) -#define gaba swizzle(glm::Y, glm::W, glm::Z, glm::W) -#define baba swizzle(glm::Z, glm::W, glm::Z, glm::W) -#define aaba swizzle(glm::W, glm::W, glm::Z, glm::W) -#define rraa swizzle(glm::X, glm::X, glm::W, glm::W) -#define graa swizzle(glm::Y, glm::X, glm::W, glm::W) -#define braa swizzle(glm::Z, glm::X, glm::W, glm::W) -#define araa swizzle(glm::W, glm::X, glm::W, glm::W) -#define rgaa swizzle(glm::X, glm::Y, glm::W, glm::W) -#define ggaa swizzle(glm::Y, glm::Y, glm::W, glm::W) -#define bgaa swizzle(glm::Z, glm::Y, glm::W, glm::W) -#define agaa swizzle(glm::W, glm::Y, glm::W, glm::W) -#define rbaa swizzle(glm::X, glm::Z, glm::W, glm::W) -#define gbaa swizzle(glm::Y, glm::Z, glm::W, glm::W) -#define bbaa swizzle(glm::Z, glm::Z, glm::W, glm::W) -#define abaa swizzle(glm::W, glm::Z, glm::W, glm::W) -#define raaa swizzle(glm::X, glm::W, glm::W, glm::W) -#define gaaa swizzle(glm::Y, glm::W, glm::W, glm::W) -#define baaa swizzle(glm::Z, glm::W, glm::W, glm::W) -#define aaaa swizzle(glm::W, glm::W, glm::W, glm::W) + operator VecType () const { return (*this)(); } + }; -#endif +// +// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros +// +#define _GLM_SWIZZLE_TEMPLATE1 template +#define _GLM_SWIZZLE_TEMPLATE2 template +#define _GLM_SWIZZLE_TYPE1 glm::detail::swizzle +#define _GLM_SWIZZLE_TYPE2 glm::detail::swizzle -#if(defined(GLM_FORCE_SWIZZLE_STPQ) || defined(GLM_SWIZZLE)) +// +// Wrapper for a binary operator (e.g. u.yy + v.zy) +// +#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ + _GLM_SWIZZLE_TEMPLATE2 \ + V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + { \ + return a() OPERAND b(); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ + { \ + return a() OPERAND b; \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return a OPERAND b(); \ + } -#define ssss swizzle(glm::X, glm::X, glm::X, glm::X) -#define tsss swizzle(glm::Y, glm::X, glm::X, glm::X) -#define psss swizzle(glm::Z, glm::X, glm::X, glm::X) -#define qsss swizzle(glm::W, glm::X, glm::X, glm::X) -#define stss swizzle(glm::X, glm::Y, glm::X, glm::X) -#define ttss swizzle(glm::Y, glm::Y, glm::X, glm::X) -#define ptss swizzle(glm::Z, glm::Y, glm::X, glm::X) -#define qtss swizzle(glm::W, glm::Y, glm::X, glm::X) -#define spss swizzle(glm::X, glm::Z, glm::X, glm::X) -#define tpss swizzle(glm::Y, glm::Z, glm::X, glm::X) -#define ppss swizzle(glm::Z, glm::Z, glm::X, glm::X) -#define qpss swizzle(glm::W, glm::Z, glm::X, glm::X) -#define sqss swizzle(glm::X, glm::W, glm::X, glm::X) -#define tqss swizzle(glm::Y, glm::W, glm::X, glm::X) -#define pqss swizzle(glm::Z, glm::W, glm::X, glm::X) -#define qqss swizzle(glm::W, glm::W, glm::X, glm::X) -#define ssts swizzle(glm::X, glm::X, glm::Y, glm::X) -#define tsts swizzle(glm::Y, glm::X, glm::Y, glm::X) -#define psts swizzle(glm::Z, glm::X, glm::Y, glm::X) -#define qsts swizzle(glm::W, glm::X, glm::Y, glm::X) -#define stts swizzle(glm::X, glm::Y, glm::Y, glm::X) -#define ttts swizzle(glm::Y, glm::Y, glm::Y, glm::X) -#define ptts swizzle(glm::Z, glm::Y, glm::Y, glm::X) -#define qtts swizzle(glm::W, glm::Y, glm::Y, glm::X) -#define spts swizzle(glm::X, glm::Z, glm::Y, glm::X) -#define tpts swizzle(glm::Y, glm::Z, glm::Y, glm::X) -#define ppts swizzle(glm::Z, glm::Z, glm::Y, glm::X) -#define qpts swizzle(glm::W, glm::Z, glm::Y, glm::X) -#define sqts swizzle(glm::X, glm::W, glm::Y, glm::X) -#define tqts swizzle(glm::Y, glm::W, glm::Y, glm::X) -#define pqts swizzle(glm::Z, glm::W, glm::Y, glm::X) -#define qqts swizzle(glm::W, glm::W, glm::Y, glm::X) -#define ssps swizzle(glm::X, glm::X, glm::Z, glm::X) -#define tsps swizzle(glm::Y, glm::X, glm::Z, glm::X) -#define psps swizzle(glm::Z, glm::X, glm::Z, glm::X) -#define qsps swizzle(glm::W, glm::X, glm::Z, glm::X) -#define stps swizzle(glm::X, glm::Y, glm::Z, glm::X) -#define ttps swizzle(glm::Y, glm::Y, glm::Z, glm::X) -#define ptps swizzle(glm::Z, glm::Y, glm::Z, glm::X) -#define qtps swizzle(glm::W, glm::Y, glm::Z, glm::X) -#define spps swizzle(glm::X, glm::Z, glm::Z, glm::X) -#define tpps swizzle(glm::Y, glm::Z, glm::Z, glm::X) -#define ppps swizzle(glm::Z, glm::Z, glm::Z, glm::X) -#define qpps swizzle(glm::W, glm::Z, glm::Z, glm::X) -#define sqps swizzle(glm::X, glm::W, glm::Z, glm::X) -#define tqps swizzle(glm::Y, glm::W, glm::Z, glm::X) -#define pqps swizzle(glm::Z, glm::W, glm::Z, glm::X) -#define qqps swizzle(glm::W, glm::W, glm::Z, glm::X) -#define ssqs swizzle(glm::X, glm::X, glm::W, glm::X) -#define tsqs swizzle(glm::Y, glm::X, glm::W, glm::X) -#define psqs swizzle(glm::Z, glm::X, glm::W, glm::X) -#define qsqs swizzle(glm::W, glm::X, glm::W, glm::X) -#define stqs swizzle(glm::X, glm::Y, glm::W, glm::X) -#define ttqs swizzle(glm::Y, glm::Y, glm::W, glm::X) -#define ptqs swizzle(glm::Z, glm::Y, glm::W, glm::X) -#define qtqs swizzle(glm::W, glm::Y, glm::W, glm::X) -#define spqs swizzle(glm::X, glm::Z, glm::W, glm::X) -#define tpqs swizzle(glm::Y, glm::Z, glm::W, glm::X) -#define ppqs swizzle(glm::Z, glm::Z, glm::W, glm::X) -#define qpqs swizzle(glm::W, glm::Z, glm::W, glm::X) -#define sqqs swizzle(glm::X, glm::W, glm::W, glm::X) -#define tqqs swizzle(glm::Y, glm::W, glm::W, glm::X) -#define pqqs swizzle(glm::Z, glm::W, glm::W, glm::X) -#define qqqs swizzle(glm::W, glm::W, glm::W, glm::X) -#define ssst swizzle(glm::X, glm::X, glm::X, glm::Y) -#define tsst swizzle(glm::Y, glm::X, glm::X, glm::Y) -#define psst swizzle(glm::Z, glm::X, glm::X, glm::Y) -#define qsst swizzle(glm::W, glm::X, glm::X, glm::Y) -#define stst swizzle(glm::X, glm::Y, glm::X, glm::Y) -#define ttst swizzle(glm::Y, glm::Y, glm::X, glm::Y) -#define ptst swizzle(glm::Z, glm::Y, glm::X, glm::Y) -#define qtst swizzle(glm::W, glm::Y, glm::X, glm::Y) -#define spst swizzle(glm::X, glm::Z, glm::X, glm::Y) -#define tpst swizzle(glm::Y, glm::Z, glm::X, glm::Y) -#define ppst swizzle(glm::Z, glm::Z, glm::X, glm::Y) -#define qpst swizzle(glm::W, glm::Z, glm::X, glm::Y) -#define sqst swizzle(glm::X, glm::W, glm::X, glm::Y) -#define tqst swizzle(glm::Y, glm::W, glm::X, glm::Y) -#define pqst swizzle(glm::Z, glm::W, glm::X, glm::Y) -#define qqst swizzle(glm::W, glm::W, glm::X, glm::Y) -#define sstt swizzle(glm::X, glm::X, glm::Y, glm::Y) -#define tstt swizzle(glm::Y, glm::X, glm::Y, glm::Y) -#define pstt swizzle(glm::Z, glm::X, glm::Y, glm::Y) -#define qstt swizzle(glm::W, glm::X, glm::Y, glm::Y) -#define sttt swizzle(glm::X, glm::Y, glm::Y, glm::Y) -#define tttt swizzle(glm::Y, glm::Y, glm::Y, glm::Y) -#define pttt swizzle(glm::Z, glm::Y, glm::Y, glm::Y) -#define qttt swizzle(glm::W, glm::Y, glm::Y, glm::Y) -#define sptt swizzle(glm::X, glm::Z, glm::Y, glm::Y) -#define tptt swizzle(glm::Y, glm::Z, glm::Y, glm::Y) -#define pptt swizzle(glm::Z, glm::Z, glm::Y, glm::Y) -#define qptt swizzle(glm::W, glm::Z, glm::Y, glm::Y) -#define sqtt swizzle(glm::X, glm::W, glm::Y, glm::Y) -#define tqtt swizzle(glm::Y, glm::W, glm::Y, glm::Y) -#define pqtt swizzle(glm::Z, glm::W, glm::Y, glm::Y) -#define qqtt swizzle(glm::W, glm::W, glm::Y, glm::Y) -#define sspt swizzle(glm::X, glm::X, glm::Z, glm::Y) -#define tspt swizzle(glm::Y, glm::X, glm::Z, glm::Y) -#define pspt swizzle(glm::Z, glm::X, glm::Z, glm::Y) -#define qspt swizzle(glm::W, glm::X, glm::Z, glm::Y) -#define stpt swizzle(glm::X, glm::Y, glm::Z, glm::Y) -#define ttpt swizzle(glm::Y, glm::Y, glm::Z, glm::Y) -#define ptpt swizzle(glm::Z, glm::Y, glm::Z, glm::Y) -#define qtpt swizzle(glm::W, glm::Y, glm::Z, glm::Y) -#define sppt swizzle(glm::X, glm::Z, glm::Z, glm::Y) -#define tppt swizzle(glm::Y, glm::Z, glm::Z, glm::Y) -#define pppt swizzle(glm::Z, glm::Z, glm::Z, glm::Y) -#define qppt swizzle(glm::W, glm::Z, glm::Z, glm::Y) -#define sqpt swizzle(glm::X, glm::W, glm::Z, glm::Y) -#define tqpt swizzle(glm::Y, glm::W, glm::Z, glm::Y) -#define pqpt swizzle(glm::Z, glm::W, glm::Z, glm::Y) -#define qqpt swizzle(glm::W, glm::W, glm::Z, glm::Y) -#define ssqt swizzle(glm::X, glm::X, glm::W, glm::Y) -#define tsqt swizzle(glm::Y, glm::X, glm::W, glm::Y) -#define psqt swizzle(glm::Z, glm::X, glm::W, glm::Y) -#define qsqt swizzle(glm::W, glm::X, glm::W, glm::Y) -#define stqt swizzle(glm::X, glm::Y, glm::W, glm::Y) -#define ttqt swizzle(glm::Y, glm::Y, glm::W, glm::Y) -#define ptqt swizzle(glm::Z, glm::Y, glm::W, glm::Y) -#define qtqt swizzle(glm::W, glm::Y, glm::W, glm::Y) -#define spqt swizzle(glm::X, glm::Z, glm::W, glm::Y) -#define tpqt swizzle(glm::Y, glm::Z, glm::W, glm::Y) -#define ppqt swizzle(glm::Z, glm::Z, glm::W, glm::Y) -#define qpqt swizzle(glm::W, glm::Z, glm::W, glm::Y) -#define sqqt swizzle(glm::X, glm::W, glm::W, glm::Y) -#define tqqt swizzle(glm::Y, glm::W, glm::W, glm::Y) -#define pqqt swizzle(glm::Z, glm::W, glm::W, glm::Y) -#define qqqt swizzle(glm::W, glm::W, glm::W, glm::Y) -#define sssp swizzle(glm::X, glm::X, glm::X, glm::Z) -#define tssp swizzle(glm::Y, glm::X, glm::X, glm::Z) -#define pssp swizzle(glm::Z, glm::X, glm::X, glm::Z) -#define qssp swizzle(glm::W, glm::X, glm::X, glm::Z) -#define stsp swizzle(glm::X, glm::Y, glm::X, glm::Z) -#define ttsp swizzle(glm::Y, glm::Y, glm::X, glm::Z) -#define ptsp swizzle(glm::Z, glm::Y, glm::X, glm::Z) -#define qtsp swizzle(glm::W, glm::Y, glm::X, glm::Z) -#define spsp swizzle(glm::X, glm::Z, glm::X, glm::Z) -#define tpsp swizzle(glm::Y, glm::Z, glm::X, glm::Z) -#define ppsp swizzle(glm::Z, glm::Z, glm::X, glm::Z) -#define qpsp swizzle(glm::W, glm::Z, glm::X, glm::Z) -#define sqsp swizzle(glm::X, glm::W, glm::X, glm::Z) -#define tqsp swizzle(glm::Y, glm::W, glm::X, glm::Z) -#define pqsp swizzle(glm::Z, glm::W, glm::X, glm::Z) -#define qqsp swizzle(glm::W, glm::W, glm::X, glm::Z) -#define sstp swizzle(glm::X, glm::X, glm::Y, glm::Z) -#define tstp swizzle(glm::Y, glm::X, glm::Y, glm::Z) -#define pstp swizzle(glm::Z, glm::X, glm::Y, glm::Z) -#define qstp swizzle(glm::W, glm::X, glm::Y, glm::Z) -#define sttp swizzle(glm::X, glm::Y, glm::Y, glm::Z) -#define tttp swizzle(glm::Y, glm::Y, glm::Y, glm::Z) -#define pttp swizzle(glm::Z, glm::Y, glm::Y, glm::Z) -#define qttp swizzle(glm::W, glm::Y, glm::Y, glm::Z) -#define sptp swizzle(glm::X, glm::Z, glm::Y, glm::Z) -#define tptp swizzle(glm::Y, glm::Z, glm::Y, glm::Z) -#define pptp swizzle(glm::Z, glm::Z, glm::Y, glm::Z) -#define qptp swizzle(glm::W, glm::Z, glm::Y, glm::Z) -#define sqtp swizzle(glm::X, glm::W, glm::Y, glm::Z) -#define tqtp swizzle(glm::Y, glm::W, glm::Y, glm::Z) -#define pqtp swizzle(glm::Z, glm::W, glm::Y, glm::Z) -#define qqtp swizzle(glm::W, glm::W, glm::Y, glm::Z) -#define sspp swizzle(glm::X, glm::X, glm::Z, glm::Z) -#define tspp swizzle(glm::Y, glm::X, glm::Z, glm::Z) -#define pspp swizzle(glm::Z, glm::X, glm::Z, glm::Z) -#define qspp swizzle(glm::W, glm::X, glm::Z, glm::Z) -#define stpp swizzle(glm::X, glm::Y, glm::Z, glm::Z) -#define ttpp swizzle(glm::Y, glm::Y, glm::Z, glm::Z) -#define ptpp swizzle(glm::Z, glm::Y, glm::Z, glm::Z) -#define qtpp swizzle(glm::W, glm::Y, glm::Z, glm::Z) -#define sppp swizzle(glm::X, glm::Z, glm::Z, glm::Z) -#define tppp swizzle(glm::Y, glm::Z, glm::Z, glm::Z) -#define pppp swizzle(glm::Z, glm::Z, glm::Z, glm::Z) -#define qppp swizzle(glm::W, glm::Z, glm::Z, glm::Z) -#define sqpp swizzle(glm::X, glm::W, glm::Z, glm::Z) -#define tqpp swizzle(glm::Y, glm::W, glm::Z, glm::Z) -#define pqpp swizzle(glm::Z, glm::W, glm::Z, glm::Z) -#define qqpp swizzle(glm::W, glm::W, glm::Z, glm::Z) -#define ssqp swizzle(glm::X, glm::X, glm::W, glm::Z) -#define tsqp swizzle(glm::Y, glm::X, glm::W, glm::Z) -#define psqp swizzle(glm::Z, glm::X, glm::W, glm::Z) -#define qsqp swizzle(glm::W, glm::X, glm::W, glm::Z) -#define stqp swizzle(glm::X, glm::Y, glm::W, glm::Z) -#define ttqp swizzle(glm::Y, glm::Y, glm::W, glm::Z) -#define ptqp swizzle(glm::Z, glm::Y, glm::W, glm::Z) -#define qtqp swizzle(glm::W, glm::Y, glm::W, glm::Z) -#define spqp swizzle(glm::X, glm::Z, glm::W, glm::Z) -#define tpqp swizzle(glm::Y, glm::Z, glm::W, glm::Z) -#define ppqp swizzle(glm::Z, glm::Z, glm::W, glm::Z) -#define qpqp swizzle(glm::W, glm::Z, glm::W, glm::Z) -#define sqqp swizzle(glm::X, glm::W, glm::W, glm::Z) -#define tqqp swizzle(glm::Y, glm::W, glm::W, glm::Z) -#define pqqp swizzle(glm::Z, glm::W, glm::W, glm::Z) -#define qqqp swizzle(glm::W, glm::W, glm::W, glm::Z) -#define sssq swizzle(glm::X, glm::X, glm::X, glm::W) -#define tssq swizzle(glm::Y, glm::X, glm::X, glm::W) -#define pssq swizzle(glm::Z, glm::X, glm::X, glm::W) -#define qssq swizzle(glm::W, glm::X, glm::X, glm::W) -#define stsq swizzle(glm::X, glm::Y, glm::X, glm::W) -#define ttsq swizzle(glm::Y, glm::Y, glm::X, glm::W) -#define ptsq swizzle(glm::Z, glm::Y, glm::X, glm::W) -#define qtsq swizzle(glm::W, glm::Y, glm::X, glm::W) -#define spsq swizzle(glm::X, glm::Z, glm::X, glm::W) -#define tpsq swizzle(glm::Y, glm::Z, glm::X, glm::W) -#define ppsq swizzle(glm::Z, glm::Z, glm::X, glm::W) -#define qpsq swizzle(glm::W, glm::Z, glm::X, glm::W) -#define sqsq swizzle(glm::X, glm::W, glm::X, glm::W) -#define tqsq swizzle(glm::Y, glm::W, glm::X, glm::W) -#define pqsq swizzle(glm::Z, glm::W, glm::X, glm::W) -#define qqsq swizzle(glm::W, glm::W, glm::X, glm::W) -#define sstq swizzle(glm::X, glm::X, glm::Y, glm::W) -#define tstq swizzle(glm::Y, glm::X, glm::Y, glm::W) -#define pstq swizzle(glm::Z, glm::X, glm::Y, glm::W) -#define qstq swizzle(glm::W, glm::X, glm::Y, glm::W) -#define sttq swizzle(glm::X, glm::Y, glm::Y, glm::W) -#define tttq swizzle(glm::Y, glm::Y, glm::Y, glm::W) -#define pttq swizzle(glm::Z, glm::Y, glm::Y, glm::W) -#define qttq swizzle(glm::W, glm::Y, glm::Y, glm::W) -#define sptq swizzle(glm::X, glm::Z, glm::Y, glm::W) -#define tptq swizzle(glm::Y, glm::Z, glm::Y, glm::W) -#define pptq swizzle(glm::Z, glm::Z, glm::Y, glm::W) -#define qptq swizzle(glm::W, glm::Z, glm::Y, glm::W) -#define sqtq swizzle(glm::X, glm::W, glm::Y, glm::W) -#define tqtq swizzle(glm::Y, glm::W, glm::Y, glm::W) -#define pqtq swizzle(glm::Z, glm::W, glm::Y, glm::W) -#define qqtq swizzle(glm::W, glm::W, glm::Y, glm::W) -#define sspq swizzle(glm::X, glm::X, glm::Z, glm::W) -#define tspq swizzle(glm::Y, glm::X, glm::Z, glm::W) -#define pspq swizzle(glm::Z, glm::X, glm::Z, glm::W) -#define qspq swizzle(glm::W, glm::X, glm::Z, glm::W) -#define stpq swizzle(glm::X, glm::Y, glm::Z, glm::W) -#define ttpq swizzle(glm::Y, glm::Y, glm::Z, glm::W) -#define ptpq swizzle(glm::Z, glm::Y, glm::Z, glm::W) -#define qtpq swizzle(glm::W, glm::Y, glm::Z, glm::W) -#define sppq swizzle(glm::X, glm::Z, glm::Z, glm::W) -#define tppq swizzle(glm::Y, glm::Z, glm::Z, glm::W) -#define pppq swizzle(glm::Z, glm::Z, glm::Z, glm::W) -#define qppq swizzle(glm::W, glm::Z, glm::Z, glm::W) -#define sqpq swizzle(glm::X, glm::W, glm::Z, glm::W) -#define tqpq swizzle(glm::Y, glm::W, glm::Z, glm::W) -#define pqpq swizzle(glm::Z, glm::W, glm::Z, glm::W) -#define qqpq swizzle(glm::W, glm::W, glm::Z, glm::W) -#define ssqq swizzle(glm::X, glm::X, glm::W, glm::W) -#define tsqq swizzle(glm::Y, glm::X, glm::W, glm::W) -#define psqq swizzle(glm::Z, glm::X, glm::W, glm::W) -#define qsqq swizzle(glm::W, glm::X, glm::W, glm::W) -#define stqq swizzle(glm::X, glm::Y, glm::W, glm::W) -#define ttqq swizzle(glm::Y, glm::Y, glm::W, glm::W) -#define ptqq swizzle(glm::Z, glm::Y, glm::W, glm::W) -#define qtqq swizzle(glm::W, glm::Y, glm::W, glm::W) -#define spqq swizzle(glm::X, glm::Z, glm::W, glm::W) -#define tpqq swizzle(glm::Y, glm::Z, glm::W, glm::W) -#define ppqq swizzle(glm::Z, glm::Z, glm::W, glm::W) -#define qpqq swizzle(glm::W, glm::Z, glm::W, glm::W) -#define sqqq swizzle(glm::X, glm::W, glm::W, glm::W) -#define tqqq swizzle(glm::Y, glm::W, glm::W, glm::W) -#define pqqq swizzle(glm::Z, glm::W, glm::W, glm::W) -#define qqqq swizzle(glm::W, glm::W, glm::W, glm::W) +// +// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz) +// +#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ + _GLM_SWIZZLE_TEMPLATE1 \ + V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ + { \ + return a() OPERAND b; \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return a OPERAND b(); \ + } -#endif +// +// Macro for wrapping a function taking one argument (e.g. abs()) +// +#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE1 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ + { \ + return FUNCTION(a()); \ + } + +// +// Macro for wrapping a function taking two vector arguments (e.g. dot()). +// +#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE2 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + { \ + return FUNCTION(a(), b()); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return FUNCTION(a(), b()); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ + { \ + return FUNCTION(a(), b); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return FUNCTION(a, b()); \ + } + +// +// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()). +// +#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE2 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ + { \ + return FUNCTION(a(), b(), c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + { \ + return FUNCTION(a(), b(), c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ + { \ + return FUNCTION(a(), b, c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + { \ + return FUNCTION(a, b(), c); \ + } + +}//namespace detail +}//namespace glm + +namespace glm +{ + namespace detail + { + _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-) + _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/) + } + + // + // Swizzles are distinct types from the unswizzled type. The below macros will + // provide template specializations for the swizzle types for the given functions + // so that the compiler does not have any ambiguity to choosing how to handle + // the function. + // + // The alternative is to use the operator()() when calling the function in order + // to explicitly convert the swizzled type to the unswizzled type. + // + + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any); + + //_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot); + //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross); + //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step); + //_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix); +} + +#define _GLM_SWIZZLE2_2_MEMBERS(T,P,E0,E1) \ + struct { glm::detail::swizzle<2,T,P,0,0,-1,-2> E0 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P,0,1,-1,-2> E0 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P,1,0,-1,-2> E1 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P,1,1,-1,-2> E1 ## E1; }; + +#define _GLM_SWIZZLE2_3_MEMBERS(T,P2,E0,E1) \ + struct { glm::detail::swizzle<3,T,P2,0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P2,0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P2,0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P2,0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P2,1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P2,1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P2,1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P2,1,1,1,-1> E1 ## E1 ## E1; }; + +#define _GLM_SWIZZLE2_4_MEMBERS(T,P2,E0,E1) \ + struct { glm::detail::swizzle<4,T,P2,0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,1,1> E1 ## E1 ## E1 ## E1; }; + +#define _GLM_SWIZZLE3_2_MEMBERS(T,P2,E0,E1,E2) \ + struct { glm::detail::swizzle<2,T,P2,0,0,-1,-2> E0 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P2,0,1,-1,-2> E0 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P2,0,2,-1,-2> E0 ## E2; }; \ + struct { glm::detail::swizzle<2,T,P2,1,0,-1,-2> E1 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P2,1,1,-1,-2> E1 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P2,1,2,-1,-2> E1 ## E2; }; \ + struct { glm::detail::swizzle<2,T,P2,2,0,-1,-2> E2 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P2,2,1,-1,-2> E2 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P2,2,2,-1,-2> E2 ## E2; }; + +#define _GLM_SWIZZLE3_3_MEMBERS(T,P,E0,E1,E2) \ + struct { glm::detail::swizzle<3,T,P,0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,2,2,2,-1> E2 ## E2 ## E2; }; + +#define _GLM_SWIZZLE3_4_MEMBERS(T,P2,E0,E1,E2) \ + struct { glm::detail::swizzle<4,T,P2,0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P2,2,2,2,2> E2 ## E2 ## E2 ## E2; }; + +#define _GLM_SWIZZLE4_2_MEMBERS(T,P,E0,E1,E2,E3) \ + struct { glm::detail::swizzle<2,T,P,0,0,-1,-2> E0 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P,0,1,-1,-2> E0 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P,0,2,-1,-2> E0 ## E2; }; \ + struct { glm::detail::swizzle<2,T,P,0,3,-1,-2> E0 ## E3; }; \ + struct { glm::detail::swizzle<2,T,P,1,0,-1,-2> E1 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P,1,1,-1,-2> E1 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P,1,2,-1,-2> E1 ## E2; }; \ + struct { glm::detail::swizzle<2,T,P,1,3,-1,-2> E1 ## E3; }; \ + struct { glm::detail::swizzle<2,T,P,2,0,-1,-2> E2 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P,2,1,-1,-2> E2 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P,2,2,-1,-2> E2 ## E2; }; \ + struct { glm::detail::swizzle<2,T,P,2,3,-1,-2> E2 ## E3; }; \ + struct { glm::detail::swizzle<2,T,P,3,0,-1,-2> E3 ## E0; }; \ + struct { glm::detail::swizzle<2,T,P,3,1,-1,-2> E3 ## E1; }; \ + struct { glm::detail::swizzle<2,T,P,3,2,-1,-2> E3 ## E2; }; \ + struct { glm::detail::swizzle<2,T,P,3,3,-1,-2> E3 ## E3; }; + +#define _GLM_SWIZZLE4_3_MEMBERS(T,P,E0,E1,E2,E3) \ + struct { glm::detail::swizzle<3,T,P,0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,0,0,3,-1> E0 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,0,1,3,-1> E0 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,0,2,3,-1> E0 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,0,3,0,-1> E0 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,0,3,1,-1> E0 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,0,3,2,-1> E0 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,0,3,3,-1> E0 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,1,0,3,-1> E1 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,1,1,3,-1> E1 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,1,2,3,-1> E1 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,1,3,0,-1> E1 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,1,3,1,-1> E1 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,1,3,2,-1> E1 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,1,3,3,-1> E1 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,2,0,3,-1> E2 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,2,1,3,-1> E2 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,2,2,2,-1> E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,2,2,3,-1> E2 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,2,3,0,-1> E2 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,2,3,1,-1> E2 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,2,3,2,-1> E2 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,2,3,3,-1> E2 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,3,0,0,-1> E3 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,3,0,1,-1> E3 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,3,0,2,-1> E3 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,3,0,3,-1> E3 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,3,1,0,-1> E3 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,3,1,1,-1> E3 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,3,1,2,-1> E3 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,3,1,3,-1> E3 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,3,2,0,-1> E3 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,3,2,1,-1> E3 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,3,2,2,-1> E3 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,3,2,3,-1> E3 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<3,T,P,3,3,0,-1> E3 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<3,T,P,3,3,1,-1> E3 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<3,T,P,3,3,2,-1> E3 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<3,T,P,3,3,3,-1> E3 ## E3 ## E3; }; + +#define _GLM_SWIZZLE4_4_MEMBERS(T,P,E0,E1,E2,E3) \ + struct { glm::detail::swizzle<4,T,P,0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ + struct { glm::detail::swizzle<4,T,P,3,3,3,3> E3 ## E3 ## E3 ## E3; }; #endif//glm_core_swizzle diff --git a/include/eepp/helper/glm/core/_swizzle.inl b/include/eepp/helper/glm/core/_swizzle.inl deleted file mode 100644 index 112e8e30a..000000000 --- a/include/eepp/helper/glm/core/_swizzle.inl +++ /dev/null @@ -1,20 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2006-04-27 -// Updated : 2006-04-27 -// Licence : This source is under MIT License -// File : _swizzle.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef __swizzle_inl__ -#define __swizzle_inl__ - -#include "./_swizzle.h" - -namespace glm -{ - -} - -#endif//__swizzle_inl__ diff --git a/include/eepp/helper/glm/core/dummy.cpp b/include/eepp/helper/glm/core/dummy.cpp deleted file mode 100644 index b633b5bd8..000000000 --- a/include/eepp/helper/glm/core/dummy.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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. - -#include "../glm.hpp" -#include "../ext.hpp" - -//#error "GLM is a header only library" - -int main() -{ - -} diff --git a/include/eepp/helper/glm/core/func_common.hpp b/include/eepp/helper/glm/core/func_common.hpp index b48012f16..c524948a7 100644 --- a/include/eepp/helper/glm/core/func_common.hpp +++ b/include/eepp/helper/glm/core/func_common.hpp @@ -1,107 +1,173 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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.20.8 specification, section 8.3 Common Functions +/// +/// @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 test{ - void main_core_func_common(); - }//namespace test + /// @addtogroup core_func_common + /// @{ - namespace core{ - namespace function{ - //! Define common functions from Section 8.3 of GLSL 1.30.8 specification. Included in glm namespace. - namespace common{ + /// Returns x if x >= 0; otherwise, it returns -x. + /// + /// @tparam genType floating-point or signed integer; scalar or vector types. + /// + /// @see GLSL abs man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + genType abs(genType const & x); - /// \addtogroup core_funcs - ///@{ + /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. + /// + /// @tparam genType Floating-point or signed integer; scalar or vector types. + /// + /// @see GLSL sign man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template + genType sign(genType const & x); - //! Returns x if x >= 0; otherwise, it returns -x. - //! (From GLSL 1.30.08 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. - //! (From GLSL 1.30.08 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. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns a value equal to the nearest integer that is less then or equal to x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL floor man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions 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. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns a value equal to the nearest integer to x + /// whose absolute value is not larger than the absolute value of x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL trunc man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType trunc(genType const & x); - //! Returns a value equal to the nearest integer to x. - //! The fraction 0.5 will round in a direction chosen by the - //! implementation, presumably the direction that is fastest. - //! This includes the possibility that round(x) returns the - //! same value as roundEven(x) for all values of x. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns a value equal to the nearest integer to x. + /// The fraction 0.5 will round in a direction chosen by the + /// implementation, presumably the direction that is fastest. + /// This includes the possibility that round(x) returns the + /// same value as roundEven(x) for all values of x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL round man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType round(genType const & x); - //! Returns a value equal to the nearest integer to x. - //! 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.) - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns a value equal to the nearest integer to x. + /// 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.) + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL roundEven man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + /// @see New round to even technique template genType roundEven(genType const & x); - //! Returns a value equal to the nearest integer - //! that is greater than or equal to x. - //! (From GLSL 1.30.08 specification, section 8.3) - template + /// Returns a value equal to the nearest integer + /// that is greater than or equal to x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL ceil man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template genType ceil(genType const & x); - //! Return x - floor(x). - //! (From GLSL 1.30.08 specification, section 8.3) - template + /// Return x - floor(x). + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL fract man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template genType fract(genType const & x); - //! Modulus. Returns x - y * floor(x / y) - //! for each component in x using the floating point value y. - //! (From GLSL 1.30.08 specification, section 8.3) - template + /// Modulus. Returns x - y * floor(x / y) + /// for each component in x using the floating point value y. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL mod man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template genType mod( genType const & x, genType const & y); - //! Modulus. Returns x - y * floor(x / y) - //! for each component in x using the floating point value y. - //! (From GLSL 1.30.08 specification, section 8.3) - template + /// Modulus. Returns x - y * floor(x / y) + /// for each component in x using the floating point value y. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL mod man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + template genType mod( genType const & x, typename genType::value_type const & y); - //! Returns the fractional part of x and sets i to the integer - //! part (as a whole number floating point value). Both the - //! return value and the output parameter will have the same - //! sign as x. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns the fractional part of x and sets i to the integer + /// part (as a whole number floating point value). Both the + /// return value and the output parameter will have the same + /// sign as x. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL modf man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType modf( genType const & x, genType & i); - //! Returns y if y < x; otherwise, it returns x. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns y if y < x; otherwise, it returns x. + /// + /// @tparam genType Floating-point or integer; scalar or vector types. + /// + /// @see GLSL min man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType min( genType const & x, @@ -112,8 +178,12 @@ namespace glm genType const & x, typename genType::value_type const & y); - //! Returns y if x < y; otherwise, it returns x. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns y if x < y; otherwise, it returns x. + /// + /// @tparam genType Floating-point or integer; scalar or vector types. + /// + /// @see GLSL max man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType max( genType const & x, @@ -124,9 +194,13 @@ namespace glm genType const & x, typename genType::value_type const & y); - //! Returns min(max(x, minVal), maxVal) for each component in x - //! using the floating-point values minVal and maxVal. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns min(max(x, minVal), maxVal) for each component in x + /// using the floating-point values minVal and maxVal. + /// + /// @tparam genType Floating-point or integer; scalar or vector types. + /// + /// @see GLSL clamp man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType clamp( genType const & x, @@ -139,12 +213,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 @@ -155,19 +229,39 @@ namespace glm //! provides different functionality than //! genType mix(genType x, genType y, genType(a)) //! where a is a Boolean vector. - //! - //! From 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 Common Functions + /// + /// @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. - //! (From GLSL 1.30.08 specification, section 8.3) + //! + /// @see GLSL step man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType step( genType const & edge, @@ -178,16 +272,20 @@ namespace glm typename genType::value_type const & edge, genType const & x); - //! Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and - //! performs smooth Hermite interpolation between 0 and 1 - //! when edge0 < x < edge1. This is useful in cases where - //! you would want a threshold function with a smooth - //! transition. This is equivalent to: - //! genType t; - //! t = clamp ((x – edge0) / (edge1 – edge0), 0, 1); - //! return t * t * (3 – 2 * t); - //! Results are undefined if edge0 >= edge1. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and + /// performs smooth Hermite interpolation between 0 and 1 + /// when edge0 < x < edge1. This is useful in cases where + /// you would want a threshold function with a smooth + /// transition. This is equivalent to: + /// genType t; + /// t = clamp ((x – edge0) / (edge1 – edge0), 0, 1); + /// return t * t * (3 – 2 * t); + /// Results are undefined if edge0 >= edge1. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL smoothstep man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType smoothstep( genType const & edge0, @@ -200,82 +298,133 @@ namespace glm typename genType::value_type const & edge1, genType const & x); - //! Returns true if x holds a NaN (not a number) - //! representation in the underlying implementation's set of - //! floating point representations. Returns false otherwise, - //! including for implementations with no NaN - //! representations. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns true if x holds a NaN (not a number) + /// representation in the underlying implementation's set of + /// floating point representations. Returns false otherwise, + /// including for implementations with no NaN + /// representations. + /// + /// /!\ When using compiler fast math, this function may fail. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL isnan man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template typename genType::bool_type isnan(genType const & x); - //! Returns true if x holds a positive infinity or negative - //! infinity representation in the underlying implementation's - //! set of floating point representations. Returns false - //! otherwise, including for implementations with no infinity - //! representations. - //! (From GLSL 1.30.08 specification, section 8.3) + /// Returns true if x holds a positive infinity or negative + /// infinity representation in the underlying implementation's + /// set of floating point representations. Returns false + /// otherwise, including for implementations with no infinity + /// representations. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL isinf man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template typename genType::bool_type isinf(genType const & x); - //! Returns a signed or unsigned integer value representing - //! the encoding of a floating-point value. The floatingpoint - //! value's bit-level representation is preserved. - //! (From GLSL 4.00.08 specification, section 8.3) + /// Returns a signed integer value representing + /// the encoding of a floating-point value. The floatingpoint + /// value's bit-level representation is preserved. + /// + /// @tparam genType Single-precision floating-point scalar or vector types. + /// @tparam genIType Signed integer scalar or vector types. + /// + /// @see GLSL floatBitsToInt man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genIType floatBitsToInt(genType const & value); - //! Returns a signed or unsigned integer value representing - //! the encoding of a floating-point value. The floatingpoint - //! value's bit-level representation is preserved. - //! (From GLSL 4.00.08 specification, section 8.3) + /// Returns a unsigned integer value representing + /// the encoding of a floating-point value. The floatingpoint + /// value's bit-level representation is preserved. + /// + /// @tparam genType Single-precision floating-point scalar or vector types. + /// @tparam genUType Unsigned integer scalar or vector types. + /// + /// @see GLSL floatBitsToUint man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genUType floatBitsToInt(genType const & value); + genUType floatBitsToUint(genType const & value); - //! Returns a floating-point value corresponding to a signed - //! or unsigned integer encoding of a floating-point value. - //! If an inf or NaN is passed in, it will not signal, and the - //! resulting floating point value is unspecified. Otherwise, - //! the bit-level representation is preserved. - //! (From GLSL 4.00.08 specification, section 8.3) - template - genType intBitsToFloat(genIUType const & value); + /// Returns a floating-point value corresponding to a signed + /// integer encoding of a floating-point value. + /// If an inf or NaN is passed in, it will not signal, and the + /// resulting floating point value is unspecified. Otherwise, + /// the bit-level representation is preserved. + /// + /// @tparam genType Single-precision floating-point scalar or vector types. + /// @tparam genIType Signed integer scalar or vector types. + /// + /// @see GLSL intBitsToFloat man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + /// + /// @todo Clarify this declaration, we don't need to actually specify the return type + template + genType intBitsToFloat(genIType const & value); - //! Computes and returns a * b + c. - //! (From GLSL 4.00.08 specification, section 8.3) + /// Returns a floating-point value corresponding to a + /// unsigned integer encoding of a floating-point value. + /// If an inf or NaN is passed in, it will not signal, and the + /// resulting floating point value is unspecified. Otherwise, + /// the bit-level representation is preserved. + /// + /// @tparam genType Single-precision floating-point scalar or vector types. + /// @tparam genUType Unsigned integer scalar or vector types. + /// + /// @see GLSL uintBitsToFloat man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions + /// + /// @todo Clarify this declaration, we don't need to actually specify the return type + template + genType uintBitsToFloat(genUType const & value); + + /// Computes and returns a * b + c. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL fma man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType fma(genType const & a, genType const & b, genType const & c); - //! Splits x into a floating-point significand in the range - //! [0.5, 1.0) and an integral exponent of two, such that: - //! x = significand * exp(2, exponent) - //! The significand is returned by the function and the - //! exponent is returned in the parameter exp. For a - //! floating-point value of zero, the significant and exponent - //! are both zero. For a floating-point value that is an - //! infinity or is not a number, the results are undefined. - //! (From GLSL 4.00.08 specification, section 8.3) + /// Splits x into a floating-point significand in the range + /// [0.5, 1.0) and an integral exponent of two, such that: + /// x = significand * exp(2, exponent) + /// + /// The significand is returned by the function and the + /// exponent is returned in the parameter exp. For a + /// floating-point value of zero, the significant and exponent + /// are both zero. For a floating-point value that is an + /// infinity or is not a number, the results are undefined. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL frexp man page + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template genType frexp(genType const & x, genIType & exp); - //! Builds a floating-point number from x and the - //! corresponding integral exponent of two in exp, returning: - //! significand * exp(2, exponent) - //! If this product is too large to be represented in the - //! floating-point type, the result is undefined. - //! (From GLSL 4.00.08 specification, section 8.3) + /// Builds a floating-point number from x and the + /// corresponding integral exponent of two in exp, returning: + /// significand * exp(2, exponent) + /// + /// If this product is too large to be represented in the + /// floating-point type, the result is undefined. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL ldexp man page; + /// @see GLSL 4.20.8 specification, section 8.3 Common Functions 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/include/eepp/helper/glm/core/func_common.inl b/include/eepp/helper/glm/core/func_common.inl index c15a4131f..25f05af5a 100644 --- a/include/eepp/helper/glm/core/func_common.inl +++ b/include/eepp/helper/glm/core/func_common.inl @@ -1,524 +1,276 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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; + // TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff; + } + }; - template - struct Abs_ + template + struct Abs_ + { + static genFIType get(genFIType const & x) { - 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( + 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 - inline genFIType abs( - genFIType const & x) - { + GLM_FUNC_QUALIFIER genFIType abs + ( + genFIType const & x + ) + { return detail::Abs_::is_signed>::get(x); - } + } - //template - //inline detail::tvec1 abs( - // detail::tvec1 const & v) - //{ - // return detail::tvec1( - // abs(v.x)); - //} - - template - inline detail::tvec2 abs( - detail::tvec2 const & v) - { - return detail::tvec2( - abs(v.x), - abs(v.y)); - } - - template - inline detail::tvec3 abs( - detail::tvec3 const & v) - { - return detail::tvec3( - abs(v.x), - abs(v.y), - abs(v.z)); - } - - template - inline detail::tvec4 abs( - detail::tvec4 const & v) - { - return detail::tvec4( - abs(v.x), - abs(v.y), - abs(v.z), - abs(v.w)); - } - - // sign + VECTORIZE_VEC(abs) + // sign //Try something like based on x >> 31 to get the sign bit - template - inline genFIType sign( - genFIType const & x) + template + GLM_FUNC_QUALIFIER genFIType sign + ( + genFIType const & x + ) { GLM_STATIC_ASSERT( detail::type::is_float || detail::type::is_int, "'sign' only accept signed inputs"); - + genFIType result; if(x > genFIType(0)) - result = genFIType(1); - else if(x < genFIType(0)) - result = genFIType(-1); - else - result = genFIType(0); - return result; + result = genFIType(1); + else if(x < genFIType(0)) + result = genFIType(-1); + else + result = genFIType(0); + return result; } - template - inline detail::tvec2 sign( - detail::tvec2 const & x) - { - return detail::tvec2( - sign(x.x), - sign(x.y)); - } + VECTORIZE_VEC(sign) - template - inline detail::tvec3 sign( - detail::tvec3 const & x) - { - return detail::tvec3( - sign(x.x), - sign(x.y), - sign(x.z)); - } + // floor + template <> + GLM_FUNC_QUALIFIER detail::half floor(detail::half const & x) + { + return detail::half(::std::floor(float(x))); + } - template - inline detail::tvec4 sign( - detail::tvec4 const & x) - { - return detail::tvec4( - sign(x.x), - sign(x.y), - sign(x.z), - sign(x.w)); - } - - // floor - template <> - inline detail::thalf floor(detail::thalf const& x) - { - return detail::thalf(::std::floor(float(x))); - } - - template - inline genType floor(genType const& x) - { + template + GLM_FUNC_QUALIFIER genType floor(genType const & x) + { GLM_STATIC_ASSERT(detail::type::is_float, "'floor' only accept floating-point inputs"); - return ::std::floor(x); - } + return ::std::floor(x); + } - template - inline detail::tvec2 floor(detail::tvec2 const& x) - { - return detail::tvec2( - floor(x.x), - floor(x.y)); - } + VECTORIZE_VEC(floor) - template - inline detail::tvec3 floor(detail::tvec3 const& x) - { - return detail::tvec3( - floor(x.x), - floor(x.y), - floor(x.z)); - } - - template - inline detail::tvec4 floor(detail::tvec4 const& x) - { - return detail::tvec4( - floor(x.x), - floor(x.y), - floor(x.z), - floor(x.w)); - } - - // trunc - template - inline genType trunc(genType const & x) - { + // trunc + template + GLM_FUNC_QUALIFIER genType trunc(genType const & x) + { GLM_STATIC_ASSERT(detail::type::is_float, "'trunc' only accept floating-point inputs"); - return x < 0 ? -floor(-x) : floor(x); - } + return x < 0 ? -floor(-x) : floor(x); + } - template - inline detail::tvec2 trunc(detail::tvec2 const & x) - { - return detail::tvec2( - trunc(x.x), - trunc(x.y)); - } + VECTORIZE_VEC(trunc) - template - inline detail::tvec3 trunc(detail::tvec3 const & x) - { - return detail::tvec3( - trunc(x.x), - trunc(x.y), - trunc(x.z)); - } - - template - inline detail::tvec4 trunc(detail::tvec4 const & x) - { - return detail::tvec4( - trunc(x.x), - trunc(x.y), - trunc(x.z), - trunc(x.w)); - } - - // round - template - inline genType round(genType const& x) - { + // round + template + GLM_FUNC_QUALIFIER genType round(genType const& x) + { GLM_STATIC_ASSERT(detail::type::is_float, "'round' only accept floating-point inputs"); - return genType(int(x + genType(0.5))); - } + if(x < 0) + return genType(int(x - genType(0.5))); + return genType(int(x + genType(0.5))); + } - template - inline detail::tvec2 round(detail::tvec2 const& x) - { - return detail::tvec2( - round(x.x), - round(x.y)); - } + VECTORIZE_VEC(round) - template - inline detail::tvec3 round(detail::tvec3 const& x) - { - return detail::tvec3( - round(x.x), - round(x.y), - round(x.z)); - } - - template - inline detail::tvec4 round(detail::tvec4 const& x) - { - return detail::tvec4( - round(x.x), - round(x.y), - round(x.z), - round(x.w)); - } - - // roundEven - template - inline genType roundEven(genType const& x) - { +/* + // roundEven + template + GLM_FUNC_QUALIFIER genType roundEven(genType const& x) + { GLM_STATIC_ASSERT(detail::type::is_float, "'roundEven' only accept floating-point inputs"); 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"); + + int Integer = int(x); + genType IntegerPart = genType(Integer); + genType FractionalPart = fract(x); - template - inline detail::tvec2 roundEven(detail::tvec2 const& x) - { - return detail::tvec2( - roundEven(x.x), - roundEven(x.y)); - } + if(FractionalPart > genType(0.5) || FractionalPart < genType(0.5)) + { + return round(x); + } + else if((Integer % 2) == 0) + { + return IntegerPart; + } + else if(x <= genType(0)) // Work around... + { + return IntegerPart - 1; + } + else + { + return IntegerPart + 1; + } + //else // Bug on MinGW 4.5.2 + //{ + // return mix(IntegerPart + genType(-1), IntegerPart + genType(1), x <= genType(0)); + //} + } + + VECTORIZE_VEC(roundEven) - template - inline detail::tvec3 roundEven(detail::tvec3 const& x) - { - return detail::tvec3( - roundEven(x.x), - roundEven(x.y), - roundEven(x.z)); - } - - template - inline detail::tvec4 roundEven(detail::tvec4 const& x) - { - return detail::tvec4( - roundEven(x.x), - roundEven(x.y), - roundEven(x.z), - roundEven(x.w)); - } - - // ceil - template - inline genType ceil(genType const & x) - { + // ceil + template + GLM_FUNC_QUALIFIER genType ceil(genType const & x) + { GLM_STATIC_ASSERT(detail::type::is_float, "'ceil' only accept floating-point inputs"); - return ::std::ceil(x); - } + return ::std::ceil(x); + } - template - inline detail::tvec2 ceil(detail::tvec2 const & x) - { - return detail::tvec2( - ceil(x.x), - ceil(x.y)); - } + VECTORIZE_VEC(ceil) - template - inline detail::tvec3 ceil(detail::tvec3 const & x) - { - return detail::tvec3( - ceil(x.x), - ceil(x.y), - ceil(x.z)); - } - - template - inline detail::tvec4 ceil(detail::tvec4 const & x) - { - return detail::tvec4( - ceil(x.x), - ceil(x.y), - ceil(x.z), - ceil(x.w)); - } - - // fract - template - inline genType fract + // fract + template + GLM_FUNC_QUALIFIER genType fract ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'fract' only accept floating-point inputs"); - return x - ::std::floor(x); - } + return x - ::std::floor(x); + } - template - inline detail::tvec2 fract - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - fract(x.x), - fract(x.y)); - } + VECTORIZE_VEC(fract) - template - inline detail::tvec3 fract - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - fract(x.x), - fract(x.y), - fract(x.z)); - } - - template - inline detail::tvec4 fract - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - fract(x.x), - fract(x.y), - fract(x.z), - fract(x.w)); - } - - // mod - template - inline genType mod + // mod + template + GLM_FUNC_QUALIFIER genType mod ( genType const & x, genType const & y ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'mod' only accept floating-point inputs"); - return x - y * floor(x / y); - } + return x - y * floor(x / y); + } - template - inline detail::tvec2 mod - ( - detail::tvec2 const & x, - typename detail::tvec2::value_type const & y - ) - { - return detail::tvec2( - mod(x.x, y), - mod(x.y, y)); - } + VECTORIZE_VEC_SCA(mod) + VECTORIZE_VEC_VEC(mod) - template - inline detail::tvec3 mod - ( - detail::tvec3 const & x, - typename detail::tvec3::value_type const & y - ) - { - return detail::tvec3( - mod(x.x, y), - mod(x.y, y), - mod(x.z, y)); - } - - template - inline detail::tvec4 mod - ( - detail::tvec4 const & x, - typename detail::tvec4::value_type const & y - ) - { - return detail::tvec4( - mod(x.x, y), - mod(x.y, y), - mod(x.z, y), - mod(x.w, y)); - } - - template - inline detail::tvec2 mod - ( - detail::tvec2 const & x, - detail::tvec2 const & y - ) - { - return detail::tvec2( - mod(x.x, y.x), - mod(x.y, y.y)); - } - - template - inline detail::tvec3 mod - ( - detail::tvec3 const & x, - detail::tvec3 const & y - ) - { - return detail::tvec3( - mod(x.x, y.x), - mod(x.y, y.y), - mod(x.z, y.z)); - } - - template - inline detail::tvec4 mod - ( - detail::tvec4 const & x, - detail::tvec4 const & y - ) - { - return detail::tvec4( - mod(x.x, y.x), - mod(x.y, y.y), - mod(x.z, y.z), - mod(x.w, y.w)); - } - - // modf - template - inline genType modf + // modf + template + GLM_FUNC_QUALIFIER genType modf ( genType const & x, genType & i ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'modf' only accept floating-point inputs"); - i = glm::floor(x); + return std::modf(x, &i); + } - return x - i; - } - - template - inline detail::tvec2 modf + template + GLM_FUNC_QUALIFIER detail::tvec2 modf ( detail::tvec2 const & x, - detail::tvec2 const & y + detail::tvec2 & i ) - { - return detail::tvec2( - modf(x.x, y.x), - modf(x.y, y.y)); - } + { + return detail::tvec2( + modf(x.x, i.x), + modf(x.y, i.y)); + } - template - inline detail::tvec3 modf + template + GLM_FUNC_QUALIFIER detail::tvec3 modf ( detail::tvec3 const & x, - detail::tvec3 const & y + detail::tvec3 & i ) - { - return detail::tvec3( - modf(x.x, y.x), - modf(x.y, y.y), - modf(x.z, y.z)); - } + { + return detail::tvec3( + modf(x.x, i.x), + modf(x.y, i.y), + modf(x.z, i.z)); + } - template - inline detail::tvec4 modf + template + GLM_FUNC_QUALIFIER detail::tvec4 modf ( detail::tvec4 const & x, - detail::tvec4 const & y + detail::tvec4 & i ) - { - return detail::tvec4( - modf(x.x, y.x), - modf(x.y, y.y), - modf(x.z, y.z), - modf(x.w, y.w)); - } + { + return detail::tvec4( + modf(x.x, i.x), + modf(x.y, i.y), + modf(x.z, i.z), + modf(x.w, i.w)); + } //// Only valid if (INT_MIN <= x-y <= INT_MAX) //// min(x,y) @@ -528,202 +280,53 @@ namespace glm //r = x - ((x - y) & ((x - y) >> (sizeof(int) * //CHAR_BIT - 1))); - // min - template - inline genType min + // min + template + GLM_FUNC_QUALIFIER genType min ( genType const & x, genType const & y ) - { + { GLM_STATIC_ASSERT( detail::type::is_float || detail::type::is_int || detail::type::is_uint, "'min' only accept numbers"); - return x < y ? x : y; - } + return x < y ? x : y; + } - template - inline detail::tvec2 min - ( - detail::tvec2 const & x, - typename detail::tvec2::value_type const & y - ) - { - return detail::tvec2( - min(x.x, y), - min(x.y, y)); - } + VECTORIZE_VEC_SCA(min) + VECTORIZE_VEC_VEC(min) - template - inline detail::tvec3 min - ( - detail::tvec3 const & x, - typename detail::tvec3::value_type const & y - ) - { - return detail::tvec3( - min(x.x, y), - min(x.y, y), - min(x.z, y)); - } - - template - inline detail::tvec4 min - ( - detail::tvec4 const & x, - typename detail::tvec4::value_type const & y - ) - { - return detail::tvec4( - min(x.x, y), - min(x.y, y), - min(x.z, y), - min(x.w, y)); - } - - template - inline detail::tvec2 min - ( - detail::tvec2 const & x, - detail::tvec2 const & y - ) - { - return detail::tvec2( - min(x.x, y.x), - min(x.y, y.y)); - } - - template - inline detail::tvec3 min - ( - detail::tvec3 const & x, - detail::tvec3 const & y - ) - { - return detail::tvec3( - min(x.x, y.x), - min(x.y, y.y), - min(x.z, y.z)); - } - - template - inline detail::tvec4 min - ( - detail::tvec4 const & x, - detail::tvec4 const & y - ) - { - return detail::tvec4( - min(x.x, y.x), - min(x.y, y.y), - min(x.z, y.z), - min(x.w, y.w)); - } - - // max - template - inline genType max + // max + template + GLM_FUNC_QUALIFIER genType max ( genType const & x, genType const & y ) - { + { GLM_STATIC_ASSERT( detail::type::is_float || detail::type::is_int || detail::type::is_uint, "'max' only accept numbers"); return x > y ? x : y; - } + } - template - inline detail::tvec2 max - ( - detail::tvec2 const & x, - typename detail::tvec2::value_type y - ) - { - return detail::tvec2( - max(x.x, y), - max(x.y, y)); - } + VECTORIZE_VEC_SCA(max) + VECTORIZE_VEC_VEC(max) - template - inline detail::tvec3 max - ( - detail::tvec3 const & x, - typename detail::tvec3::value_type y - ) - { - return detail::tvec3( - max(x.x, y), - max(x.y, y), - max(x.z, y)); - } - - template - inline detail::tvec4 max - ( - detail::tvec4 const & x, - typename detail::tvec4::value_type y - ) - { - return detail::tvec4( - max(x.x, y), - max(x.y, y), - max(x.z, y), - max(x.w, y)); - } - - template - inline detail::tvec2 max - ( - detail::tvec2 const & x, - detail::tvec2 const & y - ) - { - return detail::tvec2( - max(x.x, y.x), - max(x.y, y.y)); - } - - template - inline detail::tvec3 max - ( - detail::tvec3 const & x, - detail::tvec3 const & y - ) - { - return detail::tvec3( - max(x.x, y.x), - max(x.y, y.y), - max(x.z, y.z)); - } - - template - inline detail::tvec4 max - ( - detail::tvec4 const & x, - detail::tvec4 const & y) - { - return detail::tvec4( - max(x.x, y.x), - max(x.y, y.y), - max(x.z, y.z), - max(x.w, y.w)); - } - - // clamp - template - inline valType clamp + // clamp + template + GLM_FUNC_QUALIFIER valType clamp ( valType const & x, valType const & minVal, valType const & maxVal ) - { + { GLM_STATIC_ASSERT( detail::type::is_float || detail::type::is_int || @@ -731,98 +334,98 @@ namespace glm // Old implementation, less predictable branching //if(x >= maxVal) return maxVal; - //if(x <= minVal) return minVal; - //return x; - return glm::max(glm::min(x, maxVal), minVal); - } + //if(x <= minVal) return minVal; + //return x; + return max(min(x, maxVal), minVal); + } - template - inline detail::tvec2 clamp + template + GLM_FUNC_QUALIFIER detail::tvec2 clamp ( detail::tvec2 const & x, typename detail::tvec2::value_type const & minVal, typename detail::tvec2::value_type const & maxVal ) - { - return detail::tvec2( - clamp(x.x, minVal, maxVal), - clamp(x.y, minVal, maxVal)); - } + { + return detail::tvec2( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal)); + } - template - inline detail::tvec3 clamp + template + GLM_FUNC_QUALIFIER detail::tvec3 clamp ( detail::tvec3 const & x, typename detail::tvec3::value_type const & minVal, typename detail::tvec3::value_type const & maxVal ) - { - return detail::tvec3( - clamp(x.x, minVal, maxVal), - clamp(x.y, minVal, maxVal), - clamp(x.z, minVal, maxVal)); - } + { + return detail::tvec3( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal), + clamp(x.z, minVal, maxVal)); + } - template - inline detail::tvec4 clamp + template + GLM_FUNC_QUALIFIER detail::tvec4 clamp ( detail::tvec4 const & x, typename detail::tvec4::value_type const & minVal, typename detail::tvec4::value_type const & maxVal ) - { - return detail::tvec4( - clamp(x.x, minVal, maxVal), - clamp(x.y, minVal, maxVal), - clamp(x.z, minVal, maxVal), - clamp(x.w, minVal, maxVal)); - } + { + return detail::tvec4( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal), + clamp(x.z, minVal, maxVal), + clamp(x.w, minVal, maxVal)); + } - template - inline detail::tvec2 clamp + template + GLM_FUNC_QUALIFIER detail::tvec2 clamp ( detail::tvec2 const & x, detail::tvec2 const & minVal, detail::tvec2 const & maxVal ) - { - return detail::tvec2( - clamp(x.x, minVal.x, maxVal.x), - clamp(x.y, minVal.y, maxVal.y)); - } + { + return detail::tvec2( + clamp(x.x, minVal.x, maxVal.x), + clamp(x.y, minVal.y, maxVal.y)); + } - template - inline detail::tvec3 clamp + template + GLM_FUNC_QUALIFIER detail::tvec3 clamp ( detail::tvec3 const & x, detail::tvec3 const & minVal, detail::tvec3 const & maxVal ) - { - return detail::tvec3( - clamp(x.x, minVal.x, maxVal.x), - clamp(x.y, minVal.y, maxVal.y), - clamp(x.z, minVal.z, maxVal.z)); - } + { + return detail::tvec3( + clamp(x.x, minVal.x, maxVal.x), + clamp(x.y, minVal.y, maxVal.y), + clamp(x.z, minVal.z, maxVal.z)); + } - template - inline detail::tvec4 clamp + template + GLM_FUNC_QUALIFIER detail::tvec4 clamp ( detail::tvec4 const & x, detail::tvec4 const & minVal, detail::tvec4 const & maxVal ) - { - return detail::tvec4( - clamp(x.x, minVal.x, maxVal.x), - clamp(x.y, minVal.y, maxVal.y), - clamp(x.z, minVal.z, maxVal.z), - clamp(x.w, minVal.w, maxVal.w)); - } + { + return detail::tvec4( + clamp(x.x, minVal.x, maxVal.x), + clamp(x.y, minVal.y, maxVal.y), + clamp(x.z, minVal.z, maxVal.z), + clamp(x.w, minVal.w, maxVal.w)); + } // mix template - inline genTypeT mix + GLM_FUNC_QUALIFIER genTypeT mix ( genTypeT const & x, genTypeT const & y, @@ -839,7 +442,7 @@ namespace glm } template - inline detail::tvec2 mix + GLM_FUNC_QUALIFIER detail::tvec2 mix ( detail::tvec2 const & x, detail::tvec2 const & y, @@ -851,7 +454,7 @@ namespace glm } template - inline detail::tvec3 mix + GLM_FUNC_QUALIFIER detail::tvec3 mix ( detail::tvec3 const & x, detail::tvec3 const & y, @@ -863,7 +466,7 @@ namespace glm } template - inline detail::tvec4 mix + GLM_FUNC_QUALIFIER detail::tvec4 mix ( detail::tvec4 const & x, detail::tvec4 const & y, @@ -875,7 +478,7 @@ namespace glm } template - inline detail::tvec2 mix + GLM_FUNC_QUALIFIER detail::tvec2 mix ( detail::tvec2 const & x, detail::tvec2 const & y, @@ -887,7 +490,7 @@ namespace glm } template - inline detail::tvec3 mix + GLM_FUNC_QUALIFIER detail::tvec3 mix ( detail::tvec3 const & x, detail::tvec3 const & y, @@ -899,7 +502,7 @@ namespace glm } template - inline detail::tvec4 mix + GLM_FUNC_QUALIFIER detail::tvec4 mix ( detail::tvec4 const & x, detail::tvec4 const & y, @@ -911,7 +514,7 @@ namespace glm } //template - //inline genTypeT mix + //GLM_FUNC_QUALIFIER genTypeT mix //( // genTypeT const & x, // genTypeT const & y, @@ -927,20 +530,20 @@ namespace glm //} template - inline genType mix + GLM_FUNC_QUALIFIER genType mix ( genType const & x, genType const & y, - bool a + bool const & a ) { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - return a ? x : y; + return a ? y : x; } template - inline detail::tvec2 mix + GLM_FUNC_QUALIFIER detail::tvec2 mix ( detail::tvec2 const & x, detail::tvec2 const & y, @@ -957,13 +560,13 @@ namespace glm ++i ) { - result[i] = a[i] ? x[i] : y[i]; + result[i] = a[i] ? y[i] : x[i]; } return result; } template - inline detail::tvec3 mix + GLM_FUNC_QUALIFIER detail::tvec3 mix ( detail::tvec3 const & x, detail::tvec3 const & y, @@ -980,13 +583,13 @@ namespace glm ++i ) { - result[i] = a[i] ? x[i] : y[i]; + result[i] = a[i] ? y[i] : x[i]; } return result; } template - inline detail::tvec4 mix + GLM_FUNC_QUALIFIER detail::tvec4 mix ( detail::tvec4 const & x, detail::tvec4 const & y, @@ -1003,304 +606,327 @@ namespace glm ++i ) { - result[i] = a[i] ? x[i] : y[i]; + result[i] = a[i] ? y[i] : x[i]; } return result; } // step - template - inline genType step + template + GLM_FUNC_QUALIFIER genType step ( genType const & edge, genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - return x <= edge ? genType(0) : genType(1); - } + return x < edge ? genType(0) : genType(1); + } - template - inline detail::tvec2 step + template + GLM_FUNC_QUALIFIER detail::tvec2 step ( typename detail::tvec2::value_type const & edge, detail::tvec2 const & x ) - { - return detail::tvec2( - x.x <= edge ? T(0) : T(1), - x.y <= edge ? T(0) : T(1)); - } + { + return detail::tvec2( + x.x < edge ? T(0) : T(1), + x.y < edge ? T(0) : T(1)); + } - template - inline detail::tvec3 step + template + GLM_FUNC_QUALIFIER detail::tvec3 step ( typename detail::tvec3::value_type const & edge, detail::tvec3 const & x ) - { + { return detail::tvec3( - x.x <= edge ? T(0) : T(1), - x.y <= edge ? T(0) : T(1), - x.z <= edge ? T(0) : T(1)); - } + x.x < edge ? T(0) : T(1), + x.y < edge ? T(0) : T(1), + x.z < edge ? T(0) : T(1)); + } - template - inline detail::tvec4 step + template + GLM_FUNC_QUALIFIER detail::tvec4 step ( typename detail::tvec4::value_type const & edge, detail::tvec4 const & x ) - { - return detail::tvec4( - x.x <= edge ? T(0) : T(1), - x.y <= edge ? T(0) : T(1), - x.z <= edge ? T(0) : T(1), - x.w <= edge ? T(0) : T(1)); - } + { + return detail::tvec4( + x.x < edge ? T(0) : T(1), + x.y < edge ? T(0) : T(1), + x.z < edge ? T(0) : T(1), + x.w < edge ? T(0) : T(1)); + } - template - inline detail::tvec2 step + template + GLM_FUNC_QUALIFIER detail::tvec2 step ( detail::tvec2 const & edge, detail::tvec2 const & x ) - { - return detail::tvec2( - x.x <= edge.x ? T(0) : T(1), - x.y <= edge.y ? T(0) : T(1)); - } + { + return detail::tvec2( + x.x < edge.x ? T(0) : T(1), + x.y < edge.y ? T(0) : T(1)); + } - template - inline detail::tvec3 step + template + GLM_FUNC_QUALIFIER detail::tvec3 step ( detail::tvec3 const & edge, detail::tvec3 const & x ) - { - return detail::tvec3( - x.x <= edge.x ? T(0) : T(1), - x.y <= edge.y ? T(0) : T(1), - x.z <= edge.z ? T(0) : T(1)); - } + { + return detail::tvec3( + x.x < edge.x ? T(0) : T(1), + x.y < edge.y ? T(0) : T(1), + x.z < edge.z ? T(0) : T(1)); + } - template - inline detail::tvec4 step + template + GLM_FUNC_QUALIFIER detail::tvec4 step ( detail::tvec4 const & edge, detail::tvec4 const & x ) - { - return detail::tvec4( - x.x <= edge.x ? T(0) : T(1), - x.y <= edge.y ? T(0) : T(1), - x.z <= edge.z ? T(0) : T(1), - x.w <= edge.w ? T(0) : T(1)); - } + { + return detail::tvec4( + x.x < edge.x ? T(0) : T(1), + x.y < edge.y ? T(0) : T(1), + x.z < edge.z ? T(0) : T(1), + x.w < edge.w ? T(0) : T(1)); + } - // smoothstep - template - inline genType smoothstep + // smoothstep + template + GLM_FUNC_QUALIFIER genType smoothstep ( genType const & edge0, genType const & edge1, genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)); - return tmp * tmp * (genType(3) - genType(2) * tmp); - } + genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)); + return tmp * tmp * (genType(3) - genType(2) * tmp); + } - template - inline detail::tvec2 smoothstep + template + GLM_FUNC_QUALIFIER detail::tvec2 smoothstep ( typename detail::tvec2::value_type const & edge0, typename detail::tvec2::value_type const & edge1, detail::tvec2 const & x ) - { - return detail::tvec2( - smoothstep(edge0, edge1, x.x), - smoothstep(edge0, edge1, x.y)); - } + { + return detail::tvec2( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y)); + } - template - inline detail::tvec3 smoothstep + template + GLM_FUNC_QUALIFIER detail::tvec3 smoothstep ( typename detail::tvec3::value_type const & edge0, typename detail::tvec3::value_type const & edge1, detail::tvec3 const & x ) - { - return detail::tvec3( - smoothstep(edge0, edge1, x.x), - smoothstep(edge0, edge1, x.y), - smoothstep(edge0, edge1, x.z)); - } + { + return detail::tvec3( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y), + smoothstep(edge0, edge1, x.z)); + } - template - inline detail::tvec4 smoothstep + template + GLM_FUNC_QUALIFIER detail::tvec4 smoothstep ( typename detail::tvec4::value_type const & edge0, typename detail::tvec4::value_type const & edge1, detail::tvec4 const & x ) - { - return detail::tvec4( - smoothstep(edge0, edge1, x.x), - smoothstep(edge0, edge1, x.y), - smoothstep(edge0, edge1, x.z), - smoothstep(edge0, edge1, x.w)); - } + { + return detail::tvec4( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y), + smoothstep(edge0, edge1, x.z), + smoothstep(edge0, edge1, x.w)); + } - template - inline detail::tvec2 smoothstep + template + GLM_FUNC_QUALIFIER detail::tvec2 smoothstep ( detail::tvec2 const & edge0, detail::tvec2 const & edge1, detail::tvec2 const & x ) - { - return detail::tvec2( - smoothstep(edge0.x, edge1.x, x.x), - smoothstep(edge0.y, edge1.y, x.y)); - } + { + return detail::tvec2( + smoothstep(edge0.x, edge1.x, x.x), + smoothstep(edge0.y, edge1.y, x.y)); + } - template - inline detail::tvec3 smoothstep + template + GLM_FUNC_QUALIFIER detail::tvec3 smoothstep ( detail::tvec3 const & edge0, detail::tvec3 const & edge1, detail::tvec3 const & x ) - { - return detail::tvec3( - smoothstep(edge0.x, edge1.x, x.x), - smoothstep(edge0.y, edge1.y, x.y), - smoothstep(edge0.z, edge1.z, x.z)); - } + { + return detail::tvec3( + smoothstep(edge0.x, edge1.x, x.x), + smoothstep(edge0.y, edge1.y, x.y), + smoothstep(edge0.z, edge1.z, x.z)); + } - template - inline detail::tvec4 smoothstep + template + GLM_FUNC_QUALIFIER detail::tvec4 smoothstep ( detail::tvec4 const & edge0, detail::tvec4 const & edge1, detail::tvec4 const & x ) - { - return detail::tvec4( - smoothstep(edge0.x, edge1.x, x.x), - smoothstep(edge0.y, edge1.y, x.y), - smoothstep(edge0.z, edge1.z, x.z), - smoothstep(edge0.w, edge1.w, x.w)); - } - - template - inline typename genType::bool_type isnan - ( - genType const & x - ) { - GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); - -#if(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_VC) - return typename genType::bool_type(_isnan(x)); -#else - return typename genType::bool_type(std::isnan(x)); -#endif + return detail::tvec4( + smoothstep(edge0.x, edge1.x, x.x), + smoothstep(edge0.y, edge1.y, x.y), + smoothstep(edge0.z, edge1.z, x.z), + smoothstep(edge0.w, edge1.w, x.w)); } - template - inline typename detail::tvec2::bool_type isnan + // TODO: Not working on MinGW... + template + GLM_FUNC_QUALIFIER bool isnan(genType const & x) + { + GLM_STATIC_ASSERT(detail::type::is_float, "'isnan' only accept floating-point inputs"); + +# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL)) + return _isnan(x) != 0; +# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isnan(x) != 0; +# else + return std::isnan(x); +# endif +# else + return std::isnan(x); +# endif + } + + template + GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isnan ( detail::tvec2 const & x ) - { - return typename detail::tvec2::bool_type( - isnan(x.x), - isnan(x.y)); - } + { + return typename detail::tvec2::bool_type( + isnan(x.x), + isnan(x.y)); + } - template - inline typename detail::tvec3::bool_type isnan + template + GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isnan ( detail::tvec3 const & x ) - { - return typename detail::tvec3::bool_type( - isnan(x.x), - isnan(x.y), - isnan(x.z)); - } + { + return typename detail::tvec3::bool_type( + isnan(x.x), + isnan(x.y), + isnan(x.z)); + } - template - inline typename detail::tvec4::bool_type isnan + template + GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isnan ( detail::tvec4 const & x ) - { - return typename detail::tvec4::bool_type( - isnan(x.x), - isnan(x.y), - isnan(x.z), - isnan(x.w)); - } + { + return typename detail::tvec4::bool_type( + isnan(x.x), + isnan(x.y), + isnan(x.z), + isnan(x.w)); + } template - inline typename genType::bool_type isinf - ( - genType const & x - ) + GLM_FUNC_QUALIFIER bool isinf( + genType const & x) { GLM_STATIC_ASSERT(detail::type::is_float, "'isinf' only accept floating-point inputs"); -#if(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_VC) - return typename genType::bool_type(_fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF); -#else - return typename genType::bool_type(std::isinf(x)); -#endif +# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC)) + return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isinf(x) != 0; +# else + return std::isinf(x); +# endif +# else + return std::isinf(x); +# endif +/* +# if(GLM_COMPILER & GLM_COMPILER_VC) + return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +# elif(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) + return _isinf(x) != 0; +# else + return std::isinf(x); +# endif +# elif(GLM_COMPILER & GLM_COMPILER_INTEL) + return isinf(x) != 0; +# else + return std::isinf(x); +# endif +*/ } - template - inline typename detail::tvec2::bool_type isinf + template + GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isinf ( detail::tvec2 const & x ) - { - return typename detail::tvec2::bool_type( - isnan(x.x), - isnan(x.y)); - } + { + return typename detail::tvec2::bool_type( + isinf(x.x), + isinf(x.y)); + } - template - inline typename detail::tvec3::bool_type isinf + template + GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isinf ( detail::tvec3 const & x ) - { - return typename detail::tvec3::bool_type( - isnan(x.x), - isnan(x.y), - isnan(x.z)); - } + { + return typename detail::tvec3::bool_type( + isinf(x.x), + isinf(x.y), + isinf(x.z)); + } - template - inline typename detail::tvec4::bool_type isinf + template + GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isinf ( detail::tvec4 const & x ) - { - return typename detail::tvec4::bool_type( - isnan(x.x), - isnan(x.y), - isnan(x.z), - isnan(x.w)); - } + { + return typename detail::tvec4::bool_type( + isinf(x.x), + isinf(x.y), + isinf(x.z), + isinf(x.w)); + } - inline int floatBitsToInt(float const & value) + GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value) { union { @@ -1312,40 +938,40 @@ namespace glm return fi.i; } - template - inline detail::tvec2 floatBitsToInt + GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToInt ( - detail::tvec2 const & value + detail::tvec2 const & value ) - { - return detail::tvec2( - floatBitsToInt(value.x), - floatBitsToInt(value.y)); - } + { + return detail::tvec2( + floatBitsToInt(value.x), + floatBitsToInt(value.y)); + } - template - inline detail::tvec3 floatBitsToInt + GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToInt ( - detail::tvec3 const & value + detail::tvec3 const & value ) - { - return detail::tvec3( - floatBitsToInt(value.x), - floatBitsToInt(value.y)); - } + { + return detail::tvec3( + floatBitsToInt(value.x), + floatBitsToInt(value.y), + floatBitsToInt(value.z)); + } - template - inline detail::tvec4 floatBitsToInt + GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt ( - detail::tvec4 const & value + detail::tvec4 const & value ) - { - return detail::tvec4( - floatBitsToInt(value.x), - floatBitsToInt(value.y)); - } + { + return detail::tvec4( + floatBitsToInt(value.x), + floatBitsToInt(value.y), + floatBitsToInt(value.z), + floatBitsToInt(value.w)); + } - inline uint floatBitsToUint(float const & value) + GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value) { union { @@ -1357,40 +983,40 @@ namespace glm return fu.u; } - template - inline detail::tvec2 floatBitsToUint + GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToUint ( - detail::tvec2 const & value + detail::tvec2 const & value ) - { - return detail::tvec2( - floatBitsToUint(value.x), - floatBitsToUint(value.y)); - } + { + return detail::tvec2( + floatBitsToUint(value.x), + floatBitsToUint(value.y)); + } - template - inline detail::tvec3 floatBitsToUint + GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToUint ( - detail::tvec3 const & value + detail::tvec3 const & value ) - { - return detail::tvec3( - floatBitsToUint(value.x), - floatBitsToUint(value.y)); - } + { + return detail::tvec3( + floatBitsToUint(value.x), + floatBitsToUint(value.y), + floatBitsToUint(value.z)); + } - template - inline detail::tvec4 floatBitsToUint + GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToUint ( - detail::tvec4 const & value + detail::tvec4 const & value ) - { - return detail::tvec4( - floatBitsToUint(value.x), - floatBitsToUint(value.y)); - } + { + return detail::tvec4( + floatBitsToUint(value.x), + floatBitsToUint(value.y), + floatBitsToUint(value.z), + floatBitsToUint(value.w)); + } - inline float intBitsToFloat(int const & value) + GLM_FUNC_QUALIFIER float intBitsToFloat(int const & value) { union { @@ -1402,7 +1028,41 @@ namespace glm return fi.f; } - inline float intBitsToFloat(uint const & value) + GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat + + ( + detail::tvec2 const & value + ) + { + return detail::tvec2( + intBitsToFloat(value.x), + intBitsToFloat(value.y)); + } + + GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat + ( + detail::tvec3 const & value + ) + { + return detail::tvec3( + intBitsToFloat(value.x), + intBitsToFloat(value.y), + intBitsToFloat(value.z)); + } + + GLM_FUNC_QUALIFIER detail::tvec4 intBitsToFloat + ( + detail::tvec4 const & value + ) + { + return detail::tvec4( + intBitsToFloat(value.x), + intBitsToFloat(value.y), + intBitsToFloat(value.z), + intBitsToFloat(value.w)); + } + + GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value) { union { @@ -1414,41 +1074,41 @@ namespace glm return fu.f; } - template - inline detail::tvec2 intBitsToFloat + GLM_FUNC_QUALIFIER detail::tvec2 uintBitsToFloat ( - detail::tvec2 const & value + detail::tvec2 const & value ) - { - return detail::tvec2( - intBitsToFloat(value.x), - intBitsToFloat(value.y)); - } + { + return detail::tvec2( + uintBitsToFloat(value.x), + uintBitsToFloat(value.y)); + } - template - inline detail::tvec3 intBitsToFloat + GLM_FUNC_QUALIFIER detail::tvec3 uintBitsToFloat ( - detail::tvec3 const & value + detail::tvec3 const & value ) - { - return detail::tvec3( - intBitsToFloat(value.x), - intBitsToFloat(value.y)); - } + { + return detail::tvec3( + uintBitsToFloat(value.x), + uintBitsToFloat(value.y), + uintBitsToFloat(value.z)); + } - template - inline detail::tvec4 intBitsToFloat + GLM_FUNC_QUALIFIER detail::tvec4 uintBitsToFloat ( - detail::tvec4 const & value + detail::tvec4 const & value ) - { - return detail::tvec4( - intBitsToFloat(value.x), - intBitsToFloat(value.y)); - } + { + return detail::tvec4( + uintBitsToFloat(value.x), + uintBitsToFloat(value.y), + uintBitsToFloat(value.z), + uintBitsToFloat(value.w)); + } template - inline genType fma + GLM_FUNC_QUALIFIER genType fma ( genType const & a, genType const & b, @@ -1459,7 +1119,7 @@ namespace glm } template - genType frexp + GLM_FUNC_QUALIFIER genType frexp ( genType const & x, int & exp @@ -1469,7 +1129,7 @@ namespace glm } template - detail::tvec2 frexp + GLM_FUNC_QUALIFIER detail::tvec2 frexp ( detail::tvec2 const & x, detail::tvec2 & exp @@ -1479,7 +1139,7 @@ namespace glm } template - detail::tvec3 frexp + GLM_FUNC_QUALIFIER detail::tvec3 frexp ( detail::tvec3 const & x, detail::tvec3 & exp @@ -1489,7 +1149,7 @@ namespace glm } template - detail::tvec4 frexp + GLM_FUNC_QUALIFIER detail::tvec4 frexp ( detail::tvec4 const & x, detail::tvec4 & exp @@ -1499,7 +1159,7 @@ namespace glm } template - genType ldexp + GLM_FUNC_QUALIFIER genType ldexp ( genType const & x, int const & exp @@ -1509,7 +1169,7 @@ namespace glm } template - detail::tvec2 ldexp + GLM_FUNC_QUALIFIER detail::tvec2 ldexp ( detail::tvec2 const & x, detail::tvec2 const & exp @@ -1519,7 +1179,7 @@ namespace glm } template - detail::tvec3 ldexp + GLM_FUNC_QUALIFIER detail::tvec3 ldexp ( detail::tvec3 const & x, detail::tvec3 const & exp @@ -1529,7 +1189,7 @@ namespace glm } template - detail::tvec4 ldexp + GLM_FUNC_QUALIFIER detail::tvec4 ldexp ( detail::tvec4 const & x, detail::tvec4 const & exp @@ -1538,7 +1198,4 @@ namespace glm return std::frexp(x, exp); } - }//namespace common - }//namespace function - }//namespace core }//namespace glm diff --git a/include/eepp/helper/glm/core/func_exponential.hpp b/include/eepp/helper/glm/core/func_exponential.hpp index 24c6b02fc..37910aded 100644 --- a/include/eepp/helper/glm/core/func_exponential.hpp +++ b/include/eepp/helper/glm/core/func_exponential.hpp @@ -1,74 +1,121 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 Exponential Functions +/// +/// @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 test{ - void main_core_func_exponential(); - }//namespace test + /// @addtogroup core_func_exponential + /// @{ - 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_funcs - ///@{ - - //! Returns x raised to the y power. - //! (From GLSL 1.30.08 specification, section 8.2) + /// Returns x raised to the y power. + /// + /// @param x pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. + /// @param y + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL pow man page + /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions template genType pow(genType const & x, genType const & y); - //! Returns the natural exponentiation of x, i.e., e^x. - //! (From GLSL 1.30.08 specification, section 8.2) + /// Returns the natural exponentiation of x, i.e., e^x. + /// + /// @param x exp function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL exp man page + /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions 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. - //! (From 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. + /// + /// @param x log function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision. + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL log man page + /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions template genType log(genType const & x); - //! Returns 2 raised to the x power. - //! (From GLSL 1.30.08 specification, section 8.2) + /// Returns 2 raised to the x power. + /// + /// @param x exp2 function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision. + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL exp2 man page + /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions 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. - //! (From 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. + /// + /// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision. + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL log2 man page + /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions template genType log2(genType const & x); - //! Returns the positive square root of x. - //! (From GLSL 1.30.08 specification, section 8.2) + /// Returns the positive square root of x. + /// + /// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision. + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL sqrt man page + /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions template genType sqrt(genType const & x); - //! Returns the reciprocal of the positive square root of x. - //! (From GLSL 1.30.08 specification, section 8.2) + /// Returns the reciprocal of the positive square root of x. + /// + /// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision. + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL inversesqrt man page + /// @see GLSL 4.20.8 specification, section 8.2 Exponential Functions 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/include/eepp/helper/glm/core/func_exponential.inl b/include/eepp/helper/glm/core/func_exponential.inl index 554d667cb..5c8b9efc3 100644 --- a/include/eepp/helper/glm/core/func_exponential.inl +++ b/include/eepp/helper/glm/core/func_exponential.inl @@ -1,358 +1,155 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 - inline genType pow + // pow + template + GLM_FUNC_QUALIFIER genType pow ( genType const & x, genType const & y ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'pow' only accept floating-point input"); - return ::std::pow(x, y); - } + return ::std::pow(x, y); + } - template - inline detail::tvec2 pow - ( - detail::tvec2 const & x, - detail::tvec2 const & y - ) - { - return detail::tvec2( - pow(x.x, y.x), - pow(x.y, y.y)); - } + VECTORIZE_VEC_VEC(pow) - template - inline detail::tvec3 pow - ( - detail::tvec3 const & x, - detail::tvec3 const & y - ) - { - return detail::tvec3( - pow(x.x, y.x), - pow(x.y, y.y), - pow(x.z, y.z)); - } - - template - inline detail::tvec4 pow - ( - detail::tvec4 const & x, - detail::tvec4 const & y - ) - { - return detail::tvec4( - pow(x.x, y.x), - pow(x.y, y.y), - pow(x.z, y.z), - pow(x.w, y.w)); - } - - // exp - template - inline genType exp + // exp + template + GLM_FUNC_QUALIFIER genType exp ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'exp' only accept floating-point input"); - return ::std::exp(x); - } + return ::std::exp(x); + } - template - inline detail::tvec2 exp - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - exp(x.x), - exp(x.y)); - } + VECTORIZE_VEC(exp) - template - inline detail::tvec3 exp - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - exp(x.x), - exp(x.y), - exp(x.z)); - } - - template - inline detail::tvec4 exp - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - exp(x.x), - exp(x.y), - exp(x.z), - exp(x.w)); - } - - // log - template - inline genType log + // log + template + GLM_FUNC_QUALIFIER genType log ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'log' only accept floating-point input"); - return ::std::log(x); - } + return ::std::log(x); + } - template - inline detail::tvec2 log - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - log(x.x), - log(x.y)); - } + VECTORIZE_VEC(log) - template - inline detail::tvec3 log - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - log(x.x), - log(x.y), - log(x.z)); - } - - template - inline detail::tvec4 log - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - log(x.x), - log(x.y), - log(x.z), - log(x.w)); - } - - //exp2, ln2 = 0.69314718055994530941723212145818f - template - inline genType exp2 + //exp2, ln2 = 0.69314718055994530941723212145818f + template + GLM_FUNC_QUALIFIER genType exp2 ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'exp2' only accept floating-point input"); - return ::std::exp(genType(0.69314718055994530941723212145818) * x); - } + return ::std::exp(genType(0.69314718055994530941723212145818) * x); + } - template - inline detail::tvec2 exp2 - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - exp2(x.x), - exp2(x.y)); - } + VECTORIZE_VEC(exp2) - template - inline detail::tvec3 exp2 - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - exp2(x.x), - exp2(x.y), - exp2(x.z)); - } +namespace _detail +{ + template + struct _compute_log2 + { + template + T operator() (T const & Value) const; +/* + { + GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include for integer types support. Others types are not supported."); + return Value; + } +*/ + }; - template - inline detail::tvec4 exp2 - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - exp2(x.x), - exp2(x.y), - exp2(x.z), - exp2(x.w)); - } + template <> + struct _compute_log2 + { + template + T operator() (T const & Value) const + { + return T(::std::log(Value)) / T(0.69314718055994530941723212145818); + } + }; - // log2, ln2 = 0.69314718055994530941723212145818f - template - inline genType log2 +}//namespace _detail + + // log2, ln2 = 0.69314718055994530941723212145818f + template + GLM_FUNC_QUALIFIER genType log2 ( genType const & x ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'log2' only accept floating-point input"); + { + assert(x > genType(0)); // log2 is only defined on the range (0, inf] + return _detail::_compute_log2::ID>()(x); + } - return ::std::log(x) / genType(0.69314718055994530941723212145818); - } + VECTORIZE_VEC(log2) - template - inline detail::tvec2 log2 - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - log2(x.x), - log2(x.y)); - } - - template - inline detail::tvec3 log2 - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - log2(x.x), - log2(x.y), - log2(x.z)); - } - - template - inline detail::tvec4 log2 - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - log2(x.x), - log2(x.y), - log2(x.z), - log2(x.w)); - } - - // sqrt - template - inline genType sqrt + // sqrt + template + GLM_FUNC_QUALIFIER genType sqrt ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'sqrt' only accept floating-point input"); - return genType(::std::sqrt(x)); - } + return genType(::std::sqrt(x)); + } - template - inline detail::tvec2 sqrt - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - sqrt(x.x), - sqrt(x.y)); - } + VECTORIZE_VEC(sqrt) - template - inline detail::tvec3 sqrt - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - sqrt(x.x), - sqrt(x.y), - sqrt(x.z)); - } - - template - inline detail::tvec4 sqrt - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - sqrt(x.x), - sqrt(x.y), - sqrt(x.z), - sqrt(x.w)); - } - - template - inline genType inversesqrt + template + GLM_FUNC_QUALIFIER genType inversesqrt ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'inversesqrt' only accept floating-point input"); - return genType(1) / ::std::sqrt(x); - } + return genType(1) / ::std::sqrt(x); + } - template - inline detail::tvec2 inversesqrt - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - inversesqrt(x.x), - inversesqrt(x.y)); - } + VECTORIZE_VEC(inversesqrt) - template - inline detail::tvec3 inversesqrt - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - inversesqrt(x.x), - inversesqrt(x.y), - inversesqrt(x.z)); - } - - template - inline detail::tvec4 inversesqrt - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - inversesqrt(x.x), - inversesqrt(x.y), - inversesqrt(x.z), - inversesqrt(x.w)); - } - - }//namespace exponential - }//namespace function - }//namespace core }//namespace glm diff --git a/include/eepp/helper/glm/core/func_geometric.hpp b/include/eepp/helper/glm/core/func_geometric.hpp index a67240097..53757da91 100644 --- a/include/eepp/helper/glm/core/func_geometric.hpp +++ b/include/eepp/helper/glm/core/func_geometric.hpp @@ -1,95 +1,136 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 Geometric Functions +/// +/// @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 test{ - void main_core_func_geometric(); - }//namespace test + /// @addtogroup core_func_geometric + /// @{ - namespace core{ - namespace function{ - //! Define all geometric functions from Section 8.4 of GLSL 1.30.8 specification. Included in glm namespace. - namespace geometric{ - - /// \addtogroup core_funcs - ///@{ - - //! Returns the length of x, i.e., sqrt(x * x). - //! (From GLSL 1.30.08 specification, section 8.4) + /// Returns the length of x, i.e., sqrt(x * x). + /// + /// @tparam genType Floating-point vector types. + /// + /// @see GLSL length man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions 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). - //! (From GLSL 1.30.08 specification, section 8.4) + /// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). + /// + /// @tparam genType Floating-point vector types. + /// + /// @see GLSL distance man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions 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. - //! (From GLSL 1.30.08 specification, section 8.4) - template + /// Returns the dot product of x and y, i.e., result = x * y. + /// + /// @tparam genType Floating-point vector types. + /// + /// @see GLSL dot man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions + template typename genType::value_type dot( genType const & x, genType const & y); - //! Returns the cross product of x and y. - //! (From GLSL 1.30.08 specification, section 8.4) - template - detail::tvec3 cross( - detail::tvec3 const & x, - detail::tvec3 const & y); + /// Returns the cross product of x and y. + /// + /// @tparam valType Floating-point scalar types. + /// + /// @see GLSL cross man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions + 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. - //! (From 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 Geometric Functions template genType normalize( genType const & x); - //! If dot(Nref, I) < 0.0, return N, otherwise, return -N. - //! (From GLSL 1.30.08 specification, section 8.4) - template + /// If dot(Nref, I) < 0.0, return N, otherwise, return -N. + /// + /// @tparam genType Floating-point vector types. + /// + /// @see GLSL faceforward man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions + 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. - //! (From GLSL 1.30.08 specification, section 8.4) - template + + /// For the incident vector I and surface orientation N, + /// returns the reflection direction : result = I - 2.0 * dot(N, I) * N. + /// + /// @tparam genType Floating-point vector types. + /// + /// @see GLSL reflect man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions + 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. - //! (From GLSL 1.30.08 specification, section 8.4) - template + + /// For the incident vector I and surface normal N, + /// and the ratio of indices of refraction eta, + /// return the refraction vector. + /// + /// @tparam genType Floating-point vector types. + /// + /// @see GLSL refract man page + /// @see GLSL 4.20.8 specification, section 8.5 Geometric Functions + 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/include/eepp/helper/glm/core/func_geometric.inl b/include/eepp/helper/glm/core/func_geometric.inl index dfbbd3186..9ae20f0d6 100644 --- a/include/eepp/helper/glm/core/func_geometric.inl +++ b/include/eepp/helper/glm/core/func_geometric.inl @@ -1,122 +1,138 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 - inline genType length + // length + template + GLM_FUNC_QUALIFIER genType length ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - genType sqr = x * x; - return sqrt(sqr); - } + genType sqr = x * x; + return sqrt(sqr); + } template - inline typename detail::tvec2::value_type length + GLM_FUNC_QUALIFIER typename detail::tvec2::value_type length ( detail::tvec2 const & v ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - typename detail::tvec2::value_type sqr = v.x * v.x + v.y * v.y; - return sqrt(sqr); - } + typename detail::tvec2::value_type sqr = v.x * v.x + v.y * v.y; + return sqrt(sqr); + } - template - inline typename detail::tvec3::value_type length + template + GLM_FUNC_QUALIFIER typename detail::tvec3::value_type length ( detail::tvec3 const & v ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - typename detail::tvec3::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; - return sqrt(sqr); - } + typename detail::tvec3::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z; + return sqrt(sqr); + } - template - inline typename detail::tvec4::value_type length + template + GLM_FUNC_QUALIFIER typename detail::tvec4::value_type length ( detail::tvec4 const & v ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'length' only accept floating-point inputs"); - typename detail::tvec4::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; - return sqrt(sqr); - } + typename detail::tvec4::value_type sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w; + return sqrt(sqr); + } - // distance + // distance template - inline genType distance + GLM_FUNC_QUALIFIER genType distance ( genType const & p0, genType const & p1 ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); + { + GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); return length(p1 - p0); - } + } template - inline typename detail::tvec2::value_type distance + GLM_FUNC_QUALIFIER typename detail::tvec2::value_type distance ( detail::tvec2 const & p0, detail::tvec2 const & p1 ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); - return length(p1 - p0); - } + return length(p1 - p0); + } - template - inline typename detail::tvec3::value_type distance + template + GLM_FUNC_QUALIFIER typename detail::tvec3::value_type distance ( detail::tvec3 const & p0, detail::tvec3 const & p1 ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); return length(p1 - p0); - } + } - template - inline typename detail::tvec4::value_type distance + template + GLM_FUNC_QUALIFIER typename detail::tvec4::value_type distance ( detail::tvec4 const & p0, detail::tvec4 const & p1 ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'distance' only accept floating-point inputs"); return length(p1 - p0); - } + } // dot template - inline genType dot + GLM_FUNC_QUALIFIER genType dot ( genType const & x, genType const & y + ) { GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); @@ -124,126 +140,126 @@ namespace glm return x * y; } - template - inline typename detail::tvec2::value_type dot + template + GLM_FUNC_QUALIFIER typename detail::tvec2::value_type dot ( detail::tvec2 const & x, detail::tvec2 const & y ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); return x.x * y.x + x.y * y.y; - } + } - template - inline T dot + template + GLM_FUNC_QUALIFIER T dot ( detail::tvec3 const & x, detail::tvec3 const & y ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); return x.x * y.x + x.y * y.y + x.z * y.z; - } + } /* // SSE3 - inline float dot(const tvec4& x, const tvec4& y) - { - float Result; - __asm - { - mov esi, x - mov edi, y - movaps xmm0, [esi] - mulps xmm0, [edi] - haddps( _xmm0, _xmm0 ) - haddps( _xmm0, _xmm0 ) - movss Result, xmm0 - } - return Result; - } + GLM_FUNC_QUALIFIER float dot(const tvec4& x, const tvec4& y) + { + float Result; + __asm + { + mov esi, x + mov edi, y + movaps xmm0, [esi] + mulps xmm0, [edi] + haddps( _xmm0, _xmm0 ) + haddps( _xmm0, _xmm0 ) + movss Result, xmm0 + } + return Result; + } */ - template - inline T dot + template + GLM_FUNC_QUALIFIER T dot ( detail::tvec4 const & x, detail::tvec4 const & y ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'dot' only accept floating-point inputs"); - return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; - } + return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; + } - // cross - template - inline detail::tvec3 cross + // cross + template + GLM_FUNC_QUALIFIER detail::tvec3 cross ( detail::tvec3 const & x, detail::tvec3 const & y ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'cross' only accept floating-point inputs"); - return detail::tvec3( - x.y * y.z - y.y * x.z, - x.z * y.x - y.z * x.x, - x.x * y.y - y.x * x.y); - } + return detail::tvec3( + x.y * y.z - y.y * x.z, + x.z * y.x - y.z * x.x, + x.x * y.y - y.x * x.y); + } - // normalize - template - inline genType normalize + // normalize + template + GLM_FUNC_QUALIFIER genType normalize ( genType const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); - return x < genType(0) ? genType(-1) : genType(1); - } + return x < genType(0) ? genType(-1) : genType(1); + } - // According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error - template - inline detail::tvec2 normalize + // According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error + template + GLM_FUNC_QUALIFIER detail::tvec2 normalize ( detail::tvec2 const & x ) - { + { GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); typename detail::tvec2::value_type sqr = x.x * x.x + x.y * x.y; - return x * inversesqrt(sqr); - } + return x * inversesqrt(sqr); + } - template - inline detail::tvec3 normalize + template + GLM_FUNC_QUALIFIER detail::tvec3 normalize ( detail::tvec3 const & x ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + { + GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); typename detail::tvec3::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z; - return x * inversesqrt(sqr); - } + return x * inversesqrt(sqr); + } - template - inline detail::tvec4 normalize + template + GLM_FUNC_QUALIFIER detail::tvec4 normalize ( detail::tvec4 const & x ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); + { + GLM_STATIC_ASSERT(detail::type::is_float, "'normalize' only accept floating-point inputs"); typename detail::tvec4::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; - return x * inversesqrt(sqr); - } + return x * inversesqrt(sqr); + } - // faceforward + // faceforward template - inline genType faceforward + GLM_FUNC_QUALIFIER genType faceforward ( genType const & N, genType const & I, @@ -261,30 +277,46 @@ namespace glm genType const & N ) { - return I - N * dot(N, I) * float(2); + return I - N * dot(N, I) * genType(2); } - // refract - template - inline genType refract + // refract + template + GLM_FUNC_QUALIFIER genType refract + ( + genType const & I, + genType const & N, + genType const & eta + ) + { + //It could be a vector + //GLM_STATIC_ASSERT(detail::type::is_float); + + genType dotValue = dot(N, I); + genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue); + if(k < genType(0)) + return genType(0); + else + return eta * I - (eta * dotValue + sqrt(k)) * N; + } + + template + GLM_FUNC_QUALIFIER genType refract ( genType const & I, genType const & N, typename genType::value_type const & eta ) - { + { //It could be a vector //GLM_STATIC_ASSERT(detail::type::is_float); - typename genType::value_type dotValue = dot(N, I); - typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue); - if(k < typename genType::value_type(0)) - return genType(0); - else - return eta * I - (eta * dotValue + sqrt(k)) * N; - } + typename genType::value_type dotValue = dot(N, I); + typename genType::value_type k = typename genType::value_type(1) - eta * eta * (typename genType::value_type(1) - dotValue * dotValue); + if(k < typename genType::value_type(0)) + return genType(0); + else + return eta * I - (eta * dotValue + sqrt(k)) * N; + } - }//namespace geometric - }//namespace function - }//namespace core }//namespace glm diff --git a/include/eepp/helper/glm/core/func_integer.hpp b/include/eepp/helper/glm/core/func_integer.hpp deleted file mode 100644 index f44c7b4ff..000000000 --- a/include/eepp/helper/glm/core/func_integer.hpp +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_integer -#define glm_core_func_integer - -namespace glm -{ - namespace test{ - void main_core_func_integer(); - }//namespace test - - namespace core{ - namespace function{ - //! Define integer functions from Section 8.8 of GLSL 4.00.8 specification. - namespace 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. - //! - //! (From 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. - //! - //! (From GLSL 4.00.08 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. - //! (From 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. - //! (From GLSL 4.00.08 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. - //! - //! (From GLSL 4.00.08 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. - //! - //! (From 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 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. - //! (From GLSL 4.00.08 specification, section 8.8) - template - genIUType bitfieldReverse(genIUType const & value); - - //! Returns the number of bits set to 1 in the binary representation of value. - //! (From GLSL 4.00.08 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. - //! (From 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 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. - //! (From GLSL 4.00.08 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" - -#endif//glm_core_func_integer - diff --git a/include/eepp/helper/glm/core/func_integer.inl b/include/eepp/helper/glm/core/func_integer.inl deleted file mode 100644 index 93911c1f7..000000000 --- a/include/eepp/helper/glm/core/func_integer.inl +++ /dev/null @@ -1,600 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - namespace detail - { - - }//namespace detail - - namespace core{ - namespace function{ - namespace integer - { - // uaddCarry - template - inline genUType uaddCarry - ( - genUType const & x, - genUType const & y, - genUType & Carry - ) - { - 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; - } - - template - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - 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 - inline 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 - inline 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 - inline 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 - genIUType bitfieldExtract - ( - genIUType const & Value, - int const & Offset, - int const & Bits - ) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldExtract' only accept integer values"); - assert(Offset + Bits <= sizeof(genIUType)); - - genIUType Result = 0; - if(std::numeric_limits::is_signed) - Result |= (1 << (sizeof(genIUType) * 8 - 1)) & (1 << (Offset + Bits - 1)); - - genIUType Mask = 0; - for(std::size_t Bit = Offset; Bit < Bits; ++Bit) - Mask |= (1 << Bit); - - return Result | ((Mask & Value) >> Offset); - } - - template - inline detail::tvec2 bitfieldExtract - ( - detail::tvec2 const & Value, - int const & Offset, - int const & Bits - ) - { - return detail::tvec2( - bitfieldExtract(Value[0]), - bitfieldExtract(Value[1])); - } - - template - inline 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 - inline 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 - inline 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(std::size_t Bit = Offset; Bit < Offset + Bits; ++Bit) - Mask |= (1 << Bit); - - return (Base & ~Mask) | (Insert & Mask); - } - - template - inline 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 - inline 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 - inline 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 - inline genIUType bitfieldReverse(genIUType const & Value) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitfieldReverse' only accept integer values"); - - genIUType Result = 0; - for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i) - if(Value & (1 << i)) - Result |= (genIUType(1) << (sizeof(genIUType) * std::size_t(8)) - genIUType(1) - i); - return Result; - } - - template - inline detail::tvec2 bitfieldReverse - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - bitfieldReverse(value[0]), - bitfieldReverse(value[1])); - } - - template - inline detail::tvec3 bitfieldReverse - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - bitfieldReverse(value[0]), - bitfieldReverse(value[1]), - bitfieldReverse(value[2])); - } - - template - inline detail::tvec4 bitfieldReverse - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - bitfieldReverse(value[0]), - bitfieldReverse(value[1]), - bitfieldReverse(value[2]), - bitfieldReverse(value[3])); - } - - // bitCount - template - 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 - inline detail::tvec2 bitCount - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - bitCount(value[0]), - bitCount(value[1])); - } - - template - inline detail::tvec3 bitCount - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - bitCount(value[0]), - bitCount(value[1]), - bitCount(value[2])); - } - - template - inline detail::tvec4 bitCount - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - bitCount(value[0]), - bitCount(value[1]), - bitCount(value[2]), - bitCount(value[3])); - } - - // findLSB - template - inline 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 - inline detail::tvec2 findLSB - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - findLSB(value[0]), - findLSB(value[1])); - } - - template - inline detail::tvec3 findLSB - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - findLSB(value[0]), - findLSB(value[1]), - findLSB(value[2])); - } - - template - inline detail::tvec4 findLSB - ( - detail::tvec4 const & value - ) - { - return detail::tvec4( - findLSB(value[0]), - findLSB(value[1]), - findLSB(value[2]), - findLSB(value[3])); - } - - // findMSB - template - inline 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 - inline detail::tvec2 findMSB - ( - detail::tvec2 const & value - ) - { - return detail::tvec2( - findMSB(value[0]), - findMSB(value[1])); - } - - template - inline detail::tvec3 findMSB - ( - detail::tvec3 const & value - ) - { - return detail::tvec3( - findMSB(value[0]), - findMSB(value[1]), - findMSB(value[2])); - } - - template - inline 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 -}//namespace glm diff --git a/include/eepp/helper/glm/core/func_matrix.hpp b/include/eepp/helper/glm/core/func_matrix.hpp index b1f297205..c0338aa07 100644 --- a/include/eepp/helper/glm/core/func_matrix.hpp +++ b/include/eepp/helper/glm/core/func_matrix.hpp @@ -1,97 +1,150 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 Matrix Functions +/// +/// @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 test{ - void main_core_func_matrix(); - }//namespace test + /// @addtogroup core_func_matrix + /// @{ - 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_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]. - //! (From 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]. + /// + /// @tparam matType Floating-point matrix types. + /// + /// @see GLSL matrixCompMult man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions 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. - //! (From 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. + /// + /// @tparam matType Floating-point matrix types. + /// + /// @see GLSL outerProduct man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions + /// + /// @todo Clarify the declaration to specify that matType doesn't have to be provided when used. template matType outerProduct( vecType const & c, vecType const & r); - //! Returns the transposed matrix of x - //! (From GLSL 1.30.08 specification, section 8.5) + /// Returns the transposed matrix of x + /// + /// @tparam matType Floating-point matrix types. + /// + /// @see GLSL transpose man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions template typename matType::transpose_type transpose( matType const & x); - //! Return the determinant of a mat2 matrix. - //! (From GLSL 1.50.09 specification, section 8.5).. - template - typename detail::tmat2x2::value_type determinant( - detail::tmat2x2 const & m); + /// Return the determinant of a mat2 matrix. + /// + /// @tparam valType Floating-point scalar types. + /// + /// @see GLSL determinant man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions + template + typename detail::tmat2x2::value_type determinant( + detail::tmat2x2 const & m); - //! Return the determinant of a mat3 matrix. - //! (From GLSL 1.50.09 specification, section 8.5). - template - typename detail::tmat3x3::value_type determinant( - detail::tmat3x3 const & m); + /// Return the determinant of a mat3 matrix. + /// + /// @tparam valType Floating-point scalar types. + /// + /// @see GLSL determinant man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions + template + typename detail::tmat3x3::value_type determinant( + detail::tmat3x3 const & m); - //! Return the determinant of a mat4 matrix. - //! (From GLSL 1.50.09 specification, section 8.5). - template - typename detail::tmat4x4::value_type determinant( - detail::tmat4x4 const & m); + /// Return the determinant of a mat4 matrix. + /// + /// @tparam valType Floating-point scalar types. + /// + /// @see GLSL determinant man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions + template + typename detail::tmat4x4::value_type determinant( + detail::tmat4x4 const & m); - //! Return the inverse of a mat2 matrix. - //! (From GLSL 1.40.07 specification, section 8.5). - template - detail::tmat2x2 inverse( - detail::tmat2x2 const & m); + /// Return the inverse of a mat2 matrix. + /// + /// @tparam valType Floating-point scalar types. + /// + /// @see GLSL inverse man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions + template + detail::tmat2x2 inverse( + detail::tmat2x2 const & m); - //! Return the inverse of a mat3 matrix. - //! (From GLSL 1.40.07 specification, section 8.5). - template - detail::tmat3x3 inverse( - detail::tmat3x3 const & m); + /// Return the inverse of a mat3 matrix. + /// + /// @tparam valType Floating-point scalar types. + /// + /// @see GLSL inverse man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions + template + detail::tmat3x3 inverse( + detail::tmat3x3 const & m); - //! Return the inverse of a mat4 matrix. - //! (From GLSL 1.40.07 specification, section 8.5). - template - detail::tmat4x4 inverse( - detail::tmat4x4 const & m); + /// Return the inverse of a mat4 matrix. + /// + /// @tparam valType Floating-point scalar types. + /// + /// @see GLSL inverse man page + /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions + 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/include/eepp/helper/glm/core/func_matrix.inl b/include/eepp/helper/glm/core/func_matrix.inl index f0cbbe68a..528379dd5 100644 --- a/include/eepp/helper/glm/core/func_matrix.inl +++ b/include/eepp/helper/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 - 2012 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 - inline 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); - for(typename matType::size_type i = 0; i < matType::col_size(); ++i) + matType result(matType::null); + for(typename matType::size_type i = 0; i < matType::row_size(); ++i) result[i] = x[i] * y[i]; - return result; - } + return result; + } // outerProduct - template - inline 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,41 +59,41 @@ 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 - inline 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) + for(typename detail::tmat3x3::size_type i(0); i < m.length(); ++i) m[i] = c * r[i]; - return m; - } + return m; + } - template - inline 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) + for(typename detail::tmat4x4::size_type i(0); i < m.length(); ++i) m[i] = c * r[i]; - return m; - } + return m; + } - template - inline detail::tmat2x3 outerProduct + template + GLM_FUNC_QUALIFIER detail::tmat2x3 outerProduct ( detail::tvec3 const & c, detail::tvec2 const & r @@ -96,8 +111,8 @@ namespace glm return m; } - template - inline detail::tmat3x2 outerProduct + template + GLM_FUNC_QUALIFIER detail::tmat3x2 outerProduct ( detail::tvec2 const & c, detail::tvec3 const & r @@ -116,10 +131,10 @@ namespace glm } template - inline detail::tmat2x4 outerProduct + GLM_FUNC_QUALIFIER detail::tmat2x4 outerProduct ( - detail::tvec2 const & c, - detail::tvec4 const & r + detail::tvec4 const & c, + detail::tvec2 const & r ) { GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); @@ -137,10 +152,10 @@ namespace glm } template - inline detail::tmat4x2 outerProduct + GLM_FUNC_QUALIFIER detail::tmat4x2 outerProduct ( - detail::tvec4 const & c, - detail::tvec2 const & r + detail::tvec2 const & c, + detail::tvec4 const & r ) { GLM_STATIC_ASSERT(detail::type::is_float, "'outerProduct' only accept floating-point inputs"); @@ -158,7 +173,7 @@ namespace glm } template - inline detail::tmat3x4 outerProduct + GLM_FUNC_QUALIFIER detail::tmat3x4 outerProduct ( detail::tvec4 const & c, detail::tvec3 const & r @@ -183,7 +198,7 @@ namespace glm } template - inline detail::tmat4x3 outerProduct + GLM_FUNC_QUALIFIER detail::tmat4x3 outerProduct ( detail::tvec3 const & c, detail::tvec4 const & r @@ -207,114 +222,114 @@ namespace glm return m; } - template - inline 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 - inline 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 - inline 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 - inline 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 - inline 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 - inline detail::tmat2x4 transpose + template + GLM_FUNC_QUALIFIER detail::tmat2x4 transpose ( detail::tmat4x2 const & m ) @@ -322,39 +337,39 @@ 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 - inline detail::tmat4x2 transpose + template + GLM_FUNC_QUALIFIER detail::tmat4x2 transpose ( detail::tmat2x4 const & m ) { 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 - inline detail::tmat3x4 transpose + template + GLM_FUNC_QUALIFIER detail::tmat3x4 transpose ( detail::tmat4x3 const & m ) @@ -362,47 +377,47 @@ 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 - inline detail::tmat4x3 transpose + template + GLM_FUNC_QUALIFIER detail::tmat4x3 transpose ( detail::tmat3x4 const & m ) { 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 - inline typename detail::tmat2x2::value_type determinant + GLM_FUNC_QUALIFIER typename detail::tmat2x2::value_type determinant ( detail::tmat2x2 const & m ) @@ -413,7 +428,7 @@ namespace glm } template - inline typename detail::tmat3x3::value_type determinant + GLM_FUNC_QUALIFIER typename detail::tmat3x3::value_type determinant ( detail::tmat3x3 const & m ) @@ -427,7 +442,7 @@ namespace glm } template - inline typename detail::tmat4x4::value_type determinant + GLM_FUNC_QUALIFIER typename detail::tmat4x4::value_type determinant ( detail::tmat4x4 const & m ) @@ -448,13 +463,13 @@ 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 - inline detail::tmat2x2 inverse + GLM_FUNC_QUALIFIER detail::tmat2x2 inverse ( detail::tmat2x2 const & m ) @@ -466,15 +481,15 @@ namespace glm detail::tmat2x2 Inverse( + m[1][1] / Determinant, - - m[1][0] / Determinant, - m[0][1] / Determinant, + - m[1][0] / Determinant, + m[0][0] / Determinant); return Inverse; } template - inline detail::tmat3x3 inverse + GLM_FUNC_QUALIFIER detail::tmat3x3 inverse ( detail::tmat3x3 const & m ) @@ -503,7 +518,7 @@ namespace glm } template - inline detail::tmat4x4 inverse + GLM_FUNC_QUALIFIER detail::tmat4x4 inverse ( detail::tmat4x4 const & m ) @@ -561,11 +576,7 @@ namespace glm T Determinant = glm::dot(m[0], Row0); Inverse /= Determinant; - + return Inverse; } - - }//namespace matrix - }//namespace function - }//namespace core }//namespace glm diff --git a/include/eepp/helper/glm/core/func_noise.hpp b/include/eepp/helper/glm/core/func_noise.hpp deleted file mode 100644 index 6c5e642d8..000000000 --- a/include/eepp/helper/glm/core/func_noise.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_noise -#define glm_core_func_noise - -namespace glm -{ - namespace test{ - void main_core_func_noise(); - }//namespace test - - 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_funcs - ///@{ - - // Returns a 1D noise value based on the input value x. - // From GLSL 1.30.08 specification, section 8.9. - template - typename genType::value_type noise1(genType const & x); - - // Returns a 2D noise value based on the input value x. - // From GLSL 1.30.08 specification, section 8.9. - template - detail::tvec2 noise2(genType const & x); - - // Returns a 3D noise value based on the input value x. - // From GLSL 1.30.08 specification, section 8.9. - template - detail::tvec3 noise3(genType const & x); - - // Returns a 4D noise value based on the input value x. - // From GLSL 1.30.08 specification, section 8.9. - template - detail::tvec4 noise4(genType const & x); - - ///@} - - }//namespace noise - }//namespace function - }//namespace core - - using namespace core::function::noise; -}//namespace glm - -#include "func_noise.inl" - -#endif//glm_core_func_noise diff --git a/include/eepp/helper/glm/core/func_noise.inl b/include/eepp/helper/glm/core/func_noise.inl deleted file mode 100644 index 2a757d202..000000000 --- a/include/eepp/helper/glm/core/func_noise.inl +++ /dev/null @@ -1,305 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-01 -// Updated : 2008-09-23 -// Licence : This source is under MIT License -// File : glm/core/func_noise.inl -/////////////////////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - namespace core{ - namespace function{ - namespace noise{ - - // noise1 - template - inline genType noise1 - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise1' only accept floating-point values"); - - int iNbr = int(x + genType(3) / genType(2)) * 1103515245 + 12345; - return genType(int(iNbr / genType(65536)) % 32768) / genType(32767); - } - - template - inline typename detail::tvec2::value_type noise1 - ( - detail::tvec2 const & x - ) - { - T tmp(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) - tmp += x[i]; - return noise1(tmp); - } - - template - inline typename detail::tvec3::value_type noise1 - ( - detail::tvec3 const & x - ) - { - T tmp(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) - tmp += x[i]; - return noise1(tmp); - } - - template - inline typename detail::tvec4::value_type noise1 - ( - detail::tvec4 const & x - ) - { - T tmp(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) - tmp += x[i]; - return noise1(tmp); - } - - // noise2 - template - inline detail::tvec2 noise2 - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise2' only accept floating-point values"); - - genType f1 = x * genType(1103515245) + genType(12345); - genType f2 = f1 * genType(1103515245) + genType(12345); - return detail::tvec2( - noise1(f1), - noise1(f2)); - } - - template - inline detail::tvec2 noise2 - ( - detail::tvec2 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise2' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) - f0 += x[i]; - - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - return detail::tvec2( - noise1(f1), - noise1(f2)); - } - - template - inline detail::tvec2 noise2 - ( - detail::tvec3 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise2' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) - f0 += x[i]; - - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - return detail::tvec2( - noise1(f1), - noise1(f2)); - } - - template - inline detail::tvec2 noise2 - ( - detail::tvec4 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise2' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) - f0 += x[i]; - - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - return detail::tvec2( - noise1(f1), - noise1(f2)); - } - - // noise3 - template - inline detail::tvec3 noise3 - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise3' only accept floating-point values"); - - genType f1 = x * genType(1103515245) + genType(12345); - genType f2 = f1 * genType(1103515245) + genType(12345); - genType f3 = f2 * genType(1103515245) + genType(12345); - return detail::tvec3( - noise1(f1), - noise1(f2), - noise1(f3)); - } - - template - inline detail::tvec3 noise3 - ( - detail::tvec2 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise3' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) - f0 += x[i]; - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - T f3 = f2 * T(1103515245) + T(12345); - return detail::tvec3( - noise1(f1), - noise1(f2), - noise1(f3)); - } - - template - inline detail::tvec3 noise3 - ( - detail::tvec3 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise3' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) - f0 += x[i]; - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - T f3 = f2 * T(1103515245) + T(12345); - return detail::tvec3( - noise1(f1), - noise1(f2), - noise1(f3)); - } - - template - inline detail::tvec3 noise3 - ( - detail::tvec4 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise3' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) - f0 += x[i]; - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - T f3 = f2 * T(1103515245) + T(12345); - return detail::tvec3( - noise1(f1), - noise1(f2), - noise1(f3)); - } - - // noise4 - template - inline detail::tvec4 noise4 - ( - genType const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise4' only accept floating-point values"); - - genType f1 = x * genType(1103515245) + genType(12345); - genType f2 = f1 * genType(1103515245) + genType(12345); - genType f3 = f2 * genType(1103515245) + genType(12345); - genType f4 = f3 * genType(1103515245) + genType(12345); - return detail::tvec4( - noise1(f1), - noise1(f2), - noise1(f3), - noise1(f4)); - } - - template - inline detail::tvec4 noise4 - ( - detail::tvec2 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise4' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) - f0 += x[i]; - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - T f3 = f2 * T(1103515245) + T(12345); - T f4 = f3 * T(1103515245) + T(12345); - return detail::tvec4( - noise1(f1), - noise1(f2), - noise1(f3), - noise1(f4)); - } - - template - inline detail::tvec4 noise4 - ( - detail::tvec3 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise4' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size()(); ++i) - f0 += x[i]; - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - T f3 = f2 * T(1103515245) + T(12345); - T f4 = f3 * T(1103515245) + T(12345); - return detail::tvec4( - noise1(f1), - noise1(f2), - noise1(f3), - noise1(f4)); - } - - template - inline detail::tvec4 noise4 - ( - detail::tvec4 const & x - ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'noise4' only accept floating-point values"); - - T f0(0); - for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size()(); ++i) - f0 += x[i]; - T f1 = f0 * T(1103515245) + T(12345); - T f2 = f1 * T(1103515245) + T(12345); - T f3 = f2 * T(1103515245) + T(12345); - T f4 = f3 * T(1103515245) + T(12345); - return detail::tvec4( - noise1(f1), - noise1(f2), - noise1(f3), - noise1(f4)); - } - - }//namespace noise - }//namespace function - }//namespace core -}//namespace glm diff --git a/include/eepp/helper/glm/core/func_packing.hpp b/include/eepp/helper/glm/core/func_packing.hpp deleted file mode 100644 index 8c7cc254f..000000000 --- a/include/eepp/helper/glm/core/func_packing.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_packing -#define glm_core_func_packing - -namespace glm -{ - namespace test{ - void main_core_func_packing(); - }//namespace test - - 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 - ///@{ - - detail::uint32 packUnorm2x16(detail::tvec2 const & v); - detail::uint32 packUnorm4x8(detail::tvec4 const & v); - detail::uint32 packSnorm4x8(detail::tvec4 const & v); - - detail::tvec2 unpackUnorm2x16(detail::uint32 const & p); - detail::tvec4 unpackUnorm4x8(detail::uint32 const & p); - detail::tvec4 unpackSnorm4x8(detail::uint32 const & p); - - double packDouble2x32(detail::tvec2 const & v); - detail::tvec2 unpackDouble2x32(double const & v); - - ///@} - - }//namespace packing - }//namespace function - }//namespace core - - using namespace core::function::packing; -}//namespace glm - -#include "func_packing.inl" - -#endif//glm_core_func_packing - diff --git a/include/eepp/helper/glm/core/func_packing.inl b/include/eepp/helper/glm/core/func_packing.inl deleted file mode 100644 index 17907c577..000000000 --- a/include/eepp/helper/glm/core/func_packing.inl +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -namespace glm -{ - namespace detail - { - - }//namespace detail - - namespace core{ - namespace function{ - namespace packing - { - inline detail::uint32 packUnorm2x16(detail::tvec2 const & v) - { - detail::uint16 A((detail::uint16)round(clamp(v.x, 0.0f, 1.0f) * 65535.0f)); - detail::uint16 B((detail::uint16)round(clamp(v.y, 0.0f, 1.0f) * 65535.0f)); - return detail::uint32((B << 16) | A); - } - - inline detail::uint32 packUnorm4x8(detail::tvec4 const & v) - { - detail::uint8 A((detail::uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f)); - detail::uint8 B((detail::uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f)); - detail::uint8 C((detail::uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f)); - detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); - return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); - } - - inline detail::uint32 packSnorm4x8(detail::tvec4 const & v) - { - detail::uint8 A((detail::uint8)round(clamp(v.x,-1.0f, 1.0f) * 255.0f)); - detail::uint8 B((detail::uint8)round(clamp(v.y,-1.0f, 1.0f) * 255.0f)); - detail::uint8 C((detail::uint8)round(clamp(v.z,-1.0f, 1.0f) * 255.0f)); - detail::uint8 D((detail::uint8)round(clamp(v.w,-1.0f, 1.0f) * 255.0f)); - return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); - } - - inline detail::tvec2 unpackUnorm2x16(detail::uint32 const & p) - { - detail::uint16 A(detail::uint16(p >> 0)); - detail::uint16 B(detail::uint16(p >> 16)); - return detail::tvec2( - A * 1.0f / 65535.0f, - B * 1.0f / 65535.0f); - } - - inline detail::tvec4 unpackUnorm4x8(detail::uint32 const & p) - { - detail::uint8 A(detail::uint8(p >> 0)); - detail::uint8 B(detail::uint8(p >> 8)); - detail::uint8 C(detail::uint8(p >> 16)); - detail::uint8 D(detail::uint8(p >> 24)); - return detail::tvec4( - A * 1.0f / 255.0f, - B * 1.0f / 255.0f, - C * 1.0f / 255.0f, - D * 1.0f / 255.0f); - } - - inline detail::tvec4 unpackSnorm4x8(detail::uint32 const & p) - { - detail::uint8 A(detail::uint8(p >> 0)); - detail::uint8 B(detail::uint8(p >> 8)); - detail::uint8 C(detail::uint8(p >> 16)); - detail::uint8 D(detail::uint8(p >> 24)); - return clamp(detail::tvec4( - A * 1.0f / 127.0f, - B * 1.0f / 127.0f, - C * 1.0f / 127.0f, - D * 1.0f / 127.0f), -1.0f, 1.0f); - } - - inline double packDouble2x32(detail::tvec2 const & v) - { - return *(double*)&v; - } - - inline detail::tvec2 unpackDouble2x32(double const & v) - { - return *(detail::tvec2*)&v; - } - - }//namespace packing - }//namespace function - }//namespace core -}//namespace glm diff --git a/include/eepp/helper/glm/core/func_trigonometric.hpp b/include/eepp/helper/glm/core/func_trigonometric.hpp index 88290ba76..d8b87e368 100644 --- a/include/eepp/helper/glm/core/func_trigonometric.hpp +++ b/include/eepp/helper/glm/core/func_trigonometric.hpp @@ -1,130 +1,203 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 Angle and Trigonometry Functions +/// +/// @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 test{ - void main_core_func_trigonometric(); - }//namespace test + /// @addtogroup core_func_trigonometric + /// @{ - 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 - ///@{ - - //! Converts degrees to radians and returns the result. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Converts degrees to radians and returns the result. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL radians man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType radians(genType const & degrees); - //! Converts radians to degrees and returns the result. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Converts radians to degrees and returns the result. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL degrees man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType degrees(genType const & radians); - //! The standard trigonometric sine function. - //! The values returned by this function will range from [-1, 1]. - //! (From GLSL 1.30.08 specification, section 8.1) + /// The standard trigonometric sine function. + /// The values returned by this function will range from [-1, 1]. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL sin man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType sin(genType const & angle); - //! The standard trigonometric cosine function. - //! The values returned by this function will range from [-1, 1]. - //! (From GLSL 1.30.08 specification, section 8.1) + /// The standard trigonometric cosine function. + /// The values returned by this function will range from [-1, 1]. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL cos man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType cos(genType const & angle); - //! The standard trigonometric tangent function. - //! (From GLSL 1.30.08 specification, section 8.1) + /// The standard trigonometric tangent function. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL tan man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType tan(genType const & angle); - //! Arc sine. Returns an angle whose sine is x. - //! The range of values returned by this function is [-PI/2, PI/2]. - //! Results are undefined if |x| > 1. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Arc sine. Returns an angle whose sine is x. + /// The range of values returned by this function is [-PI/2, PI/2]. + /// Results are undefined if |x| > 1. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL asin man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType asin(genType const & x); - //! Arc cosine. Returns an angle whose sine is x. - //! The range of values returned by this function is [0, PI]. - //! Results are undefined if |x| > 1. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Arc cosine. Returns an angle whose sine is x. + /// The range of values returned by this function is [0, PI]. + /// Results are undefined if |x| > 1. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL acos man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType acos(genType const & x); - //! Arc tangent. Returns an angle whose tangent is y/x. - //! The signs of x and y are used to determine what - //! quadrant the angle is in. The range of values returned - //! by this function is [-PI, PI]. Results are undefined - //! if x and y are both 0. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Arc tangent. Returns an angle whose tangent is y/x. + /// The signs of x and y are used to determine what + /// quadrant the angle is in. The range of values returned + /// by this function is [-PI, PI]. Results are undefined + /// if x and y are both 0. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL atan man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions 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]. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Arc tangent. Returns an angle whose tangent is y_over_x. + /// The range of values returned by this function is [-PI/2, PI/2]. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL atan man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType atan(genType const & y_over_x); - //! Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 - //! (From GLSL 1.30.08 specification, section 8.1) + /// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2 + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL sinh man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType sinh(genType const & angle); - //! Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 - //! (From GLSL 1.30.08 specification, section 8.1) + /// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2 + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL cosh man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType cosh(genType const & angle); - //! Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) - //! (From GLSL 1.30.08 specification, section 8.1) + /// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL tanh man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType tanh(genType const & angle); - //! Arc hyperbolic sine; returns the inverse of sinh. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Arc hyperbolic sine; returns the inverse of sinh. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL asinh man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType asinh(genType const & x); - //! Arc hyperbolic cosine; returns the non-negative inverse - //! of cosh. Results are undefined if x < 1. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Arc hyperbolic cosine; returns the non-negative inverse + /// of cosh. Results are undefined if x < 1. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL acosh man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions template genType acosh(genType const & x); - //! Arc hyperbolic tangent; returns the inverse of tanh. - //! Results are undefined if abs(x) >= 1. - //! (From GLSL 1.30.08 specification, section 8.1) + /// Arc hyperbolic tangent; returns the inverse of tanh. + /// Results are undefined if abs(x) >= 1. + /// + /// @tparam genType Floating-point scalar or vector types. + /// + /// @see GLSL atanh man page + /// @see GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions 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/include/eepp/helper/glm/core/func_trigonometric.inl b/include/eepp/helper/glm/core/func_trigonometric.inl index 382bee4db..0dc51f154 100644 --- a/include/eepp/helper/glm/core/func_trigonometric.inl +++ b/include/eepp/helper/glm/core/func_trigonometric.inl @@ -1,745 +1,244 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 - 2012 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 core{ - namespace function{ - namespace trigonometric{ - - // radians - template - inline genType radians + // 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)); - } + genType const pi = genType(3.1415926535897932384626433832795); + return degrees * (pi / genType(180)); + } - template - inline detail::tvec2 radians - ( - detail::tvec2 const & degrees - ) - { - return detail::tvec2( - radians(degrees.x), - radians(degrees.y)); - } - - template - inline detail::tvec3 radians - ( - detail::tvec3 const & degrees - ) - { - return detail::tvec3( - radians(degrees.x), - radians(degrees.y), - radians(degrees.z)); - } - - template - inline detail::tvec4 radians - ( - detail::tvec4 const & degrees - ) - { - return detail::tvec4( - radians(degrees.x), - radians(degrees.y), - radians(degrees.z), - radians(degrees.w)); - } - - // degrees - template - inline genType degrees + VECTORIZE_VEC(radians) + + // 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 - inline detail::tvec2 degrees - ( - detail::tvec2 const & radians - ) - { - return detail::tvec2( - degrees(radians.x), - degrees(radians.y)); - } + VECTORIZE_VEC(degrees) - template - inline detail::tvec3 degrees - ( - detail::tvec3 const & radians - ) - { - return detail::tvec3( - degrees(radians.x), - degrees(radians.y), - degrees(radians.z)); - } - - template - inline detail::tvec4 degrees - ( - detail::tvec4 const & radians - ) - { - return detail::tvec4( - degrees(radians.x), - degrees(radians.y), - degrees(radians.z), - degrees(radians.w)); - } - - // sin - template - inline genType sin + // 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); - } + } - template - inline detail::tvec2 sin - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - sin(angle.x), - sin(angle.y)); - } + VECTORIZE_VEC(sin) - template - inline detail::tvec3 sin - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - sin(angle.x), - sin(angle.y), - sin(angle.z)); - } - - template - inline detail::tvec4 sin - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - sin(angle.x), - sin(angle.y), - sin(angle.z), - sin(angle.w)); - } - - // cos - template - inline genType cos(genType const & angle) - { + // 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 - inline detail::tvec2 cos - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - cos(angle.x), - cos(angle.y)); - } + VECTORIZE_VEC(cos) - template - inline detail::tvec3 cos - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - cos(angle.x), - cos(angle.y), - cos(angle.z)); - } - - template - inline detail::tvec4 cos - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - cos(angle.x), - cos(angle.y), - cos(angle.z), - cos(angle.w)); - } - - // tan - template - inline genType tan + // 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 - inline detail::tvec2 tan - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - tan(angle.x), - tan(angle.y)); - } + VECTORIZE_VEC(tan) - template - inline detail::tvec3 tan - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - tan(angle.x), - tan(angle.y), - tan(angle.z)); - } - - template - inline detail::tvec4 tan - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - tan(angle.x), - tan(angle.y), - tan(angle.z), - tan(angle.w)); - } - - // asin - template - inline genType asin + // 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 - inline detail::tvec2 asin - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - asin(x.x), - asin(x.y)); - } + VECTORIZE_VEC(asin) - template - inline detail::tvec3 asin - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - asin(x.x), - asin(x.y), - asin(x.z)); - } - - template - inline detail::tvec4 asin - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - asin(x.x), - asin(x.y), - asin(x.z), - asin(x.w)); - } - - // acos - template - inline genType acos + // 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 - inline detail::tvec2 acos - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - acos(x.x), - acos(x.y)); - } + VECTORIZE_VEC(acos) - template - inline detail::tvec3 acos - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - acos(x.x), - acos(x.y), - acos(x.z)); - } - - template - inline detail::tvec4 acos - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - acos(x.x), - acos(x.y), - acos(x.z), - acos(x.w)); - } - - // atan - template - inline genType atan + // 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 - inline detail::tvec2 atan - ( - detail::tvec2 const & y, - detail::tvec2 const & x - ) - { - return detail::tvec2( - atan(y.x, x.x), - atan(y.y, x.y)); - } + VECTORIZE_VEC_VEC(atan) - template - inline 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 - inline 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 - inline genType atan + 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 - inline detail::tvec2 atan - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - atan(x.x), - atan(x.y)); - } + VECTORIZE_VEC(atan) - template - inline detail::tvec3 atan - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - atan(x.x), - atan(x.y), - atan(x.z)); - } - - template - inline detail::tvec4 atan - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - atan(x.x), - atan(x.y), - atan(x.z), - atan(x.w)); - } - - // sinh - template - inline genType sinh + // sinh + template + GLM_FUNC_QUALIFIER genType sinh ( genType const & angle ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'sinh' only accept floating-point input"); + { + GLM_STATIC_ASSERT(detail::type::is_float, "'sinh' only accept floating-point input"); return std::sinh(angle); - } + } - template - inline detail::tvec2 sinh - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - sinh(angle.x), - sinh(angle.y)); - } + VECTORIZE_VEC(sinh) - template - inline detail::tvec3 sinh - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - sinh(angle.x), - sinh(angle.y), - sinh(angle.z)); - } - - template - inline detail::tvec4 sinh - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - sinh(angle.x), - sinh(angle.y), - sinh(angle.z), - sinh(angle.w)); - } - - // cosh - template - inline genType cosh + // cosh + template + GLM_FUNC_QUALIFIER genType cosh ( genType const & angle ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'cosh' only accept floating-point input"); + { + GLM_STATIC_ASSERT(detail::type::is_float, "'cosh' only accept floating-point input"); return std::cosh(angle); - } + } - template - inline detail::tvec2 cosh - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - cosh(angle.x), - cosh(angle.y)); - } + VECTORIZE_VEC(cosh) - template - inline detail::tvec3 cosh - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - cosh(angle.x), - cosh(angle.y), - cosh(angle.z)); - } - - template - inline detail::tvec4 cosh - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - cosh(angle.x), - cosh(angle.y), - cosh(angle.z), - cosh(angle.w)); - } - - // tanh - template - inline genType tanh + // tanh + template + GLM_FUNC_QUALIFIER genType tanh ( genType const & angle ) - { - GLM_STATIC_ASSERT(detail::type::is_float, "'tanh' only accept floating-point input"); + { + GLM_STATIC_ASSERT(detail::type::is_float, "'tanh' only accept floating-point input"); return std::tanh(angle); - } + } - template - inline detail::tvec2 tanh - ( - detail::tvec2 const & angle - ) - { - return detail::tvec2( - tanh(angle.x), - tanh(angle.y)); - } + VECTORIZE_VEC(tanh) - template - inline detail::tvec3 tanh - ( - detail::tvec3 const & angle - ) - { - return detail::tvec3( - tanh(angle.x), - tanh(angle.y), - tanh(angle.z)); - } - - template - inline detail::tvec4 tanh - ( - detail::tvec4 const & angle - ) - { - return detail::tvec4( - tanh(angle.x), - tanh(angle.y), - tanh(angle.z), - tanh(angle.w)); - } - - // asinh - template - inline genType asinh + // 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)); - } + } - template - inline detail::tvec2 asinh - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - asinh(x.x), - asinh(x.y)); - } + VECTORIZE_VEC(asinh) - template - inline detail::tvec3 asinh - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - asinh(x.x), - asinh(x.y), - asinh(x.z)); - } - - template - inline detail::tvec4 asinh - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - asinh(x.x), - asinh(x.y), - asinh(x.z), - asinh(x.w)); - } - - // acosh - template - inline genType acosh + // 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))); - } - - template - inline detail::tvec2 acosh - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - acosh(x.x), - acosh(x.y)); } - template - inline detail::tvec3 acosh - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - acosh(x.x), - acosh(x.y), - acosh(x.z)); - } + VECTORIZE_VEC(acosh) - template - inline detail::tvec4 acosh - ( - detail::tvec4 const & x - ) - { - return detail::tvec4( - acosh(x.x), - acosh(x.y), - acosh(x.z), - acosh(x.w)); - } - - // atanh - template - inline genType atanh + // 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)); - } + } - template - inline detail::tvec2 atanh - ( - detail::tvec2 const & x - ) - { - return detail::tvec2( - atanh(x.x), - atanh(x.y)); - } + VECTORIZE_VEC(atanh) - template - inline detail::tvec3 atanh - ( - detail::tvec3 const & x - ) - { - return detail::tvec3( - atanh(x.x), - atanh(x.y), - atanh(x.z)); - } - - template - inline 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/include/eepp/helper/glm/core/func_vector_relational.hpp b/include/eepp/helper/glm/core/func_vector_relational.hpp deleted file mode 100644 index 5bc087218..000000000 --- a/include/eepp/helper/glm/core/func_vector_relational.hpp +++ /dev/null @@ -1,200 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// 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 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef glm_core_func_vector_relational -#define glm_core_func_vector_relational - -#include "_detail.hpp" - -namespace glm -{ - namespace test{ - void main_core_func_vector_relational(); - }//namespace test - - namespace core{ - namespace function{ - //! Define vector relational functions from Section 8.3 of GLSL 1.30.8 specification. - //! Included in glm namespace. - namespace vector_relational - { - /// \addtogroup core_funcs - ///@{ - - //! Returns the component-wise comparison result of x < y. - //! (From GLSL 1.30.08 specification, section 8.6) - template class vecType> - inline 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"); - - 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. - //! (From GLSL 1.30.08 specification, section 8.6) - template class vecType> - inline 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"); - - 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. - //! (From GLSL 1.30.08 specification, section 8.6) - template class vecType> - inline 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"); - - 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. - //! (From GLSL 1.30.08 specification, section 8.6) - template class vecType> - inline typename vecType::bool_type greaterThanEqual - ( - vecType const & x, - vecType const & y - ) - { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, - "Invalid template instantiation of 'greaterThanEqual', GLM vector types required"); - GLM_STATIC_ASSERT(detail::is_bool::_NO, - "Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors"); - - 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. - //! (From GLSL 1.30.08 specification, section 8.6) - template class vecType> - inline typename vecType::bool_type equal - ( - vecType const & x, - vecType const & y - ) - { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, - "Invalid template instantiation of 'equal', GLM vector types required"); - - 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. - //! (From GLSL 1.30.08 specification, section 8.6) - template class vecType> - inline typename vecType::bool_type notEqual - ( - vecType const & x, - vecType const & y - ) - { - GLM_STATIC_ASSERT(detail::is_vector >::_YES, - "Invalid template instantiation of 'notEqual', GLM vector types required"); - - 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. - //! (From GLSL 1.30.08 specification, section 8.6) - template