From: slack Date: Sun, 10 Jan 2010 20:30:36 +0000 (+0100) Subject: WIP X-Git-Url: http://slack.codemaniacs.com/git/?a=commitdiff_plain;h=57831dbcac41ee5be05613bb33a1f3209ed0751b;p=md5view.git WIP --- diff --git a/default.frag b/default.frag new file mode 100644 index 0000000..4fa2df6 --- /dev/null +++ b/default.frag @@ -0,0 +1,10 @@ +#version 120 +// It was expressed that some drivers required this next line to function properly +in vec4 ex_Color; +//out vec4 gl_FragColor; + +void main(void) { + // Pass through our original color with full opacity. + gl_FragColor = ex_Color; +} + diff --git a/default.vert b/default.vert new file mode 100644 index 0000000..7d8fa6a --- /dev/null +++ b/default.vert @@ -0,0 +1,20 @@ +#version 120 + +// in_Position was bound to attribute index 0 and in_Color was bound to attribute index 1 +in vec3 in_Position; + +// We output the ex_Color variable to the next shader in the chain +out vec4 ex_Color; +void main(void) { + // Since we are using flat lines, our input only had two points: x and y. + // Set the Z coordinate to 0 and W coordinate to 1 + + gl_Position = vec4(in_Position, 1.0); + + // GLSL allows shorthand use of vectors too, the following is also valid: + // gl_Position = vec4(in_Position, 0.0, 1.0); + // We're simply passing the color through unmodified + + ex_Color = vec4(1.0,0.0,0.0,1.0); +} + diff --git a/glm/GLM_GTX_associated_min_max.h b/glm/GLM_GTX_associated_min_max.h new file mode 100644 index 0000000..fd11457 --- /dev/null +++ b/glm/GLM_GTX_associated_min_max.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_associated_min_max_api +#define glm_gtx_associated_min_max_api + +#include "gtx/associated_min_max.hpp" + +namespace glm +{ + using GLM_GTX_associated_min_max; +} + +#endif//glm_gtx_associated_min_max_api diff --git a/glm/GLM_GTX_bit.h b/glm/GLM_GTX_bit.h new file mode 100644 index 0000000..c74283b --- /dev/null +++ b/glm/GLM_GTX_bit.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_bit_api +#define glm_gtx_bit_api + +#include "gtx/bit.hpp" + +namespace glm +{ + using GLM_GTX_bit; +} + +#endif//glm_gtx_bit_api diff --git a/glm/GLM_GTX_closest_point.h b/glm/GLM_GTX_closest_point.h new file mode 100644 index 0000000..4340bf4 --- /dev/null +++ b/glm/GLM_GTX_closest_point.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_closest_point_api +#define glm_gtx_closest_point_api + +#include "gtx/closest_point.hpp" + +namespace glm +{ + using GLM_GTX_closest_point; +} + +#endif//glm_gtx_closest_point_api diff --git a/glm/GLM_GTX_color_cast.h b/glm/GLM_GTX_color_cast.h new file mode 100644 index 0000000..c03a8ce --- /dev/null +++ b/glm/GLM_GTX_color_cast.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_color_cast_api +#define glm_gtx_color_cast_api + +#include "gtx/color_cast.hpp" + +namespace glm +{ + using GLM_GTX_color_cast; +} + +#endif//glm_gtx_color_cast_api diff --git a/glm/GLM_GTX_color_space.h b/glm/GLM_GTX_color_space.h new file mode 100644 index 0000000..1126890 --- /dev/null +++ b/glm/GLM_GTX_color_space.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_color_space_api +#define glm_gtx_color_space_api + +#include "gtx/color_space.hpp" + +namespace glm +{ + using GLM_GTX_color_space; +} + +#endif//glm_gtx_color_space_api diff --git a/glm/GLM_GTX_color_space_YCoCg.h b/glm/GLM_GTX_color_space_YCoCg.h new file mode 100644 index 0000000..f0cb8ca --- /dev/null +++ b/glm/GLM_GTX_color_space_YCoCg.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-11-28 +// Updated : 2008-11-28 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_color_space_YCoCg_api +#define glm_gtx_color_space_YCoCg_api + +#include "gtx/color_space_YCoCg.hpp" + +namespace glm +{ + using GLM_GTX_color_space_YCoCg; +} + +#endif//glm_gtx_color_space_YCoCg_api diff --git a/glm/GLM_GTX_comparison.h b/glm/GLM_GTX_comparison.h new file mode 100644 index 0000000..35201b5 --- /dev/null +++ b/glm/GLM_GTX_comparison.h @@ -0,0 +1,16 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_comparison_api +#define glm_gtx_comparison_api + +#include "gtx/comparison.hpp" + +using GLM_GTX_comparison; + +#endif//glm_gtx_comparison_api diff --git a/glm/GLM_GTX_compatibility.h b/glm/GLM_GTX_compatibility.h new file mode 100644 index 0000000..420ad2d --- /dev/null +++ b/glm/GLM_GTX_compatibility.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_compatibility_api +#define glm_gtx_compatibility_api + +#include "gtx/compatibility.hpp" + +namespace glm +{ + using GLM_GTX_compatibility; +} + +#endif//glm_gtx_compatibility_api diff --git a/glm/GLM_GTX_component_wise.h b/glm/GLM_GTX_component_wise.h new file mode 100644 index 0000000..14a37f9 --- /dev/null +++ b/glm/GLM_GTX_component_wise.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_component_wise_api +#define glm_gtx_component_wise_api + +#include "gtx/component_wise.hpp" + +namespace glm +{ + using GLM_GTX_component_wise; +} + +#endif//glm_gtx_component_wise_api diff --git a/glm/GLM_GTX_determinant.h b/glm/GLM_GTX_determinant.h new file mode 100644 index 0000000..5e907ed --- /dev/null +++ b/glm/GLM_GTX_determinant.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_determinant_api +#define glm_gtx_determinant_api + +#include "gtx/determinant.hpp" + +namespace glm +{ + using GLM_GTX_determinant; +} + +#endif//glm_gtx_determinant_api diff --git a/glm/GLM_GTX_double_float.h b/glm/GLM_GTX_double_float.h new file mode 100644 index 0000000..b1ebaea --- /dev/null +++ b/glm/GLM_GTX_double_float.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_double_float_api +#define glm_gtx_double_float_api + +#include "gtx/double_float.hpp" + +namespace glm +{ + using GLM_GTX_double_float; +} + +#endif//glm_gtx_double_float_api diff --git a/glm/GLM_GTX_epsilon.h b/glm/GLM_GTX_epsilon.h new file mode 100644 index 0000000..04f18cc --- /dev/null +++ b/glm/GLM_GTX_epsilon.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_epsilon_api +#define glm_gtx_epsilon_api + +#include "gtx/epsilon.hpp" + +namespace glm +{ + using GLM_GTX_epsilon; +} + +#endif//glm_gtx_epsilon_api diff --git a/glm/GLM_GTX_euler_angles.h b/glm/GLM_GTX_euler_angles.h new file mode 100644 index 0000000..f46d6b0 --- /dev/null +++ b/glm/GLM_GTX_euler_angles.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_euler_angles_api +#define glm_gtx_euler_angles_api + +#include "gtx/euler_angles.hpp" + +namespace glm +{ + using GLM_GTX_euler_angles; +} + +#endif//glm_gtx_euler_angles_api diff --git a/glm/GLM_GTX_extend.h b/glm/GLM_GTX_extend.h new file mode 100644 index 0000000..0733632 --- /dev/null +++ b/glm/GLM_GTX_extend.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_extend_api +#define glm_gtx_extend_api + +#include "gtx/extend.hpp" + +namespace glm +{ + using GLM_GTX_extend; +} + +#endif//glm_gtx_extend_api diff --git a/glm/GLM_GTX_extented_min_max.h b/glm/GLM_GTX_extented_min_max.h new file mode 100644 index 0000000..79d42a7 --- /dev/null +++ b/glm/GLM_GTX_extented_min_max.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_extented_min_max_api +#define glm_gtx_extented_min_max_api + +#include "gtx/extented_min_max.hpp" + +namespace glm +{ + using GLM_GTX_extented_min_max; +} + +#endif//glm_gtx_extented_min_max_api diff --git a/glm/GLM_GTX_fast_exponential.h b/glm/GLM_GTX_fast_exponential.h new file mode 100644 index 0000000..61cf3ff --- /dev/null +++ b/glm/GLM_GTX_fast_exponential.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_fast_exponential_api +#define glm_gtx_fast_exponential_api + +#include "gtx/fast_exponential.hpp" + +namespace glm +{ + using GLM_GTX_fast_exponential; +} + +#endif//glm_gtx_fast_exponential_api diff --git a/glm/GLM_GTX_fast_square_root.h b/glm/GLM_GTX_fast_square_root.h new file mode 100644 index 0000000..7204e3c --- /dev/null +++ b/glm/GLM_GTX_fast_square_root.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_fast_square_root_api +#define glm_gtx_fast_square_root_api + +#include "gtx/fast_square_root.hpp" + +namespace glm +{ + using GLM_GTX_fast_square_root; +} + +#endif//glm_gtx_fast_square_root_api diff --git a/glm/GLM_GTX_fast_trigonometry.h b/glm/GLM_GTX_fast_trigonometry.h new file mode 100644 index 0000000..eeca38c --- /dev/null +++ b/glm/GLM_GTX_fast_trigonometry.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_fast_trigonometry_api +#define glm_gtx_fast_trigonometry_api + +#include "gtx/fast_trigonometry.hpp" + +namespace glm +{ + using GLM_GTX_fast_trigonometry; +} + +#endif//glm_gtx_fast_trigonometry_api diff --git a/glm/GLM_GTX_gradient_paint.h b/glm/GLM_GTX_gradient_paint.h new file mode 100644 index 0000000..ba4d051 --- /dev/null +++ b/glm/GLM_GTX_gradient_paint.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-03-06 +// Updated : 2009-03-09 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_gradient_paint_api +#define glm_gtx_gradient_paint_api + +#include "gtx/gradient_paint.hpp" + +namespace glm +{ + using GLM_GTX_gradient_paint; +} + +#endif//glm_gtx_gradient_paint_api diff --git a/glm/GLM_GTX_half_float.h b/glm/GLM_GTX_half_float.h new file mode 100644 index 0000000..1485c1e --- /dev/null +++ b/glm/GLM_GTX_half_float.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_half_float_api +#define glm_gtx_half_float_api + +#include "gtx/half_float.hpp" + +namespace glm +{ + using GLM_GTX_half_float; +} + +#endif//glm_gtx_half_float_api diff --git a/glm/GLM_GTX_handed_coordinate_space.h b/glm/GLM_GTX_handed_coordinate_space.h new file mode 100644 index 0000000..9959c2a --- /dev/null +++ b/glm/GLM_GTX_handed_coordinate_space.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_handed_coordinate_space_api +#define glm_gtx_handed_coordinate_space_api + +#include "gtx/handed_coordinate_space.hpp" + +namespace glm +{ + using GLM_GTX_handed_coordinate_space; +} + +#endif//glm_gtx_handed_coordinate_space_api diff --git a/glm/GLM_GTX_inertia.h b/glm/GLM_GTX_inertia.h new file mode 100644 index 0000000..0f4a641 --- /dev/null +++ b/glm/GLM_GTX_inertia.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_inertia_api +#define glm_gtx_inertia_api + +#include "gtx/inertia.hpp" + +namespace glm +{ + using GLM_GTX_inertia; +} + +#endif//glm_gtx_inertia_api diff --git a/glm/GLM_GTX_integer.h b/glm/GLM_GTX_integer.h new file mode 100644 index 0000000..1fca9e6 --- /dev/null +++ b/glm/GLM_GTX_integer.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_integer_api +#define glm_gtx_integer_api + +#include "gtx/integer.hpp" + +namespace glm +{ + using GLM_GTX_integer; +} + +#endif//glm_gtx_integer_api diff --git a/glm/GLM_GTX_intersect.h b/glm/GLM_GTX_intersect.h new file mode 100644 index 0000000..0ebff41 --- /dev/null +++ b/glm/GLM_GTX_intersect.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_intersect_api +#define glm_gtx_intersect_api + +#include "gtx/intersect.hpp" + +namespace glm +{ + using GLM_GTX_intersect; +} + +#endif//glm_gtx_intersect_api diff --git a/glm/GLM_GTX_inverse.h b/glm/GLM_GTX_inverse.h new file mode 100644 index 0000000..4557727 --- /dev/null +++ b/glm/GLM_GTX_inverse.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_inverse_api +#define glm_gtx_inverse_api + +#include "gtx/inverse.hpp" + +namespace glm +{ + using GLM_GTX_inverse; +} + +#endif//glm_gtx_inverse_api diff --git a/glm/GLM_GTX_inverse_transpose.h b/glm/GLM_GTX_inverse_transpose.h new file mode 100644 index 0000000..230d952 --- /dev/null +++ b/glm/GLM_GTX_inverse_transpose.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_inverse_transpose_api +#define glm_gtx_inverse_transpose_api + +#include "gtx/inverse_transpose.hpp" + +namespace glm +{ + using GLM_GTX_inverse_transpose; +} + +#endif//glm_gtx_inverse_transpose_api diff --git a/glm/GLM_GTX_log_base.h b/glm/GLM_GTX_log_base.h new file mode 100644 index 0000000..f2af52a --- /dev/null +++ b/glm/GLM_GTX_log_base.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-27 +// Updated : 2008-10-27 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_log_base_api +#define glm_gtx_log_base_api + +#include "gtx/log_base.hpp" + +namespace glm +{ + using GLM_GTX_log_base; +} + +#endif//glm_gtx_log_base_api diff --git a/glm/GLM_GTX_matrix_access.h b/glm/GLM_GTX_matrix_access.h new file mode 100644 index 0000000..07141e3 --- /dev/null +++ b/glm/GLM_GTX_matrix_access.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_access_api +#define glm_gtx_matrix_access_api + +#include "gtx/matrix_access.hpp" + +namespace glm +{ + using GLM_GTX_matrix_access; +} + +#endif//glm_gtx_matrix_access_api diff --git a/glm/GLM_GTX_matrix_cross_product.h b/glm/GLM_GTX_matrix_cross_product.h new file mode 100644 index 0000000..9a0fefd --- /dev/null +++ b/glm/GLM_GTX_matrix_cross_product.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_cross_product_api +#define glm_gtx_matrix_cross_product_api + +#include "gtx/matrix_cross_product.hpp" + +namespace glm +{ + using GLM_GTX_matrix_cross_product; +} + +#endif//glm_gtx_matrix_cross_product_api diff --git a/glm/GLM_GTX_matrix_major_storage.h b/glm/GLM_GTX_matrix_major_storage.h new file mode 100644 index 0000000..3dcb1ed --- /dev/null +++ b/glm/GLM_GTX_matrix_major_storage.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_major_storage_api +#define glm_gtx_matrix_major_storage_api + +#include "gtx/matrix_major_storage.hpp" + +namespace glm +{ + using GLM_GTX_matrix_major_storage; +} + +#endif//glm_gtx_matrix_major_storage_api diff --git a/glm/GLM_GTX_matrix_projection.h b/glm/GLM_GTX_matrix_projection.h new file mode 100644 index 0000000..11b365d --- /dev/null +++ b/glm/GLM_GTX_matrix_projection.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_projection_api +#define glm_gtx_matrix_projection_api + +#include "gtx/matrix_projection.hpp" + +namespace glm +{ + using GLM_GTX_matrix_projection; +} + +#endif//glm_gtx_matrix_projection_api diff --git a/glm/GLM_GTX_matrix_query.h b/glm/GLM_GTX_matrix_query.h new file mode 100644 index 0000000..e6266eb --- /dev/null +++ b/glm/GLM_GTX_matrix_query.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_query_api +#define glm_gtx_matrix_query_api + +#include "gtx/matrix_query.hpp" + +namespace glm +{ + using GLM_GTX_matrix_query; +} + +#endif//glm_gtx_matrix_query_api diff --git a/glm/GLM_GTX_matrix_selection.h b/glm/GLM_GTX_matrix_selection.h new file mode 100644 index 0000000..9f8cf28 --- /dev/null +++ b/glm/GLM_GTX_matrix_selection.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_selection_api +#define glm_gtx_matrix_selection_api + +#include "gtx/matrix_selection.hpp" + +namespace glm +{ + using GLM_GTX_matrix_selection; +} + +#endif//glm_gtx_matrix_selection_api diff --git a/glm/GLM_GTX_mixed_product.h b/glm/GLM_GTX_mixed_product.h new file mode 100644 index 0000000..115a7ee --- /dev/null +++ b/glm/GLM_GTX_mixed_product.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_mixed_product_api +#define glm_gtx_mixed_product_api + +#include "gtx/mixed_product.hpp" + +namespace glm +{ + using GLM_GTX_mixed_product; +} + +#endif//glm_gtx_mixed_product_api diff --git a/glm/GLM_GTX_norm.h b/glm/GLM_GTX_norm.h new file mode 100644 index 0000000..457dce1 --- /dev/null +++ b/glm/GLM_GTX_norm.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2009-01-16 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_norm_api +#define glm_gtx_norm_api + +#include "gtx/norm.hpp" + +namespace glm +{ + using GLM_GTX_norm; +} + +#endif//glm_gtx_norm_api diff --git a/glm/GLM_GTX_normal.h b/glm/GLM_GTX_normal.h new file mode 100644 index 0000000..2f2a633 --- /dev/null +++ b/glm/GLM_GTX_normal.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_normal_api +#define glm_gtx_normal_api + +#include "gtx/normal.hpp" + +namespace glm +{ + using GLM_GTX_normal; +} + +#endif//glm_gtx_normal_api diff --git a/glm/GLM_GTX_normalize_dot.h b/glm/GLM_GTX_normalize_dot.h new file mode 100644 index 0000000..9303833 --- /dev/null +++ b/glm/GLM_GTX_normalize_dot.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_normalize_dot_api +#define glm_gtx_normalize_dot_api + +#include "gtx/normalize_dot.hpp" + +namespace glm +{ + using GLM_GTX_normalize_dot; +} + +#endif//glm_gtx_normalize_dot_api diff --git a/glm/GLM_GTX_number_precision.h b/glm/GLM_GTX_number_precision.h new file mode 100644 index 0000000..606fbfc --- /dev/null +++ b/glm/GLM_GTX_number_precision.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_number_precision_api +#define glm_gtx_number_precision_api + +#include "gtx/number_precision.hpp" + +namespace glm +{ + using GLM_GTX_number_precision; +} + +#endif//glm_gtx_number_precision_api diff --git a/glm/GLM_GTX_optimum_pow.h b/glm/GLM_GTX_optimum_pow.h new file mode 100644 index 0000000..1c27ca1 --- /dev/null +++ b/glm/GLM_GTX_optimum_pow.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_optimum_pow_api +#define glm_gtx_optimum_pow_api + +#include "gtx/optimum_pow.hpp" + +namespace glm +{ + using GLM_GTX_optimum_pow; +} + +#endif//glm_gtx_optimum_pow_api diff --git a/glm/GLM_GTX_orthonormalize.h b/glm/GLM_GTX_orthonormalize.h new file mode 100644 index 0000000..b9ee4b9 --- /dev/null +++ b/glm/GLM_GTX_orthonormalize.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_orthonormalize_api +#define glm_gtx_orthonormalize_api + +#include "gtx/orthonormalize.hpp" + +namespace glm +{ + using GLM_GTX_orthonormalize; +} + +#endif//glm_gtx_orthonormalize_api diff --git a/glm/GLM_GTX_perpendicular.h b/glm/GLM_GTX_perpendicular.h new file mode 100644 index 0000000..241f624 --- /dev/null +++ b/glm/GLM_GTX_perpendicular.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_perpendicular_api +#define glm_gtx_perpendicular_api + +#include "gtx/perpendicular.hpp" + +namespace glm +{ + using GLM_GTX_perpendicular; +} + +#endif//glm_gtx_perpendicular_api diff --git a/glm/GLM_GTX_polar_coordinates.h b/glm/GLM_GTX_polar_coordinates.h new file mode 100644 index 0000000..f7113e1 --- /dev/null +++ b/glm/GLM_GTX_polar_coordinates.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_polar_coordinates_api +#define glm_gtx_polar_coordinates_api + +#include "gtx/polar_coordinates.hpp" + +namespace glm +{ + using GLM_GTX_polar_coordinates; +} + +#endif//glm_gtx_polar_coordinates_api diff --git a/glm/GLM_GTX_projection.h b/glm/GLM_GTX_projection.h new file mode 100644 index 0000000..35090b4 --- /dev/null +++ b/glm/GLM_GTX_projection.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_projection_api +#define glm_gtx_projection_api + +#include "gtx/projection.hpp" + +namespace glm +{ + using GLM_GTX_projection; +} + +#endif//glm_gtx_projection_api diff --git a/glm/GLM_GTX_quaternion.h b/glm/GLM_GTX_quaternion.h new file mode 100644 index 0000000..8bdd7a2 --- /dev/null +++ b/glm/GLM_GTX_quaternion.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_quaternion_api +#define glm_gtx_quaternion_api + +#include "gtx/quaternion.hpp" + +namespace glm +{ + using GLM_GTX_quaternion; +} + +#endif//glm_gtx_quaternion_api diff --git a/glm/GLM_GTX_random.h b/glm/GLM_GTX_random.h new file mode 100644 index 0000000..d95218f --- /dev/null +++ b/glm/GLM_GTX_random.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_random_api +#define glm_gtx_random_api + +#include "gtx/random.hpp" + +namespace glm +{ + using GLM_GTX_random; +} + +#endif//glm_gtx_random_api diff --git a/glm/GLM_GTX_raw_data.h b/glm/GLM_GTX_raw_data.h new file mode 100644 index 0000000..9a5c1e1 --- /dev/null +++ b/glm/GLM_GTX_raw_data.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-11-19 +// Updated : 2008-11-19 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_raw_data_api +#define glm_gtx_raw_data_api + +#include "gtx/raw_data.hpp" + +namespace glm +{ + using GLM_GTX_raw_data; +} + +#endif//glm_gtx_raw_data_api diff --git a/glm/GLM_GTX_reciprocal.h b/glm/GLM_GTX_reciprocal.h new file mode 100644 index 0000000..cc34a59 --- /dev/null +++ b/glm/GLM_GTX_reciprocal.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_reciprocal_api +#define glm_gtx_reciprocal_api + +#include "gtx/reciprocal.hpp" + +namespace glm +{ + using GLM_GTX_reciprocal; +} + +#endif//glm_gtx_reciprocal_api diff --git a/glm/GLM_GTX_rotate_vector.h b/glm/GLM_GTX_rotate_vector.h new file mode 100644 index 0000000..194f1ee --- /dev/null +++ b/glm/GLM_GTX_rotate_vector.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_rotate_vector_api +#define glm_gtx_rotate_vector_api + +#include "gtx/rotate_vector.hpp" + +namespace glm +{ + using GLM_GTX_rotate_vector; +} + +#endif//glm_gtx_rotate_vector_api diff --git a/glm/GLM_GTX_spline.h b/glm/GLM_GTX_spline.h new file mode 100644 index 0000000..164f58b --- /dev/null +++ b/glm/GLM_GTX_spline.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_spline_api +#define glm_gtx_spline_api + +#include "gtx/spline.hpp" + +namespace glm +{ + using GLM_GTX_spline; +} + +#endif//glm_gtx_spline_api diff --git a/glm/GLM_GTX_std_based_type.h b/glm/GLM_GTX_std_based_type.h new file mode 100644 index 0000000..51f3472 --- /dev/null +++ b/glm/GLM_GTX_std_based_type.h @@ -0,0 +1,22 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_std_based_type_api +#define glm_gtx_std_based_type_api + +#include "gtx/std_based_type.hpp" + +namespace glm +{ + using GLM_GTX_std_based_type; +} + +#endif//glm_gtx_std_based_type_api diff --git a/glm/GLM_GTX_string_cast.h b/glm/GLM_GTX_string_cast.h new file mode 100644 index 0000000..5460e17 --- /dev/null +++ b/glm/GLM_GTX_string_cast.h @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_double_float +// - GLM_GTX_half_float +// - GLM_GTX_quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_string_cast_api +#define glm_gtx_string_cast_api + +#include "gtx/string_cast.hpp" + +namespace glm +{ + using GLM_GTX_string_cast; +} + +#endif//glm_gtx_string_cast_api diff --git a/glm/GLM_GTX_transform.h b/glm/GLM_GTX_transform.h new file mode 100644 index 0000000..86ff64e --- /dev/null +++ b/glm/GLM_GTX_transform.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_transform_api +#define glm_gtx_transform_api + +#include "gtx/transform.hpp" + +namespace glm +{ + using GLM_GTX_transform; +} + +#endif//glm_gtx_transform_api diff --git a/glm/GLM_GTX_transform2.h b/glm/GLM_GTX_transform2.h new file mode 100644 index 0000000..e41d769 --- /dev/null +++ b/glm/GLM_GTX_transform2.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_transform2_api +#define glm_gtx_transform2_api + +#include "gtx/transform2.hpp" + +namespace glm +{ + using GLM_GTX_transform2; +} + +#endif//glm_gtx_transform2_api diff --git a/glm/GLM_GTX_unsigned_int.h b/glm/GLM_GTX_unsigned_int.h new file mode 100644 index 0000000..ef15384 --- /dev/null +++ b/glm/GLM_GTX_unsigned_int.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_unsigned_int_api +#define glm_gtx_unsigned_int_api + +#include "gtx/unsigned_int.hpp" + +namespace glm +{ + using GLM_GTX_unsigned_int; +} + +#endif//glm_gtx_unsigned_int_api diff --git a/glm/GLM_GTX_vector_access.h b/glm/GLM_GTX_vector_access.h new file mode 100644 index 0000000..772d817 --- /dev/null +++ b/glm/GLM_GTX_vector_access.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_vector_access_api +#define glm_gtx_vector_access_api + +#include "gtx/vector_access.hpp" + +namespace glm +{ + using GLM_GTX_vector_access; +} + +#endif//glm_gtx_vector_access_api diff --git a/glm/GLM_GTX_vector_angle.h b/glm/GLM_GTX_vector_angle.h new file mode 100644 index 0000000..817b17a --- /dev/null +++ b/glm/GLM_GTX_vector_angle.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_vector_angle_api +#define glm_gtx_vector_angle_api + +#include "gtx/vector_angle.hpp" + +namespace glm +{ + using GLM_GTX_vector_angle; +} + +#endif//glm_gtx_vector_angle_api diff --git a/glm/GLM_GTX_vector_query.h b/glm/GLM_GTX_vector_query.h new file mode 100644 index 0000000..ceec1a2 --- /dev/null +++ b/glm/GLM_GTX_vector_query.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_vector_query_api +#define glm_gtx_vector_query_api + +#include "gtx/vector_query.hpp" + +namespace glm +{ + using GLM_GTX_vector_query; +} + +#endif//glm_gtx_vector_query_api diff --git a/glm/GLM_GTX_verbose_operator.h b/glm/GLM_GTX_verbose_operator.h new file mode 100644 index 0000000..94f2e26 --- /dev/null +++ b/glm/GLM_GTX_verbose_operator.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_verbose_operator_api +#define glm_gtx_verbose_operator_api + +#include "gtx/verbose_operator.hpp" + +namespace glm +{ + using GLM_GTX_verbose_operator; +} + +#endif//glm_gtx_verbose_operator_api diff --git a/glm/GLM_VIRTREV_address.h b/glm/GLM_VIRTREV_address.h new file mode 100644 index 0000000..ee3a3a5 --- /dev/null +++ b/glm/GLM_VIRTREV_address.h @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_virtrev_address_api +#define glm_virtrev_address_api + +#include "virtrev/address.hpp" + +namespace glm +{ + using GLM_VIRTREV_address; +} + +#endif//glm_virtrev_address_api + diff --git a/glm/GLM_VIRTREV_equal_operator.h b/glm/GLM_VIRTREV_equal_operator.h new file mode 100644 index 0000000..d2ad8bf --- /dev/null +++ b/glm/GLM_VIRTREV_equal_operator.h @@ -0,0 +1,16 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_virtrev_equal_operator_api +#define glm_virtrev_equal_operator_api + +#include "virtrev/gl.hpp" + +using namespace glm::virtrev_glmext::equal_operator; + +#endif//glm_virtrev_equal_operator_api diff --git a/glm/GLM_VIRTREV_gl.h b/glm/GLM_VIRTREV_gl.h new file mode 100644 index 0000000..1d0c3d0 --- /dev/null +++ b/glm/GLM_VIRTREV_gl.h @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_virtrev_gl_api +#define glm_virtrev_gl_api + +#include "virtrev/gl.hpp" + +namespace glm +{ + using namespace virtrev_glmext::gl; +} + +#endif//glm_virtrev_gl_api + diff --git a/glm/GLM_VIRTREV_xstream.h b/glm/GLM_VIRTREV_xstream.h new file mode 100644 index 0000000..91e0da0 --- /dev/null +++ b/glm/GLM_VIRTREV_xstream.h @@ -0,0 +1,19 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-22 +// Updated : 2008-10-22 +// Licence : This source is under MIT License +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_virtrev_xstream_api +#define glm_virtrev_xstream_api + +#include "virtrev/xstream.hpp" + +namespace glm +{ + using GLM_VIRTREV_xstream; +} + +#endif//glm_virtrev_xstream_api diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp new file mode 100644 index 0000000..7e6adec --- /dev/null +++ b/glm/core/_detail.hpp @@ -0,0 +1,327 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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 +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_detail +#define glm_core_detail + +#include "../setup.hpp" +#include + +//#define valType typename genType::value_type +//#define valType_cref typename genType::value_type const & +//#define genType_cref typename genType const & + +namespace glm{ +namespace detail{ + + class thalf; + +#if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC)) + typedef signed __int64 sint64; + typedef unsigned __int64 uint64; +#elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC)) + __extension__ typedef signed long long sint64; + __extension__ typedef unsigned long long uint64; +#else//unknown compiler + typedef signed long sint64; + typedef unsigned long uint64; +#endif//GLM_COMPILER + + template + struct If + { + template + static inline T apply(F functor, const T& val) + { + return functor(val); + } + }; + + template<> + struct If + { + template + static inline T apply(F, const T& val) + { + return val; + } + }; + + //template + //struct traits + //{ + // static const bool is_signed = false; + // static const bool is_float = false; + // static const bool is_vector = false; + // static const bool is_matrix = false; + // static const bool is_genType = false; + // static const bool is_genIType = false; + // static const bool is_genUType = false; + //}; + + //template <> + //struct traits + //{ + // static const bool is_float = true; + // static const bool is_genType = true; + //}; + + //template <> + //struct traits + //{ + // static const bool is_float = true; + // static const bool is_genType = true; + //}; + + //template <> + //struct traits + //{ + // static const bool is_float = true; + // static const bool is_genType = true; + //}; + + //template + //struct desc + //{ + // typedef genType type; + // typedef genType * pointer; + // typedef genType const* const_pointer; + // typedef genType const *const const_pointer_const; + // typedef genType *const pointer_const; + // typedef genType & reference; + // typedef genType const& const_reference; + // typedef genType const& param_type; + + // typedef typename genType::value_type value_type; + // typedef typename genType::size_type size_type; + // static const typename size_type value_size; + //}; + + //template + //const typename desc::size_type desc::value_size = genType::value_size(); + + union uif32 + { + uif32() : + i(0) + {} + + uif32(float f) : + f(f) + {} + + uif32(unsigned int i) : + i(i) + {} + + float f; + unsigned int i; + }; + + union uif64 + { + uif64() : + i(0) + {} + + uif64(double f) : + f(f) + {} + + uif64(uint64 i) : + i(i) + {} + + double f; + uint64 i; + }; + + typedef uif32 uif; + + ////////////////// + // int + + template + struct is_int + { + enum is_int_enum + { + YES = 0, + NO = 1 + }; + }; + +#define GLM_DETAIL_IS_INT(T) \ + template <> \ + struct is_int \ + { \ + enum is_int_enum \ + { \ + YES = 1, \ + NO = 0 \ + }; \ + } + + ////////////////// + // uint + + template + struct is_uint + { + enum is_uint_enum + { + YES = 0, + NO = 1 + }; + }; + +#define GLM_DETAIL_IS_UINT(T) \ + template <> \ + struct is_uint \ + { \ + enum is_uint_enum \ + { \ + YES = 1, \ + NO = 0 \ + }; \ + } + + //GLM_DETAIL_IS_UINT(unsigned long long) + + ////////////////// + // float + + template + struct is_float + { + enum is_float_enum + { + YES = 0, + NO = 1 + }; + }; + +#define GLM_DETAIL_IS_FLOAT(T) \ + template <> \ + struct is_float \ + { \ + enum is_float_enum \ + { \ + YES = 1, \ + NO = 0 \ + }; \ + } + + ////////////////// + // bool + + template + struct is_bool + { + enum is_bool_enum + { + YES = 0, + NO = 1 + }; + }; + + template <> + struct is_bool + { + enum is_bool_enum + { + YES = 1, + NO = 0 + }; + }; + + ////////////////// + // vector + + template + struct is_vector + { + enum is_vector_enum + { + YES = 0, + NO = 1 + }; + }; + +#define GLM_DETAIL_IS_VECTOR(T) \ + template <> \ + struct is_vector \ + { \ + enum is_vector_enum \ + { \ + YES = 1, \ + NO = 0 \ + }; \ + } + + ////////////////// + // matrix + + template + struct is_matrix + { + enum is_matrix_enum + { + YES = 0, + NO = 1 + }; + }; + +#define GLM_DETAIL_IS_MATRIX(T) \ + template <> \ + struct is_matrix \ + { \ + enum is_matrix_enum \ + { \ + YES = 1, \ + NO = 0 \ + }; \ + } + + ////////////////// + // type + + template + struct type + { + enum type_enum + { + is_float = is_float::YES, + is_int = is_int::YES, + is_uint = is_uint::YES, + is_bool = is_bool::YES + }; + }; + + ////////////////// + // type + + typedef signed char int8; + typedef signed short int16; + typedef signed int int32; + typedef detail::sint64 int64; + + typedef unsigned char uint8; + typedef unsigned short uint16; + typedef unsigned int uint32; + typedef detail::uint64 uint64; + + typedef detail::thalf float16; + typedef float float32; + typedef double float64; + +}//namespace detail +}//namespace glm + +#endif//glm_core_detail diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp new file mode 100644 index 0000000..1fe9153 --- /dev/null +++ b/glm/core/_swizzle.hpp @@ -0,0 +1,1085 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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 +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_swizzle +#define glm_core_swizzle + +namespace glm +{ + enum comp + { + X = 0, + R = 0, + S = 0, + Y = 1, + G = 1, + T = 1, + Z = 2, + B = 2, + P = 2, + W = 3, + A = 3, + Q = 3 + }; +}//namespace glm + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) + +#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) + +#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) + +#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) + +#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) + +#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) + +#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) + +#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) + +#endif// defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) + +#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) + +#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) + +#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) + +#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) + +#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) + +#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_XYZW) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) + +#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) + +#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_RGBA) + +#if defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) + +#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) + +#endif//defined(GLM_SWIZZLE) && (GLM_SWIZZLE & GLM_SWIZZLE_STPQ) + +#endif//glm_core_swizzle diff --git a/glm/core/_swizzle.inl b/glm/core/_swizzle.inl new file mode 100644 index 0000000..e3202be --- /dev/null +++ b/glm/core/_swizzle.inl @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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/glm/core/func_common.hpp b/glm/core/func_common.hpp new file mode 100644 index 0000000..f1100f7 --- /dev/null +++ b/glm/core/func_common.hpp @@ -0,0 +1,185 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-03-08 +// Updated : 2008-03-08 +// Licence : This source is under MIT License +// File : glm/core/func_common.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_common +#define glm_core_func_common + +namespace glm +{ + namespace test{ + void main_core_func_common(); + }//namespace test + + 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. + //! (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) + 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) + 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) + 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) + 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 + genType ceil(genType const & x); + + //! Return x - floor(x). + //! (From GLSL 1.30.08 specification, section 8.3) + template + genType fract(genType const & x); + + //! Modulus. Returns x - y * floor(x / y) + //! for each component in x using the floating point value y. + //! (From GLSL 1.30.08 specification, section 8.3) + template + genTypeT mod( + genTypeT const & x, + genTypeU 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) + 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) + template + genUIFTypeT min( + genUIFTypeT const & x, + genUIFTypeU const & y); + + //! Returns y if x < y; otherwise, it returns x. + //! (From GLSL 1.30.08 specification, section 8.3) + template + genUIFTypeT max( + genUIFTypeT const & x, + genUIFTypeU 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) + template + genUIFTypeT clamp( + genUIFTypeT const & x, + genUIFTypeU const & minVal, + genUIFTypeU const & maxVal); + + //! \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: + //! 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 + //! component of a that is true, the corresponding + //! component of y is returned. Components of x and y that + //! are not selected are allowed to be invalid floating point + //! values and will have no effect on the results. Thus, this + //! 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. + 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) + template + genTypeU step(genTypeT const & edge, genTypeU 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) + template + genTypeU smoothstep(genTypeT const & edge0, genTypeT const & edge1, genTypeU 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) + 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) + template + typename genType::bool_type isinf(genType const & x); + + }//namespace common + }//namespace function + }//namespace core + + using namespace core::function::common; +}//namespace glm + +#include "func_common.inl" + +#endif//glm_core_func_common diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl new file mode 100644 index 0000000..89a4a0f --- /dev/null +++ b/glm/core/func_common.inl @@ -0,0 +1,1270 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2008-09-04 +// Licence : This source is under MIT License +// File : glm/core/func_common.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace common{ + + // abs + template + inline genFIType abs( + genFIType const & x) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + return x >= genFIType(0) ? x : -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 + + //Try something like based on x >> 31 to get the sign bit + template + inline genFIType sign( + genFIType const & x) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int); + + genFIType result; + if(x > genFIType(0)) + 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)); + } + + template + inline detail::tvec3 sign( + detail::tvec3 const & x) + { + return detail::tvec3( + sign(x.x), + sign(x.y), + sign(x.z)); + } + + 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 genType floor(genType const& x) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::floor(x); + } + + template + inline detail::tvec2 floor(detail::tvec2 const& x) + { + return detail::tvec2( + floor(x.x), + floor(x.y)); + } + + 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) + { + GLM_STATIC_ASSERT(detail::type::is_float); + return floor(abs(x)); + } + + template + inline detail::tvec2 trunc(detail::tvec2 const& x) + { + return detail::tvec2( + trunc(x.x), + trunc(x.y)); + } + + 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) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + 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) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(int(x + genType(int(x) % 2))); + } + + template + inline detail::tvec2 roundEven(detail::tvec2 const& x) + { + return detail::tvec2( + roundEven(x.x), + roundEven(x.y)); + } + + 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) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::ceil(x); + } + + template + inline detail::tvec2 ceil(detail::tvec2 const & x) + { + return detail::tvec2( + ceil(x.x), + ceil(x.y)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return x - ::std::floor(x); + } + + template + inline detail::tvec2 fract + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + fract(x.x), + fract(x.y)); + } + + 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 + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return x - y * floor(x / y); + } + + template + inline detail::tvec2 mod + ( + detail::tvec2 const & x, + valType y + ) + { + return detail::tvec2( + mod(x.x, y), + mod(x.y, y)); + } + + template + inline detail::tvec3 mod + ( + detail::tvec3 const & x, + valType 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, + valType 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 + ( + genType const & x, + genType & i + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + i = glm::floor(x); + + return x - i; + } + + template + inline detail::tvec2 modf + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + return detail::tvec2( + modf(x.x, y.x), + modf(x.y, y.y)); + } + + template + inline detail::tvec3 modf + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + return detail::tvec3( + modf(x.x, y.x), + modf(x.y, y.y), + modf(x.z, y.z)); + } + + template + inline detail::tvec4 modf + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + return detail::tvec4( + modf(x.x, y.x), + modf(x.y, y.y), + modf(x.z, y.z), + modf(x.w, y.w)); + } + + //// Only valid if (INT_MIN <= x-y <= INT_MAX) + //// min(x,y) + //r = y + ((x - y) & ((x - y) >> (sizeof(int) * + //CHAR_BIT – 1))); + //// max(x,y) + //r = x - ((x - y) & ((x - y) >> (sizeof(int) * + //CHAR_BIT - 1))); + + // min + template + inline genType min + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return x < y ? x : y; + } + + template + inline detail::tvec2 min + ( + detail::tvec2 const & x, + valType y + ) + { + return detail::tvec2( + min(x.x, y), + min(x.y, y)); + } + + template + inline detail::tvec3 min + ( + detail::tvec3 const & x, + valType 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, + valType 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 + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return x > y ? x : y; + } + + template + inline detail::tvec2 max + ( + detail::tvec2 const & x, + valType y + ) + { + return detail::tvec2( + max(x.x, y), + max(x.y, y)); + } + + template + inline detail::tvec3 max + ( + detail::tvec3 const & x, + valType 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, + valType 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 + ( + valType const & x, + valType const & minVal, + valType const & maxVal + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + if(x >= maxVal) return maxVal; + if(x <= minVal) return minVal; + return x; + } + + template + inline detail::tvec2 clamp + ( + detail::tvec2 const & x, + valType minVal, + valType maxVal + ) + { + return detail::tvec2( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal)); + } + + template + inline detail::tvec3 clamp + ( + detail::tvec3 const & x, + valType minVal, + valType maxVal + ) + { + return detail::tvec3( + clamp(x.x, minVal, maxVal), + clamp(x.y, minVal, maxVal), + clamp(x.z, minVal, maxVal)); + } + + template + inline detail::tvec4 clamp + ( + detail::tvec4 const & x, + valType minVal, + valType 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 + ( + 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)); + } + + template + inline 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)); + } + + template + inline 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)); + } + + // mix + template + inline genTypeT mix + ( + genTypeT const & x, + genTypeT const & y, + genTypeU const & a + ) + { + // It could be a vector too + //GLM_STATIC_ASSERT( + // detail::type::is_float && + // detail::type::is_float); + + //return x + a * (y - x); + return genTypeU(x) + a * genTypeU(y - x); + } + + template + inline detail::tvec2 mix + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + valTypeB const & a + ) + { + return detail::tvec2( + detail::tvec2(x) + a * detail::tvec2(y - x)); + } + + template + inline detail::tvec3 mix + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + valTypeB const & a + ) + { + return detail::tvec3( + detail::tvec3(x) + a * detail::tvec3(y - x)); + } + + template + inline detail::tvec4 mix + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + valTypeB const & a + ) + { + return detail::tvec4( + detail::tvec4(x) + a * detail::tvec4(y - x)); + } + + template + inline detail::tvec2 mix + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 const & a + ) + { + return detail::tvec2( + detail::tvec2(x) + a * detail::tvec2(y - x)); + } + + template + inline detail::tvec3 mix + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 const & a + ) + { + return detail::tvec3( + detail::tvec3(x) + a * detail::tvec3(y - x)); + } + + template + inline detail::tvec4 mix + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 const & a + ) + { + return detail::tvec4( + detail::tvec4(x) + a * detail::tvec4(y - x)); + } + + //template + //inline genTypeT mix + //( + // genTypeT const & x, + // genTypeT const & y, + // float const & a + //) + //{ + // // It could be a vector too + // //GLM_STATIC_ASSERT( + // // detail::type::is_float && + // // detail::type::is_float); + + // return x + a * (y - x); + //} + + template + inline genType mix + ( + genType const & x, + genType const & y, + bool a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return a ? x : y; + } + + template + inline detail::tvec2 mix + ( + detail::tvec2 const & x, + detail::tvec2 const & y, + typename detail::tvec2::bool_type a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tvec2 result; + for + ( + typename detail::tvec2::size_type i = 0; + i < detail::tvec2::value_size(); + ++i + ) + { + result[i] = a[i] ? x[i] : y[i]; + } + return result; + } + + template + inline detail::tvec3 mix + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + typename detail::tvec3::bool_type a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tvec3 result; + for + ( + typename detail::tvec3::size_type i = 0; + i < detail::tvec3::value_size(); + ++i + ) + { + result[i] = a[i] ? x[i] : y[i]; + } + return result; + } + + template + inline detail::tvec4 mix + ( + detail::tvec4 const & x, + detail::tvec4 const & y, + typename detail::tvec4::bool_type a + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tvec4 result; + for + ( + typename detail::tvec4::size_type i = 0; + i < detail::tvec4::value_size(); + ++i + ) + { + result[i] = a[i] ? x[i] : y[i]; + } + return result; + } + + // step + template + inline genType step + ( + genType const & edge, + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return x <= edge ? genType(0) : genType(1); + } + + template + inline detail::tvec2 step + ( + valType const & edge, + detail::tvec2 const & x + ) + { + return detail::tvec2( + x.x <= edge ? valType(0) : valType(1), + x.y <= edge ? valType(0) : valType(1)); + } + + template + inline detail::tvec3 step + ( + valType const & edge, + detail::tvec3 const & x + ) + { + return detail::tvec3( + x.x <= edge ? valType(0) : valType(1), + x.y <= edge ? valType(0) : valType(1), + x.z <= edge ? valType(0) : valType(1)); + } + + template + inline detail::tvec4 step + ( + valType edge, + detail::tvec4 const & x + ) + { + return detail::tvec4( + x.x <= edge ? valType(0) : valType(1), + x.y <= edge ? valType(0) : valType(1), + x.z <= edge ? valType(0) : valType(1), + x.w <= edge ? valType(0) : valType(1)); + } + + template + inline detail::tvec2 step + ( + detail::tvec2 const & edge, + detail::tvec2 const & x + ) + { + return detail::tvec2( + x.x <= edge.x ? valType(0) : valType(1), + x.y <= edge.y ? valType(0) : valType(1)); + } + + template + inline detail::tvec3 step + ( + detail::tvec3 const & edge, + detail::tvec3 const & x + ) + { + return detail::tvec3( + x.x <= edge.x ? valType(0) : valType(1), + x.y <= edge.y ? valType(0) : valType(1), + x.z <= edge.z ? valType(0) : valType(1)); + } + + template + inline detail::tvec4 step + ( + detail::tvec4 const & edge, + detail::tvec4 const & x + ) + { + return detail::tvec4( + x.x <= edge.x ? valType(0) : valType(1), + x.y <= edge.y ? valType(0) : valType(1), + x.z <= edge.z ? valType(0) : valType(1), + x.w <= edge.w ? valType(0) : valType(1)); + } + + // smoothstep + template + inline genType smoothstep + ( + genType const & edge0, + genType const & edge1, + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + genType tmp = clamp((x - edge0) / (edge1 - edge0), genType(0), genType(1)); + return tmp * tmp * (genType(3) - genType(2) * tmp); + } + + template + inline detail::tvec2 smoothstep + ( + valType const & edge0, + valType const & edge1, + detail::tvec2 const & x + ) + { + return detail::tvec2( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y)); + } + + template + inline detail::tvec3 smoothstep + ( + valType const & edge0, + valType const & edge1, + detail::tvec3 const & x + ) + { + return detail::tvec3( + smoothstep(edge0, edge1, x.x), + smoothstep(edge0, edge1, x.y), + smoothstep(edge0, edge1, x.z)); + } + + template + inline detail::tvec4 smoothstep + ( + valType const & edge0, + valType 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)); + } + + template + inline 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)); + } + + template + inline 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)); + } + + template + inline 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); + +#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 + } + + template + inline typename detail::tvec2::bool_type isnan + ( + detail::tvec2 const & x + ) + { + return typename detail::tvec2::bool_type( + isnan(x.x), + isnan(x.y)); + } + + template + inline 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)); + } + + template + inline typename detail::tvec4::bool_type isnan + ( + const detail::tvec4& x + ) + { + 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_STATIC_ASSERT(detail::type::is_float); + +#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 + } + + template + inline typename detail::tvec2::bool_type isinf + ( + detail::tvec2 const & x + ) + { + return typename detail::tvec2::bool_type( + isnan(x.x), + isnan(x.y)); + } + + template + inline 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)); + } + + template + inline typename detail::tvec4::bool_type isinf + ( + const detail::tvec4& x + ) + { + return typename detail::tvec4::bool_type( + isnan(x.x), + isnan(x.y), + isnan(x.z), + isnan(x.w)); + } + + }//namespace common + }//namespace function + }//namespace core +}//namespace glm diff --git a/glm/core/func_exponential.hpp b/glm/core/func_exponential.hpp new file mode 100644 index 0000000..3f5e3b5 --- /dev/null +++ b/glm/core/func_exponential.hpp @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-08 +// Updated : 2008-09-06 +// Licence : This source is under MIT License +// File : glm/core/func_exponential.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_exponential +#define glm_core_func_exponential + +namespace glm +{ + namespace test{ + void main_core_func_exponential(); + }//namespace test + + namespace core{ + namespace function{ + //! Define all exponential functions from Section 8.2 of GLSL 1.30.8 specification. Included in glm namespace. + namespace exponential{ + + //! Returns x raised to the y power. + //! (From GLSL 1.30.08 specification, section 8.2) + 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) + 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) + template + genType log(genType const & x); + + //! Returns 2 raised to the x power. + //! (From GLSL 1.30.08 specification, section 8.2) + template + genType exp2(genType const & x); + + //! Returns the base 2 log of x, i.e., returns the value y, + //! which satisfies the equation x = 2 ^ y. + //! (From GLSL 1.30.08 specification, section 8.2) + template + genType log2(genType const & x); + + //! Returns the positive square root of x. + //! (From GLSL 1.30.08 specification, section 8.2) + 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) + template + genType inversesqrt(genType const & x); + + }//namespace exponential + }//namespace function + }//namespace core + + using namespace core::function::exponential; +}//namespace glm + +#include "func_exponential.inl" + +#endif//glm_core_func_exponential diff --git a/glm/core/func_exponential.inl b/glm/core/func_exponential.inl new file mode 100644 index 0000000..33e75ff --- /dev/null +++ b/glm/core/func_exponential.inl @@ -0,0 +1,358 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2008-09-06 +// Licence : This source is under MIT License +// File : glm/core/func_exponential.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace exponential{ + + // pow + template + inline genType pow + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::exp(x); + } + + template + inline detail::tvec2 exp + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + exp(x.x), + exp(x.y)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::log(x); + } + + template + inline detail::tvec2 log + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + log(x.x), + log(x.y)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + template + inline detail::tvec3 exp2 + ( + detail::tvec3 const & x + ) + { + return detail::tvec3( + exp2(x.x), + exp2(x.y), + exp2(x.z)); + } + + template + inline detail::tvec4 exp2 + ( + detail::tvec4 const & x + ) + { + return detail::tvec4( + exp2(x.x), + exp2(x.y), + exp2(x.z), + exp2(x.w)); + } + + // log2, ln2 = 0.69314718055994530941723212145818f + template + inline genType log2 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::log(x) / genType(0.69314718055994530941723212145818); + } + + template + inline detail::tvec2 log2 + ( + const detail::tvec2& x + ) + { + return detail::tvec2( + log2(x.x), + log2(x.y)); + } + + template + inline detail::tvec3 log2 + ( + const detail::tvec3& 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(::std::sqrt(double(x))); + } + + template + inline detail::tvec2 sqrt + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + sqrt(x.x), + sqrt(x.y)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(1) / ::std::sqrt(x); + } + + template + inline detail::tvec2 inversesqrt + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + inversesqrt(x.x), + inversesqrt(x.y)); + } + + 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/glm/core/func_geometric.hpp b/glm/core/func_geometric.hpp new file mode 100644 index 0000000..b54c757 --- /dev/null +++ b/glm/core/func_geometric.hpp @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2008-09-08 +// Licence : This source is under MIT License +// File : glm/core/func_geometric.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_geometric +#define glm_core_func_geometric + +namespace glm +{ + namespace test{ + void main_core_func_geometric(); + }//namespace test + + namespace core{ + namespace function{ + //! Define all geometric functions from Section 8.4 of GLSL 1.30.8 specification. Included in glm namespace. + namespace geometric{ + + //! Returns the length of x, i.e., sqrt(x * x). + //! (From GLSL 1.30.08 specification, section 8.4) + template + 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) + 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 + 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 a vector in the same direction as x but with length of 1. + //! (From GLSL 1.30.08 specification, section 8.4) + 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 + 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 + 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 + 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" + +#endif//glm_core_func_geometric diff --git a/glm/core/func_geometric.inl b/glm/core/func_geometric.inl new file mode 100644 index 0000000..32871d6 --- /dev/null +++ b/glm/core/func_geometric.inl @@ -0,0 +1,290 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2008-09-08 +// Licence : This source is under MIT License +// File : glm/core/func_geometric.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace geometric{ + + // length + template + inline genType length + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + genType sqr = x * x; + return sqrt(sqr); + } + + template + inline typename detail::tvec2::value_type length + ( + detail::tvec2 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType sqr = x.x * x.x + x.y * x.y; + return sqrt(sqr); + } + + template + inline typename detail::tvec3::value_type length + ( + detail::tvec3 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; + return sqrt(sqr); + } + + template + inline typename detail::tvec4::value_type length + ( + detail::tvec4 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + return sqrt(sqr); + } + + // distance + template + inline genType distance + ( + genType const & p0, + genType const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return length(p1 - p0); + } + + template + inline typename detail::tvec2::value_type distance + ( + detail::tvec2 const & p0, + detail::tvec2 const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return length(p1 - p0); + } + + template + inline typename detail::tvec3::value_type distance + ( + detail::tvec3 const & p0, + detail::tvec3 const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return length(p1 - p0); + } + + template + inline typename detail::tvec4::value_type distance + ( + detail::tvec4 const & p0, + detail::tvec4 const & p1 + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return length(p1 - p0); + } + + // dot + template + inline genType dot + ( + genType const & x, + genType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return x * y; + } + + template + inline typename detail::tvec2::value_type dot + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return x.x * y.x + x.y * y.y; + } + + template + inline valType dot + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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; + } +*/ + template + inline valType dot + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return x.x * y.x + x.y * y.y + x.z * y.z + x.w * y.w; + } + + // cross + template + inline detail::tvec3 cross + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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 + ( + detail::tvec2 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType sqr = x.x * x.x + x.y * x.y; + return x * inversesqrt(sqr); + } + + template + inline detail::tvec3 normalize + ( + detail::tvec3 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; + return x * inversesqrt(sqr); + } + + template + inline detail::tvec4 normalize + ( + detail::tvec4 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + return x * inversesqrt(sqr); + } + + // faceforward + template + inline genType faceforward + ( + genType const & N, + genType const & I, + genType const & Nref + ) + { + return dot(Nref, I) < 0 ? N : -N; + } + + // reflect + template + genType reflect + ( + genType const & I, + genType const & N + ) + { + return I - N * dot(N, I) * float(2); + } + + // refract + template + inline 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; + } + + }//namespace geometric + }//namespace function + }//namespace core +}//namespace glm diff --git a/glm/core/func_matrix.hpp b/glm/core/func_matrix.hpp new file mode 100644 index 0000000..2c21dd2 --- /dev/null +++ b/glm/core/func_matrix.hpp @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-03 +// Updated : 2008-08-03 +// Licence : This source is under MIT License +// File : glm/core/func_matrix.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_matrix +#define glm_core_func_matrix + +namespace glm +{ + namespace test{ + void main_core_func_matrix(); + }//namespace test + + namespace core{ + namespace function{ + //! Define all matrix functions from Section 8.5 of GLSL 1.30.8 specification. Included in glm namespace. + namespace matrix{ + + //! 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) + 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) + template + matType outerProduct(vecType const & c, vecType const & r); + + //! Returns the transposed matrix of x + //! (From GLSL 1.30.08 specification, section 8.5) + template + typename matType::transpose_type transpose(matType const & x); + + //! Return the determinant of a matrix. + //! (From GLSL 1.50.09 specification, section 8.5). genType: mat2, mat3, mat4. + template + typename genType::value_type determinant( + genType const & m); + + //! Return the inverse of a matrix. + //! (From GLSL 1.40.07 specification, section 8.5). genType: mat2, mat3, mat4. + template + genType inverse( + genType const & m); + + }//namespace matrix + }//namespace function + }//namespace core + + using namespace core::function::matrix; +}//namespace glm + +#include "func_matrix.inl" + +#endif//glm_core_func_matrix diff --git a/glm/core/func_matrix.inl b/glm/core/func_matrix.inl new file mode 100644 index 0000000..2eb1351 --- /dev/null +++ b/glm/core/func_matrix.inl @@ -0,0 +1,760 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-03-08 +// Updated : 2008-03-08 +// Licence : This source is under MIT License +// File : glm/core/func_matrix.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace matrix{ + + // matrixCompMult +/* + template + inline detail::tmat2x2 matrixCompMult + ( + detail::tmat2x2 const & x, + detail::tmat2x2 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x2 result; + for(std::size_t i = 0; i < detail::tmat2x2::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat3x3 matrixCompMult + ( + detail::tmat3x3 const & x, + detail::tmat3x3 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x3 result; + for(std::size_t i = 0; i < detail::tmat3x3::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat4x4 matrixCompMult + ( + detail::tmat4x4 const & x, + detail::tmat4x4 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x4 result; + for(std::size_t i = 0; i < detail::tmat4x4::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat2x3 matrixCompMult + ( + detail::tmat2x3 const & x, + detail::tmat2x3 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x3 result; + for(std::size_t i = 0; i < detail::tmat2x3::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat3x2 matrixCompMult + ( + detail::tmat3x2 const & x, + detail::tmat3x2 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x2 result; + for(std::size_t i = 0; i < detail::tmat3x2::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat2x4 matrixCompMult + ( + detail::tmat2x4 const & x, + detail::tmat2x4 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x4 result; + for(std::size_t i = 0; i < detail::tmat2x4::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat4x2 matrixCompMult + ( + detail::tmat4x2 const & x, + detail::tmat4x2 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x2 result; + for(std::size_t i = 0; i < detail::tmat4x2::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat3x4 matrixCompMult + ( + detail::tmat3x4 const & x, + detail::tmat3x4 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x4 result; + for(std::size_t i = 0; i < detail::tmat3x4::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + template + inline detail::tmat4x3 matrixCompMult + ( + detail::tmat4x3 const & x, + detail::tmat4x3 const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x3 result; + for(std::size_t i = 0; i < detail::tmat4x3::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } +*/ + template + inline matType matrixCompMult + ( + matType const & x, + matType const & y + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + matType result; + for(typename matType::size_type i = 0; i < typename matType::col_size(); ++i) + result[i] = x[i] * y[i]; + return result; + } + + // outerProduct + template + inline detail::tmat2x2 outerProduct + ( + detail::tvec2 const & c, + detail::tvec2 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x2 m; + m[0][0] = c[0] * r[0]; + m[0][1] = c[1] * r[0]; + m[1][0] = c[0] * r[1]; + m[1][1] = c[1] * r[1]; + return m; + } + + template + inline detail::tmat3x3 outerProduct + ( + detail::tvec3 const & c, + detail::tvec3 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x3 m; + for(typename detail::tmat3x3::size_type i = 0; i < detail::tmat3x3::col_size(); ++i) + m[i] = c * r[i]; + return m; + } + + template + inline detail::tmat4x4 outerProduct + ( + detail::tvec4 const & c, + detail::tvec4 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x4 m; + for(typename detail::tmat4x4::size_type i = 0; i < detail::tmat4x4::col_size(); ++i) + m[i] = c * r[i]; + return m; + } + + template + inline detail::tmat2x3 outerProduct + ( + detail::tvec3 const & c, + detail::tvec2 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x3 m; + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + return m; + } + + template + inline detail::tmat3x2 outerProduct + ( + detail::tvec2 const & c, + detail::tvec3 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x2 m; + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + return m; + } + + template + inline detail::tmat2x4 outerProduct + ( + detail::tvec2 const & c, + detail::tvec4 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x4 m; + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[0][3] = c.w * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + m[1][3] = c.w * r.y; + return m; + } + + template + inline detail::tmat4x2 outerProduct + ( + detail::tvec4 const & c, + detail::tvec2 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x2 m; + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + m[3][0] = c.x * r.w; + m[3][1] = c.y * r.w; + return m; + } + + template + inline detail::tmat3x4 outerProduct + ( + detail::tvec4 const & c, + detail::tvec3 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x4 m; + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[0][3] = c.w * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + m[1][3] = c.w * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + m[2][2] = c.z * r.z; + m[2][3] = c.w * r.z; + return m; + } + + template + inline detail::tmat4x3 outerProduct + ( + detail::tvec3 const & c, + detail::tvec4 const & r + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x3 m; + m[0][0] = c.x * r.x; + m[0][1] = c.y * r.x; + m[0][2] = c.z * r.x; + m[1][0] = c.x * r.y; + m[1][1] = c.y * r.y; + m[1][2] = c.z * r.y; + m[2][0] = c.x * r.z; + m[2][1] = c.y * r.z; + m[2][2] = c.z * r.z; + m[3][0] = c.x * r.w; + m[3][1] = c.y * r.w; + m[3][2] = c.z * r.w; + return m; + } + + template + inline detail::tmat2x2 transpose + ( + detail::tmat2x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x2 result; + 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 + ( + detail::tmat3x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x3 result; + 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[2][0] = m[0][2]; + result[2][1] = m[1][2]; + result[2][2] = m[2][2]; + return result; + } + + template + inline detail::tmat4x4 transpose + ( + detail::tmat4x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x4 result; + 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[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; + } + + template + inline detail::tmat2x3 transpose + ( + detail::tmat3x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x3 result; + 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]; + return result; + } + + template + inline detail::tmat3x2 transpose + ( + detail::tmat2x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x2 result; + 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 + ( + detail::tmat4x2 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat2x4 result; + 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]; + return result; + } + + template + inline detail::tmat4x2 transpose + ( + detail::tmat2x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x2 result; + 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 + ( + detail::tmat4x3 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat3x4 result; + 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[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 + ( + detail::tmat3x4 const & m + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + detail::tmat4x3 result; + 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[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][2] = m[2][3]; + return result; + } + + template + inline typename detail::tmat2x2::value_type determinant + ( + detail::tmat2x2 const & m + ) + { + return m[0][0] * m[1][1] - m[1][0] * m[0][1]; + } + + template + inline typename detail::tmat3x3::value_type determinant + ( + detail::tmat3x3 const & m + ) + { + return m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) + - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) + + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); + } + + template + inline typename detail::tmat4x4::value_type determinant + ( + detail::tmat4x4 const & m + ) + { + valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + + detail::tvec4 DetCof( + + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02), + - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04), + + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05), + - (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]; + } + + template + inline detail::tmat2x2 inverse + ( + detail::tmat2x2 const & m + ) + { + //valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1]; + valType Determinant = determinant(m); + + detail::tmat2x2 Inverse( + + m[1][1] / Determinant, + - m[1][0] / Determinant, + - m[0][1] / Determinant, + + m[0][0] / Determinant); + + return Inverse; + } + + template + inline detail::tmat3x3 inverse + ( + detail::tmat3x3 const & m + ) + { + //valType Determinant = m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) + // - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2]) + // + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]); + + valType Determinant = determinant(m); + + detail::tmat3x3 Inverse; + Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]); + Inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]); + Inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]); + Inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]); + Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]); + Inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]); + Inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]); + Inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]); + Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]); + Inverse /= Determinant; + + return Inverse; + } + + template + inline detail::tmat4x4 inverseOgre + ( + detail::tmat4x4 const & m + ) + { + valType m00 = m[0][0], m01 = m[0][1], m02 = m[0][2], m03 = m[0][3]; + valType m10 = m[1][0], m11 = m[1][1], m12 = m[1][2], m13 = m[1][3]; + valType m20 = m[2][0], m21 = m[2][1], m22 = m[2][2], m23 = m[2][3]; + valType m30 = m[3][0], m31 = m[3][1], m32 = m[3][2], m33 = m[3][3]; + + valType v0 = m20 * m31 - m21 * m30; + valType v1 = m20 * m32 - m22 * m30; + valType v2 = m20 * m33 - m23 * m30; + valType v3 = m21 * m32 - m22 * m31; + valType v4 = m21 * m33 - m23 * m31; + valType v5 = m22 * m33 - m23 * m32; + + valType t00 = + (v5 * m11 - v4 * m12 + v3 * m13); + valType t10 = - (v5 * m10 - v2 * m12 + v1 * m13); + valType t20 = + (v4 * m10 - v2 * m11 + v0 * m13); + valType t30 = - (v3 * m10 - v1 * m11 + v0 * m12); + + valType invDet = 1 / (t00 * m00 + t10 * m01 + t20 * m02 + t30 * m03); + + valType d00 = t00 * invDet; + valType d10 = t10 * invDet; + valType d20 = t20 * invDet; + valType d30 = t30 * invDet; + + valType d01 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet; + valType d11 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet; + valType d21 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet; + valType d31 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet; + + v0 = m10 * m31 - m11 * m30; + v1 = m10 * m32 - m12 * m30; + v2 = m10 * m33 - m13 * m30; + v3 = m11 * m32 - m12 * m31; + v4 = m11 * m33 - m13 * m31; + v5 = m12 * m33 - m13 * m32; + + valType d02 = + (v5 * m01 - v4 * m02 + v3 * m03) * invDet; + valType d12 = - (v5 * m00 - v2 * m02 + v1 * m03) * invDet; + valType d22 = + (v4 * m00 - v2 * m01 + v0 * m03) * invDet; + valType d32 = - (v3 * m00 - v1 * m01 + v0 * m02) * invDet; + + v0 = m21 * m10 - m20 * m11; + v1 = m22 * m10 - m20 * m12; + v2 = m23 * m10 - m20 * m13; + v3 = m22 * m11 - m21 * m12; + v4 = m23 * m11 - m21 * m13; + v5 = m23 * m12 - m22 * m13; + + valType d03 = - (v5 * m01 - v4 * m02 + v3 * m03) * invDet; + valType d13 = + (v5 * m00 - v2 * m02 + v1 * m03) * invDet; + valType d23 = - (v4 * m00 - v2 * m01 + v0 * m03) * invDet; + valType d33 = + (v3 * m00 - v1 * m01 + v0 * m02) * invDet; + + return detail::tmat4x4( + d00, d01, d02, d03, + d10, d11, d12, d13, + d20, d21, d22, d23, + d30, d31, d32, d33); + } + + template + inline detail::tmat4x4 inverse + ( + detail::tmat4x4 const & m + ) + { + valType Coef00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + valType Coef02 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; + valType Coef03 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; + + valType Coef04 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + valType Coef06 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; + valType Coef07 = m[1][1] * m[2][3] - m[2][1] * m[1][3]; + + valType Coef08 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + valType Coef10 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; + valType Coef11 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; + + valType Coef12 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + valType Coef14 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; + valType Coef15 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; + + valType Coef16 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + valType Coef18 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; + valType Coef19 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; + + valType Coef20 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + valType Coef22 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; + valType Coef23 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; + + detail::tvec4 const SignA(+1, -1, +1, -1); + detail::tvec4 const SignB(-1, +1, -1, +1); + + detail::tvec4 Fac0(Coef00, Coef00, Coef02, Coef03); + detail::tvec4 Fac1(Coef04, Coef04, Coef06, Coef07); + detail::tvec4 Fac2(Coef08, Coef08, Coef10, Coef11); + detail::tvec4 Fac3(Coef12, Coef12, Coef14, Coef15); + detail::tvec4 Fac4(Coef16, Coef16, Coef18, Coef19); + detail::tvec4 Fac5(Coef20, Coef20, Coef22, Coef23); + + detail::tvec4 Vec0(m[1][0], m[0][0], m[0][0], m[0][0]); + detail::tvec4 Vec1(m[1][1], m[0][1], m[0][1], m[0][1]); + detail::tvec4 Vec2(m[1][2], m[0][2], m[0][2], m[0][2]); + detail::tvec4 Vec3(m[1][3], m[0][3], m[0][3], m[0][3]); + + detail::tvec4 Inv0 = SignA * (Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2); + detail::tvec4 Inv1 = SignB * (Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4); + detail::tvec4 Inv2 = SignA * (Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5); + detail::tvec4 Inv3 = SignB * (Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5); + + detail::tmat4x4 Inverse(Inv0, Inv1, Inv2, Inv3); + + detail::tvec4 Row0(Inverse[0][0], Inverse[1][0], Inverse[2][0], Inverse[3][0]); + + valType Determinant = glm::dot(m[0], Row0); + + Inverse /= Determinant; + + return Inverse; + } + + }//namespace matrix + }//namespace function + }//namespace core +}//namespace glm diff --git a/glm/core/func_noise.hpp b/glm/core/func_noise.hpp new file mode 100644 index 0000000..9aa7a72 --- /dev/null +++ b/glm/core/func_noise.hpp @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#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{ + + // 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/glm/core/func_noise.inl b/glm/core/func_noise.inl new file mode 100644 index 0000000..51995d2 --- /dev/null +++ b/glm/core/func_noise.inl @@ -0,0 +1,305 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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); + + 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 + ) + { + valType 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 + ) + { + valType 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 + ) + { + valType 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); + + 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); + + valType f0(0); + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + f0 += x[i]; + + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + return detail::tvec2( + noise1(f1), + noise1(f2)); + } + + template + inline detail::tvec2 noise2 + ( + detail::tvec3 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType f0(0); + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + f0 += x[i]; + + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + return detail::tvec2( + noise1(f1), + noise1(f2)); + } + + template + inline detail::tvec2 noise2 + ( + detail::tvec4 const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + valType f0(0); + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + f0 += x[i]; + + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + return detail::tvec2( + noise1(f1), + noise1(f2)); + } + + // noise3 + template + inline detail::tvec3 noise3 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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); + + valType f0(0); + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + f0 += x[i]; + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + valType f3 = f2 * valType(1103515245) + valType(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); + + valType f0(0); + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + f0 += x[i]; + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + valType f3 = f2 * valType(1103515245) + valType(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); + + valType f0(0); + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + f0 += x[i]; + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + valType f3 = f2 * valType(1103515245) + valType(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); + + 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); + + valType f0(0); + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + f0 += x[i]; + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + valType f3 = f2 * valType(1103515245) + valType(12345); + valType f4 = f3 * valType(1103515245) + valType(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); + + valType f0(0); + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + f0 += x[i]; + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + valType f3 = f2 * valType(1103515245) + valType(12345); + valType f4 = f3 * valType(1103515245) + valType(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); + + valType f0(0); + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + f0 += x[i]; + valType f1 = f0 * valType(1103515245) + valType(12345); + valType f2 = f1 * valType(1103515245) + valType(12345); + valType f3 = f2 * valType(1103515245) + valType(12345); + valType f4 = f3 * valType(1103515245) + valType(12345); + return detail::tvec4( + noise1(f1), + noise1(f2), + noise1(f3), + noise1(f4)); + } + + }//namespace noise + }//namespace function + }//namespace core +}//namespace glm diff --git a/glm/core/func_trigonometric.hpp b/glm/core/func_trigonometric.hpp new file mode 100644 index 0000000..9ef0d94 --- /dev/null +++ b/glm/core/func_trigonometric.hpp @@ -0,0 +1,125 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_trigonometric +#define glm_core_func_trigonometric + +namespace glm +{ + namespace test{ + void main_core_func_trigonometric(); + }//namespace test + + 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{ + + //! Converts degrees to radians and returns the result. + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType radians(genType const & degrees); + + //! Converts radians to degrees and returns the result. + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType degrees(genType const & radians); + + //! The standard trigonometric sine function. + //! The values returned by this function will range from [-1, 1]. + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType sin(genType const & angle); + + //! The standard trigonometric cosine function. + //! The values returned by this function will range from [-1, 1]. + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType cos(genType const & angle); + + //! The standard trigonometric tangent function. + //! (From GLSL 1.30.08 specification, section 8.1) + 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) + 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) + 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) + 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) + 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) + 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) + template + genType cosh(genType const & angle); + + //! Returns the hyperbolic tangent function, sinh(angle) / cosh(angle) + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType tanh(genType const & angle); + + //! Arc hyperbolic sine; returns the inverse of sinh. + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType asinh(genType const & x); + + //! Arc hyperbolic cosine; returns the non-negative inverse + //! of cosh. Results are undefined if x < 1. + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType acosh(genType const & x); + + //! Arc hyperbolic tangent; returns the inverse of tanh. + //! Results are undefined if abs(x) >= 1. + //! (From GLSL 1.30.08 specification, section 8.1) + template + genType atanh(genType const & x); + + }//namespace trigonometric + }//namespace function + }//namespace core + + using namespace core::function::trigonometric; +}//namespace glm + +#include "func_trigonometric.inl" + +#endif//glm_core_func_trigonometric + + diff --git a/glm/core/func_trigonometric.inl b/glm/core/func_trigonometric.inl new file mode 100644 index 0000000..438e217 --- /dev/null +++ b/glm/core/func_trigonometric.inl @@ -0,0 +1,745 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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 +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace trigonometric{ + + // radians + template + inline genType radians + ( + genType const & degrees + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + const genType 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 + ( + genType const & radians + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + 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 + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::sin(angle); + } + + template + inline detail::tvec2 sin + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + sin(angle.x), + sin(angle.y)); + } + + 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) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::cos(angle); + } + + template + inline detail::tvec2 cos + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + cos(angle.x), + cos(angle.y)); + } + + 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 + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::tan(angle); + } + + template + inline detail::tvec2 tan + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + tan(angle.x), + tan(angle.y)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::asin(x); + } + + template + inline detail::tvec2 asin + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + asin(x.x), + asin(x.y)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::acos(x); + } + + template + inline detail::tvec2 acos + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + acos(x.x), + acos(x.y)); + } + + 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 + ( + genType const & y, + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return ::std::atan(x); + } + + template + inline detail::tvec2 atan + ( + detail::tvec2 const & x + ) + { + return detail::tvec2( + atan(x.x), + atan(x.y)); + } + + 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 + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return std::sinh(angle); + } + + template + inline detail::tvec2 sinh + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + sinh(angle.x), + sinh(angle.y)); + } + + 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 + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return std::cosh(angle); + } + + template + inline detail::tvec2 cosh + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + cosh(angle.x), + cosh(angle.y)); + } + + 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 + ( + genType const & angle + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + return std::tanh(angle); + } + + template + inline detail::tvec2 tanh + ( + detail::tvec2 const & angle + ) + { + return detail::tvec2( + tanh(angle.x), + tanh(angle.y)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + 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 + ( + genType const & x + ) + { + GLM_STATIC_ASSERT(detail::type::is_float); + + 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)); + } + + 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/glm/core/func_vector_relational.hpp b/glm/core/func_vector_relational.hpp new file mode 100644 index 0000000..2985684 --- /dev/null +++ b/glm/core/func_vector_relational.hpp @@ -0,0 +1,78 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_func_vector_relational +#define glm_core_func_vector_relational + +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{ + + //! Returns the component-wise compare of x < y. + //! (From GLSL 1.30.08 specification, section 8.6) + template + typename vecType::bool_type lessThan(vecType const & x, vecType const & y); + + //! Returns the component-wise compare of x <= y. + //! (From GLSL 1.30.08 specification, section 8.6) + template + typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y); + + //! Returns the component-wise compare of x > y. + //! (From GLSL 1.30.08 specification, section 8.6) + template + typename vecType::bool_type greaterThan(vecType const & x, vecType const & y); + + //! Returns the component-wise compare of x >= y. + //! (From GLSL 1.30.08 specification, section 8.6) + template + typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y); + + //! Returns the component-wise compare of x == y. + //! (From GLSL 1.30.08 specification, section 8.6) + template + typename vecType::bool_type equal(vecType const & x, vecType const & y); + + //! Returns the component-wise compare of x != y. + //! (From GLSL 1.30.08 specification, section 8.6) + template + typename vecType::bool_type notEqual(vecType const & x, vecType const & y); + + //! Returns true if any component of x is true. + //! (From GLSL 1.30.08 specification, section 8.6) + template + bool any(vecType const & x); + + //! Returns true if all components of x are true. + //! (From GLSL 1.30.08 specification, section 8.6) + template + bool all(vecType const & x); + + //! Returns the component-wise logical complement of x. + //! (From GLSL 1.30.08 specification, section 8.6) + template + typename vecType::bool_type not_(vecType const & x); + + }//namespace vector_relational + }//namespace function + }//namespace core + + using namespace core::function::vector_relational; +}//namespace glm + +#include "func_vector_relational.inl" + +#endif//glm_core_func_vector_relational diff --git a/glm/core/func_vector_relational.inl b/glm/core/func_vector_relational.inl new file mode 100644 index 0000000..b5d4893 --- /dev/null +++ b/glm/core/func_vector_relational.inl @@ -0,0 +1,359 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 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_vector_relational.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace core{ + namespace function{ + namespace vector_relational{ + + // lessThan + template + inline typename detail::tvec2::bool_type lessThan + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec2::bool_type(x.x < y.x, x.y < y.y); + } + + template + inline typename detail::tvec3::bool_type lessThan + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec3::bool_type(x.x < y.x, x.y < y.y, x.z < y.z); + } + + template + inline typename detail::tvec4::bool_type lessThan + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec4::bool_type(x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w); + } + + // lessThanEqual + template + inline typename detail::tvec2::bool_type lessThanEqual + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec2::bool_type(x.x <= y.x, x.y <= y.y); + } + + template + inline typename detail::tvec3::bool_type lessThanEqual + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec3::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z); + } + + template + inline typename detail::tvec4::bool_type lessThanEqual + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec4::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w); + } + + // greaterThan + template + inline typename detail::tvec2::bool_type greaterThan + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec2::bool_type(x.x > y.x, x.y > y.y); + } + + template + inline typename detail::tvec3::bool_type greaterThan + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec3::bool_type(x.x > y.x, x.y > y.y, x.z > y.z); + } + + template + inline typename detail::tvec4::bool_type greaterThan + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec4::bool_type(x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w); + } + + // greaterThanEqual + template + inline typename detail::tvec2::bool_type greaterThanEqual + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec2::bool_type(x.x >= y.x, x.y >= y.y); + } + + template + inline typename detail::tvec3::bool_type greaterThanEqual + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec3::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z); + } + + template + inline typename detail::tvec4::bool_type greaterThanEqual + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint); + + return typename detail::tvec4::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w); + } + + // equal + template + inline typename detail::tvec2::bool_type equal + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); + + return typename detail::tvec2::bool_type(x.x == y.x, x.y == y.y); + } + + template + inline typename detail::tvec3::bool_type equal + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); + + return typename detail::tvec3::bool_type(x.x == y.x, x.y == y.y, x.z == y.z); + } + + template + inline typename detail::tvec4::bool_type equal + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); + + return typename detail::tvec4::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w); + } + + // notEqual + template + inline typename detail::tvec2::bool_type notEqual + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); + + return typename detail::tvec2::bool_type(x.x != y.x, x.y != y.y); + } + + template + inline typename detail::tvec3::bool_type notEqual + ( + detail::tvec3 const & x, + detail::tvec3 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); + + return typename detail::tvec3::bool_type(x.x != y.x, x.y != y.y, x.z != y.z); + } + + template + inline typename detail::tvec4::bool_type notEqual + ( + detail::tvec4 const & x, + detail::tvec4 const & y + ) + { + GLM_STATIC_ASSERT( + detail::type::is_float || + detail::type::is_int || + detail::type::is_uint || + detail::type::is_bool); + + return typename detail::tvec4::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w); + } + + // any + inline bool any(detail::tvec2 const & x) + { + return x.x || x.y; + } + + inline bool any(detail::tvec3 const & x) + { + return x.x || x.y || x.z; + } + + inline bool any(detail::tvec4 const & x) + { + return x.x || x.y || x.z || x.w; + } + + // all + inline bool all(const detail::tvec2& x) + { + return x.x && x.y; + } + + inline bool all(const detail::tvec3& x) + { + return x.x && x.y && x.z; + } + + inline bool all(const detail::tvec4& x) + { + return x.x && x.y && x.z && x.w; + } + + // not + inline detail::tvec2::bool_type not_ + ( + detail::tvec2 const & v + ) + { + return detail::tvec2::bool_type(!v.x, !v.y); + } + + inline detail::tvec3::bool_type not_ + ( + detail::tvec3 const & v + ) + { + return detail::tvec3::bool_type(!v.x, !v.y, !v.z); + } + + inline detail::tvec4::bool_type not_ + ( + detail::tvec4 const & v + ) + { + return detail::tvec4::bool_type(!v.x, !v.y, !v.z, !v.w); + } + + }//namespace vector_relational + }//namespace function + }//namespace core +}//namespace glm + diff --git a/glm/core/hint.hpp b/glm/core/hint.hpp new file mode 100644 index 0000000..c8ffc72 --- /dev/null +++ b/glm/core/hint.hpp @@ -0,0 +1,21 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-14 +// Updated : 2008-08-14 +// Licence : This source is under MIT License +// File : glm/core/hint.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type +#define glm_core_type + +namespace glm +{ + // Use dont_care, nicest and fastest to optimize implementations. + class dont_care {}; + class nicest {}; + class fastest {}; +}; + +#endif//glm_core_type diff --git a/glm/core/intrinsic_common.hpp b/glm/core/intrinsic_common.hpp new file mode 100644 index 0000000..3dc224d --- /dev/null +++ b/glm/core/intrinsic_common.hpp @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-11 +// Updated : 2009-05-11 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_common.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_DETAIL_INTRINSIC_COMMON_INCLUDED +#define GLM_DETAIL_INTRINSIC_COMMON_INCLUDED + +//#include +//#include +#include +#include + +__m128 _mm_abs_ps(__m128 x); + +__m128 _mm_sgn_ps(__m128 x); + +//floor +__m128 _mm_flr_ps(__m128 v); + +//trunc +__m128 _mm_trc_ps(__m128 v); + +//round +__m128 _mm_rnd_ps(__m128 v); + +//roundEven +__m128 _mm_rde_ps(__m128 v); + +__m128 _mm_ceil_ps(__m128 v); + +__m128 _mm_frc_ps(__m128 x); + +__m128 _mm_mod_ps(__m128 x, __m128 y); + +__m128 _mm_modf_ps(__m128 x, __m128i & i); + +//inline __m128 _mm_min_ps(__m128 x, __m128 y) + +//inline __m128 _mm_max_ps(__m128 x, __m128 y) + +__m128 _mm_clp_ps(__m128 v, __m128 minVal, __m128 maxVal); + +__m128 _mm_mix_ps(__m128 v1, __m128 v2, __m128 a); + +__m128 _mm_stp_ps(__m128 edge, __m128 x); + +__m128 _mm_ssp_ps(__m128 edge0, __m128 edge1, __m128 x); + +__m128 _mm_nan_ps(__m128 x); + +__m128 _mm_inf_ps(__m128 x); + +#include "intrinsic_common.inl" + +#endif//GLM_DETAIL_INTRINSIC_COMMON_INCLUDED diff --git a/glm/core/intrinsic_common.inl b/glm/core/intrinsic_common.inl new file mode 100644 index 0000000..f96e217 --- /dev/null +++ b/glm/core/intrinsic_common.inl @@ -0,0 +1,268 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-08 +// Updated : 2009-05-08 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_common.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + union ieee754_QNAN + { + const float f; + struct + { + const unsigned int mantissa:23, exp:8, sign:1; + }; + + ieee754_QNAN() : f(0.0), mantissa(0x7FFFFF), exp(0xFF), sign(0x0) {} + }; + + static const __m128 zero = _mm_setzero_ps(); + static const __m128 one = _mm_set_ps1(1.0f); + static const __m128 minus_one = _mm_set_ps1(-1.0f); + static const __m128 two = _mm_set_ps1(2.0f); + static const __m128 three = _mm_set_ps1(3.0f); + static const __m128 pi = _mm_set_ps1(3.1415926535897932384626433832795f); + static const __m128 hundred_eighty = _mm_set_ps1(180.f); + static const __m128 pi_over_hundred_eighty = _mm_set_ps1(0.017453292519943295769236907684886f); + static const __m128 hundred_eighty_over_pi = _mm_set_ps1(57.295779513082320876798154814105f); + + static const ieee754_QNAN absMask; + static const __m128 abs4Mask = _mm_set_ps1(absMask.f); + + static const __m128 _epi32_sign_mask;// = _mm_castsi128_ps(_mm_set1_epi32(0x80000000)); + static const __m128 _epi32_inv_sign_mask;// = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF)); + static const __m128 _epi32_mant_mask;// = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000)); + static const __m128 _epi32_inv_mant_mask;// = _mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)); + static const __m128 _epi32_min_norm_pos;// = _mm_castsi128_ps(_mm_set1_epi32(0x00800000)); + static const __m128 _epi32_0 = _mm_set_ps1(0); + static const __m128 _epi32_1 = _mm_set_ps1(1); + static const __m128 _epi32_2 = _mm_set_ps1(2); + static const __m128 _epi32_3 = _mm_set_ps1(3); + static const __m128 _epi32_4 = _mm_set_ps1(4); + static const __m128 _epi32_5 = _mm_set_ps1(5); + static const __m128 _epi32_6 = _mm_set_ps1(6); + static const __m128 _epi32_7 = _mm_set_ps1(7); + static const __m128 _epi32_8 = _mm_set_ps1(8); + static const __m128 _epi32_9 = _mm_set_ps1(9); + static const __m128 _epi32_127 = _mm_set_ps1(127); + static const __m128 _epi32_ninf;// = _mm_castsi128_ps(_mm_set1_epi32(0xFF800000)); + static const __m128 _epi32_pinf;// = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000)); + + static const __m128 _ps_1_3 = _mm_set_ps1(0.33333333333333333333333333333333f); + static const __m128 _ps_0p5 = _mm_set_ps1(0.5f); + static const __m128 _ps_1 = _mm_set_ps1(1.0f); + static const __m128 _ps_m1 = _mm_set_ps1(-1.0f); + static const __m128 _ps_2 = _mm_set_ps1(2.0f); + static const __m128 _ps_3 = _mm_set_ps1(3.0f); + static const __m128 _ps_127 = _mm_set_ps1(127.0f); + static const __m128 _ps_255 = _mm_set_ps1(255.0f); + static const __m128 _ps_2pow23 = _mm_set_ps1(8388608.0f); + + static const __m128 _ps_1_0_0_0 = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f); + static const __m128 _ps_0_1_0_0 = _mm_set_ps(0.0f, 1.0f, 0.0f, 0.0f); + static const __m128 _ps_0_0_1_0 = _mm_set_ps(0.0f, 0.0f, 1.0f, 0.0f); + static const __m128 _ps_0_0_0_1 = _mm_set_ps(0.0f, 0.0f, 0.0f, 1.0f); + + static const __m128 _ps_pi = _mm_set_ps1(3.1415926535897932384626433832795f); + static const __m128 _ps_pi2 = _mm_set_ps1(6.283185307179586476925286766560f); + static const __m128 _ps_2_pi = _mm_set_ps1(0.63661977236758134307553505349006f); + static const __m128 _ps_pi_2 = _mm_set_ps1(1.5707963267948966192313216916398f); + static const __m128 _ps_4_pi = _mm_set_ps1(1.2732395447351626861510701069801f); + static const __m128 _ps_pi_4 = _mm_set_ps1(0.78539816339744830961566084581988f); + + static const __m128 _ps_sincos_p0 = _mm_set_ps1(0.15707963267948963959e1f); + static const __m128 _ps_sincos_p1 = _mm_set_ps1(-0.64596409750621907082e0f); + static const __m128 _ps_sincos_p2 = _mm_set_ps1(0.7969262624561800806e-1f); + static const __m128 _ps_sincos_p3 = _mm_set_ps1(-0.468175413106023168e-2f); + static const __m128 _ps_tan_p0 = _mm_set_ps1(-1.79565251976484877988e7f); + static const __m128 _ps_tan_p1 = _mm_set_ps1(1.15351664838587416140e6f); + static const __m128 _ps_tan_p2 = _mm_set_ps1(-1.30936939181383777646e4f); + static const __m128 _ps_tan_q0 = _mm_set_ps1(-5.38695755929454629881e7f); + static const __m128 _ps_tan_q1 = _mm_set_ps1(2.50083801823357915839e7f); + static const __m128 _ps_tan_q2 = _mm_set_ps1(-1.32089234440210967447e6f); + static const __m128 _ps_tan_q3 = _mm_set_ps1(1.36812963470692954678e4f); + static const __m128 _ps_tan_poleval = _mm_set_ps1(3.68935e19f); + static const __m128 _ps_atan_t0 = _mm_set_ps1(-0.91646118527267623468e-1f); + static const __m128 _ps_atan_t1 = _mm_set_ps1(-0.13956945682312098640e1f); + static const __m128 _ps_atan_t2 = _mm_set_ps1(-0.94393926122725531747e2f); + static const __m128 _ps_atan_t3 = _mm_set_ps1(0.12888383034157279340e2f); + static const __m128 _ps_atan_s0 = _mm_set_ps1(0.12797564625607904396e1f); + static const __m128 _ps_atan_s1 = _mm_set_ps1(0.21972168858277355914e1f); + static const __m128 _ps_atan_s2 = _mm_set_ps1(0.68193064729268275701e1f); + static const __m128 _ps_atan_s3 = _mm_set_ps1(0.28205206687035841409e2f); + + static const __m128 _ps_exp_hi = _mm_set_ps1(88.3762626647949f); + static const __m128 _ps_exp_lo = _mm_set_ps1(-88.3762626647949f); + static const __m128 _ps_exp_rln2 = _mm_set_ps1(1.4426950408889634073599f); + static const __m128 _ps_exp_p0 = _mm_set_ps1(1.26177193074810590878e-4f); + static const __m128 _ps_exp_p1 = _mm_set_ps1(3.02994407707441961300e-2f); + static const __m128 _ps_exp_q0 = _mm_set_ps1(3.00198505138664455042e-6f); + static const __m128 _ps_exp_q1 = _mm_set_ps1(2.52448340349684104192e-3f); + static const __m128 _ps_exp_q2 = _mm_set_ps1(2.27265548208155028766e-1f); + static const __m128 _ps_exp_q3 = _mm_set_ps1(2.00000000000000000009e0f); + static const __m128 _ps_exp_c1 = _mm_set_ps1(6.93145751953125e-1f); + static const __m128 _ps_exp_c2 = _mm_set_ps1(1.42860682030941723212e-6f); + static const __m128 _ps_exp2_hi = _mm_set_ps1(127.4999961853f); + static const __m128 _ps_exp2_lo = _mm_set_ps1(-127.4999961853f); + static const __m128 _ps_exp2_p0 = _mm_set_ps1(2.30933477057345225087e-2f); + static const __m128 _ps_exp2_p1 = _mm_set_ps1(2.02020656693165307700e1f); + static const __m128 _ps_exp2_p2 = _mm_set_ps1(1.51390680115615096133e3f); + static const __m128 _ps_exp2_q0 = _mm_set_ps1(2.33184211722314911771e2f); + static const __m128 _ps_exp2_q1 = _mm_set_ps1(4.36821166879210612817e3f); + static const __m128 _ps_log_p0 = _mm_set_ps1(-7.89580278884799154124e-1f); + static const __m128 _ps_log_p1 = _mm_set_ps1(1.63866645699558079767e1f); + static const __m128 _ps_log_p2 = _mm_set_ps1(-6.41409952958715622951e1f); + static const __m128 _ps_log_q0 = _mm_set_ps1(-3.56722798256324312549e1f); + static const __m128 _ps_log_q1 = _mm_set_ps1(3.12093766372244180303e2f); + static const __m128 _ps_log_q2 = _mm_set_ps1(-7.69691943550460008604e2f); + static const __m128 _ps_log_c0 = _mm_set_ps1(0.693147180559945f); + static const __m128 _ps_log2_c0 = _mm_set_ps1(1.44269504088896340735992f); + +}//namespace detail +}//namespace glm + +inline __m128 _mm_abs_ps(__m128 x) +{ + return _mm_and_ps(glm::detail::abs4Mask, x); +} + +inline __m128 _mm_sgn_ps(__m128 x) +{ + //__m128 cmp0 = _mm_cmpeq_ps(x, zero); + //__m128 cmp1 = _mm_cmple_ps(x, zero); + //__m128 cmp2 = _mm_cmpge_ps(x, zero); + + __m128 result; + __m128 cmp0 = _mm_cmpeq_ps(x, glm::detail::zero); + if(_mm_movemask_ps(cmp0) == 0) + result = glm::detail::zero; + else + { + __m128 cmp1 = _mm_cmpge_ps(x, glm::detail::zero); + //__m128 cmp2 = _mm_cmple_ps(x, glm::detail::zero); + if(_mm_movemask_ps(cmp1) > 0) + result = glm::detail::one; + else //if(_mm_movemask_ps(cmp2) > 0) + result = glm::detail::minus_one; + } + return result; +} + +//floor +inline __m128 _mm_flr_ps(__m128 x) +{ + __m128 rnd0 = _mm_rnd_ps(x); + __m128 cmp0 = _mm_cmplt_ps(x, rnd0); + __m128 and0 = _mm_and_ps(cmp0, glm::detail::_ps_1); + __m128 sub0 = _mm_sub_ps(rnd0, and0); + return sub0; +} + +//trunc +inline __m128 _mm_trc_ps(__m128 v) +{ + +} + +//round +inline __m128 _mm_rnd_ps(__m128 x) +{ + __m128 and0 = _mm_and_ps(glm::detail::_epi32_sign_mask, x); + __m128 or0 = _mm_or_ps(and0, glm::detail::_ps_2pow23); + __m128 add0 = _mm_add_ps(x, or0); + __m128 sub0 = _mm_sub_ps(add0, or0); + return sub0; +} + +//roundEven +inline __m128 _mm_rde_ps(__m128 v) +{ + +} + +inline __m128 _mm_ceil_ps(__m128 x) +{ + __m128 rnd0 = _mm_rnd_ps(x); + __m128 cmp0 = _mm_cmpgt_ps(x, rnd0); + __m128 and0 = _mm_and_ps(cmp0, glm::detail::_ps_1); + __m128 add0 = _mm_add_ps(rnd0, and0); + return add0; +} + +inline __m128 _mm_frc_ps(__m128 x) +{ + __m128 flr0 = _mm_flr_ps(x); + __m128 sub0 = _mm_sub_ps(x, flr0); + return sub0; +} + +inline __m128 _mm_mod_ps(__m128 x, __m128 y) +{ + __m128 div0 = _mm_div_ps(x, y); + __m128 flr0 = _mm_flr_ps(div0); + __m128 mul0 = _mm_mul_ps(y, flr0); + __m128 sub0 = _mm_sub_ps(x, mul0); + return sub0; +} + +inline __m128 _mm_modf_ps(__m128 x, __m128i & i) +{ + +} + +//inline __m128 _mm_min_ps(__m128 x, __m128 y) + +//inline __m128 _mm_max_ps(__m128 x, __m128 y) + +inline __m128 _mm_clp_ps(__m128 v, __m128 minVal, __m128 maxVal) +{ + __m128 min0 = _mm_min_ps(v, maxVal); + __m128 max0 = _mm_max_ps(min0, minVal); + return max0; +} + +inline __m128 _mm_mix_ps(__m128 v1, __m128 v2, __m128 a) +{ + __m128 sub0 = _mm_sub_ps(glm::detail::one, a); + __m128 mul0 = _mm_mul_ps(v1, sub0); + __m128 mul1 = _mm_mul_ps(v2, a); + __m128 add0 = _mm_add_ps(mul0, mul1); + return add0; +} + +inline __m128 _mm_stp_ps(__m128 edge, __m128 x) +{ + __m128 cmp = _mm_cmple_ps(x, edge); + if(_mm_movemask_ps(cmp) == 0) + return glm::detail::one; + else + return glm::detail::zero; +} + +inline __m128 _mm_ssp_ps(__m128 edge0, __m128 edge1, __m128 x) +{ + __m128 sub0 = _mm_sub_ps(x, edge0); + __m128 sub1 = _mm_sub_ps(edge1, edge0); + __m128 div0 = _mm_sub_ps(sub0, sub1); + __m128 clp0 = _mm_clp_ps(div0, glm::detail::zero, glm::detail::one); + __m128 mul0 = _mm_mul_ps(glm::detail::two, clp0); + __m128 sub2 = _mm_sub_ps(glm::detail::three, mul0); + __m128 mul1 = _mm_mul_ps(clp0, clp0); + __m128 mul2 = _mm_mul_ps(mul1, sub2); + return mul2; +} + +inline __m128 _mm_nan_ps(__m128 x) +{ + +} + +inline __m128 _mm_inf_ps(__m128 x) +{ + +} diff --git a/glm/core/intrinsic_exponential.hpp b/glm/core/intrinsic_exponential.hpp new file mode 100644 index 0000000..e69de29 diff --git a/glm/core/intrinsic_exponential.inl b/glm/core/intrinsic_exponential.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/core/intrinsic_geometric.hpp b/glm/core/intrinsic_geometric.hpp new file mode 100644 index 0000000..c536916 --- /dev/null +++ b/glm/core/intrinsic_geometric.hpp @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-08 +// Updated : 2009-05-08 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_geometric.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_intrinsic_geometric +#define glm_core_intrinsic_geometric + +#include "intrinsic_common.hpp" + +//length +__m128 _mm_len_ps(__m128 x); + +//distance +__m128 _mm_dst_ps(__m128 p0, __m128 p1); + +//dot +__m128 _mm_dot_ps(__m128 v1, __m128 v2); + +// SSE1 +__m128 _mm_dot_ss(__m128 v1, __m128 v2); + +//cross +__m128 _mm_xpd_ps(__m128 v1, __m128 v2); + +//normalize +__m128 _mm_nrm_ps(__m128 v); + +//faceforward +__m128 _mm_ffd_ps(__m128 N, __m128 I, __m128 Nref); + +//reflect +__m128 _mm_rfe_ps(__m128 I, __m128 N); + +//refract +__m128 _mm_rfa_ps(__m128 I, __m128 N, __m128 eta); + + +#include "intrinsic_geometric.inl" + +#endif//glm_core_intrinsic_geometric diff --git a/glm/core/intrinsic_geometric.inl b/glm/core/intrinsic_geometric.inl new file mode 100644 index 0000000..d0382ab --- /dev/null +++ b/glm/core/intrinsic_geometric.inl @@ -0,0 +1,117 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-08 +// Updated : 2009-05-08 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_geometric.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +//length +inline __m128 _mm_len_ps(__m128 x) +{ + __m128 dot0 = _mm_dot_ps(x, x); + __m128 sqt0 = _mm_sqrt_ps(dot0); + return sqt0; +} + +//distance +inline __m128 _mm_dst_ps(__m128 p0, __m128 p1) +{ + __m128 sub0 = _mm_sub_ps(p0, p1); + __m128 len0 = _mm_len_ps(sub0); + return len0; +} + +//dot +inline __m128 _mm_dot_ps(__m128 v1, __m128 v2) +{ + __m128 mul0 = _mm_mul_ps(v1, v2); + __m128 swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1)); + __m128 add0 = _mm_add_ps(mul0, swp0); + __m128 swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3)); + __m128 add1 = _mm_add_ps(add0, swp1); + return add1; +} + +// SSE1 +inline __m128 _mm_dot_ss(__m128 v1, __m128 v2) +{ + __m128 mul0 = _mm_mul_ps(v1, v2); + __m128 mov0 = _mm_movehl_ps(mul0, mul0); + __m128 add0 = _mm_add_ps(mov0, mul0); + __m128 swp1 = _mm_shuffle_ps(add0, add0, 1); + __m128 add1 = _mm_add_ss(add0, swp1); + return add1; +} + +//cross +inline __m128 _mm_xpd_ps(__m128 v1, __m128 v2) +{ + __m128 swp0 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 0, 2, 1)); + __m128 swp1 = _mm_shuffle_ps(v1, v1, _MM_SHUFFLE(3, 1, 0, 2)); + __m128 swp2 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 0, 2, 1)); + __m128 swp3 = _mm_shuffle_ps(v2, v2, _MM_SHUFFLE(3, 1, 0, 2)); + __m128 mul0 = _mm_mul_ps(swp0, swp3); + __m128 mul1 = _mm_mul_ps(swp1, swp2); + __m128 sub0 = _mm_sub_ps(mul0, mul1); + return sub0; +} + +//normalize +inline __m128 _mm_nrm_ps(__m128 v) +{ + __m128 dot0 = _mm_dot_ps(v, v); + __m128 isr0 = _mm_rsqrt_ps(dot0); + __m128 mul0 = _mm_mul_ps(v, isr0); + return mul0; +} + +//faceforward +inline __m128 _mm_ffd_ps(__m128 N, __m128 I, __m128 Nref) +{ + //__m128 dot0 = _mm_dot_ps(v, v); + //__m128 neg0 = _mm_neg_ps(N); + //__m128 sgn0 = _mm_sgn_ps(dot0); + //__m128 mix0 = _mm_mix_ps(N, neg0, sgn0); + //return mix0; + + __m128 dot0 = _mm_dot_ps(Nref, I); + __m128 sgn0 = _mm_sgn_ps(dot0); + __m128 mul0 = _mm_mul_ps(sgn0, glm::detail::minus_one); + __m128 mul1 = _mm_mul_ps(N, mul0); + return mul1; +} + +//reflect +inline __m128 _mm_rfe_ps(__m128 I, __m128 N) +{ + __m128 dot0 = _mm_dot_ps(N, I); + __m128 mul0 = _mm_mul_ps(N, I); + __m128 mul1 = _mm_mul_ps(mul0, glm::detail::two); + __m128 sub0 = _mm_sub_ps(I, mul1); + return sub0; +} + +//refract +inline __m128 _mm_rfa_ps(__m128 I, __m128 N, __m128 eta) +{ + __m128 dot0 = _mm_dot_ps(N, I); + __m128 mul0 = _mm_mul_ps(eta, eta); + __m128 mul1 = _mm_mul_ps(dot0, dot0); + __m128 sub0 = _mm_sub_ps(glm::detail::one, mul0); + __m128 sub1 = _mm_sub_ps(glm::detail::one, mul1); + __m128 mul2 = _mm_mul_ps(sub0, sub1); + + if(_mm_movemask_ps(_mm_cmplt_ss(mul2, glm::detail::zero)) == 0) + return glm::detail::zero; + + __m128 sqt0 = _mm_sqrt_ps(mul2); + __m128 mul3 = _mm_mul_ps(eta, dot0); + __m128 add0 = _mm_add_ps(mul3, sqt0); + __m128 mul4 = _mm_mul_ps(add0, N); + __m128 mul5 = _mm_mul_ps(eta, I); + __m128 sub2 = _mm_sub_ps(mul5, mul4); + + return sub2; +} diff --git a/glm/core/intrinsic_matrix.hpp b/glm/core/intrinsic_matrix.hpp new file mode 100644 index 0000000..f57ffb1 --- /dev/null +++ b/glm/core/intrinsic_matrix.hpp @@ -0,0 +1,36 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-06-05 +// Updated : 2009-06-05 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_common.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_DETAIL_INTRINSIC_MATRIX_INCLUDED +#define GLM_DETAIL_INTRINSIC_MATRIX_INCLUDED + +#include "../glm.hpp" + +#include +#include + +void _mm_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); + +void _mm_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); + +__m128 _mm_mul_ps(__m128 m[4], __m128 v); + +__m128 _mm_mul_ps(__m128 v, __m128 m[4]); + +void _mm_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4]); + +void _mm_transpose_ps(__m128 const in[4], __m128 out[4]); + +void _mm_inverse_ps(__m128 const in[4], __m128 out[4]); + +void _mm_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]); + +#include "intrinsic_matrix.inl" + +#endif//GLM_DETAIL_INTRINSIC_MATRIX_INCLUDED diff --git a/glm/core/intrinsic_matrix.inl b/glm/core/intrinsic_matrix.inl new file mode 100644 index 0000000..3e80ed3 --- /dev/null +++ b/glm/core/intrinsic_matrix.inl @@ -0,0 +1,704 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-06-05 +// Updated : 2009-06-05 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_common.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +static const __m128 one = _mm_set_ps1(1.0f); +static const __m128 pi = _mm_set_ps1(3.141592653589793238462643383279f); +static const __m128 _m128_rad_ps = _mm_set_ps1(3.141592653589793238462643383279f / 180.f); +static const __m128 _m128_deg_ps = _mm_set_ps1(180.f / 3.141592653589793238462643383279f); + +inline void _mm_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]) +{ + { + out[0] = _mm_add_ps(in1[0], in2[0]); + out[1] = _mm_add_ps(in1[1], in2[1]); + out[2] = _mm_add_ps(in1[2], in2[2]); + out[3] = _mm_add_ps(in1[3], in2[3]); + } +} + +inline void _mm_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]) +{ + { + out[0] = _mm_sub_ps(in1[0], in2[0]); + out[1] = _mm_sub_ps(in1[1], in2[1]); + out[2] = _mm_sub_ps(in1[2], in2[2]); + out[3] = _mm_sub_ps(in1[3], in2[3]); + } +} + +inline __m128 _mm_mul_ps(__m128 m[4], __m128 v) +{ + __m128 v0 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(0, 0, 0, 0)); + __m128 v1 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(1, 1, 1, 1)); + __m128 v2 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(2, 2, 2, 2)); + __m128 v3 = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 m0 = _mm_mul_ps(m[0], v0); + __m128 m1 = _mm_mul_ps(m[1], v1); + __m128 m2 = _mm_mul_ps(m[2], v2); + __m128 m3 = _mm_mul_ps(m[3], v3); + + __m128 a0 = _mm_add_ps(m0, m1); + __m128 a1 = _mm_add_ps(m2, m3); + __m128 a2 = _mm_add_ps(a0, a1); + + return a2; +} + +inline __m128 _mm_mul_ps(__m128 v, __m128 m[4]) +{ + __m128 i0 = m[0]; + __m128 i1 = m[1]; + __m128 i2 = m[2]; + __m128 i3 = m[3]; + + __m128 m0 = _mm_mul_ps(v, i0); + __m128 m1 = _mm_mul_ps(v, i1); + __m128 m2 = _mm_mul_ps(v, i2); + __m128 m3 = _mm_mul_ps(v, i3); + + __m128 u0 = _mm_unpacklo_ps(m0, m1); + __m128 u1 = _mm_unpackhi_ps(m0, m1); + __m128 a0 = _mm_add_ps(u0, u1); + + __m128 u2 = _mm_unpacklo_ps(m2, m3); + __m128 u3 = _mm_unpackhi_ps(m2, m3); + __m128 a1 = _mm_add_ps(u2, u3); + + __m128 f0 = _mm_movelh_ps(a0, a1); + __m128 f1 = _mm_movehl_ps(a1, a0); + __m128 f2 = _mm_add_ps(f0, f1); + + return f2; +} + +inline void _mm_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4]) +{ + { + __m128 e0 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 e1 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 e2 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 e3 = _mm_shuffle_ps(in2[0], in2[0], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 m0 = _mm_mul_ps(in1[0], e0); + __m128 m1 = _mm_mul_ps(in1[1], e1); + __m128 m2 = _mm_mul_ps(in1[2], e2); + __m128 m3 = _mm_mul_ps(in1[3], e3); + + __m128 a0 = _mm_add_ps(m0, m1); + __m128 a1 = _mm_add_ps(m2, m3); + __m128 a2 = _mm_add_ps(a0, a1); + + out[0] = a2; + } + + { + __m128 e0 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 e1 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 e2 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 e3 = _mm_shuffle_ps(in2[1], in2[1], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 m0 = _mm_mul_ps(in1[0], e0); + __m128 m1 = _mm_mul_ps(in1[1], e1); + __m128 m2 = _mm_mul_ps(in1[2], e2); + __m128 m3 = _mm_mul_ps(in1[3], e3); + + __m128 a0 = _mm_add_ps(m0, m1); + __m128 a1 = _mm_add_ps(m2, m3); + __m128 a2 = _mm_add_ps(a0, a1); + + out[1] = a2; + } + + { + __m128 e0 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 e1 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 e2 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 e3 = _mm_shuffle_ps(in2[2], in2[2], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 m0 = _mm_mul_ps(in1[0], e0); + __m128 m1 = _mm_mul_ps(in1[1], e1); + __m128 m2 = _mm_mul_ps(in1[2], e2); + __m128 m3 = _mm_mul_ps(in1[3], e3); + + __m128 a0 = _mm_add_ps(m0, m1); + __m128 a1 = _mm_add_ps(m2, m3); + __m128 a2 = _mm_add_ps(a0, a1); + + out[2] = a2; + } + + { + //(__m128&)_mm_shuffle_epi32(__m128i&)in2[0], _MM_SHUFFLE(3, 3, 3, 3)) + __m128 e0 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 e1 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 e2 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 e3 = _mm_shuffle_ps(in2[3], in2[3], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 m0 = _mm_mul_ps(in1[0], e0); + __m128 m1 = _mm_mul_ps(in1[1], e1); + __m128 m2 = _mm_mul_ps(in1[2], e2); + __m128 m3 = _mm_mul_ps(in1[3], e3); + + __m128 a0 = _mm_add_ps(m0, m1); + __m128 a1 = _mm_add_ps(m2, m3); + __m128 a2 = _mm_add_ps(a0, a1); + + out[3] = a2; + } +} + +inline void _mm_transpose_ps(__m128 const in[4], __m128 out[4]) +{ + __m128 tmp0 = _mm_shuffle_ps(in[0], in[1], 0x44); + __m128 tmp2 = _mm_shuffle_ps(in[0], in[1], 0xEE); + __m128 tmp1 = _mm_shuffle_ps(in[2], in[3], 0x44); + __m128 tmp3 = _mm_shuffle_ps(in[2], in[3], 0xEE); + + out[0] = _mm_shuffle_ps(tmp0, tmp1, 0x88); + out[1] = _mm_shuffle_ps(tmp0, tmp1, 0xDD); + out[2] = _mm_shuffle_ps(tmp2, tmp3, 0x88); + out[3] = _mm_shuffle_ps(tmp2, tmp3, 0xDD); +} + +inline void _mm_inverse_ps(__m128 const in[4], __m128 out[4]) +{ + __m128 Fac0; + { + // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + // valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; + // valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac0 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac1; + { + // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + // valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; + // valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac1 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + + __m128 Fac2; + { + // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + // valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; + // valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac2 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac3; + { + // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + // valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; + // valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac3 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac4; + { + // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + // valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; + // valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac4 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac5; + { + // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + // valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; + // valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac5 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f); + __m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f); + + // m[1][0] + // m[0][0] + // m[0][0] + // m[0][0] + __m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0)); + + // m[1][1] + // m[0][1] + // m[0][1] + // m[0][1] + __m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0)); + + // m[1][2] + // m[0][2] + // m[0][2] + // m[0][2] + __m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0)); + + // m[1][3] + // m[0][3] + // m[0][3] + // m[0][3] + __m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0)); + + // col0 + // + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]), + // - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]), + // + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]), + // - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]), + __m128 Mul00 = _mm_mul_ps(Vec1, Fac0); + __m128 Mul01 = _mm_mul_ps(Vec2, Fac1); + __m128 Mul02 = _mm_mul_ps(Vec3, Fac2); + __m128 Sub00 = _mm_sub_ps(Mul00, Mul01); + __m128 Add00 = _mm_add_ps(Sub00, Mul02); + __m128 Inv0 = _mm_mul_ps(SignB, Add00); + + // col1 + // - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]), + // + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]), + // - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]), + // + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]), + __m128 Mul03 = _mm_mul_ps(Vec0, Fac0); + __m128 Mul04 = _mm_mul_ps(Vec2, Fac3); + __m128 Mul05 = _mm_mul_ps(Vec3, Fac4); + __m128 Sub01 = _mm_sub_ps(Mul03, Mul04); + __m128 Add01 = _mm_add_ps(Sub01, Mul05); + __m128 Inv1 = _mm_mul_ps(SignA, Add01); + + // col2 + // + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]), + // - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]), + // + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]), + // - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]), + __m128 Mul06 = _mm_mul_ps(Vec0, Fac1); + __m128 Mul07 = _mm_mul_ps(Vec1, Fac3); + __m128 Mul08 = _mm_mul_ps(Vec3, Fac5); + __m128 Sub02 = _mm_sub_ps(Mul06, Mul07); + __m128 Add02 = _mm_add_ps(Sub02, Mul08); + __m128 Inv2 = _mm_mul_ps(SignB, Add02); + + // col3 + // - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]), + // + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]), + // - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]), + // + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3])); + __m128 Mul09 = _mm_mul_ps(Vec0, Fac2); + __m128 Mul10 = _mm_mul_ps(Vec1, Fac4); + __m128 Mul11 = _mm_mul_ps(Vec2, Fac5); + __m128 Sub03 = _mm_sub_ps(Mul09, Mul10); + __m128 Add03 = _mm_add_ps(Sub03, Mul11); + __m128 Inv3 = _mm_mul_ps(SignA, Add03); + + __m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0)); + + // valType Determinant = m[0][0] * Inverse[0][0] + // + m[0][1] * Inverse[1][0] + // + m[0][2] * Inverse[2][0] + // + m[0][3] * Inverse[3][0]; + __m128 Det0 = _mm_dot_ps(in[0], Row2); + __m128 Rcp0 = _mm_div_ps(one, Det0); + //__m128 Rcp0 = _mm_rcp_ps(Det0); + + // Inverse /= Determinant; + out[0] = _mm_mul_ps(Inv0, Rcp0); + out[1] = _mm_mul_ps(Inv1, Rcp0); + out[2] = _mm_mul_ps(Inv2, Rcp0); + out[3] = _mm_mul_ps(Inv3, Rcp0); +} + +inline void _mm_inverse_fast_ps(__m128 const in[4], __m128 out[4]) +{ + __m128 Fac0; + { + // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + // valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + // valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; + // valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac0 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac1; + { + // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + // valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + // valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; + // valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac1 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + + __m128 Fac2; + { + // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + // valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + // valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; + // valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac2 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac3; + { + // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + // valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + // valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; + // valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(3, 3, 3, 3)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac3 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac4; + { + // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + // valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + // valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; + // valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(2, 2, 2, 2)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac4 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 Fac5; + { + // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + // valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + // valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; + // valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; + + __m128 Swp0a = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Swp0b = _mm_shuffle_ps(in[3], in[2], _MM_SHUFFLE(0, 0, 0, 0)); + + __m128 Swp00 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Swp01 = _mm_shuffle_ps(Swp0a, Swp0a, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp02 = _mm_shuffle_ps(Swp0b, Swp0b, _MM_SHUFFLE(2, 0, 0, 0)); + __m128 Swp03 = _mm_shuffle_ps(in[2], in[1], _MM_SHUFFLE(1, 1, 1, 1)); + + __m128 Mul00 = _mm_mul_ps(Swp00, Swp01); + __m128 Mul01 = _mm_mul_ps(Swp02, Swp03); + Fac5 = _mm_sub_ps(Mul00, Mul01); + + bool stop = true; + } + + __m128 SignA = _mm_set_ps( 1.0f,-1.0f, 1.0f,-1.0f); + __m128 SignB = _mm_set_ps(-1.0f, 1.0f,-1.0f, 1.0f); + + // m[1][0] + // m[0][0] + // m[0][0] + // m[0][0] + __m128 Temp0 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Vec0 = _mm_shuffle_ps(Temp0, Temp0, _MM_SHUFFLE(2, 2, 2, 0)); + + // m[1][1] + // m[0][1] + // m[0][1] + // m[0][1] + __m128 Temp1 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(1, 1, 1, 1)); + __m128 Vec1 = _mm_shuffle_ps(Temp1, Temp1, _MM_SHUFFLE(2, 2, 2, 0)); + + // m[1][2] + // m[0][2] + // m[0][2] + // m[0][2] + __m128 Temp2 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(2, 2, 2, 2)); + __m128 Vec2 = _mm_shuffle_ps(Temp2, Temp2, _MM_SHUFFLE(2, 2, 2, 0)); + + // m[1][3] + // m[0][3] + // m[0][3] + // m[0][3] + __m128 Temp3 = _mm_shuffle_ps(in[1], in[0], _MM_SHUFFLE(3, 3, 3, 3)); + __m128 Vec3 = _mm_shuffle_ps(Temp3, Temp3, _MM_SHUFFLE(2, 2, 2, 0)); + + // col0 + // + (Vec1[0] * Fac0[0] - Vec2[0] * Fac1[0] + Vec3[0] * Fac2[0]), + // - (Vec1[1] * Fac0[1] - Vec2[1] * Fac1[1] + Vec3[1] * Fac2[1]), + // + (Vec1[2] * Fac0[2] - Vec2[2] * Fac1[2] + Vec3[2] * Fac2[2]), + // - (Vec1[3] * Fac0[3] - Vec2[3] * Fac1[3] + Vec3[3] * Fac2[3]), + __m128 Mul00 = _mm_mul_ps(Vec1, Fac0); + __m128 Mul01 = _mm_mul_ps(Vec2, Fac1); + __m128 Mul02 = _mm_mul_ps(Vec3, Fac2); + __m128 Sub00 = _mm_sub_ps(Mul00, Mul01); + __m128 Add00 = _mm_add_ps(Sub00, Mul02); + __m128 Inv0 = _mm_mul_ps(SignB, Add00); + + // col1 + // - (Vec0[0] * Fac0[0] - Vec2[0] * Fac3[0] + Vec3[0] * Fac4[0]), + // + (Vec0[0] * Fac0[1] - Vec2[1] * Fac3[1] + Vec3[1] * Fac4[1]), + // - (Vec0[0] * Fac0[2] - Vec2[2] * Fac3[2] + Vec3[2] * Fac4[2]), + // + (Vec0[0] * Fac0[3] - Vec2[3] * Fac3[3] + Vec3[3] * Fac4[3]), + __m128 Mul03 = _mm_mul_ps(Vec0, Fac0); + __m128 Mul04 = _mm_mul_ps(Vec2, Fac3); + __m128 Mul05 = _mm_mul_ps(Vec3, Fac4); + __m128 Sub01 = _mm_sub_ps(Mul03, Mul04); + __m128 Add01 = _mm_add_ps(Sub01, Mul05); + __m128 Inv1 = _mm_mul_ps(SignA, Add01); + + // col2 + // + (Vec0[0] * Fac1[0] - Vec1[0] * Fac3[0] + Vec3[0] * Fac5[0]), + // - (Vec0[0] * Fac1[1] - Vec1[1] * Fac3[1] + Vec3[1] * Fac5[1]), + // + (Vec0[0] * Fac1[2] - Vec1[2] * Fac3[2] + Vec3[2] * Fac5[2]), + // - (Vec0[0] * Fac1[3] - Vec1[3] * Fac3[3] + Vec3[3] * Fac5[3]), + __m128 Mul06 = _mm_mul_ps(Vec0, Fac1); + __m128 Mul07 = _mm_mul_ps(Vec1, Fac3); + __m128 Mul08 = _mm_mul_ps(Vec3, Fac5); + __m128 Sub02 = _mm_sub_ps(Mul06, Mul07); + __m128 Add02 = _mm_add_ps(Sub02, Mul08); + __m128 Inv2 = _mm_mul_ps(SignB, Add02); + + // col3 + // - (Vec1[0] * Fac2[0] - Vec1[0] * Fac4[0] + Vec2[0] * Fac5[0]), + // + (Vec1[0] * Fac2[1] - Vec1[1] * Fac4[1] + Vec2[1] * Fac5[1]), + // - (Vec1[0] * Fac2[2] - Vec1[2] * Fac4[2] + Vec2[2] * Fac5[2]), + // + (Vec1[0] * Fac2[3] - Vec1[3] * Fac4[3] + Vec2[3] * Fac5[3])); + __m128 Mul09 = _mm_mul_ps(Vec0, Fac2); + __m128 Mul10 = _mm_mul_ps(Vec1, Fac4); + __m128 Mul11 = _mm_mul_ps(Vec2, Fac5); + __m128 Sub03 = _mm_sub_ps(Mul09, Mul10); + __m128 Add03 = _mm_add_ps(Sub03, Mul11); + __m128 Inv3 = _mm_mul_ps(SignA, Add03); + + __m128 Row0 = _mm_shuffle_ps(Inv0, Inv1, _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Row1 = _mm_shuffle_ps(Inv2, Inv3, _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Row2 = _mm_shuffle_ps(Row0, Row1, _MM_SHUFFLE(2, 0, 2, 0)); + + // valType Determinant = m[0][0] * Inverse[0][0] + // + m[0][1] * Inverse[1][0] + // + m[0][2] * Inverse[2][0] + // + m[0][3] * Inverse[3][0]; + __m128 Det0 = _mm_dot_ps(in[0], Row2); + __m128 Rcp0 = _mm_rcp_ps(Det0); + //__m128 Rcp0 = _mm_div_ps(one, Det0); + // Inverse /= Determinant; + out[0] = _mm_mul_ps(Inv0, Rcp0); + out[1] = _mm_mul_ps(Inv1, Rcp0); + out[2] = _mm_mul_ps(Inv2, Rcp0); + out[3] = _mm_mul_ps(Inv3, Rcp0); +} + + +void _mm_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]) +{ + float a = glm::radians(Angle); + float c = cos(a); + float s = sin(a); + + glm::vec4 AxisA(v[0], v[1], v[2], float(0)); + __m128 AxisB = _mm_set_ps(AxisA.w, AxisA.z, AxisA.y, AxisA.x); + __m128 AxisC = _mm_nrm_ps(AxisB); + + __m128 Cos0 = _mm_set_ss(c); + __m128 CosA = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(0, 0, 0, 0)); + __m128 Sin0 = _mm_set_ss(s); + __m128 SinA = _mm_shuffle_ps(Sin0, Sin0, _MM_SHUFFLE(0, 0, 0, 0)); + + // detail::tvec3 temp = (valType(1) - c) * axis; + __m128 Temp0 = _mm_sub_ps(one, CosA); + __m128 Temp1 = _mm_mul_ps(Temp0, AxisC); + + //Rotate[0][0] = c + temp[0] * axis[0]; + //Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2]; + //Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1]; + __m128 Axis0 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(0, 0, 0, 0)); + __m128 TmpA0 = _mm_mul_ps(Axis0, AxisC); + __m128 CosA0 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 1, 0)); + __m128 TmpA1 = _mm_add_ps(CosA0, TmpA0); + __m128 SinA0 = SinA;//_mm_set_ps(0.0f, s, -s, 0.0f); + __m128 TmpA2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 1, 2, 3)); + __m128 TmpA3 = _mm_mul_ps(SinA0, TmpA2); + __m128 TmpA4 = _mm_add_ps(TmpA1, TmpA3); + + //Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2]; + //Rotate[1][1] = c + temp[1] * axis[1]; + //Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0]; + __m128 Axis1 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(1, 1, 1, 1)); + __m128 TmpB0 = _mm_mul_ps(Axis1, AxisC); + __m128 CosA1 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 1, 0, 1)); + __m128 TmpB1 = _mm_add_ps(CosA1, TmpB0); + __m128 SinB0 = SinA;//_mm_set_ps(-s, 0.0f, s, 0.0f); + __m128 TmpB2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 0, 3, 2)); + __m128 TmpB3 = _mm_mul_ps(SinA0, TmpB2); + __m128 TmpB4 = _mm_add_ps(TmpB1, TmpB3); + + //Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1]; + //Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0]; + //Rotate[2][2] = c + temp[2] * axis[2]; + __m128 Axis2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(2, 2, 2, 2)); + __m128 TmpC0 = _mm_mul_ps(Axis2, AxisC); + __m128 CosA2 = _mm_shuffle_ps(Cos0, Cos0, _MM_SHUFFLE(1, 0, 1, 1)); + __m128 TmpC1 = _mm_add_ps(CosA2, TmpC0); + __m128 SinC0 = SinA;//_mm_set_ps(s, -s, 0.0f, 0.0f); + __m128 TmpC2 = _mm_shuffle_ps(AxisC, AxisC, _MM_SHUFFLE(3, 3, 0, 1)); + __m128 TmpC3 = _mm_mul_ps(SinA0, TmpC2); + __m128 TmpC4 = _mm_add_ps(TmpC1, TmpC3); + + __m128 Result[4]; + Result[0] = TmpA4; + Result[1] = TmpB4; + Result[2] = TmpC4; + Result[2] = _mm_set_ps(1, 0, 0, 0); + + //detail::tmat4x4 Result(detail::tmat4x4::null); + //Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2]; + //Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2]; + //Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2]; + //Result[3] = m[3]; + //return Result; + _mm_mul_ps(in, Result, out); +} diff --git a/glm/core/intrinsic_trigonometric.hpp b/glm/core/intrinsic_trigonometric.hpp new file mode 100644 index 0000000..e69de29 diff --git a/glm/core/intrinsic_trigonometric.inl b/glm/core/intrinsic_trigonometric.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/core/intrinsic_vector_relational.hpp b/glm/core/intrinsic_vector_relational.hpp new file mode 100644 index 0000000..1560829 --- /dev/null +++ b/glm/core/intrinsic_vector_relational.hpp @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-06-09 +// Updated : 2009-06-09 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_vector_relational.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef GLM_DETAIL_INTRINSIC_VECTOR_RELATIONAL_INCLUDED +#define GLM_DETAIL_INTRINSIC_VECTOR_RELATIONAL_INCLUDED + +#include +#include + +#include "intrinsic_vector_relational.inl" + +#endif//GLM_DETAIL_INTRINSIC_VECTOR_RELATIONAL_INCLUDED diff --git a/glm/core/intrinsic_vector_relational.inl b/glm/core/intrinsic_vector_relational.inl new file mode 100644 index 0000000..87fec8f --- /dev/null +++ b/glm/core/intrinsic_vector_relational.inl @@ -0,0 +1,347 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-06-09 +// Updated : 2009-06-09 +// Licence : This source is under MIT License +// File : glm/core/intrinsic_vector_relational.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +//// lessThan +//template +//inline typename detail::tvec2::bool_type lessThan +//( +// detail::tvec2 const & x, +// detail::tvec2 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec2::bool_type(x.x < y.x, x.y < y.y); +//} +// +//template +//inline typename detail::tvec3::bool_type lessThan +//( +// detail::tvec3 const & x, +// detail::tvec3 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec3::bool_type(x.x < y.x, x.y < y.y, x.z < y.z); +//} +// +//template +//inline typename detail::tvec4::bool_type lessThan +//( +// detail::tvec4 const & x, +// detail::tvec4 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec4::bool_type(x.x < y.x, x.y < y.y, x.z < y.z, x.w < y.w); +//} +// +//// lessThanEqual +//template +//inline typename detail::tvec2::bool_type lessThanEqual +//( +// detail::tvec2 const & x, +// detail::tvec2 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec2::bool_type(x.x <= y.x, x.y <= y.y); +//} +// +//template +//inline typename detail::tvec3::bool_type lessThanEqual +//( +// detail::tvec3 const & x, +// detail::tvec3 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec3::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z); +//} +// +//template +//inline typename detail::tvec4::bool_type lessThanEqual +//( +// detail::tvec4 const & x, +// detail::tvec4 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec4::bool_type(x.x <= y.x, x.y <= y.y, x.z <= y.z, x.w <= y.w); +//} +// +//// greaterThan +//template +//inline typename detail::tvec2::bool_type greaterThan +//( +// detail::tvec2 const & x, +// detail::tvec2 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec2::bool_type(x.x > y.x, x.y > y.y); +//} +// +//template +//inline typename detail::tvec3::bool_type greaterThan +//( +// detail::tvec3 const & x, +// detail::tvec3 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec3::bool_type(x.x > y.x, x.y > y.y, x.z > y.z); +//} +// +//template +//inline typename detail::tvec4::bool_type greaterThan +//( +// detail::tvec4 const & x, +// detail::tvec4 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec4::bool_type(x.x > y.x, x.y > y.y, x.z > y.z, x.w > y.w); +//} +// +//// greaterThanEqual +//template +//inline typename detail::tvec2::bool_type greaterThanEqual +//( +// detail::tvec2 const & x, +// detail::tvec2 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec2::bool_type(x.x >= y.x, x.y >= y.y); +//} +// +//template +//inline typename detail::tvec3::bool_type greaterThanEqual +//( +// detail::tvec3 const & x, +// detail::tvec3 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec3::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z); +//} +// +//template +//inline typename detail::tvec4::bool_type greaterThanEqual +//( +// detail::tvec4 const & x, +// detail::tvec4 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint); +// +// return typename detail::tvec4::bool_type(x.x >= y.x, x.y >= y.y, x.z >= y.z, x.w >= y.w); +//} +// +//// equal +//template +//inline typename detail::tvec2::bool_type equal +//( +// detail::tvec2 const & x, +// detail::tvec2 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint || +// detail::type::is_bool); +// +// return typename detail::tvec2::bool_type(x.x == y.x, x.y == y.y); +//} +// +//template +//inline typename detail::tvec3::bool_type equal +//( +// detail::tvec3 const & x, +// detail::tvec3 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint || +// detail::type::is_bool); +// +// return typename detail::tvec3::bool_type(x.x == y.x, x.y == y.y, x.z == y.z); +//} +// +//template +//inline typename detail::tvec4::bool_type equal +//( +// detail::tvec4 const & x, +// detail::tvec4 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint || +// detail::type::is_bool); +// +// return typename detail::tvec4::bool_type(x.x == y.x, x.y == y.y, x.z == y.z, x.w == y.w); +//} +// +//// notEqual +//template +//inline typename detail::tvec2::bool_type notEqual +//( +// detail::tvec2 const & x, +// detail::tvec2 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint || +// detail::type::is_bool); +// +// return typename detail::tvec2::bool_type(x.x != y.x, x.y != y.y); +//} +// +//template +//inline typename detail::tvec3::bool_type notEqual +//( +// detail::tvec3 const & x, +// detail::tvec3 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint || +// detail::type::is_bool); +// +// return typename detail::tvec3::bool_type(x.x != y.x, x.y != y.y, x.z != y.z); +//} +// +//template +//inline typename detail::tvec4::bool_type notEqual +//( +// detail::tvec4 const & x, +// detail::tvec4 const & y +//) +//{ +// GLM_STATIC_ASSERT( +// detail::type::is_float || +// detail::type::is_int || +// detail::type::is_uint || +// detail::type::is_bool); +// +// return typename detail::tvec4::bool_type(x.x != y.x, x.y != y.y, x.z != y.z, x.w != y.w); +//} +// +//// any +//inline bool any(detail::tvec2 const & x) +//{ +// return x.x || x.y; +//} +// +//inline bool any(detail::tvec3 const & x) +//{ +// return x.x || x.y || x.z; +//} +// +//inline bool any(detail::tvec4 const & x) +//{ +// return x.x || x.y || x.z || x.w; +//} +// +//// all +//inline bool all(const detail::tvec2& x) +//{ +// return x.x && x.y; +//} +// +//inline bool all(const detail::tvec3& x) +//{ +// return x.x && x.y && x.z; +//} +// +//inline bool all(const detail::tvec4& x) +//{ +// return x.x && x.y && x.z && x.w; +//} +// +//// not +//inline detail::tvec2::bool_type not_ +//( +// detail::tvec2 const & v +//) +//{ +// return detail::tvec2::bool_type(!v.x, !v.y); +//} +// +//inline detail::tvec3::bool_type not_ +//( +// detail::tvec3 const & v +//) +//{ +// return detail::tvec3::bool_type(!v.x, !v.y, !v.z); +//} +// +//inline detail::tvec4::bool_type not_ +//( +// detail::tvec4 const & v +//) +//{ +// return detail::tvec4::bool_type(!v.x, !v.y, !v.z, !v.w); +//} \ No newline at end of file diff --git a/glm/core/type.hpp b/glm/core/type.hpp new file mode 100644 index 0000000..e4bba56 --- /dev/null +++ b/glm/core/type.hpp @@ -0,0 +1,34 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-01-08 +// Updated : 2008-01-08 +// Licence : This source is under MIT License +// File : glm/core/type.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type +#define glm_core_type + +#include "type_half.hpp" +#include "type_float.hpp" +#include "type_int.hpp" + +#include "type_gentype.hpp" + +#include "type_vec1.hpp" +#include "type_vec2.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" + +#include "type_mat2x2.hpp" +#include "type_mat2x3.hpp" +#include "type_mat2x4.hpp" +#include "type_mat3x2.hpp" +#include "type_mat3x3.hpp" +#include "type_mat3x4.hpp" +#include "type_mat4x2.hpp" +#include "type_mat4x3.hpp" +#include "type_mat4x4.hpp" + +#endif//glm_core_type diff --git a/glm/core/type_float.hpp b/glm/core/type_float.hpp new file mode 100644 index 0000000..a6e5732 --- /dev/null +++ b/glm/core/type_float.hpp @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-22 +// Updated : 2008-09-17 +// Licence : This source is under MIT License +// File : glm/core/type_float.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_float +#define glm_core_type_float + +#include "type_half.hpp" +#include "../setup.hpp" + +namespace glm +{ + namespace detail + { + GLM_DETAIL_IS_FLOAT(detail::thalf); + GLM_DETAIL_IS_FLOAT(float); + GLM_DETAIL_IS_FLOAT(double); + GLM_DETAIL_IS_FLOAT(long double); + } + //namespace detail + + namespace core{ + namespace type{ + namespace scalar{ + + namespace precision + { +#ifdef GLM_USE_HALF_SCALAR + typedef detail::thalf lowp_float_t; +#else//GLM_USE_HALF_SCALAR + typedef float lowp_float_t; +#endif//GLM_USE_HALF_SCALAR + typedef float mediump_float_t; + typedef double highp_float_t; + + //! Low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification + typedef lowp_float_t lowp_float; + //! Medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification + typedef mediump_float_t mediump_float; + //! High precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification + typedef highp_float_t highp_float; + } + //namespace precision + +#ifndef GLM_PRECISION + typedef precision::mediump_float_t float_t; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_FLOAT) + typedef precision::highp_float_t float_t; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_FLOAT) + typedef precision::mediump_float_t float_t; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_FLOAT) + typedef precision::lowp_float_t float_t; +#else + # pragma message("GLM message: Precisson undefined for float numbers."); + typedef precision::mediump_float_t float_t; +#endif//GLM_PRECISION + + }//namespace scalar + }//namespace type + }//namespace core +}//namespace glm + +#endif//glm_core_type_float diff --git a/glm/core/type_gentype.hpp b/glm/core/type_gentype.hpp new file mode 100644 index 0000000..c71092c --- /dev/null +++ b/glm/core/type_gentype.hpp @@ -0,0 +1,94 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-05 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/core/type_gentype.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_gentype +#define glm_core_type_gentype + +#include "type_size.hpp" + +namespace glm{ + +enum profile +{ + nice, + fast, + simd +}; + +namespace detail{ + +template +class genType +{ +public: + ////////////////////////////////////// + // Traits + + typedef sizeType size_type; + typedef valTypeT value_type; + + typedef genType class_type; + + typedef genType bool_type; + typedef genType col_type; + typedef genType row_type; + typedef genType transpose_type; + + static size_type col_size(); + static size_type row_size(); + static size_type value_size(); + static bool is_scalar(); + static bool is_vector(); + static bool is_matrix(); + +private: + // Data + col_type value[colT]; + +public: + ////////////////////////////////////// + // Constructors + genType(); + genType(class_type const & m); + + explicit genType(value_type const & x); + explicit genType(value_type const * const x); + explicit genType(col_type const * const x); + + ////////////////////////////////////// + // Conversions + template + explicit genType(genType const & m); + + ////////////////////////////////////// + // Accesses + col_type& operator[](size_type i); + col_type const & operator[](size_type i) const; + + ////////////////////////////////////// + // Unary updatable operators + class_type& operator= (class_type const & x); + class_type& operator+= (value_type const & x); + class_type& operator+= (class_type const & x); + class_type& operator-= (value_type const & x); + class_type& operator-= (class_type const & x); + class_type& operator*= (value_type const & x); + class_type& operator*= (class_type const & x); + class_type& operator/= (value_type const & x); + class_type& operator/= (class_type const & x); + class_type& operator++ (); + class_type& operator-- (); +}; + +}//namespace detail +}//namespace glm + +#include "type_gentype.inl" + +#endif//glm_core_type_gentype diff --git a/glm/core/type_gentype.inl b/glm/core/type_gentype.inl new file mode 100644 index 0000000..57f3423 --- /dev/null +++ b/glm/core/type_gentype.inl @@ -0,0 +1,347 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-05 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/core/type_gentype.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + +///////////////////////////////// +// Static functions + +template +typename genType::size_type genType::col_size() +{ + return cT; +} + +template +typename genType::size_type genType::row_size() +{ + return rT; +} + +template +typename genType::size_type genType::value_size() +{ + return rT * cT; +} + +template +bool genType::is_scalar() +{ + return rT == 1 && cT == 1; +} + +template +bool genType::is_vector() +{ + return rT == 1; +} + +template +bool genType::is_matrix() +{ + return rT != 1; +} + +///////////////////////////////// +// Constructor + +template +genType::genType() +{ + memset(&this->value, 0, cT * rT * sizeof(vT)); +} + +template +genType::genType +( + typename genType::class_type const & m +) +{ + for + ( + typename genType::size_type i = typename genType::size_type(0); + i < genType::col_size(); + ++i + ) + { + this->value[i] = m[i]; + } +} + +template +genType::genType +( + typename genType::value_type const & x +) +{ + if(rT == 1) // vector + { + for + ( + typename genType::size_type i = typename genType::size_type(0); + i < genType::col_size(); + ++i + ) + { + this->value[i][rT] = x; + } + } + else // matrix + { + memset(&this->value, 0, cT * rT * sizeof(vT)); + + typename genType::size_type stop = cT < rT ? cT : rT; + + for + ( + typename genType::size_type i = typename genType::size_type(0); + i < stop; + ++i + ) + { + this->value[i][i] = x; + } + } +} + +template +genType::genType +( + typename genType::value_type const * const x +) +{ + memcpy(&this->value, &x.value, cT * rT * sizeof(vT)); +} + +template +genType::genType +( + typename genType::col_type const * const x +) +{ + for + ( + typename genType::size_type i = typename genType::size_type(0); + i < genType::col_size(); + ++i + ) + { + this->value[i] = x[i]; + } +} + +template +template +genType::genType +( + genType const & m +) +{ + for + ( + typename genType::size_type i = typename genType::size_type(0); + i < genType::col_size(); + ++i + ) + { + this->value[i] = genType(m[i]); + } +} + +////////////////////////////////////// +// Accesses + +template +typename genType::col_type& genType::operator[] +( + typename genType::size_type i +) +{ + return this->value[i]; +} + +template +typename genType::col_type const & genType::operator[] +( + typename genType::size_type i +) const +{ + return this->value[i]; +} + +////////////////////////////////////// +// Unary updatable operators + +template +typename genType::class_type& genType::operator= +( + typename genType::class_type const & x +) +{ + memcpy(&this->value, &x.value, cT * rT * sizeof(vT)); + return *this; +} + +template +typename genType::class_type& genType::operator+= +( + typename genType::value_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] += x; + + return *this; +} + +template +typename genType::class_type& genType::operator+= +( + typename genType::class_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] += x[j][i]; + + return *this; +} + +template +typename genType::class_type& genType::operator-= +( + typename genType::value_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] -= x; + + return *this; +} + +template +typename genType::class_type& genType::operator-= +( + typename genType::class_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] -= x[j][i]; + + return *this; +} + +template +typename genType::class_type& genType::operator*= +( + typename genType::value_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] *= x; + + return *this; +} + +template +typename genType::class_type& genType::operator*= +( + typename genType::class_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] *= x[j][i]; + + return *this; +} + +template +typename genType::class_type& genType::operator/= +( + typename genType::value_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] /= x; + + return *this; +} + +template +typename genType::class_type& genType::operator/= +( + typename genType::class_type const & x +) +{ + typename genType::size_type stop_col = x.col_size(); + typename genType::size_type stop_row = x.row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + this->value[j][i] /= x[j][i]; + + return *this; +} + +template +typename genType::class_type& genType::operator++ () +{ + typename genType::size_type stop_col = col_size(); + typename genType::size_type stop_row = row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + ++this->value[j][i]; + + return *this; +} + +template +typename genType::class_type& genType::operator-- () +{ + typename genType::size_type stop_col = col_size(); + typename genType::size_type stop_row = row_size(); + + for(typename genType::size_type j = 0; j < stop_col; ++j) + for(typename genType::size_type i = 0; i < stop_row; ++i) + --this->value[j][i]; + + return *this; +} + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_half.hpp b/glm/core/type_half.hpp new file mode 100644 index 0000000..c2d7883 --- /dev/null +++ b/glm/core/type_half.hpp @@ -0,0 +1,85 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-17 +// Updated : 2009-11-12 +// Licence : This source is under MIT License +// File : glm/core/type_half.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_half +#define glm_core_type_half + +#include + +namespace glm +{ + namespace test + { + bool main_type_half(); + + }//namespace test + + namespace detail + { + typedef short hdata; + + float toFloat32(hdata value); + hdata toFloat16(float const & value); + + class thalf + { + public: + // Constructors + thalf(); + thalf(thalf const & s); + + template + thalf(U const & s); + + // Cast + //operator float(); + operator float() const; + //operator double(); + //operator double() const; + + // Unary updatable operators + thalf& operator= (thalf const & s); + thalf& operator+=(thalf const & s); + thalf& operator-=(thalf const & s); + thalf& operator*=(thalf const & s); + thalf& operator/=(thalf const & s); + thalf& operator++(); + thalf& operator--(); + + float toFloat() const{return toFloat32(data);} + + hdata _data() const{return data;} + + private: + hdata data; + }; + + thalf operator+ (thalf const & s1, thalf const & s2); + + thalf operator- (thalf const & s1, thalf const & s2); + + thalf operator* (thalf const & s1, thalf const & s2); + + thalf operator/ (thalf const & s1, thalf const & s2); + + // Unary constant operators + thalf operator- (thalf const & s); + + thalf operator-- (thalf const & s, int); + + thalf operator++ (thalf const & s, int); + + }//namespace detail + + +}//namespace glm + +#include "type_half.inl" + +#endif//glm_core_type_half diff --git a/glm/core/type_half.inl b/glm/core/type_half.inl new file mode 100644 index 0000000..6045293 --- /dev/null +++ b/glm/core/type_half.inl @@ -0,0 +1,357 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-17 +// Updated : 2009-11-12 +// Licence : This source is under MIT License +// File : glm/core/type_half.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Copyright: +// This half implementation is based on OpenEXR which is Copyright (c) 2002, +// Industrial Light & Magic, a division of Lucas Digital Ltd. LLC +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "_detail.hpp" + +namespace glm{ +namespace detail +{ + inline float overflow() + { + volatile float f = 1e10; + + for(int i = 0; i < 10; ++i) + f *= f; // this will overflow before + // the for­loop terminates + return f; + } + + inline float toFloat32(hdata value) + { + int s = (value >> 15) & 0x00000001; + int e = (value >> 10) & 0x0000001f; + int m = value & 0x000003ff; + + if(e == 0) + { + if(m == 0) + { + // + // Plus or minus zero + // + + detail::uif result; + result.i = s << 31; + return result.f; + } + else + { + // + // Denormalized number -- renormalize it + // + + while(!(m & 0x00000400)) + { + m <<= 1; + e -= 1; + } + + e += 1; + m &= ~0x00000400; + } + } + else if(e == 31) + { + if(m == 0) + { + // + // Positive or negative infinity + // + + uif result; + result.i = (s << 31) | 0x7f800000; + return result.f; + } + else + { + // + // Nan -- preserve sign and significand bits + // + + uif result; + result.i = (s << 31) | 0x7f800000 | (m << 13); + return result.f; + } + } + + // + // Normalized number + // + + e = e + (127 - 15); + m = m << 13; + + // + // Assemble s, e and m. + // + + uif Result; + Result.i = (s << 31) | (e << 23) | m; + return Result.f; + } + + inline hdata toFloat16(float const & f) + { + uif Entry; + Entry.f = f; + int i = Entry.i; + + // + // Our floating point number, f, is represented by the bit + // pattern in integer i. Disassemble that bit pattern into + // the sign, s, the exponent, e, and the significand, m. + // Shift s into the position where it will go in in the + // resulting half number. + // Adjust e, accounting for the different exponent bias + // of float and half (127 versus 15). + // + + register int s = (i >> 16) & 0x00008000; + register int e = ((i >> 23) & 0x000000ff) - (127 - 15); + register int m = i & 0x007fffff; + + // + // Now reassemble s, e and m into a half: + // + + if(e <= 0) + { + if(e < -10) + { + // + // E is less than -10. The absolute value of f is + // less than half_MIN (f may be a small normalized + // float, a denormalized float or a zero). + // + // We convert f to a _halfGTX zero. + // + + return 0; + } + + // + // E is between -10 and 0. F is a normalized float, + // whose magnitude is less than __half_NRM_MIN. + // + // We convert f to a denormalized _halfGTX. + // + + m = (m | 0x00800000) >> (1 - e); + + // + // Round to nearest, round "0.5" up. + // + // Rounding may cause the significand to overflow and make + // our number normalized. Because of the way a half's bits + // are laid out, we don't have to treat this case separately; + // the code below will handle it correctly. + // + + if(m & 0x00001000) + m += 0x00002000; + + // + // Assemble the _halfGTX from s, e (zero) and m. + // + + return hdata(s | (m >> 13)); + } + else if(e == 0xff - (127 - 15)) + { + if(m == 0) + { + // + // F is an infinity; convert f to a half + // infinity with the same sign as f. + // + + return hdata(s | 0x7c00); + } + else + { + // + // F is a NAN; we produce a half NAN that preserves + // the sign bit and the 10 leftmost bits of the + // significand of f, with one exception: If the 10 + // leftmost bits are all zero, the NAN would turn + // into an infinity, so we have to set at least one + // bit in the significand. + // + + m >>= 13; + + return hdata(s | 0x7c00 | m | (m == 0)); + } + } + else + { + // + // E is greater than zero. F is a normalized float. + // We try to convert f to a normalized half. + // + + // + // Round to nearest, round "0.5" up + // + + if(m & 0x00001000) + { + m += 0x00002000; + + if(m & 0x00800000) + { + m = 0; // overflow in significand, + e += 1; // adjust exponent + } + } + + // + // Handle exponent overflow + // + + if (e > 30) + { + overflow(); // Cause a hardware floating point overflow; + + return hdata(s | 0x7c00); + // if this returns, the half becomes an + } // infinity with the same sign as f. + + // + // Assemble the half from s, e and m. + // + + return hdata(s | (e << 10) | (m >> 13)); + } + } + + inline thalf::thalf() : + data(0) + {} + + inline thalf::thalf(thalf const & s) : + data(s.data) + {} + + template + inline thalf::thalf(U const & s) : + data(toFloat16(float(s))) + {} + + // Cast + //inline half::operator float() + //{ + // return toFloat(); + //} + + inline thalf::operator float() const + { + return toFloat(); + } + + //inline half::operator double() + //{ + // return double(toFloat()); + //} + + //inline half::operator double() const + //{ + // return double(toFloat()); + //} + + // Unary updatable operators + inline thalf& thalf::operator= (thalf const & s) + { + data = s.data; + return *this; + } + + inline thalf& thalf::operator+=(thalf const & s) + { + data = toFloat16(toFloat32(data) + toFloat32(s.data)); + return *this; + } + + inline thalf& thalf::operator-=(thalf const & s) + { + data = toFloat16(toFloat32(data) - toFloat32(s.data)); + return *this; + } + + inline thalf& thalf::operator*=(thalf const & s) + { + data = toFloat16(toFloat32(data) * toFloat32(s.data)); + return *this; + } + + inline thalf& thalf::operator/=(thalf const & s) + { + data = toFloat16(toFloat32(data) / toFloat32(s.data)); + return *this; + } + + inline thalf& thalf::operator++() + { + float Casted = toFloat32(data); + data = toFloat16(++Casted); + return *this; + } + + inline thalf& thalf::operator--() + { + float Casted = toFloat32(data); + data = toFloat16(--Casted); + return *this; + } + + ////////////////////////////////////// + // Binary arithmetic operators + + inline detail::thalf operator+ (detail::thalf const & s1, detail::thalf const & s2) + { + return detail::thalf(float(s1) + float(s2)); + } + + inline detail::thalf operator- (detail::thalf const & s1, detail::thalf const & s2) + { + return detail::thalf(float(s1) - float(s2)); + } + + inline detail::thalf operator* (detail::thalf const & s1, detail::thalf const & s2) + { + return detail::thalf(float(s1) * float(s2)); + } + + inline detail::thalf operator/ (detail::thalf const & s1, detail::thalf const & s2) + { + return detail::thalf(float(s1) / float(s2)); + } + + // Unary constant operators + inline detail::thalf operator- (detail::thalf const & s) + { + return detail::thalf(-float(s)); + } + + inline detail::thalf operator-- (detail::thalf const & s, int) + { + return detail::thalf(float(s) - 1.0f); + } + + inline detail::thalf operator++ (detail::thalf const & s, int) + { + return detail::thalf(float(s) + 1.0f); + } + +}//namespace detail +}//namespace glm diff --git a/glm/core/type_int.hpp b/glm/core/type_int.hpp new file mode 100644 index 0000000..98f0e34 --- /dev/null +++ b/glm/core/type_int.hpp @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-22 +// Updated : 2008-09-17 +// Licence : This source is under MIT License +// File : glm/core/type_int.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_int +#define glm_core_type_int + +#include "../setup.hpp" +#include "_detail.hpp" + +namespace glm +{ + namespace detail + { +#if defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC) + typedef signed __int64 highp_int_t; + typedef unsigned __int64 highp_uint_t; +#elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC)) + __extension__ typedef signed long long highp_int_t; + __extension__ typedef unsigned long long highp_uint_t; +//# 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 +#else + typedef signed long highp_int_t; + typedef unsigned long highp_uint_t; +#endif//GLM_COMPILER + + GLM_DETAIL_IS_INT(signed char); + GLM_DETAIL_IS_INT(signed short); + GLM_DETAIL_IS_INT(signed int); + GLM_DETAIL_IS_INT(signed long); + GLM_DETAIL_IS_INT(highp_int_t); + + GLM_DETAIL_IS_UINT(unsigned char); + GLM_DETAIL_IS_UINT(unsigned short); + GLM_DETAIL_IS_UINT(unsigned int); + GLM_DETAIL_IS_UINT(unsigned long); + GLM_DETAIL_IS_UINT(highp_uint_t); + } + //namespace detail + + namespace core{ + namespace type{ + namespace scalar{ + + namespace precision + { + typedef signed short lowp_int_t; + typedef signed int mediump_int_t; + typedef detail::highp_int_t highp_int_t; + + typedef unsigned short lowp_uint_t; + typedef unsigned int mediump_uint_t; + typedef detail::highp_uint_t highp_uint_t; + + //! Low precision signed integer. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification. + typedef lowp_int_t lowp_int; + //! Medium precision signed integer. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification. + typedef mediump_int_t mediump_int; + //! High precision signed integer. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification. + typedef highp_int_t highp_int; + + //! Low precision unsigned integer. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification. + typedef lowp_uint_t lowp_uint; + //! Medium precision unsigned integer. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification. + typedef mediump_uint_t mediump_uint; + //! High precision unsigned integer. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification. + typedef highp_uint_t highp_uint; + } + //namespace precision + +#ifndef GLM_PRECISION + typedef precision::mediump_int_t int_t; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_INT) + typedef precision::highp_int_t int_t; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_INT) + typedef precision::mediump_int_t int_t; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_INT) + typedef precision::lowp_int_t int_t; +#else + typedef mediump_int_t int_t; +# pragma message("GLM message: Precisson undefined for signed integer number."); +#endif//GLM_PRECISION + +#ifndef GLM_PRECISION + typedef precision::mediump_uint_t uint_t; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_UINT) + typedef precision::highp_uint_t uint_t; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_UINT) + typedef precision::mediump_uint_t uint_t; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_UINT) + typedef precision::lowp_uint_t uint_t; +#else + typedef precision::mediump_uint_t uint_t; +# pragma message("GLM message: Precisson undefined for unsigned integer number."); +#endif//GLM_PRECISION + + //! Unsigned integer. + //! From GLSL 1.30.8 specification section 4.1.3 Integers. + typedef uint_t uint; + + }//namespace scalar + }//namespace type + }//namespace core +} + +#endif//glm_core_type_int diff --git a/glm/core/type_mat2x2.hpp b/glm/core/type_mat2x2.hpp new file mode 100644 index 0000000..8114ccf --- /dev/null +++ b/glm/core/type_mat2x2.hpp @@ -0,0 +1,221 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-01-27 +// Updated : 2008-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_mat2x2.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat2x2 +#define glm_core_type_mat2x2 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat2x2(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 2 * 2 matrix of floating-point numbers. + template + struct tmat2x2 + { + public: + typedef tmat2x2* pointer; + typedef const tmat2x2* const_pointer; + typedef const tmat2x2*const const_pointer_const; + typedef tmat2x2*const pointer_const; + typedef tmat2x2& reference; + typedef const tmat2x2& const_reference; + typedef const tmat2x2& param_type; + typedef tmat2x2 transpose_type; + + typedef T value_type; + typedef detail::tvec2 col_type; + typedef detail::tvec2 row_type; + typedef glm::sizeType size_type; + static size_type value_size(); + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat2x2 _inverse() const; + + private: + // Data + detail::tvec2 value[2]; + + public: + // Constructors + tmat2x2(); + tmat2x2(tmat2x2 const & m); + + explicit tmat2x2(const T x); + explicit tmat2x2( + const T x1, const T y1, + const T x2, const T y2); + explicit tmat2x2( + const detail::tvec2 & v1, + const detail::tvec2 & v2); + + // Conversions + template + explicit tmat2x2(const tmat2x2& m); + + explicit tmat2x2(const tmat3x3& x); + explicit tmat2x2(const tmat4x4& x); + explicit tmat2x2(const tmat2x3& x); + explicit tmat2x2(const tmat3x2& x); + explicit tmat2x2(const tmat2x4& x); + explicit tmat2x2(const tmat4x2& x); + explicit tmat2x2(const tmat3x4& x); + explicit tmat2x2(const tmat4x3& x); + + ////////////////////////////////////// + // Accesses + + detail::tvec2& operator[](size_type i); + detail::tvec2 const & operator[](size_type i) const; + + // Unary updatable operators + tmat2x2& operator=(tmat2x2 const & m); + tmat2x2& operator+=(const T & s); + tmat2x2& operator+=(tmat2x2 const & m); + tmat2x2& operator-=(const T & s); + tmat2x2& operator-=(tmat2x2 const & m); + tmat2x2& operator*=(const T & s); + tmat2x2& operator*= (tmat2x2 const & m); + tmat2x2& operator/= (const T & s); + tmat2x2& operator/= (tmat2x2 const & m); + tmat2x2& operator++ (); + tmat2x2& operator-- (); + }; + + // Binary operators + template + tmat2x2 operator+ (tmat2x2 const & m, const T & s); + + template + tmat2x2 operator+ (const T & s, tmat2x2 const & m); + + template + tmat2x2 operator+ (tmat2x2 const & m1, tmat2x2 const & m2); + + template + tmat2x2 operator- (tmat2x2 const & m, const T & s); + + template + tmat2x2 operator- (const T & s, tmat2x2 const & m); + + template + tmat2x2 operator- (tmat2x2 const & m1, tmat2x2 const & m2); + + template + tmat2x2 operator* (tmat2x2 const & m, const T & s); + + template + tmat2x2 operator* (const T & s, tmat2x2 const & m); + + template + tvec2 operator* (tmat2x2 const & m, const tvec2& v); + + template + tvec2 operator* (const tvec2& v, tmat2x2 const & m); + + template + tmat2x2 operator* (tmat2x2 const & m1, tmat2x2 const & m2); + + template + tmat2x2 operator/ (tmat2x2 const & m, const T & s); + + template + tmat2x2 operator/ (const T & s, tmat2x2 const & m); + + template + tvec2 operator/ (tmat2x2 const & m, const tvec2& v); + + template + tvec2 operator/ (const tvec2& v, tmat2x2 const & m); + + template + tmat2x2 operator/ (tmat2x2 const & m1, tmat2x2 const & m2); + + // Unary constant operators + template + tmat2x2 const operator- (tmat2x2 const & m); + + template + tmat2x2 const operator-- (tmat2x2 const & m, int); + + template + tmat2x2 const operator++ (tmat2x2 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 2 columns of 2 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x2 lowp_mat2x2; + //! 2 columns of 2 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x2 mediump_mat2x2; + //! 2 columns of 2 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x2 highp_mat2x2; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 2 columns of 2 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat2x2 mat2x2; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat2x2 mat2x2; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat2x2 mat2x2; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat2x2 mat2x2; +#else + typedef detail::tmat2x2 mat2x2; +#endif//GLM_PRECISION + + //! 2 columns of 2 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef mat2x2 mat2; + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat2x2.inl" + +#endif //glm_core_type_mat2x2 diff --git a/glm/core/type_mat2x2.inl b/glm/core/type_mat2x2.inl new file mode 100644 index 0000000..8476c41 --- /dev/null +++ b/glm/core/type_mat2x2.inl @@ -0,0 +1,463 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-01-16 +// Updated : 2007-03-01 +// Licence : This source is under MIT License +// File : glm/core/type_mat2x2.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat2x2::size_type tmat2x2::value_size() + { + return typename tmat2x2::size_type(2); + } + + template + typename tmat2x2::size_type tmat2x2::col_size() + { + return typename tmat2x2::size_type(2); + } + + template + typename tmat2x2::size_type tmat2x2::row_size() + { + return typename tmat2x2::size_type(2); + } + + template + bool tmat2x2::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec2& tmat2x2::operator[](typename tmat2x2::size_type i) + { + assert( + i >= typename tmat2x2::size_type(0) && + i < tmat2x2::col_size()); + + return value[i]; + } + + template + const detail::tvec2& tmat2x2::operator[](typename tmat2x2::size_type i) const + { + assert( + i >= typename tmat2x2::size_type(0) && + i < tmat2x2::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // mat2 constructors + + template + inline tmat2x2::tmat2x2() + { + this->value[0] = detail::tvec2(1, 0); + this->value[1] = detail::tvec2(0, 1); + } + + template + inline tmat2x2::tmat2x2(const tmat2x2 & m) + { + this->value[0] = m.value[0]; + this->value[1] = m.value[1]; + } + + template + inline tmat2x2::tmat2x2(const T f) + { + this->value[0] = detail::tvec2(f, 0); + this->value[1] = detail::tvec2(0, f); + } + + template + inline tmat2x2::tmat2x2(const T x0, const T y0, const T x1, const T y1) + { + this->value[0] = detail::tvec2(x0, y0); + this->value[1] = detail::tvec2(x1, y1); + } + + template + inline tmat2x2::tmat2x2(const detail::tvec2& v0, const detail::tvec2& v1) + { + this->value[0] = v0; + this->value[1] = v1; + } + + ////////////////////////////////////////////////////////////// + // mat2 conversions + + template + template + inline tmat2x2::tmat2x2(const tmat2x2& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + } + + template + inline tmat2x2::tmat2x2(const tmat3x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + } + + template + inline tmat2x2::tmat2x2(const tmat4x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + } + + template + inline tmat2x2::tmat2x2(const tmat2x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + } + + template + inline tmat2x2::tmat2x2(const tmat3x2& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + } + + template + inline tmat2x2::tmat2x2(const tmat2x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + } + + template + inline tmat2x2::tmat2x2(const tmat4x2& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + } + + template + inline tmat2x2::tmat2x2(const tmat3x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + } + + template + inline tmat2x2::tmat2x2(const tmat4x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + } + +/* + template + inline tmat2x2::tmat2x2(const T* a) + { + this->value[0] = detail::tvec2(a[0], a[1]); + this->value[1] = detail::tvec2(a[2], a[3]); + } +*/ + + template + inline tmat2x2 tmat2x2::_inverse() const + { + T Determinant = value[0][0] * value[1][1] - value[1][0] * value[0][1]; + + tmat2x2 Inverse( + + value[1][1] / Determinant, + - value[1][0] / Determinant, + - value[0][1] / Determinant, + + value[0][0] / Determinant); + return Inverse; + } + + ////////////////////////////////////////////////////////////// + // mat3 operators + + // This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared + template + inline tmat2x2& tmat2x2::operator=(tmat2x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator+= (const T & s) + { + this->value[0] += s; + this->value[1] += s; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator+= (tmat2x2 const & m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator-= (const T & s) + { + this->value[0] -= s; + this->value[1] -= s; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator-= (tmat2x2 const & m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator*= (const T & s) + { + this->value[0] *= s; + this->value[1] *= s; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator*= (tmat2x2 const & m) + { + return (*this = *this * m); + } + + template + inline tmat2x2& tmat2x2::operator/= (const T & s) + { + this->value[0] /= s; + this->value[1] /= s; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator/= (tmat2x2 const & m) + { + return (*this = *this / m); + } + + template + inline tmat2x2& tmat2x2::operator++ () + { + ++this->value[0]; + ++this->value[1]; + return *this; + } + + template + inline tmat2x2& tmat2x2::operator-- () + { + --this->value[0]; + --this->value[1]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat2x2 operator+ (tmat2x2 const & m, const T & s) + { + return tmat2x2( + m[0] + s, + m[1] + s); + } + + template + inline tmat2x2 operator+ (const T & s, tmat2x2 const & m) + { + return tmat2x2( + m[0] + s, + m[1] + s); + } + + //template + //inline detail::tvec2 operator+ (tmat2x2 const & m, const detail::tvec2& v) + //{ + + //} + + //template + //inline detail::tvec2 operator+ (const detail::tvec2& v, tmat2x2 const & m) + //{ + + //} + + template + inline tmat2x2 operator+ (tmat2x2 const & m1, tmat2x2 const & m2) + { + return tmat2x2( + m1[0] + m2[0], + m1[1] + m2[1]); + } + + template + inline tmat2x2 operator- (tmat2x2 const & m, const T & s) + { + return tmat2x2( + m[0] - s, + m[1] - s); + } + + template + inline tmat2x2 operator- (const T & s, tmat2x2 const & m) + { + return tmat2x2( + s - m[0], + s - m[1]); + } + + //template + //inline tmat2x2 operator- (tmat2x2 const & m, const detail::tvec2& v) + //{ + + //} + + //template + //inline tmat2x2 operator- (const detail::tvec2& v, tmat2x2 const & m) + //{ + + //} + + template + inline tmat2x2 operator- (tmat2x2 const & m1, tmat2x2 const & m2) + { + return tmat2x2( + m1[0] - m2[0], + m1[1] - m2[1]); + } + + template + inline tmat2x2 operator* (tmat2x2 const & m, const T & s) + { + return tmat2x2( + m[0] * s, + m[1] * s); + } + + template + inline tmat2x2 operator* (const T & s, tmat2x2 const & m) + { + return tmat2x2( + m[0] * s, + m[1] * s); + } + + template + inline detail::tvec2 operator* (tmat2x2 const & m, const detail::tvec2& v) + { + return detail::tvec2( + m[0][0] * v.x + m[1][0] * v.y, + m[0][1] * v.x + m[1][1] * v.y); + } + + template + inline detail::tvec2 operator* (const detail::tvec2& v, tmat2x2 const & m) + { + return detail::tvec2( + m[0][0] * v.x + m[0][1] * v.y, + m[1][0] * v.x + m[1][1] * v.y); + } + + template + inline tmat2x2 operator* (tmat2x2 const & m1, tmat2x2 const & m2) + { + return tmat2x2( + m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1], + m1[0][1] * m2[0][0] + m1[1][1] * m2[0][1], + m1[0][0] * m2[1][0] + m1[1][0] * m2[1][1], + m1[0][1] * m2[1][0] + m1[1][1] * m2[1][1]); + } + + template + inline tmat2x2 operator/ (tmat2x2 const & m, const T & s) + { + return tmat2x2( + m[0] / s, + m[1] / s); + } + + template + inline tmat2x2 operator/ (const T & s, tmat2x2 const & m) + { + return tmat2x2( + s / m[0], + s / m[1]); + } + + template + inline detail::tvec2 operator/ (tmat2x2 const & m, const detail::tvec2& v) + { + return m._inverse() * v; + } + + template + inline detail::tvec2 operator/ (const detail::tvec2& v, tmat2x2 const & m) + { + return v * m._inverse(); + } + + template + inline tmat2x2 operator/ (tmat2x2 const & m1, tmat2x2 const & m2) + { + return m1 * m2._inverse(); + } + + // Unary constant operators + template + inline tmat2x2 const operator- + ( + tmat2x2 const & m + ) + { + return tmat2x2( + -m[0], + -m[1]); + } + + template + inline tmat2x2 const operator++ + ( + tmat2x2 const & m, + int + ) + { + return tmat2x2( + m[0] + valType(1), + m[1] + valType(1)); + } + + template + inline tmat2x2 const operator-- + ( + tmat2x2 const & m, + int + ) + { + return tmat2x2( + m[0] - valType(1), + m[1] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_mat2x3.hpp b/glm/core/type_mat2x3.hpp new file mode 100644 index 0000000..caec93e --- /dev/null +++ b/glm/core/type_mat2x3.hpp @@ -0,0 +1,212 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-10-01 +// Updated : 2008-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_mat2x3.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat2x3 +#define glm_core_type_mat2x3 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat2x3(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 2 * 3 matrix of floating-point numbers. + template + struct tmat2x3 + { + public: + typedef tmat2x3* pointer; + typedef const tmat2x3* const_pointer; + typedef const tmat2x3*const const_pointer_const; + typedef tmat2x3*const pointer_const; + typedef tmat2x3& reference; + typedef const tmat2x3& const_reference; + typedef const tmat2x3& param_type; + typedef tmat3x2 transpose_type; + + typedef T value_type; + typedef detail::tvec3 col_type; + typedef detail::tvec2 row_type; + typedef glm::sizeType size_type; + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat3x2 _inverse() const; + + private: + // Data + detail::tvec3 value[2]; + + public: + // Constructors + tmat2x3(); + explicit tmat2x3(const T x); + explicit tmat2x3( + const T x0, const T y0, const T z0, + const T x1, const T y1, const T z1); + explicit tmat2x3( + const detail::tvec3& v0, + const detail::tvec3& v1); + + // Conversion + template + explicit tmat2x3(const tmat2x3& m); + + explicit tmat2x3(const tmat2x2& x); + explicit tmat2x3(const tmat3x3& x); + explicit tmat2x3(const tmat4x4& x); + explicit tmat2x3(const tmat2x4& x); + explicit tmat2x3(const tmat3x2& x); + explicit tmat2x3(const tmat3x4& x); + explicit tmat2x3(const tmat4x2& x); + explicit tmat2x3(const tmat4x3& x); + + // Accesses + detail::tvec3& operator[](size_type i); + detail::tvec3 const & operator[](size_type i) const; + + // Unary updatable operators + tmat2x3& operator= (const tmat2x3& m); + tmat2x3& operator+= (const T & s); + tmat2x3& operator+= (const tmat2x3& m); + tmat2x3& operator-= (const T & s); + tmat2x3& operator-= (const tmat2x3& m); + tmat2x3& operator*= (const T & s); + tmat2x3& operator*= (const tmat3x2& m); + tmat2x3& operator/= (const T & s); + // tmat2x3& operator/= (const tmat3x2& m); + + tmat2x3& operator++ (); + tmat2x3& operator-- (); + + // Unary constant operators + const tmat2x3 operator- () const; + const tmat2x3 operator++ (int n) const; + const tmat2x3 operator-- (int n) const; + }; + + // Binary operators + template + tmat2x3 operator+ (const tmat2x3& m, const T & s); + + template + tmat2x3 operator+ (const tmat2x3& m1, const tmat2x3& m2); + + template + tmat2x3 operator- (const tmat2x3& m, const T & s); + + template + tmat2x3 operator- (const tmat2x3& m1, const tmat2x3& m2); + + template + tmat2x3 operator* (const tmat2x3& m, const T & s); + + template + tmat2x3 operator* (const T & s, const tmat2x3& m); + + template + detail::tvec3 operator* (const tmat2x3& m, const detail::tvec2& v); + + template + detail::tvec3 operator* (const detail::tvec3& v, const tmat2x3& m); + + template + tmat3x3 operator* (const tmat2x3& m1, const tmat3x2& m2); + + template + tmat3x2 operator/ (const tmat2x3& m, const T & s); + + template + tmat3x2 operator/ (const T & s, const tmat2x3& m); + + //template + //detail::tvec3 operator/ (const tmat2x3& m, const detail::tvec2& v); + + //template + //detail::tvec2 operator/ (const detail::tvec3& v, const tmat2x3& m); + + //template + //tmat3x3 operator/ (const tmat3x2& m1, const tmat2x3& m2); + + // Unary constant operators + template + tmat2x3 const operator- (tmat2x3 const & m); + + template + tmat2x3 const operator-- (tmat2x3 const & m, int); + + template + tmat2x3 const operator++ (tmat2x3 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 2 columns of 3 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x3 lowp_mat2x3; + //! 2 columns of 3 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x3 mediump_mat2x3; + //! 2 columns of 3 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x3 highp_mat2x3; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 2 columns of 3 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat2x3 mat2x3; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_FLOAT) + typedef detail::tmat2x3 mat2x3; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_FLOAT) + typedef detail::tmat2x3 mat2x3; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_FLOAT) + typedef detail::tmat2x3 mat2x3; +#else + typedef detail::tmat2x3 mat2x3; +#endif//GLM_PRECISION + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat2x3.inl" + +#endif //glm_core_type_mat2x3 diff --git a/glm/core/type_mat2x3.inl b/glm/core/type_mat2x3.inl new file mode 100644 index 0000000..5ec438c --- /dev/null +++ b/glm/core/type_mat2x3.inl @@ -0,0 +1,457 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-05 +// Updated : 2006-10-01 +// Licence : This source is under MIT License +// File : glm/core/type_mat2x3.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat2x3::size_type tmat2x3::col_size() + { + return typename tmat2x3::size_type(2); + } + + template + typename tmat2x3::size_type tmat2x3::row_size() + { + return typename tmat2x3::size_type(3); + } + + template + bool tmat2x3::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec3& tmat2x3::operator[](typename tmat2x3::size_type i) + { + assert( + i >= typename tmat2x3::size_type(0) && + i < tmat2x3::col_size()); + + return value[i]; + } + + template + const detail::tvec3& tmat2x3::operator[](typename tmat2x3::size_type i) const + { + assert( + i >= typename tmat2x3::size_type(0) && + i < tmat2x3::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // Constructors + + template + inline tmat2x3::tmat2x3() + { + this->value[0] = detail::tvec3(T(1), T(0), T(0)); + this->value[1] = detail::tvec3(T(0), T(1), T(0)); + } + + template + inline tmat2x3::tmat2x3(const T f) + { + this->value[0] = detail::tvec3(f, T(0), T(0)); + this->value[1] = detail::tvec3(T(0), f, T(0)); + } + + template + inline tmat2x3::tmat2x3 + ( + const T x0, const T y0, const T z0, + const T x1, const T y1, const T z1 + ) + { + this->value[0] = detail::tvec3(x0, y0, z0); + this->value[1] = detail::tvec3(x1, y1, z1); + } + + template + inline tmat2x3::tmat2x3 + ( + const detail::tvec3 & v0, + const detail::tvec3 & v1 + ) + { + this->value[0] = v0; + this->value[1] = v1; + } + + // Conversion + template + template + inline tmat2x3::tmat2x3(const tmat2x3& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + } + + template + inline tmat2x3::tmat2x3(tmat2x2 const & m) + { + this->value[0] = detail::tvec3(m[0], T(0)); + this->value[1] = detail::tvec3(m[1], T(0)); + } + + template + inline tmat2x3::tmat2x3(const tmat3x3& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + } + + template + inline tmat2x3::tmat2x3(const tmat4x4& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + } + + template + inline tmat2x3::tmat2x3(const tmat2x4& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + } + + template + inline tmat2x3::tmat2x3(const tmat3x2& m) + { + this->value[0] = detail::tvec3(m[0], T(0)); + this->value[1] = detail::tvec3(m[1], T(0)); + } + + template + inline tmat2x3::tmat2x3(const tmat3x4& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + } + + template + inline tmat2x3::tmat2x3(const tmat4x2& m) + { + this->value[0] = detail::tvec3(m[0], T(0)); + this->value[1] = detail::tvec3(m[1], T(0)); + } + + template + inline tmat2x3::tmat2x3(const tmat4x3& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + } + + ////////////////////////////////////////////////////////////// + // Unary updatable operators + + template + inline tmat2x3& tmat2x3::operator= (const tmat2x3& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } + + template + inline tmat2x3& tmat2x3::operator+= (const T & s) + { + this->value[0] += s; + this->value[1] += s; + return *this; + } + + template + inline tmat2x3& tmat2x3::operator+= (const tmat2x3& m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + return *this; + } + + template + inline tmat2x3& tmat2x3::operator-= (const T & s) + { + this->value[0] -= s; + this->value[1] -= s; + return *this; + } + + template + inline tmat2x3& tmat2x3::operator-= (const tmat2x3& m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + return *this; + } + + template + inline tmat2x3& tmat2x3::operator*= (const T & s) + { + this->value[0] *= s; + this->value[1] *= s; + return *this; + } + + template + inline tmat2x3& tmat2x3::operator*= (const tmat3x2& m) + { + return (*this = tmat2x3(*this * m)); + } + + template + inline tmat2x3 & tmat2x3::operator/= (const T & s) + { + this->value[0] /= s; + this->value[1] /= s; + return *this; + } +/* ToDo + template + inline tmat2x3& tmat2x3::operator/= (const tmat3x2& m) + { + return (*this = tmat2x3(*this / m)); + } +*/ + template + inline tmat2x3& tmat2x3::operator++ () + { + ++this->value[0]; + ++this->value[1]; + return *this; + } + + template + inline tmat2x3& tmat2x3::operator-- () + { + --this->value[0]; + --this->value[1]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // Unary constant operators + template + inline const tmat2x3 tmat2x3::operator- () const + { + return tmat2x3( + -this->value[0], + -this->value[1]); + } + + template + inline const tmat2x3 tmat2x3::operator-- (int n) const + { + tmat2x3 m = *this; + --m[0]; + --m[1]; + return m; + } + + template + inline const tmat2x3 tmat2x3::operator++ (int n) const + { + tmat2x3 m = *this; + ++m[0]; + ++m[1]; + return m; + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat2x3 operator+ (const tmat2x3& m, const T & s) + { + return tmat2x3( + m[0] + s, + m[1] + s); + } + + template + inline tmat2x3 operator+ (const tmat2x3& m1, const tmat2x3& m2) + { + return tmat2x3( + m1[0] + m2[0], + m1[1] + m2[1]); + } + + template + inline tmat2x3 operator- (const tmat2x3& m, const T & s) + { + return tmat2x3( + m[0] - s, + m[1] - s); + } + + template + inline tmat2x3 operator- (const tmat2x3& m1, const tmat2x3& m2) + { + return tmat2x3( + m1[0] - m2[0], + m1[1] - m2[1]); + } + + template + inline tmat2x3 operator* (const tmat2x3& m, const T & s) + { + return tmat2x3( + m[0] * s, + m[1] * s); + } + + template + inline tmat2x3 operator* (const T & s, const tmat2x3 & m) + { + return tmat2x3( + m[0] * s, + m[1] * s); + } + + template + inline detail::tvec3 operator* (const tmat2x3& m, const detail::tvec2& v) + { + return detail::tvec3( + m[0][0] * v.x + m[1][0] * v.y, + m[0][1] * v.x + m[1][1] * v.y, + m[0][2] * v.x + m[1][2] * v.y, + m[0][3] * v.x + m[1][3] * v.y); + } + + template + inline detail::tvec2 operator* (const detail::tvec3& v, const tmat2x3& m) + { + return detail::tvec2( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); + } + + template + inline tmat3x3 operator* (const tmat2x3& m1, const tmat3x2& m2) + { + const T SrcA00 = m1[0][0]; + const T SrcA01 = m1[0][1]; + const T SrcA02 = m1[0][2]; + const T SrcA10 = m1[1][0]; + const T SrcA11 = m1[1][1]; + const T SrcA12 = m1[1][2]; + + const T SrcB00 = m2[0][0]; + const T SrcB01 = m2[0][1]; + const T SrcB10 = m2[1][0]; + const T SrcB11 = m2[1][1]; + const T SrcB20 = m2[2][0]; + const T SrcB21 = m2[2][1]; + + tmat3x3 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01; + Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11; + Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11; + Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21; + Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21; + Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21; + return Result; + } + + template + inline tmat2x3 operator/ (const tmat2x3& m, const T & s) + { + return tmat2x3( + m[0] / s, + m[1] / s, + m[2] / s); + } + + template + inline tmat2x3 operator/ (const T & s, const tmat2x3& m) + { + return tmat2x3( + s / m[0], + s / m[1], + s / m[2]); + } + + //template + //tvec3 operator/ + //( + // tmat3x2 const & m, + // tvec2 const & v + //) + //{ + // return m._inverse() * v; + //} + + //template + //tvec3 operator/ + //( + // tvec2 const & v, + // tmat3x2 const & m + //) + //{ + // return v * m._inverse(); + //} + + //template + //inline tmat2x2 operator/ + //( + // tmat3x2 const & m1, + // tmat2x3 const & m2 + //) + //{ + // return m1 * m2._inverse(); + //} + + // Unary constant operators + template + inline tmat2x3 const operator- + ( + tmat2x3 const & m + ) + { + return tmat2x3( + -m[0], + -m[1]); + } + + template + inline tmat2x3 const operator++ + ( + tmat2x3 const & m, + int + ) + { + return tmat2x3( + m[0] + valType(1), + m[1] + valType(1)); + } + + template + inline tmat2x3 const operator-- + ( + tmat2x3 const & m, + int + ) + { + return tmat2x3( + m[0] - valType(1), + m[1] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_mat2x4.hpp b/glm/core/type_mat2x4.hpp new file mode 100644 index 0000000..03ad7ce --- /dev/null +++ b/glm/core/type_mat2x4.hpp @@ -0,0 +1,208 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-05 +// Updated : 2008-08-25 +// Licence : This source is under MIT License +// File : glm/core/type_mat2x4.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat2x4 +#define glm_core_type_mat2x4 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat2x4(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 2 * 4 matrix of floating-point numbers. + template + struct tmat2x4 + { + public: + typedef tmat2x4* pointer; + typedef const tmat2x4* const_pointer; + typedef const tmat2x4*const const_pointer_const; + typedef tmat2x4*const pointer_const; + typedef tmat2x4& reference; + typedef const tmat2x4& const_reference; + typedef const tmat2x4& param_type; + typedef tmat4x2 transpose_type; + + typedef T value_type; + typedef detail::tvec2 col_type; + typedef detail::tvec4 row_type; + typedef glm::sizeType size_type; + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat4x2 _inverse() const; + + private: + // Data + detail::tvec4 value[2]; + + public: + // Constructors + tmat2x4(); + explicit tmat2x4(const T x); + explicit tmat2x4( + const T x0, const T y0, const T z0, const T w0, + const T x1, const T y1, const T z1, const T w1); + explicit tmat2x4( + const detail::tvec4& v0, + const detail::tvec4& v1); + + // Conversion + template + explicit tmat2x4(const tmat2x4& m); + + explicit tmat2x4(const tmat2x2& x); + explicit tmat2x4(const tmat3x3& x); + explicit tmat2x4(const tmat4x4& x); + explicit tmat2x4(const tmat2x3& x); + //explicit tmat2x4(const tmat2x4& x); + explicit tmat2x4(const tmat3x2& x); + explicit tmat2x4(const tmat3x4& x); + explicit tmat2x4(const tmat4x2& x); + explicit tmat2x4(const tmat4x3& x); + + // Accesses + detail::tvec4& operator[](size_type i); + detail::tvec4 const & operator[](size_type i) const; + + // Unary updatable operators + tmat2x4& operator= (const tmat2x4& m); + tmat2x4& operator+= (const T & s); + tmat2x4& operator+= (const tmat2x4& m); + tmat2x4& operator-= (const T & s); + tmat2x4& operator-= (const tmat2x4& m); + tmat2x4& operator*= (const T & s); + tmat2x4& operator*= (const tmat4x2& m); + tmat2x4& operator/= (const T & s); + //tmat2x4& operator/= (const tmat4x2& m); + + tmat2x4& operator++ (); + tmat2x4& operator-- (); + }; + + // Binary operators + template + tmat2x4 operator+ (const tmat2x4& m, const T & s); + + template + tmat2x4 operator+ (const tmat2x4& m1, const tmat2x4& m2); + + template + tmat2x4 operator- (const tmat2x4& m, const T & s); + + template + tmat2x4 operator- (const tmat2x4& m1, const tmat2x4& m2); + + template + tmat2x4 operator* (const tmat2x4& m, const T & s); + + template + tmat2x4 operator* (const T & s, const tmat2x4& m); + + template + detail::tvec4 operator* (const tmat2x4& m, const detail::tvec2& v); + + template + detail::tvec2 operator* (const detail::tvec4& v, const tmat2x4& m); + + template + tmat4x4 operator* (const tmat2x4& m1, const tmat4x2& m2); + + template + tmat4x2 operator/ (const tmat2x4& m, const T & s); + + template + tmat4x2 operator/ (const T & s, const tmat2x4& m); + + //template + //detail::tvec4 operator/ (const tmat2x4& m, const detail::tvec2& v); + + //template + //detail::tvec2 operator/ (const detail::tvec4& v, const tmat2x4& m); + + //template + //tmat4x4 operator/ (const tmat4x2& m1, const tmat2x4& m2); + + // Unary constant operators + template + tmat2x4 const operator- (tmat2x4 const & m); + + template + tmat2x4 const operator-- (tmat2x4 const & m, int); + + template + tmat2x4 const operator++ (tmat2x4 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 2 columns of 4 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x4 lowp_mat2x4; + //! 2 columns of 4 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x4 mediump_mat2x4; + //! 2 columns of 4 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat2x4 highp_mat2x4; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 2 columns of 4 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat2x4 mat2x4; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat2x4 mat2x4; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat2x4 mat2x4; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat2x4 mat2x4; +#else + typedef detail::tmat2x4 mat2x4; +#endif//GLM_PRECISION + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat2x4.inl" + +#endif //glm_core_type_mat2x4 diff --git a/glm/core/type_mat2x4.inl b/glm/core/type_mat2x4.inl new file mode 100644 index 0000000..026aa15 --- /dev/null +++ b/glm/core/type_mat2x4.inl @@ -0,0 +1,450 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-05 +// Updated : 2006-10-01 +// Licence : This source is under MIT License +// File : glm/core/type_mat2x4.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat2x4::size_type tmat2x4::col_size() + { + return typename tmat2x4::size_type(2); + } + + template + typename tmat2x4::size_type tmat2x4::row_size() + { + return typename tmat2x4::size_type(4); + } + + template + bool tmat2x4::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec4& tmat2x4::operator[](typename tmat2x4::size_type i) + { + assert( + i >= typename tmat2x4::size_type(0) && + i < tmat2x4::col_size()); + + return value[i]; + } + + template + const detail::tvec4& tmat2x4::operator[](typename tmat2x4::size_type i) const + { + assert( + i >= typename tmat2x4::size_type(0) && + i < tmat2x4::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // Constructors + + template + inline tmat2x4::tmat2x4() + { + this->value[0] = detail::tvec4(1, 0, 0, 0); + this->value[1] = detail::tvec4(0, 1, 0, 0); + } + + template + inline tmat2x4::tmat2x4(const T f) + { + this->value[0] = detail::tvec4(f, 0, 0, 0); + this->value[1] = detail::tvec4(0, f, 0, 0); + } + + template + inline tmat2x4::tmat2x4 + ( + const T x0, const T y0, const T z0, const T w0, + const T x1, const T y1, const T z1, const T w1 + ) + { + this->value[0] = detail::tvec4(x0, y0, z0, w0); + this->value[1] = detail::tvec4(x1, y1, z1, w1); + } + + template + inline tmat2x4::tmat2x4 + ( + const detail::tvec4 & v0, + const detail::tvec4 & v1 + ) + { + this->value[0] = v0; + this->value[1] = v1; + } + + // Conversion + template + template + inline tmat2x4::tmat2x4(const tmat2x4& m) + { + this->value[0] = detail::tvec4(m[0]); + this->value[1] = detail::tvec4(m[1]); + } + + template + inline tmat2x4::tmat2x4(tmat2x2 const & m) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(0)); + this->value[1] = detail::tvec4(m[1], detail::tvec2(0)); + } + + template + inline tmat2x4::tmat2x4(const tmat3x3& m) + { + this->value[0] = detail::tvec4(m[0], T(0)); + this->value[1] = detail::tvec4(m[1], T(0)); + } + + template + inline tmat2x4::tmat2x4(const tmat4x4& m) + { + this->value[0] = detail::tvec4(m[0]); + this->value[1] = detail::tvec4(m[1]); + } + + template + inline tmat2x4::tmat2x4(const tmat2x3& m) + { + this->value[0] = detail::tvec4(m[0], T(0)); + this->value[1] = detail::tvec4(m[1], T(0)); + } + + template + inline tmat2x4::tmat2x4(const tmat3x2& m) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(0)); + this->value[1] = detail::tvec4(m[1], detail::tvec2(0)); + } + + template + inline tmat2x4::tmat2x4(const tmat3x4& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + } + + template + inline tmat2x4::tmat2x4(const tmat4x2& m) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(T(0))); + this->value[1] = detail::tvec4(m[1], detail::tvec2(T(0))); + } + + template + inline tmat2x4::tmat2x4(const tmat4x3& m) + { + this->value[0] = detail::tvec4(m[0], T(0)); + this->value[1] = detail::tvec4(m[1], T(0)); + } + + ////////////////////////////////////////////////////////////// + // Unary updatable operators + + template + inline tmat2x4& tmat2x4::operator= (const tmat2x4& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + return *this; + } + + template + inline tmat2x4& tmat2x4::operator+= (const T & s) + { + this->value[0] += s; + this->value[1] += s; + return *this; + } + + template + inline tmat2x4& tmat2x4::operator+= (const tmat2x4& m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + return *this; + } + + template + inline tmat2x4& tmat2x4::operator-= (const T & s) + { + this->value[0] -= s; + this->value[1] -= s; + return *this; + } + + template + inline tmat2x4& tmat2x4::operator-= (const tmat2x4& m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + return *this; + } + + template + inline tmat2x4& tmat2x4::operator*= (const T & s) + { + this->value[0] *= s; + this->value[1] *= s; + return *this; + } + + template + inline tmat2x4& tmat2x4::operator*= (const tmat4x2& m) + { + return (*this = tmat2x4(*this * m)); + } + + template + inline tmat2x4 & tmat2x4::operator/= (const T & s) + { + this->value[0] /= s; + this->value[1] /= s; + return *this; + } +/* ToDo + template + inline tmat2x4& tmat2x4::operator/= (const tmat4x2& m) + { + return (*this = tmat2x4(*this / m)); + } +*/ + template + inline tmat2x4& tmat2x4::operator++ () + { + ++this->value[0]; + ++this->value[1]; + return *this; + } + + template + inline tmat2x4& tmat2x4::operator-- () + { + --this->value[0]; + --this->value[1]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // inverse + template + inline tmat4x2 tmat2x4::_inverse() const + { + assert(0); //g.truc.creation[at]gmail.com + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat2x4 operator+ (const tmat2x4& m, const T & s) + { + return tmat2x4( + m[0] + s, + m[1] + s); + } + + template + inline tmat2x4 operator+ (const tmat2x4& m1, const tmat2x4& m2) + { + return tmat2x4( + m1[0] + m2[0], + m1[1] + m2[1]); + } + + template + inline tmat2x4 operator- (const tmat2x4& m, const T & s) + { + return tmat2x4( + m[0] - s, + m[1] - s); + } + + template + inline tmat2x4 operator- (const tmat2x4& m1, const tmat2x4& m2) + { + return tmat2x4( + m1[0] - m2[0], + m1[1] - m2[1]); + } + + template + inline tmat2x4 operator* (const tmat2x4& m, const T & s) + { + return tmat2x4( + m[0] * s, + m[1] * s); + } + + template + inline tmat2x4 operator* (const T & s, const tmat2x4 & m) + { + return tmat2x4( + m[0] * s, + m[1] * s); + } + + template + inline detail::tvec4 operator* (const tmat2x4& m, const detail::tvec2& v) + { + return detail::tvec4( + m[0][0] * v.x + m[1][0] * v.y, + m[0][1] * v.x + m[1][1] * v.y, + m[0][2] * v.x + m[1][2] * v.y, + m[0][3] * v.x + m[1][3] * v.y); + } + + template + inline detail::tvec2 operator* (const detail::tvec4& v, const tmat2x4& m) + { + return detail::tvec4( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); + } + + template + inline tmat4x4 operator* (const tmat2x4& m1, const tmat4x2& m2) + { + const T SrcA00 = m1[0][0]; + const T SrcA01 = m1[0][1]; + const T SrcA02 = m1[0][2]; + const T SrcA03 = m1[0][3]; + const T SrcA10 = m1[1][0]; + const T SrcA11 = m1[1][1]; + const T SrcA12 = m1[1][2]; + const T SrcA13 = m1[1][3]; + + const T SrcB00 = m2[0][0]; + const T SrcB01 = m2[0][1]; + const T SrcB10 = m2[1][0]; + const T SrcB11 = m2[1][1]; + const T SrcB20 = m2[2][0]; + const T SrcB21 = m2[2][1]; + const T SrcB30 = m2[3][0]; + const T SrcB31 = m2[3][1]; + + tmat4x4 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01; + Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01; + Result[0][3] = SrcA03 * SrcB00 + SrcA13 * SrcB01; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11; + Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11; + Result[1][3] = SrcA03 * SrcB10 + SrcA13 * SrcB11; + Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21; + Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21; + Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21; + Result[2][3] = SrcA03 * SrcB20 + SrcA13 * SrcB21; + Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31; + Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31; + Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31; + Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31; + return Result; + } + + template + inline tmat2x4 operator/ (const tmat2x4& m, const T & s) + { + return tmat2x4( + m[0] / s, + m[1] / s, + m[2] / s, + m[3] / s); + } + + template + inline tmat2x4 operator/ (const T & s, const tmat2x4& m) + { + return tmat2x4( + s / m[0], + s / m[1], + s / m[2], + s / m[3]); + } + + //template + //tvec4 operator/ + //( + // tmat4x2 const & m, + // tvec2 const & v + //) + //{ + // return m._inverse() * v; + //} + + //template + //tvec4 operator/ + //( + // tvec2 const & v, + // tmat4x2 const & m + //) + //{ + // return v * m._inverse(); + //} + + //template + //inline tmat2x2 operator/ + //( + // tmat4x2 const & m1, + // tmat2x4 const & m2 + //) + //{ + // return m1 * m2._inverse(); + //} + + // Unary constant operators + template + inline tmat2x4 const operator- + ( + tmat2x4 const & m + ) + { + return tmat2x4( + -m[0], + -m[1]); + } + + template + inline tmat2x4 const operator++ + ( + tmat2x4 const & m, + int + ) + { + return tmat2x4( + m[0] + valType(1), + m[1] + valType(1)); + } + + template + inline tmat2x4 const operator-- + ( + tmat2x4 const & m, + int + ) + { + return tmat2x4( + m[0] - valType(1), + m[1] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_mat3x2.hpp b/glm/core/type_mat3x2.hpp new file mode 100644 index 0000000..b9efeaa --- /dev/null +++ b/glm/core/type_mat3x2.hpp @@ -0,0 +1,209 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-05 +// Updated : 2008-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_mat3x2.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat3x2 +#define glm_core_type_mat3x2 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat3x2(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 3 * 2 matrix of floating-point numbers. + template + struct tmat3x2 + { + public: + typedef tmat3x2* pointer; + typedef const tmat3x2* const_pointer; + typedef const tmat3x2*const const_pointer_const; + typedef tmat3x2*const pointer_const; + typedef tmat3x2& reference; + typedef const tmat3x2& const_reference; + typedef const tmat3x2& param_type; + typedef tmat2x3 transpose_type; + + typedef T value_type; + typedef detail::tvec3 col_type; + typedef detail::tvec2 row_type; + typedef glm::sizeType size_type; + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat2x3 _inverse() const; + + private: + // Data + detail::tvec2 value[3]; + + public: + // Constructors + tmat3x2(); + explicit tmat3x2(const T x); + explicit tmat3x2( + const T x0, const T y0, + const T x1, const T y1, + const T x2, const T y2); + explicit tmat3x2( + const detail::tvec2& v0, + const detail::tvec2& v1, + const detail::tvec2& v2); + + // Conversion + template + explicit tmat3x2(const tmat3x2& m); + + explicit tmat3x2(const tmat2x2& x); + explicit tmat3x2(const tmat3x3& x); + explicit tmat3x2(const tmat4x4& x); + explicit tmat3x2(const tmat2x3& x); + explicit tmat3x2(const tmat2x4& x); + explicit tmat3x2(const tmat3x4& x); + explicit tmat3x2(const tmat4x2& x); + explicit tmat3x2(const tmat4x3& x); + + // Accesses + detail::tvec2& operator[](size_type i); + const detail::tvec2& operator[](size_type i) const; + + // Unary updatable operators + tmat3x2& operator= (const tmat3x2& m); + tmat3x2& operator+= (const T & s); + tmat3x2& operator+= (const tmat3x2& m); + tmat3x2& operator-= (const T & s); + tmat3x2& operator-= (const tmat3x2& m); + tmat3x2& operator*= (const T & s); + tmat3x2& operator*= (const tmat2x3& m); + tmat3x2& operator/= (const T & s); + //tmat3x2& operator/= (const tmat2x3& m); + + tmat3x2& operator++ (); + tmat3x2& operator-- (); + }; + + // Binary operators + template + tmat3x2 operator+ (const tmat3x2& m, const T & s); + + template + tmat3x2 operator+ (const tmat3x2& m1, const tmat3x2& m2); + + template + tmat3x2 operator- (const tmat3x2& m, const T & s); + + template + tmat3x2 operator- (const tmat3x2& m1, const tmat3x2& m2); + + template + tmat3x2 operator* (const tmat3x2& m, const T & s); + + template + tmat3x2 operator* (const T & s, const tmat3x4& m); + + template + detail::tvec2 operator* (const tmat3x2& m, const detail::tvec3& v); + + template + detail::tvec3 operator* (const detail::tvec2& v, const tmat3x2& m); + + template + tmat2x2 operator* (const tmat3x2& m1, const tmat2x3& m2); + + template + tmat2x3 operator/ (const tmat2x3& m, const T & s); + + template + tmat2x3 operator/ (const T s, const tmat2x3& m); + + //template + //detail::tvec2 operator/ (const tmat3x2& m, const detail::tvec3& v); + + //template + //detail::tvec3 operator/ (const detail::tvec2& v, const tmat3x2& m); + + //template + //tmat2x2 operator/ (const tmat2x3& m1, const tmat3x2& m2); + + // Unary constant operators + template + tmat3x2 const operator- (tmat3x2 const & m); + + template + tmat3x2 const operator-- (tmat3x2 const & m, int); + + template + tmat3x2 const operator++ (tmat3x2 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 3 columns of 2 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x2 lowp_mat3x2; + //! 3 columns of 2 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x2 mediump_mat3x2; + //! 3 columns of 2 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x2 highp_mat3x2; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 3 columns of 2 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat3x2 mat3x2; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat3x2 mat3x2; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat3x2 mat3x2; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat3x2 mat3x2; +#else + typedef detail::tmat3x2 mat3x2; +#endif//GLM_PRECISION + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat3x2.inl" + +#endif //glm_core_type_mat3x2 diff --git a/glm/core/type_mat3x2.inl b/glm/core/type_mat3x2.inl new file mode 100644 index 0000000..5106517 --- /dev/null +++ b/glm/core/type_mat3x2.inl @@ -0,0 +1,465 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-05 +// Updated : 2006-10-01 +// Licence : This source is under MIT License +// File : glm/core/type_mat3x2.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat3x2::size_type tmat3x2::col_size() + { + return typename tmat3x2::size_type(3); + } + + template + typename tmat3x2::size_type tmat3x2::row_size() + { + return typename tmat3x2::size_type(2); + } + + template + bool tmat3x2::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec2& tmat3x2::operator[](typename tmat3x2::size_type i) + { + assert( + i >= typename tmat3x2::size_type(0) && + i < tmat3x2::col_size()); + + return value[i]; + } + + template + const detail::tvec2& tmat3x2::operator[](typename tmat3x2::size_type i) const + { + assert( + i >= typename tmat3x2::size_type(0) && + i < tmat3x2::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // Constructors + + template + inline tmat3x2::tmat3x2() + { + this->value[0] = detail::tvec2(1, 0); + this->value[1] = detail::tvec2(0, 1); + this->value[2] = detail::tvec2(0, 0); + } + + template + inline tmat3x2::tmat3x2(const T f) + { + this->value[0] = detail::tvec2(f, 0); + this->value[1] = detail::tvec2(0, f); + this->value[2] = detail::tvec2(0, 0); + } + + template + inline tmat3x2::tmat3x2 + ( + const T x0, const T y0, + const T x1, const T y1, + const T x2, const T y2 + ) + { + this->value[0] = detail::tvec2(x0, y0); + this->value[1] = detail::tvec2(x1, y1); + this->value[2] = detail::tvec2(x2, y2); + } + + template + inline tmat3x2::tmat3x2 + ( + const detail::tvec2 & v0, + const detail::tvec2 & v1, + const detail::tvec2 & v2 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + } + + // Conversion + template + template + inline tmat3x2::tmat3x2(const tmat3x2& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + } + + template + inline tmat3x2::tmat3x2(tmat2x2 const & m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = detail::tvec2(T(0)); + } + + template + inline tmat3x2::tmat3x2(const tmat3x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + } + + template + inline tmat3x2::tmat3x2(const tmat4x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + } + + template + inline tmat3x2::tmat3x2(const tmat2x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(T(0)); + } + + template + inline tmat3x2::tmat3x2(const tmat2x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(T(0)); + } + + template + inline tmat3x2::tmat3x2(const tmat3x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + } + + template + inline tmat3x2::tmat3x2(const tmat4x2& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + } + + template + inline tmat3x2::tmat3x2(const tmat4x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + } + + ////////////////////////////////////////////////////////////// + // Unary updatable operators + + template + inline tmat3x2& tmat3x2::operator= (const tmat3x2& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } + + template + inline tmat3x2& tmat3x2::operator+= (const T & s) + { + this->value[0] += s; + this->value[1] += s; + this->value[2] += s; + return *this; + } + + template + inline tmat3x2& tmat3x2::operator+= (const tmat3x2& m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + this->value[2] += m[2]; + return *this; + } + + template + inline tmat3x2& tmat3x2::operator-= (const T & s) + { + this->value[0] -= s; + this->value[1] -= s; + this->value[2] -= s; + return *this; + } + + template + inline tmat3x2& tmat3x2::operator-= (const tmat3x2& m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + this->value[2] -= m[2]; + return *this; + } + + template + inline tmat3x2& tmat3x2::operator*= (const T & s) + { + this->value[0] *= s; + this->value[1] *= s; + this->value[2] *= s; + return *this; + } + + template + inline tmat3x2& tmat3x2::operator*= (const tmat2x3& m) + { + return (*this = tmat3x2(*this * m)); + } + + template + inline tmat3x2 & tmat3x2::operator/= (const T & s) + { + this->value[0] /= s; + this->value[1] /= s; + this->value[2] /= s; + return *this; + } + + //template + //inline tmat3x2& tmat3x2::operator/= (const tmat3x2& m) + //{ + // return (*this = tmat3x2(*this / m)); + //} + + template + inline tmat3x2& tmat3x2::operator++ () + { + ++this->value[0]; + ++this->value[1]; + ++this->value[2]; + return *this; + } + + template + inline tmat3x2& tmat3x2::operator-- () + { + --this->value[0]; + --this->value[1]; + --this->value[2]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // inverse + template + inline tmat2x3 tmat3x2::_inverse() const + { + assert(0); //g.truc.creation[at]gmail.com + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat3x2 operator+ (const tmat3x2& m, const T & s) + { + return tmat3x2( + m[0] + s, + m[1] + s, + m[2] + s); + } + + template + inline tmat3x2 operator+ (const tmat3x2& m1, const tmat3x2& m2) + { + return tmat3x2( + m1[0] + m2[0], + m1[1] + m2[1], + m1[2] + m2[2]); + } + + template + inline tmat3x2 operator- (const tmat3x2& m, const T & s) + { + return tmat3x4( + m[0] - s, + m[1] - s, + m[2] - s); + } + + template + inline tmat3x2 operator- (const tmat3x2& m1, const tmat3x2& m2) + { + return tmat3x2( + m1[0] - m2[0], + m1[1] - m2[1], + m1[2] - m2[2]); + } + + template + inline tmat3x2 operator* (const tmat3x2& m, const T & s) + { + return tmat3x2( + m[0] * s, + m[1] * s, + m[2] * s); + } + + template + inline tmat3x2 operator* (const T & s, const tmat3x2 & m) + { + return tmat3x2( + m[0] * s, + m[1] * s, + m[2] * s); + } + + template + inline detail::tvec2 operator* (const tmat3x2& m, const detail::tvec3& v) + { + return detail::tvec2( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z); + } + + template + inline detail::tvec3 operator* (const detail::tvec2& v, const tmat3x2& m) + { + return detail::tvec3( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); + } + + template + inline tmat2x2 operator* (const tmat3x2& m1, const tmat2x3& m2) + { + const T SrcA00 = m1[0][0]; + const T SrcA01 = m1[0][1]; + const T SrcA10 = m1[1][0]; + const T SrcA11 = m1[1][1]; + const T SrcA20 = m1[2][0]; + const T SrcA21 = m1[2][1]; + + const T SrcB00 = m2[0][0]; + const T SrcB01 = m2[0][1]; + const T SrcB02 = m2[0][2]; + const T SrcB10 = m2[1][0]; + const T SrcB11 = m2[1][1]; + const T SrcB12 = m2[1][2]; + + tmat2x2 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA01 * SrcB01 + SrcA20 * SrcB02; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12; + return Result; + } + + template + inline tmat3x2 operator/ (const tmat3x2& m, const T & s) + { + return tmat3x2( + m[0] / s, + m[1] / s, + m[2] / s, + m[3] / s); + } + + template + inline tmat3x2 operator/ (const T & s, const tmat3x2& m) + { + return tmat3x2( + s / m[0], + s / m[1], + s / m[2], + s / m[3]); + } + + //template + //inline tvec2 operator/ + //( + // tmat3x2 const & m, + // tvec2 const & v + //) + //{ + // return m._inverse() * v; + //} + + //template + //inline tvec3 operator/ + //( + // tvec2 const & v, + // tmat3x2 const & m + //) + //{ + // return v * m._inverse(); + //} + + //template + //inline tmat3x3 operator/ + //( + // tmat3x2 const & m1, + // tmat2x3 const & m2 + //) + //{ + // return m1 * m2._inverse(); + //} + + // Unary constant operators + template + inline tmat3x2 const operator- + ( + tmat3x2 const & m + ) + { + return tmat3x2( + -m[0], + -m[1], + -m[2]); + } + + template + inline tmat3x2 const operator++ + ( + tmat3x2 const & m, + int + ) + { + return tmat3x2( + m[0] + valType(1), + m[1] + valType(1), + m[2] + valType(1)); + } + + template + inline tmat3x2 const operator-- + ( + tmat3x2 const & m, + int + ) + { + return tmat3x2( + m[0] - valType(1), + m[1] - valType(1), + m[2] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_mat3x3.hpp b/glm/core/type_mat3x3.hpp new file mode 100644 index 0000000..032d960 --- /dev/null +++ b/glm/core/type_mat3x3.hpp @@ -0,0 +1,219 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-01-27 +// Updated : 2008-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_mat3x3.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat3x3 +#define glm_core_type_mat3x3 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat3x3(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 3 * 3 matrix of floating-point numbers. + template + struct tmat3x3 + { + public: + typedef tmat3x3* pointer; + typedef const tmat3x3* const_pointer; + typedef const tmat3x3*const const_pointer_const; + typedef tmat3x3*const pointer_const; + typedef tmat3x3& reference; + typedef const tmat3x3& const_reference; + typedef const tmat3x3& param_type; + typedef tmat3x3 transpose_type; + + typedef T value_type; + typedef detail::tvec3 col_type; + typedef detail::tvec3 row_type; + typedef glm::sizeType size_type; + static size_type value_size(); + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat3x3 _inverse() const; + + private: + // Data + tvec3 value[3]; + + public: + // Constructors + tmat3x3(); + explicit tmat3x3(const T x); + explicit tmat3x3( + const T x0, const T y0, const T z0, + const T x1, const T y1, const T z1, + const T x2, const T y2, const T z2); + explicit tmat3x3( + const detail::tvec3 & v0, + const detail::tvec3 & v1, + const detail::tvec3 & v2); + + // Conversions + template + explicit tmat3x3(const tmat3x3& m); + + explicit tmat3x3(const tmat2x2& x); + explicit tmat3x3(const tmat4x4& x); + explicit tmat3x3(const tmat2x3& x); + explicit tmat3x3(const tmat3x2& x); + explicit tmat3x3(const tmat2x4& x); + explicit tmat3x3(const tmat4x2& x); + explicit tmat3x3(const tmat3x4& x); + explicit tmat3x3(const tmat4x3& x); + + // Accesses + detail::tvec3& operator[](size_type i); + detail::tvec3 const & operator[](size_type i) const; + + // Unary updatable operators + tmat3x3& operator=(const tmat3x3& m); + tmat3x3& operator+= (const T & s); + tmat3x3& operator+= (const tmat3x3& m); + tmat3x3& operator-= (const T & s); + tmat3x3& operator-= (const tmat3x3& m); + tmat3x3& operator*= (const T & s); + tmat3x3& operator*= (const tmat3x3& m); + tmat3x3& operator/= (const T & s); + tmat3x3& operator/= (const tmat3x3& m); + tmat3x3& operator++ (); + tmat3x3& operator-- (); + }; + + // Binary operators + template + tmat3x3 operator+ (const tmat3x3& m, const T & s); + + template + tmat3x3 operator+ (const T & s, const tmat3x3& m); + + template + tmat3x3 operator+ (const tmat3x3& m1, const tmat3x3& m2); + + template + tmat3x3 operator- (const tmat3x3& m, const T & s); + + template + tmat3x3 operator- (const T & s, const tmat3x3& m); + + template + tmat3x3 operator- (const tmat3x3& m1, const tmat3x3& m2); + + template + tmat3x3 operator* (const tmat3x3& m, const T & s); + + template + tmat3x3 operator* (const T & s, const tmat3x3& m); + + template + detail::tvec3 operator* (const tmat3x3& m, const detail::tvec3& v); + + template + detail::tvec3 operator* (const detail::tvec3& v, const tmat3x3& m); + + template + tmat3x3 operator* (const tmat3x3& m1, const tmat3x3& m2); + + template + tmat3x3 operator/ (const tmat3x3& m, const T & s); + + template + tmat3x3 operator/ (const T & s, const tmat3x3& m); + + template + detail::tvec3 operator/ (const tmat3x3& m, const detail::tvec3& v); + + template + detail::tvec3 operator/ (const detail::tvec3& v, const tmat3x3& m); + + template + tmat3x3 operator/ (const tmat3x3& m1, const tmat3x3& m2); + + // Unary constant operators + template + tmat3x3 const operator- (tmat3x3 const & m); + + template + tmat3x3 const operator-- (tmat3x3 const & m, int); + + template + tmat3x3 const operator++ (tmat3x3 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 3 columns of 3 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x3 lowp_mat3x3; + //! 3 columns of 3 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x3 mediump_mat3x3; + //! 3 columns of 3 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x3 highp_mat3x3; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 3 columns of 3 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat3x3 mat3x3; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat3x3 mat3x3; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat3x3 mat3x3; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat3x3 mat3x3; +#else + typedef detail::tmat3x3 mat3x3; +#endif//GLM_PRECISION + + //! 3 columns of 3 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef mat3x3 mat3; + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat3x3.inl" + +#endif //glm_core_type_mat3x3 diff --git a/glm/core/type_mat3x3.inl b/glm/core/type_mat3x3.inl new file mode 100644 index 0000000..f12d10f --- /dev/null +++ b/glm/core/type_mat3x3.inl @@ -0,0 +1,604 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-01-27 +// Updated : 2008-08-25 +// Licence : This source is under MIT License +// File : glm/core/type_mat3x3.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat3x3::size_type tmat3x3::value_size() + { + return typename tmat3x3::size_type(3); + } + + template + typename tmat3x3::size_type tmat3x3::col_size() + { + return typename tmat3x3::size_type(3); + } + + template + typename tmat3x3::size_type tmat3x3::row_size() + { + return typename tmat3x3::size_type(3); + } + + template + bool tmat3x3::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec3& tmat3x3::operator[](typename tmat3x3::size_type i) + { + assert( + i >= typename tmat3x3::size_type(0) && + i < tmat3x3::col_size()); + + return value[i]; + } + + template + const detail::tvec3& tmat3x3::operator[](typename tmat3x3::size_type i) const + { + assert( + i >= typename tmat3x3::size_type(0) && + i < tmat3x3::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // mat3 constructors + + template + inline tmat3x3::tmat3x3() + { + this->value[0] = detail::tvec3(1, 0, 0); + this->value[1] = detail::tvec3(0, 1, 0); + this->value[2] = detail::tvec3(0, 0, 1); + } + + template + inline tmat3x3::tmat3x3(const T f) + { + this->value[0] = detail::tvec3(f, 0, 0); + this->value[1] = detail::tvec3(0, f, 0); + this->value[2] = detail::tvec3(0, 0, f); + } + + template + inline tmat3x3::tmat3x3 + ( + const T x0, const T y0, const T z0, + const T x1, const T y1, const T z1, + const T x2, const T y2, const T z2 + ) + { + this->value[0] = detail::tvec3(x0, y0, z0); + this->value[1] = detail::tvec3(x1, y1, z1); + this->value[2] = detail::tvec3(x2, y2, z2); + } + + template + inline tmat3x3::tmat3x3 + ( + const detail::tvec3& v0, + const detail::tvec3& v1, + const detail::tvec3& v2 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + } + + ////////////////////////////////////////////////////////////// + // mat3 conversions + + template + template + inline tmat3x3::tmat3x3(const tmat3x3& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(m[2]); + } + + template + inline tmat3x3::tmat3x3(tmat2x2 const & m) + { + this->value[0] = detail::tvec3(m[0], T(0)); + this->value[1] = detail::tvec3(m[1], T(0)); + this->value[2] = detail::tvec3(detail::tvec2(0), T(1)); + } + + template + inline tmat3x3::tmat3x3(const tmat4x4& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(m[2]); + } + + template + inline tmat3x3::tmat3x3(const tmat2x3& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = detail::tvec3(detail::tvec2(0), T(1)); + } + + template + inline tmat3x3::tmat3x3(const tmat3x2& m) + { + this->value[0] = detail::tvec3(m[0], T(0)); + this->value[1] = detail::tvec3(m[1], T(0)); + this->value[2] = detail::tvec3(m[2], T(1)); + } + + template + inline tmat3x3::tmat3x3(const tmat2x4& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(detail::tvec2(0), T(1)); + } + + template + inline tmat3x3::tmat3x3(const tmat4x2& m) + { + this->value[0] = detail::tvec3(m[0], T(0)); + this->value[1] = detail::tvec3(m[1], T(0)); + this->value[2] = detail::tvec3(m[2], T(1)); + } + + template + inline tmat3x3::tmat3x3(const tmat3x4& m) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(m[2]); + } + + template + inline tmat3x3::tmat3x3(const tmat4x3& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + } + +/* + template + inline tmat3x3::tmat3x3(const T* a) + { + this->value[0] = detail::tvec3(a[0], a[1], a[2]); + this->value[1] = detail::tvec3(a[3], a[4], a[5]); + this->value[2] = detail::tvec3(a[6], a[7], a[8]); + } +*/ + /* + // GL_GTX_euler_angles + template + inline tmat3x3::tmat3x3(const detail::tvec3 & angles) + { + T ch = cos(angles.x); + T sh = sin(angles.x); + T cp = cos(angles.y); + T sp = sin(angles.y); + T cb = cos(angles.z); + T sb = sin(angles.z); + + value[0][0] = ch * cb + sh * sp * sb; + value[0][1] = sb * cp; + value[0][2] = -sh * cb + ch * sp * sb; + value[1][0] = -ch * sb + sh * sp * cb; + value[1][1] = cb * cp; + value[1][2] = sb * sh + ch * sp * cb; + value[2][0] = sh * cp; + value[2][1] = -sp; + value[2][2] = ch * cp; + } + */ + ////////////////////////////////////////////////////////////// + // mat3 conversions + /* + template + inline tmat3x3::tmat3x3(const tquat & q) + { + this->value[0][0] = 1 - 2 * q.y * q.y - 2 * q.z * q.z; + this->value[0][1] = 2 * q.x * q.y + 2 * q.w * q.z; + this->value[0][2] = 2 * q.x * q.z - 2 * q.w * q.y; + + this->value[1][0] = 2 * q.x * q.y - 2 * q.w * q.z; + this->value[1][1] = 1 - 2 * q.x * q.x - 2 * q.z * q.z; + this->value[1][2] = 2 * q.y * q.z + 2 * q.w * q.x; + + this->value[2][0] = 2 * q.x * q.z + 2 * q.w * q.y; + this->value[2][1] = 2 * q.y * q.z - 2 * q.w * q.x; + this->value[2][2] = 1 - 2 * q.x * q.x - 2 * q.y * q.y; + } + */ + ////////////////////////////////////////////////////////////// + // mat3 operators + + template + inline tmat3x3& tmat3x3::operator=(const tmat3x3& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator+= (const T & s) + { + this->value[0] += s; + this->value[1] += s; + this->value[2] += s; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator+= (const tmat3x3& m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + this->value[2] += m[2]; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator-= (const T & s) + { + this->value[0] -= s; + this->value[1] -= s; + this->value[2] -= s; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator-= (const tmat3x3& m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + this->value[2] -= m[2]; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator*= (const T & s) + { + this->value[0] *= s; + this->value[1] *= s; + this->value[2] *= s; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator*= (const tmat3x3& m) + { + return (*this = *this * m); + } + + template + inline tmat3x3& tmat3x3::operator/= (const T & s) + { + this->value[0] /= s; + this->value[1] /= s; + this->value[2] /= s; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator/= (const tmat3x3& m) + { + return (*this = *this / m); + } + + template + inline tmat3x3& tmat3x3::operator++ () + { + this->value[0]++; + this->value[1]++; + this->value[2]++; + return *this; + } + + template + inline tmat3x3& tmat3x3::operator-- () + { + this->value[0]--; + this->value[1]--; + this->value[2]--; + return *this; + } + + template + inline tmat3x3 tmat3x3::_inverse() const + { + T S00 = value[0][0]; + T S01 = value[0][1]; + T S02 = value[0][2]; + + T S10 = value[1][0]; + T S11 = value[1][1]; + T S12 = value[1][2]; + + T S20 = value[2][0]; + T S21 = value[2][1]; + T S22 = value[2][2]; + + tmat3x3 Inverse( + + (S11 * S22 - S21 * S12), + - (S10 * S22 - S20 * S12), + + (S10 * S21 - S20 * S11), + - (S01 * S22 - S21 * S02), + + (S00 * S22 - S20 * S02), + - (S00 * S21 - S20 * S01), + + (S01 * S12 - S11 * S02), + - (S00 * S12 - S10 * S02), + + (S00 * S11 - S10 * S01)); + + T Determinant = S00 * (S11 * S22 - S21 * S12) + - S10 * (S01 * S22 - S21 * S02) + + S20 * (S01 * S12 - S11 * S02); + + Inverse /= Determinant; + return Inverse; + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat3x3 operator+ (const tmat3x3& m, const T & s) + { + return tmat3x3( + m[0] + s, + m[1] + s, + m[2] + s); + } + + template + inline tmat3x3 operator+ (const T & s, const tmat3x3& m) + { + return tmat3x3( + m[0] + s, + m[1] + s, + m[2] + s); + } + + //template + //inline tvec3 operator+ (const tmat3x3& m, const tvec3& v) + //{ + + //} + + //template + //inline tvec3 operator+ (const tvec3& v, const tmat3x3& m) + //{ + + //} + + template + inline tmat3x3 operator+ (const tmat3x3& m1, const tmat3x3& m2) + { + return tmat3x3( + m1[0] + m2[0], + m1[1] + m2[1], + m1[2] + m2[2]); + } + + template + inline tmat3x3 operator- (const tmat3x3& m, const T & s) + { + return tmat3x3( + m[0] - s, + m[1] - s, + m[2] - s); + } + + template + inline tmat3x3 operator- (const T & s, const tmat3x3& m) + { + return tmat3x3( + s - m[0], + s - m[1], + s - m[2]); + } + + //template + //inline detail::tvec3 operator- (const tmat3x3& m, const detail::tvec3& v) + //{ + + //} + + //template + //inline detail::tvec3 operator- (const detail::tvec3& v, const tmat3x3& m) + //{ + + //} + + template + inline tmat3x3 operator- (const tmat3x3& m1, const tmat3x3& m2) + { + return tmat3x3( + m1[0] - m2[0], + m1[1] - m2[1], + m1[2] - m2[2]); + } + + template + inline tmat3x3 operator* (const tmat3x3& m, const T & s) + { + return tmat3x3( + m[0] * s, + m[1] * s, + m[2] * s); + } + + template + inline tmat3x3 operator* (const T & s, const tmat3x3& m) + { + return tmat3x3( + m[0] * s, + m[1] * s, + m[2] * s); + } + + template + inline detail::tvec3 operator* (const tmat3x3& m, const detail::tvec3& v) + { + return detail::tvec3( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z, + m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z); + } + + template + inline detail::tvec3 operator* (const detail::tvec3& v, const tmat3x3& m) + { + return detail::tvec3( + m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z, + m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z, + m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z); + } + + template + inline tmat3x3 operator* (const tmat3x3& m1, const tmat3x3& m2) + { + const T SrcA00 = m1[0][0]; + const T SrcA01 = m1[0][1]; + const T SrcA02 = m1[0][2]; + const T SrcA10 = m1[1][0]; + const T SrcA11 = m1[1][1]; + const T SrcA12 = m1[1][2]; + const T SrcA20 = m1[2][0]; + const T SrcA21 = m1[2][1]; + const T SrcA22 = m1[2][2]; + + const T SrcB00 = m2[0][0]; + const T SrcB01 = m2[0][1]; + const T SrcB02 = m2[0][2]; + const T SrcB10 = m2[1][0]; + const T SrcB11 = m2[1][1]; + const T SrcB12 = m2[1][2]; + const T SrcB20 = m2[2][0]; + const T SrcB21 = m2[2][1]; + const T SrcB22 = m2[2][2]; + + tmat3x3 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02; + Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12; + Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12; + Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22; + Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22; + Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22; + return Result; + } + + + template + inline tmat3x3 operator/ (const tmat3x3& m, const T & s) + { + return tmat3x3( + m[0] / s, + m[1] / s, + m[2] / s); + } + + template + inline tmat3x3 operator/ (const T & s, const tmat3x3& m) + { + return tmat3x3( + s / m[0], + s / m[1], + s / m[2]); + } + + template + inline detail::tvec3 operator/ + ( + tmat3x3 const & m, + tvec3 const & v + ) + { + return m._inverse() * v; + } + + template + inline detail::tvec3 operator/ + ( + tvec3 const & v, + tmat3x3 const & m + ) + { + return v * m._inverse(); + } + + template + inline tmat3x3 operator/ + ( + tmat3x3 const & m1, + tmat3x3 const & m2 + ) + { + return m1 * m2._inverse(); + } + + // Unary constant operators + template + inline tmat3x3 const operator- + ( + tmat3x3 const & m + ) + { + return tmat3x3( + -m[0], + -m[1], + -m[2]); + } + + template + inline tmat3x3 const operator++ + ( + tmat3x3 const & m, + int + ) + { + return tmat3x3( + m[0] + valType(1), + m[1] + valType(1), + m[2] + valType(1)); + } + + template + inline tmat3x3 const operator-- + ( + tmat3x3 const & m, + int + ) + { + return tmat3x3( + m[0] - valType(1), + m[1] - valType(1), + m[2] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_mat3x4.hpp b/glm/core/type_mat3x4.hpp new file mode 100644 index 0000000..256073a --- /dev/null +++ b/glm/core/type_mat3x4.hpp @@ -0,0 +1,209 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-05 +// Updated : 2008-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_mat3x4.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat3x4 +#define glm_core_type_mat3x4 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat3x4(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 3 * 4 matrix of floating-point numbers. + template + struct tmat3x4 + { + public: + typedef tmat3x4* pointer; + typedef const tmat3x4* const_pointer; + typedef const tmat3x4*const const_pointer_const; + typedef tmat3x4*const pointer_const; + typedef tmat3x4& reference; + typedef const tmat3x4& const_reference; + typedef const tmat3x4& param_type; + typedef tmat4x3 transpose_type; + + typedef T value_type; + typedef detail::tvec3 col_type; + typedef detail::tvec4 row_type; + typedef glm::sizeType size_type; + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat4x3 _inverse() const; + + private: + // Data + detail::tvec4 value[3]; + + public: + // Constructors + tmat3x4(); + explicit tmat3x4(const T x); + explicit tmat3x4( + const T x0, const T y0, const T z0, const T w0, + const T x1, const T y1, const T z1, const T w1, + const T x2, const T y2, const T z2, const T w2); + explicit tmat3x4( + const detail::tvec4& v0, + const detail::tvec4& v1, + const detail::tvec4& v2); + + // Conversion + template + explicit tmat3x4(const tmat3x4& m); + + explicit tmat3x4(const tmat2x2& x); + explicit tmat3x4(const tmat3x3& x); + explicit tmat3x4(const tmat4x4& x); + explicit tmat3x4(const tmat2x3& x); + explicit tmat3x4(const tmat3x2& x); + explicit tmat3x4(const tmat2x4& x); + explicit tmat3x4(const tmat4x2& x); + explicit tmat3x4(const tmat4x3& x); + + // Accesses + detail::tvec4& operator[](size_type i); + detail::tvec4 const & operator[](size_type i) const; + + // Unary updatable operators + tmat3x4& operator= (const tmat3x4& m); + tmat3x4& operator+= (const T & s); + tmat3x4& operator+= (const tmat3x4& m); + tmat3x4& operator-= (const T & s); + tmat3x4& operator-= (const tmat3x4& m); + tmat3x4& operator*= (const T & s); + tmat3x4& operator*= (const tmat4x3& m); + tmat3x4& operator/= (const T & s); + //tmat3x4& operator/= (const tmat4x3& m); + + tmat3x4& operator++ (); + tmat3x4& operator-- (); + }; + + // Binary operators + template + tmat3x4 operator+ (const tmat3x4& m, const T & s); + + template + tmat3x4 operator+ (const tmat3x4& m1, const tmat3x4& m2); + + template + tmat3x4 operator- (const tmat3x4& m, const T & s); + + template + tmat3x4 operator- (const tmat3x4& m1, const tmat3x4& m2); + + template + tmat3x4 operator* (const tmat3x4& m, const T & s); + + template + tmat3x4 operator* (const T & s, const tmat3x4& m); + + template + detail::tvec4 operator* (const tmat3x4& m, const detail::tvec3& v); + + template + detail::tvec3 operator* (const detail::tvec4& v, const tmat3x4& m); + + template + tmat4x4 operator* (const tmat3x4& m1, const tmat4x3& m2); + + template + tmat4x3 operator/ (const tmat4x3& m, const T & s); + + template + tmat4x3 operator/ (const T & s, const tmat4x3& m); + + //template + //detail::tvec4 operator/ (const tmat3x4& m, const detail::tvec3& v); + + //template + //detail::tvec3 operator/ (const detail::tvec4& v, const tmat3x4& m); + + //template + //tmat4x4 operator/ (const tmat4x3& m1, const tmat3x4& m2); + + // Unary constant operators + template + tmat3x4 const operator- (tmat3x4 const & m); + + template + tmat3x4 const operator-- (tmat3x4 const & m, int); + + template + tmat3x4 const operator++ (tmat3x4 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 3 columns of 4 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x4 lowp_mat3x4; + //! 3 columns of 4 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x4 mediump_mat3x4; + //! 3 columns of 4 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat3x4 highp_mat3x4; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 3 columns of 4 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat3x4 mat3x4; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat3x4 mat3x4; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat3x4 mat3x4; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat3x4 mat3x4; +#else + typedef detail::tmat3x4 mat3x4; +#endif//GLM_PRECISION + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat3x4.inl" + +#endif //glm_core_type_mat3x4 diff --git a/glm/core/type_mat3x4.inl b/glm/core/type_mat3x4.inl new file mode 100644 index 0000000..24ca60d --- /dev/null +++ b/glm/core/type_mat3x4.inl @@ -0,0 +1,484 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-05 +// Updated : 2006-10-01 +// Licence : This source is under MIT License +// File : glm/core/type_mat3x4.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat3x4::size_type tmat3x4::col_size() + { + return typename tmat3x4::size_type(3); + } + + template + typename tmat3x4::size_type tmat3x4::row_size() + { + return typename tmat3x4::size_type(4); + } + + template + bool tmat3x4::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec4& tmat3x4::operator[](typename tmat3x4::size_type i) + { + assert( + i >= typename tmat3x4::size_type(0) && + i < tmat3x4::col_size()); + + return value[i]; + } + + template + const detail::tvec4& tmat3x4::operator[](typename tmat3x4::size_type i) const + { + assert( + i >= typename tmat3x4::size_type(0) && + i < tmat3x4::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // Constructors + + template + inline tmat3x4::tmat3x4() + { + this->value[0] = detail::tvec4(1, 0, 0, 0); + this->value[1] = detail::tvec4(0, 1, 0, 0); + this->value[2] = detail::tvec4(0, 0, 1, 0); + } + + template + inline tmat3x4::tmat3x4(const T f) + { + this->value[0] = detail::tvec4(f, 0, 0, 0); + this->value[1] = detail::tvec4(0, f, 0, 0); + this->value[2] = detail::tvec4(0, 0, f, 0); + } + + template + inline tmat3x4::tmat3x4 + ( + const T x0, const T y0, const T z0, const T w0, + const T x1, const T y1, const T z1, const T w1, + const T x2, const T y2, const T z2, const T w2 + ) + { + this->value[0] = detail::tvec4(x0, y0, z0, w0); + this->value[1] = detail::tvec4(x1, y1, z1, w1); + this->value[2] = detail::tvec4(x2, y2, z2, w2); + } + + template + inline tmat3x4::tmat3x4 + ( + const detail::tvec4 & v0, + const detail::tvec4 & v1, + const detail::tvec4 & v2 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + } + + // Conversion + template + template + inline tmat3x4::tmat3x4(const tmat3x4& m) + { + this->value[0] = detail::tvec4(m[0]); + this->value[1] = detail::tvec4(m[1]); + this->value[2] = detail::tvec4(m[2]); + } + + template + inline tmat3x4::tmat3x4(tmat2x2 const & m) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(0)); + this->value[1] = detail::tvec4(m[1], detail::tvec2(0)); + this->value[2] = detail::tvec4(T(0), T(0), T(1), T(0)); + } + + template + inline tmat3x4::tmat3x4(const tmat3x3& m) + { + this->value[0] = detail::tvec4(m[0], T(0)); + this->value[1] = detail::tvec4(m[1], T(0)); + this->value[2] = detail::tvec4(m[2], T(0)); + } + + template + inline tmat3x4::tmat3x4(const tmat4x4& m) + { + this->value[0] = detail::tvec4(m[0]); + this->value[1] = detail::tvec4(m[1]); + this->value[2] = detail::tvec4(m[2]); + } + + template + inline tmat3x4::tmat3x4(const tmat2x3& m) + { + this->value[0] = detail::tvec4(m[0], T(0)); + this->value[1] = detail::tvec4(m[1], T(0)); + this->value[2] = detail::tvec4(T(0), T(0), T(1), T(0)); + } + + template + inline tmat3x4::tmat3x4(const tmat3x2& m) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(0)); + this->value[1] = detail::tvec4(m[1], detail::tvec2(0)); + this->value[2] = detail::tvec4(m[2], T(0), T(1)); + } + + template + inline tmat3x4::tmat3x4(const tmat2x4& m) + { + this->value[0] = detail::tvec4(m[0]); + this->value[1] = detail::tvec4(m[1]); + this->value[2] = detail::tvec4(T(0), T(0), T(1), T(0)); + } + + template + inline tmat3x4::tmat3x4(const tmat4x2& m) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(T(0))); + this->value[1] = detail::tvec4(m[1], detail::tvec2(T(0))); + this->value[2] = detail::tvec4(m[2], detail::tvec2(T(1), T(0))); + } + + template + inline tmat3x4::tmat3x4(const tmat4x3& m) + { + this->value[0] = detail::tvec4(m[0], T(0)); + this->value[1] = detail::tvec4(m[1], T(0)); + this->value[2] = detail::tvec4(m[2], T(0)); + } + + ////////////////////////////////////////////////////////////// + // Unary updatable operators + + template + inline tmat3x4& tmat3x4::operator= (const tmat3x4& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + return *this; + } + + template + inline tmat3x4& tmat3x4::operator+= (const T & s) + { + this->value[0] += s; + this->value[1] += s; + this->value[2] += s; + return *this; + } + + template + inline tmat3x4& tmat3x4::operator+= (const tmat3x4& m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + this->value[2] += m[2]; + return *this; + } + + template + inline tmat3x4& tmat3x4::operator-= (const T & s) + { + this->value[0] -= s; + this->value[1] -= s; + this->value[2] -= s; + return *this; + } + + template + inline tmat3x4& tmat3x4::operator-= (const tmat3x4& m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + this->value[2] -= m[2]; + return *this; + } + + template + inline tmat3x4& tmat3x4::operator*= (const T & s) + { + this->value[0] *= s; + this->value[1] *= s; + this->value[2] *= s; + return *this; + } + + template + inline tmat3x4& tmat3x4::operator*= (const tmat4x3& m) + { + return (*this = tmat3x4(*this * m)); + } + + template + inline tmat3x4 & tmat3x4::operator/= (const T & s) + { + this->value[0] /= s; + this->value[1] /= s; + this->value[2] /= s; + return *this; + } +/* ToDo + template + inline tmat3x4& tmat3x4::operator/= (const tmat4x3& m) + { + return (*this = tmat3x4(*this / m)); + } +*/ + template + inline tmat3x4& tmat3x4::operator++ () + { + ++this->value[0]; + ++this->value[1]; + ++this->value[2]; + return *this; + } + + template + inline tmat3x4& tmat3x4::operator-- () + { + --this->value[0]; + --this->value[1]; + --this->value[2]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat3x4 operator+ (const tmat3x4& m, const T & s) + { + return tmat3x4( + m[0] + s, + m[1] + s, + m[2] + s); + } + + template + inline tmat3x4 operator+ (const tmat3x4& m1, const tmat3x4& m2) + { + return tmat3x4( + m1[0] + m2[0], + m1[1] + m2[1], + m1[2] + m2[2]); + } + + template + inline tmat3x4 operator- (const tmat3x4& m, const T & s) + { + return tmat3x4( + m[0] - s, + m[1] - s, + m[2] - s); + } + + template + inline tmat3x4 operator- (const tmat3x4& m1, const tmat3x4& m2) + { + return tmat3x4( + m1[0] - m2[0], + m1[1] - m2[1], + m1[2] - m2[2]); + } + + template + inline tmat3x4 operator* (const tmat3x4& m, const T & s) + { + return tmat3x4( + m[0] * s, + m[1] * s, + m[2] * s); + } + + template + inline tmat3x4 operator* (const T & s, const tmat3x4 & m) + { + return tmat3x4( + m[0] * s, + m[1] * s, + m[2] * s); + } + + template + inline detail::tvec4 operator* (const tmat3x4& m, const detail::tvec3& v) + { + return detail::tvec4( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z, + m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z, + m[0][3] * v.x + m[1][3] * v.y + m[2][3] * v.z); + } + + template + inline detail::tvec3 operator* (const detail::tvec4& v, const tmat3x4& m) + { + return detail::tvec3( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, + m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); + } + + template + inline tmat4x4 operator* (const tmat3x4& m1, const tmat4x3& m2) + { + const T SrcA00 = m1[0][0]; + const T SrcA01 = m1[0][1]; + const T SrcA02 = m1[0][2]; + const T SrcA03 = m1[0][3]; + const T SrcA10 = m1[1][0]; + const T SrcA11 = m1[1][1]; + const T SrcA12 = m1[1][2]; + const T SrcA13 = m1[1][3]; + const T SrcA20 = m1[2][0]; + const T SrcA21 = m1[2][1]; + const T SrcA22 = m1[2][2]; + const T SrcA23 = m1[2][3]; + + const T SrcB00 = m2[0][0]; + const T SrcB01 = m2[0][1]; + const T SrcB02 = m2[0][2]; + const T SrcB10 = m2[1][0]; + const T SrcB11 = m2[1][1]; + const T SrcB12 = m2[1][2]; + const T SrcB20 = m2[2][0]; + const T SrcB21 = m2[2][1]; + const T SrcB22 = m2[2][2]; + const T SrcB30 = m2[3][0]; + const T SrcB31 = m2[3][1]; + const T SrcB32 = m2[3][2]; + + tmat4x4 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02; + Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02; + Result[0][3] = SrcA03 * SrcB00 + SrcA13 * SrcB01 + SrcA23 * SrcB02; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12; + Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12; + Result[1][3] = SrcA03 * SrcB10 + SrcA13 * SrcB11 + SrcA23 * SrcB12; + Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22; + Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22; + Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22; + Result[2][3] = SrcA03 * SrcB20 + SrcA13 * SrcB21 + SrcA23 * SrcB22; + Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31 + SrcA20 * SrcB32; + Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31 + SrcA21 * SrcB32; + Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31 + SrcA22 * SrcB32; + Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31 + SrcA23 * SrcB32; + return Result; + } + + template + inline tmat3x4 operator/ (const tmat3x4& m, const T & s) + { + return tmat3x4( + m[0] / s, + m[1] / s, + m[2] / s, + m[3] / s); + } + + template + inline tmat3x4 operator/ (const T & s, const tmat3x4& m) + { + return tmat3x4( + s / m[0], + s / m[1], + s / m[2], + s / m[3]); + } + + //template + //inline tvec4 operator/ + //( + // tmat3x4 const & m, + // tvec4 const & v + //) + //{ + // return m._inverse() * v; + //} + + //template + //inline tvec3 operator/ + //( + // tvec4 const & v, + // tmat3x4 const & m + //) + //{ + // return v * m._inverse(); + //} + + //template + //inline tmat4x4 operator/ + //( + // tmat3x4 const & m1, + // tmat4x3 const & m2 + //) + //{ + // return m1 * m2._inverse(); + //} + + // Unary constant operators + template + inline tmat3x4 const operator- + ( + tmat3x4 const & m + ) + { + return tmat3x4( + -m[0], + -m[1], + -m[2]); + } + + template + inline tmat3x4 const operator++ + ( + tmat3x4 const & m, + int + ) + { + return tmat3x4( + m[0] + valType(1), + m[1] + valType(1), + m[2] + valType(1)); + } + + template + inline tmat3x4 const operator-- + ( + tmat3x4 const & m, + int + ) + { + return tmat3x4( + m[0] - valType(1), + m[1] - valType(1), + m[2] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_mat4x2.hpp b/glm/core/type_mat4x2.hpp new file mode 100644 index 0000000..03102ab --- /dev/null +++ b/glm/core/type_mat4x2.hpp @@ -0,0 +1,211 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-10-01 +// Updated : 2008-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_mat4x2.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat4x2 +#define glm_core_type_mat4x2 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat4x2(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 4 * 2 matrix of floating-point numbers. + template + struct tmat4x2 + { + public: + typedef tmat4x2* pointer; + typedef const tmat4x2* const_pointer; + typedef const tmat4x2*const const_pointer_const; + typedef tmat4x2*const pointer_const; + typedef tmat4x2& reference; + typedef const tmat4x2& const_reference; + typedef const tmat4x2& param_type; + typedef tmat2x4 transpose_type; + + typedef T value_type; + typedef detail::tvec4 col_type; + typedef detail::tvec2 row_type; + typedef glm::sizeType size_type; + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat2x4 _inverse() const; + + private: + // Data + detail::tvec2 value[4]; + + public: + // Constructors + tmat4x2(); + explicit tmat4x2(T const & x); + explicit tmat4x2( + T const & x0, T const & y0, + T const & x1, T const & y1, + T const & x2, T const & y2, + T const & x3, T const & y3); + explicit tmat4x2( + detail::tvec2 const & v0, + detail::tvec2 const & v1, + detail::tvec2 const & v2, + detail::tvec2 const & v3); + + // Conversions + template + explicit tmat4x2(const tmat4x2& m); + + explicit tmat4x2(const tmat2x2& x); + explicit tmat4x2(const tmat3x3& x); + explicit tmat4x2(const tmat4x4& x); + explicit tmat4x2(const tmat2x3& x); + explicit tmat4x2(const tmat3x2& x); + explicit tmat4x2(const tmat2x4& x); + explicit tmat4x2(const tmat4x3& x); + explicit tmat4x2(const tmat3x4& x); + + // Accesses + detail::tvec2& operator[](size_type i); + detail::tvec2 const & operator[](size_type i) const; + + // Unary updatable operators + tmat4x2& operator= (const tmat4x2& m); + tmat4x2& operator+= (const T & s); + tmat4x2& operator+= (const tmat4x2& m); + tmat4x2& operator-= (const T & s); + tmat4x2& operator-= (const tmat4x2& m); + tmat4x2& operator*= (const T & s); + tmat4x2& operator*= (const tmat2x4& m); + tmat4x2& operator/= (const T & s); + tmat4x2& operator/= (const tmat2x4& m); + + tmat4x2& operator++ (); + tmat4x2& operator-- (); + }; + + // Binary operators + template + tmat4x2 operator+ (const tmat4x2& m, const T & s); + + template + tmat4x2 operator+ (const tmat4x2& m1, const tmat4x2& m2); + + template + tmat4x2 operator- (const tmat4x2& m, const T & s); + + template + tmat4x2 operator- (const tmat4x2& m1, const tmat4x2& m2); + + template + tmat4x2 operator* (const tmat4x2& m, const T & s); + + template + tmat4x2 operator* (const T & s, const tmat4x2& m); + + template + detail::tvec2 operator* (const tmat4x2& m, const detail::tvec4& v); + + template + detail::tvec4 operator* (const detail::tvec2& v, const tmat4x2& m); + + template + tmat2x2 operator* (const tmat4x2& m1, const tmat2x4& m2); + + template + tmat4x2 operator/ (const tmat4x2& m, const T & s); + + template + tmat4x2 operator/ (const T & s, const tmat4x2& m); + + //template + //detail::tvec2 operator/ (const tmat4x2& m, const detail::tvec4& v); + + //template + //detail::tvec4 operator/ (const detail::tvec2& v, const tmat4x2& m); + + //template + //tmat2x2 operator/ (const tmat4x2& m1, const tmat2x4& m2); + + // Unary constant operators + template + tmat4x2 const operator- (tmat4x2 const & m); + + template + tmat4x2 const operator-- (tmat4x2 const & m, int); + + template + tmat4x2 const operator++ (tmat4x2 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 4 columns of 2 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x2 lowp_mat4x2; + //! 4 columns of 2 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x2 mediump_mat4x2; + //! 4 columns of 2 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x2 highp_mat4x2; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 4 columns of 2 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat4x2 mat4x2; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat4x2 mat4x2; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat4x2 mat4x2; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat4x2 mat4x2; +#else + typedef detail::tmat4x2 mat4x2; +#endif//GLM_PRECISION + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat4x2.inl" + +#endif //glm_core_type_mat4x2 diff --git a/glm/core/type_mat4x2.inl b/glm/core/type_mat4x2.inl new file mode 100644 index 0000000..e1363e1 --- /dev/null +++ b/glm/core/type_mat4x2.inl @@ -0,0 +1,513 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-10-01 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/core/type_mat4x2.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat4x2::size_type tmat4x2::col_size() + { + return typename tmat4x2::size_type(4); + } + + template + typename tmat4x2::size_type tmat4x2::row_size() + { + return typename tmat4x2::size_type(2); + } + + template + bool tmat4x2::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec2& tmat4x2::operator[] + ( + typename tmat4x2::size_type i + ) + { + assert( + i >= typename tmat4x2::size_type(0) && + i < tmat4x2::col_size()); + + return value[i]; + } + + template + const detail::tvec2& tmat4x2::operator[] + ( + typename tmat4x2::size_type i + ) const + { + assert( + i >= typename tmat4x2::size_type(0) && + i < tmat4x2::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // Constructors + + template + inline tmat4x2::tmat4x2() + { + this->value[0] = detail::tvec2(1, 0); + this->value[1] = detail::tvec2(0, 1); + this->value[2] = detail::tvec2(0, 0); + this->value[3] = detail::tvec2(0, 0); + } + + template + inline tmat4x2::tmat4x2 + ( + valType const & s + ) + { + this->value[0] = detail::tvec2(s, 0); + this->value[1] = detail::tvec2(0, s); + this->value[2] = detail::tvec2(0, 0); + this->value[3] = detail::tvec2(0, 0); + } + + template + inline tmat4x2::tmat4x2 + ( + valType const & x0, valType const & y0, + valType const & x1, valType const & y1, + valType const & x2, valType const & y2, + valType const & x3, valType const & y3 + ) + { + this->value[0] = detail::tvec2(x0, y0); + this->value[1] = detail::tvec2(x1, y1); + this->value[2] = detail::tvec2(x2, y2); + this->value[3] = detail::tvec2(x3, y3); + } + + template + inline tmat4x2::tmat4x2 + ( + const detail::tvec2 & v0, + const detail::tvec2 & v1, + const detail::tvec2 & v2, + const detail::tvec2 & v3 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + this->value[3] = v3; + } + + // Conversion + template + template + inline tmat4x2::tmat4x2(const tmat4x2& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + this->value[3] = detail::tvec2(m[3]); + } + + template + inline tmat4x2::tmat4x2(tmat2x2 const & m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(valType(0)); + this->value[3] = detail::tvec2(valType(0)); + } + + template + inline tmat4x2::tmat4x2(const tmat3x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + this->value[3] = detail::tvec2(valType(0)); + } + + template + inline tmat4x2::tmat4x2(const tmat4x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + this->value[3] = detail::tvec2(m[3]); + } + + template + inline tmat4x2::tmat4x2(const tmat2x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(valType(0)); + this->value[3] = detail::tvec2(valType(0)); + } + + template + inline tmat4x2::tmat4x2(const tmat3x2& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + this->value[3] = detail::tvec2(valType(0)); + } + + template + inline tmat4x2::tmat4x2(const tmat2x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(valType(0)); + this->value[3] = detail::tvec2(valType(0)); + } + + template + inline tmat4x2::tmat4x2(const tmat4x3& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + this->value[3] = detail::tvec2(m[3]); + } + + template + inline tmat4x2::tmat4x2(const tmat3x4& m) + { + this->value[0] = detail::tvec2(m[0]); + this->value[1] = detail::tvec2(m[1]); + this->value[2] = detail::tvec2(m[2]); + this->value[3] = detail::tvec2(valType(0)); + } + + ////////////////////////////////////////////////////////////// + // Unary updatable operators + + template + inline tmat4x2& tmat4x2::operator= (const tmat4x2& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } + + template + inline tmat4x2& tmat4x2::operator+= (const valType & s) + { + this->value[0] += s; + this->value[1] += s; + this->value[2] += s; + this->value[3] += s; + return *this; + } + + template + inline tmat4x2& tmat4x2::operator+= (const tmat4x2& m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + this->value[2] += m[2]; + this->value[3] += m[3]; + return *this; + } + + template + inline tmat4x2& tmat4x2::operator-= (const valType & s) + { + this->value[0] -= s; + this->value[1] -= s; + this->value[2] -= s; + this->value[3] -= s; + return *this; + } + + template + inline tmat4x2& tmat4x2::operator-= (const tmat4x2& m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + this->value[2] -= m[2]; + this->value[3] -= m[3]; + return *this; + } + + template + inline tmat4x2& tmat4x2::operator*= (const valType & s) + { + this->value[0] *= s; + this->value[1] *= s; + this->value[2] *= s; + this->value[3] *= s; + return *this; + } + + template + inline tmat4x2& tmat4x2::operator*= (const tmat2x4& m) + { + return (*this = tmat4x2(*this * m)); + } + + template + inline tmat4x2 & tmat4x2::operator/= (const valType & s) + { + this->value[0] /= s; + this->value[1] /= s; + this->value[2] /= s; + this->value[3] /= s; + return *this; + } + + //template + //inline tmat2x2& tmat4x2::operator/= (const tmat2x4& m) + //{ + // return (*this = *this / m); + //} + + template + inline tmat4x2& tmat4x2::operator++ () + { + ++this->value[0]; + ++this->value[1]; + ++this->value[2]; + ++this->value[3]; + return *this; + } + + template + inline tmat4x2& tmat4x2::operator-- () + { + --this->value[0]; + --this->value[1]; + --this->value[2]; + --this->value[3]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // inverse + template + inline tmat2x4 tmat4x2::_inverse() const + { + assert(0); //g.truc.creation[at]gmail.com + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat4x2 operator+ (const tmat4x2& m, const valType & s) + { + return tmat4x2( + m[0] + s, + m[1] + s, + m[2] + s, + m[3] + s); + } + + template + inline tmat4x2 operator+ (const tmat4x2& m1, const tmat4x2& m2) + { + return tmat4x2( + m1[0] + m2[0], + m1[1] + m2[1], + m1[2] + m2[2], + m1[3] + m2[3]); + } + + template + inline tmat4x2 operator- (const tmat4x2& m, const valType & s) + { + return tmat4x2( + m[0] - s, + m[1] - s, + m[2] - s, + m[3] - s); + } + + template + inline tmat4x2 operator- (const tmat4x2& m1, const tmat4x2& m2) + { + return tmat4x2( + m1[0] - m2[0], + m1[1] - m2[1], + m1[2] - m2[2], + m1[3] - m2[3]); + } + + template + inline tmat4x2 operator* (const tmat4x2& m, const valType & s) + { + return tmat4x2( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline tmat4x2 operator* (const valType & s, const tmat4x2 & m) + { + return tmat4x2( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline detail::tvec2 operator* (const tmat4x2& m, const tvec4& v) + { + return detail::tvec2( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w); + } + + template + inline tvec4 operator* (const detail::tvec2& v, const tmat4x2& m) + { + return tvec4( + v.x * m[0][0] + v.y * m[0][1], + v.x * m[1][0] + v.y * m[1][1], + v.x * m[2][0] + v.y * m[2][1], + v.x * m[3][0] + v.y * m[3][1]); + } + + template + inline tmat2x2 operator* (const tmat4x2& m1, const tmat2x4& m2) + { + const valType SrcA00 = m1[0][0]; + const valType SrcA01 = m1[0][1]; + const valType SrcA10 = m1[1][0]; + const valType SrcA11 = m1[1][1]; + const valType SrcA20 = m1[2][0]; + const valType SrcA21 = m1[2][1]; + const valType SrcA30 = m1[3][0]; + const valType SrcA31 = m1[3][1]; + + const valType SrcB00 = m2[0][0]; + const valType SrcB01 = m2[0][1]; + const valType SrcB02 = m2[0][2]; + const valType SrcB03 = m2[0][3]; + const valType SrcB10 = m2[1][0]; + const valType SrcB11 = m2[1][1]; + const valType SrcB12 = m2[1][2]; + const valType SrcB13 = m2[1][3]; + + tmat2x2 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA01 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13; + return Result; + } + + template + inline tmat4x2 operator/ (const tmat4x2& m, const valType & s) + { + return tmat4x2( + m[0] / s, + m[1] / s, + m[2] / s, + m[3] / s); + } + + template + inline tmat4x2 operator/ (const valType & s, const tmat4x2& m) + { + return tmat4x2( + s / m[0], + s / m[1], + s / m[2], + s / m[3]); + } + + //template + //tvec2 operator/ + //( + // tmat4x2 const & m, + // tvec4 const & v + //) + //{ + // return m._inverse() * v; + //} + + //template + //tvec4 operator/ + //( + // tvec2 const & v, + // tmat4x2 const & m + //) + //{ + // return v * m._inverse(); + //} + + //template + //inline tmat2x2 operator/ + //( + // tmat4x2 const & m1, + // tmat2x4 const & m2 + //) + //{ + // return m1 * m2._inverse(); + //} + + // Unary constant operators + template + inline tmat4x2 const operator- + ( + tmat4x2 const & m + ) + { + return tmat4x2( + -m[0], + -m[1], + -m[2], + -m[3]); + } + + template + inline tmat4x2 const operator++ + ( + tmat4x2 const & m, + int + ) + { + return tmat4x2( + m[0] + valType(1), + m[1] + valType(1), + m[2] + valType(1), + m[3] + valType(1)); + } + + template + inline tmat4x2 const operator-- + ( + tmat4x2 const & m, + int + ) + { + return tmat4x2( + m[0] - valType(1), + m[1] - valType(1), + m[2] - valType(1), + m[3] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_mat4x3.hpp b/glm/core/type_mat4x3.hpp new file mode 100644 index 0000000..e513a14 --- /dev/null +++ b/glm/core/type_mat4x3.hpp @@ -0,0 +1,216 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-08-04 +// Updated : 2006-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_type_mat4x3.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat4x3 +#define glm_core_type_mat4x3 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat4x3(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 4 * 3 matrix of floating-point numbers. + template + struct tmat4x3 + { + public: + typedef tmat4x3* pointer; + typedef const tmat4x3* const_pointer; + typedef const tmat4x3*const const_pointer_const; + typedef tmat4x3*const pointer_const; + typedef tmat4x3& reference; + typedef const tmat4x3& const_reference; + typedef const tmat4x3& param_type; + typedef tmat3x4 transpose_type; + + typedef T value_type; + typedef detail::tvec4 col_type; + typedef detail::tvec3 row_type; + typedef glm::sizeType size_type; + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat3x4 _inverse() const; + + private: + // Data + detail::tvec3 value[4]; + + public: + // Constructors + tmat4x3(); + explicit tmat4x3(T const & x); + explicit tmat4x3( + const T x0, const T y0, const T z0, + const T x1, const T y1, const T z1, + const T x2, const T y2, const T z2, + const T x3, const T y3, const T z3); + explicit tmat4x3( + const detail::tvec3& v0, + const detail::tvec3& v1, + const detail::tvec3& v2, + const detail::tvec3& v3); + + // Conversion + template + explicit tmat4x3(const tmat4x3& m); + + explicit tmat4x3(const tmat2x2& x); + explicit tmat4x3(const tmat3x3& x); + explicit tmat4x3(const tmat4x4& x); + explicit tmat4x3(const tmat2x3& x); + explicit tmat4x3(const tmat3x2& x); + explicit tmat4x3(const tmat2x4& x); + explicit tmat4x3(const tmat4x2& x); + explicit tmat4x3(const tmat3x4& x); + + // Accesses + detail::tvec3& operator[](size_type i); + detail::tvec3 const & operator[](size_type i) const; + + // Unary updatable operators + tmat4x3& operator= (tmat4x3 const & m); + tmat4x3& operator+= (T const & s); + tmat4x3& operator+= (tmat4x3 const & m); + tmat4x3& operator-= (T const & s); + tmat4x3& operator-= (tmat4x3 const & m); + tmat4x3& operator*= (T const & s); + tmat4x3& operator*= (tmat3x4 const & m); + tmat4x3& operator/= (T const & s); + //tmat4x3& operator/= (tmat3x4 const & m); + + tmat4x3& operator++ (); + tmat4x3& operator-- (); + + // Unary constant operators + const tmat4x3 operator- () const; + const tmat4x3 operator++ (int) const; + const tmat4x3 operator-- (int) const; + }; + + // Binary operators + template + tmat4x3 operator+ (const tmat4x3& m, const T & s); + + template + tmat4x3 operator+ (const tmat4x3& m1, const tmat4x3& m2); + + template + tmat4x3 operator- (const tmat4x3& m, const T & s); + + template + tmat4x3 operator- (const tmat4x3& m1, const tmat4x3& m2); + + template + tmat4x3 operator* (const tmat4x3& m, const T & s); + + template + tmat4x3 operator* (const T & s, const tmat4x3& m); + + template + detail::tvec3 operator* (const tmat4x3& m, const detail::tvec4& v); + + template + detail::tvec4 operator* (const detail::tvec3& v, const tmat4x3& m); + + template + tmat3x3 operator* (const tmat4x3& m1, const tmat3x4& m2); + + template + tmat4x3 operator/ (const tmat4x3& m, const T & s); + + template + tmat4x3 operator/ (const T & s, const tmat4x3 & m); + + //template + //detail::tvec3 operator/ (const tmat4x3& m, const detail::tvec4& v); + + //template + //detail::tvec4 operator/ (const detail::tvec3& v, const tmat4x3& m); + + //template + //tmat3x3 operator/ (const tmat4x3& m1, const tmat3x4& m2); + + // Unary constant operators + template + tmat4x3 const operator- (tmat4x3 const & m); + + template + tmat4x3 const operator-- (tmat4x3 const & m, int); + + template + tmat4x3 const operator++ (tmat4x3 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 4 columns of 3 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x3 lowp_mat4x3; + //! 4 columns of 3 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x3 mediump_mat4x3; + //! 4 columns of 3 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x3 highp_mat4x3; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 4 columns of 3 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat4x3 mat4x3; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat4x3 mat4x3; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat4x3 mat4x3; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat4x3 mat4x3; +#else + typedef detail::tmat4x3 mat4x3; +#endif//GLM_PRECISION + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat4x3.inl" + +#endif//glm_core_type_mat4x3 diff --git a/glm/core/type_mat4x3.inl b/glm/core/type_mat4x3.inl new file mode 100644 index 0000000..e8b4e94 --- /dev/null +++ b/glm/core/type_mat4x3.inl @@ -0,0 +1,613 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-17 +// Updated : 2006-04-17 +// Licence : This source is under MIT License +// File : glm/core/type_mat4x3.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat4x3::size_type tmat4x3::col_size() + { + return typename tmat4x3::size_type(4); + } + + template + typename tmat4x3::size_type tmat4x3::row_size() + { + return typename tmat4x3::size_type(3); + } + + template + bool tmat4x3::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec3& tmat4x3::operator[] + ( + typename tmat4x3::size_type i + ) + { + assert( + i >= typename tmat4x3::size_type(0) && + i < tmat4x3::col_size()); + + return value[i]; + } + + template + const detail::tvec3& tmat4x3::operator[] + ( + typename tmat4x3::size_type i + ) const + { + assert( + i >= typename tmat4x3::size_type(0) && + i < tmat4x3::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // Constructors + + template + inline tmat4x3::tmat4x3() + { + this->value[0] = detail::tvec3(1, 0, 0); + this->value[1] = detail::tvec3(0, 1, 0); + this->value[2] = detail::tvec3(0, 0, 1); + this->value[3] = detail::tvec3(0, 0, 0); + } + + template + inline tmat4x3::tmat4x3(valType const & s) + { + this->value[0] = detail::tvec3(s, 0, 0); + this->value[1] = detail::tvec3(0, s, 0); + this->value[2] = detail::tvec3(0, 0, s); + this->value[3] = detail::tvec3(0, 0, 0); + } + + template + inline tmat4x3::tmat4x3 + ( + const valType x0, const valType y0, const valType z0, + const valType x1, const valType y1, const valType z1, + const valType x2, const valType y2, const valType z2, + const valType x3, const valType y3, const valType z3 + ) + { + this->value[0] = detail::tvec3(x0, y0, z0); + this->value[1] = detail::tvec3(x1, y1, z1); + this->value[2] = detail::tvec3(x2, y2, z2); + this->value[3] = detail::tvec3(x3, y3, z3); + } + + template + inline tmat4x3::tmat4x3 + ( + const detail::tvec3 & v0, + const detail::tvec3 & v1, + const detail::tvec3 & v2, + const detail::tvec3 & v3 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + this->value[3] = v3; + } + + // Conversion + template + template + inline tmat4x3::tmat4x3 + ( + tmat4x3 const & m + ) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(m[2]); + this->value[3] = detail::tvec3(m[3]); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat2x2 const & m + ) + { + this->value[0] = detail::tvec3(m[0], valType(0)); + this->value[1] = detail::tvec3(m[1], valType(0)); + this->value[2] = detail::tvec3(m[2], valType(1)); + this->value[3] = detail::tvec3(valType(0)); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat3x3 const & m + ) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(m[2]); + this->value[3] = detail::tvec3(valType(0)); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat4x4 const & m + ) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(m[2]); + this->value[3] = detail::tvec3(m[3]); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat2x3 const & m + ) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(valType(0), valType(0), valType(1)); + this->value[3] = detail::tvec3(valType(0)); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat3x2 const & m + ) + { + this->value[0] = detail::tvec3(m[0], valType(0)); + this->value[1] = detail::tvec3(m[1], valType(0)); + this->value[2] = detail::tvec3(m[2], valType(1)); + this->value[3] = detail::tvec3(valType(0)); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat2x4 const & m + ) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(valType(0), valType(0), valType(1)); + this->value[3] = detail::tvec3(valType(0)); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat4x2 const & m + ) + { + this->value[0] = detail::tvec3(m[0], valType(0)); + this->value[1] = detail::tvec3(m[1], valType(0)); + this->value[2] = detail::tvec3(m[2], valType(1)); + this->value[3] = detail::tvec3(m[3], valType(0)); + } + + template + inline tmat4x3::tmat4x3 + ( + tmat3x4 const & m + ) + { + this->value[0] = detail::tvec3(m[0]); + this->value[1] = detail::tvec3(m[1]); + this->value[2] = detail::tvec3(m[2]); + this->value[3] = detail::tvec3(valType(0)); + } + + ////////////////////////////////////////////////////////////// + // Unary updatable operators + + template + inline tmat4x3& tmat4x3::operator= + ( + tmat4x3 const & m + ) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } + + template + inline tmat4x3& tmat4x3::operator+= + ( + valType const & s + ) + { + this->value[0] += s; + this->value[1] += s; + this->value[2] += s; + this->value[3] += s; + return *this; + } + + template + inline tmat4x3& tmat4x3::operator+= + ( + tmat4x3 const & m + ) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + this->value[2] += m[2]; + this->value[3] += m[3]; + return *this; + } + + template + inline tmat4x3& tmat4x3::operator-= + ( + valType const & s + ) + { + this->value[0] -= s; + this->value[1] -= s; + this->value[2] -= s; + this->value[3] -= s; + return *this; + } + + template + inline tmat4x3& tmat4x3::operator-= + ( + tmat4x3 const & m + ) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + this->value[2] -= m[2]; + this->value[3] -= m[3]; + return *this; + } + + template + inline tmat4x3& tmat4x3::operator*= + ( + valType const & s + ) + { + this->value[0] *= s; + this->value[1] *= s; + this->value[2] *= s; + this->value[3] *= s; + return *this; + } + + template + inline tmat4x3& tmat4x3::operator*= + ( + tmat3x4 const & m + ) + { + return (*this = tmat4x3(*this * m)); + } + + template + inline tmat4x3 & tmat4x3::operator/= + ( + valType const & s + ) + { + this->value[0] /= s; + this->value[1] /= s; + this->value[2] /= s; + this->value[3] /= s; + return *this; + } + + //template + //inline tmat4x3& tmat4x3::operator/= + //( + // tmat3x4 const & m + //) + //{ + // return (*this = *this / m); + //} + + template + inline tmat4x3& tmat4x3::operator++ () + { + ++this->value[0]; + ++this->value[1]; + ++this->value[2]; + ++this->value[3]; + return *this; + } + + template + inline tmat4x3& tmat4x3::operator-- () + { + --this->value[0]; + --this->value[1]; + --this->value[2]; + --this->value[3]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // inverse + template + inline tmat3x4 tmat4x3::_inverse() const + { + assert(0); //g.truc.creation[at]gmail.com + } + + ////////////////////////////////////////////////////////////// + // Unary constant operators + template + inline const tmat4x3 tmat4x3::operator- () const + { + return tmat4x3( + -this->value[0], + -this->value[1], + -this->value[2], + -this->value[3]); + } + + template + inline const tmat4x3 tmat4x3::operator-- (int) const + { + tmat4x3 m = *this; + --m.value[0]; + --m.value[1]; + --m.value[2]; + --m.value[3]; + return m; + } + + template + inline const tmat4x3 tmat4x3::operator++ (int) const + { + tmat4x4 m = *this; + ++m.value[0]; + ++m.value[1]; + ++m.value[2]; + ++m.value[3]; + return m; + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline tmat4x3 operator+ (const tmat4x3& m, valType const & s) + { + return tmat4x3( + m[0] + s, + m[1] + s, + m[2] + s, + m[3] + s); + } + + template + inline tmat4x3 operator+ (const tmat4x3& m1, const tmat4x3& m2) + { + return tmat4x3( + m1[0] + m2[0], + m1[1] + m2[1], + m1[2] + m2[2], + m1[3] + m2[3]); + } + + template + inline tmat4x3 operator- (const tmat4x3& m, valType const & s) + { + return tmat4x3( + m[0] - s, + m[1] - s, + m[2] - s, + m[3] - s); + } + + template + inline tmat4x3 operator- (const tmat4x3& m1, const tmat4x3& m2) + { + return tmat4x3( + m1[0] - m2[0], + m1[1] - m2[1], + m1[2] - m2[2], + m1[3] - m2[3]); + } + + template + inline tmat4x3 operator* (const tmat4x3& m, valType const & s) + { + return tmat4x3( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline tmat4x3 operator* (valType const & s, const tmat4x3 & m) + { + return tmat4x3( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline detail::tvec3 operator* (const tmat4x3& m, const detail::tvec4& v) + { + return detail::tvec3( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, + m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); + } + + template + inline detail::tvec4 operator* (const detail::tvec3& v, const tmat4x3& m) + { + return detail::tvec4( + v.x * m[0][0] + v.y * m[0][1] + v.z * m[0][2], + v.x * m[1][0] + v.y * m[1][1] + v.z * m[1][2], + v.x * m[2][0] + v.y * m[2][1] + v.z * m[2][2], + v.x * m[3][0] + v.y * m[3][1] + v.z * m[3][2]); + } + + template + inline tmat3x3 operator* (const tmat4x3& m1, const tmat3x4& m2) + { + const valType SrcA00 = m1[0][0]; + const valType SrcA01 = m1[0][1]; + const valType SrcA02 = m1[0][2]; + const valType SrcA10 = m1[1][0]; + const valType SrcA11 = m1[1][1]; + const valType SrcA12 = m1[1][2]; + const valType SrcA20 = m1[2][0]; + const valType SrcA21 = m1[2][1]; + const valType SrcA22 = m1[2][2]; + const valType SrcA30 = m1[3][0]; + const valType SrcA31 = m1[3][1]; + const valType SrcA32 = m1[3][2]; + + const valType SrcB00 = m2[0][0]; + const valType SrcB01 = m2[0][1]; + const valType SrcB02 = m2[0][2]; + const valType SrcB03 = m2[0][3]; + const valType SrcB10 = m2[1][0]; + const valType SrcB11 = m2[1][1]; + const valType SrcB12 = m2[1][2]; + const valType SrcB13 = m2[1][3]; + const valType SrcB20 = m2[2][0]; + const valType SrcB21 = m2[2][1]; + const valType SrcB22 = m2[2][2]; + const valType SrcB23 = m2[2][3]; + + tmat3x3 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03; + Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02 + SrcA32 * SrcB03; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13; + Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12 + SrcA32 * SrcB13; + Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22 + SrcA30 * SrcB23; + Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22 + SrcA31 * SrcB23; + Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22 + SrcA32 * SrcB23; + return Result; + } + + template + inline tmat4x3 operator/ (const tmat4x3& m, valType const & s) + { + return tmat4x3( + m[0] / s, + m[1] / s, + m[2] / s, + m[3] / s); + } + + template + inline tmat4x3 operator/ (valType const & s, const tmat4x3& m) + { + return tmat4x3( + s / m[0], + s / m[1], + s / m[2], + s / m[3]); + } + + //template + //inline tvec3 operator/ + //( + // tmat4x3 const & m, + // tvec3 const & v + //) + //{ + // return m._inverse() * v; + //} + + //template + //inline tvec4 operator/ + //( + // tvec3 const & v, + // tmat4x3 const & m + //) + //{ + // return v * m._inverse(); + //} + + //template + //inline tmat3x3 operator/ + //( + // tmat4x3 const & m1, + // tmat3x4 const & m2 + //) + //{ + // return m1 * m2._inverse(); + //} + + // Unary constant operators + template + inline tmat4x3 const operator- + ( + tmat4x3 const & m + ) + { + return tmat4x3( + -m[0], + -m[1], + -m[2], + -m[3]); + } + + template + inline tmat4x3 const operator++ + ( + tmat4x3 const & m, + int + ) + { + return tmat4x3( + m[0] + valType(1), + m[1] + valType(1), + m[2] + valType(1), + m[3] + valType(1)); + } + + template + inline tmat4x3 const operator-- + ( + tmat4x3 const & m, + int + ) + { + return tmat4x3( + m[0] - valType(1), + m[1] - valType(1), + m[2] - valType(1), + m[3] - valType(1)); + } + +} //namespace detail +} //namespace glm + diff --git a/glm/core/type_mat4x4.hpp b/glm/core/type_mat4x4.hpp new file mode 100644 index 0000000..25884ad --- /dev/null +++ b/glm/core/type_mat4x4.hpp @@ -0,0 +1,224 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-01-27 +// Updated : 2008-08-30 +// Licence : This source is under MIT License +// File : glm/core/type_mat4x4.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_mat4x4 +#define glm_core_type_mat4x4 + +#include "type_size.hpp" + +namespace glm +{ + namespace test + { + void main_mat4x4(); + }//namespace test + + namespace detail + { + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + template struct tmat2x2; + template struct tmat2x3; + template struct tmat2x4; + template struct tmat3x2; + template struct tmat3x3; + template struct tmat3x4; + template struct tmat4x2; + template struct tmat4x3; + template struct tmat4x4; + + //!< \brief Template for 4 * 4 matrix of floating-point numbers. + template + struct tmat4x4 + { + public: + enum ctor{null}; + + typedef tmat4x4* pointer; + typedef const tmat4x4* const_pointer; + typedef const tmat4x4*const const_pointer_const; + typedef tmat4x4*const pointer_const; + typedef tmat4x4& reference; + typedef const tmat4x4& const_reference; + typedef const tmat4x4& param_type; + typedef tmat4x4 transpose_type; + + typedef T value_type; + typedef tvec4 col_type; + typedef tvec4 row_type; + typedef glm::sizeType size_type; + static size_type value_size(); + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + public: + tmat4x4 _inverse() const; + + private: + // Data + detail::tvec4 value[4]; + + public: + // Constructors + tmat4x4(); + explicit tmat4x4(ctor Null); + explicit tmat4x4(T const & x); + explicit tmat4x4( + const T x0, const T y0, const T z0, const T w0, + const T x1, const T y1, const T z1, const T w1, + const T x2, const T y2, const T z2, const T w2, + const T x3, const T y3, const T z3, const T w3); + explicit tmat4x4( + detail::tvec4 const & v0, + detail::tvec4 const & v1, + detail::tvec4 const & v2, + detail::tvec4 const & v3); + + // Conversions + template + explicit tmat4x4(tmat4x4 const & m); + + explicit tmat4x4(tmat2x2 const & x); + explicit tmat4x4(tmat3x3 const & x); + explicit tmat4x4(tmat2x3 const & x); + explicit tmat4x4(tmat3x2 const & x); + explicit tmat4x4(tmat2x4 const & x); + explicit tmat4x4(tmat4x2 const & x); + explicit tmat4x4(tmat3x4 const & x); + explicit tmat4x4(tmat4x3 const & x); + + // Accesses + detail::tvec4& operator[](size_type i); + detail::tvec4 const & operator[](size_type i) const; + + // Unary updatable operators + tmat4x4& operator= (tmat4x4 const & m); + tmat4x4& operator+= (T const & s); + tmat4x4& operator+= (tmat4x4 const & m); + tmat4x4& operator-= (T const & s); + tmat4x4& operator-= (tmat4x4 const & m); + tmat4x4& operator*= (T const & s); + tmat4x4& operator*= (tmat4x4 const & m); + tmat4x4& operator/= (T const & s); + tmat4x4& operator/= (tmat4x4 const & m); + tmat4x4& operator++ (); + tmat4x4& operator-- (); + }; + + // Binary operators + template + tmat4x4 operator+ (const tmat4x4& m, valType const & s); + + template + tmat4x4 operator+ (valType const & s, const tmat4x4& m); + + template + tmat4x4 operator+ (const tmat4x4& m1, const tmat4x4& m2); + + template + tmat4x4 operator- (const tmat4x4& m, const T & s); + + template + tmat4x4 operator- (const T & s, const tmat4x4& m); + + template + tmat4x4 operator- (const tmat4x4& m1, const tmat4x4& m2); + + template + tmat4x4 operator* (const tmat4x4& m, const T & s); + + template + tmat4x4 operator* (const T & s, const tmat4x4& m); + + template + detail::tvec4 operator* (const tmat4x4& m, const detail::tvec4& v); + + template + detail::tvec4 operator* (const detail::tvec4& v, const tmat4x4& m); + + template + tmat4x4 operator* (const tmat4x4& m1, const tmat4x4& m2); + + template + tmat4x4 operator/ (const tmat4x4& m, const T & s); + + template + tmat4x4 operator/ (const T & s, const tmat4x4& m); + + template + detail::tvec4 operator/ (const tmat4x4& m, const detail::tvec4& v); + + template + detail::tvec4 operator/ (const detail::tvec4& v, const tmat4x4& m); + + template + tmat4x4 operator/ (const tmat4x4& m1, const tmat4x4& m2); + + // Unary constant operators + template + tmat4x4 const operator- (tmat4x4 const & m); + + template + tmat4x4 const operator-- (tmat4x4 const & m, int); + + template + tmat4x4 const operator++ (tmat4x4 const & m, int); + + } //namespace detail + + namespace core{ + namespace type{ + namespace matrix{ + + namespace precision + { + //! 4 columns of 4 components matrix of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x4 lowp_mat4x4; + //! 4 columns of 4 components matrix of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x4 mediump_mat4x4; + //! 4 columns of 4 components matrix of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices and section 4.5 Precision and Precision Qualifiers) + typedef detail::tmat4x4 highp_mat4x4; + } + //namespace precision + +#ifndef GLM_PRECISION + //! 4 columns of 4 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef detail::tmat4x4 mat4x4; +#elif(GLM_PRECISION & GLM_PRECISION_HIGH) + typedef detail::tmat4x4 mat4x4; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUM) + typedef detail::tmat4x4 mat4x4; +#elif(GLM_PRECISION & GLM_PRECISION_LOW) + typedef detail::tmat4x4 mat4x4; +#else + typedef detail::tmat4x4 mat4x4; +#endif//GLM_PRECISION + + //! 4 columns of 4 components matrix of floating-point numbers. + //! (From GLSL 1.30.8 specification, section 4.1.6 Matrices) + typedef mat4x4 mat4; + + }//namespace matrix + }//namespace type + }//namespace core +} //namespace glm + +#include "type_mat4x4.inl" + +#endif //glm_core_type_mat4x4 diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl new file mode 100644 index 0000000..00f69ea --- /dev/null +++ b/glm/core/type_mat4x4.inl @@ -0,0 +1,802 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-01-27 +// Updated : 2008-09-09 +// Licence : This source is under MIT License +// File : glm/core/type_mat4x4.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + template + typename tmat4x4::size_type tmat4x4::value_size() + { + return typename tmat4x4::size_type(4); + } + + template + typename tmat4x4::size_type tmat4x4::col_size() + { + return typename tmat4x4::size_type(4); + } + + template + typename tmat4x4::size_type tmat4x4::row_size() + { + return typename tmat4x4::size_type(4); + } + + template + bool tmat4x4::is_matrix() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + detail::tvec4& tmat4x4::operator[] + ( + typename tmat4x4::size_type i + ) + { + assert( + i >= typename tmat4x4::size_type(0) && + i < tmat4x4::col_size()); + + return value[i]; + } + + template + const detail::tvec4& tmat4x4::operator[] + ( + typename tmat4x4::size_type i + ) const + { + assert( + i >= typename tmat4x4::size_type(0) && + i < tmat4x4::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // mat4 constructors + + template + inline tmat4x4::tmat4x4() + { + this->value[0] = detail::tvec4(1, 0, 0, 0); + this->value[1] = detail::tvec4(0, 1, 0, 0); + this->value[2] = detail::tvec4(0, 0, 1, 0); + this->value[3] = detail::tvec4(0, 0, 0, 1); + } + + template + inline tmat4x4::tmat4x4(typename tmat4x4::ctor) + {} + + template + inline tmat4x4::tmat4x4(valType const & f) + { + this->value[0] = detail::tvec4(f, 0, 0, 0); + this->value[1] = detail::tvec4(0, f, 0, 0); + this->value[2] = detail::tvec4(0, 0, f, 0); + this->value[3] = detail::tvec4(0, 0, 0, f); + } + + template + inline tmat4x4::tmat4x4 + ( + const valType x0, const valType y0, const valType z0, const valType w0, + const valType x1, const valType y1, const valType z1, const valType w1, + const valType x2, const valType y2, const valType z2, const valType w2, + const valType x3, const valType y3, const valType z3, const valType w3 + ) + { + this->value[0] = detail::tvec4(x0, y0, z0, w0); + this->value[1] = detail::tvec4(x1, y1, z1, w1); + this->value[2] = detail::tvec4(x2, y2, z2, w2); + this->value[3] = detail::tvec4(x3, y3, z3, w3); + } + + template + inline tmat4x4::tmat4x4 + ( + detail::tvec4 const & v0, + detail::tvec4 const & v1, + detail::tvec4 const & v2, + detail::tvec4 const & v3 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + this->value[3] = v3; + } + + template + template + inline tmat4x4::tmat4x4 + ( + tmat4x4 const & m + ) + { + this->value[0] = detail::tvec4(m[0]); + this->value[1] = detail::tvec4(m[1]); + this->value[2] = detail::tvec4(m[2]); + this->value[3] = detail::tvec4(m[3]); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat2x2 const & m + ) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(0)); + this->value[1] = detail::tvec4(m[1], detail::tvec2(0)); + this->value[2] = detail::tvec4(valType(0)); + this->value[3] = detail::tvec4(valType(0), valType(0), valType(0), valType(1)); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat3x3 const & m + ) + { + this->value[0] = detail::tvec4(m[0], valType(0)); + this->value[1] = detail::tvec4(m[1], valType(0)); + this->value[2] = detail::tvec4(m[2], valType(0)); + this->value[3] = detail::tvec4(valType(0), valType(0), valType(0), valType(1)); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat2x3 const & m + ) + { + this->value[0] = detail::tvec4(m[0], valType(0)); + this->value[1] = detail::tvec4(m[1], valType(0)); + this->value[2] = detail::tvec4(valType(0)); + this->value[3] = detail::tvec4(valType(0), valType(0), valType(0), valType(1)); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat3x2 const & m + ) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(0)); + this->value[1] = detail::tvec4(m[1], detail::tvec2(0)); + this->value[2] = detail::tvec4(m[2], detail::tvec2(0)); + this->value[3] = detail::tvec4(valType(0), valType(0), valType(0), valType(1)); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat2x4 const & m + ) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = detail::tvec4(valType(0)); + this->value[3] = detail::tvec4(valType(0), valType(0), valType(0), valType(1)); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat4x2 const & m + ) + { + this->value[0] = detail::tvec4(m[0], detail::tvec2(0)); + this->value[1] = detail::tvec4(m[1], detail::tvec2(0)); + this->value[2] = detail::tvec4(valType(0)); + this->value[3] = detail::tvec4(valType(0), valType(0), valType(0), valType(1)); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat3x4 const & m + ) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = detail::tvec4(valType(0), valType(0), valType(0), valType(1)); + } + + template + inline tmat4x4::tmat4x4 + ( + tmat4x3 const & m + ) + { + this->value[0] = detail::tvec4(m[0], valType(0)); + this->value[1] = detail::tvec4(m[1], valType(0)); + this->value[2] = detail::tvec4(m[2], valType(0)); + this->value[3] = detail::tvec4(m[3], valType(1)); + } + +/* + template + inline tmat4x4::tmat4x4(const valType* a) + { + this->value[0] = detail::tvec4(a[0], a[1], a[2], a[3]); + this->value[1] = detail::tvec4(a[4], a[5], a[6], a[7]); + this->value[2] = detail::tvec4(a[8], a[9], a[10], a[11]); + this->value[4] = detail::tvec4(a[12], a[13], a[14], a[15]); + } +*/ + /* + // GL_GTX_euler_angles + template + inline tmat4x4::tmat4x4(const tvec3 & angles) + { + valType ch = cos(angles.x); + valType sh = sin(angles.x); + valType cp = cos(angles.y); + valType sp = sin(angles.y); + valType cb = cos(angles.z); + valType sb = sin(angles.z); + + value[0][0] = ch * cb + sh * sp * sb; + value[0][1] = sb * cp; + value[0][2] = -sh * cb + ch * sp * sb; + value[0][3] = 0.0f; + value[1][0] = -ch * sb + sh * sp * cb; + value[1][1] = cb * cp; + value[1][2] = sb * sh + ch * sp * cb; + value[1][3] = 0.0f; + value[2][0] = sh * cp; + value[2][1] = -sp; + value[2][2] = ch * cp; + value[2][3] = 0.0f; + value[3][0] = 0.0f; + value[3][1] = 0.0f; + value[3][2] = 0.0f; + value[3][3] = 1.0f; + } + */ + ////////////////////////////////////////////////////////////// + // mat4 conversion + /* + template + inline tmat4x4::tmat4x4(const tquat & q) + { + *this = tmat4x4(1); + this->value[0][0] = 1 - 2 * q.y * q.y - 2 * q.z * q.z; + this->value[0][1] = 2 * q.x * q.y + 2 * q.w * q.z; + this->value[0][2] = 2 * q.x * q.z - 2 * q.w * q.y; + + this->value[1][0] = 2 * q.x * q.y - 2 * q.w * q.z; + this->value[1][1] = 1 - 2 * q.x * q.x - 2 * q.z * q.z; + this->value[1][2] = 2 * q.y * q.z + 2 * q.w * q.x; + + this->value[2][0] = 2 * q.x * q.z + 2 * q.w * q.y; + this->value[2][1] = 2 * q.y * q.z - 2 * q.w * q.x; + this->value[2][2] = 1 - 2 * q.x * q.x - 2 * q.y * q.y; + } + */ + ////////////////////////////////////////////////////////////// + // mat4 operators + + template + inline tmat4x4& tmat4x4::operator= + ( + tmat4x4 const & m + ) + { + //memcpy could be faster + //memcpy(&this->value, &m.value, 16 * sizeof(valType)); + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator+= + ( + valType const & s + ) + { + this->value[0] += s; + this->value[1] += s; + this->value[2] += s; + this->value[3] += s; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator+= + ( + tmat4x4 const & m + ) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + this->value[2] += m[2]; + this->value[3] += m[3]; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator-= + ( + valType const & s + ) + { + this->value[0] -= s; + this->value[1] -= s; + this->value[2] -= s; + this->value[3] -= s; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator-= + ( + tmat4x4 const & m + ) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + this->value[2] -= m[2]; + this->value[3] -= m[3]; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator*= + ( + valType const & s + ) + { + this->value[0] *= s; + this->value[1] *= s; + this->value[2] *= s; + this->value[3] *= s; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator*= + ( + tmat4x4 const & m + ) + { + return (*this = *this * m); + } + + template + inline tmat4x4 & tmat4x4::operator/= + ( + valType const & s + ) + { + this->value[0] /= s; + this->value[1] /= s; + this->value[2] /= s; + this->value[3] /= s; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator/= + ( + tmat4x4 const & m + ) + { + return (*this = *this / m); + } + + template + inline tmat4x4& tmat4x4::operator++ () + { + ++this->value[0]; + ++this->value[1]; + ++this->value[2]; + ++this->value[3]; + return *this; + } + + template + inline tmat4x4& tmat4x4::operator-- () + { + --this->value[0]; + --this->value[1]; + --this->value[2]; + --this->value[3]; + return *this; + } + + template + inline tmat4x4 tmat4x4::_inverse() const + { + // Calculate all mat2 determinants + valType SubFactor00 = this->value[2][2] * this->value[3][3] - this->value[3][2] * this->value[2][3]; + valType SubFactor01 = this->value[2][1] * this->value[3][3] - this->value[3][1] * this->value[2][3]; + valType SubFactor02 = this->value[2][1] * this->value[3][2] - this->value[3][1] * this->value[2][2]; + valType SubFactor03 = this->value[2][0] * this->value[3][3] - this->value[3][0] * this->value[2][3]; + valType SubFactor04 = this->value[2][0] * this->value[3][2] - this->value[3][0] * this->value[2][2]; + valType SubFactor05 = this->value[2][0] * this->value[3][1] - this->value[3][0] * this->value[2][1]; + valType SubFactor06 = this->value[1][2] * this->value[3][3] - this->value[3][2] * this->value[1][3]; + valType SubFactor07 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3]; + valType SubFactor08 = this->value[1][1] * this->value[3][2] - this->value[3][1] * this->value[1][2]; + valType SubFactor09 = this->value[1][0] * this->value[3][3] - this->value[3][0] * this->value[1][3]; + valType SubFactor10 = this->value[1][0] * this->value[3][2] - this->value[3][0] * this->value[1][2]; + valType SubFactor11 = this->value[1][1] * this->value[3][3] - this->value[3][1] * this->value[1][3]; + valType SubFactor12 = this->value[1][0] * this->value[3][1] - this->value[3][0] * this->value[1][1]; + valType SubFactor13 = this->value[1][2] * this->value[2][3] - this->value[2][2] * this->value[1][3]; + valType SubFactor14 = this->value[1][1] * this->value[2][3] - this->value[2][1] * this->value[1][3]; + valType SubFactor15 = this->value[1][1] * this->value[2][2] - this->value[2][1] * this->value[1][2]; + valType SubFactor16 = this->value[1][0] * this->value[2][3] - this->value[2][0] * this->value[1][3]; + valType SubFactor17 = this->value[1][0] * this->value[2][2] - this->value[2][0] * this->value[1][2]; + valType SubFactor18 = this->value[1][0] * this->value[2][1] - this->value[2][0] * this->value[1][1]; + + tmat4x4 Inverse( + + (this->value[1][1] * SubFactor00 - this->value[1][2] * SubFactor01 + this->value[1][3] * SubFactor02), + - (this->value[1][0] * SubFactor00 - this->value[1][2] * SubFactor03 + this->value[1][3] * SubFactor04), + + (this->value[1][0] * SubFactor01 - this->value[1][1] * SubFactor03 + this->value[1][3] * SubFactor05), + - (this->value[1][0] * SubFactor02 - this->value[1][1] * SubFactor04 + this->value[1][2] * SubFactor05), + + - (this->value[0][1] * SubFactor00 - this->value[0][2] * SubFactor01 + this->value[0][3] * SubFactor02), + + (this->value[0][0] * SubFactor00 - this->value[0][2] * SubFactor03 + this->value[0][3] * SubFactor04), + - (this->value[0][0] * SubFactor01 - this->value[0][1] * SubFactor03 + this->value[0][3] * SubFactor05), + + (this->value[0][0] * SubFactor02 - this->value[0][1] * SubFactor04 + this->value[0][2] * SubFactor05), + + + (this->value[0][1] * SubFactor06 - this->value[0][2] * SubFactor07 + this->value[0][3] * SubFactor08), + - (this->value[0][0] * SubFactor06 - this->value[0][2] * SubFactor09 + this->value[0][3] * SubFactor10), + + (this->value[0][0] * SubFactor11 - this->value[0][1] * SubFactor09 + this->value[0][3] * SubFactor12), + - (this->value[0][0] * SubFactor08 - this->value[0][1] * SubFactor10 + this->value[0][2] * SubFactor12), + + - (this->value[0][1] * SubFactor13 - this->value[0][2] * SubFactor14 + this->value[0][3] * SubFactor15), + + (this->value[0][0] * SubFactor13 - this->value[0][2] * SubFactor16 + this->value[0][3] * SubFactor17), + - (this->value[0][0] * SubFactor14 - this->value[0][1] * SubFactor16 + this->value[0][3] * SubFactor18), + + (this->value[0][0] * SubFactor15 - this->value[0][1] * SubFactor17 + this->value[0][2] * SubFactor18)); + + valType Determinant = this->value[0][0] * Inverse[0][0] + + this->value[0][1] * Inverse[1][0] + + this->value[0][2] * Inverse[2][0] + + this->value[0][3] * Inverse[3][0]; + + Inverse /= Determinant; + return Inverse; + } + + // Binary operators + template + inline tmat4x4 operator+ + ( + tmat4x4 const & m, + valType const & s + ) + { + return tmat4x4( + m[0] + s, + m[1] + s, + m[2] + s, + m[3] + s); + } + + template + inline tmat4x4 operator+ + ( + valType const & s, + tmat4x4 const & m + ) + { + return tmat4x4( + m[0] + s, + m[1] + s, + m[2] + s, + m[3] + s); + } + + template + inline tmat4x4 operator+ + ( + tmat4x4 const & m1, + tmat4x4 const & m2 + ) + { + return tmat4x4( + m1[0] + m2[0], + m1[1] + m2[1], + m1[2] + m2[2], + m1[3] + m2[3]); + } + + template + inline tmat4x4 operator- + ( + tmat4x4 const & m, + valType const & s + ) + { + return tmat4x4( + m[0] - s, + m[1] - s, + m[2] - s, + m[3] - s); + } + + template + inline tmat4x4 operator- + ( + valType const & s, + tmat4x4 const & m + ) + { + return tmat4x4( + s - m[0], + s - m[1], + s - m[2], + s - m[3]); + } + + template + inline tmat4x4 operator- + ( + tmat4x4 const & m1, + tmat4x4 const & m2 + ) + { + return tmat4x4( + m1[0] - m2[0], + m1[1] - m2[1], + m1[2] - m2[2], + m1[3] - m2[3]); + } + + template + inline tmat4x4 operator* + ( + tmat4x4 const & m, + valType const & s + ) + { + return tmat4x4( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline tmat4x4 operator* + ( + valType const & s, + tmat4x4 const & m + ) + { + return tmat4x4( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline detail::tvec4 operator* + ( + tmat4x4 const & m, + detail::tvec4 const & v + ) + { + return detail::tvec4( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, + m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w, + m[0][3] * v.x + m[1][3] * v.y + m[2][3] * v.z + m[3][3] * v.w); + } + + template + inline detail::tvec4 operator* + ( + detail::tvec4 const & v, + tmat4x4 const & m + ) + { + return detail::tvec4( + m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w, + m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w, + m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w, + m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] * v.w); + } +/* + template + inline tmat4x4 operator* + ( + tmat4x4 const & m1, + tmat4x4 const & m2 + ) + { + const valType SrcA00 = m1[0][0]; + const valType SrcA01 = m1[0][1]; + const valType SrcA02 = m1[0][2]; + const valType SrcA03 = m1[0][3]; + const valType SrcA10 = m1[1][0]; + const valType SrcA11 = m1[1][1]; + const valType SrcA12 = m1[1][2]; + const valType SrcA13 = m1[1][3]; + const valType SrcA20 = m1[2][0]; + const valType SrcA21 = m1[2][1]; + const valType SrcA22 = m1[2][2]; + const valType SrcA23 = m1[2][3]; + const valType SrcA30 = m1[3][0]; + const valType SrcA31 = m1[3][1]; + const valType SrcA32 = m1[3][2]; + const valType SrcA33 = m1[3][3]; + + const valType SrcB00 = m2[0][0]; + const valType SrcB01 = m2[0][1]; + const valType SrcB02 = m2[0][2]; + const valType SrcB03 = m2[0][3]; + const valType SrcB10 = m2[1][0]; + const valType SrcB11 = m2[1][1]; + const valType SrcB12 = m2[1][2]; + const valType SrcB13 = m2[1][3]; + const valType SrcB20 = m2[2][0]; + const valType SrcB21 = m2[2][1]; + const valType SrcB22 = m2[2][2]; + const valType SrcB23 = m2[2][3]; + const valType SrcB30 = m2[3][0]; + const valType SrcB31 = m2[3][1]; + const valType SrcB32 = m2[3][2]; + const valType SrcB33 = m2[3][3]; + + tmat4x4 Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02 + SrcA30 * SrcB03; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02 + SrcA31 * SrcB03; + Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02 + SrcA32 * SrcB03; + Result[0][3] = SrcA03 * SrcB00 + SrcA13 * SrcB01 + SrcA23 * SrcB02 + SrcA33 * SrcB03; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12 + SrcA30 * SrcB13; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12 + SrcA31 * SrcB13; + Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12 + SrcA32 * SrcB13; + Result[1][3] = SrcA03 * SrcB10 + SrcA13 * SrcB11 + SrcA23 * SrcB12 + SrcA33 * SrcB13; + Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22 + SrcA30 * SrcB23; + Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22 + SrcA31 * SrcB23; + Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22 + SrcA32 * SrcB23; + Result[2][3] = SrcA03 * SrcB20 + SrcA13 * SrcB21 + SrcA23 * SrcB22 + SrcA33 * SrcB23; + Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31 + SrcA20 * SrcB32 + SrcA30 * SrcB33; + Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31 + SrcA21 * SrcB32 + SrcA31 * SrcB33; + Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31 + SrcA22 * SrcB32 + SrcA32 * SrcB33; + Result[3][3] = SrcA03 * SrcB30 + SrcA13 * SrcB31 + SrcA23 * SrcB32 + SrcA33 * SrcB33; + return Result; + } +*/ + template + inline tmat4x4 operator* + ( + tmat4x4 const & m1, + tmat4x4 const & m2 + ) + { + detail::tvec4 const SrcA0 = m1[0]; + detail::tvec4 const SrcA1 = m1[1]; + detail::tvec4 const SrcA2 = m1[2]; + detail::tvec4 const SrcA3 = m1[3]; + + detail::tvec4 const SrcB0 = m2[0]; + detail::tvec4 const SrcB1 = m2[1]; + detail::tvec4 const SrcB2 = m2[2]; + detail::tvec4 const SrcB3 = m2[3]; + + tmat4x4 Result; + Result[0] = SrcA0 * SrcB0[0] + SrcA1 * SrcB0[1] + SrcA2 * SrcB0[2] + SrcA3 * SrcB0[3]; + Result[1] = SrcA0 * SrcB1[0] + SrcA1 * SrcB1[1] + SrcA2 * SrcB1[2] + SrcA3 * SrcB1[3]; + Result[2] = SrcA0 * SrcB2[0] + SrcA1 * SrcB2[1] + SrcA2 * SrcB2[2] + SrcA3 * SrcB2[3]; + Result[3] = SrcA0 * SrcB3[0] + SrcA1 * SrcB3[1] + SrcA2 * SrcB3[2] + SrcA3 * SrcB3[3]; + return Result; + } + + template + inline tmat4x4 operator/ + ( + tmat4x4 const & m, + valType const & s + ) + { + return tmat4x4( + m[0] / s, + m[1] / s, + m[2] / s, + m[3] / s); + } + + template + inline tmat4x4 operator/ (const valType s, const tmat4x4& m) + { + return tmat4x4( + s / m[0], + s / m[1], + s / m[2], + s / m[3]); + } + + template + inline tvec4 operator/ + ( + tmat4x4 const & m, + tvec4 const & v + ) + { + return m._inverse() * v; + } + + template + inline tvec4 operator/ + ( + tvec4 const & v, + tmat4x4 const & m + ) + { + return v * m._inverse(); + } + + template + inline tmat4x4 operator/ + ( + tmat4x4 const & m1, + tmat4x4 const & m2 + ) + { + return m1 * m2._inverse(); + } + + // Unary constant operators + template + inline tmat4x4 const operator- + ( + tmat4x4 const & m + ) + { + return tmat4x4( + -m[0], + -m[1], + -m[2], + -m[3]); + } + + template + inline tmat4x4 const operator++ + ( + tmat4x4 const & m, + int + ) + { + return tmat4x4( + m[0] + valType(1), + m[1] + valType(1), + m[2] + valType(1), + m[3] + valType(1)); + } + + template + inline tmat4x4 const operator-- + ( + tmat4x4 const & m, + int + ) + { + return tmat4x4( + m[0] - valType(1), + m[1] - valType(1), + m[2] - valType(1), + m[3] - valType(1)); + } + +} //namespace detail +} //namespace glm diff --git a/glm/core/type_size.hpp b/glm/core/type_size.hpp new file mode 100644 index 0000000..cca4c59 --- /dev/null +++ b/glm/core/type_size.hpp @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-05 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/core/type_size.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_size +#define glm_core_type_size + +#include + +namespace glm +{ + namespace core{ + namespace type{ + namespace scalar{ + + //typedef std::size_t size_t; + typedef int sizeType; + + }//namespace scalar + }//namespace type + }//namespace core +}//namespace glm + +#endif//glm_core_type_size diff --git a/glm/core/type_vec1.hpp b/glm/core/type_vec1.hpp new file mode 100644 index 0000000..95eff92 --- /dev/null +++ b/glm/core/type_vec1.hpp @@ -0,0 +1,254 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-25 +// Updated : 2008-08-31 +// Licence : This source is under MIT License +// File : glm/core/type_vec1.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_gentype1 +#define glm_core_type_gentype1 + +#include "type_float.hpp" +#include "type_int.hpp" +#include "type_size.hpp" +#include "_swizzle.hpp" + +namespace glm +{ + namespace test + { + void main_vec1(); + }//namespace test + + namespace detail + { + template struct tref1; + template struct tref2; + template struct tref3; + template struct tref4; + template struct tvec1; + template struct tvec2; + template struct tvec3; + template struct tvec4; + + template + struct tvec1 + { + ////////////////////////////////////// + // Typedef (Implementation details) + + typedef valType value_type; + typedef valType& value_reference; + typedef valType* value_pointer; + typedef tvec1 bool_type; + + typedef glm::sizeType size_type; + static size_type value_size(); + static bool is_vector(); + + typedef tvec1 type; + typedef tvec1* pointer; + typedef const tvec1* const_pointer; + typedef const tvec1*const const_pointer_const; + typedef tvec1*const pointer_const; + typedef tvec1& reference; + typedef const tvec1& const_reference; + typedef const tvec1& param_type; + + ////////////////////////////////////// + // Data + +# if defined(GLM_USE_ONLY_XYZW) + value_type x, y; +# else//GLM_USE_ONLY_XYZW + union {value_type x, r, s;}; +# endif//GLM_USE_ONLY_XYZW + + ////////////////////////////////////// + // Accesses + + valType& operator[](size_type i); + valType const & operator[](size_type i) const; + + ////////////////////////////////////// + // Address (Implementation details) + + const value_type* _address() const{return (value_type*)(this);} + value_type* _address(){return (value_type*)(this);} + + ////////////////////////////////////// + // Implicit basic constructors + + tvec1(); + tvec1(const tvec1& v); + + ////////////////////////////////////// + // Explicit basic constructors + + tvec1(valType s); + + ////////////////////////////////////// + // Swizzle constructors + + tvec1(const tref1& r); + + ////////////////////////////////////// + // Convertion scalar constructors + + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec1(U x); + + ////////////////////////////////////// + // Convertion vector constructors + + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec1(const tvec2& v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec1(const tvec3& v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec1(const tvec4& v); + + ////////////////////////////////////// + // Unary arithmetic operators + + tvec1& operator= (const tvec1& v); + + tvec1& operator+=(valType const & s); + tvec1& operator+=(const tvec1& v); + tvec1& operator-=(valType const & s); + tvec1& operator-=(const tvec1& v); + tvec1& operator*=(valType const & s); + tvec1& operator*=(const tvec1& v); + tvec1& operator/=(valType const & s); + tvec1& operator/=(const tvec1& v); + tvec1& operator++(); + tvec1& operator--(); + + ////////////////////////////////////// + // Unary bit operators + + tvec1& operator%=(valType const & s); + tvec1& operator%=(const tvec1& v); + tvec1& operator&=(valType const & s); + tvec1& operator&=(const tvec1& v); + tvec1& operator|=(valType const & s); + tvec1& operator|=(const tvec1& v); + tvec1& operator^=(valType const & s); + tvec1& operator^=(const tvec1& v); + tvec1& operator<<=(valType const & s); + tvec1& operator<<=(const tvec1& v); + tvec1& operator>>=(valType const & s); + tvec1& operator>>=(const tvec1& v); + + ////////////////////////////////////// + // Swizzle operators + + valType swizzle(comp X) const; + tvec2 swizzle(comp X, comp Y) const; + tvec3 swizzle(comp X, comp Y, comp Z) const; + tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + tref1 swizzle(comp X); + }; + + template + struct tref1 + { + tref1(T& x); + tref1(const tref1& r); + tref1(const tvec1& v); + + tref1& operator= (const tref1& r); + tref1& operator= (const tvec1& v); + + T& x; + }; + } //namespace detail + + namespace core{ + namespace type{ + namespace vector{ + + ////////////////////////// + // Boolean definition + + typedef detail::tvec1 bvec1; + + ////////////////////////// + // Float definition + +#ifndef GLM_PRECISION + typedef detail::tvec1 vec1; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_FLOAT) + typedef detail::tvec1 vec1; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_FLOAT) + typedef detail::tvec1 vec1; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_FLOAT) + typedef detail::tvec1 vec1; +#else + typedef detail::tvec1 vec1; +#endif//GLM_PRECISION + + namespace precision + { + typedef detail::tvec1 highp_vec1; + typedef detail::tvec1 mediump_vec1; + typedef detail::tvec1 lowp_vec1; + } + //namespace precision + + ////////////////////////// + // Signed integer definition + +#ifndef GLM_PRECISION + typedef detail::tvec1 ivec1; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_INT) + typedef detail::tvec1 ivec1; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_INT) + typedef detail::tvec1 ivec1; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_INT) + typedef detail::tvec1 ivec1; +#endif//GLM_PRECISION + + namespace precision + { + typedef detail::tvec1 highp_ivec1; + typedef detail::tvec1 mediump_ivec1; + typedef detail::tvec1 lowp_ivec1; + } + //namespace precision + + ////////////////////////// + // Unsigned integer definition + +#ifndef GLM_PRECISION + typedef detail::tvec1 uvec1; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_UINT) + typedef detail::tvec1 uvec1; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_UINT) + typedef detail::tvec1 uvec1; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_UINT) + typedef detail::tvec1 uvec1; +#endif//GLM_PRECISION + + namespace precision + { + typedef detail::tvec1 highp_uvec1; + typedef detail::tvec1 mediump_uvec1; + typedef detail::tvec1 lowp_uvec1; + } + //namespace precision + + }//namespace vector + }//namespace type + }//namespace core +}//namespace glm + +#include "type_vec1.inl" + +#endif//glm_core_type_gentype1 diff --git a/glm/core/type_vec1.inl b/glm/core/type_vec1.inl new file mode 100644 index 0000000..33eed0c --- /dev/null +++ b/glm/core/type_vec1.inl @@ -0,0 +1,595 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-25 +// Updated : 2008-09-09 +// Licence : This source is under MIT License +// File : glm/core/type_vec1.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + template + typename tvec1::size_type tvec1::value_size() + { + return typename tvec1::size_type(1); + } + + template + bool tvec1::is_vector() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + valType& tvec1::operator[](typename tvec1::size_type i) + { + assert( i >= typename tvec1::size_type(0) && + i < tvec1::value_size()); + return (&x)[i]; + } + + template + valType const & tvec1::operator[](typename tvec1::size_type i) const + { + assert( i >= typename tvec1::size_type(0) && + i < tvec1::value_size()); + return (&x)[i]; + } + + ////////////////////////////////////// + // Implicit basic constructors + + template + tvec1::tvec1() : + x(valType(0)) + {} + + template + tvec1::tvec1(const tvec1& v) : + x(v.x) + {} + + ////////////////////////////////////// + // Explicit basic constructors + + template + tvec1::tvec1(valType s) : + x(s) + {} + + ////////////////////////////////////// + // Swizzle constructors + + template + tvec1::tvec1(const tref1& r) : + x(r.x) + {} + + ////////////////////////////////////// + // Convertion scalar constructors + + template + template + tvec1::tvec1(U x) : + x(valType(x)) + {} + + ////////////////////////////////////// + // Convertion vector constructors + + template + template + tvec1::tvec1(const tvec2& v) : + x(valType(v.x)) + {} + + template + template + tvec1::tvec1(const tvec3& v) : + x(valType(v.x)) + {} + + template + template + tvec1::tvec1(const tvec4& v) : + x(valType(v.x)) + {} + + ////////////////////////////////////// + // Unary arithmetic operators + + template + tvec1& tvec1::operator= (const tvec1& v) + { + this->x = v.x; + return *this; + } + + template + tvec1& tvec1::operator+=(valType const & s) + { + this->x += s; + return *this; + } + + template + tvec1& tvec1::operator+=(const tvec1& v) + { + this->x += v.x; + return *this; + } + + template + tvec1& tvec1::operator-=(valType const & s) + { + this->x -= s; + return *this; + } + + template + tvec1& tvec1::operator-=(const tvec1& v) + { + this->x -= v.x; + return *this; + } + + template + tvec1& tvec1::operator*=(valType const & s) + { + this->x *= s; + return *this; + } + + template + tvec1& tvec1::operator*=(const tvec1& v) + { + this->x *= v.x; + return *this; + } + + template + tvec1& tvec1::operator/=(valType const & s) + { + this->x /= s; + return *this; + } + + template + tvec1& tvec1::operator/=(const tvec1& v) + { + this->x /= v.x; + return *this; + } + + template + tvec1& tvec1::operator++() + { + ++this->x; + return *this; + } + + template + tvec1& tvec1::operator--() + { + --this->x; + return *this; + } + + ////////////////////////////////////// + // Unary bit operators + + template + tvec1& tvec1::operator%=(valType const & s) + { + this->x %= s; + return *this; + } + + template + tvec1& tvec1::operator%=(const tvec1& v) + { + this->x %= v.x; + return *this; + } + + template + tvec1& tvec1::operator&=(valType const & s) + { + this->x &= s; + return *this; + } + + template + tvec1& tvec1::operator&=(const tvec1& v) + { + this->x &= v.x; + return *this; + } + + template + tvec1& tvec1::operator|=(valType const & s) + { + this->x |= s; + return *this; + } + + template + tvec1& tvec1::operator|=(const tvec1& v) + { + this->x |= v.x; + return *this; + } + + template + tvec1& tvec1::operator^=(valType const & s) + { + this->x ^= s; + return *this; + } + + template + tvec1& tvec1::operator^=(const tvec1& v) + { + this->x ^= v.x; + return *this; + } + + template + tvec1& tvec1::operator<<=(valType const & s) + { + this->x <<= s; + return *this; + } + + template + tvec1& tvec1::operator<<=(const tvec1& v) + { + this->x <<= v.x; + return *this; + } + + template + tvec1& tvec1::operator>>=(valType const & s) + { + this->x >>= s; + return *this; + } + + template + tvec1& tvec1::operator>>=(const tvec1& v) + { + this->x >>= v.x; + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + template + valType tvec1::swizzle(comp x) const + { + return (*this)[x]; + } + + template + tvec2 tvec1::swizzle(comp x, comp y) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } + + template + tvec3 tvec1::swizzle(comp x, comp y, comp z) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + template + tvec4 tvec1::swizzle(comp x, comp y, comp z, comp w) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + template + tref1 tvec1::swizzle(comp x) + { + return tref1( + (*this)[x]); + } + + ////////////////////////////////////// + // Binary arithmetic operators + + template + inline tvec1 operator+ (const tvec1& v, T const & s) + { + return tvec1( + v.x + s); + } + + template + inline tvec1 operator+ (T const & s, const tvec1& v) + { + return tvec1( + s + v.x); + } + + template + inline tvec1 operator+ (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x + v2.x); + } + + //operator- + template + inline tvec1 operator- (const tvec1& v, T const & s) + { + return tvec1( + v.x - s); + } + + template + inline tvec1 operator- (T const & s, const tvec1& v) + { + return tvec1( + s - v.x); + } + + template + inline tvec1 operator- (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x - v2.x); + } + + //operator* + template + inline tvec1 operator* (const tvec1& v, T const & s) + { + return tvec1( + v.x * s); + } + + template + inline tvec1 operator* (T const & s, const tvec1& v) + { + return tvec1( + s * v.x); + } + + template + inline tvec1 operator* (const tvec1& v1, const tvec1 & v2) + { + return tvec1( + v1.x * v2.x); + } + + //operator/ + template + inline tvec1 operator/ (const tvec1& v, T const & s) + { + return tvec1( + v.x / s); + } + + template + inline tvec1 operator/ (T const & s, const tvec1& v) + { + return tvec1( + s / v.x); + } + + template + inline tvec1 operator/ (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x / v2.x); + } + + // Unary constant operators + template + inline tvec1 operator- (const tvec1& v) + { + return tvec1( + -v.x); + } + + template + inline tvec1 operator++ (const tvec1& v, int) + { + return tvec1( + v.x + T(1)); + } + + template + inline tvec1 operator-- (const tvec1& v, int) + { + return tvec1( + v.x - T(1)); + } + + ////////////////////////////////////// + // Binary bit operators + + template + inline tvec1 operator% (const tvec1& v, T const & s) + { + return tvec1( + v.x % s); + } + + template + inline tvec1 operator% (T const & s, const tvec1& v) + { + return tvec1( + s % v.x); + } + + template + inline tvec1 operator% (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x % v2.x); + } + + template + inline tvec1 operator& (const tvec1& v, T const & s) + { + return tvec1( + v.x & s); + } + + template + inline tvec1 operator& (T const & s, const tvec1& v) + { + return tvec1( + s & v.x); + } + + template + inline tvec1 operator& (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x & v2.x); + } + + template + inline tvec1 operator| (const tvec1& v, T const & s) + { + return tvec1( + v.x | s); + } + + template + inline tvec1 operator| (T const & s, const tvec1& v) + { + return tvec1( + s | v.x); + } + + template + inline tvec1 operator| (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x | v2.x); + } + + template + inline tvec1 operator^ (const tvec1& v, T const & s) + { + return tvec1( + v.x ^ s); + } + + template + inline tvec1 operator^ (T const & s, const tvec1& v) + { + return tvec1( + s ^ v.x); + } + + template + inline tvec1 operator^ (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x ^ v2.x); + } + + template + inline tvec1 operator<< (const tvec1& v, T const & s) + { + return tvec1( + v.x << s); + } + + template + inline tvec1 operator<< (T const & s, const tvec1& v) + { + return tvec1( + s << v.x); + } + + template + inline tvec1 operator<< (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x << v2.x); + } + + template + inline tvec1 operator>> (const tvec1& v, T const & s) + { + return tvec1( + v.x >> s); + } + + template + inline tvec1 operator>> (T const & s, const tvec1& v) + { + return tvec1( + s >> v.x); + } + + template + inline tvec1 operator>> (const tvec1& v1, const tvec1& v2) + { + return tvec1( + v1.x >> v2.x); + } + + template + inline tvec1 operator~ (const tvec1& v) + { + return tvec1( + ~v.x); + } + + ////////////////////////////////////// + // tref definition + + template + tref1::tref1(T& x) : + x(x) + {} + + template + tref1::tref1(const tref1& r) : + x(r.x) + {} + + template + tref1::tref1(const tvec1& v) : + x(v.x) + {} + + template + tref1& tref1::operator= (const tref1& r) + { + x = r.x; + return *this; + } + + template + tref1& tref1::operator= (const tvec1& v) + { + x = v.x; + return *this; + } + + }//namespace detail +}//namespace glm diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp new file mode 100644 index 0000000..f6d3815 --- /dev/null +++ b/glm/core/type_vec2.hpp @@ -0,0 +1,311 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-18 +// Updated : 2008-08-31 +// Licence : This source is under MIT License +// File : glm/core/type_tvec2.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_gentype2 +#define glm_core_type_gentype2 + +#include "type_float.hpp" +#include "type_int.hpp" +#include "type_size.hpp" +#include "_swizzle.hpp" + +namespace glm +{ + namespace test + { + void main_vec2(); + } + //namespace test + + namespace detail + { + template struct tref2; + template struct tref3; + template struct tref4; + template struct tvec3; + template struct tvec4; + + template + struct tvec2 + { + ////////////////////////////////////// + // Typedef (Implementation details) + + typedef valType value_type; + typedef valType& value_reference; + typedef valType* value_pointer; + typedef tvec2 bool_type; + + typedef glm::sizeType size_type; + static size_type value_size(); + static bool is_vector(); + + typedef tvec2 type; + typedef tvec2* pointer; + typedef const tvec2* const_pointer; + typedef const tvec2*const const_pointer_const; + typedef tvec2*const pointer_const; + typedef tvec2& reference; + typedef const tvec2& const_reference; + typedef const tvec2& param_type; + + ////////////////////////////////////// + // Data + +# if defined(GLM_USE_ONLY_XYZW) + value_type x, y; +# else//GLM_USE_ONLY_XYZW +# ifdef GLM_USE_ANONYMOUS_UNION + union + { + struct{value_type x, y;}; + struct{value_type r, g;}; + struct{value_type s, t;}; + }; +# else//GLM_USE_ANONYMOUS_UNION + union {value_type x, r, s;}; + union {value_type y, g, t;}; +# endif//GLM_USE_ANONYMOUS_UNION +# endif//GLM_USE_ONLY_XYZW + + ////////////////////////////////////// + // Accesses + + valType & operator[](size_type i); + valType const & operator[](size_type i) const; + + ////////////////////////////////////// + // Address (Implementation details) + + value_type const * const _address() const{return (value_type*)(this);} + value_type * _address(){return (value_type*)(this);} + + ////////////////////////////////////// + // Implicit basic constructors + + tvec2(); + tvec2(tvec2 const & v); + + ////////////////////////////////////// + // Explicit basic constructors + + explicit tvec2(valType s); + explicit tvec2(valType s1, valType s2); + + ////////////////////////////////////// + // Swizzle constructors + + tvec2(tref2 const & r); + + ////////////////////////////////////// + // Convertion scalar constructors + + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(U x); + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(U x, V y); + + ////////////////////////////////////// + // Convertion vector constructors + + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(tvec2 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(tvec3 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(tvec4 const & v); + + ////////////////////////////////////// + // Unary arithmetic operators + + tvec2& operator= (tvec2 const & v); + + tvec2& operator+=(valType const & s); + tvec2& operator+=(tvec2 const & v); + tvec2& operator-=(valType const & s); + tvec2& operator-=(tvec2 const & v); + tvec2& operator*=(valType const & s); + tvec2& operator*=(tvec2 const & v); + tvec2& operator/=(valType const & s); + tvec2& operator/=(tvec2 const & v); + tvec2& operator++(); + tvec2& operator--(); + + ////////////////////////////////////// + // Unary bit operators + + tvec2& operator%=(valType const & s); + tvec2& operator%=(tvec2 const & v); + tvec2& operator&=(valType const & s); + tvec2& operator&=(tvec2 const & v); + tvec2& operator|=(valType const & s); + tvec2& operator|=(tvec2 const & v); + tvec2& operator^=(valType const & s); + tvec2& operator^=(tvec2 const & v); + tvec2& operator<<=(valType const & s); + tvec2& operator<<=(tvec2 const & v); + tvec2& operator>>=(valType const & s); + tvec2& operator>>=(tvec2 const & v); + + ////////////////////////////////////// + // Swizzle operators + + valType swizzle(comp X) const; + tvec2 swizzle(comp X, comp Y) const; + tvec3 swizzle(comp X, comp Y, comp Z) const; + tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + tref2 swizzle(comp X, comp Y); + }; + +// tvec2::tvec2(float x, float y) : +// x(detail::thalf(x)), +// y(detail::thalf(y)) +// {} + + template + struct tref2 + { + tref2(T& x, T& y); + tref2(tref2 const & r); + tref2(tvec2 const & v); + + tref2& operator= (tref2 const & r); + tref2& operator= (tvec2 const & v); + + T& x; + T& y; + }; + } //namespace detail + + namespace core{ + namespace type{ + namespace vector{ + + ////////////////////////// + // Boolean definition + + //! 2 components vector of boolean. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec2 bvec2; + + ////////////////////////// + // Float definition + +#ifndef GLM_PRECISION + //! 2 components vector of floating-point numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec2 vec2; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_FLOAT) + typedef detail::tvec2 vec2; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_FLOAT) + typedef detail::tvec2 vec2; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_FLOAT) + typedef detail::tvec2 vec2; +#else + typedef detail::tvec2 vec2; +#endif//GLM_PRECISION + + namespace precision + { + //! 2 components vector of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec2 highp_vec2; + //! 2 components vector of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec2 mediump_vec2; + //! 2 components vector of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec2 lowp_vec2; + } + //namespace precision + + ////////////////////////// + // Signed integer definition + +#ifndef GLM_PRECISION + //! \brief 2 components vector of signed integer numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec2 ivec2; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_INT) + typedef detail::tvec2 ivec2; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_INT) + typedef detail::tvec2 ivec2; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_INT) + typedef detail::tvec2 ivec2; +#else + typedef detail::tvec2 ivec2; +#endif//GLM_PRECISION + + namespace precision + { + //! 2 components vector of high precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec2 highp_ivec2; + //! 2 components vector of medium precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec2 mediump_ivec2; + //! 2 components vector of low precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec2 lowp_ivec2; + } + //namespace precision + + ////////////////////////// + // Unsigned integer definition + +#ifndef GLM_PRECISION + //! 2 components vector of unsigned integer numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec2 uvec2; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_UINT) + typedef detail::tvec2 uvec2; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_UINT) + typedef detail::tvec2 uvec2; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_UINT) + typedef detail::tvec2 uvec2; +#else + typedef detail::tvec2 uvec2; +#endif//GLM_PRECISION + + namespace precision + { + //! 2 components vector of high precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec2 highp_uvec2; + //! 2 components vector of medium precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec2 mediump_uvec2; + //! 2 components vector of low precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec2 lowp_uvec2; + } + //namespace precision + + }//namespace vector + }//namespace type + }//namespace core +}//namespace glm + +#include "type_vec2.inl" + +#endif//glm_core_type_gentype2 diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl new file mode 100644 index 0000000..ade2c03 --- /dev/null +++ b/glm/core/type_vec2.inl @@ -0,0 +1,679 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-18 +// Updated : 2008-09-09 +// Licence : This source is under MIT License +// File : glm/core/type_tvec2.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + template + typename tvec2::size_type tvec2::value_size() + { + return typename tvec2::size_type(2); + } + + template + bool tvec2::is_vector() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + inline valType& tvec2::operator[](typename tvec2::size_type i) + { + assert( i >= typename tvec2::size_type(0) && + i < tvec2::value_size()); + return (&x)[i]; + } + + template + inline valType const & tvec2::operator[](typename tvec2::size_type i) const + { + assert( i >= typename tvec2::size_type(0) && + i < tvec2::value_size()); + return (&x)[i]; + } + + ////////////////////////////////////// + // Implicit basic constructors + + template + inline tvec2::tvec2() : + x(Type(0)), + y(Type(0)) + {} + + template + inline tvec2::tvec2(tvec2 const & v) : + x(v.x), + y(v.y) + {} + + ////////////////////////////////////// + // Explicit basic constructors + + template + inline tvec2::tvec2(valType s) : + x(s), + y(s) + {} + + template + inline tvec2::tvec2(valType s1, valType s2) : + x(s1), + y(s2) + {} + + ////////////////////////////////////// + // Swizzle constructors + + template + inline tvec2::tvec2(tref2 const & r) : + x(r.x), + y(r.y) + {} + + ////////////////////////////////////// + // Convertion scalar constructors + + template + template + inline tvec2::tvec2(U x) : + x(valType(x)), + y(valType(x)) + {} + + template + template + inline tvec2::tvec2(U x, V y) : + x(valType(x)), + y(valType(y)) + {} + + ////////////////////////////////////// + // Convertion vector constructors + + template + template + inline tvec2::tvec2(tvec2 const & v) : + x(valType(v.x)), + y(valType(v.y)) + {} + + template + template + inline tvec2::tvec2(tvec3 const & v) : + x(valType(v.x)), + y(valType(v.y)) + {} + + template + template + inline tvec2::tvec2(tvec4 const & v) : + x(valType(v.x)), + y(valType(v.y)) + {} + + ////////////////////////////////////// + // Unary arithmetic operators + + template + inline tvec2& tvec2::operator= (tvec2 const & v) + { + this->x = v.x; + this->y = v.y; + return *this; + } + + template + inline tvec2& tvec2::operator+=(valType const & s) + { + this->x += s; + this->y += s; + return *this; + } + + template + inline tvec2& tvec2::operator+=(tvec2 const & v) + { + this->x += v.x; + this->y += v.y; + return *this; + } + + template + inline tvec2& tvec2::operator-=(valType const & s) + { + this->x -= s; + this->y -= s; + return *this; + } + + template + inline tvec2& tvec2::operator-=(tvec2 const & v) + { + this->x -= v.x; + this->y -= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator*=(valType const & s) + { + this->x *= s; + this->y *= s; + return *this; + } + + template + inline tvec2& tvec2::operator*=(tvec2 const & v) + { + this->x *= v.x; + this->y *= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator/=(valType const & s) + { + this->x /= s; + this->y /= s; + return *this; + } + + template + inline tvec2& tvec2::operator/=(tvec2 const & v) + { + this->x /= v.x; + this->y /= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator++() + { + ++this->x; + ++this->y; + return *this; + } + + template + inline tvec2& tvec2::operator--() + { + --this->x; + --this->y; + return *this; + } + + ////////////////////////////////////// + // Unary bit operators + + template + inline tvec2& tvec2::operator%=(valType const & s) + { + this->x %= s; + this->y %= s; + return *this; + } + + template + inline tvec2& tvec2::operator%=(tvec2 const & v) + { + this->x %= v.x; + this->y %= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator&=(valType const & s) + { + this->x &= s; + this->y &= s; + return *this; + } + + template + inline tvec2& tvec2::operator&=(tvec2 const & v) + { + this->x &= v.x; + this->y &= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator|=(valType const & s) + { + this->x |= s; + this->y |= s; + return *this; + } + + template + inline tvec2& tvec2::operator|=(tvec2 const & v) + { + this->x |= v.x; + this->y |= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator^=(valType const & s) + { + this->x ^= s; + this->y ^= s; + return *this; + } + + template + inline tvec2& tvec2::operator^=(tvec2 const & v) + { + this->x ^= v.x; + this->y ^= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator<<=(valType const & s) + { + this->x <<= s; + this->y <<= s; + return *this; + } + + template + inline tvec2& tvec2::operator<<=(tvec2 const & v) + { + this->x <<= v.x; + this->y <<= v.y; + return *this; + } + + template + inline tvec2& tvec2::operator>>=(valType const & s) + { + this->x >>= s; + this->y >>= s; + return *this; + } + + template + inline tvec2& tvec2::operator>>=(tvec2 const & v) + { + this->x >>= v.x; + this->y >>= v.y; + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + template + inline valType tvec2::swizzle(comp x) const + { + return (*this)[x]; + } + + template + inline tvec2 tvec2::swizzle(comp x, comp y) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } + + template + inline tvec3 tvec2::swizzle(comp x, comp y, comp z) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + template + inline tvec4 tvec2::swizzle(comp x, comp y, comp z, comp w) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + template + inline tref2 tvec2::swizzle(comp x, comp y) + { + return tref2( + (*this)[x], + (*this)[y]); + } + + ////////////////////////////////////// + // Binary arithmetic operators + + template + inline tvec2 operator+ (tvec2 const & v, T const & s) + { + return tvec2( + v.x + s, + v.y + s); + } + + template + inline tvec2 operator+ (T const & s, tvec2 const & v) + { + return tvec2( + s + v.x, + s + v.y); + } + + template + inline tvec2 operator+ (tvec2 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x + v2.x, + v1.y + v2.y); + } + + //operator- + template + inline tvec2 operator- (tvec2 const & v, T const & s) + { + return tvec2( + v.x - s, + v.y - s); + } + + template + inline tvec2 operator- (T const & s, tvec2 const & v) + { + return tvec2( + s - v.x, + s - v.y); + } + + template + inline tvec2 operator- (tvec2 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x - v2.x, + v1.y - v2.y); + } + + //operator* + template + inline tvec2 operator* (tvec2 const & v, T const & s) + { + return tvec2( + v.x * s, + v.y * s); + } + + template + inline tvec2 operator* (T const & s, tvec2 const & v) + { + return tvec2( + s * v.x, + s * v.y); + } + + template + inline tvec2 operator* (tvec2 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x * v2.x, + v1.y * v2.y); + } + + //operator/ + template + inline tvec2 operator/ (tvec2 const & v, T const & s) + { + return tvec2( + v.x / s, + v.y / s); + } + + template + inline tvec2 operator/ (T const & s, tvec2 const & v) + { + return tvec2( + s / v.x, + s / v.y); + } + + template + inline tvec2 operator/ (tvec2 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x / v2.x, + v1.y / v2.y); + } + + // Unary constant operators + template + inline tvec2 operator- (tvec2 const & v) + { + return tvec2( + -v.x, + -v.y); + } + + template + inline tvec2 operator++ (tvec2 const & v, int) + { + return tvec2( + v.x + T(1), + v.y + T(1)); + } + + template + inline tvec2 operator-- (tvec2 const & v, int) + { + return tvec2( + v.x - T(1), + v.y - T(1)); + } + + ////////////////////////////////////// + // Binary bit operators + + template + inline tvec2 operator% (tvec2 const & v, T const & s) + { + return tvec2( + v.x % s, + v.y % s); + } + + template + inline tvec2 operator% (T const & s, tvec2 const & v) + { + return tvec2( + s % v.x, + s % v.y); + } + + template + inline tvec2 operator% (tvec2 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x % v2.x, + v1.y % v2.y); + } + + template + inline tvec2 operator& (tvec2 const & v, T const & s) + { + return tvec2( + v.x & s, + v.y & s); + } + + template + inline tvec2 operator& (T const & s, tvec2 const & v) + { + return tvec2( + s & v.x, + s & v.y); + } + + template + inline tvec2 operator& (tvec2 const & v1, tvec2 const & v2) + { + return tvec2( + v1.x & v2.x, + v1.y & v2.y); + } + + template + inline tvec2 operator| (tvec2 const & v, T const & s) + { + return tvec2( + v.x | s, + v.y | s); + } + + template + inline tvec2 operator| (T const & s, tvec2 const & v) + { + return tvec2( + s | v.x, + s | v.y); + } + + template + inline tvec2 operator| (const tvec2& v1, const tvec2& v2) + { + return tvec2( + v1.x | v2.x, + v1.y | v2.y); + } + + template + inline tvec2 operator^ (const tvec2& v, T const & s) + { + return tvec2( + v.x ^ s, + v.y ^ s); + } + + template + inline tvec2 operator^ (T const & s, const tvec2& v) + { + return tvec2( + s ^ v.x, + s ^ v.y); + } + + template + inline tvec2 operator^ (const tvec2& v1, const tvec2& v2) + { + return tvec2( + v1.x ^ v2.x, + v1.y ^ v2.y); + } + + template + inline tvec2 operator<< (const tvec2& v, T const & s) + { + return tvec2( + v.x << s, + v.y << s); + } + + template + inline tvec2 operator<< (T const & s, const tvec2& v) + { + return tvec2( + s << v.x, + s << v.y); + } + + template + inline tvec2 operator<< (const tvec2& v1, const tvec2& v2) + { + return tvec2( + v1.x << v2.x, + v1.y << v2.y); + } + + template + inline tvec2 operator>> (const tvec2& v, T const & s) + { + return tvec2( + v.x >> s, + v.y >> s); + } + + template + inline tvec2 operator>> (T const & s, const tvec2& v) + { + return tvec2( + s >> v.x, + s >> v.y); + } + + template + inline tvec2 operator>> (const tvec2& v1, const tvec2& v2) + { + return tvec2( + v1.x >> v2.x, + v1.y >> v2.y); + } + + template + inline tvec2 operator~ (const tvec2& v) + { + return tvec2( + ~v.x, + ~v.y); + } + + ////////////////////////////////////// + // tref definition + + template + tref2::tref2(T& x, T& y) : + x(x), + y(y) + {} + + template + tref2::tref2(const tref2& r) : + x(r.x), + y(r.y) + {} + + template + tref2::tref2(const tvec2& v) : + x(v.x), + y(v.y) + {} + + template + tref2& tref2::operator= (const tref2& r) + { + x = r.x; + y = r.y; + return *this; + } + + template + tref2& tref2::operator= (const tvec2& v) + { + x = v.x; + y = v.y; + return *this; + } + + }//namespace detail +}//namespace glm diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp new file mode 100644 index 0000000..e81d751 --- /dev/null +++ b/glm/core/type_vec3.hpp @@ -0,0 +1,310 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-22 +// Updated : 2008-08-31 +// Licence : This source is under MIT License +// File : glm/core/type_tvec3.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_gentype3 +#define glm_core_type_gentype3 + +#include "type_float.hpp" +#include "type_int.hpp" +#include "type_size.hpp" +#include "_swizzle.hpp" + +namespace glm +{ + namespace test + { + void main_vec3(); + }//namespace test + + namespace detail + { + template struct tref2; + template struct tref3; + template struct tref4; + template struct tvec2; + template struct tvec4; + + template + struct tvec3 + { + ////////////////////////////////////// + // Typedef (Implementation details) + + typedef valType value_type; + typedef valType& value_reference; + typedef valType* value_pointer; + typedef tvec3 bool_type; + + typedef glm::sizeType size_type; + static size_type value_size(); + static bool is_vector(); + + typedef tvec3 type; + typedef tvec3* pointer; + typedef tvec3 const * const_pointer; + typedef tvec3 const * const const_pointer_const; + typedef tvec3 * const pointer_const; + typedef tvec3& reference; + typedef tvec3 const & const_reference; + typedef tvec3 const & param_type; + + ////////////////////////////////////// + // Data + +# if defined(GLM_USE_ONLY_XYZW) + value_type x, y, z; +# else//GLM_USE_ONLY_XYZW +# ifdef GLM_USE_ANONYMOUS_UNION + union + { + struct{value_type x, y, z;}; + struct{value_type r, g, b;}; + struct{value_type s, t, p;}; + }; +# else//GLM_USE_ANONYMOUS_UNION + union {value_type x, r, s;}; + union {value_type y, g, t;}; + union {value_type z, b, p;}; +# endif//GLM_USE_ANONYMOUS_UNION +# endif//GLM_USE_ONLY_XYZW + + ////////////////////////////////////// + // Accesses + + valType & operator[](size_type i); + valType const & operator[](size_type i) const; + + ////////////////////////////////////// + // Address (Implementation details) + + value_type const * _address() const{return (value_type*)(this);} + value_type* _address(){return (value_type*)(this);} + + ////////////////////////////////////// + // Implicit basic constructors + + tvec3(); + tvec3(tvec3 const & v); + + ////////////////////////////////////// + // Explicit basic constructors + + explicit tvec3(valType s); + explicit tvec3(valType s1, valType s2, valType s3); + + ////////////////////////////////////// + // Swizzle constructors + + tvec3(tref3 const & r); + + ////////////////////////////////////// + // Convertion scalar constructors + + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(U x); + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(U x, V y, W z); + + ////////////////////////////////////// + // Convertion vector constructors + + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(tvec2 const & v, B s); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(A s, tvec2 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(tvec3 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(tvec4 const & v); + + ////////////////////////////////////// + // Unary arithmetic operators + + tvec3& operator= (tvec3 const & v); + + tvec3& operator+=(valType const & s); + tvec3& operator+=(tvec3 const & v); + tvec3& operator-=(valType const & s); + tvec3& operator-=(tvec3 const & v); + tvec3& operator*=(valType const & s); + tvec3& operator*=(tvec3 const & v); + tvec3& operator/=(valType const & s); + tvec3& operator/=(tvec3 const & v); + tvec3& operator++(); + tvec3& operator--(); + + ////////////////////////////////////// + // Unary bit operators + + tvec3& operator%=(valType const & s); + tvec3& operator%=(tvec3 const & v); + tvec3& operator&=(valType const & s); + tvec3& operator&=(tvec3 const & v); + tvec3& operator|=(valType const & s); + tvec3& operator|=(tvec3 const & v); + tvec3& operator^=(valType const & s); + tvec3& operator^=(tvec3 const & v); + tvec3& operator<<=(valType const & s); + tvec3& operator<<=(tvec3 const & v); + tvec3& operator>>=(valType const & s); + tvec3& operator>>=(tvec3 const & v); + + ////////////////////////////////////// + // Swizzle operators + + valType swizzle(comp X) const; + tvec2 swizzle(comp X, comp Y) const; + tvec3 swizzle(comp X, comp Y, comp Z) const; + tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + tref3 swizzle(comp X, comp Y, comp Z); + }; + + template + struct tref3 + { + tref3(T& x, T& y, T& z); + tref3(tref3 const & r); + tref3(tvec3 const & v); + + tref3& operator= (tref3 const & r); + tref3& operator= (tvec3 const & v); + + T& x; + T& y; + T& z; + }; + } //namespace detail + + namespace core{ + namespace type{ + namespace vector{ + + ////////////////////////// + // Boolean definition + + //! 3 components vector of boolean. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec3 bvec3; + + ////////////////////////// + // Float definition + +#ifndef GLM_PRECISION + //! 3 components vector of floating-point numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec3 vec3; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_FLOAT) + typedef detail::tvec3 vec3; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_FLOAT) + typedef detail::tvec3 vec3; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_FLOAT) + typedef detail::tvec3 vec3; +#else + typedef detail::tvec3 vec3; +#endif//GLM_PRECISION + + namespace precision + { + //! 3 components vector of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec3 highp_vec3; + //! 3 components vector of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec3 mediump_vec3; + //! 3 components vector of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec3 lowp_vec3; + } + //namespace precision + + ////////////////////////// + // Signed integer definition + +#ifndef GLM_PRECISION + //! 3 components vector of signed integer numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec3 ivec3; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_INT) + typedef detail::tvec3 ivec3; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_INT) + typedef detail::tvec3 ivec3; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_INT) + typedef detail::tvec3 ivec3; +#else + typedef detail::tvec3 ivec3; +#endif//GLM_PRECISION + + namespace precision + { + //! 3 components vector of high precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec3 highp_ivec3; + //! 3 components vector of medium precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec3 mediump_ivec3; + //! 3 components vector of low precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec3 lowp_ivec3; + } + //namespace precision + + ////////////////////////// + // Unsigned integer definition + +#ifndef GLM_PRECISION + //! 3 components vector of unsigned integer numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec3 uvec3; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_UINT) + typedef detail::tvec3 uvec3; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_UINT) + typedef detail::tvec3 uvec3; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_UINT) + typedef detail::tvec3 uvec3; +#else + typedef detail::tvec3 uvec3; +#endif//GLM_PRECISION + + namespace precision + { + //! 3 components vector of high precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec3 highp_uvec3; + //! 3 components vector of medium precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec3 mediump_uvec3; + //! 3 components vector of low precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec3 lowp_uvec3; + } + //namespace precision + + }//namespace vector + }//namespace type + }//namespace core +}//namespace glm + +#include "type_vec3.inl" + +#endif//glm_core_type_gentype3 diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl new file mode 100644 index 0000000..d0360e7 --- /dev/null +++ b/glm/core/type_vec3.inl @@ -0,0 +1,762 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-22 +// Updated : 2008-09-09 +// Licence : This source is under MIT License +// File : glm/core/type_tvec3.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + template + typename tvec3::size_type tvec3::value_size() + { + return typename tvec3::size_type(3); + } + + template + bool tvec3::is_vector() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + inline valType& tvec3::operator[](typename tvec3::size_type i) + { + assert( i >= typename tvec3::size_type(0) && + i < tvec3::value_size()); + + return (&x)[i]; + } + + template + inline valType const & tvec3::operator[](typename tvec3::size_type i) const + { + assert( i >= typename tvec3::size_type(0) && + i < tvec3::value_size()); + + return (&x)[i]; + } + + ////////////////////////////////////// + // Implicit basic constructors + + template + inline tvec3::tvec3() : + x(valType(0)), + y(valType(0)), + z(valType(0)) + {} + + template + inline tvec3::tvec3(const tvec3& v) : + x(v.x), + y(v.y), + z(v.z) + {} + + ////////////////////////////////////// + // Explicit basic constructors + + template + inline tvec3::tvec3(valType s) : + x(s), + y(s), + z(s) + {} + + template + inline tvec3::tvec3(valType s0, valType s1, valType s2) : + x(s0), + y(s1), + z(s2) + {} + + ////////////////////////////////////// + // Swizzle constructors + + template + inline tvec3::tvec3(const tref3& r) : + x(r.x), + y(r.y), + z(r.z) + {} + + ////////////////////////////////////// + // Convertion scalar constructors + + template + template + inline tvec3::tvec3(U x) : + x(valType(x)), + y(valType(x)), + z(valType(x)) + {} + + template + template + inline tvec3::tvec3(A x, B y, C z) : + x(valType(x)), + y(valType(y)), + z(valType(z)) + {} + + ////////////////////////////////////// + // Convertion vector constructors + + template + template + inline tvec3::tvec3(const tvec2& v, B s) : + x(valType(v.x)), + y(valType(v.y)), + z(valType(s)) + {} + + template + template + inline tvec3::tvec3(A s, const tvec2& v) : + x(valType(s)), + y(valType(v.x)), + z(valType(v.y)) + {} + + template + template + inline tvec3::tvec3(const tvec3& v) : + x(valType(v.x)), + y(valType(v.y)), + z(valType(v.z)) + {} + + template + template + inline tvec3::tvec3(const tvec4& v) : + x(valType(v.x)), + y(valType(v.y)), + z(valType(v.z)) + {} + + ////////////////////////////////////// + // Unary arithmetic operators + + template + inline tvec3& tvec3::operator= (const tvec3& v) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + return *this; + } + + template + inline tvec3& tvec3::operator+=(valType const & s) + { + this->x += s; + this->y += s; + this->z += s; + return *this; + } + + template + inline tvec3& tvec3::operator+=(const tvec3& v) + { + this->x += v.x; + this->y += v.y; + this->z += v.z; + return *this; + } + + template + inline tvec3& tvec3::operator-=(valType const & s) + { + this->x -= s; + this->y -= s; + this->z -= s; + return *this; + } + + template + inline tvec3& tvec3::operator-=(const tvec3& v) + { + this->x -= v.x; + this->y -= v.y; + this->z -= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator*=(valType const & s) + { + this->x *= s; + this->y *= s; + this->z *= s; + return *this; + } + + template + inline tvec3& tvec3::operator*=(const tvec3& v) + { + this->x *= v.x; + this->y *= v.y; + this->z *= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator/=(valType const & s) + { + this->x /= s; + this->y /= s; + this->z /= s; + return *this; + } + + template + inline tvec3& tvec3::operator/=(const tvec3& v) + { + this->x /= v.x; + this->y /= v.y; + this->z /= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator++() + { + ++this->x; + ++this->y; + ++this->z; + return *this; + } + + template + inline tvec3& tvec3::operator--() + { + --this->x; + --this->y; + --this->z; + return *this; + } + + ////////////////////////////////////// + // Unary bit operators + + template + inline tvec3& tvec3::operator%=(valType const & s) + { + this->x %= s; + this->y %= s; + this->z %= s; + return *this; + } + + template + inline tvec3& tvec3::operator%=(const tvec3& v) + { + this->x %= v.x; + this->y %= v.y; + this->z %= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator&=(valType const & s) + { + this->x &= s; + this->y &= s; + this->z &= s; + return *this; + } + + template + inline tvec3& tvec3::operator&=(const tvec3& v) + { + this->x &= v.x; + this->y &= v.y; + this->z &= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator|=(valType const & s) + { + this->x |= s; + this->y |= s; + this->z |= s; + return *this; + } + + template + inline tvec3& tvec3::operator|=(const tvec3& v) + { + this->x |= v.x; + this->y |= v.y; + this->z |= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator^=(valType const & s) + { + this->x ^= s; + this->y ^= s; + this->z ^= s; + return *this; + } + + template + inline tvec3& tvec3::operator^=(const tvec3& v) + { + this->x ^= v.x; + this->y ^= v.y; + this->z ^= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator<<=(valType const & s) + { + this->x <<= s; + this->y <<= s; + this->z <<= s; + return *this; + } + + template + inline tvec3& tvec3::operator<<=(const tvec3& v) + { + this->x <<= v.x; + this->y <<= v.y; + this->z <<= v.z; + return *this; + } + + template + inline tvec3& tvec3::operator>>=(valType const & s) + { + this->x >>= s; + this->y >>= s; + this->z >>= s; + return *this; + } + + template + inline tvec3& tvec3::operator>>=(const tvec3& v) + { + this->x >>= v.x; + this->y >>= v.y; + this->z >>= v.z; + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + template + inline valType tvec3::swizzle(comp x) const + { + return (*this)[x]; + } + + template + inline tvec2 tvec3::swizzle(comp x, comp y) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } + + template + inline tvec3 tvec3::swizzle(comp x, comp y, comp z) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + template + inline tvec4 tvec3::swizzle(comp x, comp y, comp z, comp w) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + template + inline tref3 tvec3::swizzle(comp x, comp y, comp z) + { + return tref3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + ////////////////////////////////////// + // Binary arithmetic operators + + template + inline tvec3 operator+ (const tvec3& v, T const & s) + { + return tvec3( + v.x + s, + v.y + s, + v.z + s); + } + + template + inline tvec3 operator+ (T const & s, const tvec3& v) + { + return tvec3( + s + v.x, + s + v.y, + s + v.z); + } + + template + inline tvec3 operator+ (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x + v2.x, + v1.y + v2.y, + v1.z + v2.z); + } + + //operator- + template + inline tvec3 operator- (const tvec3& v, T const & s) + { + return tvec3( + v.x - s, + v.y - s, + v.z - s); + } + + template + inline tvec3 operator- (T const & s, const tvec3& v) + { + return tvec3( + s - v.x, + s - v.y, + s - v.z); + } + + template + inline tvec3 operator- (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x - v2.x, + v1.y - v2.y, + v1.z - v2.z); + } + + //operator* + template + inline tvec3 operator* (const tvec3& v, T const & s) + { + return tvec3( + v.x * s, + v.y * s, + v.z * s); + } + + template + inline tvec3 operator* (T const & s, const tvec3& v) + { + return tvec3( + s * v.x, + s * v.y, + s * v.z); + } + + template + inline tvec3 operator* (const tvec3& v1, const tvec3 & v2) + { + return tvec3( + v1.x * v2.x, + v1.y * v2.y, + v1.z * v2.z); + } + + //operator/ + template + inline tvec3 operator/ (const tvec3& v, T const & s) + { + return tvec3( + v.x / s, + v.y / s, + v.z / s); + } + + template + inline tvec3 operator/ (T const & s, const tvec3& v) + { + return tvec3( + s / v.x, + s / v.y, + s / v.z); + } + + template + inline tvec3 operator/ (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x / v2.x, + v1.y / v2.y, + v1.z / v2.z); + } + + // Unary constant operators + template + inline tvec3 operator- (const tvec3& v) + { + return tvec3( + -v.x, + -v.y, + -v.z); + } + + template + inline tvec3 operator++ (const tvec3& v, int) + { + return tvec3( + v.x + T(1), + v.y + T(1), + v.z + T(1)); + } + + template + inline tvec3 operator-- (const tvec3& v, int) + { + return tvec3( + v.x - T(1), + v.y - T(1), + v.z - T(1)); + } + + ////////////////////////////////////// + // Binary bit operators + + template + inline tvec3 operator% (const tvec3& v, T const & s) + { + return tvec3( + v.x % s, + v.y % s, + v.z % s); + } + + template + inline tvec3 operator% (T const & s, const tvec3& v) + { + return tvec3( + s % v.x, + s % v.y, + s % v.z); + } + + template + inline tvec3 operator% (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x % v2.x, + v1.y % v2.y, + v1.z % v2.z); + } + + template + inline tvec3 operator& (const tvec3& v, T const & s) + { + return tvec3( + v.x & s, + v.y & s, + v.z & s); + } + + template + inline tvec3 operator& (T const & s, const tvec3& v) + { + return tvec3( + s & v.x, + s & v.y, + s & v.z); + } + + template + inline tvec3 operator& (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x & v2.x, + v1.y & v2.y, + v1.z & v2.z); + } + + template + inline tvec3 operator| (const tvec3& v, T const & s) + { + return tvec3( + v.x | s, + v.y | s, + v.z | s); + } + + template + inline tvec3 operator| (T const & s, const tvec3& v) + { + return tvec3( + s | v.x, + s | v.y, + s | v.z); + } + + template + inline tvec3 operator| (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x | v2.x, + v1.y | v2.y, + v1.z | v2.z); + } + + template + inline tvec3 operator^ (const tvec3& v, T const & s) + { + return tvec3( + v.x ^ s, + v.y ^ s, + v.z ^ s); + } + + template + inline tvec3 operator^ (T const & s, const tvec3& v) + { + return tvec3( + s ^ v.x, + s ^ v.y, + s ^ v.z); + } + + template + inline tvec3 operator^ (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x ^ v2.x, + v1.y ^ v2.y, + v1.z ^ v2.z); + } + + template + inline tvec3 operator<< (const tvec3& v, T const & s) + { + return tvec3( + v.x << s, + v.y << s, + v.z << s); + } + + template + inline tvec3 operator<< (T const & s, const tvec3& v) + { + return tvec3( + s << v.x, + s << v.y, + s << v.z); + } + + template + inline tvec3 operator<< (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x << v2.x, + v1.y << v2.y, + v1.z << v2.z); + } + + template + inline tvec3 operator>> (const tvec3& v, T const & s) + { + return tvec3( + v.x >> s, + v.y >> s, + v.z >> s); + } + + template + inline tvec3 operator>> (T const & s, const tvec3& v) + { + return tvec3( + s >> v.x, + s >> v.y, + s >> v.z); + } + + template + inline tvec3 operator>> (const tvec3& v1, const tvec3& v2) + { + return tvec3( + v1.x >> v2.x, + v1.y >> v2.y, + v1.z >> v2.z); + } + + template + inline tvec3 operator~ (const tvec3& v) + { + return tvec3( + ~v.x, + ~v.y, + ~v.z); + } + + ////////////////////////////////////// + // tref definition + + template + tref3::tref3(T& x, T& y, T& z) : + x(x), + y(y), + z(z) + {} + + template + tref3::tref3(const tref3& r) : + x(r.x), + y(r.y), + z(r.z) + {} + + template + tref3::tref3(const tvec3& v) : + x(v.x), + y(v.y), + z(v.z) + {} + + template + tref3& tref3::operator= (const tref3& r) + { + x = r.x; + y = r.y; + z = r.z; + return *this; + } + + template + tref3& tref3::operator= (const tvec3& v) + { + x = v.x; + y = v.y; + z = v.z; + return *this; + } + + }//namespace detail +}//namespace glm diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp new file mode 100644 index 0000000..d892886 --- /dev/null +++ b/glm/core/type_vec4.hpp @@ -0,0 +1,323 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-22 +// Updated : 2008-08-31 +// Licence : This source is under MIT License +// File : glm/core/type_tvec4.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_core_type_gentype4 +#define glm_core_type_gentype4 + +#include "type_float.hpp" +#include "type_int.hpp" +#include "type_size.hpp" +#include "_swizzle.hpp" +#include "_detail.hpp" + +namespace glm +{ + namespace test + { + void main_vec4(); + }//namespace test + + namespace detail + { + template struct tref2; + template struct tref3; + template struct tref4; + template struct tvec2; + template struct tvec3; + + template + struct tvec4 + { + enum ctor{null}; + + ////////////////////////////////////// + // Typedef (Implementation details) + + typedef valType value_type; + typedef valType & value_reference; + typedef valType * value_pointer; + typedef tvec4 bool_type; + + typedef glm::sizeType size_type; + static size_type value_size(); + static bool is_vector(); + + typedef tvec4 type; + typedef tvec4 * pointer; + typedef tvec4 const * const_pointer; + typedef tvec4 const * const const_pointer_const; + typedef tvec4 * const pointer_const; + typedef tvec4 & reference; + typedef tvec4 const & const_reference; + typedef tvec4 const & param_type; + + ////////////////////////////////////// + // Data + +# if defined(GLM_USE_ONLY_XYZW) + value_type x, y, z, w; +# else//GLM_USE_ONLY_XYZW +# ifdef GLM_USE_ANONYMOUS_UNION + union + { + struct{value_type x, y, z, w;}; + struct{value_type r, g, b, a;}; + struct{value_type s, t, p, q;}; + + }; +# else//GLM_USE_ANONYMOUS_UNION + union {value_type x, r, s;}; + union {value_type y, g, t;}; + union {value_type z, b, p;}; + union {value_type w, a, q;}; +# endif//GLM_USE_ANONYMOUS_UNION +# endif//GLM_USE_ONLY_XYZW + + ////////////////////////////////////// + // Accesses + + valType & operator[](size_type i); + valType const & operator[](size_type i) const; + + ////////////////////////////////////// + // Address (Implementation details) + + value_type * _address(){return (value_type*)(this);} + value_type const * const _address() const{return (value_type*)(this);} + + ////////////////////////////////////// + // Implicit basic constructors + + tvec4(); + tvec4(typename tvec4::ctor); + tvec4(tvec4 const & v); + + ////////////////////////////////////// + // Explicit basic constructors + + explicit tvec4(valType const & s); + explicit tvec4(valType const & s0, valType const & s1, valType const & s2, valType const & s3); + + ////////////////////////////////////// + // Swizzle constructors + + tvec4(tref4 const & r); + + ////////////////////////////////////// + // Convertion scalar constructors + + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(valTypeU const & x); + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A const & x, B const & y, C const & z, D const & w); + + ////////////////////////////////////// + // Convertion vector constructors + + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(tvec2 const & v, B const & s1, C const & s2); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A const & s1, tvec2 const & v, C const & s2); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A const & s1, B const & s2, tvec2 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(tvec3 const & v, B const & s); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A const & s, tvec3 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(tvec2 const & v1, tvec2 const & v2); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(tvec4 const & v); + + ////////////////////////////////////// + // Unary arithmetic operators + + tvec4& operator= (tvec4 const & v); + + tvec4& operator+=(valType const & s); + tvec4& operator+=(tvec4 const & v); + tvec4& operator-=(valType const & s); + tvec4& operator-=(tvec4 const & v); + tvec4& operator*=(valType const & s); + tvec4& operator*=(tvec4 const & v); + tvec4& operator/=(valType const & s); + tvec4& operator/=(tvec4 const & v); + tvec4& operator++(); + tvec4& operator--(); + + ////////////////////////////////////// + // Unary bit operators + + tvec4& operator%= (valType const & s); + tvec4& operator%= (tvec4 const & v); + tvec4& operator&= (valType const & s); + tvec4& operator&= (tvec4 const & v); + tvec4& operator|= (valType const & s); + tvec4& operator|= (tvec4 const & v); + tvec4& operator^= (valType const & s); + tvec4& operator^= (tvec4 const & v); + tvec4& operator<<=(valType const & s); + tvec4& operator<<=(tvec4 const & v); + tvec4& operator>>=(valType const & s); + tvec4& operator>>=(tvec4 const & v); + + ////////////////////////////////////// + // Swizzle operators + + valType swizzle(comp X) const; + tvec2 swizzle(comp X, comp Y) const; + tvec3 swizzle(comp X, comp Y, comp Z) const; + tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + tref4 swizzle(comp X, comp Y, comp Z, comp W); + }; + + template + struct tref4 + { + tref4(valType & x, valType & y, valType & z, valType & w); + tref4(tref4 const & r); + tref4(tvec4 const & v); + + tref4& operator= (tref4 const & r); + tref4& operator= (tvec4 const & v); + + valType & x; + valType & y; + valType & z; + valType & w; + }; + } //namespace detail + + namespace core{ + namespace type{ + namespace vector{ + + ////////////////////////// + // Boolean definition + + //! 4 components vector of boolean. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec4 bvec4; + + ////////////////////////// + // Float definition + +#ifndef GLM_PRECISION + //! 4 components vector of floating-point numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec4 vec4; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_FLOAT) + typedef detail::tvec4 vec4; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_FLOAT) + typedef detail::tvec4 vec4; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_FLOAT) + typedef detail::tvec4 vec4; +#endif//GLM_PRECISION + + namespace precision + { + //! 4 components vector of high precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec4 highp_vec4; + //! 4 components vector of medium precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec4 mediump_vec4; + //! 4 components vector of low precision floating-point numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.5.2 Precision Qualifiers. + typedef detail::tvec4 lowp_vec4; + } + //namespace precision + + ////////////////////////// + // Signed integer definition + +#ifndef GLM_PRECISION + //! 4 components vector of signed integer numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec4 ivec4; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_INT) + typedef detail::tvec4 ivec4; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_INT) + typedef detail::tvec4 ivec4; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_INT) + typedef detail::tvec4 ivec4; +#endif//GLM_PRECISION + + namespace precision + { + //! 4 components vector of high precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec4 highp_ivec4; + //! 4 components vector of medium precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec4 mediump_ivec4; + //! 4 components vector of low precision signed integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec4 lowp_ivec4; + } + //namespace precision + + ////////////////////////// + // Unsigned integer definition + +#ifndef GLM_PRECISION + //! 4 components vector of unsigned integer numbers. + //! From GLSL 1.30.8 specification, section 4.1.5 Vectors. + typedef detail::tvec4 uvec4; +#elif(GLM_PRECISION & GLM_PRECISION_HIGHP_UINT) + typedef detail::tvec4 uvec4; +#elif(GLM_PRECISION & GLM_PRECISION_MEDIUMP_UINT) + typedef detail::tvec4 uvec4; +#elif(GLM_PRECISION & GLM_PRECISION_LOWP_UINT) + typedef detail::tvec4 uvec4; +#endif//GLM_PRECISION + + namespace precision + { + //! 4 components vector of high precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec4 highp_uvec4; + //! 4 components vector of medium precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec4 mediump_uvec4; + //! 4 components vector of low precision unsigned integer numbers. + //! There is no garanty on the actual precision. + //! From GLSL 1.30.8 specification, section 4.1.5 Precision Qualifiers. + typedef detail::tvec4 lowp_uvec4; + } + //namespace precision + + }//namespace vector + }//namespace type + }//namespace core + + using namespace core::type; + +}//namespace glm + +#include "type_vec4.inl" + +#endif//glm_core_type_gentype4 diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl new file mode 100644 index 0000000..29094b0 --- /dev/null +++ b/glm/core/type_vec4.inl @@ -0,0 +1,1115 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-08-23 +// Updated : 2008-09-09 +// Licence : This source is under MIT License +// File : glm/core/type_tvec4.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + template + typename tvec4::size_type tvec4::value_size() + { + return typename tvec4::size_type(4); + } + + template + bool tvec4::is_vector() + { + return true; + } + + ////////////////////////////////////// + // Accesses + + template + inline valType& tvec4::operator[](typename tvec4::size_type i) + { + assert( i >= typename tvec4::size_type(0) && + i < tvec4::value_size()); + + return (&x)[i]; + } + + template + inline valType const & tvec4::operator[](typename tvec4::size_type i) const + { + assert( i >= typename tvec4::size_type(0) && + i < tvec4::value_size()); + + return (&x)[i]; + } + + ////////////////////////////////////// + // Implicit basic constructors + + template + inline tvec4::tvec4() : + x(valType(0)), + y(valType(0)), + z(valType(0)), + w(valType(0)) + {} + + template + inline tvec4::tvec4(typename tvec4::ctor) + {} + + template + inline tvec4::tvec4(tvec4 const & v) : + x(v.x), + y(v.y), + z(v.z), + w(v.w) + {} + + ////////////////////////////////////// + // Explicit basic constructors + + template + inline tvec4::tvec4 + ( + valType const & s + ) : + x(s), + y(s), + z(s), + w(s) + {} + + template + inline tvec4::tvec4 + ( + valType const & s1, + valType const & s2, + valType const & s3, + valType const & s4 + ) : + x(s1), + y(s2), + z(s3), + w(s4) + {} + + ////////////////////////////////////// + // Swizzle constructors + + template + inline tvec4::tvec4 + ( + tref4 const & r + ) : + x(r.x), + y(r.y), + z(r.z), + w(r.w) + {} + + ////////////////////////////////////// + // Convertion scalar constructors + + template + template + inline tvec4::tvec4 + ( + valTypeU const & x + ) : + x(valType(x)), + y(valType(x)), + z(valType(x)), + w(valType(x)) + {} + + template + template + inline tvec4::tvec4 + ( + A const & x, + B const & y, + C const & z, + D const & w + ) : + x(valType(x)), + y(valType(y)), + z(valType(z)), + w(valType(w)) + {} + + ////////////////////////////////////// + // Convertion vector constructors + + template + template + inline tvec4::tvec4 + ( + tvec2 const & v, + B const & s1, + C const & s2 + ) : + x(valType(v.x)), + y(valType(v.y)), + z(valType(s1)), + w(valType(s2)) + {} + + template + template + inline tvec4::tvec4 + ( + A const & s1, + tvec2 const & v, + C const & s2 + ) : + x(valType(s1)), + y(valType(v.x)), + z(valType(v.y)), + w(valType(s2)) + {} + + template + template + inline tvec4::tvec4 + ( + A const & s1, + B const & s2, + tvec2 const & v + ) : + x(valType(s1)), + y(valType(s2)), + z(valType(v.x)), + w(valType(v.y)) + {} + + template + template + inline tvec4::tvec4 + ( + tvec3 const & v, + B const & s + ) : + x(valType(v.x)), + y(valType(v.y)), + z(valType(v.z)), + w(valType(s)) + {} + + template + template + inline tvec4::tvec4 + ( + A const & s, + tvec3 const & v + ) : + x(valType(s)), + y(valType(v.x)), + z(valType(v.y)), + w(valType(v.z)) + {} + + template + template + inline tvec4::tvec4 + ( + tvec2 const & v1, + tvec2 const & v2 + ) : + x(valType(v1.x)), + y(valType(v1.y)), + z(valType(v2.x)), + w(valType(v2.y)) + {} + + template + template + inline tvec4::tvec4 + ( + tvec4 const & v + ) : + x(valType(v.x)), + y(valType(v.y)), + z(valType(v.z)), + w(valType(v.w)) + {} + + ////////////////////////////////////// + // Unary arithmetic operators + + template + inline tvec4& tvec4::operator= + ( + tvec4 const & v + ) + { + this->x = v.x; + this->y = v.y; + this->z = v.z; + this->w = v.w; + return *this; + } + + template + inline tvec4& tvec4::operator+= + ( + valType const & s + ) + { + this->x += s; + this->y += s; + this->z += s; + this->w += s; + return *this; + } + + template + inline tvec4& tvec4::operator+= + ( + tvec4 const & v + ) + { + this->x += v.x; + this->y += v.y; + this->z += v.z; + this->w += v.w; + return *this; + } + + template + inline tvec4& tvec4::operator-= + ( + valType const & s + ) + { + this->x -= s; + this->y -= s; + this->z -= s; + this->w -= s; + return *this; + } + + template + inline tvec4& tvec4::operator-= + ( + tvec4 const & v + ) + { + this->x -= v.x; + this->y -= v.y; + this->z -= v.z; + this->w -= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator*= + ( + valType const & s + ) + { + this->x *= s; + this->y *= s; + this->z *= s; + this->w *= s; + return *this; + } + + template + inline tvec4& tvec4::operator*= + ( + tvec4 const & v + ) + { + this->x *= v.x; + this->y *= v.y; + this->z *= v.z; + this->w *= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator/= + ( + valType const & s + ) + { + this->x /= s; + this->y /= s; + this->z /= s; + this->w /= s; + return *this; + } + + template + inline tvec4& tvec4::operator/= + ( + tvec4 const & v + ) + { + this->x /= v.x; + this->y /= v.y; + this->z /= v.z; + this->w /= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator++() + { + ++this->x; + ++this->y; + ++this->z; + ++this->w; + return *this; + } + + template + inline tvec4& tvec4::operator--() + { + --this->x; + --this->y; + --this->z; + --this->w; + return *this; + } + + ////////////////////////////////////// + // Unary bit operators + + template + inline tvec4& tvec4::operator%= + ( + valType const & s + ) + { + this->x %= s; + this->y %= s; + this->z %= s; + this->w %= s; + return *this; + } + + template + inline tvec4& tvec4::operator%= + ( + tvec4 const & v + ) + { + this->x %= v.x; + this->y %= v.y; + this->z %= v.z; + this->w %= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator&= + ( + valType const & s + ) + { + this->x &= s; + this->y &= s; + this->z &= s; + this->w &= s; + return *this; + } + + template + inline tvec4& tvec4::operator&= + ( + tvec4 const & v + ) + { + this->x &= v.x; + this->y &= v.y; + this->z &= v.z; + this->w &= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator|= + ( + valType const & s + ) + { + this->x |= s; + this->y |= s; + this->z |= s; + this->w |= s; + return *this; + } + + template + inline tvec4& tvec4::operator|= + ( + tvec4 const & v + ) + { + this->x |= v.x; + this->y |= v.y; + this->z |= v.z; + this->w |= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator^= + ( + valType const & s + ) + { + this->x ^= s; + this->y ^= s; + this->z ^= s; + this->w ^= s; + return *this; + } + + template + inline tvec4& tvec4::operator^= + ( + tvec4 const & v + ) + { + this->x ^= v.x; + this->y ^= v.y; + this->z ^= v.z; + this->w ^= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator<<= + ( + valType const & s + ) + { + this->x <<= s; + this->y <<= s; + this->z <<= s; + this->w <<= s; + return *this; + } + + template + inline tvec4& tvec4::operator<<= + ( + tvec4 const & v + ) + { + this->x <<= v.x; + this->y <<= v.y; + this->z <<= v.z; + this->w <<= v.w; + return *this; + } + + template + inline tvec4& tvec4::operator>>= + ( + valType const & s + ) + { + this->x >>= s; + this->y >>= s; + this->z >>= s; + this->w >>= s; + return *this; + } + + template + inline tvec4& tvec4::operator>>= + ( + tvec4 const & v + ) + { + this->x >>= v.x; + this->y >>= v.y; + this->z >>= v.z; + this->w >>= v.w; + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + template + inline valType tvec4::swizzle(comp x) const + { + return (*this)[x]; + } + + template + inline tvec2 tvec4::swizzle(comp x, comp y) const + { + return tvec2( + (*this)[x], + (*this)[y]); + } + + template + inline tvec3 tvec4::swizzle(comp x, comp y, comp z) const + { + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); + } + + template + inline tvec4 tvec4::swizzle(comp x, comp y, comp z, comp w) const + { + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + template + inline tref4 tvec4::swizzle(comp x, comp y, comp z, comp w) + { + return tref4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); + } + + ////////////////////////////////////// + // Binary arithmetic operators + + template + inline tvec4 operator+ + ( + tvec4 const & v, + valType const & s + ) + { + return tvec4( + v.x + s, + v.y + s, + v.z + s, + v.w + s); + } + + template + inline tvec4 operator+ + ( + valType const & s, + tvec4 const & v + ) + { + return tvec4( + s + v.x, + s + v.y, + s + v.z, + s + v.w); + } + + template + inline tvec4 operator+ + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x + v2.x, + v1.y + v2.y, + v1.z + v2.z, + v1.w + v2.w); + } + + //operator- + template + inline tvec4 operator- + ( + tvec4 const & v, + valType const & s + ) + { + return tvec4( + v.x - s, + v.y - s, + v.z - s, + v.w - s); + } + + template + inline tvec4 operator- + ( + valType const & s, + tvec4 const & v + ) + { + return tvec4( + s - v.x, + s - v.y, + s - v.z, + s - v.w); + } + + template + inline tvec4 operator- + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x - v2.x, + v1.y - v2.y, + v1.z - v2.z, + v1.w - v2.w); + } + + //operator* + template + inline tvec4 operator* + ( + tvec4 const & v, + valType const & s + ) + { + return tvec4( + v.x * s, + v.y * s, + v.z * s, + v.w * s); + } + + template + inline tvec4 operator* + ( + valType const & s, + tvec4 const & v + ) + { + return tvec4( + s * v.x, + s * v.y, + s * v.z, + s * v.w); + } + + template + inline tvec4 operator* + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x * v2.x, + v1.y * v2.y, + v1.z * v2.z, + v1.w * v2.w); + } + + //operator/ + template + inline tvec4 operator/ + ( + tvec4 const & v, + valType const & s + ) + { + return tvec4( + v.x / s, + v.y / s, + v.z / s, + v.w / s); + } + + template + inline tvec4 operator/ + ( + valType const & s, + tvec4 const & v + ) + { + return tvec4( + s / v.x, + s / v.y, + s / v.z, + s / v.w); + } + + template + inline tvec4 operator/ + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x / v2.x, + v1.y / v2.y, + v1.z / v2.z, + v1.w / v2.w); + } + + // Unary constant operators + template + inline tvec4 operator- + ( + tvec4 const & v + ) + { + return tvec4( + -v.x, + -v.y, + -v.z, + -v.w); + } + + template + inline tvec4 operator++ + ( + tvec4 const & v, + int + ) + { + return tvec4( + v.x + valType(1), + v.y + valType(1), + v.z + valType(1), + v.w + valType(1)); + } + + template + inline tvec4 operator-- + ( + tvec4 const & v, + int + ) + { + return tvec4( + v.x - valType(1), + v.y - valType(1), + v.z - valType(1), + v.w - valType(1)); + } + + ////////////////////////////////////// + // Binary bit operators + + template + inline tvec4 operator% + ( + tvec4 const & v, + T const & s + ) + { + return tvec4( + v.x % s, + v.y % s, + v.z % s, + v.w % s); + } + + template + inline tvec4 operator% + ( + T const & s, + tvec4 const & v + ) + { + return tvec4( + s % v.x, + s % v.y, + s % v.z, + s % v.w); + } + + template + inline tvec4 operator% + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x % v2.x, + v1.y % v2.y, + v1.z % v2.z, + v1.w % v2.w); + } + + template + inline tvec4 operator& + ( + tvec4 const & v, + T const & s + ) + { + return tvec4( + v.x & s, + v.y & s, + v.z & s, + v.w & s); + } + + template + inline tvec4 operator& + ( + T const & s, + tvec4 const & v + ) + { + return tvec4( + s & v.x, + s & v.y, + s & v.z, + s & v.w); + } + + template + inline tvec4 operator& + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x & v2.x, + v1.y & v2.y, + v1.z & v2.z, + v1.w & v2.w); + } + + template + inline tvec4 operator| + ( + tvec4 const & v, + T const & s + ) + { + return tvec4( + v.x | s, + v.y | s, + v.z | s, + v.w | s); + } + + template + inline tvec4 operator| + ( + T const & s, + tvec4 const & v + ) + { + return tvec4( + s | v.x, + s | v.y, + s | v.z, + s | v.w); + } + + template + inline tvec4 operator| + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x | v2.x, + v1.y | v2.y, + v1.z | v2.z, + v1.w | v2.w); + } + + template + inline tvec4 operator^ + ( + tvec4 const & v, + T const & s + ) + { + return tvec4( + v.x ^ s, + v.y ^ s, + v.z ^ s, + v.w ^ s); + } + + template + inline tvec4 operator^ + ( + T const & s, + tvec4 const & v + ) + { + return tvec4( + s ^ v.x, + s ^ v.y, + s ^ v.z, + s ^ v.w); + } + + template + inline tvec4 operator^ + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x ^ v2.x, + v1.y ^ v2.y, + v1.z ^ v2.z, + v1.w ^ v2.w); + } + + template + inline tvec4 operator<< + ( + tvec4 const & v, + T const & s + ) + { + return tvec4( + v.x << s, + v.y << s, + v.z << s, + v.w << s); + } + + template + inline tvec4 operator<< + ( + T const & s, + tvec4 const & v + ) + { + return tvec4( + s << v.x, + s << v.y, + s << v.z, + s << v.w); + } + + template + inline tvec4 operator<< + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x << v2.x, + v1.y << v2.y, + v1.z << v2.z, + v1.w << v2.w); + } + + template + inline tvec4 operator>> + ( + tvec4 const & v, + T const & s + ) + { + return tvec4( + v.x >> s, + v.y >> s, + v.z >> s, + v.w >> s); + } + + template + inline tvec4 operator>> + ( + T const & s, + tvec4 const & v + ) + { + return tvec4( + s >> v.x, + s >> v.y, + s >> v.z, + s >> v.w); + } + + template + inline tvec4 operator>> + ( + tvec4 const & v1, + tvec4 const & v2 + ) + { + return tvec4( + v1.x >> v2.x, + v1.y >> v2.y, + v1.z >> v2.z, + v1.w >> v2.w); + } + + template + inline tvec4 operator~ + ( + tvec4 const & v + ) + { + return tvec4( + ~v.x, + ~v.y, + ~v.z, + ~v.w); + } + + ////////////////////////////////////// + // tref definition + + template + tref4::tref4(T& x, T& y, T& z, T& w) : + x(x), + y(y), + z(z), + w(w) + {} + + template + tref4::tref4(tref4 const & r) : + x(r.x), + y(r.y), + z(r.z), + w(r.w) + {} + + template + tref4::tref4(tvec4 const & v) : + x(v.x), + y(v.y), + z(v.z), + w(v.w) + {} + + template + tref4& tref4::operator= (tref4 const & r) + { + x = r.x; + y = r.y; + z = r.z; + w = r.w; + return *this; + } + + template + tref4& tref4::operator= (tvec4 const & v) + { + x = v.x; + y = v.y; + z = v.z; + w = v.w; + return *this; + } + + }//namespace detail +}//namespace glm diff --git a/glm/ext.hpp b/glm/ext.hpp new file mode 100644 index 0000000..59e2086 --- /dev/null +++ b/glm/ext.hpp @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-01 +// Updated : 2009-05-01 +// Licence : This source is under MIT License +// File : glm/ext.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_ext +#define glm_ext + +#include "glm.hpp" +#include "gtc.hpp" +#include "gtx.hpp" +#include "img.hpp" + +//const float goldenRatio = 1.618033988749894848f; +//const float pi = 3.141592653589793238f; + +#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_EXTS | GLM_MESSAGE_NOTIFICATION))) +# pragma message("GLM message: Extensions library included") +#endif//GLM_MESSAGE + +#define GLM_EXTENSION(extension) namespace glm{using extension;} + +#endif //glm_ext diff --git a/glm/glm.h b/glm/glm.h new file mode 100644 index 0000000..b176a34 --- /dev/null +++ b/glm/glm.h @@ -0,0 +1,2 @@ +#pragma message(" is deprecated, please include instead") +#include "glm.hpp" diff --git a/glm/glm.hpp b/glm/glm.hpp new file mode 100644 index 0000000..3a9de2f --- /dev/null +++ b/glm/glm.hpp @@ -0,0 +1,173 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-01-14 +// Updated : 2009-05-01 +// Licence : This source is under MIT License +// File : glm/glm.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +/*! \mainpage OpenGL Mathematics + * + * OpenGL Mathematics (GLM) is a C++ mathematics library for 3D applications based on the OpenGL Shading Language (GLSL) specification. + * + * The goal of the project is to provide to 3D programmers math classes and functions that miss in C++ when we use to program with GLSL or any high level GPU language. With GLM, the idea is to have a library that works the same way that GLSL which imply a strict following of GLSL specification for the implementation. + * + * However, this project isn't limited by GLSL features. An extension system based on GLSL extensions development conventions allows to extend GLSL capabilities. + * + * GLM is release under MIT license and available for all version of GCC from version 3.4 and Visual Studio from version 8.0 as a platform independent library. + * + * Any feedback is welcome, please send them to g.truc.creation[NO_SPAM_THANKS]gmail.com. + * + */ + +#ifndef glm_glm +#define glm_glm + +#ifdef max +#undef max +#endif + +#ifdef min +#undef min +#endif + +#define GLMvalType typename genType::value_type +#define GLMcolType typename genType::col_type +#define GLMrowType typename genType::row_type + +#define GLMsizeType typename genType::size_type +#define GLMrowSize typename genType::row_size +#define GLMcolSize typename genType::col_size + +#include +#include +#include "./setup.hpp" + +//! GLM namespace, it contains all GLSL based features. +namespace glm +{ + namespace test + { + bool main_bug(); + bool main_core(); + }//namespace test + + //! GLM core. Namespace that includes all the feature define by GLSL 1.30.8 specification. This namespace is included in glm namespace. + namespace core + { + //! Scalar, vectors and matrices + //! from section 4.1.2 Booleans, 4.1.3 Integers section, 4.1.4 Floats section, + //! 4.1.5 Vectors and section 4.1.6 Matrices of GLSL 1.30.8 specification. + //! This namespace resolves precision qualifier define in section 4.5 of GLSL 1.30.8 specification. + namespace type + { + //! Scalar types from section 4.1.2 Booleans, 4.1.3 Integers and 4.1.4 Floats of GLSL 1.30.8 specification. + //! This namespace is included in glm namespace. + namespace scalar + { + //! Scalar types with precision qualifier. + //! This namespace is included in glm namespace. + namespace precision{} + } + + //! Vector types from section 4.1.5 of GLSL 1.30.8 specification. + //! This namespace is included in glm namespace. + namespace vector + { + //! Vector types with precision qualifier. + //! This namespace is included in glm namespace. + namespace precision{} + } + + //! Matrix types from section 4.1.6 of GLSL 1.30.8 specification. + //! This namespace is included in glm namespace. + namespace matrix + { + //! Matrix types with precision qualifier. + //! This namespace is included in glm namespace. + namespace precision{} + } + } + //! Some of the functions defined in section 8 Built-in Functions of GLSL 1.30.8 specification. + //! Angle and trigonometry, exponential, common, geometric, matrix and vector relational functions. + namespace function{} + } + //namespace core + + using namespace core::type::scalar; + using namespace core::type::scalar::precision; + using namespace core::type::vector; + using namespace core::type::vector::precision; + using namespace core::type::matrix; + using namespace core::type::matrix::precision; + + //! GLM experimental extensions. The interface could change between releases. + namespace gtx{} + + //! GLM stable extensions. + namespace gtc{} + + //! IMG extensions. + namespace img{} + + //! VIRTREV extensions. + namespace img{} + +} //namespace glm + +#include "./core/_detail.hpp" +#include "./core/type.hpp" +#include "./core/type_half.hpp" + +#include "./core/func_common.hpp" +#include "./core/func_exponential.hpp" +#include "./core/func_geometric.hpp" +#include "./core/func_matrix.hpp" +#include "./core/func_trigonometric.hpp" +#include "./core/func_vector_relational.hpp" +#include "./core/func_noise.hpp" +#include "./core/_swizzle.hpp" +//#include "./core/_xref2.hpp" +//#include "./core/_xref3.hpp" +//#include "./core/_xref4.hpp" + +#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_CORE | GLM_MESSAGE_NOTIFICATION))) +# pragma message("GLM message: Core library included") +#endif//GLM_MESSAGE + +#if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC)) + +#define GLM_DEPRECATED __declspec(deprecated) +#define GLM_RESTRICT __restrict +#define GLM_ALIGN(x) __declspec(align(x)) + +//#define aligned(x) __declspec(align(x)) struct + +#else + +#define GLM_DEPRECATED +#define GLM_RESTRICT +#define GLM_ALIGN(x) + +#endif//GLM_COMPILER + +//////////////////// +// check type sizes +#ifndef GLM_STATIC_ASSERT_NULL + GLM_STATIC_ASSERT(sizeof(glm::detail::int8)==1); + GLM_STATIC_ASSERT(sizeof(glm::detail::int16)==2); + GLM_STATIC_ASSERT(sizeof(glm::detail::int32)==4); + GLM_STATIC_ASSERT(sizeof(glm::detail::int64)==8); + + GLM_STATIC_ASSERT(sizeof(glm::detail::uint8)==1); + GLM_STATIC_ASSERT(sizeof(glm::detail::uint16)==2); + GLM_STATIC_ASSERT(sizeof(glm::detail::uint32)==4); + GLM_STATIC_ASSERT(sizeof(glm::detail::uint64)==8); + + GLM_STATIC_ASSERT(sizeof(glm::detail::float16)==2); + GLM_STATIC_ASSERT(sizeof(glm::detail::float32)==4); + GLM_STATIC_ASSERT(sizeof(glm::detail::float64)==8); +#endif//GLM_STATIC_ASSERT_NULL + +#endif //glm_glm diff --git a/glm/glmext.h b/glm/glmext.h new file mode 100644 index 0000000..eb3950b --- /dev/null +++ b/glm/glmext.h @@ -0,0 +1,2 @@ +#pragma message(" is deprecated, please include specific extensions instead") +#include "ext.hpp" diff --git a/glm/glmsetup.h b/glm/glmsetup.h new file mode 100644 index 0000000..009f81d --- /dev/null +++ b/glm/glmsetup.h @@ -0,0 +1,2 @@ +#pragma message(" is deprecated, please include instead") +#include "setup.hpp" diff --git a/glm/gtc.hpp b/glm/gtc.hpp new file mode 100644 index 0000000..6c7a61a --- /dev/null +++ b/glm/gtc.hpp @@ -0,0 +1,26 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-01 +// Updated : 2009-05-01 +// Licence : This source is under MIT License +// File : glm/gtc.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Note: +// GTC extensions are stable extensions +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc +#define glm_gtc + +#define GLM_GTC_GLOBAL 1 + +#include "gtc/double_float.hpp" +#include "gtc/half_float.hpp" +#include "gtc/matrix_access.hpp" +#include "gtc/matrix_operation.hpp" +#include "gtc/matrix_projection.hpp" +#include "gtc/matrix_transform.hpp" +#include "gtc/quaternion.hpp" + +#endif//glm_gtc diff --git a/glm/gtc/double_float.hpp b/glm/gtc/double_float.hpp new file mode 100644 index 0000000..2f79ff5 --- /dev/null +++ b/glm/gtc/double_float.hpp @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/double_float.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Note: +// - This implementation doesn't need to redefine all build-in functions to +// support double based type. +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc_double_float +#define glm_gtc_double_float + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + bool main_gtc_double_float(); + }//namespace test + + namespace gtc{ + //! GLM_GTC_double_float extension: Add support for double precision floating-point types + namespace double_float + { + //! Vector of 2 single-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tvec2 fvec2; + + //! Vector of 3 single-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tvec3 fvec3; + + //! Vector of 4 single-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tvec4 fvec4; + + //! 2 * 2 matrix of single-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tmat2x2 fmat2; + + //! 3 * 3 matrix of single-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tmat3x3 fmat3; + + //! 4 * 4 matrix of single-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tmat4x4 fmat4; + + //! Vector of 2 double-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tvec2 dvec2; + + //! Vector of 3 double-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tvec3 dvec3; + + //! Vector of 4 double-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tvec4 dvec4; + + //! 2 * 2 matrix of double-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tmat2x2 dmat2; + + //! 3 * 3 matrix of double-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tmat3x3 dmat3; + + //! 4 * 4 matrix of double-precision floating-point numbers. + //! From GLM_GTC_double_float extension. + typedef detail::tmat4x4 dmat4; + + }//namespace double_float + }//namespace gtc +}//namespace glm + +#define GLM_GTC_double_float namespace gtc::double_float +#ifndef GLM_GTC_GLOBAL +namespace glm {using GLM_GTC_double_float;} +#endif//GLM_GTC_GLOBAL + +#include "double_float.inl" + +#endif//glm_gtc_double_float diff --git a/glm/gtc/double_float.inl b/glm/gtc/double_float.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtc/half_float.hpp b/glm/gtc/half_float.hpp new file mode 100644 index 0000000..0a0fa5d --- /dev/null +++ b/glm/gtc/half_float.hpp @@ -0,0 +1,407 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/half_float.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc_half_float +#define glm_gtc_half_float + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + bool main_gtc_half_float(); + }//namespace test + + namespace detail + { +#ifndef GLM_USE_ANONYMOUS_UNION + template <> + struct tvec2 + { + ////////////////////////////////////// + // Typedef (Implementation details) + + typedef thalf value_type; + typedef thalf& value_reference; + typedef thalf* value_pointer; + typedef tvec2 bool_type; + + typedef sizeType size_type; + static size_type value_size(); + static bool is_vector(); + + typedef tvec2 type; + typedef tvec2* pointer; + typedef const tvec2* const_pointer; + typedef const tvec2*const const_pointer_const; + typedef tvec2*const pointer_const; + typedef tvec2& reference; + typedef const tvec2& const_reference; + typedef const tvec2& param_type; + + ////////////////////////////////////// + // Data + + thalf x, y; + + ////////////////////////////////////// + // Accesses + + thalf& operator[](size_type i); + thalf operator[](size_type i) const; + + ////////////////////////////////////// + // Address (Implementation details) + + thalf const * const _address() const{return (value_type*)(this);} + thalf * _address(){return (value_type*)(this);} + + ////////////////////////////////////// + // Implicit basic constructors + + tvec2(); + tvec2(tvec2 const & v); + + ////////////////////////////////////// + // Explicit basic constructors + + explicit tvec2(thalf s); + explicit tvec2(thalf s1, thalf s2); + + ////////////////////////////////////// + // Swizzle constructors + + tvec2(tref2 const & r); + + ////////////////////////////////////// + // Convertion scalar constructors + + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(U x); + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(U x, V y); + + ////////////////////////////////////// + // Convertion vector constructors + + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(tvec2 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(tvec3 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec2(tvec4 const & v); + + ////////////////////////////////////// + // Unary arithmetic operators + + tvec2& operator= (tvec2 const & v); + + tvec2& operator+=(thalf s); + tvec2& operator+=(tvec2 const & v); + tvec2& operator-=(thalf s); + tvec2& operator-=(tvec2 const & v); + tvec2& operator*=(thalf s); + tvec2& operator*=(tvec2 const & v); + tvec2& operator/=(thalf s); + tvec2& operator/=(tvec2 const & v); + tvec2& operator++(); + tvec2& operator--(); + + ////////////////////////////////////// + // Swizzle operators + + thalf swizzle(comp X) const; + tvec2 swizzle(comp X, comp Y) const; + tvec3 swizzle(comp X, comp Y, comp Z) const; + tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + tref2 swizzle(comp X, comp Y); + }; + + template <> + struct tvec3 + { + ////////////////////////////////////// + // Typedef (Implementation details) + + typedef thalf value_type; + typedef thalf& value_reference; + typedef thalf* value_pointer; + typedef tvec3 bool_type; + + typedef glm::sizeType size_type; + static size_type value_size(); + static bool is_vector(); + + typedef tvec3 type; + typedef tvec3 * pointer; + typedef tvec3 const * const_pointer; + typedef tvec3 const * const const_pointer_const; + typedef tvec3 * const pointer_const; + typedef tvec3 & reference; + typedef tvec3 const & const_reference; + typedef tvec3 const & param_type; + + ////////////////////////////////////// + // Data + + thalf x, y, z; + + ////////////////////////////////////// + // Accesses + + thalf& operator[](size_type i); + thalf operator[](size_type i) const; + + ////////////////////////////////////// + // Address (Implementation details) + + const value_type* _address() const{return (value_type*)(this);} + value_type* _address(){return (value_type*)(this);} + + ////////////////////////////////////// + // Implicit basic constructors + + tvec3(); + tvec3(tvec3 const & v); + + ////////////////////////////////////// + // Explicit basic constructors + + explicit tvec3(thalf s); + explicit tvec3(thalf s1, thalf s2, thalf s3); + + ////////////////////////////////////// + // Swizzle constructors + + tvec3(tref3 const & r); + + ////////////////////////////////////// + // Convertion scalar constructors + + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(U x); + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(U x, V y, W z); + + ////////////////////////////////////// + // Convertion vector constructors + + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(const tvec2& v, B s); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(A s, const tvec2& v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(tvec3 const & v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec3(tvec4 const & v); + + ////////////////////////////////////// + // Unary arithmetic operators + + tvec3& operator= (tvec3 const & v); + + tvec3& operator+=(thalf s); + tvec3& operator+=(tvec3 const & v); + tvec3& operator-=(thalf s); + tvec3& operator-=(tvec3 const & v); + tvec3& operator*=(thalf s); + tvec3& operator*=(tvec3 const & v); + tvec3& operator/=(thalf s); + tvec3& operator/=(tvec3 const & v); + tvec3& operator++(); + tvec3& operator--(); + + ////////////////////////////////////// + // Swizzle operators + + thalf swizzle(comp X) const; + tvec2 swizzle(comp X, comp Y) const; + tvec3 swizzle(comp X, comp Y, comp Z) const; + tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + tref3 swizzle(comp X, comp Y, comp Z); + }; + + template <> + struct tvec4 + { + ////////////////////////////////////// + // Typedef (Implementation details) + + typedef thalf value_type; + typedef thalf& value_reference; + typedef thalf* value_pointer; + typedef tvec4 bool_type; + + typedef glm::sizeType size_type; + static size_type value_size(); + static bool is_vector(); + + typedef tvec4 type; + typedef tvec4 * pointer; + typedef tvec4 const * const_pointer; + typedef tvec4 const * const const_pointer_const; + typedef tvec4 * const pointer_const; + typedef tvec4 & reference; + typedef tvec4 const & const_reference; + typedef tvec4 const & param_type; + + ////////////////////////////////////// + // Data + + thalf x, y, z, w; + + ////////////////////////////////////// + // Accesses + + thalf& operator[](size_type i); + thalf operator[](size_type i) const; + + ////////////////////////////////////// + // Address (Implementation details) + + const value_type* _address() const{return (value_type*)(this);} + value_type* _address(){return (value_type*)(this);} + + ////////////////////////////////////// + // Implicit basic constructors + + tvec4(); + tvec4(tvec4 const & v); + + ////////////////////////////////////// + // Explicit basic constructors + + explicit tvec4(thalf s); + explicit tvec4(thalf s0, thalf s1, thalf s2, thalf s3); + + ////////////////////////////////////// + // Swizzle constructors + + tvec4(tref4 const & r); + + ////////////////////////////////////// + // Convertion scalar constructors + + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(U x); + //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A x, B y, C z, D w); + + ////////////////////////////////////// + // Convertion vector constructors + + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(const tvec2& v, B s1, C s2); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A s1, const tvec2& v, C s2); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A s1, B s2, const tvec2& v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(const tvec3& v, B s); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(A s, const tvec3& v); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(const tvec2& v1, const tvec2& v2); + //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) + template + explicit tvec4(const tvec4& v); + + ////////////////////////////////////// + // Unary arithmetic operators + + tvec4& operator= (tvec4 const & v); + + tvec4& operator+=(thalf s); + tvec4& operator+=(tvec4 const & v); + tvec4& operator-=(thalf s); + tvec4& operator-=(tvec4 const & v); + tvec4& operator*=(thalf s); + tvec4& operator*=(tvec4 const & v); + tvec4& operator/=(thalf s); + tvec4& operator/=(tvec4 const & v); + tvec4& operator++(); + tvec4& operator--(); + + ////////////////////////////////////// + // Swizzle operators + + thalf swizzle(comp X) const; + tvec2 swizzle(comp X, comp Y) const; + tvec3 swizzle(comp X, comp Y, comp Z) const; + tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; + tref4 swizzle(comp X, comp Y, comp Z, comp W); + }; +#endif//GLM_USE_ANONYMOUS_UNION + } + //namespace detail + + namespace gtc{ + //! GLM_GTC_half_float extension: Add support for half precision floating-point types + namespace half_float + { + //! Type for half-precision floating-point numbers. + //! From GLM_GTC_half_float extension. + typedef detail::thalf half; + + //! Vector of 2 half-precision floating-point numbers. + //! From GLM_GTC_half_float extension. + typedef detail::tvec2 hvec2; + + //! Vector of 3 half-precision floating-point numbers. + //! From GLM_GTC_half_float extension. + typedef detail::tvec3 hvec3; + + //! Vector of 4 half-precision floating-point numbers. + //! From GLM_GTC_half_float extension. + typedef detail::tvec4 hvec4; + + //! 2 * 2 matrix of half-precision floating-point numbers. + //! From GLM_GTC_half_float extension. + typedef detail::tmat2x2 hmat2; + + //! 3 * 3 matrix of half-precision floating-point numbers. + //! From GLM_GTC_half_float extension. + typedef detail::tmat3x3 hmat3; + + //! 4 * 4 matrix of half-precision floating-point numbers. + //! From GLM_GTC_half_float extension. + typedef detail::tmat4x4 hmat4; + + }//namespace half_float + }//namespace gtc +}//namespace glm + +#define GLM_GTC_half_float namespace gtc::half_float +#ifndef GLM_GTC_GLOBAL +namespace glm {using GLM_GTC_half_float;} +#endif//GLM_GTC_GLOBAL + +#include "half_float.inl" + +#endif//glm_gtc_half_float diff --git a/glm/gtc/half_float.inl b/glm/gtc/half_float.inl new file mode 100644 index 0000000..55719d0 --- /dev/null +++ b/glm/gtc/half_float.inl @@ -0,0 +1,784 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-08-24 +// Licence : This source is under MIT licence +// File : glm/gtx/half_float.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + +#ifndef GLM_USE_ANONYMOUS_UNION + +////////////////////////////////////// +// hvec2 + +inline tvec2::size_type tvec2::value_size() +{ + return tvec2::size_type(2); +} + +inline bool tvec2::is_vector() +{ + return true; +} + +////////////////////////////////////// +// Accesses + +inline thalf& tvec2::operator[](tvec2::size_type i) +{ + assert( i >= tvec2::size_type(0) && + i < tvec2::value_size()); + return (&x)[i]; +} + +inline thalf tvec2::operator[](tvec2::size_type i) const +{ + assert( i >= tvec2::size_type(0) && + i < tvec2::value_size()); + return (&x)[i]; +} + +////////////////////////////////////// +// Implicit basic constructors + +inline tvec2::tvec2() : + x(thalf(0.f)), + y(thalf(0.f)) +{} + +inline tvec2::tvec2(tvec2 const & v) : + x(v.x), + y(v.y) +{} + +////////////////////////////////////// +// Explicit basic constructors + +inline tvec2::tvec2(thalf s) : + x(s), + y(s) +{} + +inline tvec2::tvec2(thalf s1, thalf s2) : + x(s1), + y(s2) +{} + +////////////////////////////////////// +// Swizzle constructors + +inline tvec2::tvec2(tref2 const & r) : + x(r.x), + y(r.y) +{} + +////////////////////////////////////// +// Convertion scalar constructors + +template +inline tvec2::tvec2(U x) : + x(thalf(x)), + y(thalf(x)) +{} + +template +inline tvec2::tvec2(U x, V y) : + x(thalf(x)), + y(thalf(y)) +{} + +////////////////////////////////////// +// Convertion vector constructors + +template +inline tvec2::tvec2(tvec2 const & v) : + x(thalf(v.x)), + y(thalf(v.y)) +{} + +template +inline tvec2::tvec2(tvec3 const & v) : + x(thalf(v.x)), + y(thalf(v.y)) +{} + +template +inline tvec2::tvec2(tvec4 const & v) : + x(thalf(v.x)), + y(thalf(v.y)) +{} + +////////////////////////////////////// +// Unary arithmetic operators + +inline tvec2& tvec2::operator= (tvec2 const & v) +{ + this->x = v.x; + this->y = v.y; + return *this; +} + +inline tvec2& tvec2::operator+=(thalf s) +{ + this->x += s; + this->y += s; + return *this; +} + +inline tvec2& tvec2::operator+=(tvec2 const & v) +{ + this->x += v.x; + this->y += v.y; + return *this; +} + +inline tvec2& tvec2::operator-=(thalf s) +{ + this->x -= s; + this->y -= s; + return *this; +} + +inline tvec2& tvec2::operator-=(tvec2 const & v) +{ + this->x -= v.x; + this->y -= v.y; + return *this; +} + +inline tvec2& tvec2::operator*=(thalf s) +{ + this->x *= s; + this->y *= s; + return *this; +} + +inline tvec2& tvec2::operator*=(tvec2 const & v) +{ + this->x *= v.x; + this->y *= v.y; + return *this; +} + +inline tvec2& tvec2::operator/=(thalf s) +{ + this->x /= s; + this->y /= s; + return *this; +} + +inline tvec2& tvec2::operator/=(tvec2 const & v) +{ + this->x /= v.x; + this->y /= v.y; + return *this; +} + +inline tvec2& tvec2::operator++() +{ + ++this->x; + ++this->y; + return *this; +} + +inline tvec2& tvec2::operator--() +{ + --this->x; + --this->y; + return *this; +} + +////////////////////////////////////// +// Swizzle operators + +inline thalf tvec2::swizzle(comp x) const +{ + return (*this)[x]; +} + +inline tvec2 tvec2::swizzle(comp x, comp y) const +{ + return tvec2( + (*this)[x], + (*this)[y]); +} + +inline tvec3 tvec2::swizzle(comp x, comp y, comp z) const +{ + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); +} + +inline tvec4 tvec2::swizzle(comp x, comp y, comp z, comp w) const +{ + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); +} + +inline tref2 tvec2::swizzle(comp x, comp y) +{ + return tref2( + (*this)[x], + (*this)[y]); +} + +////////////////////////////////////// +// hvec3 + +inline tvec3::size_type tvec3::value_size() +{ + return tvec3::size_type(3); +} + +inline bool tvec3::is_vector() +{ + return true; +} + +////////////////////////////////////// +// Accesses + +inline thalf& tvec3::operator[](tvec3::size_type i) +{ + assert( i >= tvec3::size_type(0) && + i < tvec3::value_size()); + + return (&x)[i]; +} + +inline thalf tvec3::operator[](tvec3::size_type i) const +{ + assert( i >= tvec3::size_type(0) && + i < tvec3::value_size()); + + return (&x)[i]; +} + +////////////////////////////////////// +// Implicit basic constructors + +inline tvec3::tvec3() : + x(thalf(0)), + y(thalf(0)), + z(thalf(0)) +{} + +inline tvec3::tvec3(tvec3 const & v) : + x(v.x), + y(v.y), + z(v.z) +{} + +////////////////////////////////////// +// Explicit basic constructors + +inline tvec3::tvec3(thalf s) : + x(s), + y(s), + z(s) +{} + +inline tvec3::tvec3(thalf s0, thalf s1, thalf s2) : + x(s0), + y(s1), + z(s2) +{} + +////////////////////////////////////// +// Swizzle constructors + +inline tvec3::tvec3(tref3 const & r) : + x(r.x), + y(r.y), + z(r.z) +{} + +////////////////////////////////////// +// Convertion scalar constructors + +template +inline tvec3::tvec3(U x) : + x(thalf(x)), + y(thalf(x)), + z(thalf(x)) +{} + +template +inline tvec3::tvec3(A x, B y, C z) : + x(thalf(x)), + y(thalf(y)), + z(thalf(z)) +{} + +////////////////////////////////////// +// Convertion vector constructors + +template +inline tvec3::tvec3(tvec2 const & v, B s) : + x(thalf(v.x)), + y(thalf(v.y)), + z(thalf(s)) +{} + +template +inline tvec3::tvec3(A s, tvec2 const & v) : + x(thalf(s)), + y(thalf(v.x)), + z(thalf(v.y)) +{} + +template +inline tvec3::tvec3(tvec3 const & v) : + x(thalf(v.x)), + y(thalf(v.y)), + z(thalf(v.z)) +{} + +template +inline tvec3::tvec3(tvec4 const & v) : + x(thalf(v.x)), + y(thalf(v.y)), + z(thalf(v.z)) +{} + +////////////////////////////////////// +// Unary arithmetic operators + +inline tvec3& tvec3::operator= (tvec3 const & v) +{ + this->x = v.x; + this->y = v.y; + this->z = v.z; + return *this; +} + +inline tvec3& tvec3::operator+=(thalf s) +{ + this->x += s; + this->y += s; + this->z += s; + return *this; +} + +inline tvec3& tvec3::operator+=(tvec3 const & v) +{ + this->x += v.x; + this->y += v.y; + this->z += v.z; + return *this; +} + +inline tvec3& tvec3::operator-=(thalf s) +{ + this->x -= s; + this->y -= s; + this->z -= s; + return *this; +} + +inline tvec3& tvec3::operator-=(tvec3 const & v) +{ + this->x -= v.x; + this->y -= v.y; + this->z -= v.z; + return *this; +} + +inline tvec3& tvec3::operator*=(thalf s) +{ + this->x *= s; + this->y *= s; + this->z *= s; + return *this; +} + +inline tvec3& tvec3::operator*=(tvec3 const & v) +{ + this->x *= v.x; + this->y *= v.y; + this->z *= v.z; + return *this; +} + +inline tvec3& tvec3::operator/=(thalf s) +{ + this->x /= s; + this->y /= s; + this->z /= s; + return *this; +} + +inline tvec3& tvec3::operator/=(tvec3 const & v) +{ + this->x /= v.x; + this->y /= v.y; + this->z /= v.z; + return *this; +} + +inline tvec3& tvec3::operator++() +{ + ++this->x; + ++this->y; + ++this->z; + return *this; +} + +inline tvec3& tvec3::operator--() +{ + --this->x; + --this->y; + --this->z; + return *this; +} + +////////////////////////////////////// +// Swizzle operators + +inline thalf tvec3::swizzle(comp x) const +{ + return (*this)[x]; +} + +inline tvec2 tvec3::swizzle(comp x, comp y) const +{ + return tvec2( + (*this)[x], + (*this)[y]); +} + +inline tvec3 tvec3::swizzle(comp x, comp y, comp z) const +{ + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); +} + +inline tvec4 tvec3::swizzle(comp x, comp y, comp z, comp w) const +{ + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); +} + +inline tref3 tvec3::swizzle(comp x, comp y, comp z) +{ + return tref3( + (*this)[x], + (*this)[y], + (*this)[z]); +} + +////////////////////////////////////// +// hvec4 + +inline tvec4::size_type tvec4::value_size() +{ + return tvec4::size_type(4); +} + +inline bool tvec4::is_vector() +{ + return true; +} + +////////////////////////////////////// +// Accesses + +inline thalf& tvec4::operator[](tvec4::size_type i) +{ + assert( i >= tvec4::size_type(0) && + i < tvec4::value_size()); + + return (&x)[i]; +} + +inline thalf tvec4::operator[](tvec4::size_type i) const +{ + assert( i >= tvec4::size_type(0) && + i < tvec4::value_size()); + + return (&x)[i]; +} + +////////////////////////////////////// +// Implicit basic constructors + +inline tvec4::tvec4() : + x(thalf(0)), + y(thalf(0)), + z(thalf(0)), + w(thalf(0)) +{} + +inline tvec4::tvec4(tvec4 const & v) : + x(v.x), + y(v.y), + z(v.z), + w(v.w) +{} + +////////////////////////////////////// +// Explicit basic constructors + +inline tvec4::tvec4(thalf s) : + x(s), + y(s), + z(s), + w(s) +{} + +inline tvec4::tvec4(thalf s1, thalf s2, thalf s3, thalf s4) : + x(s1), + y(s2), + z(s3), + w(s4) +{} + +////////////////////////////////////// +// Swizzle constructors + +inline tvec4::tvec4(tref4 const & r) : + x(r.x), + y(r.y), + z(r.z), + w(r.w) +{} + +////////////////////////////////////// +// Convertion scalar constructors + +template +inline tvec4::tvec4(U x) : + x(thalf(x)), + y(thalf(x)), + z(thalf(x)), + w(thalf(x)) +{} + +template +inline tvec4::tvec4(A x, B y, C z, D w) : + x(thalf(x)), + y(thalf(y)), + z(thalf(z)), + w(thalf(w)) +{} + +////////////////////////////////////// +// Convertion vector constructors + +template +inline tvec4::tvec4(const tvec2& v, B s1, C s2) : + x(thalf(v.x)), + y(thalf(v.y)), + z(thalf(s1)), + w(thalf(s2)) +{} + +template +inline tvec4::tvec4(A s1, const tvec2& v, C s2) : + x(thalf(s1)), + y(thalf(v.x)), + z(thalf(v.y)), + w(thalf(s2)) +{} + +template +inline tvec4::tvec4(A s1, B s2, const tvec2& v) : + x(thalf(s1)), + y(thalf(s2)), + z(thalf(v.x)), + w(thalf(v.y)) +{} + +template +inline tvec4::tvec4(const tvec3& v, B s) : + x(thalf(v.x)), + y(thalf(v.y)), + z(thalf(v.z)), + w(thalf(s)) +{} + +template +inline tvec4::tvec4(A s, const tvec3& v) : + x(thalf(s)), + y(thalf(v.x)), + z(thalf(v.y)), + w(thalf(v.z)) +{} + +template +inline tvec4::tvec4(const tvec2& v1, const tvec2& v2) : + x(thalf(v1.x)), + y(thalf(v1.y)), + z(thalf(v2.x)), + w(thalf(v2.y)) +{} + +template +inline tvec4::tvec4(const tvec4& v) : + x(thalf(v.x)), + y(thalf(v.y)), + z(thalf(v.z)), + w(thalf(v.w)) +{} + +////////////////////////////////////// +// Unary arithmetic operators + +inline tvec4& tvec4::operator= (tvec4 const & v) +{ + this->x = v.x; + this->y = v.y; + this->z = v.z; + this->w = v.w; + return *this; +} + +inline tvec4& tvec4::operator+=(thalf s) +{ + this->x += s; + this->y += s; + this->z += s; + this->w += s; + return *this; +} + +inline tvec4& tvec4::operator+=(tvec4 const & v) +{ + this->x += v.x; + this->y += v.y; + this->z += v.z; + this->w += v.w; + return *this; +} + +inline tvec4& tvec4::operator-=(thalf s) +{ + this->x -= s; + this->y -= s; + this->z -= s; + this->w -= s; + return *this; +} + +inline tvec4& tvec4::operator-=(tvec4 const & v) +{ + this->x -= v.x; + this->y -= v.y; + this->z -= v.z; + this->w -= v.w; + return *this; +} + +inline tvec4& tvec4::operator*=(thalf s) +{ + this->x *= s; + this->y *= s; + this->z *= s; + this->w *= s; + return *this; +} + +inline tvec4& tvec4::operator*=(tvec4 const & v) +{ + this->x *= v.x; + this->y *= v.y; + this->z *= v.z; + this->w *= v.w; + return *this; +} + +inline tvec4& tvec4::operator/=(thalf s) +{ + this->x /= s; + this->y /= s; + this->z /= s; + this->w /= s; + return *this; +} + +inline tvec4& tvec4::operator/=(tvec4 const & v) +{ + this->x /= v.x; + this->y /= v.y; + this->z /= v.z; + this->w /= v.w; + return *this; +} + +inline tvec4& tvec4::operator++() +{ + ++this->x; + ++this->y; + ++this->z; + ++this->w; + return *this; +} + +inline tvec4& tvec4::operator--() +{ + --this->x; + --this->y; + --this->z; + --this->w; + return *this; +} + +////////////////////////////////////// +// Swizzle operators + +inline thalf tvec4::swizzle(comp x) const +{ + return (*this)[x]; +} + +inline tvec2 tvec4::swizzle(comp x, comp y) const +{ + return tvec2( + (*this)[x], + (*this)[y]); +} + +inline tvec3 tvec4::swizzle(comp x, comp y, comp z) const +{ + return tvec3( + (*this)[x], + (*this)[y], + (*this)[z]); +} + +inline tvec4 tvec4::swizzle(comp x, comp y, comp z, comp w) const +{ + return tvec4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); +} + +inline tref4 tvec4::swizzle(comp x, comp y, comp z, comp w) +{ + return tref4( + (*this)[x], + (*this)[y], + (*this)[z], + (*this)[w]); +} + +#endif//GLM_USE_ANONYMOUS_UNION + +}//namespace detail +}//namespace glm diff --git a/glm/gtc/matrix_access.hpp b/glm/gtc/matrix_access.hpp new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtc/matrix_access.inl b/glm/gtc/matrix_access.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtc/matrix_operation.hpp b/glm/gtc/matrix_operation.hpp new file mode 100644 index 0000000..72d9e70 --- /dev/null +++ b/glm/gtc/matrix_operation.hpp @@ -0,0 +1,36 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/matrix_operation.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc_matrix_operation +#define glm_gtc_matrix_operation + +// Dependency: +#include "../glm.hpp" + +namespace glm{ +namespace gtc{ +//! GLM_GTC_matrix_operation extension: Matrix operation functions +namespace matrix_operation +{ + +}//namespace matrix_operation +}//namespace gtc +}//namespace glm + +#define GLM_GTC_matrix_operation namespace gtc::matrix_operation +#ifndef GLM_GTC_GLOBAL +namespace glm {using GLM_GTC_matrix_operation;} +#endif//GLM_GTC_GLOBAL + +#include "matrix_operation.inl" + +#endif//glm_gtc_matrix_operation diff --git a/glm/gtc/matrix_operation.inl b/glm/gtc/matrix_operation.inl new file mode 100644 index 0000000..83222d0 --- /dev/null +++ b/glm/gtc/matrix_operation.inl @@ -0,0 +1,17 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/matrix_operation.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtc{ +namespace matrix_operation +{ + +}//namespace matrix_operation +}//namespace gtc +}//namespace glm diff --git a/glm/gtc/matrix_projection.hpp b/glm/gtc/matrix_projection.hpp new file mode 100644 index 0000000..588c970 --- /dev/null +++ b/glm/gtc/matrix_projection.hpp @@ -0,0 +1,102 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/matrix_projection.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_matrix_operation +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc_matrix_projection +#define glm_gtc_matrix_projection + +// Dependency: +#include "../glm.hpp" +#include "../gtc/matrix_operation.hpp" + +namespace glm +{ + namespace test{ + bool main_gtc_matrix_projection(); + }//namespace test + + namespace gtc{ + //! GLM_GTC_matrix_projection: Varius ways to build and operate on projection matrices + namespace matrix_projection + { + using namespace gtc::matrix_operation; + + //! Creates a matrix for projecting two-dimensional coordinates onto the screen. + //! From GLM_GTC_matrix_projection extension. + template + detail::tmat4x4 ortho( + valType const & left, + valType const & right, + valType const & bottom, + valType const & top); + + //! Creates a matrix for an orthographic parallel viewing volume. + //! From GLM_GTC_matrix_projection extension. + template + detail::tmat4x4 ortho( + valType const & left, + valType const & right, + valType const & bottom, + valType const & top, + valType const & zNear, + valType const & zFar); + + //! Creates a frustum matrix. + //! From GLM_GTC_matrix_projection extension. + template + detail::tmat4x4 frustum( + valType const & left, + valType const & right, + valType const & bottom, + valType const & top, + valType const & nearVal, + valType const & farVal); + + //! Creates a matrix for a symetric perspective-view frustum. + //! From GLM_GTC_matrix_projection extension. + template + detail::tmat4x4 perspective( + valType const & fovy, + valType const & aspect, + valType const & zNear, + valType const & zFar); + + //! Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates. + //! From GLM_GTC_matrix_projection extension. + template + detail::tvec3 project( + detail::tvec3 const & obj, + detail::tmat4x4 const & model, + detail::tmat4x4 const & proj, + detail::tvec4 const & viewport); + + //! Map the specified window coordinates (win.x, win.y, win.z) into object coordinates. + //! From GLM_GTC_matrix_projection extension. + template + detail::tvec3 unProject( + detail::tvec3 const & win, + detail::tmat4x4 const & model, + detail::tmat4x4 const & proj, + detail::tvec4 const & viewport); + + }//namespace matrix_projection + }//namespace gtc +}//namespace glm + +#define GLM_GTC_matrix_projection namespace gtc::matrix_projection +#ifndef GLM_GTC_GLOBAL +namespace glm {using GLM_GTC_matrix_projection;} +#endif//GLM_GTC_GLOBAL + +#include "matrix_projection.inl" + +#endif//glm_gtc_matrix_projection diff --git a/glm/gtc/matrix_projection.inl b/glm/gtc/matrix_projection.inl new file mode 100644 index 0000000..7bae2f9 --- /dev/null +++ b/glm/gtc/matrix_projection.inl @@ -0,0 +1,132 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/matrix_projection.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtc{ +namespace matrix_projection +{ + template + inline detail::tmat4x4 ortho( + valType const & left, + valType const & right, + valType const & bottom, + valType const & top) + { + detail::tmat4x4 Result(1); + Result[0][0] = valType(2) / (right - left); + Result[1][1] = valType(2) / (top - bottom); + Result[2][2] = - valType(1); + Result[3][0] = - (right + left) / (right - left); + Result[3][1] = - (top + bottom) / (top - bottom); + return Result; + } + + template + inline detail::tmat4x4 ortho( + valType const & left, + valType const & right, + valType const & bottom, + valType const & top, + valType const & zNear, + valType const & zFar) + { + detail::tmat4x4 Result(1); + Result[0][0] = valType(2) / (right - left); + Result[1][1] = valType(2) / (top - bottom); + Result[2][2] = - valType(2) / (zFar - zNear); + Result[3][0] = - (right + left) / (right - left); + Result[3][1] = - (top + bottom) / (top - bottom); + Result[3][2] = - (zFar + zNear) / (zFar - zNear); + return Result; + } + + template + inline detail::tmat4x4 frustum( + valType const & left, + valType const & right, + valType const & bottom, + valType const & top, + valType const & nearVal, + valType const & farVal) + { + detail::tmat4x4 Result(0); + Result[0][0] = (valType(2) * nearVal) / (right - left); + Result[1][1] = (valType(2) * nearVal) / (top - bottom); + Result[2][0] = (right + left) / (right - left); + Result[2][1] = (top + bottom) / (top - bottom); + Result[2][2] = -(farVal + nearVal) / (farVal - nearVal); + Result[2][3] = valType(-1); + Result[3][2] = -(valType(2) * farVal * nearVal) / (farVal - nearVal); + return Result; + } + + template + inline detail::tmat4x4 perspective( + valType const & fovy, + valType const & aspect, + valType const & zNear, + valType const & zFar) + { + valType range = tan(radians(fovy / valType(2))) * zNear; + valType left = -range * aspect; + valType right = range * aspect; + valType bottom = -range; + valType top = range; + + detail::tmat4x4 Result(valType(0)); + Result[0][0] = (valType(2) * zNear) / (right - left); + Result[1][1] = (valType(2) * zNear) / (top - bottom); + Result[2][2] = - (zFar + zNear) / (zFar - zNear); + Result[2][3] = - valType(1); + Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear); + return Result; + } + + template + inline detail::tvec3 project( + detail::tvec3 const & obj, + detail::tmat4x4 const & model, + detail::tmat4x4 const & proj, + detail::tvec4 const & viewport) + { + detail::tvec4 tmp = detail::tvec4(obj, valTypeT(1)); + tmp = model * tmp; + tmp = proj * tmp; + + tmp /= tmp.w; + tmp = tmp * valTypeT(0.5) + valTypeT(0.5); + tmp[0] = tmp[0] * valTypeT(viewport[2]) + valTypeT(viewport[0]); + tmp[1] = tmp[1] * valTypeT(viewport[3]) + valTypeT(viewport[1]); + + return detail::tvec3(tmp); + } + + template + inline detail::tvec3 unProject( + detail::tvec3 const & win, + detail::tmat4x4 const & model, + detail::tmat4x4 const & proj, + detail::tvec4 const & viewport) + { + detail::tmat4x4 inverse = glm::inverse(proj * model); + + detail::tvec4 tmp = detail::tvec4(win, valTypeT(1)); + tmp.x = (tmp.x - valTypeT(viewport[0])) / valTypeT(viewport[2]); + tmp.y = (tmp.y - valTypeT(viewport[1])) / valTypeT(viewport[3]); + tmp = tmp * valTypeT(2) - valTypeT(1); + + detail::tvec4 obj = inverse * tmp; + obj /= obj.w; + + return detail::tvec3(obj); + } + +}//namespace matrix_projection +}//namespace gtc +}//namespace glm diff --git a/glm/gtc/matrix_transform.hpp b/glm/gtc/matrix_transform.hpp new file mode 100644 index 0000000..3faa5e1 --- /dev/null +++ b/glm/gtc/matrix_transform.hpp @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/matrix_transform.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_matrix_operation +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc_matrix_transform +#define glm_gtc_matrix_transform + +// Dependency: +#include "../glm.hpp" +#include "../gtc/matrix_operation.hpp" + +namespace glm +{ + namespace test{ + bool main_gtc_matrix_transform(); + }//namespace test + + namespace gtc{ + //! GLM_GTC_matrix_transform extension: Add transformation matrices + namespace matrix_transform + { + using namespace gtc::matrix_operation; + + //! Builds a translation 4 * 4 matrix created from a vector of 3 components. + //! From GLM_GTC_matrix_transform extension. + template + detail::tmat4x4 translate( + detail::tmat4x4 const & m, + detail::tvec3 const & v); + + //! Builds a rotation 4 * 4 matrix created from an axis vector and an angle expressed in degrees. + //! From GLM_GTC_matrix_transform extension. + template + detail::tmat4x4 rotate( + detail::tmat4x4 const & m, + valType const & angle, + detail::tvec3 const & v); + + //! Builds a scale 4 * 4 matrix created from 3 scalars. + //! From GLM_GTC_matrix_transform extension. + template + detail::tmat4x4 scale( + detail::tmat4x4 const & m, + detail::tvec3 const & v); + + }//namespace matrix_transform + }//namespace gtc +}//namespace glm + +#define GLM_GTC_matrix_transform namespace gtc::matrix_transform +#ifndef GLM_GTC_GLOBAL +namespace glm {using GLM_GTC_matrix_transform;} +#endif//GLM_GTC_GLOBAL + +#include "matrix_transform.inl" + +#endif//glm_gtc_matrix_transform diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl new file mode 100644 index 0000000..389ac79 --- /dev/null +++ b/glm/gtc/matrix_transform.inl @@ -0,0 +1,136 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/matrix_transform.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtc{ +namespace matrix_transform +{ + template + inline detail::tmat4x4 translate( + detail::tmat4x4 const & m, + detail::tvec3 const & v) + { + detail::tmat4x4 Result(m); + Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; + return Result; + } + + template + inline detail::tmat4x4 rotate( + detail::tmat4x4 const & m, + valType const & angle, + detail::tvec3 const & v) + { + valType a = radians(angle); + valType c = cos(a); + valType s = sin(a); + + detail::tvec3 axis = normalize(v); + + detail::tvec3 temp = (valType(1) - c) * axis; + + detail::tmat4x4 Rotate(detail::tmat4x4::null); + Rotate[0][0] = c + temp[0] * axis[0]; + Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2]; + Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1]; + + Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2]; + Rotate[1][1] = c + temp[1] * axis[1]; + Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0]; + + Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1]; + Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0]; + Rotate[2][2] = c + temp[2] * axis[2]; + + detail::tmat4x4 Result(detail::tmat4x4::null); + Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2]; + Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2]; + Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2]; + Result[3] = m[3]; + return Result; + } + + template + inline detail::tmat4x4 scale( + detail::tmat4x4 const & m, + detail::tvec3 const & v) + { + detail::tmat4x4 Result(detail::tmat4x4::null); + Result[0] = m[0] * v[0]; + Result[1] = m[1] * v[1]; + Result[2] = m[2] * v[2]; + Result[3] = m[3]; + return Result; + } + + template + inline detail::tmat4x4 translate_slow( + detail::tmat4x4 const & m, + detail::tvec3 const & v) + { + detail::tmat4x4 Result(valType(1)); + Result[3] = detail::tvec4(v, valType(1)); + return m * Result; + + //detail::tmat4x4 Result(m); + Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3]; + //Result[3][0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0]; + //Result[3][1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1]; + //Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2]; + //Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3]; + //return Result; + } + + template + inline detail::tmat4x4 rotate_slow( + detail::tmat4x4 const & m, + valType const & angle, + detail::tvec3 const & v) + { + valType a = radians(angle); + valType c = cos(a); + valType s = sin(a); + detail::tmat4x4 Result; + + detail::tvec3 axis = normalize(v); + + Result[0][0] = c + (1 - c) * axis.x * axis.x; + Result[0][1] = (1 - c) * axis.x * axis.y + s * axis.z; + Result[0][2] = (1 - c) * axis.x * axis.z - s * axis.y; + Result[0][3] = 0; + + Result[1][0] = (1 - c) * axis.y * axis.x - s * axis.z; + Result[1][1] = c + (1 - c) * axis.y * axis.y; + Result[1][2] = (1 - c) * axis.y * axis.z + s * axis.x; + Result[1][3] = 0; + + Result[2][0] = (1 - c) * axis.z * axis.x + s * axis.y; + Result[2][1] = (1 - c) * axis.z * axis.y - s * axis.x; + Result[2][2] = c + (1 - c) * axis.z * axis.z; + Result[2][3] = 0; + + Result[3] = detail::tvec4(0, 0, 0, 1); + return m * Result; + } + + template + inline detail::tmat4x4 scale_slow( + detail::tmat4x4 const & m, + detail::tvec3 const & v) + { + detail::tmat4x4 Result(valType(1)); + Result[0][0] = v.x; + Result[1][1] = v.y; + Result[2][2] = v.z; + return m * Result; + } + +}//namespace matrix_transform +}//namespace gtc +}//namespace glm diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp new file mode 100644 index 0000000..bcf8877 --- /dev/null +++ b/glm/gtc/quaternion.hpp @@ -0,0 +1,198 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-21 +// Updated : 2009-06-04 +// Licence : This source is under MIT License +// File : glm/gtc/quaternion.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// +// ToDo: +// - Study constructors with angles and axis +// - Study constructors with vec3 that are the imaginary component of quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc_quaternion +#define glm_gtc_quaternion + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + bool main_gtc_quaternion(); + }//namespace test + + namespace detail + { + //! \brief Template for quaternion. + //! From GLM_GTC_quaternion extension. + template + class tquat + { + public: + valType x, y, z, w; + + // Constructors + tquat(); + explicit tquat(valType const & s, tvec3 const & v); + explicit tquat(valType const & w, valType const & x, valType const & y, valType const & z); + + // Convertions + //explicit tquat(valType const & pitch, valType const & yaw, valType const & roll); + //! pitch, yaw, roll + explicit tquat(tvec3 const & eulerAngles); + explicit tquat(tmat3x3 const & m); + explicit tquat(tmat4x4 const & m); + + // Accesses + valType& operator[](int i); + valType operator[](int i) const; + + // Operators + tquat& operator*=(valType const & s); + tquat& operator/=(valType const & s); + }; + + template + detail::tquat operator- ( + detail::tquat const & q); + + template + detail::tvec3 operator* ( + detail::tquat const & q, + detail::tvec3 const & v); + + template + detail::tvec3 operator* ( + detail::tvec3 const & v, + detail::tquat const & q); + + template + detail::tvec4 operator* ( + detail::tquat const & q, + detail::tvec4 const & v); + + template + detail::tvec4 operator* ( + detail::tvec4 const & v, + detail::tquat const & q); + + template + detail::tquat operator* ( + detail::tquat const & q, + valType const & s); + + template + detail::tquat operator* ( + valType const & s, + detail::tquat const & q); + + template + detail::tquat operator/ ( + detail::tquat const & q, + valType const & s); + + } //namespace detail + + namespace gtc{ + //! GLM_GTC_quaternion extension: Quaternion types and functions + namespace quaternion + { + //! Returns the length of the quaternion x. + //! From GLM_GTC_quaternion extension. + template + valType length( + detail::tquat const & q); + + //! Returns the normalized quaternion of from x. + //! From GLM_GTC_quaternion extension. + template + detail::tquat normalize( + detail::tquat const & q); + + //! Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ... + //! From GLM_GTC_quaternion extension. + template + valType dot( + detail::tquat const & q1, + detail::tquat const & q2); + + //! Returns the cross product of q1 and q2. + //! From GLM_GTC_quaternion extension. + template + detail::tquat cross( + detail::tquat const & q1, + detail::tquat const & q2); + + //! Returns a LERP interpolated quaternion of x and y according a. + //! From GLM_GTC_quaternion extension. + template + detail::tquat mix( + detail::tquat const & x, + detail::tquat const & y, + valType const & a); + + //! Returns the q conjugate. + //! From GLM_GTC_quaternion extension. + template + detail::tquat conjugate( + detail::tquat const & q); + + //! Returns the q inverse. + //! From GLM_GTC_quaternion extension. + template + detail::tquat inverse( + detail::tquat const & q); + + //! Rotates a quaternion from an vector of 3 components axis and an angle expressed in degrees. + //! From GLM_GTC_quaternion extension. + template + detail::tquat rotate( + detail::tquat const & q, + valType const & angle, + detail::tvec3 const & v); + + //! Converts a quaternion to a 3 * 3 matrix. + //! From GLM_GTC_quaternion extension. + template + detail::tmat3x3 mat3_cast( + detail::tquat const & x); + + //! Converts a quaternion to a 4 * 4 matrix. + //! From GLM_GTC_quaternion extension. + template + detail::tmat4x4 mat4_cast( + detail::tquat const & x); + + //! Converts a 3 * 3 matrix to a quaternion. + //! From GLM_GTC_quaternion extension. + template + detail::tquat quat_cast( + detail::tmat3x3 const & x); + + //! Converts a 4 * 4 matrix to a quaternion. + //! From GLM_GTC_quaternion extension. + template + detail::tquat quat_cast( + detail::tmat4x4 const & x); + + //! Quaternion of floating-point numbers. + //! From GLM_GTC_quaternion extension. + typedef detail::tquat quat; + + }//namespace quaternion + }//namespace gtc +} //namespace glm + +#define GLM_GTC_quaternion namespace gtc::quaternion +#ifndef GLM_GTC_GLOBAL +namespace glm {using GLM_GTC_quaternion;} +#endif//GLM_GTC_GLOBAL + +#include "quaternion.inl" + +#endif//glm_gtc_quaternion diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl new file mode 100644 index 0000000..5b05a07 --- /dev/null +++ b/glm/gtc/quaternion.inl @@ -0,0 +1,481 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-21 +// Updated : 2009-06-04 +// Licence : This source is under MIT License +// File : glm/gtc/quaternion.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm{ +namespace detail{ + + template + inline tquat::tquat() : + x(0), + y(0), + z(0), + w(1) + {} + + template + inline tquat::tquat + ( + valType const & s, + tvec3 const & v + ) : + x(v.x), + y(v.y), + z(v.z), + w(s) + {} + + template + inline tquat::tquat + ( + valType const & w, + valType const & x, + valType const & y, + valType const & z + ) : + x(x), + y(y), + z(z), + w(w) + {} + + ////////////////////////////////////////////////////////////// + // tquat conversions + + //template + //inline tquat::tquat + //( + // valType const & pitch, + // valType const & yaw, + // valType const & roll + //) + //{ + // tvec3 eulerAngle(pitch * valType(0.5), yaw * valType(0.5), roll * valType(0.5)); + // tvec3 c = glm::cos(eulerAngle * valType(0.5)); + // tvec3 s = glm::sin(eulerAngle * valType(0.5)); + // + // this->w = c.x * c.y * c.z + s.x * s.y * s.z; + // this->x = s.x * c.y * c.z - c.x * s.y * s.z; + // this->y = c.x * s.y * c.z + s.x * c.y * s.z; + // this->z = c.x * c.y * s.z - s.x * s.y * c.z; + //} + + template + inline tquat::tquat + ( + tvec3 const & eulerAngle + ) + { + tvec3 c = glm::cos(eulerAngle * valType(0.5)); + tvec3 s = glm::sin(eulerAngle * valType(0.5)); + + this->w = c.x * c.y * c.z + s.x * s.y * s.z; + this->x = s.x * c.y * c.z - c.x * s.y * s.z; + this->y = c.x * s.y * c.z + s.x * c.y * s.z; + this->z = c.x * c.y * s.z - s.x * s.y * c.z; + } + + template + inline tquat::tquat + ( + tmat3x3 const & m + ) + { + *this = toQuat(m); + } + + template + inline tquat::tquat + ( + tmat4x4 const & m + ) + { + *this = toQuat(m); + } + + ////////////////////////////////////////////////////////////// + // tquat accesses + + template + inline valType& tquat::operator [] (int i) + { + return (&x)[i]; + } + + template + inline valType tquat::operator [] (int i) const + { + return (&x)[i]; + } + + ////////////////////////////////////////////////////////////// + // tquat operators + + template + inline tquat& tquat::operator *= + ( + valType const & s + ) + { + this->w *= s; + this->x *= s; + this->y *= s; + this->z *= s; + return *this; + } + + template + inline tquat& tquat::operator /= + ( + valType const & s + ) + { + this->w /= s; + this->x /= s; + this->y /= s; + this->z /= s; + return *this; + } + + ////////////////////////////////////////////////////////////// + // tquat external operators + + template + inline detail::tquat operator- + ( + detail::tquat const & q + ) + { + return detail::tquat(-q.w, -q.x, -q.y, -q.z); + } + + // Transformation + template + inline detail::tvec3 operator* + ( + detail::tquat const & q, + detail::tvec3 const & v + ) + { + detail::tvec3 uv, uuv; + detail::tvec3 QuatVector(q.x, q.y, q.z); + uv = glm::cross(QuatVector, v); + uuv = glm::cross(QuatVector, uv); + uv *= (valType(2) * q.w); + uuv *= valType(2); + + return v + uv + uuv; + } + + template + inline detail::tvec3 operator* + ( + detail::tvec3 const & v, + detail::tquat const & q + ) + { + return gtc::quaternion::inverse(q) * v; + } + + template + inline detail::tvec4 operator* + ( + detail::tquat const & q, + detail::tvec4 const & v + ) + { + return detail::tvec4(q * detail::tvec3(v), v.w); + } + + template + inline detail::tvec4 operator* + ( + detail::tvec4 const & v, + detail::tquat const & q + ) + { + return gtc::quaternion::inverse(q) * v; + } + + template + inline detail::tquat operator* + ( + detail::tquat const & q, + valType const & s + ) + { + return detail::tquat( + q.w * s, q.x * s, q.y * s, q.z * s); + } + + template + inline detail::tquat operator* + ( + valType const & s, + detail::tquat const & q + ) + { + return q * s; + } + + template + inline detail::tquat operator/ + ( + detail::tquat const & q, + valType const & s + ) + { + return detail::tquat( + q.w / s, q.x / s, q.y / s, q.z / s); + } + +}//namespace detail + +namespace gtc{ +namespace quaternion{ + + //////////////////////////////////////////////////////// + template + inline valType length + ( + detail::tquat const & q + ) + { + return static_cast(glm::sqrt(dot(q, q))); + } + + template + inline detail::tquat normalize + ( + detail::tquat const & q + ) + { + T len = static_cast(length(q)); + if(len <= 0) // Problem + return detail::tquat(1, 0, 0, 0); + T oneOverLen = 1 / len; + return detail::tquat(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen); + } + + template + inline valType dot + ( + detail::tquat const & q1, + detail::tquat const & q2 + ) + { + return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w; + } + + template + inline detail::tquat cross + ( + detail::tquat const & q1, + detail::tquat const & q2 + ) + { + return detail::tquat( + q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z, + q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, + q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, + q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x); + } + + template + inline detail::tquat mix + ( + detail::tquat const & x, + detail::tquat const & y, + T const & a + ) + { + if(a <= T(0)) return x; + if(a >= T(1)) return y; + + float fCos = dot(x, y); + detail::tquat y2(y); //BUG!!! tquat y2; + if(fCos < T(0)) + { + y2 = -y; + fCos = -fCos; + } + + //if(fCos > 1.0f) // problem + float k0, k1; + if(fCos > T(0.9999)) + { + k0 = T(1) - a; + k1 = T(0) + a; //BUG!!! 1.0f + a; + } + else + { + T fSin = sqrt(T(1) - fCos * fCos); + T fAngle = atan(fSin, fCos); + T fOneOverSin = T(1) / fSin; + k0 = sin((T(1) - a) * fAngle) * fOneOverSin; + k1 = sin((T(0) + a) * fAngle) * fOneOverSin; + } + + return detail::tquat( + k0 * x.w + k1 * y2.w, + k0 * x.x + k1 * y2.x, + k0 * x.y + k1 * y2.y, + k0 * x.z + k1 * y2.z); + } + + template + inline detail::tquat conjugate + ( + detail::tquat const & q + ) + { + return detail::tquat(q.w, -q.x, -q.y, -q.z); + } + + template + inline detail::tquat inverse + ( + detail::tquat const & q + ) + { + return gtc::quaternion::conjugate(q) / gtc::quaternion::length(q); + } + + template + inline detail::tquat rotate + ( + detail::tquat const & q, + valType const & angle, + detail::tvec3 const & v + ) + { + detail::tvec3 Tmp = v; + + // Axis of rotation must be normalised + valType len = glm::core::function::geometric::length(Tmp); + if(abs(len - valType(1)) > valType(0.001)) + { + valType oneOverLen = valType(1) / len; + Tmp.x *= oneOverLen; + Tmp.y *= oneOverLen; + Tmp.z *= oneOverLen; + } + + valType AngleRad = radians(angle); + valType fSin = sin(AngleRad * valType(0.5)); + + return gtc::quaternion::cross(q, detail::tquat(cos(AngleRad * valType(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin)); + } + + template + inline detail::tmat3x3 mat3_cast + ( + detail::tquat const & q + ) + { + detail::tmat3x3 Result(valType(1)); + Result[0][0] = 1 - 2 * q.y * q.y - 2 * q.z * q.z; + Result[0][1] = 2 * q.x * q.y + 2 * q.w * q.z; + Result[0][2] = 2 * q.x * q.z - 2 * q.w * q.y; + + Result[1][0] = 2 * q.x * q.y - 2 * q.w * q.z; + Result[1][1] = 1 - 2 * q.x * q.x - 2 * q.z * q.z; + Result[1][2] = 2 * q.y * q.z + 2 * q.w * q.x; + + Result[2][0] = 2 * q.x * q.z + 2 * q.w * q.y; + Result[2][1] = 2 * q.y * q.z - 2 * q.w * q.x; + Result[2][2] = 1 - 2 * q.x * q.x - 2 * q.y * q.y; + return Result; + } + + template + inline detail::tmat4x4 mat4_cast + ( + detail::tquat const & q + ) + { + return detail::tmat4x4(mat3_cast(q)); + } + + template + inline detail::tquat quat_cast + ( + detail::tmat3x3 const & m + ) + { + T fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2]; + T fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2]; + T fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1]; + T fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2]; + + int biggestIndex = 0; + T fourBiggestSquaredMinus1 = fourWSquaredMinus1; + if(fourXSquaredMinus1 > fourBiggestSquaredMinus1) + { + fourBiggestSquaredMinus1 = fourXSquaredMinus1; + biggestIndex = 1; + } + if(fourYSquaredMinus1 > fourBiggestSquaredMinus1) + { + fourBiggestSquaredMinus1 = fourYSquaredMinus1; + biggestIndex = 2; + } + if(fourZSquaredMinus1 > fourBiggestSquaredMinus1) + { + fourBiggestSquaredMinus1 = fourZSquaredMinus1; + biggestIndex = 3; + } + + T biggestVal = sqrt(fourBiggestSquaredMinus1 + T(1)) * T(0.5); + T mult = T(0.25) / biggestVal; + + detail::tquat Result; + switch(biggestIndex) + { + case 0: + Result.w = biggestVal; + Result.x = (m[1][2] - m[2][1]) * mult; + Result.y = (m[2][0] - m[0][2]) * mult; + Result.z = (m[0][1] - m[1][0]) * mult; + break; + case 1: + Result.w = (m[1][2] - m[2][1]) * mult; + Result.x = biggestVal; + Result.y = (m[0][1] + m[1][0]) * mult; + Result.z = (m[2][1] + m[1][2]) * mult; + break; + case 2: + Result.w = (m[2][0] - m[0][2]) * mult; + Result.x = (m[0][1] + m[1][0]) * mult; + Result.y = biggestVal; + Result.z = (m[1][2] + m[2][1]) * mult; + break; + case 3: + Result.w = (m[0][1] - m[1][0]) * mult; + Result.x = (m[2][0] + m[0][2]) * mult; + Result.y = (m[1][2] + m[2][1]) * mult; + Result.z = biggestVal; + break; + } + return Result; + } + + template + inline detail::tquat quat_cast + ( + detail::tmat4x4 const & m4 + ) + { + return quat_cast(detail::tmat3x3(m4)); + } + +}//namespace quaternion +}//namespace gtc +}//namespace glm diff --git a/glm/gtc/type_precision.hpp b/glm/gtc/type_precision.hpp new file mode 100644 index 0000000..8cde665 --- /dev/null +++ b/glm/gtc/type_precision.hpp @@ -0,0 +1,204 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-06-04 +// Updated : 2009-06-04 +// Licence : This source is under MIT License +// File : glm/gtc/type_precision.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_half +// - GLM_GTC_double +// - GLM_GTC_quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtc_type_precision +#define glm_gtc_type_precision + +// Dependency: +#include "../glm.hpp" +#include "../gtc/half_float.hpp" +#include "../gtc/double_float.hpp" +#include "../gtc/quaternion.hpp" + +namespace glm +{ + namespace test{ + bool main_gtc_type_precision(); + }//namespace test + + namespace gtc{ + //! GLM_GTC_type_precision extension: Defined types with specific size. + namespace type_precision + { + /////////////////////////// + // Dependences + + using namespace gtc::half_float; + using namespace gtc::double_float; + using namespace gtc::quaternion; + + /////////////////////////// + // Signed int vector types + + typedef detail::int8 int8; //!< \brief 8bit signed integer. (from GLM_GTC_type_precision extension) + typedef detail::int16 int16; //!< \brief 16bit signed integer. (from GLM_GTC_type_precision extension) + typedef detail::int32 int32; //!< \brief 32bit signed integer. (from GLM_GTC_type_precision extension) + typedef detail::int64 int64; //!< \brief 64bit signed integer. (from GLM_GTC_type_precision extension) + + typedef int8 i8; //!< \brief 8bit signed integer. (from GLM_GTC_type_precision extension) + typedef int16 i16; //!< \brief 16bit signed integer. (from GLM_GTC_type_precision extension) + typedef int32 i32; //!< \brief 32bit signed integer. (from GLM_GTC_type_precision extension) + typedef int64 i64; //!< \brief 64bit signed integer. (from GLM_GTC_type_precision extension) + + //typedef i8 i8vec1; //!< \brief 8bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 i8vec2; //!< \brief 8bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 i8vec3; //!< \brief 8bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 i8vec4; //!< \brief 8bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef i16 i16vec1; //!< \brief 16bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 i16vec2; //!< \brief 16bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 i16vec3; //!< \brief 16bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 i16vec4; //!< \brief 16bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef i32 i32vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 i32vec2; //!< \brief 32bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 i32vec3; //!< \brief 32bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 i32vec4; //!< \brief 32bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef i64 i64vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 i64vec2; //!< \brief 64bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 i64vec3; //!< \brief 64bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 i64vec4; //!< \brief 64bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) + + ///////////////////////////// + // Unsigned int vector types + + typedef detail::uint8 uint8; //!< \brief 8bit unsigned integer. (from GLM_GTC_type_precision extension) + typedef detail::uint16 uint16; //!< \brief 16bit unsigned integer. (from GLM_GTC_type_precision extension) + typedef detail::uint32 uint32; //!< \brief 32bit unsigned integer. (from GLM_GTC_type_precision extension) + typedef detail::uint64 uint64; //!< \brief 64bit unsigned integer. (from GLM_GTC_type_precision extension) + + typedef uint8 u8; //!< \brief 8bit unsigned integer. (from GLM_GTC_type_precision extension) + typedef uint16 u16; //!< \brief 16bit unsigned integer. (from GLM_GTC_type_precision extension) + typedef uint32 u32; //!< \brief 32bit unsigned integer. (from GLM_GTC_type_precision extension) + typedef uint64 u64; //!< \brief 64bit unsigned integer. (from GLM_GTC_type_precision extension) + + //typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 u8vec2; //!< \brief 8bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 u8vec3; //!< \brief 8bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 u8vec4; //!< \brief 8bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 u16vec2; //!< \brief 16bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 u16vec3; //!< \brief 16bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 u16vec4; //!< \brief 16bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 u32vec2; //!< \brief 32bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 u32vec3; //!< \brief 32bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 u32vec4; //!< \brief 32bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 u64vec2; //!< \brief 64bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 u64vec3; //!< \brief 64bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 u64vec4; //!< \brief 64bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) + + ////////////////////// + // Float vector types + + typedef detail::float16 float16; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::float32 float32; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::float64 float64; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension) + + typedef float16 f16; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef float32 f32; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef float64 f64; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension) + + //typedef f16 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 f16vec2; //!< \brief Half-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 f16vec3; //!< \brief Half-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 f16vec4; //!< \brief Half-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 f32vec2; //!< \brief Single-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 f32vec3; //!< \brief Single-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 f32vec4; //!< \brief Single-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension) + + //typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec2 f64vec2; //!< \brief Double-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec3 f64vec3; //!< \brief Double-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension) + typedef detail::tvec4 f64vec4; //!< \brief Double-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension) + + ////////////////////// + // Float matrix types + + //typedef f16 f16mat1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x2 f16mat2; //!< \brief Half-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x3 f16mat3; //!< \brief Half-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x4 f16mat4; //!< \brief Half-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension) + + //typedef f16 f16mat1x1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x2 f16mat2x2; //!< \brief Half-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x3 f16mat2x3; //!< \brief Half-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x4 f16mat2x4; //!< \brief Half-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x2 f16mat3x2; //!< \brief Half-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x3 f16mat3x3; //!< \brief Half-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x4 f16mat3x4; //!< \brief Half-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x2 f16mat4x2; //!< \brief Half-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x3 f16mat4x3; //!< \brief Half-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x4 f16mat4x4; //!< \brief Half-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension) + + //typedef f32 f32mat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x2 f32mat2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x3 f32mat3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x4 f32mat4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension) + + //typedef f32 f32mat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x2 f32mat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x3 f32mat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x4 f32mat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x2 f32mat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x3 f32mat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x4 f32mat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x2 f32mat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x3 f32mat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x4 f32mat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension) + + //typedef f64 f64mat1; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x2 f64mat2; //!< \brief Double-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x3 f64mat3; //!< \brief Double-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x4 f64mat4; //!< \brief Double-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension) + + //typedef f64 f64mat1x1; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x2 f64mat2x2; //!< \brief Double-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x3 f64mat2x3; //!< \brief Double-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat2x4 f64mat2x4; //!< \brief Double-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x2 f64mat3x2; //!< \brief Double-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x3 f64mat3x3; //!< \brief Double-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat3x4 f64mat3x4; //!< \brief Double-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x2 f64mat4x2; //!< \brief Double-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x3 f64mat4x3; //!< \brief Double-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension) + typedef detail::tmat4x4 f64mat4x4; //!< \brief Double-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension) + + ////////////////////////// + // Float quaternion types + + typedef detail::tquat f16quat; //!< \brief Half-precision floating-point quaternion. (from GLM_GTC_type_precision extension) + typedef detail::tquat f32quat; //!< \brief Single-precision floating-point quaternion. (from GLM_GTC_type_precision extension) + typedef detail::tquat f64quat; //!< \brief Double-precision floating-point quaternion. (from GLM_GTC_type_precision extension) + + }//namespace type_precision + }//namespace gtc +}//namespace glm + +#define GLM_GTC_type_precision namespace gtc::type_precision + +#ifndef GLM_GTC_GLOBAL +namespace glm {using GLM_GTC_type_precision;} +#endif//GLM_GTC_GLOBAL + +#include "type_precision.inl" + +#endif//glm_gtc_type_precision diff --git a/glm/gtc/type_precision.inl b/glm/gtc/type_precision.inl new file mode 100644 index 0000000..0437c95 --- /dev/null +++ b/glm/gtc/type_precision.inl @@ -0,0 +1,13 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-06-14 +// Updated : 2009-06-14 +// Licence : This source is under MIT License +// File : glm/gtc/type_precision.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + +} diff --git a/glm/gtx.hpp b/glm/gtx.hpp new file mode 100644 index 0000000..1f4f637 --- /dev/null +++ b/glm/gtx.hpp @@ -0,0 +1,83 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-04-03 +// Updated : 2009-05-01 +// Licence : This source is under MIT License +// File : glm/gtx.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Note: +// GTX extensions are experimental extensions +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx +#define glm_gtx + +#define GLM_GTX_GLOBAL 1 + +//#include "./gtx/array_range.hpp" +#include "./gtx/associated_min_max.hpp" +#include "./gtx/bit.hpp" +#include "./gtx/closest_point.hpp" +#include "./gtx/color_cast.hpp" +#include "./gtx/color_space.hpp" +#include "./gtx/color_space_YCoCg.hpp" +#include "./gtx/compatibility.hpp" +#include "./gtx/component_wise.hpp" +//#include "./gtx/complex.hpp" +#include "./gtx/determinant.hpp" +#include "./gtx/double_float.hpp" +#include "./gtx/epsilon.hpp" +#include "./gtx/euler_angles.hpp" +#include "./gtx/extend.hpp" +#include "./gtx/extented_min_max.hpp" +#include "./gtx/fast_exponential.hpp" +#include "./gtx/fast_square_root.hpp" +#include "./gtx/fast_trigonometry.hpp" +//#include "./gtx/flexible_mix.hpp" +//#include "./gtx/gpu_shader4.hpp" +#include "./gtx/gradient_paint.hpp" +#include "./gtx/half_float.hpp" +#include "./gtx/handed_coordinate_space.hpp" +#include "./gtx/inertia.hpp" +#include "./gtx/integer.hpp" +#include "./gtx/intersect.hpp" +#include "./gtx/inverse.hpp" +#include "./gtx/inverse_transpose.hpp" +//#include "./gtx/mat_mn.hpp" +#include "./gtx/log_base.hpp" +#include "./gtx/matrix_access.hpp" +#include "./gtx/matrix_cross_product.hpp" +#include "./gtx/matrix_major_storage.hpp" +#include "./gtx/matrix_projection.hpp" +#include "./gtx/matrix_query.hpp" +#include "./gtx/matrix_selection.hpp" +//#include "./gtx/matx.hpp" +#include "./gtx/mixed_product.hpp" +#include "./gtx/norm.hpp" +#include "./gtx/normal.hpp" +#include "./gtx/normalize_dot.hpp" +#include "./gtx/number_precision.hpp" +#include "./gtx/optimum_pow.hpp" +#include "./gtx/orthonormalize.hpp" +#include "./gtx/perpendicular.hpp" +#include "./gtx/polar_coordinates.hpp" +#include "./gtx/projection.hpp" +#include "./gtx/quaternion.hpp" +#include "./gtx/random.hpp" +#include "./gtx/raw_data.hpp" +#include "./gtx/reciprocal.hpp" +#include "./gtx/rotate_vector.hpp" +#include "./gtx/spline.hpp" +#include "./gtx/std_based_type.hpp" +#include "./gtx/string_cast.hpp" +#include "./gtx/transform.hpp" +#include "./gtx/transform2.hpp" +#include "./gtx/unsigned_int.hpp" +#include "./gtx/vector_access.hpp" +#include "./gtx/vector_angle.hpp" +#include "./gtx/vector_query.hpp" +//#include "./gtx/vecx.hpp" +#include "./gtx/verbose_operator.hpp" + +#endif//glm_gtx diff --git a/glm/gtx/associated_min_max.hpp b/glm/gtx/associated_min_max.hpp new file mode 100644 index 0000000..82a7957 --- /dev/null +++ b/glm/gtx/associated_min_max.hpp @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-03-10 +// Updated : 2008-03-15 +// Licence : This source is under MIT License +// File : gtx_associated_min_max.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_extented_min_max +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_associated_min_max +#define glm_gtx_associated_min_max + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_associated_min_max(); + }//namespace test + + namespace gtx + { + //! GLM_GTX_associated_min_max extension: Min and max functions that return associated values not the compared onces. + namespace associated_min_max + { + //! \brief Min comparison between 2 variables + template + genTypeU associatedMin( + const genTypeT& x, const genTypeU& a, + const genTypeT& y, const genTypeU& b); + + //! \brief Min comparison between 3 variables + template + genTypeU associatedMin( + const genTypeT& x, const genTypeU& a, + const genTypeT& y, const genTypeU& b, + const genTypeT& z, const genTypeU& c); + + //! \brief Min comparison between 4 variables + template + genTypeU associatedMin( + const genTypeT& x, const genTypeU& a, + const genTypeT& y, const genTypeU& b, + const genTypeT& z, const genTypeU& c, + const genTypeT& w, const genTypeU& d); + + //! \brief Max comparison between 2 variables + template + genTypeU associatedMax( + const genTypeT& x, const genTypeU& a, + const genTypeT& y, const genTypeU& b); + + //! \brief Max comparison between 3 variables + template + genTypeU associatedMax( + const genTypeT& x, const genTypeU& a, + const genTypeT& y, const genTypeU& b, + const genTypeT& z, const genTypeU& c); + + //! \brief Max comparison between 4 variables + template + genTypeU associatedMax( + const genTypeT& x, const genTypeU& a, + const genTypeT& y, const genTypeU& b, + const genTypeT& z, const genTypeU& c, + const genTypeT& w, const genTypeU& d); + + }//namespace associated_min_max + + bool test(); + }//namespace gtx +}//namespace glm + +#define GLM_GTX_associated_min_max namespace gtx::associated_min_max +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_associated_min_max;} +#endif//GLM_GTC_GLOBAL + +#include "associated_min_max.inl" + +#endif//glm_gtx_associated_min_max diff --git a/glm/gtx/associated_min_max.inl b/glm/gtx/associated_min_max.inl new file mode 100644 index 0000000..05d4100 --- /dev/null +++ b/glm/gtx/associated_min_max.inl @@ -0,0 +1,916 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-03-10 +// Updated : 2008-03-15 +// Licence : This source is under MIT License +// File : gtx_associated_min_max.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace associated_min_max{ + + // Min comparison between 2 variables + template + inline U associatedMin(T x, U a, T y, U b) + { + return x < y ? a : b; + } + + template + inline detail::tvec2 associatedMin + ( + const detail::tvec2& x, const detail::tvec2& a, + const detail::tvec2& y, const detail::tvec2& b + ) + { + detail::tvec2 Result; + //Result.x = x[0] < y[0] ? a[0] : b[0]; + //Result.y = x[1] < y[1] ? a[1] : b[1]; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x[i] < y[i] ? a[i] : b[i]; + return Result; + } + + template + inline detail::tvec3 associatedMin + ( + const detail::tvec3& x, const detail::tvec3& a, + const detail::tvec3& y, const detail::tvec3& b + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x[i] < y[i] ? a[i] : b[i]; + return Result; + } + + template + inline detail::tvec4 associatedMin + ( + const detail::tvec4& x, const detail::tvec4& a, + const detail::tvec4& y, const detail::tvec4& b + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x[i] < y[i] ? a[i] : b[i]; + return Result; + } + + template + inline detail::tvec2 associatedMin + ( + T x, const detail::tvec2& a, + T y, const detail::tvec2& b + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x < y ? a[i] : b[i]; + return Result; + } + + template + inline detail::tvec3 associatedMin + ( + T x, const detail::tvec3& a, + T y, const detail::tvec3& b + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x < y ? a[i] : b[i]; + return Result; + } + + template + inline detail::tvec4 associatedMin + ( + T x, const detail::tvec4& a, + T y, const detail::tvec4& b + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x < y ? a[i] : b[i]; + return Result; + } + + template + inline detail::tvec2 associatedMin + ( + const detail::tvec2& x, U a, + const detail::tvec2& y, U b + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x[i] < y[i] ? a : b; + return Result; + } + + template + inline detail::tvec3 associatedMin + ( + const detail::tvec3& x, U a, + const detail::tvec3& y, U b + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x[i] < y[i] ? a : b; + return Result; + } + + template + inline detail::tvec4 associatedMin + ( + const detail::tvec4& x, U a, + const detail::tvec4& y, U b + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x[i] < y[i] ? a : b; + return Result; + } + + // Min comparison between 3 variables + template + inline U associatedMin + ( + T x, U a, + T y, U b, + T z, U c + ) + { + U Result = x < y ? (x < z ? a : c) : (y < z ? b : c); + return Result; + } + + template + inline detail::tvec2 associatedMin + ( + const detail::tvec2& x, const detail::tvec2& a, + const detail::tvec2& y, const detail::tvec2& b, + const detail::tvec2& z, const detail::tvec2& c + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]); + return Result; + } + + template + inline detail::tvec3 associatedMin + ( + const detail::tvec3& x, const detail::tvec3& a, + const detail::tvec3& y, const detail::tvec3& b, + const detail::tvec3& z, const detail::tvec3& c + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]); + return Result; + } + + template + inline detail::tvec4 associatedMin + ( + const detail::tvec4& x, const detail::tvec4& a, + const detail::tvec4& y, const detail::tvec4& b, + const detail::tvec4& z, const detail::tvec4& c + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]); + return Result; + } + + // Min comparison between 4 variables + template + inline U associatedMin + ( + T x, U a, + T y, U b, + T z, U c, + T w, U d + ) + { + T Test1 = min(x, y); + T Test2 = min(z, w);; + U Result1 = x < y ? a : b; + U Result2 = z < w ? c : d; + U Result = Test1 < Test2 ? Result1 : Result2; + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec2 associatedMin + ( + const detail::tvec2& x, const detail::tvec2& a, + const detail::tvec2& y, const detail::tvec2& b, + const detail::tvec2& z, const detail::tvec2& c, + const detail::tvec2& w, const detail::tvec2& d + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + { + T Test1 = min(x[i], y[i]); + T Test2 = min(z[i], w[i]); + U Result1 = x[i] < y[i] ? a[i] : b[i]; + U Result2 = z[i] < w[i] ? c[i] : d[i]; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec3 associatedMin + ( + const detail::tvec3& x, const detail::tvec3& a, + const detail::tvec3& y, const detail::tvec3& b, + const detail::tvec3& z, const detail::tvec3& c, + const detail::tvec3& w, const detail::tvec3& d + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + { + T Test1 = min(x[i], y[i]); + T Test2 = min(z[i], w[i]); + U Result1 = x[i] < y[i] ? a[i] : b[i]; + U Result2 = z[i] < w[i] ? c[i] : d[i]; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec4 associatedMin + ( + const detail::tvec4& x, const detail::tvec4& a, + const detail::tvec4& y, const detail::tvec4& b, + const detail::tvec4& z, const detail::tvec4& c, + const detail::tvec4& w, const detail::tvec4& d + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + { + T Test1 = min(x[i], y[i]); + T Test2 = min(z[i], w[i]); + U Result1 = x[i] < y[i] ? a[i] : b[i]; + U Result2 = z[i] < w[i] ? c[i] : d[i]; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec2 associatedMin + ( + T x, const detail::tvec2& a, + T y, const detail::tvec2& b, + T z, const detail::tvec2& c, + T w, const detail::tvec2& d + ) + { + T Test1 = min(x, y); + T Test2 = min(z, w); + + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + { + U Result1 = x < y ? a[i] : b[i]; + U Result2 = z < w ? c[i] : d[i]; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec3 associatedMin + ( + T x, const detail::tvec3& a, + T y, const detail::tvec3& b, + T z, const detail::tvec3& c, + T w, const detail::tvec3& d + ) + { + T Test1 = min(x, y); + T Test2 = min(z, w); + + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + { + U Result1 = x < y ? a[i] : b[i]; + U Result2 = z < w ? c[i] : d[i]; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec4 associatedMin + ( + T x, const detail::tvec4& a, + T y, const detail::tvec4& b, + T z, const detail::tvec4& c, + T w, const detail::tvec4& d + ) + { + T Test1 = min(x, y); + T Test2 = min(z, w); + + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + { + U Result1 = x < y ? a[i] : b[i]; + U Result2 = z < w ? c[i] : d[i]; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec2 associatedMin + ( + const detail::tvec2& x, U a, + const detail::tvec2& y, U b, + const detail::tvec2& z, U c, + const detail::tvec2& w, U d + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + { + T Test1 = min(x[i], y[i]); + T Test2 = min(z[i], w[i]);; + U Result1 = x[i] < y[i] ? a : b; + U Result2 = z[i] < w[i] ? c : d; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec3 associatedMin + ( + const detail::tvec3& x, U a, + const detail::tvec3& y, U b, + const detail::tvec3& z, U c, + const detail::tvec3& w, U d + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + { + T Test1 = min(x[i], y[i]); + T Test2 = min(z[i], w[i]);; + U Result1 = x[i] < y[i] ? a : b; + U Result2 = z[i] < w[i] ? c : d; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Min comparison between 4 variables + template + inline detail::tvec4 associatedMin + ( + const detail::tvec4& x, U a, + const detail::tvec4& y, U b, + const detail::tvec4& z, U c, + const detail::tvec4& w, U d + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + { + T Test1 = min(x[i], y[i]); + T Test2 = min(z[i], w[i]);; + U Result1 = x[i] < y[i] ? a : b; + U Result2 = z[i] < w[i] ? c : d; + Result[i] = Test1 < Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 2 variables + template + inline U associatedMax(T x, U a, T y, U b) + { + return x > y ? a : b; + } + + // Max comparison between 2 variables + template + inline detail::tvec2 associatedMax + ( + const detail::tvec2& x, const detail::tvec2& a, + const detail::tvec2& y, const detail::tvec2& b + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x[i] > y[i] ? a[i] : b[i]; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec3 associatedMax + ( + const detail::tvec3& x, const detail::tvec3& a, + const detail::tvec3& y, const detail::tvec3& b + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x[i] > y[i] ? a[i] : b[i]; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec4 associatedMax + ( + const detail::tvec4& x, const detail::tvec4& a, + const detail::tvec4& y, const detail::tvec4& b + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x[i] > y[i] ? a[i] : b[i]; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec2 associatedMax + ( + T x, const detail::tvec2& a, + T y, const detail::tvec2& b + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x > y ? a[i] : b[i]; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec3 associatedMax + ( + T x, const detail::tvec3& a, + T y, const detail::tvec3& b + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x > y ? a[i] : b[i]; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec4 associatedMax + ( + T x, const detail::tvec4& a, + T y, const detail::tvec4& b + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x > y ? a[i] : b[i]; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec2 associatedMax + ( + const detail::tvec2& x, U a, + const detail::tvec2& y, U b + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x[i] > y[i] ? a : b; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec3 associatedMax + ( + const detail::tvec3& x, U a, + const detail::tvec3& y, U b + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x[i] > y[i] ? a : b; + return Result; + } + + // Max comparison between 2 variables + template + inline detail::tvec4 associatedMax + ( + const detail::tvec4& x, U a, + const detail::tvec4& y, U b + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x[i] > y[i] ? a : b; + return Result; + } + + // Max comparison between 3 variables + template + inline U associatedMax + ( + T x, U a, + T y, U b, + T z, U c + ) + { + U Result = x > y ? (x > z ? a : c) : (y > z ? b : c); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec2 associatedMax + ( + const detail::tvec2& x, const detail::tvec2& a, + const detail::tvec2& y, const detail::tvec2& b, + const detail::tvec2& z, const detail::tvec2& c + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec3 associatedMax + ( + const detail::tvec3& x, const detail::tvec3& a, + const detail::tvec3& y, const detail::tvec3& b, + const detail::tvec3& z, const detail::tvec3& c + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec4 associatedMax + ( + const detail::tvec4& x, const detail::tvec4& a, + const detail::tvec4& y, const detail::tvec4& b, + const detail::tvec4& z, const detail::tvec4& c + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec2 associatedMax + ( + T x, const detail::tvec2& a, + T y, const detail::tvec2& b, + T z, const detail::tvec2& c + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec3 associatedMax + ( + T x, const detail::tvec3& a, + T y, const detail::tvec3& b, + T z, const detail::tvec3& c + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec4 associatedMax + ( + T x, const detail::tvec4& a, + T y, const detail::tvec4& b, + T z, const detail::tvec4& c + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec2 associatedMax + ( + const detail::tvec2& x, U a, + const detail::tvec2& y, U b, + const detail::tvec2& z, U c + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec3 associatedMax + ( + const detail::tvec3& x, U a, + const detail::tvec3& y, U b, + const detail::tvec3& z, U c + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c); + return Result; + } + + // Max comparison between 3 variables + template + inline detail::tvec4 associatedMax + ( + const detail::tvec4& x, U a, + const detail::tvec4& y, U b, + const detail::tvec4& z, U c + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c); + return Result; + } + + // Max comparison between 4 variables + template + inline U associatedMax + ( + T x, U a, + T y, U b, + T z, U c, + T w, U d + ) + { + T Test1 = max(x, y); + T Test2 = max(z, w);; + U Result1 = x > y ? a : b; + U Result2 = z > w ? c : d; + U Result = Test1 > Test2 ? Result1 : Result2; + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec2 associatedMax + ( + const detail::tvec2& x, const detail::tvec2& a, + const detail::tvec2& y, const detail::tvec2& b, + const detail::tvec2& z, const detail::tvec2& c, + const detail::tvec2& w, const detail::tvec2& d + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + { + T Test1 = max(x[i], y[i]); + T Test2 = max(z[i], w[i]); + U Result1 = x[i] > y[i] ? a[i] : b[i]; + U Result2 = z[i] > w[i] ? c[i] : d[i]; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec3 associatedMax + ( + const detail::tvec3& x, const detail::tvec3& a, + const detail::tvec3& y, const detail::tvec3& b, + const detail::tvec3& z, const detail::tvec3& c, + const detail::tvec3& w, const detail::tvec3& d + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + { + T Test1 = max(x[i], y[i]); + T Test2 = max(z[i], w[i]); + U Result1 = x[i] > y[i] ? a[i] : b[i]; + U Result2 = z[i] > w[i] ? c[i] : d[i]; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec4 associatedMax + ( + const detail::tvec4& x, const detail::tvec4& a, + const detail::tvec4& y, const detail::tvec4& b, + const detail::tvec4& z, const detail::tvec4& c, + const detail::tvec4& w, const detail::tvec4& d + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + { + T Test1 = max(x[i], y[i]); + T Test2 = max(z[i], w[i]); + U Result1 = x[i] > y[i] ? a[i] : b[i]; + U Result2 = z[i] > w[i] ? c[i] : d[i]; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec2 associatedMax + ( + T x, const detail::tvec2& a, + T y, const detail::tvec2& b, + T z, const detail::tvec2& c, + T w, const detail::tvec2& d + ) + { + T Test1 = max(x, y); + T Test2 = max(z, w); + + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + { + U Result1 = x > y ? a[i] : b[i]; + U Result2 = z > w ? c[i] : d[i]; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec3 associatedMax + ( + T x, const detail::tvec3& a, + T y, const detail::tvec3& b, + T z, const detail::tvec3& c, + T w, const detail::tvec3& d + ) + { + T Test1 = max(x, y); + T Test2 = max(z, w); + + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + { + U Result1 = x > y ? a[i] : b[i]; + U Result2 = z > w ? c[i] : d[i]; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec4 associatedMax + ( + T x, const detail::tvec4& a, + T y, const detail::tvec4& b, + T z, const detail::tvec4& c, + T w, const detail::tvec4& d + ) + { + T Test1 = max(x, y); + T Test2 = max(z, w); + + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + { + U Result1 = x > y ? a[i] : b[i]; + U Result2 = z > w ? c[i] : d[i]; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec2 associatedMax + ( + const detail::tvec2& x, U a, + const detail::tvec2& y, U b, + const detail::tvec2& z, U c, + const detail::tvec2& w, U d + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + { + T Test1 = max(x[i], y[i]); + T Test2 = max(z[i], w[i]);; + U Result1 = x[i] > y[i] ? a : b; + U Result2 = z[i] > w[i] ? c : d; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec3 associatedMax + ( + const detail::tvec3& x, U a, + const detail::tvec3& y, U b, + const detail::tvec3& z, U c, + const detail::tvec3& w, U d + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + { + T Test1 = max(x[i], y[i]); + T Test2 = max(z[i], w[i]);; + U Result1 = x[i] > y[i] ? a : b; + U Result2 = z[i] > w[i] ? c : d; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + + // Max comparison between 4 variables + template + inline detail::tvec4 associatedMax + ( + const detail::tvec4& x, U a, + const detail::tvec4& y, U b, + const detail::tvec4& z, U c, + const detail::tvec4& w, U d + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + { + T Test1 = max(x[i], y[i]); + T Test2 = max(z[i], w[i]);; + U Result1 = x[i] > y[i] ? a : b; + U Result2 = z[i] > w[i] ? c : d; + Result[i] = Test1 > Test2 ? Result1 : Result2; + } + return Result; + } + +}//namespace associated_min_max +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/bit.hpp b/glm/gtx/bit.hpp new file mode 100644 index 0000000..71a31d0 --- /dev/null +++ b/glm/gtx/bit.hpp @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-14 +// Updated : 2008-11-14 +// Licence : This source is under MIT License +// File : glm/gtx/bit.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_half_float +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_bit +#define glm_gtx_bit + +// Dependency: +#include "../glm.hpp" +#include "../gtc/half_float.hpp" +#include + +namespace glm +{ + namespace test{ + void main_gtx_bit(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_bit extension: Allow to perform bit operations on integer values + namespace bit + { + using namespace gtc::half_float; + + //! Build a mask of 'count' bits + //! From GLM_GTX_bit extension. + template + genIType mask(genIType const & count); + + //! Component wise extraction of bit fields. + //! genType and genIType could be a scalar or a vector. + //! From GLM_GTX_bit extension. + template + genIType extractField(genType const & v, genIType const & first, genIType const & count); + + //! Find the lowest bit set to 1 in a integer variable. + //! From GLM_GTX_bit extension. + template + int lowestBit(genType const & value); + + //! Find the highest bit set to 1 in a integer variable. + //! From GLM_GTX_bit extension. + template + int highestBit(genType const & value); + + //! Find the highest bit set to 1 in a integer variable and return its value. + //! From GLM_GTX_bit extension. + template + genType highestBitValue(genType const & value); + + //! Return true if the value is a power of two number. + //! From GLM_GTX_bit extension. + template + bool isPowerOfTwo(genType const & value); + + //! Return the power of two number which value is just higher the input value. + //! From GLM_GTX_bit extension. + template + genType powerOfTwoAbove(genType const & value); + + //! Return the power of two number which value is just lower the input value. + //! From GLM_GTX_bit extension. + template + genType powerOfTwoBelow(genType const & value); + + //! Return the power of two number which value is the closet to the input value. + //! From GLM_GTX_bit extension. + template + genType powerOfTwoNearest(genType const & value); + + //! Revert all bits of any integer based type. + //! From GLM_GTX_bit extension. + template + genType bitRevert(genType const & value); + + //! Rotate all bits to the right. + //! From GLM_GTX_bit extension. + template + genType bitRotateRight(genType const & In, std::size_t Shift); + + //! Rotate all bits to the left. + //! From GLM_GTX_bit extension. + template + genType bitRotateLeft(genType const & In, std::size_t Shift); + + }//namespace bit + }//namespace gtx +}//namespace glm + +#define GLM_GTX_bit namespace gtx::bit +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_bit;} +#endif//GLM_GTX_GLOBAL + +#include "bit.inl" + +#endif//glm_gtx_bit diff --git a/glm/gtx/bit.inl b/glm/gtx/bit.inl new file mode 100644 index 0000000..ffadf16 --- /dev/null +++ b/glm/gtx/bit.inl @@ -0,0 +1,733 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-14 +// Updated : 2008-11-14 +// Licence : This source is under MIT License +// File : glm/gtx/bit.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "../core/_detail.hpp" + +namespace glm{ +namespace gtx{ +namespace bit{ + +template +inline genIType mask +( + genIType const & count +) +{ + return ((genIType(1) << (count)) - genIType(1)); +} + +template +inline detail::tvec2 mask +( + detail::tvec2 const & count +) +{ + return detail::tvec2( + mask(count[0]), + mask(count[1])); +} + +template +inline detail::tvec3 mask +( + detail::tvec3 const & count +) +{ + return detail::tvec3( + mask(count[0]), + mask(count[1]), + mask(count[2])); +} + +template +inline detail::tvec4 mask +( + detail::tvec4 const & count +) +{ + return detail::tvec4( + mask(count[0]), + mask(count[1]), + mask(count[2]), + mask(count[3])); +} + +// extractField +template +inline genIType extractField +( + gtc::half_float::half const & value, + genIType const & first, + genIType const & count +) +{ + assert(first + count < sizeof(gtc::half_float::half)); + return (value._data() << first) >> ((sizeof(gtc::half_float::half) << 3) - count); +} + +template +inline genIType extractField +( + float const & value, + genIType const & first, + genIType const & count +) +{ + assert(first + count < sizeof(float)); + return (detail::uif32(value).i << first) >> ((sizeof(float) << 3) - count); +} + +template +inline genIType extractField +( + double const & value, + genIType const & first, + genIType const & count +) +{ + assert(first + count < sizeof(double)); + return (detail::uif64(value).i << first) >> ((sizeof(double) << 3) - count); +} + +template +inline genIType extractField +( + genType const & value, + genIType const & first, + genIType const & count +) +{ + assert(first + count < sizeof(genType)); + return (value << first) >> ((sizeof(genType) << 3) - count); +} + +template +inline detail::tvec2 extractField +( + detail::tvec2 const & value, + valIType const & first, + valIType const & count +) +{ + return detail::tvec2( + extractField(value[0], first, count), + extractField(value[1], first, count)); +} + +template +inline detail::tvec3 extractField +( + detail::tvec3 const & value, + valIType const & first, + valIType const & count +) +{ + return detail::tvec3( + extractField(value[0], first, count), + extractField(value[1], first, count), + extractField(value[2], first, count)); +} + +template +inline detail::tvec4 extractField +( + detail::tvec4 const & value, + valIType const & first, + valIType const & count +) +{ + return detail::tvec4( + extractField(value[0], first, count), + extractField(value[1], first, count), + extractField(value[2], first, count), + extractField(value[3], first, count)); +} + +template +inline detail::tvec2 extractField +( + detail::tvec2 const & value, + detail::tvec2 const & first, + detail::tvec2 const & count +) +{ + return detail::tvec2( + extractField(value[0], first[0], count[0]), + extractField(value[1], first[1], count[1])); +} + +template +inline detail::tvec3 extractField +( + detail::tvec3 const & value, + detail::tvec3 const & first, + detail::tvec3 const & count +) +{ + return detail::tvec3( + extractField(value[0], first[0], count[0]), + extractField(value[1], first[1], count[1]), + extractField(value[2], first[2], count[2])); +} + +template +inline detail::tvec4 extractField +( + detail::tvec4 const & value, + detail::tvec4 const & first, + detail::tvec4 const & count +) +{ + return detail::tvec4( + extractField(value[0], first[0], count[0]), + extractField(value[1], first[1], count[1]), + extractField(value[2], first[2], count[2]), + extractField(value[3], first[3], count[3])); +} + +template +inline detail::tvec2 extractField +( + valType const & value, + detail::tvec2 const & first, + detail::tvec2 const & count +) +{ + return detail::tvec2( + extractField(value, first[0], count[0]), + extractField(value, first[1], count[1])); +} + +template +inline detail::tvec3 extractField +( + valType const & value, + detail::tvec3 const & first, + detail::tvec3 const & count +) +{ + return detail::tvec3( + extractField(value, first[0], count[0]), + extractField(value, first[1], count[1]), + extractField(value, first[2], count[2])); +} + +template +inline detail::tvec4 extractField +( + valType const & value, + detail::tvec4 const & first, + detail::tvec4 const & count +) +{ + return detail::tvec4( + extractField(value, first[0], count[0]), + extractField(value, first[1], count[1]), + extractField(value, first[2], count[2]), + extractField(value, first[3], count[3])); +} + +// lowestBit +template +inline int lowestBit +( + genType const & Value +) +{ + genType Bit; + for(Bit = genType(0); !(Value & (1 << Bit)); ++Bit); + return Bit; +} + +template +inline detail::tvec2 lowestBit +( + detail::tvec2 const & value +) +{ + return detail::tvec2( + lowestBit(value[0]), + lowestBit(value[1])); +} + +template +inline detail::tvec3 lowestBit +( + detail::tvec3 const & value +) +{ + return detail::tvec3( + lowestBit(value[0]), + lowestBit(value[1]), + lowestBit(value[2])); +} + +template +inline detail::tvec4 lowestBit +( + detail::tvec4 const & value +) +{ + return detail::tvec4( + lowestBit(value[0]), + lowestBit(value[1]), + lowestBit(value[2]), + lowestBit(value[3])); +} + +// highestBit +template +inline int highestBit +( + genType const & value +) +{ + genType bit = genType(-1); + for(genType tmp = value; tmp; tmp >>= 1, ++bit); + return bit; +} + +//template <> +//inline int highestBit +//( +// int value +//) +//{ +// int bit = -1; +// for(int tmp = value; tmp; tmp >>= 1, ++bit); +// return bit; +//} + +template +inline detail::tvec2 highestBit +( + detail::tvec2 const & value +) +{ + return detail::tvec2( + highestBit(value[0]), + highestBit(value[1])); +} + +template +inline detail::tvec3 highestBit +( + detail::tvec3 const & value +) +{ + return detail::tvec3( + highestBit(value[0]), + highestBit(value[1]), + highestBit(value[2])); +} + +template +inline detail::tvec4 highestBit +( + detail::tvec4 const & value +) +{ + return detail::tvec4( + highestBit(value[0]), + highestBit(value[1]), + highestBit(value[2]), + highestBit(value[3])); +} + +// highestBitValue +template +inline genType highestBitValue +( + genType const & value +) +{ + genType tmp = value; + genType result = genType(0); + while(tmp) + { + result = (tmp & (~tmp + 1)); // grab lowest bit + tmp &= ~result; // clear lowest bit + } + return result; +} + +template +inline detail::tvec2 highestBitValue +( + detail::tvec2 const & value +) +{ + return detail::tvec2( + highestBitValue(value[0]), + highestBitValue(value[1])); +} + +template +inline detail::tvec3 highestBitValue +( + detail::tvec3 const & value +) +{ + return detail::tvec3( + highestBitValue(value[0]), + highestBitValue(value[1]), + highestBitValue(value[2])); +} + +template +inline detail::tvec4 highestBitValue +( + detail::tvec4 const & value +) +{ + return detail::tvec4( + highestBitValue(value[0]), + highestBitValue(value[1]), + highestBitValue(value[2]), + highestBitValue(value[3])); +} + +// isPowerOfTwo +template +inline bool isPowerOfTwo(genType const & Value) +{ + //detail::If::is_signed>::apply(abs, Value); + //return !(Value & (Value - 1)); + + // For old complier? + genType Result = Value; + if(std::numeric_limits::is_signed) + Result = abs(Result); + return !(Result & (Result - 1)); +} + +template +inline detail::tvec2 isPowerOfTwo +( + detail::tvec2 const & value +) +{ + return detail::tvec2( + isPowerOfTwo(value[0]), + isPowerOfTwo(value[1])); +} + +template +inline detail::tvec3 isPowerOfTwo +( + detail::tvec3 const & value +) +{ + return detail::tvec3( + isPowerOfTwo(value[0]), + isPowerOfTwo(value[1]), + isPowerOfTwo(value[2])); +} + +template +inline detail::tvec4 isPowerOfTwo +( + detail::tvec4 const & value +) +{ + return detail::tvec4( + isPowerOfTwo(value[0]), + isPowerOfTwo(value[1]), + isPowerOfTwo(value[2]), + isPowerOfTwo(value[3])); +} + +// powerOfTwoAbove +template +inline genType powerOfTwoAbove(genType const & value) +{ + return isPowerOfTwo(value) ? value : highestBitValue(value) << 1; +} + +template +inline detail::tvec2 powerOfTwoAbove +( + detail::tvec2 const & value +) +{ + return detail::tvec2( + powerOfTwoAbove(value[0]), + powerOfTwoAbove(value[1])); +} + +template +inline detail::tvec3 powerOfTwoAbove +( + detail::tvec3 const & value +) +{ + return detail::tvec3( + powerOfTwoAbove(value[0]), + powerOfTwoAbove(value[1]), + powerOfTwoAbove(value[2])); +} + +template +inline detail::tvec4 powerOfTwoAbove +( + detail::tvec4 const & value +) +{ + return detail::tvec4( + powerOfTwoAbove(value[0]), + powerOfTwoAbove(value[1]), + powerOfTwoAbove(value[2]), + powerOfTwoAbove(value[3])); +} + +// powerOfTwoBelow +template +inline genType powerOfTwoBelow +( + genType const & value +) +{ + return isPowerOfTwo(value) ? value : highestBitValue(value); +} + +template +inline detail::tvec2 powerOfTwoBelow +( + detail::tvec2 const & value +) +{ + return detail::tvec2( + powerOfTwoBelow(value[0]), + powerOfTwoBelow(value[1])); +} + +template +inline detail::tvec3 powerOfTwoBelow +( + detail::tvec3 const & value +) +{ + return detail::tvec3( + powerOfTwoBelow(value[0]), + powerOfTwoBelow(value[1]), + powerOfTwoBelow(value[2])); +} + +template +inline detail::tvec4 powerOfTwoBelow +( + detail::tvec4 const & value +) +{ + return detail::tvec4( + powerOfTwoBelow(value[0]), + powerOfTwoBelow(value[1]), + powerOfTwoBelow(value[2]), + powerOfTwoBelow(value[3])); +} + +// powerOfTwoNearest +template +inline genType powerOfTwoNearest +( + genType const & value +) +{ + if(isPowerOfTwo(value)) + return value; + + genType prev = highestBitValue(value); + genType next = prev << 1; + return (next - value) < (value - prev) ? next : prev; +} + +template +inline detail::tvec2 powerOfTwoNearest +( + detail::tvec2 const & value +) +{ + return detail::tvec2( + powerOfTwoNearest(value[0]), + powerOfTwoNearest(value[1])); +} + +template +inline detail::tvec3 powerOfTwoNearest +( + detail::tvec3 const & value +) +{ + return detail::tvec3( + powerOfTwoNearest(value[0]), + powerOfTwoNearest(value[1]), + powerOfTwoNearest(value[2])); +} + +template +inline detail::tvec4 powerOfTwoNearest +( + detail::tvec4 const & value +) +{ + return detail::tvec4( + powerOfTwoNearest(value[0]), + powerOfTwoNearest(value[1]), + powerOfTwoNearest(value[2]), + powerOfTwoNearest(value[3])); +} + +template +inline genType bitRevert(genType const & In) +{ + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + + genType Out = 0; + std::size_t BitSize = sizeof(genType) * 8; + for(std::size_t i = 0; i < BitSize; ++i) + if(In & (1 << i)) + Out |= 1 << (BitSize - 1 - i); + return Out; +} + +template +inline detail::tvec2 bitRevert +( + detail::tvec2 const & Value +) +{ + return detail::tvec2( + bitRevert(Value[0]), + bitRevert(Value[1])); +} + +template +inline detail::tvec3 bitRevert +( + detail::tvec3 const & Value +) +{ + return detail::tvec3( + bitRevert(Value[0]), + bitRevert(Value[1]), + bitRevert(Value[2])); +} + +template +inline detail::tvec4 bitRevert +( + detail::tvec4 const & Value +) +{ + return detail::tvec4( + bitRevert(Value[0]), + bitRevert(Value[1]), + bitRevert(Value[2]), + bitRevert(Value[3])); +} + +template +inline genType bitRotateRight(genType const & In, std::size_t Shift) +{ + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + + std::size_t BitSize = sizeof(genType) * 8; + return (In << Shift) | (In >> (BitSize - Shift)); +} + +template +inline detail::tvec2 bitRotateRight +( + detail::tvec2 const & Value, + std::size_t Shift +) +{ + return detail::tvec2( + bitRotateRight(Value[0], Shift), + bitRotateRight(Value[1], Shift)); +} + +template +inline detail::tvec3 bitRotateRight +( + detail::tvec3 const & Value, + std::size_t Shift +) +{ + return detail::tvec3( + bitRotateRight(Value[0], Shift), + bitRotateRight(Value[1], Shift), + bitRotateRight(Value[2], Shift)); +} + +template +inline detail::tvec4 bitRotateRight +( + detail::tvec4 const & Value, + std::size_t Shift +) +{ + return detail::tvec4( + bitRotateRight(Value[0], Shift), + bitRotateRight(Value[1], Shift), + bitRotateRight(Value[2], Shift), + bitRotateRight(Value[3], Shift)); +} + +template +inline genType bitRotateLeft(genType const & In, std::size_t Shift) +{ + GLM_STATIC_ASSERT(std::numeric_limits::is_integer); + + std::size_t BitSize = sizeof(genType) * 8; + return (In >> Shift) | (In << (BitSize - Shift)); +} + +template +inline detail::tvec2 bitRotateLeft +( + detail::tvec2 const & Value, + std::size_t Shift +) +{ + return detail::tvec2( + bitRotateLeft(Value[0], Shift), + bitRotateLeft(Value[1], Shift)); +} + +template +inline detail::tvec3 bitRotateLeft +( + detail::tvec3 const & Value, + std::size_t Shift +) +{ + return detail::tvec3( + bitRotateLeft(Value[0], Shift), + bitRotateLeft(Value[1], Shift), + bitRotateLeft(Value[2], Shift)); +} + +template +inline detail::tvec4 bitRotateLeft +( + detail::tvec4 const & Value, + std::size_t Shift +) +{ + return detail::tvec4( + bitRotateLeft(Value[0], Shift), + bitRotateLeft(Value[1], Shift), + bitRotateLeft(Value[2], Shift), + bitRotateLeft(Value[3], Shift)); +} + +}//namespace bit +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/closest_point.hpp b/glm/gtx/closest_point.hpp new file mode 100644 index 0000000..776c2f4 --- /dev/null +++ b/glm/gtx/closest_point.hpp @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-30 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/gtx/closest_point.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_closest_point +#define glm_gtx_closest_point + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_closest_point(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_closest_point extension: Find the point on a straight line which is the closet of a point. + namespace closest_point{ + + //! Find the point on a straight line which is the closet of a point. + //! From GLM_GTX_closest_point extension. + template + detail::tvec3 closestPointOnLine( + detail::tvec3 const & point, + detail::tvec3 const & a, + detail::tvec3 const & b); + + }//namespace closest_point + }//namespace gtx +}//namespace glm + +#define GLM_GTX_closest_point namespace gtx::closest_point +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_closest_point;} +#endif//GLM_GTC_GLOBAL + +#include "closest_point.inl" + +#endif//glm_gtx_closest_point diff --git a/glm/gtx/closest_point.inl b/glm/gtx/closest_point.inl new file mode 100644 index 0000000..f58046b --- /dev/null +++ b/glm/gtx/closest_point.inl @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-30 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/gtx/closest_point.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_closest_point +#define glm_gtx_closest_point + +namespace glm{ +namespace gtx{ +namespace closest_point{ + +template +inline detail::tvec3 closestPointOnLine +( + detail::tvec3 const & point, + detail::tvec3 const & a, + detail::tvec3 const & b +) +{ + valType LineLength = distance(a, b); + detail::tvec3 Vector = point - a; + detail::tvec3 LineDirection = (b - a) / LineLength; + + // Project Vector to LineDirection to get the distance of point from a + valType Distance = dot(Vector, LineDirection); + + if(Distance <= valType(0)) return a; + if(Distance >= LineLength) return b; + return a + LineDirection * Distance; +} + +}//namespace closest_point +}//namespace gtx +}//namespace glm + +#endif//glm_gtx_closest_point diff --git a/glm/gtx/color_cast.hpp b/glm/gtx/color_cast.hpp new file mode 100644 index 0000000..e211a66 --- /dev/null +++ b/glm/gtx/color_cast.hpp @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-06-21 +// Updated : 2009-06-05 +// Licence : This source is under MIT License +// File : glm/gtx/color_cast.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_number_precision +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_color_cast +#define glm_gtx_color_cast + +// Dependency: +#include "../glm.hpp" +#include "../gtx/number_precision.hpp" + +namespace glm +{ + namespace test{ + void main_ext_gtx_color_cast(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_color_cast extension: Conversion between two color types + namespace color_cast + { + using namespace gtx::number_precision; + + //! Conversion of a floating value into a 8bit unsigned int value. + //! From GLM_GTX_color_cast extension. + template gtc::type_precision::uint8 u8channel_cast(valType a); + + //! Conversion of a floating value into a 16bit unsigned int value. + //! From GLM_GTX_color_cast extension. + template gtc::type_precision::uint16 u16channel_cast(valType a); + + template gtc::type_precision::uint32 u32_rgbx_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint32 u32_xrgb_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint32 u32_bgrx_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint32 u32_xbgr_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::uint32 u32_rgba_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint32 u32_argb_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint32 u32_bgra_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint32 u32_abgr_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 32bit unsigned int value. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::uint64 u64_rgbx_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint64 u64_xrgb_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint64 u64_bgrx_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint64 u64_xbgr_cast(const detail::tvec3& c); //!< \brief Conversion of a 3 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::uint64 u64_rgba_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint64 u64_argb_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint64 u64_bgra_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + template gtc::type_precision::uint64 u64_abgr_cast(const detail::tvec4& c); //!< \brief Conversion of a 4 components color into an 64bit unsigned int value. (From GLM_GTX_color_cast extension) + + template gtx::number_precision::f16vec1 f16_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::f16vec3 f16_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f16vec3 f16_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f16vec3 f16_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f16vec3 f16_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::f16vec4 f16_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f16vec4 f16_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f16vec4 f16_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f16vec4 f16_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + + template gtx::number_precision::f32vec1 f32_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::f32vec3 f32_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f32vec3 f32_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f32vec3 f32_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f32vec3 f32_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::f32vec4 f32_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f32vec4 f32_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f32vec4 f32_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f32vec4 f32_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + + template gtx::number_precision::f64vec1 f64_channel_cast(T a); //!< \brief Conversion of a u8 or u16 value to a single channel floating value. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::f64vec3 f64_rgbx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f64vec3 f64_xrgb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f64vec3 f64_bgrx_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f64vec3 f64_xbgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 3 components floating color. (From GLM_GTX_color_cast extension) + + template gtc::type_precision::f64vec4 f64_rgba_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f64vec4 f64_argb_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f64vec4 f64_bgra_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + template gtc::type_precision::f64vec4 f64_abgr_cast(T c); //!< \brief Conversion of a u32 or u64 color into 4 components floating color. (From GLM_GTX_color_cast extension) + }//namespace color_space + }//namespace gtx +}//namespace glm + +#define GLM_GTX_color_cast namespace gtx::color_cast +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_color_cast;} +#endif//GLM_GTC_GLOBAL + +#include "color_cast.inl" + +#endif//glm_gtx_color_cast diff --git a/glm/gtx/color_cast.inl b/glm/gtx/color_cast.inl new file mode 100644 index 0000000..58f50fe --- /dev/null +++ b/glm/gtx/color_cast.inl @@ -0,0 +1,739 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-06-21 +// Updated : 2007-08-03 +// Licence : This source is under MIT License +// File : glm/gtx/color_cast.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +//! GLM_GTX_color_cast extension: Conversion between two color types +namespace color_cast{ + +template +inline gtc::type_precision::uint8 u8channel_cast(T a) +{ + return static_cast(a * T(255)); +} + +template +inline gtc::type_precision::uint16 u16channel_cast(T a) +{ + return static_cast(a * T(65535)); +} + +template +inline gtc::type_precision::uint32 u32_rgbx_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(255)) << 0; + result += static_cast(c.y * detail::tvec3::value_type(255)) << 8; + result += static_cast(c.z * detail::tvec3::value_type(255)) << 16; + return result; +} + +template +inline gtc::type_precision::uint32 u32_xrgb_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(255)) << 8; + result += static_cast(c.y * detail::tvec3::value_type(255)) << 16; + result += static_cast(c.z * detail::tvec3::value_type(255)) << 24; + return result; +} + +template +inline gtc::type_precision::uint32 u32_bgrx_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(255)) << 16; + result += static_cast(c.y * detail::tvec3::value_type(255)) << 8; + result += static_cast(c.z * detail::tvec3::value_type(255)) << 0; + return result; +} + +template +inline gtc::type_precision::uint32 u32_xbgr_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(255)) << 24; + result += static_cast(c.y * detail::tvec3::value_type(255)) << 16; + result += static_cast(c.z * detail::tvec3::value_type(255)) << 8; + result += static_cast(c.w * detail::tvec3::value_type(255)) << 0; + return result; +} + +template +inline gtc::type_precision::uint32 u32_rgba_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(255)) << 0; + result += static_cast(c.y * detail::tvec4::value_type(255)) << 8; + result += static_cast(c.z * detail::tvec4::value_type(255)) << 16; + result += static_cast(c.w * detail::tvec4::value_type(255)) << 24; + return result; +} + +template +inline gtc::type_precision::uint32 u32_argb_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(255)) << 8; + result += static_cast(c.y * detail::tvec4::value_type(255)) << 16; + result += static_cast(c.z * detail::tvec4::value_type(255)) << 24; + result += static_cast(c.w * detail::tvec4::value_type(255)) << 0; + return result; +} + +template +inline gtc::type_precision::uint32 u32_bgra_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(255)) << 16; + result += static_cast(c.y * detail::tvec4::value_type(255)) << 8; + result += static_cast(c.z * detail::tvec4::value_type(255)) << 0; + result += static_cast(c.w * detail::tvec4::value_type(255)) << 24; + return result; +} + +template +inline gtc::type_precision::uint32 u32_abgr_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint32 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(255)) << 24; + result += static_cast(c.y * detail::tvec4::value_type(255)) << 16; + result += static_cast(c.z * detail::tvec4::value_type(255)) << 8; + result += static_cast(c.w * detail::tvec4::value_type(255)) << 0; + return result; +} + +template +inline gtc::type_precision::uint64 u64_rgbx_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(65535)) << 0; + result += static_cast(c.y * detail::tvec3::value_type(65535)) << 16; + result += static_cast(c.z * detail::tvec3::value_type(65535)) << 32; + return result; +} + +template +inline gtc::type_precision::uint64 u32_xrgb_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(65535)) << 16; + result += static_cast(c.y * detail::tvec3::value_type(65535)) << 32; + result += static_cast(c.z * detail::tvec3::value_type(65535)) << 48; + return result; +} + +template +inline gtc::type_precision::uint64 u32_bgrx_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(65535)) << 32; + result += static_cast(c.y * detail::tvec3::value_type(65535)) << 16; + result += static_cast(c.z * detail::tvec3::value_type(65535)) << 0; + return result; +} + +template +inline gtc::type_precision::uint64 u32_xbgr_cast(const detail::tvec3& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec3::value_type(65535)) << 48; + result += static_cast(c.y * detail::tvec3::value_type(65535)) << 32; + result += static_cast(c.z * detail::tvec3::value_type(65535)) << 16; + result += static_cast(c.w * detail::tvec3::value_type(65535)) << 0; + return result; +} + +template +inline gtc::type_precision::uint64 u64_rgba_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(65535)) << 0; + result += static_cast(c.y * detail::tvec4::value_type(65535)) << 16; + result += static_cast(c.z * detail::tvec4::value_type(65535)) << 32; + result += static_cast(c.w * detail::tvec4::value_type(65535)) << 48; + return result; +} + +template +inline gtc::type_precision::uint64 u64_argb_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(65535)) << 16; + result += static_cast(c.y * detail::tvec4::value_type(65535)) << 32; + result += static_cast(c.z * detail::tvec4::value_type(65535)) << 48; + result += static_cast(c.w * detail::tvec4::value_type(65535)) << 0; + return result; +} + +template +inline gtc::type_precision::uint64 u64_bgra_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(65535)) << 32; + result += static_cast(c.y * detail::tvec4::value_type(65535)) << 16; + result += static_cast(c.z * detail::tvec4::value_type(65535)) << 0; + result += static_cast(c.w * detail::tvec4::value_type(65535)) << 48; + return result; +} + +template +inline gtc::type_precision::uint64 u64_abgr_cast(const detail::tvec4& c) +{ + gtc::type_precision::uint64 result = 0; + result += static_cast(c.x * detail::tvec4::value_type(65535)) << 48; + result += static_cast(c.y * detail::tvec4::value_type(65535)) << 32; + result += static_cast(c.z * detail::tvec4::value_type(65535)) << 16; + result += static_cast(c.w * detail::tvec4::value_type(65535)) << 0; + return result; +} + +template <> +inline f16vec1 f16_channel_cast(gtc::type_precision::uint32 color) +{ + return gtc::type_precision::f16(static_cast(color >> 0) / static_cast(255)); +} + +template <> +inline gtc::type_precision::f16vec3 f16_rgbx_cast(gtc::type_precision::uint32 color) +{ + gtc::type_precision::f16vec3 result; + result.x = gtc::type_precision::f16(static_cast(color >> 0) / static_cast(255)); + result.y = gtc::type_precision::f16(static_cast(color >> 8) / static_cast(255)); + result.z = gtc::type_precision::f16(static_cast(color >> 16) / static_cast(255)); + return result; +} + +template <> +inline gtc::type_precision::f16vec3 f16_xrgb_cast(gtc::type_precision::uint32 color) +{ + gtc::type_precision::f16vec3 result; + result.x = gtc::type_precision::f16(static_cast(color >> 8) / static_cast(255)); + result.y = gtc::type_precision::f16(static_cast(color >> 16) / static_cast(255)); + result.z = gtc::type_precision::f16(static_cast(color >> 24) / static_cast(255)); + return result; +} + +template <> +inline f16vec3 f16_bgrx_cast(uint32 color) +{ + f16vec3 result; + result.x = f16(static_cast(color >> 16) / static_cast(255)); + result.y = f16(static_cast(color >> 8) / static_cast(255)); + result.z = f16(static_cast(color >> 0) / static_cast(255)); + return result; +} + +template <> +inline f16vec3 f16_xbgr_cast(uint32 color) +{ + f16vec3 result; + result.x = f16(static_cast(color >> 24) / static_cast(255)); + result.y = f16(static_cast(color >> 16) / static_cast(255)); + result.z = f16(static_cast(color >> 8) / static_cast(255)); + return result; +} + +template <> +inline f16vec4 f16_rgba_cast(uint32 color) +{ + f16vec4 result; + result.x = f16(static_cast(color >> 0) / static_cast(255)); + result.y = f16(static_cast(color >> 8) / static_cast(255)); + result.z = f16(static_cast(color >> 16) / static_cast(255)); + result.w = f16(static_cast(color >> 24) / static_cast(255)); + return result; +} + +template <> +inline f16vec4 f16_argb_cast(uint32 color) +{ + f16vec4 result; + result.x = f16(static_cast(color >> 8) / static_cast(255)); + result.y = f16(static_cast(color >> 16) / static_cast(255)); + result.z = f16(static_cast(color >> 24) / static_cast(255)); + result.w = f16(static_cast(color >> 0) / static_cast(255)); + return result; +} + +template <> +inline f16vec4 f16_bgra_cast(uint32 color) +{ + f16vec4 result; + result.x = f16(static_cast(color >> 16) / static_cast(255)); + result.y = f16(static_cast(color >> 8) / static_cast(255)); + result.z = f16(static_cast(color >> 0) / static_cast(255)); + result.w = f16(static_cast(color >> 24) / static_cast(255)); + return result; +} + +template <> +inline f16vec4 f16_abgr_cast(uint32 color) +{ + f16vec4 result; + result.x = f16(static_cast(color >> 24) / static_cast(255)); + result.y = f16(static_cast(color >> 16) / static_cast(255)); + result.z = f16(static_cast(color >> 8) / static_cast(255)); + result.w = f16(static_cast(color >> 0) / static_cast(255)); + return result; +} + +template <> +inline float f32_channel_cast(uint8 color) +{ + return static_cast(color >> 0) / static_cast(255); +} + +template <> +inline detail::tvec3 f32_rgbx_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 0) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 16) / static_cast(255); + return result; +} + +template <> +inline detail::tvec3 f32_xrgb_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 8) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 24) / static_cast(255); + return result; +} + +template <> +inline detail::tvec3 f32_bgrx_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 16) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 0) / static_cast(255); + return result; +} + +template <> +inline detail::tvec3 f32_xbgr_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 24) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 8) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f32_rgba_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 0) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 16) / static_cast(255); + result.w = static_cast(color >> 24) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f32_argb_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 8) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 24) / static_cast(255); + result.w = static_cast(color >> 0) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f32_bgra_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 16) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 0) / static_cast(255); + result.w = static_cast(color >> 24) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f32_abgr_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 24) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 8) / static_cast(255); + result.w = static_cast(color >> 0) / static_cast(255); + return result; +} + +template <> +inline double f64_channel_cast(uint8 color) +{ + return static_cast(color >> 0) / static_cast(255); +} + +template <> +inline detail::tvec3 f64_rgbx_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 0) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 16) / static_cast(255); + return result; +} + +template <> +inline detail::tvec3 f64_xrgb_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 8) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 24) / static_cast(255); + return result; +} + +template <> +inline detail::tvec3 f64_bgrx_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 16) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 0) / static_cast(255); + return result; +} + +template <> +inline detail::tvec3 f64_xbgr_cast(uint32 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 24) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 8) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f64_rgba_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 0) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 16) / static_cast(255); + result.w = static_cast(color >> 24) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f64_argb_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 8) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 24) / static_cast(255); + result.w = static_cast(color >> 0) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f64_bgra_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 16) / static_cast(255); + result.y = static_cast(color >> 8) / static_cast(255); + result.z = static_cast(color >> 0) / static_cast(255); + result.w = static_cast(color >> 24) / static_cast(255); + return result; +} + +template <> +inline detail::tvec4 f64_abgr_cast(uint32 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 24) / static_cast(255); + result.y = static_cast(color >> 16) / static_cast(255); + result.z = static_cast(color >> 8) / static_cast(255); + result.w = static_cast(color >> 0) / static_cast(255); + return result; +} + +template <> +inline detail::thalf f16_channel_cast(uint16 color) +{ + return detail::thalf(static_cast(color >> 0) / static_cast(65535)); +} + +template <> +inline detail::tvec3 f16_rgbx_cast(uint64 color) +{ + detail::tvec3 result; + result.x = detail::thalf(static_cast(color >> 0) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + return result; +} + +template <> +inline detail::tvec3 f16_xrgb_cast(uint64 color) +{ + detail::tvec3 result; + result.x = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 48) / static_cast(65535)); + return result; +} + +template <> +inline detail::tvec3 f16_bgrx_cast(uint64 color) +{ + detail::tvec3 result; + result.x = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 0) / static_cast(65535)); + return result; +} + +template <> +inline detail::tvec3 f16_xbgr_cast(uint64 color) +{ + detail::tvec3 result; + result.x = detail::thalf(static_cast(color >> 48) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + return result; +} + +template <> +inline detail::tvec4 f16_rgba_cast(uint64 color) +{ + detail::tvec4 result; + result.x = detail::thalf(static_cast(color >> 0) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + result.w = detail::thalf(static_cast(color >> 48) / static_cast(65535)); + return result; +} + +template <> +inline detail::tvec4 f16_argb_cast(uint64 color) +{ + detail::tvec4 result; + result.x = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 48) / static_cast(65535)); + result.w = detail::thalf(static_cast(color >> 0) / static_cast(65535)); + return result; +} + +template <> +inline detail::tvec4 f16_bgra_cast(uint64 color) +{ + detail::tvec4 result; + result.x = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 0) / static_cast(65535)); + result.w = detail::thalf(static_cast(color >> 48) / static_cast(65535)); + return result; +} + +template <> +inline detail::tvec4 f16_abgr_cast(uint64 color) +{ + detail::tvec4 result; + result.x = detail::thalf(static_cast(color >> 48) / static_cast(65535)); + result.y = detail::thalf(static_cast(color >> 32) / static_cast(65535)); + result.z = detail::thalf(static_cast(color >> 16) / static_cast(65535)); + result.w = detail::thalf(static_cast(color >> 0) / static_cast(65535)); + return result; +} + +template <> +inline float f32_channel_cast(uint16 color) +{ + return static_cast(color >> 0) / static_cast(65535); +} + +template <> +inline detail::tvec3 f32_rgbx_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 0) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 32) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec3 f32_xrgb_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 16) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 48) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec3 f32_bgrx_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 32) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 0) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec3 f32_xbgr_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 48) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 16) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f32_rgba_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 0) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 32) / static_cast(65535); + result.w = static_cast(color >> 48) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f32_argb_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 16) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 48) / static_cast(65535); + result.w = static_cast(color >> 0) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f32_bgra_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 32) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 0) / static_cast(65535); + result.w = static_cast(color >> 48) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f32_abgr_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 48) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 16) / static_cast(65535); + result.w = static_cast(color >> 0) / static_cast(65535); + return result; +} + +template <> +inline double f64_channel_cast(uint16 color) +{ + return static_cast(color >> 0) / static_cast(65535); +} + +template <> +inline detail::tvec3 f64_rgbx_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 0) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 32) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec3 f64_xrgb_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 16) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 48) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec3 f64_bgrx_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 32) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 0) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec3 f64_xbgr_cast(uint64 color) +{ + detail::tvec3 result; + result.x = static_cast(color >> 48) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 16) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f64_rgba_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 0) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 32) / static_cast(65535); + result.w = static_cast(color >> 48) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f64_argb_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 16) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 48) / static_cast(65535); + result.w = static_cast(color >> 0) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f64_bgra_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 32) / static_cast(65535); + result.y = static_cast(color >> 16) / static_cast(65535); + result.z = static_cast(color >> 0) / static_cast(65535); + result.w = static_cast(color >> 48) / static_cast(65535); + return result; +} + +template <> +inline detail::tvec4 f64_abgr_cast(uint64 color) +{ + detail::tvec4 result; + result.x = static_cast(color >> 48) / static_cast(65535); + result.y = static_cast(color >> 32) / static_cast(65535); + result.z = static_cast(color >> 16) / static_cast(65535); + result.w = static_cast(color >> 0) / static_cast(65535); + return result; +} + +}//namespace color_space +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/color_space.hpp b/glm/gtx/color_space.hpp new file mode 100644 index 0000000..3438bbd --- /dev/null +++ b/glm/gtx/color_space.hpp @@ -0,0 +1,78 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2007-02-22 +// Licence : This source is under MIT License +// File : glm/gtx/color_space.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_color_space +#define glm_gtx_color_space + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_color_space(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_color_space extension: Related to RGB to HSV conversions and operations + namespace color_space + { + //! Converts a color from HSV color space to its color in RGB color space. + //! From GLM_GTX_color_space extension. + template + detail::tvec3 rgbColor( + detail::tvec3 const & hsvValue); + + //! Converts a color from RGB color space to its color in HSV color space. + //! From GLM_GTX_color_space extension. + template + detail::tvec3 hsvColor( + detail::tvec3 const & rgbValue); + + //! Build a saturation matrix. + //! From GLM_GTX_color_space extension + template + detail::tmat4x4 saturation( + valType const s); + + //! Modify the saturation of a color. + //! From GLM_GTX_color_space extension. + template + detail::tvec3 saturation( + valType const s, + detail::tvec3 const & color); + + //! Modify the saturation of a color. + //! From GLM_GTX_color_space extension. + template + detail::tvec4 saturation( + valType const s, + detail::tvec4 const & color); + + //! Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals. + //! From GLM_GTX_color_space extension. + template + valType luminosity( + detail::tvec3 const & color); + + }//namespace color_space + }//namespace gtx +}//namespace glm + +#define GLM_GTX_color_space namespace gtx::color_space +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_color_space;} +#endif//GLM_GTC_GLOBAL + +#include "color_space.inl" + +#endif//glm_gtx_color_space diff --git a/glm/gtx/color_space.inl b/glm/gtx/color_space.inl new file mode 100644 index 0000000..540da8a --- /dev/null +++ b/glm/gtx/color_space.inl @@ -0,0 +1,154 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2007-02-22 +// Licence : This source is under MIT License +// File : glm/gtx/color_space.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace color_space +{ + template + inline detail::tvec3 rgbColor(const detail::tvec3& hsvColor) + { + detail::tvec3 hsv = hsvColor; + detail::tvec3 rgbColor; + + if(hsv.y == T(0)) + // achromatic (grey) + rgbColor = detail::tvec3(hsv.z); + else + { + T sector = floor(hsv.x / T(60)); + T frac = (hsv.x / T(60)) - sector; + // factorial part of h + T o = hsv.z * (T(1) - hsv.y); + T p = hsv.z * (T(1) - hsv.y * frac); + T q = hsv.z * (T(1) - hsv.y * (T(1) - frac)); + + switch(int(sector)) + { + default: + case 0: + rgbColor.r = hsv.z; + rgbColor.g = q; + rgbColor.b = o; + break; + case 1: + rgbColor.r = p; + rgbColor.g = hsv.z; + rgbColor.b = o; + break; + case 2: + rgbColor.r = o; + rgbColor.g = hsv.z; + rgbColor.b = q; + break; + case 3: + rgbColor.r = o; + rgbColor.g = p; + rgbColor.b = hsv.z; + break; + case 4: + rgbColor.r = q; + rgbColor.g = o; + rgbColor.b = hsv.z; + break; + case 5: + rgbColor.r = hsv.z; + rgbColor.g = o; + rgbColor.b = p; + break; + } + } + + return rgbColor; + } + + template + inline detail::tvec3 hsvColor(const detail::tvec3& rgbColor) + { + detail::tvec3 hsv = rgbColor; + float Min = min(min(rgbColor.r, rgbColor.g), rgbColor.b); + float Max = max(max(rgbColor.r, rgbColor.g), rgbColor.b); + float Delta = Max - Min; + + hsv.z = Max; + + if(Max != T(0)) + { + hsv.y = Delta / hsv.z; + T h = T(0); + + if(rgbColor.r == Max) + // between yellow & magenta + h = T(0) + T(60) * (rgbColor.g - rgbColor.b) / Delta; + else if(rgbColor.g == Max) + // between cyan & yellow + h = T(120) + T(60) * (rgbColor.b - rgbColor.r) / Delta; + else + // between magenta & cyan + h = T(240) + T(60) * (rgbColor.r - rgbColor.g) / Delta; + + if(h < T(0)) + hsv.x = h + T(360); + else + hsv.x = h; + } + else + { + // If r = g = b = 0 then s = 0, h is undefined + hsv.y = T(0); + hsv.x = T(0); + } + + return hsv; + } + + template + inline detail::tmat4x4 saturation(const T s) + { + detail::tvec3 rgbw = detail::tvec3(T(0.2126), T(0.7152), T(0.0722)); + + T col0 = (T(1) - s) * rgbw.r; + T col1 = (T(1) - s) * rgbw.g; + T col2 = (T(1) - s) * rgbw.b; + + detail::tmat4x4 result(T(1)); + result[0][0] = col0 + s; + result[0][1] = col0; + result[0][2] = col0; + result[1][0] = col1; + result[1][1] = col1 + s; + result[1][2] = col1; + result[2][0] = col2; + result[2][1] = col2; + result[2][2] = col2 + s; + return result; + } + + template + inline detail::tvec3 saturation(const T s, const detail::tvec3& color) + { + return detail::tvec3(saturation(s) * detail::tvec4(color, T(0))); + } + + template + inline detail::tvec4 saturation(const T s, const detail::tvec4& color) + { + return saturation(s) * color; + } + + template + inline T luminosity(const detail::tvec3& color) + { + const detail::tvec3 tmp = detail::tvec3(0.33, 0.59, 0.11); + return dot(color, tmp); + } + +}//namespace color_space +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/color_space_YCoCg.hpp b/glm/gtx/color_space_YCoCg.hpp new file mode 100644 index 0000000..1932ffd --- /dev/null +++ b/glm/gtx/color_space_YCoCg.hpp @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-28 +// Updated : 2008-10-28 +// Licence : This source is under MIT License +// File : glm/gtx/color_space_YCoCg.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_color_space_YCoCg +#define glm_gtx_color_space_YCoCg + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_color_space_YCoCg(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_color_space_YCoCg extension: RGB to YCoCg conversions and operations + namespace color_space_YCoCg + { + //! Convert a color from RGB color space to YCoCg color space. + //! From GLM_GTX_color_space_YCoCg extension. + template + detail::tvec3 rgb2YCoCg( + detail::tvec3 const & rgbColor); + + //! Convert a color from YCoCg color space to RGB color space. + //! From GLM_GTX_color_space_YCoCg extension. + template + detail::tvec3 YCoCg2rgb( + detail::tvec3 const & YCoCgColor); + + //! Convert a color from RGB color space to YCoCgR color space. + //! \see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" + //! From GLM_GTX_color_space_YCoCg extension. + template + detail::tvec3 rgb2YCoCgR( + detail::tvec3 const & rgbColor); + + //! Convert a color from YCoCgR color space to RGB color space. + //! \see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" + //! From GLM_GTX_color_space_YCoCg extension. + template + detail::tvec3 YCoCgR2rgb( + detail::tvec3 const & YCoCgColor); + + }//namespace color_space_YCoCg + }//namespace gtx +}//namespace glm + +#define GLM_GTX_color_space_YCoCg namespace gtx::color_space_YCoCg +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_color_space_YCoCg;} +#endif//GLM_GTC_GLOBAL + +#include "color_space_YCoCg.inl" + +#endif//glm_gtx_color_space_YCoCg diff --git a/glm/gtx/color_space_YCoCg.inl b/glm/gtx/color_space_YCoCg.inl new file mode 100644 index 0000000..7d9e7ec --- /dev/null +++ b/glm/gtx/color_space_YCoCg.inl @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-28 +// Updated : 2008-10-28 +// Licence : This source is under MIT License +// File : glm/gtx/color_space_YCoCg.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace color_space_YCoCg{ + +template +inline detail::tvec3 rgb2YCoCg +( + detail::tvec3 const & rgbColor +) +{ + detail::tvec3 result; + result.x/*Y */ = rgbColor.r / valType(4) + rgbColor.g / valType(2) + rgbColor.b / valType(4); + result.y/*Co*/ = rgbColor.r / valType(2) + rgbColor.g * valType(0) - rgbColor.b / valType(2); + result.z/*Cg*/ = - rgbColor.r / valType(4) + rgbColor.g / valType(2) - rgbColor.b / valType(4); + return result; +} + +template +inline detail::tvec3 rgb2YCoCgR +( + detail::tvec3 const & rgbColor +) +{ + detail::tvec3 result; + result.x/*Y */ = rgbColor.g / valType(2) + (rgbColor.r + rgbColor.b) / valType(4); + result.y/*Co*/ = rgbColor.r - rgbColor.b; + result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / valType(2); + return result; +} + +template +inline detail::tvec3 YCoCg2rgb +( + detail::tvec3 const & YCoCgColor +) +{ + detail::tvec3 result; + result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z; + result.g = YCoCgColor.x + YCoCgColor.z; + result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z; + return result; +} + +template +inline detail::tvec3 YCoCgR2rgb +( + detail::tvec3 const & YCoCgRColor +) +{ + detail::tvec3 result; + valType tmp = YCoCgRColor.x - (YCoCgRColor.z / valType(2)); + result.g = YCoCgRColor.z + tmp; + result.b = tmp - (YCoCgRColor.y / valType(2)); + result.r = result.b + YCoCgRColor.y; + return result; +} + +}//namespace color_space_YCoCg +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/comparison.hpp b/glm/gtx/comparison.hpp new file mode 100644 index 0000000..1f071b4 --- /dev/null +++ b/glm/gtx/comparison.hpp @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-06-22 +// Updated : 2008-10-27 +// Licence : This source is under MIT License +// File : glm/gtx/comparison.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_comparison +#define glm_gtx_comparison + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_comparison(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_comparison extension: Defined comparison operators for vectors. + namespace comparison{ + + //! Define == operator for vectors + //! From GLM_GTX_comparison extension. + template + bool operator== (vecType const & x, vecType const & y); + + //! Define != operator for vectors + //! From GLM_GTX_comparison extension. + template + bool operator!= (vecType const & x, vecType const & y); + + }//namespace comparison + }//namespace gtx +}//namespace glm + +#define GLM_GTX_comparison namespace glm::gtx::comparison +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_comparison;} +#endif//GLM_GTC_GLOBAL + +#include "comparison.inl" + +#endif//glm_gtx_comparison diff --git a/glm/gtx/comparison.inl b/glm/gtx/comparison.inl new file mode 100644 index 0000000..31a8022 --- /dev/null +++ b/glm/gtx/comparison.inl @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-06-22 +// Updated : 2008-10-27 +// Licence : This source is under MIT License +// File : glm/gtx/comparison.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace comparison{ + +template +inline bool operator== +( + detail::tvec2 const & x, + detail::tvec2 const & y +) +{ + return glm::all(glm::equal(x, y)); +} + +template +inline bool operator== +( + detail::tvec3 const & x, + detail::tvec3 const & y +) +{ + return glm::all(glm::equal(x, y)); +} + +template +inline bool operator== +( + detail::tvec4 const & x, + detail::tvec4 const & y +) +{ + return glm::all(glm::equal(x, y)); +} + +template +inline bool operator!= +( + detail::tvec2 const & x, + detail::tvec2 const & y +) +{ + return glm::any(glm::notEqual(x, y)); +} + +template +inline bool operator!= +( + detail::tvec3 const & x, + detail::tvec3 const & y +) +{ + return glm::any(glm::notEqual(x, y)); +} + +template +inline bool operator!= +( + detail::tvec4 const & x, + detail::tvec4 const & y +) +{ + return glm::any(glm::notEqual(x, y)); +} + +}//namespace comparison +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/compatibility.hpp b/glm/gtx/compatibility.hpp new file mode 100644 index 0000000..80643c3 --- /dev/null +++ b/glm/gtx/compatibility.hpp @@ -0,0 +1,174 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-01-24 +// Updated : 2008-10-24 +// Licence : This source is under MIT License +// File : glm/gtx/compatibility.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_half_float +// - GLM_GTX_double_float +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_compatibility +#define glm_gtx_compatibility + +// Dependency: +#include "../glm.hpp" +#include "../gtc/half_float.hpp" +#include "../gtc/double_float.hpp" + +#ifdef GLM_COMPILER_VC +#include +#endif +#ifdef GLM_COMPILER_GCC +#include +#endif + +namespace glm +{ + namespace test{ + void main_gtx_compatibility(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_compatibility extension: Provide functions to increase the compatibility with Cg and HLSL languages + namespace compatibility + { + template inline T lerp(T x, T y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility) + template inline detail::tvec2 lerp(const detail::tvec2& x, const detail::tvec2& y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility) + template inline detail::tvec3 lerp(const detail::tvec3& x, const detail::tvec3& y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility) + template inline detail::tvec4 lerp(const detail::tvec4& x, const detail::tvec4& y, T a){return mix(x, y, a);} //!< \brief 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]. (From GLM_GTX_compatibility) + template inline detail::tvec2 lerp(const detail::tvec2& x, const detail::tvec2& y, const detail::tvec2& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template inline detail::tvec3 lerp(const detail::tvec3& x, const detail::tvec3& y, const detail::tvec3& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + template inline detail::tvec4 lerp(const detail::tvec4& x, const detail::tvec4& y, const detail::tvec4& a){return mix(x, y, a);} //!< \brief Returns the component-wise result of x * (1.0 - a) + y * a, i.e., the linear blend of x and y using vector a. The value for a is not restricted to the range [0, 1]. (From GLM_GTX_compatibility) + + template inline T saturate(T x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + template inline detail::tvec2 saturate(const detail::tvec2& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + template inline detail::tvec3 saturate(const detail::tvec3& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + template inline detail::tvec4 saturate(const detail::tvec4& x){return clamp(x, T(0), T(1));} //!< \brief Returns clamp(x, 0, 1) for each component in x. (From GLM_GTX_compatibility) + + template inline T atan2(T x, T y){return atan(x, y);} //!< \brief 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 GLM_GTX_compatibility) + template inline detail::tvec2 atan2(const detail::tvec2& x, const detail::tvec2& y){return atan(x, y);} //!< \brief 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 GLM_GTX_compatibility) + template inline detail::tvec3 atan2(const detail::tvec3& x, const detail::tvec3& y){return atan(x, y);} //!< \brief 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 GLM_GTX_compatibility) + template inline detail::tvec4 atan2(const detail::tvec4& x, const detail::tvec4& y){return atan(x, y);} //!< \brief 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 GLM_GTX_compatibility) + + template bool isfinite(genType const & x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template detail::tvec2 isfinite(const detail::tvec2& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template detail::tvec3 isfinite(const detail::tvec3& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + template detail::tvec4 isfinite(const detail::tvec4& x); //!< \brief Test whether or not a scalar or each vector component is a finite value. (From GLM_GTX_compatibility) + + template bool isinf(genType const & x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension) + template detail::tvec2 isinf(const detail::tvec2& x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension) + template detail::tvec3 isinf(const detail::tvec3& x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension) + template detail::tvec4 isinf(const detail::tvec4& x); //!< \brief Determines whether the given floating-point value is infinite. (From GLM_GTX_compatibility extension) + + template bool isnan(genType const & x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension) + template detail::tvec2 isnan(const detail::tvec2& x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension) + template detail::tvec3 isnan(const detail::tvec3& x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension) + template detail::tvec4 isnan(const detail::tvec4& x); //!< \brief Checks given floating-point value for not a number (NAN) (From GLM_GTX_compatibility extension) + + typedef bool bool1; //!< \brief boolean type with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tvec2 bool2; //!< \brief boolean type with 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec3 bool3; //!< \brief boolean type with 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec4 bool4; //!< \brief boolean type with 4 components. (From GLM_GTX_compatibility extension) + + typedef bool bool1x1; //!< \brief boolean matrix with 1 x 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x2 bool2x2; //!< \brief boolean matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x3 bool2x3; //!< \brief boolean matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x4 bool2x4; //!< \brief boolean matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x2 bool3x2; //!< \brief boolean matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x3 bool3x3; //!< \brief boolean matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x4 bool3x4; //!< \brief boolean matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x2 bool4x2; //!< \brief boolean matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x3 bool4x3; //!< \brief boolean matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x4 bool4x4; //!< \brief boolean matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + + typedef int int1; //!< \brief integer vector with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tvec2 int2; //!< \brief integer vector with 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec3 int3; //!< \brief integer vector with 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec4 int4; //!< \brief integer vector with 4 components. (From GLM_GTX_compatibility extension) + + typedef int int1x1; //!< \brief integer matrix with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x2 int2x2; //!< \brief integer matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x3 int2x3; //!< \brief integer matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x4 int2x4; //!< \brief integer matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x2 int3x2; //!< \brief integer matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x3 int3x3; //!< \brief integer matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x4 int3x4; //!< \brief integer matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x2 int4x2; //!< \brief integer matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x3 int4x3; //!< \brief integer matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x4 int4x4; //!< \brief integer matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + + typedef gtc::half_float::half half1; //!< \brief half-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tvec2 half2; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec3 half3; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec4 half4; //!< \brief half-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) + + typedef gtc::half_float::half half1x1; //!< \brief half-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x2 half2x2; //!< \brief half-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x3 half2x3; //!< \brief half-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x4 half2x4; //!< \brief half-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x2 half3x2; //!< \brief half-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x3 half3x3; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x4 half3x4; //!< \brief half-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x2 half4x2; //!< \brief half-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x3 half4x3; //!< \brief half-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x4 half4x4; //!< \brief half-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + + typedef float float1; //!< \brief single-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tvec2 float2; //!< \brief single-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec3 float3; //!< \brief single-precision floating-point vector with 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec4 float4; //!< \brief single-precision floating-point vector with 4 components. (From GLM_GTX_compatibility extension) + + typedef float float1x1; //!< \brief single-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x2 float2x2; //!< \brief single-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x3 float2x3; //!< \brief single-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x4 float2x4; //!< \brief single-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x2 float3x2; //!< \brief single-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x3 float3x3; //!< \brief single-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x4 float3x4; //!< \brief single-precision floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x2 float4x2; //!< \brief single-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x3 float4x3; //!< \brief single-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x4 float4x4; //!< \brief single-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + + typedef double double1; //!< \brief double-precision floating-point vector with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tvec2 double2; //!< \brief double-precision floating-point vector with 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec3 double3; //!< \brief double-precision floating-point vector with 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tvec4 double4; //!< \brief double-precision floating-point vector with 4 components. (From GLM_GTX_compatibility extension) + + typedef double double1x1; //!< \brief double-precision floating-point matrix with 1 component. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x2 double2x2; //!< \brief double-precision floating-point matrix with 2 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x3 double2x3; //!< \brief double-precision floating-point matrix with 2 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat2x4 double2x4; //!< \brief double-precision floating-point matrix with 2 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x2 double3x2; //!< \brief double-precision floating-point matrix with 3 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x3 double3x3; //!< \brief double-precision floating-point matrix with 3 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat3x4 double3x4; //!< \brief double-precision floating-point matrix with 3 x 4 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x2 double4x2; //!< \brief double-precision floating-point matrix with 4 x 2 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x3 double4x3; //!< \brief double-precision floating-point matrix with 4 x 3 components. (From GLM_GTX_compatibility extension) + typedef detail::tmat4x4 double4x4; //!< \brief double-precision floating-point matrix with 4 x 4 components. (From GLM_GTX_compatibility extension) + + }//namespace compatibility + }//namespace gtx +}//namespace glm + +#define GLM_GTX_compatibility namespace gtx::compatibility +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_compatibility;} +#endif//GLM_GTC_GLOBAL + +#include "compatibility.inl" + +#endif//glm_gtx_compatibility + + + + + + + + + + diff --git a/glm/gtx/compatibility.inl b/glm/gtx/compatibility.inl new file mode 100644 index 0000000..2048145 --- /dev/null +++ b/glm/gtx/compatibility.inl @@ -0,0 +1,141 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-16 +// Updated : 2008-10-24 +// Licence : This source is under MIT License +// File : glm/gtx/compatibility.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace compatibility{ + +// isfinite +template +inline bool isfinite( + genType const & x) +{ +#ifdef GLM_COMPILER_VC + return _finite(x); +#else//GLM_COMPILER_GCC + return std::isfinite(x); +#endif +} + +template +inline detail::tvec2 isfinite( + detail::tvec2 const & x) +{ + return detail::tvec2( + isfinite(x.x), + isfinite(x.y)); +} + +template +inline detail::tvec3 isfinite( + detail::tvec3 const & x) +{ + return detail::tvec3( + isfinite(x.x), + isfinite(x.y), + isfinite(x.z)); +} + +template +inline detail::tvec4 isfinite( + detail::tvec4 const & x) +{ + return detail::tvec4( + isfinite(x.x), + isfinite(x.y), + isfinite(x.z), + isfinite(x.w)); +} + +// isinf +template +inline bool isinf( + genType const & x) +{ +#if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC)) + return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF; +#else + return std::isinf(x); +#endif +} + +template +inline detail::tvec2 isinf( + detail::tvec2 const & x) +{ + return detail::tvec2( + isinf(x.x), + isinf(x.y)); +} + +template +inline detail::tvec3 isinf( + detail::tvec3 const & x) +{ + return detail::tvec3( + isinf(x.x), + isinf(x.y), + isinf(x.z)); +} + +template +inline detail::tvec4 isinf( + detail::tvec4 const & x) +{ + return detail::tvec4( + isinf(x.x), + isinf(x.y), + isinf(x.z), + isinf(x.w)); +} + +// isnan +template +inline bool isnan(genType const & x) +{ +#if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC)) + return _isnan(x); +#else + return std::isnan(x); +#endif +} + +template +inline detail::tvec2 isnan( + detail::tvec2 const & x) +{ + return detail::tvec2( + isnan(x.x), + isnan(x.y)); +} + +template +inline detail::tvec3 isnan( + detail::tvec3 const & x) +{ + return detail::tvec3( + isnan(x.x), + isnan(x.y), + isnan(x.z)); +} + +template +inline detail::tvec4 isnan( + detail::tvec4 const & x) +{ + return detail::tvec4( + isnan(x.x), + isnan(x.y), + isnan(x.z), + isnan(x.w)); +} + +}//namespace compatibility +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/component_wise.hpp b/glm/gtx/component_wise.hpp new file mode 100644 index 0000000..d2d6f11 --- /dev/null +++ b/glm/gtx/component_wise.hpp @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-05-21 +// Updated : 2007-05-21 +// Licence : This source is under MIT License +// File : glm/gtx/component_wise.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_component_wise +#define glm_gtx_component_wise + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_component_wise(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_component_wise extension: Operations between components of a type + namespace component_wise + { + //! Add all vector components together. + //! From GLM_GTX_component_wise extension. + template + typename genType::value_type compAdd( + genType const & v); + + //! Multiply all vector components together. + //! From GLM_GTX_component_wise extension. + template + typename genType::value_type compMul( + genType const & v); + + //! Find the minimum value between single vector components. + //! From GLM_GTX_component_wise extension. + template + typename genType::value_type compMin( + genType const & v); + + //! Find the maximum value between single vector components. + //! From GLM_GTX_component_wise extension. + template + typename genType::value_type compMax( + genType const & v); + + }//namespace component_wise + }//namespace gtx +}//namespace glm + +#define GLM_GTX_component_wise namespace gtx::component_wise +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_component_wise;} +#endif//GLM_GTC_GLOBAL + +#include "component_wise.inl" + +#endif//glm_gtx_component_wise diff --git a/glm/gtx/component_wise.inl b/glm/gtx/component_wise.inl new file mode 100644 index 0000000..dff9cfd --- /dev/null +++ b/glm/gtx/component_wise.inl @@ -0,0 +1,88 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-05-21 +// Updated : 2007-05-21 +// Licence : This source is under MIT License +// File : gtx_component_wise.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace component_wise +{ + template + inline typename genType::value_type compAdd(const genType& v) + { + typename genType::size_type result = typename genType::value_type(0); + for(typename genType::size_type i = 0; i < genType::value_size(); ++i) + result += v[i]; + return result; + } +/* + template + inline valType compAdd(const genType& v) + { + valType result = valType(0); + for(sizeType i = 0; i < valSize; ++i) + result += v[i]; + return result; + } +*/ + template + inline typename genType::value_type compMul(const genType& v) + { + typename genType::value_type result = typename genType::value_type(1); + for(typename genType::size_type i = 0; i < genType::value_size(); ++i) + result *= v[i]; + return result; + } +/* + template + inline typename genType::value_type compMul(const genType& v) + { + valType result = valType(0); + for(GLMsizeType i = 0; i < valSize; ++i) + result *= v[i]; + return result; + } +*/ + template + inline typename genType::value_type compMin(const genType& v) + { + typename genType::value_type result = typename genType::value_type(v[0]); + for(typename genType::size_type i = 1; i < genType::value_size(); ++i) + result = min(result, v[i]); + return result; + } +/* + template + inline typename genType::value_type compMin(const genType& v) + { + valType result = valType(0); + for(GLMsizeType i = 0; i < valSize; ++i) + result = min(result, v[i]); + return result; + } +*/ + template + inline typename genType::value_type compMax(const genType& v) + { + typename genType::value_type result = typename genType::value_type(v[0]); + for(typename genType::size_type i = 1; i < genType::value_size(); ++i) + result = max(result, v[i]); + return result; + } +/* + template + inline typename genType::value_type compMax(const genType& v) + { + GLMvalType result = GLMvalType(0); + for(GLMsizeType i = 0; i < GLMvalSize; ++i) + result = max(result, v[i]); + return result; + } +*/ +}//namespace component_wise +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/determinant.hpp b/glm/gtx/determinant.hpp new file mode 100644 index 0000000..3b5db0c --- /dev/null +++ b/glm/gtx/determinant.hpp @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-04-23 +// Licence : This source is under MIT License +// File : glm/gtx/determinant.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_determinant +#define glm_gtx_determinant + +// Dependency: +#include "../glm.hpp" +#include "../gtc/matrix_operation.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_determinant(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_determinant extension: Compute the determinant of a matrix + namespace determinant + { + using namespace gtc::matrix_operation; + + }//namespace determinant + }//namespace gtx +}//namespace glm + +#define GLM_GTX_determinant namespace gtx::determinant +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_determinant;} +#endif//GLM_GTC_GLOBAL + +#include "determinant.inl" + +#endif//glm_gtx_determinant diff --git a/glm/gtx/determinant.inl b/glm/gtx/determinant.inl new file mode 100644 index 0000000..5868517 --- /dev/null +++ b/glm/gtx/determinant.inl @@ -0,0 +1,13 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2005-12-21 +// Licence : This source is under MIT License +// File : glm/gtx/determinant.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + +} diff --git a/glm/gtx/double_float.hpp b/glm/gtx/double_float.hpp new file mode 100644 index 0000000..ac49134 --- /dev/null +++ b/glm/gtx/double_float.hpp @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/gtx/double_float.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_double_float +// - GLM_GTX_quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Note: +// - This implementation doesn't need to redefine all build-in functions to +// support double based type. +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_double_float +#define glm_gtx_double_float + +// Dependency: +#include "../glm.hpp" +#include "../gtc/double_float.hpp" +#include "../gtx/quaternion.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_double_float(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_double_float extension: Add support for double precision flotting-point types + namespace double_float + { + //! Quaternion of single-precision floating-point numbers. + //! From GLM_GTX_double extension. + typedef detail::tquat fquat; + + //! Quaternion of double-precision floating-point numbers. + //! From GLM_GTX_double extension. + typedef detail::tquat dquat; + + }//namespace double_float + }//namespace gtx +}//namespace glm + +#define GLM_GTX_double_float namespace gtc::double_float; using namespace gtx::double_float +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_double_float;} +#endif//GLM_GTX_GLOBAL + +#include "double_float.inl" + +#endif//glm_gtx_double_float diff --git a/glm/gtx/double_float.inl b/glm/gtx/double_float.inl new file mode 100644 index 0000000..c7e1e5c --- /dev/null +++ b/glm/gtx/double_float.inl @@ -0,0 +1,13 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-04-29 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtc/double_float.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + +} diff --git a/glm/gtx/epsilon.hpp b/glm/gtx/epsilon.hpp new file mode 100644 index 0000000..5e077da --- /dev/null +++ b/glm/gtx/epsilon.hpp @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/epsilon.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_double +// - GLM_GTX_half +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_epsilon +#define glm_gtx_epsilon + +// Dependency: +#include "../glm.hpp" +#include "../gtc/double_float.hpp" +#include "../gtc/half_float.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_epsilon(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_epsilon extension: Comparaison functions for a user defined epsilon values. + namespace epsilon + { + //! Returns the component-wise compare of |x - y| < epsilon. + //! From GLM_GTX_epsilon extension. + template + bool equalEpsilon( + genTypeT const & x, + genTypeT const & y, + genTypeU const & epsilon); + + //! Returns the component-wise compare of |x - y| >= epsilon. + //! From GLM_GTX_epsilon extension. + template + bool notEqualEpsilon( + genTypeT const & x, + genTypeT const & y, + genTypeU const & epsilon); + + }//namespace epsilon + }//namespace gtx +}//namespace glm + +#define GLM_GTX_epsilon namespace gtx::epsilon +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_epsilon;} +#endif//GLM_GTX_GLOBAL + +#include "epsilon.inl" + +#endif//glm_gtx_epsilon diff --git a/glm/gtx/epsilon.inl b/glm/gtx/epsilon.inl new file mode 100644 index 0000000..60d1907 --- /dev/null +++ b/glm/gtx/epsilon.inl @@ -0,0 +1,204 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2006-01-16 +// Licence : This source is under MIT License +// File : glm/gtx/epsilon.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace epsilon{ + +template +inline bool equalEpsilon +( + genType const & x, + genType const & y, + genType const & epsilon +) +{ + return abs(x - y) < epsilon; +} + +template +inline bool notEqualEpsilon +( + genType const & x, + genType const & y, + genType const & epsilon +) +{ + return abs(x - y) >= epsilon; +} + +template +inline detail::tvec2 equalEpsilon +( + detail::tvec2 const & x, + detail::tvec2 const & y, + valType const & epsilon) +{ + return detail::tvec2( + abs(x.x - y.x) < epsilon, + abs(x.y - y.y) < epsilon); +} + +template +inline detail::tvec3 equalEpsilon +( + detail::tvec3 const & x, + detail::tvec3 const & y, + valType const & epsilon) +{ + return detail::tvec3( + abs(x.x - y.x) < epsilon, + abs(x.y - y.y) < epsilon, + abs(x.z - y.z) < epsilon); +} + +template +inline detail::tvec4 equalEpsilon +( + detail::tvec4 const & x, + detail::tvec4 const & y, + valType const & epsilon +) +{ + return detail::tvec4( + abs(x.x - y.x) < epsilon, + abs(x.y - y.y) < epsilon, + abs(x.z - y.z) < epsilon, + abs(x.w - y.w) < epsilon); +} + +template +inline detail::tvec2 notEqualEpsilon +( + detail::tvec2 const & x, + detail::tvec2 const & y, + valType const & epsilon +) +{ + return detail::tvec2( + abs(x.x - y.x) >= epsilon, + abs(x.y - y.y) >= epsilon); +} + +template +inline detail::tvec3 notEqualEpsilon +( + detail::tvec3 const & x, + detail::tvec3 const & y, + valType const & epsilon +) +{ + return detail::tvec3( + abs(x.x - y.x) >= epsilon, + abs(x.y - y.y) >= epsilon, + abs(x.z - y.z) >= epsilon); +} + +template +inline detail::tvec4 notEqualEpsilon +( + detail::tvec4 const & x, + detail::tvec4 const & y, + valType const & epsilon +) +{ + return detail::tvec4( + abs(x.x - y.x) >= epsilon, + abs(x.y - y.y) >= epsilon, + abs(x.z - y.z) >= epsilon, + abs(x.w - y.w) >= epsilon); +} + +template +inline detail::tvec2 equalEpsilon +( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 const & epsilon +) +{ + return detail::tvec2( + abs(x.x - y.x) < epsilon.x, + abs(x.y - y.y) < epsilon.y); +} + +template +inline detail::tvec3 equalEpsilon +( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 const & epsilon +) +{ + return detail::tvec3( + abs(x.x - y.x) < epsilon.x, + abs(x.y - y.y) < epsilon.y, + abs(x.z - y.z) < epsilon.z); +} + +template +inline detail::tvec4 equalEpsilon +( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 const & epsilon +) +{ + return detail::tvec4( + abs(x.x - y.x) < epsilon.x, + abs(x.y - y.y) < epsilon.y, + abs(x.z - y.z) < epsilon.z, + abs(x.w - y.w) < epsilon.w); +} + +template +inline detail::tvec2 notEqualEpsilon +( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec2 const & epsilon +) +{ + return detail::tvec2( + abs(x.x - y.x) >= epsilon.x, + abs(x.y - y.y) >= epsilon.y); +} + +template +inline detail::tvec3 notEqualEpsilon +( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 const & epsilon +) +{ + return detail::tvec3( + abs(x.x - y.x) >= epsilon.x, + abs(x.y - y.y) >= epsilon.y, + abs(x.z - y.z) >= epsilon.z); +} + +template +inline detail::tvec4 notEqualEpsilon +( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec4 const & epsilon +) +{ + return detail::tvec4( + abs(x.x - y.x) >= epsilon.x, + abs(x.y - y.y) >= epsilon.y, + abs(x.z - y.z) >= epsilon.z, + abs(x.w - y.w) >= epsilon.w); +} + +}//namespace epsilon +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/euler_angles.hpp b/glm/gtx/euler_angles.hpp new file mode 100644 index 0000000..0391045 --- /dev/null +++ b/glm/gtx/euler_angles.hpp @@ -0,0 +1,139 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2007-08-14 +// Licence : This source is under MIT License +// File : glm/gtx/euler_angles.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_double_float +// - GLM_GTC_half_float +/////////////////////////////////////////////////////////////////////////////////////////////////// +// ToDo: +// - mat2 mat2GTX(const vec2& angles) undefined +// - mat3 mat3GTX(const vec2& angles) undefined +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_euler_angles +#define glm_gtx_euler_angles + +// Dependency: +#include "../glm.hpp" +#include "../gtc/double_float.hpp" +#include "../gtc/half_float.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_euler_angles extension: Build matrices from euler angles. + namespace euler_angles + { + //! Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle X. + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleX( + valType const & angleX); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Y. + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleY( + valType const & angleY); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from an euler angle Z. + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleZ( + valType const & angleZ); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Y). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleXY( + valType const & angleX, + valType const & angleY); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleYX( + valType const & angleY, + valType const & angleX); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (X * Z). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleXZ( + valType const & angleX, + valType const & angleZ); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * X). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleZX( + valType const & angleZ, + valType const & angleX); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * Z). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleYZ( + valType const & angleY, + valType const & angleZ); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Z * Y). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleZY( + valType const & angleZ, + valType const & angleY); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 eulerAngleYXZ( + valType const & yaw, + valType const & pitch, + valType const & roll); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 yawPitchRoll( + valType const & yaw, + valType const & pitch, + valType const & roll); + + //! Creates a 2D 2 * 2 rotation matrix from an euler angle. + //! From GLM_GTX_euler_angles extension. + template + detail::tmat2x2 orientate2(T const & angle); + + //! Creates a 2D 4 * 4 homogeneous rotation matrix from an euler angle. + //! From GLM_GTX_euler_angles extension. + template + detail::tmat3x3 orientate3(T const & angle); + + //! Creates a 3D 3 * 3 rotation matrix from euler angles (Y * X * Z). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat3x3 orientate3(detail::tvec3 const & angles); + + //! Creates a 3D 4 * 4 homogeneous rotation matrix from euler angles (Y * X * Z). + //! From GLM_GTX_euler_angles extension. + template + detail::tmat4x4 orientate4(detail::tvec3 const & angles); + }//namespace euler_angles + }//namespace gtx +}//namespace glm + +#define GLM_GTX_euler_angles namespace gtx::euler_angles +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_euler_angles;} +#endif//GLM_GTX_GLOBAL + +#include "euler_angles.inl" + +#endif//glm_gtx_euler_angles diff --git a/glm/gtx/euler_angles.inl b/glm/gtx/euler_angles.inl new file mode 100644 index 0000000..57c51c9 --- /dev/null +++ b/glm/gtx/euler_angles.inl @@ -0,0 +1,249 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2007-08-14 +// Licence : This source is under MIT License +// File : glm/gtx/euler_angles.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace euler_angles{ + +template +inline detail::tmat4x4 eulerAngleX +( + valType const & angleX +) +{ + valType cosX = glm::cos(angleX); + valType sinX = glm::sin(angleX); + + return detail::tmat4x4( + valType(1), valType(0), valType(0), valType(0), + valType(0), cosX, sinX, valType(0), + valType(0),-sinX, cosX, valType(0), + valType(0), valType(0), valType(0), valType(1)); +} + +template +inline detail::tmat4x4 eulerAngleY +( + valType const & angleY +) +{ + valType cosY = glm::cos(angleY); + valType sinY = glm::sin(angleY); + + return detail::tmat4x4( + cosY, valType(0), sinY, valType(0), + valType(0), valType(1), valType(0), valType(0), + -sinY, valType(0), cosY, valType(0), + valType(0), valType(0), valType(0), valType(1)); +} + +template +inline detail::tmat4x4 eulerAngleZ +( + valType const & angleZ +) +{ + valType cosZ = glm::cos(angleZ); + valType sinZ = glm::sin(angleZ); + + return detail::tmat4x4( + cosZ, sinZ, valType(0), valType(0), + -sinZ, cosZ, valType(0), valType(0), + valType(0), valType(0), valType(1), valType(0), + valType(0), valType(0), valType(0), valType(1)); +} + +template +inline detail::tmat4x4 eulerAngleXY +( + valType const & angleX, + valType const & angleY +) +{ + valType cosX = glm::cos(angleX); + valType sinX = glm::sin(angleX); + valType cosY = glm::cos(angleY); + valType sinY = glm::sin(angleY); + + return detail::tmat4x4( + cosY, -sinX * sinY, cosX * sinY, valType(0), + valType(0), cosX, sinX, valType(0), + -sinY , -sinX * cosY, cosX * cosY, valType(0), + valType(0), valType(0), valType(0), valType(1)); +} + +template +inline detail::tmat4x4 eulerAngleYX +( + valType const & angleY, + valType const & angleX +) +{ + valType cosX = glm::cos(angleX); + valType sinX = glm::sin(angleX); + valType cosY = glm::cos(angleY); + valType sinY = glm::sin(angleY); + + return detail::tmat4x4( + cosY, valType(0), sinY, valType(0), + -sinX * sinY, cosX, sinX * cosY, valType(0), + -cosX * sinY, -sinX, cosX * cosY, valType(0), + valType(0), valType(0), valType(0), valType(1)); +} + +template +inline detail::tmat4x4 eulerAngleXZ +( + valType const & angleX, + valType const & angleZ +) +{ + return eulerAngleX(angleX) * eulerAngleZ(angleZ); +} + +template +inline detail::tmat4x4 eulerAngleZX +( + valType const & angleZ, + valType const & angleX +) +{ + return eulerAngleZ(angleZ) * eulerAngleX(angleX); +} + +template +inline detail::tmat4x4 eulerAngleYXZ +( + valType const & yaw, + valType const & pitch, + valType const & roll +) +{ + valType tmp_ch = glm::cos(yaw); + valType tmp_sh = glm::sin(yaw); + valType tmp_cp = glm::cos(pitch); + valType tmp_sp = glm::sin(pitch); + valType tmp_cb = glm::cos(roll); + valType tmp_sb = glm::sin(roll); + + detail::tmat4x4 Result; + Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb; + Result[0][1] = tmp_sb * tmp_cp; + Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb; + Result[0][3] = valType(0); + Result[1][0] = -tmp_ch * tmp_sb + tmp_sh * tmp_sp * tmp_cb; + Result[1][1] = tmp_cb * tmp_cp; + Result[1][2] = tmp_sb * tmp_sh + tmp_ch * tmp_sp * tmp_cb; + Result[1][3] = valType(0); + Result[2][0] = tmp_sh * tmp_cp; + Result[2][1] = -tmp_sp; + Result[2][2] = tmp_ch * tmp_cp; + Result[2][3] = valType(0); + Result[3][0] = valType(0); + Result[3][1] = valType(0); + Result[3][2] = valType(0); + Result[3][3] = valType(1); + return Result; +} + +template +inline detail::tmat4x4 yawPitchRoll +( + valType const & yaw, + valType const & pitch, + valType const & roll +) +{ + valType tmp_ch = glm::cos(yaw); + valType tmp_sh = glm::sin(yaw); + valType tmp_cp = glm::cos(pitch); + valType tmp_sp = glm::sin(pitch); + valType tmp_cb = glm::cos(roll); + valType tmp_sb = glm::sin(roll); + + detail::tmat4x4 Result; + Result[0][0] = tmp_ch * tmp_cb + tmp_sh * tmp_sp * tmp_sb; + Result[0][1] = tmp_sb * tmp_cp; + Result[0][2] = -tmp_sh * tmp_cb + tmp_ch * tmp_sp * tmp_sb; + Result[0][3] = valType(0); + Result[1][0] = -tmp_ch * tmp_sb + tmp_sh * tmp_sp * tmp_cb; + Result[1][1] = tmp_cb * tmp_cp; + Result[1][2] = tmp_sb * tmp_sh + tmp_ch * tmp_sp * tmp_cb; + Result[1][3] = valType(0); + Result[2][0] = tmp_sh * tmp_cp; + Result[2][1] = -tmp_sp; + Result[2][2] = tmp_ch * tmp_cp; + Result[2][3] = valType(0); + Result[3][0] = valType(0); + Result[3][1] = valType(0); + Result[3][2] = valType(0); + Result[3][3] = valType(1); + return Result; +} + +template +inline detail::tmat2x2 orientate2 +( + valType const & angle +) +{ + valType c = glm::cos(angle); + valType s = glm::sin(angle); + + detail::tmat2x2 Result; + Result[0][0] = c; + Result[0][1] = s; + Result[1][0] = -s; + Result[1][1] = c; + return Result; +} + +template +inline detail::tmat3x3 orientate3 +( + valType const & angle +) +{ + valType c = glm::cos(angle); + valType s = glm::sin(angle); + + detail::tmat3x3 Result; + Result[0][0] = c; + Result[0][1] = s; + Result[0][2] = 0.0f; + Result[1][0] = -s; + Result[1][1] = c; + Result[1][2] = 0.0f; + Result[2][0] = 0.0f; + Result[2][1] = 0.0f; + Result[2][2] = 1.0f; + return Result; +} + +template +inline detail::tmat3x3 orientate3 +( + detail::tvec3 const & angles +) +{ + return detail::tmat3x3(yawPitchRoll(angles.x, angles.y, angles.z)); +} + +template +inline detail::tmat4x4 orientate4 +( + detail::tvec3 const & angles +) +{ + return yawPitchRoll(angles.z, angles.x, angles.y); +} + +}//namespace euler_angles +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/extend.hpp b/glm/gtx/extend.hpp new file mode 100644 index 0000000..6cfb22e --- /dev/null +++ b/glm/gtx/extend.hpp @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-07 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/extend.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_extend +#define glm_gtx_extend + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_extend(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_extend extension: Extend a position from a source to a position at a defined length. + namespace extend + { + //! Extends of Length the Origin position using the (Source - Origin) direction. + //! From GLM_GTX_extend extension. + template + genType extend( + genType const & Origin, + genType const & Source, + typename genType::value_type const Length); + + }//namespace extend + }//namespace gtx +}//namespace glm + +#define GLM_GTX_extend namespace gtx::extend +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_extend;} +#endif//GLM_GTX_GLOBAL + +#include "extend.inl" + +#endif//glm_gtx_extend diff --git a/glm/gtx/extend.inl b/glm/gtx/extend.inl new file mode 100644 index 0000000..b45a003 --- /dev/null +++ b/glm/gtx/extend.inl @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-07 +// Updated : 2008-10-05 +// Licence : This source is under MIT License +// File : glm/gtx/extend.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace extend{ + +template +genType extend +( + genType const & Origin, + genType const & Source, + genType const & Distance +) +{ + return Origin + (Source - Origin) * Distance; +} + +template +detail::tvec2 extend +( + detail::tvec2 const & Origin, + detail::tvec2 const & Source, + valType const & Distance +) +{ + return Origin + (Source - Origin) * Distance; +} + +template +detail::tvec3 extend +( + detail::tvec3 const & Origin, + detail::tvec3 const & Source, + valType const & Distance +) +{ + return Origin + (Source - Origin) * Distance; +} + +template +detail::tvec4 extend +( + detail::tvec4 const & Origin, + detail::tvec4 const & Source, + valType const & Distance +) +{ + return Origin + (Source - Origin) * Distance; +} + +}//namespace extend +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/extented_min_max.hpp b/glm/gtx/extented_min_max.hpp new file mode 100644 index 0000000..6b3ac56 --- /dev/null +++ b/glm/gtx/extented_min_max.hpp @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-14 +// Updated : 2007-08-14 +// Licence : This source is under MIT License +// File : gtx_extented_min_max.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_half_float +// - GLM_GTX_double_float +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_extented_min_max +#define glm_gtx_extented_min_max + +// Dependency: +#include "../glm.hpp" +#include "../gtc/half_float.hpp" +#include "../gtc/double_float.hpp" + +namespace glm +{ + namespace test{ + void main_ext_gtx_extented_min_max(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_extented_min_max extension: Min and max functions for 3 to 4 parameters. + namespace extented_min_max + { + template T min(const T x, const T y, const T z); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template T min(const T x, const T y, const T z, const T w); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 min(const detail::tvec2& x, const T y, const T z); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 min(const detail::tvec3& x, const T y, const T z); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 min(const detail::tvec4& x, const T y, const T z); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 min(const detail::tvec2& x, const T y, const T z, const T w); //!< \brief Return the minimum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 min(const detail::tvec3& x, const T y, const T z, const T w); //!< \brief Return the minimum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 min(const detail::tvec4& x, const T y, const T z, const T w); //!< \brief Return the minimum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 min(const detail::tvec2& x, const detail::tvec2& y, const detail::tvec2& z); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 min(const detail::tvec3& x, const detail::tvec3& y, const detail::tvec3& z); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 min(const detail::tvec4& x, const detail::tvec4& y, const detail::tvec4& z); //!< \brief Return the minimum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 min(const detail::tvec2& x, const detail::tvec2& y, const detail::tvec2& z, const detail::tvec2& w); //!< \brief Return the minimum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 min(const detail::tvec3& x, const detail::tvec3& y, const detail::tvec3& z, const detail::tvec3& w); //!< \brief Return the minimum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 min(const detail::tvec4& x, const detail::tvec4& y, const detail::tvec4& z, const detail::tvec4& w); //!< \brief Return the minimum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + + template T max(const T x, const T y, const T z); //!< \brief Return the maximum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template T max(const T x, const T y, const T z, const T w); //!< \brief Return the maximum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 max(const detail::tvec2& x, const T y, const T z); //!< \brief Return the maximum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 max(const detail::tvec3& x, const T y, const T z); //!< \brief Return the maximum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 max(const detail::tvec4& x, const T y, const T z); //!< \brief Return the maximum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 max(const detail::tvec2& x, const T y, const T z, const T w); //!< \brief Return the maximum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 max(const detail::tvec3& x, const T y, const T z, const T w); //!< \brief Return the maximum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 max(const detail::tvec4& x, const T y, const T z, const T w); //!< \brief Return the maximum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 max(const detail::tvec2& x, const detail::tvec2& y, const detail::tvec2& z); //!< \brief Return the maximum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 max(const detail::tvec3& x, const detail::tvec3& y, const detail::tvec3& z); //!< \brief Return the maximum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 max(const detail::tvec4& x, const detail::tvec4& y, const detail::tvec4& z); //!< \brief Return the maximum component-wise values of 3 imputs (From GLM_GTX_extented_min_max extension) + + template detail::tvec2 max(const detail::tvec2& x, const detail::tvec2& y, const detail::tvec2& z, const detail::tvec2& w); //!< \brief Return the maximum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec3 max(const detail::tvec3& x, const detail::tvec3& y, const detail::tvec3& z, const detail::tvec3& w); //!< \brief Return the maximum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + template detail::tvec4 max(const detail::tvec4& x, const detail::tvec4& y, const detail::tvec4& z, const detail::tvec4& w); //!< \brief Return the maximum component-wise values of 4 imputs (From GLM_GTX_extented_min_max extension) + + }//namespace extented_min_max + }//namespace gtx +}//namespace glm + +#define GLM_GTX_extented_min_max namespace gtx::extented_min_max +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_extented_min_max;} +#endif//GLM_GTX_GLOBAL + +#include "extented_min_max.inl" + +#endif//glm_gtx_extented_min_max diff --git a/glm/gtx/extented_min_max.inl b/glm/gtx/extented_min_max.inl new file mode 100644 index 0000000..1625338 --- /dev/null +++ b/glm/gtx/extented_min_max.inl @@ -0,0 +1,282 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-14 +// Updated : 2007-03-14 +// Licence : This source is under MIT License +// File : gtx_extented_min_max.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace extented_min_max +{ + template + inline T min( + const T x, + const T y, + const T z) + { + return min(min(x, y), z); + } + + template + inline T min( + const T x, + const T y, + const T z, + const T w) + { + return min(min(x, y), min(z, w)); + } + + template + inline detail::tvec2 min( + const detail::tvec2& x, + const T y, + const T z) + { + return min(x, min(y, z)); + } + + template + inline detail::tvec3 min( + const detail::tvec3& x, + const T y, + const T z) + { + return min(x, min(y, z)); + } + + template + inline detail::tvec4 min( + const detail::tvec4& x, + const T y, + const T z) + { + return min(x, min(y, z)); + } + + template + inline detail::tvec2 min( + const detail::tvec2& x, + const T y, + const T z, + const T w) + { + return min(x, min(y, min(z, w))); + } + + template + inline detail::tvec3 min( + const detail::tvec3& x, + const T y, + const T z, + const T w) + { + return min(x, min(y, min(z, w))); + } + + template + inline detail::tvec4 min( + const detail::tvec4& x, + const T y, + const T z, + const T w) + { + return min(x, min(y, min(z, w))); + } + + template + inline detail::tvec2 min( + const detail::tvec2& x, + const detail::tvec2& y, + const detail::tvec2& z) + { + return min(x, min(y, z)); + } + + template + inline detail::tvec3 min( + const detail::tvec3& x, + const detail::tvec3& y, + const detail::tvec3& z) + { + return min(x, min(y, z)); + } + + template + inline detail::tvec4 min( + const detail::tvec4& x, + const detail::tvec4& y, + const detail::tvec4& z) + { + return min(x, min(y, z)); + } + + template + inline detail::tvec2 min( + const detail::tvec2& x, + const detail::tvec2& y, + const detail::tvec2& z, + const detail::tvec2& w) + { + return min(min(x, y), min(z, w)); + } + + template + inline detail::tvec3 min( + const detail::tvec3& x, + const detail::tvec3& y, + const detail::tvec3& z, + const detail::tvec3& w) + { + return min(min(x, y), min(z, w)); + } + + template + inline detail::tvec4 min( + const detail::tvec4& x, + const detail::tvec4& y, + const detail::tvec4& z, + const detail::tvec4& w) + { + return min(min(x, y), min(z, w)); + } + + template + inline T max( + const T x, + const T y, + const T z) + { + return max(max(x, y), z); + } + + template + inline T max( + const T x, + const T y, + const T z, + const T w) + { + return max(max(x, y), max(z, w)); + } + + template + inline detail::tvec2 max( + const detail::tvec2& x, + const T y, + const T z) + { + return max(x, max(y, z)); + } + + template + inline detail::tvec3 max( + const detail::tvec3& x, + const T y, + const T z) + { + return max(x, max(y, z)); + } + + template + inline detail::tvec4 max( + const detail::tvec4& x, + const T y, + const T z) + { + return max(x, max(y, z)); + } + + template + inline detail::tvec2 max( + const detail::tvec2& x, + const T y, + const T z, + const T w) + { + return max(max(x, y), max(z, w)); + } + + template + inline detail::tvec3 max( + const detail::tvec3& x, + const T y, + const T z, + const T w) + { + return max(max(x, y), max(z, w)); + } + + template + inline detail::tvec4 max( + const detail::tvec4& x, + const T y, + const T z, + const T w) + { + return max(max(x, y), max(z, w)); + } + + template + inline detail::tvec2 max( + const detail::tvec2& x, + const detail::tvec2& y, + const detail::tvec2& z) + { + return max(max(x, y), z); + } + + template + inline detail::tvec3 max( + const detail::tvec3& x, + const detail::tvec3& y, + const detail::tvec3& z) + { + return max(max(x, y), z); + } + + template + inline detail::tvec4 max( + const detail::tvec4& x, + const detail::tvec4& y, + const detail::tvec4& z) + { + return max(max(x, y), z); + } + + template + inline detail::tvec2 max( + const detail::tvec2& x, + const detail::tvec2& y, + const detail::tvec2& z, + const detail::tvec2& w) + { + return max(max(x, y), max(z, w)); + } + + template + inline detail::tvec3 max( + const detail::tvec3& x, + const detail::tvec3& y, + const detail::tvec3& z, + const detail::tvec3& w) + { + return max(max(x, y), max(z, w)); + } + + template + inline detail::tvec4 max( + const detail::tvec4& x, + const detail::tvec4& y, + const detail::tvec4& z, + const detail::tvec4& w) + { + return max(max(x, y), max(z, w)); + } + +}//namespace extented_min_max +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/fast_exponential.hpp b/glm/gtx/fast_exponential.hpp new file mode 100644 index 0000000..c531f00 --- /dev/null +++ b/glm/gtx/fast_exponential.hpp @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-09 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/fast_exponential.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_half +// - GLM_GTX_double +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_fast_exponential +#define glm_gtx_fast_exponential + +// Dependency: +#include "../glm.hpp" +#include "../gtc/half_float.hpp" +#include "../gtc/double_float.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_fast_exponential(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_fast_exponential extension: Fast but less accurate implementations of exponential based functions. + namespace fast_exponential + { + using namespace gtc::half_float; + using namespace gtc::double_float; + + //! Faster than the common pow function but less accurate. + //! From GLM_GTX_fast_exponential extension. + template + valType fastPow( + valType const & x, + valType const & y); + + //! Faster than the common pow function but less accurate. + //! From GLM_GTX_fast_exponential extension. + template + T fastPow( + const T& x, + const U& y); + + //! Faster than the common exp function but less accurate. + //! From GLM_GTX_fast_exponential extension. + template + T fastExp(const T& x); + + //! Faster than the common log function but less accurate. + //! From GLM_GTX_fast_exponential extension. + template + T fastLog(const T& x); + + //! Faster than the common exp2 function but less accurate. + //! From GLM_GTX_fast_exponential extension. + template + T fastExp2(const T& x); + + //! Faster than the common log2 function but less accurate. + //! From GLM_GTX_fast_exponential extension. + template + T fastLog2(const T& x); + + //! Faster than the common ln function but less accurate. + //! From GLM_GTX_fast_exponential extension. + template + T fastLn(const T& x); + + }//namespace fast_exponential + }//namespace gtx +}//namespace glm + +#define GLM_GTX_fast_exponential namespace gtx::fast_exponential +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_fast_exponential;} +#endif//GLM_GTX_GLOBAL + +#include "fast_exponential.inl" + +#endif//glm_gtx_fast_exponential diff --git a/glm/gtx/fast_exponential.inl b/glm/gtx/fast_exponential.inl new file mode 100644 index 0000000..e5a3a6c --- /dev/null +++ b/glm/gtx/fast_exponential.inl @@ -0,0 +1,294 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-09 +// Updated : 2006-01-09 +// Licence : This source is under MIT License +// File : glm/gtx/fast_exponential.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace fast_exponential +{ + // fastPow: + template + inline T fastPow(const T x, const T y) + { + return exp(y * log(x)); + } + + template + inline detail::tvec2 fastPow( + const detail::tvec2& x, + const detail::tvec2& y) + { + return detail::tvec2( + fastPow(x.x, y.x), + fastPow(x.y, y.y)); + } + + template + inline detail::tvec3 fastPow( + const detail::tvec3& x, + const detail::tvec3& y) + { + return detail::tvec3( + fastPow(x.x, y.x), + fastPow(x.y, y.y), + fastPow(x.z, y.z)); + } + + template + inline detail::tvec4 fastPow( + const detail::tvec4& x, + const detail::tvec4& y) + { + return detail::tvec4( + fastPow(x.x, y.x), + fastPow(x.y, y.y), + fastPow(x.z, y.z), + fastPow(x.w, y.w)); + } + + template + inline T fastPow(const T x, int y) + { + T f = T(1); + for(int i = 0; i < y; ++i) + f *= x; + return f; + } + + template + inline detail::tvec2 fastPow( + const detail::tvec2& x, + const detail::tvec2& y) + { + return detail::tvec2( + fastPow(x.x, y.x), + fastPow(x.y, y.y)); + } + + template + inline detail::tvec3 fastPow( + const detail::tvec3& x, + const detail::tvec3& y) + { + return detail::tvec3( + fastPow(x.x, y.x), + fastPow(x.y, y.y), + fastPow(x.z, y.z)); + } + + template + inline detail::tvec4 fastPow( + const detail::tvec4& x, + const detail::tvec4& y) + { + return detail::tvec4( + fastPow(x.x, y.x), + fastPow(x.y, y.y), + fastPow(x.z, y.z), + fastPow(x.w, y.w)); + } + + // fastExp + // Note: This function provides accurate results only for value between -1 and 1, else avoid it. + template + inline T fastExp(const T x) + { + // This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower. + // return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f)))); + T x2 = x * x; + T x3 = x2 * x; + T x4 = x3 * x; + T x5 = x4 * x; + return T(1) + x + (x2 * T(0.5)) + (x3 * T(0.1666666667)) + (x4 * T(0.041666667)) + (x5 * T(0.008333333333)); + } +/* // Try to handle all values of float... but often shower than std::exp, glm::floor and the loop kill the performance + inline float fastExp(float x) + { + const float e = 2.718281828f; + const float IntegerPart = floor(x); + const float FloatPart = x - IntegerPart; + float z = 1.f; + + for(int i = 0; i < int(IntegerPart); ++i) + z *= e; + + const float x2 = FloatPart * FloatPart; + const float x3 = x2 * FloatPart; + const float x4 = x3 * FloatPart; + const float x5 = x4 * FloatPart; + return z * (1.0f + FloatPart + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)); + } + + // Increase accuracy on number bigger that 1 and smaller than -1 but it's not enough for high and negative numbers + inline float fastExp(float x) + { + // This has a better looking and same performance in release mode than the following code. However, in debug mode it's slower. + // return 1.0f + x * (1.0f + x * 0.5f * (1.0f + x * 0.3333333333f * (1.0f + x * 0.25 * (1.0f + x * 0.2f)))); + float x2 = x * x; + float x3 = x2 * x; + float x4 = x3 * x; + float x5 = x4 * x; + float x6 = x5 * x; + float x7 = x6 * x; + float x8 = x7 * x; + return 1.0f + x + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)+ (x6 * 0.00138888888888f) + (x7 * 0.000198412698f) + (x8 * 0.0000248015873f);; + } +*/ + template + inline detail::tvec2 fastExp( + const detail::tvec2& x) + { + return detail::tvec2( + fastExp(x.x), + fastExp(x.y)); + } + + template + inline detail::tvec3 fastExp( + const detail::tvec3& x) + { + return detail::tvec3( + fastExp(x.x), + fastExp(x.y), + fastExp(x.z)); + } + + template + inline detail::tvec4 fastExp( + const detail::tvec4& x) + { + return detail::tvec4( + fastExp(x.x), + fastExp(x.y), + fastExp(x.z), + fastExp(x.w)); + } + + // fastLog + template + inline T fastLog(const T x) + { + return std::log(x); + } + + /* Slower than the VC7.1 function... + inline float fastLog(float x) + { + float y1 = (x - 1.0f) / (x + 1.0f); + float y2 = y1 * y1; + return 2.0f * y1 * (1.0f + y2 * (0.3333333333f + y2 * (0.2f + y2 * 0.1428571429f))); + } + */ + + template + inline detail::tvec2 fastLog( + const detail::tvec2& x) + { + return detail::tvec2( + fastLog(x.x), + fastLog(x.y)); + } + + template + inline detail::tvec3 fastLog( + const detail::tvec3& x) + { + return detail::tvec3( + fastLog(x.x), + fastLog(x.y), + fastLog(x.z)); + } + + template + inline detail::tvec4 fastLog( + const detail::tvec4& x) + { + return detail::tvec4( + fastLog(x.x), + fastLog(x.y), + fastLog(x.z), + fastLog(x.w)); + } + + //fastExp2, ln2 = 0.69314718055994530941723212145818f + template + inline T fastExp2(const T x) + { + return fastExp(0.69314718055994530941723212145818f * x); + } + + template + inline detail::tvec2 fastExp2( + const detail::tvec2& x) + { + return detail::tvec2( + fastExp2(x.x), + fastExp2(x.y)); + } + + template + inline detail::tvec3 fastExp2( + const detail::tvec3& x) + { + return detail::tvec3( + fastExp2(x.x), + fastExp2(x.y), + fastExp2(x.z)); + } + + template + inline detail::tvec4 fastExp2( + const detail::tvec4& x) + { + return detail::tvec4( + fastExp2(x.x), + fastExp2(x.y), + fastExp2(x.z), + fastExp2(x.w)); + } + + // fastLog2, ln2 = 0.69314718055994530941723212145818f + template + inline T fastLog2(const T x) + { + return fastLog(x) / 0.69314718055994530941723212145818f; + } + + template + inline detail::tvec2 fastLog2( + const detail::tvec2& x) + { + return detail::tvec2( + fastLog2(x.x), + fastLog2(x.y)); + } + + template + inline detail::tvec3 fastLog2( + const detail::tvec3& x) + { + return detail::tvec3( + fastLog2(x.x), + fastLog2(x.y), + fastLog2(x.z)); + } + + template + inline detail::tvec4 fastLog2( + const detail::tvec4& x) + { + return detail::tvec4( + fastLog2(x.x), + fastLog2(x.y), + fastLog2(x.z), + fastLog2(x.w)); + } + +}//namespace fast_exponential +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/fast_square_root.hpp b/glm/gtx/fast_square_root.hpp new file mode 100644 index 0000000..f4e3730 --- /dev/null +++ b/glm/gtx/fast_square_root.hpp @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-04 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/fast_square_root.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Note: +// - Sqrt optimisation based on Newton's method, +// www.gamedev.net/community/forums/topic.asp?topic id=139956 +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_fast_square_root +#define glm_gtx_fast_square_root + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_fast_square_root(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_fast_square_root extension: Fast but less accurate implementations of square root based functions. + namespace fast_square_root + { + //! Faster than the common sqrt function but less accurate. + //! From GLM_GTX_fast_square_root extension. + template + genType fastSqrt(genType const & x); + + //! Faster than the common inversesqrt function but less accurate. + //! From GLM_GTX_fast_square_root extension. + template + genType fastInverseSqrt(genType const & x); + + //! Faster than the common length function but less accurate. + //! From GLM_GTX_fast_square_root extension. + template + typename genType::value_type fastLength(genType const & x); + + //! Faster than the common distance function but less accurate. + //! From GLM_GTX_fast_square_root extension. + template + typename genType::value_type fastDistance(genType const & x, genType const & y); + + //! Faster than the common normalize function but less accurate. + //! From GLM_GTX_fast_square_root extension. + template + genType fastNormalize(genType const & x); + + }//namespace fast_square_root + }// namespace gtx +}//namespace glm + +#define GLM_GTX_fast_square_root namespace gtx::fast_square_root +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_fast_square_root;} +#endif//GLM_GTX_GLOBAL + +#include "fast_square_root.inl" + +#endif//glm_gtx_fast_square_root diff --git a/glm/gtx/fast_square_root.inl b/glm/gtx/fast_square_root.inl new file mode 100644 index 0000000..0e8be94 --- /dev/null +++ b/glm/gtx/fast_square_root.inl @@ -0,0 +1,237 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-04 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/fast_square_root.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace fast_square_root{ + +// fastSqrt +template +inline genType fastSqrt +( + genType const & x +) +{ + return genType(1) / fastInverseSqrt(x); +} + +template +inline detail::tvec2 fastSqrt +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + fastSqrt(x.x), + fastSqrt(x.y)); +} + +template +inline detail::tvec3 fastSqrt +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + fastSqrt(x.x), + fastSqrt(x.y), + fastSqrt(x.z)); +} + +template +inline detail::tvec4 fastSqrt +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + fastSqrt(x.x), + fastSqrt(x.y), + fastSqrt(x.z), + fastSqrt(x.w)); +} + +// fastInversesqrt +template +inline genType fastInverseSqrt +( + genType const & x +) +{ + genType tmp = x; + float xhalf = 0.5f * float(tmp); + uint i = *(uint*)&x; + i = 0x5f375a86 - (i >> 1); + //x = *(float*)&i; + //x = *((float*)(char*)&i); + tmp = detail::uif(i).f; + tmp = tmp * (1.5f - xhalf * tmp * tmp); + return genType(tmp); +} + +template +inline detail::tvec2 fastInverseSqrt +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + fastInverseSqrt(x.x), + fastInverseSqrt(x.y)); +} + +template +inline detail::tvec3 fastInverseSqrt +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + fastInverseSqrt(x.x), + fastInverseSqrt(x.y), + fastInverseSqrt(x.z)); +} + +template +inline detail::tvec4 fastInverseSqrt +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + fastInverseSqrt(x.x), + fastInverseSqrt(x.y), + fastInverseSqrt(x.z), + fastInverseSqrt(x.w)); +} + +// fastLength +template +inline genType fastLength +( + genType const & x +) +{ + return abs(x); +} + +template +inline valType fastLength +( + detail::tvec2 const & x +) +{ + valType sqr = x.x * x.x + x.y * x.y; + return fastSqrt(sqr); +} + +template +inline valType fastLength +( + detail::tvec3 const & x +) +{ + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; + return fastSqrt(sqr); +} + +template +inline valType fastLength +( + detail::tvec4 const & x +) +{ + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + return fastSqrt(sqr); +} + +// fastDistance +template +inline genType fastDistance +( + genType const & x, + genType const & y +) +{ + return fastLength(y - x); +} + +template +inline valType fastDistance +( + detail::tvec2 const & x, + detail::tvec2 const & y +) +{ + return fastLength(y - x); +} + +template +inline valType fastDistance +( + detail::tvec3 const & x, + detail::tvec3 const & y +) +{ + return fastLength(y - x); +} + +template +inline valType fastDistance +( + detail::tvec4 const & x, + detail::tvec4 const & y +) +{ + return fastLength(y - x); +} + +// fastNormalize +template +inline genType fastNormalize +( + genType const & x +) +{ + return x > genType(0) ? genType(1) : -genType(1); +} + +template +inline detail::tvec2 fastNormalize +( + detail::tvec2 const & x +) +{ + valType sqr = x.x * x.x + x.y * x.y; + return x * fastInverseSqrt(sqr); +} + +template +inline detail::tvec3 fastNormalize +( + detail::tvec3 const & x +) +{ + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; + return x * fastInverseSqrt(sqr); +} + +template +inline detail::tvec4 fastNormalize +( + detail::tvec4 const & x +) +{ + valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; + return x * fastInverseSqrt(sqr); +} + +}//namespace fast_square_root +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/fast_trigonometry.hpp b/glm/gtx/fast_trigonometry.hpp new file mode 100644 index 0000000..18119b5 --- /dev/null +++ b/glm/gtx/fast_trigonometry.hpp @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-08 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/fast_trigonometry.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_fast_trigonometry +#define glm_gtx_fast_trigonometry + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_fast_trigonometry(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_fast_trigonometry extension: Fast but less accurate implementations of trigonometric functions. + namespace fast_trigonometry + { + //! Faster than the common sin function but less accurate. + //! Defined between -2pi and 2pi. + //! From GLM_GTX_fast_trigonometry extension. + template + T fastSin(const T& angle); + + //! Faster than the common cos function but less accurate. + //! Defined between -2pi and 2pi. + //! From GLM_GTX_fast_trigonometry extension. + template + T fastCos(const T& angle); + + //! Faster than the common tan function but less accurate. + //! Defined between -2pi and 2pi. + //! From GLM_GTX_fast_trigonometry extension. + template + T fastTan(const T& angle); + + //! Faster than the common asin function but less accurate. + //! Defined between -2pi and 2pi. + //! From GLM_GTX_fast_trigonometry extension. + template + T fastAsin(const T& angle); + + //! Faster than the common acos function but less accurate. + //! Defined between -2pi and 2pi. + //! From GLM_GTX_fast_trigonometry extension. + template + T fastAcos(const T& angle); + + //! Faster than the common atan function but less accurate. + //! Defined between -2pi and 2pi. + //! From GLM_GTX_fast_trigonometry extension. + template + T fastAtan(const T& y, const T& x); + + //! Faster than the common atan function but less accurate. + //! Defined between -2pi and 2pi. + //! From GLM_GTX_fast_trigonometry extension. + template + T fastAtan(const T& angle); + + }//namespace fast_trigonometry + }//namespace gtx +}//namespace glm + +#define GLM_GTX_fast_trigonometry namespace gtx::fast_trigonometry +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_fast_trigonometry;} +#endif//GLM_GTX_GLOBAL + +#include "fast_trigonometry.inl" + +#endif//glm_gtx_fast_trigonometry diff --git a/glm/gtx/fast_trigonometry.inl b/glm/gtx/fast_trigonometry.inl new file mode 100644 index 0000000..9ed1181 --- /dev/null +++ b/glm/gtx/fast_trigonometry.inl @@ -0,0 +1,272 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-08 +// Updated : 2006-01-08 +// Licence : This source is under MIT License +// File : glm/gtx/fast_trigonometry.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace fast_trigonometry +{ + // sin + template + inline T fastSin(const T x) + { + return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040)); + } + + template + inline detail::tvec2 fastSin( + const detail::tvec2& x) + { + return detail::tvec2( + fastSin(x.x), + fastSin(x.y)); + } + + template + inline detail::tvec3 fastSin( + const detail::tvec3& x) + { + return detail::tvec3( + fastSin(x.x), + fastSin(x.y), + fastSin(x.z)); + } + + template + inline detail::tvec4 fastSin( + const detail::tvec4& x) + { + return detail::tvec4( + fastSin(x.x), + fastSin(x.y), + fastSin(x.z), + fastSin(x.w)); + } + + // cos + template + inline T fastCos(const T x) + { + return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888)); + } + + template + inline detail::tvec2 fastCos( + const detail::tvec2& x) + { + return detail::tvec2( + fastCos(x.x), + fastCos(x.y)); + } + + template + inline detail::tvec3 fastCos( + const detail::tvec3& x) + { + return detail::tvec3( + fastCos(x.x), + fastCos(x.y), + fastCos(x.z)); + } + + template + inline detail::tvec4 fastCos( + const detail::tvec4& x) + { + return detail::tvec4( + fastCos(x.x), + fastCos(x.y), + fastCos(x.z), + fastCos(x.w)); + } + + // tan + template + inline T fastTan(const T x) + { + return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539)); + } + + template + inline detail::tvec2 fastTan( + const detail::tvec2& x) + { + return detail::tvec2( + fastTan(x.x), + fastTan(x.y)); + } + + template + inline detail::tvec3 fastTan( + const detail::tvec3& x) + { + return detail::tvec3( + fastTan(x.x), + fastTan(x.y), + fastTan(x.z)); + } + + template + inline detail::tvec4 fastTan( + const detail::tvec4& x) + { + return detail::tvec4( + fastTan(x.x), + fastTan(x.y), + fastTan(x.z), + fastTan(x.w)); + } + + // asin + template + inline T fastAsin(const T x) + { + return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159)); + } + + template detail::tvec2 fastAsin( + const detail::tvec2& x) + { + return detail::tvec2( + fastAsin(x.x), + fastAsin(x.y)); + } + + template detail::tvec3 fastAsin( + const detail::tvec3& x) + { + return detail::tvec3( + fastAsin(x.x), + fastAsin(x.y), + fastAsin(x.z)); + } + + template detail::tvec4 fastAsin( + const detail::tvec4& x) + { + return detail::tvec4( + fastAsin(x.x), + fastAsin(x.y), + fastAsin(x.z), + fastAsin(x.w)); + } + + // acos + template + inline T fastAcos(const T x) + { + return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2) + } + + template detail::tvec2 fastAcos( + const detail::tvec2& x) + { + return detail::tvec2( + fastAcos(x.x), + fastAcos(x.y)); + } + + template detail::tvec3 fastAcos( + const detail::tvec3& x) + { + return detail::tvec3( + fastAcos(x.x), + fastAcos(x.y), + fastAcos(x.z)); + } + + template detail::tvec4 fastAcos( + const detail::tvec4& x) + { + return detail::tvec4( + fastAcos(x.x), + fastAcos(x.y), + fastAcos(x.z), + fastAcos(x.w)); + } + + // atan + template + inline T fastAtan(const T y, const T x) + { + T sgn = sign(y) * sign(x); + return abs(fastAtan(y / x)) * sgn; + } + + template + inline detail::tvec2 fastAtan( + const detail::tvec2& y, + const detail::tvec2& x) + { + return detail::tvec2( + fastAtan(y.x, x.x), + fastAtan(y.y, x.y)); + } + + template + inline detail::tvec3 fastAtan( + const detail::tvec3& y, + const detail::tvec3& x) + { + return detail::tvec3( + fastAtan(y.x, x.x), + fastAtan(y.y, x.y), + fastAtan(y.z, x.z)); + } + + template + inline detail::tvec4 fastAtan( + const detail::tvec4& y, + const detail::tvec4& x) + { + return detail::tvec4( + fastAtan(y.x, x.x), + fastAtan(y.y, x.y), + fastAtan(y.z, x.z), + fastAtan(y.w, x.w)); + } + + template + inline T fastAtan(const T x) + { + return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909)); + } + + template + inline detail::tvec2 fastAtan( + const detail::tvec2& x) + { + return detail::tvec2( + fastAtan(x.x), + fastAtan(x.y)); + } + + template + inline detail::tvec3 fastAtan( + const detail::tvec3& x) + { + return detail::tvec3( + fastAtan(x.x), + fastAtan(x.y), + fastAtan(x.z)); + } + + template + inline detail::tvec4 fastAtan( + const detail::tvec4& x) + { + return detail::tvec4( + fastAtan(x.x), + fastAtan(x.y), + fastAtan(x.z), + fastAtan(x.w)); + } + +}//namespace fast_trigonometry +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/flexible_mix.inl b/glm/gtx/flexible_mix.inl new file mode 100644 index 0000000..99782bd --- /dev/null +++ b/glm/gtx/flexible_mix.inl @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-09-21 +// Updated : 2007-09-21 +// Licence : This source is under MIT licence +// File : glm/gtx/flexible_mix.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + // mix + template + inline T mixGTX(T x, T y, U a) + { + //GLM_STATIC_ASSERT(detail::traits::is_float); + //return T(x * (U(1) - a) + y * a); + return T(x + a * (y - x)); + } + + template + inline detail::tvec2 mixGTX(const detail::tvec2& x, const detail::tvec2& y, U a) + { + return detail::tvec2(detail::tvec2(x) * (U(1) - a) + detail::tvec2(y) * a); + //return x * (U(1) - a) + y * a; + } + + template + inline detail::tvec3 mixGTX(const detail::tvec3& x, const detail::tvec3& y, U a) + { + return detail::tvec3(detail::tvec3(x) * (U(1) - a) + detail::tvec3(y) * a); + //return x * (U(1) - a) + y * a; + //return mix(x, y, tvec3(a)); + } + + template + inline detail::tvec4 mixGTX(const detail::tvec4& x, const detail::tvec4& y, U a) + { + return detail::tvec4(detail::tvec4(x) * (U(1) - a) + detail::tvec4(y) * a); + //return x * (U(1) - a) + y * a; + } + + template + inline detail::tvec2 mixGTX(const detail::tvec2& x, const detail::tvec2& y, const detail::tvec2& a) + { + return detail::tvec2(detail::tvec2(x) * (U(1) - a) + detail::tvec2(y) * a); + } + + template + inline detail::tvec3 mixGTX(const detail::tvec3& x, const detail::tvec3& y, const detail::tvec3& a) + { + return detail::tvec3(detail::tvec3(x) * (U(1) - a) + detail::tvec3(y) * a); + } + + template + inline detail::tvec4 mixGTX(const detail::tvec4& x, const detail::tvec4& y, const detail::tvec4& a) + { + return detail::tvec4(detail::tvec4(x) * (U(1) - a) + detail::tvec4(y) * a); + } +} diff --git a/glm/gtx/gradient_paint.hpp b/glm/gtx/gradient_paint.hpp new file mode 100644 index 0000000..39f2dea --- /dev/null +++ b/glm/gtx/gradient_paint.hpp @@ -0,0 +1,56 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-03-06 +// Updated : 2009-03-09 +// Licence : This source is under MIT License +// File : glm/gtx/gradient_paint.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_gradient_paint +#define glm_gtx_gradient_paint + +// Dependency: +#include "../glm.hpp" +#include "../gtx/optimum_pow.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_gradient_paint(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_gradient_paint extension: Compute a radient gradient according section OpenVG 1.1 specifications, 9.3.2 Radial Gradients + namespace gradient_paint + { + using namespace gtx::optimum_pow; + + template + valType radialGradient( + glm::detail::tvec2 const & Center, + valType const & Radius, + glm::detail::tvec2 const & Focal, + glm::detail::tvec2 const & Position); + + template + valType linearGradient( + glm::detail::tvec2 const & Point0, + glm::detail::tvec2 const & Point1, + glm::detail::tvec2 const & Position); + + }//namespace gradient_paint + }//namespace gtx +}//namespace glm + +#define GLM_GTX_gradient_paint namespace gtx::gradient_paint +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_gradient_paint;} +#endif//GLM_GTX_GLOBAL + +#include "gradient_paint.inl" + +#endif//glm_gtx_gradient_paint diff --git a/glm/gtx/gradient_paint.inl b/glm/gtx/gradient_paint.inl new file mode 100644 index 0000000..c9750c6 --- /dev/null +++ b/glm/gtx/gradient_paint.inl @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-03-06 +// Updated : 2009-03-09 +// Licence : This source is under MIT License +// File : glm/gtx/gradient_paint.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace gradient_paint{ + + template + valType radialGradient( + glm::detail::tvec2 const & Center, + valType const & Radius, + glm::detail::tvec2 const & Focal, + glm::detail::tvec2 const & Position) + { + glm::detail::tvec2 F = Focal - Center; + glm::detail::tvec2 D = Position - Focal; + valType Radius2 = gtx::optimum_pow::pow2(Radius); + valType Fx2 = gtx::optimum_pow::pow2(F.x); + valType Fy2 = gtx::optimum_pow::pow2(F.y); + + valType Numerator = (D.x * F.x + D.y * F.y) + glm::sqrt(Radius2 * (gtx::optimum_pow::pow2(D.x) + gtx::optimum_pow::pow2(D.y)) - gtx::optimum_pow::pow2(D.x * F.y - D.y * F.x)); + valType Denominator = Radius2 - (Fx2 + Fy2); + return Numerator / Denominator; + } + + template + valType linearGradient( + glm::detail::tvec2 const & Point0, + glm::detail::tvec2 const & Point1, + glm::detail::tvec2 const & Position) + { + glm::detail::tvec2 Dist = Point1 - Point0; + return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); + } + +}//namespace gradient_paint +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/half_float.hpp b/glm/gtx/half_float.hpp new file mode 100644 index 0000000..097e136 --- /dev/null +++ b/glm/gtx/half_float.hpp @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtx/half_float.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_half_float +// - GLM_GTX_quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_half_float +#define glm_gtx_half_float + +// Dependency: +#include "../glm.hpp" +#include "../gtc/half_float.hpp" +#include "../gtx/quaternion.hpp" + +namespace glm +{ + namespace test{ + void main_ext_gtx_half_float(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_half_float extension: Add support for half precision flotting-point types + namespace half_float + { + //! Quaternion of half-precision floating-point numbers. + //! From GLM_GTX_half_float extension. + typedef detail::tquat hquat; + + }//namespace half_float + }//namespace gtx +}//namespace glm + +#define GLM_GTX_half_float namespace gtc::half_float; using namespace gtx::half_float; using namespace gtx::quaternion +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_half_float;} +#endif//GLM_GTX_GLOBAL + +#include "half_float.inl" + +#endif//glm_gtx_half_float diff --git a/glm/gtx/half_float.inl b/glm/gtx/half_float.inl new file mode 100644 index 0000000..2ca386e --- /dev/null +++ b/glm/gtx/half_float.inl @@ -0,0 +1,16 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-10-02 +// Licence : This source is under MIT License +// File : glm/gtx/half.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail{ + + + +}//namespace detail +}//namespace glm diff --git a/glm/gtx/handed_coordinate_space.hpp b/glm/gtx/handed_coordinate_space.hpp new file mode 100644 index 0000000..293ac58 --- /dev/null +++ b/glm/gtx/handed_coordinate_space.hpp @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/handed_coordinate_space.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_handed_coordinate_space +#define glm_gtx_handed_coordinate_space + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_handed_coordinate_space extension: To know if a triedron is right or left handed + namespace handed_coordinate_space + { + //! Return if a trihedron right handed or not. + //! From GLM_GTX_handed_coordinate_space extension. + template + bool rightHanded( + detail::tvec3 const & tangent, + detail::tvec3 const & binormal, + detail::tvec3 const & normal); + + //! Return if a trihedron left handed or not. + //! From GLM_GTX_handed_coordinate_space extension. + template + bool leftHanded( + detail::tvec3 const & tangent, + detail::tvec3 const & binormal, + detail::tvec3 const & normal); + + }//namespace handed_coordinate_space + }//namespace gtx +}//namespace glm + +#define GLM_GTX_handed_coordinate_space namespace gtx::handed_coordinate_space +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_handed_coordinate_space;} +#endif//GLM_GTX_GLOBAL + +#include "handed_coordinate_space.inl" + +#endif//glm_gtx_handed_coordinate_space diff --git a/glm/gtx/handed_coordinate_space.inl b/glm/gtx/handed_coordinate_space.inl new file mode 100644 index 0000000..3e447d6 --- /dev/null +++ b/glm/gtx/handed_coordinate_space.inl @@ -0,0 +1,34 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/handed_coordinate_space.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace handed_coordinate_space +{ + template + inline bool rightHanded( + detail::tvec3 const & tangent, + detail::tvec3 const & binormal, + detail::tvec3 const & normal) + { + return dot(cross(normal, tangent), binormal) > T(0); + } + + template + inline bool leftHanded( + detail::tvec3 const & tangent, + detail::tvec3 const & binormal, + detail::tvec3 const & normal) + { + return dot(cross(normal, tangent), binormal) < T(0); + } + +}//namespace handed_coordinate_space +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/inertia.hpp b/glm/gtx/inertia.hpp new file mode 100644 index 0000000..588bbb2 --- /dev/null +++ b/glm/gtx/inertia.hpp @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-21 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/inertia.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_inertia +#define glm_gtx_inertia + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_inertia extension: Create inertia matrices + namespace inertia + { + //! Build an inertia matrix for a box. + //! From GLM_GTX_inertia extension. + template + detail::tmat3x3 boxInertia3( + const T Mass, + const detail::tvec3& Scale); + + //! Build an inertia matrix for a box. + //! From GLM_GTX_inertia extension. + template + detail::tmat4x4 boxInertia4( + const T Mass, + const detail::tvec3& Scale); + + //! Build an inertia matrix for a disk. + //! From GLM_GTX_inertia extension. + template + detail::tmat3x3 diskInertia3( + const T Mass, + const T Radius); + + //! Build an inertia matrix for a disk. + //! From GLM_GTX_inertia extension. + template + detail::tmat4x4 diskInertia4( + const T Mass, + const T Radius); + + //! Build an inertia matrix for a ball. + //! From GLM_GTX_inertia extension. + template + detail::tmat3x3 ballInertia3( + const T Mass, + const T Radius); + + //! Build an inertia matrix for a ball. + //! From GLM_GTX_inertia extension. + template + detail::tmat4x4 ballInertia4( + const T Mass, + const T Radius); + + //! Build an inertia matrix for a sphere. + //! From GLM_GTX_inertia extension. + template + detail::tmat3x3 sphereInertia3( + const T Mass, + const T Radius); + + //! Build an inertia matrix for a sphere. + //! From GLM_GTX_inertia extension. + template + detail::tmat4x4 sphereInertia4( + const T Mass, + const T Radius); + + }//namespace inertia + }//namespace gtx +}//namespace glm + +#define GLM_GTX_inertia namespace gtx::inertia +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_inertia;} +#endif//GLM_GTX_GLOBAL + +#include "inertia.inl" + +#endif//glm_gtx_inertia diff --git a/glm/gtx/inertia.inl b/glm/gtx/inertia.inl new file mode 100644 index 0000000..1c7a290 --- /dev/null +++ b/glm/gtx/inertia.inl @@ -0,0 +1,103 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-21 +// Updated : 2006-12-06 +// Licence : This source is under MIT License +// File : glm/gtx/inertia.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace inertia{ + + template + inline detail::tmat3x3 boxInertia3( + const T Mass, + const detail::tvec3& Scale) + { + detail::tmat3x3 Result(T(1)); + Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12); + Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12); + Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12); + return Result; + } + + template + inline detail::tmat4x4 boxInertia4( + const T Mass, + const detail::tvec3& Scale) + { + detail::tmat4x4 Result(T(1)); + Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12); + Result[1][1] = (Scale.x * Scale.x + Scale.z * Scale.z) * Mass / T(12); + Result[2][2] = (Scale.x * Scale.x + Scale.y * Scale.y) * Mass / T(12); + return Result; + } + + template + inline detail::tmat3x3 diskInertia3( + const T Mass, + const T Radius) + { + T a = Mass * Radius * Radius / T(2); + detail::tmat3x3 Result(a); + Result[2][2] *= T(2); + return Result; + } + + template + inline detail::tmat4x4 diskInertia4( + const T Mass, + const T Radius) + { + T a = Mass * Radius * Radius / T(2); + detail::tmat4x4 Result(a); + Result[2][2] *= T(2); + Result[3][3] = T(1); + return Result; + } + + template + inline detail::tmat3x3 ballInertia3( + const T Mass, + const T Radius) + { + T a = T(2) * Mass * Radius * Radius / T(5); + return detail::tmat3x3(a); + } + + template + inline detail::tmat4x4 ballInertia4( + const T Mass, + const T Radius) + { + T a = T(2) * Mass * Radius * Radius / T(5); + detail::tmat4x4 Result(a); + Result[3][3] = T(1); + return Result; + } + + template + inline detail::tmat3x3 sphereInertia3( + const T Mass, + const T Radius) + { + T a = T(2) * Mass * Radius * Radius / T(3); + return detail::tmat3x3(a); + } + + template + inline detail::tmat4x4 sphereInertia4( + const T Mass, + const T Radius) + { + T a = T(2) * Mass * Radius * Radius / T(3); + detail::tmat4x4 Result(a); + Result[3][3] = T(1); + return Result; + } + +}//namespace inertia +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/integer.hpp b/glm/gtx/integer.hpp new file mode 100644 index 0000000..17bc037 --- /dev/null +++ b/glm/gtx/integer.hpp @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-24 +// Updated : 2006-11-14 +// Licence : This source is under MIT License +// File : glm/gtx/integer.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_integer +#define glm_gtx_integer + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_integer extension: Add support for integer for core functions + namespace integer + { + //! Returns x raised to the y power. + //! From GLM_GTX_integer extension. + int pow(int x, int y); + + //! Returns the positive square root of x. + //! From GLM_GTX_integer extension. + int sqrt(int x); + + //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. + //! From GLM_GTX_integer extension. + int mod(int x, int y); + + //! Return the factorial value of a number (!12 max, integer only) + //! From GLM_GTX_integer extension. + template + genType factorial(genType const & x); + + }//namespace integer + }//namespace gtx +}//namespace glm + +#define GLM_GTX_integer namespace gtx::integer +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_integer;} +#endif//GLM_GTX_GLOBAL + +#include "integer.inl" + +#endif//glm_gtx_integer diff --git a/glm/gtx/integer.inl b/glm/gtx/integer.inl new file mode 100644 index 0000000..ad8bad4 --- /dev/null +++ b/glm/gtx/integer.inl @@ -0,0 +1,90 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-24 +// Updated : 2006-12-06 +// Licence : This source is under MIT License +// File : glm/gtx/integer.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace integer +{ + // pow + inline int pow(int x, int y) + { + if(y == 0) + return 1; + int result = x; + for(int i = 1; i < y; ++i) + result *= x; + return result; + } + + // sqrt: From Christopher J. Musial, An integer square root, Graphics Gems, 1990, page 387 + inline int sqrt(int x) + { + if(x <= 1) return x; + + int NextTrial = x >> 1; + int CurrentAnswer; + + do + { + CurrentAnswer = NextTrial; + NextTrial = (NextTrial + x / NextTrial) >> 1; + } while(NextTrial < CurrentAnswer); + + return CurrentAnswer; + } + + // mod + inline int mod(int x, int y) + { + return x - y * (x / y); + } + + // factorial (!12 max, integer only) + template + inline genType factorial(genType const & x) + { + genType Result; + for(Result = 1; x > 1; --x) + Result *= x; + return Result; + } + + template + inline detail::tvec2 factorial( + detail::tvec2 const & x) + { + return detail::tvec2( + factorial(x.x), + factorial(x.y)); + } + + template + inline detail::tvec3 factorial( + detail::tvec3 const & x) + { + return detail::tvec3( + factorial(x.x), + factorial(x.y), + factorial(x.z)); + } + + template + inline detail::tvec4 factorial( + detail::tvec4 const & x) + { + return detail::tvec4( + factorial(x.x), + factorial(x.y), + factorial(x.z), + factorial(x.w)); + } + +}//namespace integer +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/intersect.hpp b/glm/gtx/intersect.hpp new file mode 100644 index 0000000..1dfcefa --- /dev/null +++ b/glm/gtx/intersect.hpp @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-04-03 +// Updated : 2009-01-20 +// Licence : This source is under MIT License +// File : glm/gtx/intersect.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_closest_point +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_intersect +#define glm_gtx_intersect + +// Dependency: +#include "../glm.hpp" +#include "../gtx/closest_point.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_intesect(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_intersect extension: Add intersection functions + namespace intersect + { + //! Compute the intersection of a ray and a triangle. + //! From GLM_GTX_intersect extension. + template + bool intersectRayTriangle( + genType const & orig, genType const & dir, + genType const & vert0, genType const & vert1, genType const & vert2, + genType & baryPosition); + + //! Compute the intersection of a line and a triangle. + //! From GLM_GTX_intersect extension. + template + bool intersectLineTriangle( + genType const & orig, genType const & dir, + genType const & vert0, genType const & vert1, genType const & vert2, + genType & position); + + //! Compute the intersection of a ray and a sphere. + //! From GLM_GTX_intersect extension. + template + bool intersectRaySphere( + genType const & orig, genType const & dir, + genType const & center, typename genType::value_type radius, + genType & position, genType & normal); + + //! Compute the intersection of a line and a sphere. + //! From GLM_GTX_intersect extension + template + bool intersectLineSphere( + genType const & point0, genType const & point1, + genType const & center, typename genType::value_type radius, + genType & position, genType & normal); + + }//namespace intersect +}//namespace gtx +}//namespace glm + +#define GLM_GTX_intersect namespace gtx::intersect +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_intersect;} +#endif//GLM_GTX_GLOBAL + +#include "intersect.inl" + +#endif//glm_gtx_intersect diff --git a/glm/gtx/intersect.inl b/glm/gtx/intersect.inl new file mode 100644 index 0000000..439ecc0 --- /dev/null +++ b/glm/gtx/intersect.inl @@ -0,0 +1,201 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-04-03 +// Updated : 2009-01-20 +// Licence : This source is under MIT licence +// File : glm/gtx/intersect.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +namespace glm{ +namespace gtx{ +namespace intersect{ + +template +inline bool intersectRayTriangle +( + genType const & orig, genType const & dir, + genType const & v0, genType const & v1, genType const & v2, + genType & baryPosition +) +{ + genType e1 = v1 - v0; + genType e2 = v2 - v0; + + genType p = glm::cross(dir, e2); + + typename genType::value_type a = glm::dot(e1, p); + + typename genType::value_type Epsilon = std::numeric_limits::epsilon(); + if(a < Epsilon) + return false; + + typename genType::value_type f = typename genType::value_type(1.0f) / a; + + genType s = orig - v0; + baryPosition.x = f * glm::dot(s, p); + if(baryPosition.x < typename genType::value_type(0.0f)) + return false; + if(baryPosition.x > typename genType::value_type(1.0f)) + return false; + + genType q = glm::cross(s, e1); + baryPosition.y = f * glm::dot(dir, q); + if(baryPosition.y < typename genType::value_type(0.0f)) + return false; + if(baryPosition.y + baryPosition.x > typename genType::value_type(1.0f)) + return false; + + baryPosition.z = f * glm::dot(e2, q); + + return baryPosition.z >= typename genType::value_type(0.0f); +} + +//template +//inline bool intersectRayTriangle +//( +// genType const & orig, genType const & dir, +// genType const & vert0, genType const & vert1, genType const & vert2, +// genType & position +//) +//{ +// typename genType::value_type Epsilon = std::numeric_limits::epsilon(); +// +// genType edge1 = vert1 - vert0; +// genType edge2 = vert2 - vert0; +// +// genType pvec = cross(dir, edge2); +// +// float det = dot(edge1, pvec); +// if(det < Epsilon) +// return false; +// +// genType tvec = orig - vert0; +// +// position.y = dot(tvec, pvec); +// if (position.y < typename genType::value_type(0) || position.y > det) +// return typename genType::value_type(0); +// +// genType qvec = cross(tvec, edge1); +// +// position.z = dot(dir, qvec); +// if (position.z < typename genType::value_type(0) || position.y + position.z > det) +// return typename genType::value_type(0); +// +// position.x = dot(edge2, qvec); +// position *= typename genType::value_type(1) / det; +// +// return typename genType::value_type(1); +//} + +template +inline bool intersectLineTriangle +( + genType const & orig, genType const & dir, + genType const & vert0, genType const & vert1, genType const & vert2, + genType & position +) +{ + typename genType::value_type Epsilon = std::numeric_limits::epsilon(); + + genType edge1 = vert1 - vert0; + genType edge2 = vert2 - vert0; + + genType pvec = cross(dir, edge2); + + float det = dot(edge1, pvec); + + if (det > -Epsilon && det < Epsilon) + return false; + float inv_det = typename genType::value_type(1) / det; + + genType tvec = orig - vert0; + + position.y = dot(tvec, pvec) * inv_det; + if (position.y < typename genType::value_type(0) || position.y > typename genType::value_type(1)) + return false; + + genType qvec = cross(tvec, edge1); + + position.z = dot(dir, qvec) * inv_det; + if (position.z < typename genType::value_type(0) || position.y + position.z > typename genType::value_type(1)) + return false; + + position.x = dot(edge2, qvec) * inv_det; + + return true; +} + +template +inline bool intersectRaySphere +( + genType const & rayStarting, genType const & rayDirection, + genType const & sphereCenter, typename genType::value_type sphereRadius, + genType & position, genType & normal +) +{ + typename genType::value_type Epsilon = std::numeric_limits::epsilon(); + + typename genType::value_type a = dot(rayDirection, rayDirection); + typename genType::value_type b = typename genType::value_type(2) * dot(rayStarting, rayDirection); + typename genType::value_type c = dot(rayStarting, rayStarting) - sphereRadius * sphereRadius; + typename genType::value_type d = b * b - typename genType::value_type(4) * a * c; + typename genType::value_type e = sqrt(d); + typename genType::value_type x1 = (-b - e) / (typename genType::value_type(2) * a); + typename genType::value_type x2 = (-b + e) / (typename genType::value_type(2) * a); + + if(x1 > Epsilon) + { + position = rayStarting + rayDirection * sphereRadius; + normal = (position - sphereCenter) / sphereRadius; + return true; + } + else if(x2 > Epsilon) + { + position = rayStarting + rayDirection * sphereRadius; + normal = (position - sphereCenter) / sphereRadius; + return true; + } + return false; +} + +template +inline bool intersectLineSphere +( + genType const & point0, genType const & point1, + genType const & center, typename genType::value_type radius, + genType & position, genType & normal +) +{ + typename genType::value_type Epsilon = std::numeric_limits::epsilon(); + + genType dir = point1 - point0; + typename genType::value_type a = dot(dir, dir); + typename genType::value_type b = typename genType::value_type(2) * dot(center, dir); + typename genType::value_type c = dot(center, center) - radius * radius; + typename genType::value_type d = b * b - typename genType::value_type(4) * a * c; + typename genType::value_type e = sqrt(d); + typename genType::value_type x1 = (-b - e) / (typename genType::value_type(2) * a); + typename genType::value_type x2 = (-b + e) / (typename genType::value_type(2) * a); + + if(x1 > Epsilon) + { + position = center + dir * radius; + normal = (position - center) / radius; + return true; + } + else if(x2 > Epsilon) + { + position = center + dir * radius; + normal = (position - center) / radius; + return true; + } + return false; +} + +}//namespace intersect +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/inverse.hpp b/glm/gtx/inverse.hpp new file mode 100644 index 0000000..2dca92b --- /dev/null +++ b/glm/gtx/inverse.hpp @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-09-30 +// Licence : This source is under MIT License +// File : glm/gtx/inverse.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_inverse +#define glm_gtx_inverse + +// Dependency: +#include "../glm.hpp" +#include "../gtc/matrix_operation.hpp" + +namespace glm{ +namespace gtx{ +//! GLM_GTX_inverse extension: Inverse matrix functions +namespace inverse +{ + using namespace gtc::matrix_operation; + + //! Fast matrix inverse for affine matrix. + //! From GLM_GTX_inverse extension. + template + genType affineInverse(genType const & m); + +}//namespace inverse +}//namespace gtx +}//namespace glm + +#define GLM_GTX_inverse namespace gtx::inverse +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_inverse;} +#endif//GLM_GTX_GLOBAL + +#include "inverse.inl" + +#endif//glm_gtx_inverse diff --git a/glm/gtx/inverse.inl b/glm/gtx/inverse.inl new file mode 100644 index 0000000..31aad6e --- /dev/null +++ b/glm/gtx/inverse.inl @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-09-30 +// Licence : This source is under MIT License +// File : glm/gtx/inverse.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace inverse +{ + template + inline detail::tmat3x3 affineInverse + ( + detail::tmat3x3 const & m + ) + { + detail::tmat3x3 Result(m); + Result[2] = detail::tvec3(0, 0, 1); + Result = transpose(Result); + detail::tvec3 Translation = Result * detail::tvec3(-detail::tvec2(m[2]), m[2][2]); + Result[2] = Translation; + return Result; + } + + template + inline detail::tmat4x4 affineInverse + ( + detail::tmat4x4 const & m + ) + { + detail::tmat4x4 Result(m); + Result[3] = detail::tvec4(0, 0, 0, 1); + Result = transpose(Result); + detail::tvec4 Translation = Result * detail::tvec4(-detail::tvec3(m[3]), m[3][3]); + Result[3] = Translation; + return Result; + } + +}//namespace inverse +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/inverse_transpose.hpp b/glm/gtx/inverse_transpose.hpp new file mode 100644 index 0000000..1c905fa --- /dev/null +++ b/glm/gtx/inverse_transpose.hpp @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-04 +// Updated : 2008-10-23 +// Licence : This source is under MIT License +// File : glm/gtx/inverse_transpose.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_inverse_transpose +#define glm_gtx_inverse_transpose + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_inverse_transpose extension: Inverse transpose matrix functions + namespace inverse_transpose + { + //! Compute the inverse transpose of a matrix. + //! From GLM_GTX_inverse extension. + template + inline typename genType::value_type inverseTranspose( + genType const & m); + + }//namespace inverse_transpose + }//namespace gtx +}//namespace glm + +#define GLM_GTX_inverse_transpose namespace gtx::inverse_transpose +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_inverse_transpose;} +#endif//GLM_GTX_GLOBAL + +#include "inverse_transpose.inl" + +#endif//glm_gtx_inverse_transpose diff --git a/glm/gtx/inverse_transpose.inl b/glm/gtx/inverse_transpose.inl new file mode 100644 index 0000000..f11a52d --- /dev/null +++ b/glm/gtx/inverse_transpose.inl @@ -0,0 +1,112 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-04 +// Updated : 2008-12-02 +// Licence : This source is under MIT License +// File : glm/gtx/inverse_transpose.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +//! GLM_GTX_inverse_transpose extension: Inverse transpose matrix functions +namespace inverse_transpose{ + +template +inline detail::tmat2x2 inverseTranspose( + detail::tmat2x2 const & m) +{ + valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1]; + + detail::tmat2x2 Inverse( + + m[1][1] / Determinant, + - m[0][1] / Determinant, + - m[1][0] / Determinant, + + m[0][0] / Determinant); + + return Inverse; +} + +template +inline detail::tmat3x3 inverseTranspose( + detail::tmat3x3 const & m) +{ + valType Determinant = + + m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) + - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) + + m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]); + + detail::tmat3x3 Inverse; + Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]); + Inverse[0][1] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]); + Inverse[0][2] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]); + Inverse[1][0] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]); + Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]); + Inverse[1][2] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]); + Inverse[2][0] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]); + Inverse[2][1] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]); + Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]); + Inverse /= Determinant; + + return Inverse; +} + +template +inline detail::tmat4x4 inverseTranspose( + detail::tmat4x4 const & m) +{ + valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3]; + valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3]; + valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2]; + valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3]; + valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2]; + valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1]; + valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3]; + valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; + valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2]; + valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3]; + valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2]; + valType SubFactor11 = m[1][1] * m[3][3] - m[3][1] * m[1][3]; + valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1]; + valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3]; + valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3]; + valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2]; + valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3]; + valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2]; + valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1]; + + detail::tmat4x4 Inverse; + Inverse[0][0] = + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02); + Inverse[0][1] = - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04); + Inverse[0][2] = + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05); + Inverse[0][3] = - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05); + + Inverse[1][0] = - (m[0][1] * SubFactor00 - m[0][2] * SubFactor01 + m[0][3] * SubFactor02); + Inverse[1][1] = + (m[0][0] * SubFactor00 - m[0][2] * SubFactor03 + m[0][3] * SubFactor04); + Inverse[1][2] = - (m[0][0] * SubFactor01 - m[0][1] * SubFactor03 + m[0][3] * SubFactor05); + Inverse[1][3] = + (m[0][0] * SubFactor02 - m[0][1] * SubFactor04 + m[0][2] * SubFactor05); + + Inverse[2][0] = + (m[0][1] * SubFactor06 - m[0][2] * SubFactor07 + m[0][3] * SubFactor08); + Inverse[2][1] = - (m[0][0] * SubFactor06 - m[0][2] * SubFactor09 + m[0][3] * SubFactor10); + Inverse[2][2] = + (m[0][0] * SubFactor11 - m[0][1] * SubFactor09 + m[0][3] * SubFactor12); + Inverse[2][3] = - (m[0][0] * SubFactor08 - m[0][1] * SubFactor10 + m[0][2] * SubFactor12); + + Inverse[3][0] = - (m[0][1] * SubFactor13 - m[0][2] * SubFactor14 + m[0][3] * SubFactor15); + Inverse[3][1] = + (m[0][0] * SubFactor13 - m[0][2] * SubFactor16 + m[0][3] * SubFactor17); + Inverse[3][2] = - (m[0][0] * SubFactor14 - m[0][1] * SubFactor16 + m[0][3] * SubFactor18); + Inverse[3][3] = + (m[0][0] * SubFactor15 - m[0][1] * SubFactor17 + m[0][2] * SubFactor18); + + valType Determinant = + + m[0][0] * Inverse[0][0] + + m[0][1] * Inverse[0][1] + + m[0][2] * Inverse[0][2] + + m[0][3] * Inverse[0][3]; + + Inverse /= Determinant; + + return Inverse; +} + +}//namespace inverse_transpose +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/log_base.hpp b/glm/gtx/log_base.hpp new file mode 100644 index 0000000..5c5a875 --- /dev/null +++ b/glm/gtx/log_base.hpp @@ -0,0 +1,47 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-24 +// Updated : 2008-10-24 +// Licence : This source is under MIT License +// File : glm/gtx/log_base.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_log_base +#define glm_gtx_log_base + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_ext_gtx_log_base(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_log_base extension: Logarithm for any base. base can be a vector or a scalar. + namespace log_base + { + //! Logarithm for any base. + //! From GLM_GTX_log_base. + template + genType log( + genType const & x, + genType const & base); + + }//namespace extend + }//namespace gtx +}//namespace glm + +#define GLM_GTX_log_base namespace gtx::log_base +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_log_base;} +#endif//GLM_GTX_GLOBAL + +#include "log_base.inl" + +#endif//glm_gtx_log_base diff --git a/glm/gtx/log_base.inl b/glm/gtx/log_base.inl new file mode 100644 index 0000000..c24fea1 --- /dev/null +++ b/glm/gtx/log_base.inl @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-24 +// Updated : 2008-10-24 +// Licence : This source is under MIT License +// File : glm/gtx/log_base.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace log_base{ + +template +inline genType log( + genType const & x, + genType const & base) +{ + assert(x != genType(0)); + + return glm::log(x) / glm::log(base); +} + +template +inline detail::tvec2 log( + detail::tvec2 const & v, + valType const & base) +{ + return detail::tvec2( + log(v.x, base), + log(v.y, base)); +} + +template +inline detail::tvec3 log( + detail::tvec3 const & v, + valType const & base) +{ + return detail::tvec3( + log(v.x, base), + log(v.y, base), + log(v.z, base)); +} + +template +inline detail::tvec4 log( + detail::tvec4 const & v, + valType const & base) +{ + return detail::tvec4( + log(v.x, base), + log(v.y, base), + log(v.z, base), + log(v.w, base)); +} + +template +inline detail::tvec2 log( + detail::tvec2 const & v, + detail::tvec2 const & base) +{ + return detail::tvec2( + log(v.x, base.x), + log(v.y, base.y)); +} + +template +inline detail::tvec3 log( + detail::tvec3 const & v, + detail::tvec3 const & base) +{ + return detail::tvec3( + log(v.x, base.x), + log(v.y, base.y), + log(v.z, base.z)); +} + +template +inline detail::tvec4 log( + detail::tvec4 const & v, + detail::tvec4 const & base) +{ + return detail::tvec4( + log(v.x, base.x), + log(v.y, base.y), + log(v.z, base.z), + log(v.w, base.w)); +} + +}//namespace log_base +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/mat4x3.inl b/glm/gtx/mat4x3.inl new file mode 100644 index 0000000..d6f56ab --- /dev/null +++ b/glm/gtx/mat4x3.inl @@ -0,0 +1,405 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-17 +// Updated : 2006-04-17 +// Licence : This source is under MIT licence +// File : glm/gtx/mat4x3.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + ////////////////////////////////////////////////////////////// + // Constructors + + template + inline _xmat4x3GTX::_xmat4x3GTX() + { + this->value[0] = tvec3(1, 0, 0); + this->value[1] = tvec3(0, 1, 0); + this->value[2] = tvec3(0, 0, 1); + this->value[3] = tvec3(0, 0, 0); + } + + template + inline _xmat4x3GTX::_xmat4x3GTX(const T f) + { + this->value[0] = tvec3(f, 0, 0); + this->value[1] = tvec3(0, f, 0); + this->value[2] = tvec3(0, 0, f); + this->value[3] = tvec3(0, 0, 0); + } + + template + inline _xmat4x3GTX::_xmat4x3GTX + ( + const T x0, const T y0, const T z0, + const T x1, const T y1, const T z1, + const T x2, const T y2, const T z2, + const T x3, const T y3, const T z3 + ) + { + this->value[0] = tvec3(x0, y0, z0); + this->value[1] = tvec3(x1, y1, z1); + this->value[2] = tvec3(x2, y2, z2); + this->value[3] = tvec3(x3, y3, z3); + } + + template + inline _xmat4x3GTX::_xmat4x3GTX + ( + const tvec3 & v0, + const tvec3 & v1, + const tvec3 & v2, + const tvec3 & v3 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + this->value[3] = v3; + } + + ////////////////////////////////////////////////////////////// + // Unary updatable operators + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator= (const _xmat4x3GTX& m) + { + this->value[0] = m[0]; + this->value[1] = m[1]; + this->value[2] = m[2]; + this->value[3] = m[3]; + return *this; + } + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator+= (const T s) + { + this->value[0] += s; + this->value[1] += s; + this->value[2] += s; + this->value[3] += s; + return *this; + } + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator+= (const _xmat4x3GTX& m) + { + this->value[0] += m[0]; + this->value[1] += m[1]; + this->value[2] += m[2]; + this->value[3] += m[3]; + return *this; + } + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator-= (const T s) + { + this->value[0] -= s; + this->value[1] -= s; + this->value[2] -= s; + this->value[3] -= s; + return *this; + } + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator-= (const _xmat4x3GTX& m) + { + this->value[0] -= m[0]; + this->value[1] -= m[1]; + this->value[2] -= m[2]; + this->value[3] -= m[3]; + return *this; + } + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator*= (const T s) + { + this->value[0] *= s; + this->value[1] *= s; + this->value[2] *= s; + this->value[3] *= s; + return *this; + } + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator*= (const _xmat4x3GTX& m) + { + return (*this = *this * m); + } + + template + inline _xmat4x3GTX & _xmat4x3GTX::operator/= (const T s) + { + this->value[0] /= s; + this->value[1] /= s; + this->value[2] /= s; + this->value[3] /= s; + return *this; + } +/* + template + inline _xmat4x3GTX& _xmat4x3GTX::operator/= (const _xmat4x3GTX& m) + { + return (*this = *this / m); + } +*/ + template + inline _xmat4x3GTX& _xmat4x3GTX::operator++ () + { + ++this->value[0]; + ++this->value[1]; + ++this->value[2]; + ++this->value[3]; + return *this; + } + + template + inline _xmat4x3GTX& _xmat4x3GTX::operator-- () + { + --this->value[0]; + --this->value[1]; + --this->value[2]; + --this->value[3]; + return *this; + } + + ////////////////////////////////////////////////////////////// + // Unary constant operators + template + inline const _xmat4x3GTX _xmat4x3GTX::operator- () const + { + return _xmat4x3GTX( + -this->value[0], + -this->value[1], + -this->value[2], + -this->value[3]); + } + + template + inline const _xmat4x3GTX _xmat4x3GTX::operator-- (int n) const + { + _xmat4x3GTX m = *this; + --m.value[0]; + --m.value[1]; + --m.value[2]; + --m.value[3]; + return m; + } + + template + inline const _xmat4x3GTX _xmat4x3GTX::operator++ (int n) const + { + detail::tmat4x4 m = *this; + ++m.value[0]; + ++m.value[1]; + ++m.value[2]; + ++m.value[3]; + return m; + } + + ////////////////////////////////////////////////////////////// + // Binary operators + + template + inline _xmat4x3GTX operator+ (const _xmat4x3GTX& m, const T s) + { + return _xmat4x3GTX( + m[0] + s, + m[1] + s, + m[2] + s, + m[3] + s); + } + + template + inline _xmat4x3GTX operator+ (const _xmat4x3GTX& m1, const _xmat4x3GTX& m2) + { + return _xmat4x3GTX( + m1[0] + m2[0], + m1[1] + m2[1], + m1[2] + m2[2], + m1[3] + m2[3]); + } + + template + inline _xmat4x3GTX operator- (const _xmat4x3GTX& m, const T s) + { + return _xmat4x3GTX( + m[0] - s, + m[1] - s, + m[2] - s, + m[3] - s); + } + + template + inline _xmat4x3GTX operator- (const _xmat4x3GTX& m1, const _xmat4x3GTX& m2) + { + return _xmat4x3GTX( + m1[0] - m2[0], + m1[1] - m2[1], + m1[2] - m2[2], + m1[3] - m2[3]); + } + + template + inline _xmat4x3GTX operator* (const _xmat4x3GTX& m, const T s) + { + return _xmat4x3GTX( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline _xmat4x3GTX operator* (const T s, const _xmat4x3GTX & m) + { + return _xmat4x3GTX( + m[0] * s, + m[1] * s, + m[2] * s, + m[3] * s); + } + + template + inline tvec3 operator* (const _xmat4x3GTX& m, const tvec4& v) + { + return tvec3( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, + m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); + } + + template + inline tvec3 operator* (const tvec4& v, const _xmat4x3GTX& m) + { + return tvec3( + m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, + m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, + m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); + } + + template + inline _xmat4x3GTX operator* (const _xmat4x3GTX& m1, const _xmat4x3GTX& m2) + { + const T SrcA00 = m1[0][0]; + const T SrcA01 = m1[0][1]; + const T SrcA02 = m1[0][2]; + const T SrcA10 = m1[1][0]; + const T SrcA11 = m1[1][1]; + const T SrcA12 = m1[1][2]; + const T SrcA20 = m1[2][0]; + const T SrcA21 = m1[2][1]; + const T SrcA22 = m1[2][2]; + const T SrcA30 = m1[3][0]; + const T SrcA31 = m1[3][1]; + const T SrcA32 = m1[3][2]; + + const T SrcB00 = m2[0][0]; + const T SrcB01 = m2[0][1]; + const T SrcB02 = m2[0][2]; + const T SrcB10 = m2[1][0]; + const T SrcB11 = m2[1][1]; + const T SrcB12 = m2[1][2]; + const T SrcB20 = m2[2][0]; + const T SrcB21 = m2[2][1]; + const T SrcB22 = m2[2][2]; + const T SrcB30 = m2[3][0]; + const T SrcB31 = m2[3][1]; + const T SrcB32 = m2[3][2]; + + _xmat4x3GTX Result; + Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02; + Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02; + Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02; + Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12; + Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12; + Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12; + Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22; + Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22; + Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22; + Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31 + SrcA20 * SrcB32 + SrcA30; + Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31 + SrcA21 * SrcB32 + SrcA31; + Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31 + SrcA22 * SrcB32 + SrcA32; + return Result; + } + + template + inline _xmat4x3GTX operator/ (const _xmat4x3GTX& m, const T s) + { + return _xmat4x3GTX( + m.value[0] / s, + m.value[1] / s, + m.value[2] / s, + m.value[3] / s); + } +/* + template + inline _xmat4x3GTX operator/ (const T s, const _xmat4x3GTX& m) + { + return _xmat4x3GTX( + s / m.value[0], + s / m.value[1], + s / m.value[2], + s / m.value[3]); + } + + template + tvec3 operator/ (const _xmat4x3GTX& m, const tvec4& v) + { + + } + + template + tvec3 operator/ (const tvec4& v, const _xmat4x3GTX& m) + { + + } +*/ + + template + inline _xmat4x3GTX operator/ (const _xmat4x3GTX& m1, const _xmat4x3GTX& m2) + { + T SubFactor01 = m2[2][1] * m2[3][2] - m2[3][1] * m2[2][2]; + T SubFactor02 = m2[2][0] * m2[3][2] - m2[3][0] * m2[2][2]; + T SubFactor03 = m2[2][0] * m2[3][1] - m2[3][0] * m2[2][1]; + T SubFactor04 = m2[1][1] * m2[3][2] - m2[3][1] * m2[1][2]; + T SubFactor05 = m2[1][0] * m2[3][2] - m2[3][0] * m2[1][2]; + T SubFactor06 = m2[1][0] * m2[3][1] - m2[3][0] * m2[1][1]; + T SubFactor07 = m2[1][1] * m2[2][2] - m2[2][1] * m2[1][2]; + T SubFactor08 = m2[1][0] * m2[2][2] - m2[2][0] * m2[1][2]; + T SubFactor09 = m2[1][0] * m2[2][1] - m2[2][0] * m2[1][1]; + + _xmat4x3GTX Inverse( + + m2[1][3] * SubFactor01, + - m2[1][3] * SubFactor02, + + m2[1][3] * SubFactor03, + -(m2[1][0] * SubFactor01 - m2[1][1] * SubFactor02 + m2[1][2] * SubFactor03), + + - m2[0][3] * SubFactor01, + + m2[0][3] * SubFactor02, + - m2[0][3] * SubFactor03, + +(m2[0][0] * SubFactor02 - m2[0][1] * SubFactor02 + m2[0][2] * SubFactor03), + + + m2[0][3] * SubFactor04, + - m2[0][3] * SubFactor05, + + m2[0][3] * SubFactor06, + -(m2[0][0] * SubFactor04 - m2[0][1] * SubFactor05 + m2[0][2] * SubFactor06), + + - m2[0][3] * SubFactor07, + + m2[0][3] * SubFactor08, + - m2[0][3] * SubFactor09, + +(m2[0][0] * SubFactor07 - m2[0][1] * SubFactor08 + m2[0][2] * SubFactor09)); + + T Determinant = m2[0][0] * Inverse[0][0] + + m2[0][1] * Inverse[1][0] + + m2[0][2] * Inverse[2][0] + + m2[0][3] * Inverse[3][0]; + + Inverse /= Determinant; + + return m1 * Inverse; + } + +} //namespace glm diff --git a/glm/gtx/matrix_access.hpp b/glm/gtx/matrix_access.hpp new file mode 100644 index 0000000..ba03ba8 --- /dev/null +++ b/glm/gtx/matrix_access.hpp @@ -0,0 +1,51 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-27 +// Updated : 2006-12-06 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_access.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_access +#define glm_gtx_matrix_access + +// Dependency: +#include "../glm.hpp" + +namespace glm{ +namespace gtx{ +//! GLM_GTX_matrix_access extension: Set a column or a row of a matrix +namespace matrix_access +{ + //! Set a specific row to a matrix. + //! From GLM_GTX_matrix_access extension. + template + genType row( + const genType& m, + int index, + typename genType::row_type const & x); + + //! Set a specific column to a matrix. + //! From GLM_GTX_matrix_access extension. + template + genType column( + const genType& m, + int index, + typename genType::col_type const & x); + +}//namespace matrix_access +}//namespace gtx +}//namespace glm + +#define GLM_GTX_matrix_access namespace gtx::matrix_access +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matrix_access;} +#endif//GLM_GTX_GLOBAL + +#include "matrix_access.inl" + +#endif//glm_gtx_matrix_access diff --git a/glm/gtx/matrix_access.inl b/glm/gtx/matrix_access.inl new file mode 100644 index 0000000..99c6226 --- /dev/null +++ b/glm/gtx/matrix_access.inl @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-27 +// Updated : 2005-12-27 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_access.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace matrix_access{ + + template + inline genType row( + genType const & m, + int index, + typename genType::row_type const & x) + { + genType Result = m; + for(typename genType::size_type i = 0; i < genType::row_size(); ++i) + Result[i][index] = x[i]; + return Result; + } + + template + inline genType column( + genType const & m, + int index, + typename genType::col_type const & x) + { + genType Result = m; + Result[index] = x; + return Result; + } + +}//namespace matrix_access +}//namespace gtx +}//namespace glm + diff --git a/glm/gtx/matrix_cross_product.hpp b/glm/gtx/matrix_cross_product.hpp new file mode 100644 index 0000000..7794f36 --- /dev/null +++ b/glm/gtx/matrix_cross_product.hpp @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_cross_product.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_cross_product +#define glm_gtx_matrix_cross_product + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_matrix_cross_product(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_matrix_cross_product: Build cross product matrices + namespace matrix_cross_product + { + //! Build a cross product matrix. + //! From GLM_GTX_matrix_cross_product extension. + template + detail::tmat3x3 matrixCross3( + detail::tvec3 const & x); + + //! Build a cross product matrix. + //! From GLM_GTX_matrix_cross_product extension. + template + detail::tmat4x4 matrixCross4( + detail::tvec3 const & x); + + }//namespace matrix_cross_product + }//namespace gtx +}//namespace glm + +#define GLM_GTX_matrix_cross_product namespace gtx::matrix_cross_product +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matrix_cross_product;} +#endif//GLM_GTX_GLOBAL + +#include "matrix_cross_product.inl" + +#endif//glm_gtx_matrix_cross_product diff --git a/glm/gtx/matrix_cross_product.inl b/glm/gtx/matrix_cross_product.inl new file mode 100644 index 0000000..b58692d --- /dev/null +++ b/glm/gtx/matrix_cross_product.inl @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2005-12-21 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_cross_product.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace matrix_cross_product +{ + template + inline detail::tmat3x3 matrixCross3( + detail::tvec3 const & x) + { + detail::tmat3x3 Result(T(0)); + Result[0][1] = x.z; + Result[1][0] = -x.z; + Result[0][2] = -x.y; + Result[2][0] = x.y; + Result[1][2] = x.x; + Result[2][1] = -x.x; + return Result; + } + + template + inline detail::tmat4x4 matrixCross4( + detail::tvec3 const & x) + { + detail::tmat4x4 Result(T(0)); + Result[0][1] = x.z; + Result[1][0] = -x.z; + Result[0][2] = -x.y; + Result[2][0] = x.y; + Result[1][2] = x.x; + Result[2][1] = -x.x; + return Result; + } + +}//namespace matrix_cross_product +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/matrix_major_storage.hpp b/glm/gtx/matrix_major_storage.hpp new file mode 100644 index 0000000..71f8b7b --- /dev/null +++ b/glm/gtx/matrix_major_storage.hpp @@ -0,0 +1,120 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-19 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_major_storage.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_major_storage +#define glm_gtx_matrix_major_storage + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_matrix_cross_product: Build matrices with specific matrix order, row or column + namespace matrix_major_storage + { + //! Build a row major matrix from row vectors. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat2x2 rowMajor2( + const detail::tvec2& v1, + const detail::tvec2& v2); + + //! Build a row major matrix from other matrix. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat2x2 rowMajor2( + const detail::tmat2x2& m); + + //! Build a row major matrix from row vectors. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat3x3 rowMajor3( + const detail::tvec3& v1, + const detail::tvec3& v2, + const detail::tvec3& v3); + + //! Build a row major matrix from other matrix. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat3x3 rowMajor3( + const detail::tmat3x3& m); + + //! Build a row major matrix from row vectors. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat4x4 rowMajor4( + const detail::tvec4& v1, + const detail::tvec4& v2, + const detail::tvec4& v3, + const detail::tvec4& v4); + + //! Build a row major matrix from other matrix. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat4x4 rowMajor4( + const detail::tmat4x4& m); + + //! Build a column major matrix from column vectors. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat2x2 colMajor2( + const detail::tvec2& v1, + const detail::tvec2& v2); + + //! Build a column major matrix from other matrix. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat2x2 colMajor2( + const detail::tmat2x2& m); + + //! Build a column major matrix from column vectors. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat3x3 colMajor3( + const detail::tvec3& v1, + const detail::tvec3& v2, + const detail::tvec3& v3); + + //! Build a column major matrix from other matrix. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat3x3 colMajor3( + const detail::tmat3x3& m); + + //! Build a column major matrix from column vectors. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat4x4 colMajor4( + const detail::tvec4& v1, + const detail::tvec4& v2, + const detail::tvec4& v3, + const detail::tvec4& v4); + + //! Build a column major matrix from other matrix. + //! From GLM_GTX_matrix_major_storage extension. + template + detail::tmat4x4 colMajor4( + const detail::tmat4x4& m); + + }//namespace matrix_major_storage + }//namespace gtx +}//namespace glm + +#define GLM_GTX_matrix_major_storage namespace gtx::matrix_major_storage +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matrix_major_storage;} +#endif//GLM_GTX_GLOBAL + +#include "matrix_major_storage.inl" + +#endif//glm_gtx_matrix_major_storage diff --git a/glm/gtx/matrix_major_storage.inl b/glm/gtx/matrix_major_storage.inl new file mode 100644 index 0000000..4e45666 --- /dev/null +++ b/glm/gtx/matrix_major_storage.inl @@ -0,0 +1,176 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-19 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_major_storage.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace matrix_major_storage +{ + template + inline detail::tmat2x2 rowMajor2( + const detail::tvec2& v1, + const detail::tvec2& v2) + { + detail::tmat2x2 Result; + Result[0][0] = v1.x; + Result[1][0] = v1.y; + Result[0][1] = v2.x; + Result[1][1] = v2.y; + return Result; + } + + template + inline detail::tmat2x2 rowMajor2( + const detail::tmat2x2& m) + { + detail::tmat2x2 Result; + 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 rowMajor3( + const detail::tvec3& v1, + const detail::tvec3& v2, + const detail::tvec3& v3) + { + detail::tmat3x3 Result; + Result[0][0] = v1.x; + Result[1][0] = v1.y; + Result[2][0] = v1.z; + Result[0][1] = v2.x; + Result[1][1] = v2.y; + Result[2][1] = v2.z; + Result[0][2] = v3.x; + Result[1][2] = v3.y; + Result[2][2] = v3.z; + return Result; + } + + template + inline detail::tmat3x3 rowMajor3( + const detail::tmat3x3& m) + { + detail::tmat3x3 Result; + 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[2][0] = m[0][2]; + Result[2][1] = m[1][2]; + Result[2][2] = m[2][2]; + return Result; + } + + template + inline detail::tmat4x4 rowMajor4( + const detail::tvec4& v1, + const detail::tvec4& v2, + const detail::tvec4& v3, + const detail::tvec4& v4) + { + detail::tmat4x4 Result; + Result[0][0] = v1.x; + Result[1][0] = v1.y; + Result[2][0] = v1.z; + Result[3][0] = v1.w; + Result[0][1] = v2.x; + Result[1][1] = v2.y; + Result[2][1] = v2.z; + Result[3][1] = v2.w; + Result[0][2] = v3.x; + Result[1][2] = v3.y; + Result[2][2] = v3.z; + Result[3][2] = v3.w; + Result[0][3] = v4.x; + Result[1][3] = v4.y; + Result[2][3] = v4.z; + Result[3][3] = v4.w; + return Result; + } + + template + inline detail::tmat4x4 rowMajor4( + const detail::tmat4x4& m) + { + detail::tmat4x4 Result; + 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[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; + } + + template + inline detail::tmat2x2 colMajor2( + const detail::tvec2& v1, + const detail::tvec2& v2) + { + return detail::tmat2x2(v1, v2); + } + + template + inline detail::tmat2x2 colMajor2( + const detail::tmat2x2& m) + { + return detail::tmat2x2(m); + } + + template + inline detail::tmat3x3 colMajor3( + const detail::tvec3& v1, + const detail::tvec3& v2, + const detail::tvec3& v3) + { + return detail::tmat3x3(v1, v2, v3); + } + + template + inline detail::tmat3x3 colMajor3( + const detail::tmat3x3& m) + { + return detail::tmat3x3(m); + } + + template + inline detail::tmat4x4 colMajor4( + const detail::tvec4& v1, + const detail::tvec4& v2, + const detail::tvec4& v3, + const detail::tvec4& v4) + { + return detail::tmat4x4(v1, v2, v3, v4); + } + + template + inline detail::tmat4x4 colMajor4( + const detail::tmat4x4& m) + { + return detail::tmat4x4(m); + } + +}//namespace matrix_major_storage +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/matrix_operation.hpp b/glm/gtx/matrix_operation.hpp new file mode 100644 index 0000000..7063516 --- /dev/null +++ b/glm/gtx/matrix_operation.hpp @@ -0,0 +1,94 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-08-29 +// Updated : 2009-08-29 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_operation.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_operation +#define glm_gtx_matrix_operation + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_matrix_operation(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_matrix_operation: Build cross product matrices + namespace matrix_operation + { + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat2x2 diagonal2x2( + detail::tvec2 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat2x3 diagonal2x3( + detail::tvec2 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat2x4 diagonal2x4( + detail::tvec2 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat3x2 diagonal3x2( + detail::tvec2 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat3x3 diagonal3x3( + detail::tvec3 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat3x4 diagonal3x4( + detail::tvec3 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat4x2 diagonal4x2( + detail::tvec2 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat4x3 diagonal4x3( + detail::tvec3 const & v); + + //! Build a diagonal matrix. + //! From GLM_GTX_matrix_operation extension. + template + detail::tmat4x4 diagonal4x4( + detail::tvec4 const & v); + + }//namespace matrix_operation + }//namespace gtx +}//namespace glm + +#define GLM_GTX_matrix_operation namespace gtx::matrix_operation +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matrix_operation;} +#endif//GLM_GTX_GLOBAL + +#include "matrix_operation.inl" + +#endif//glm_gtx_matrix_operation diff --git a/glm/gtx/matrix_operation.inl b/glm/gtx/matrix_operation.inl new file mode 100644 index 0000000..4fa5c9f --- /dev/null +++ b/glm/gtx/matrix_operation.inl @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-08-29 +// Updated : 2009-08-29 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_operation.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtc{ +namespace matrix_operation +{ + template + inline detail::tmat2x2 diagonal2x2 + ( + detail::tvec2 const & v + ) + { + detail::tmat2x2 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + return Result; + } + + template + inline detail::tmat2x3 diagonal2x3 + ( + detail::tvec2 const & v + ) + { + detail::tmat2x3 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + return Result; + } + + template + inline detail::tmat2x4 diagonal2x4 + ( + detail::tvec2 const & v + ) + { + detail::tmat2x4 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + return Result; + } + + template + inline detail::tmat3x2 diagonal3x2 + ( + detail::tvec2 const & v + ) + { + detail::tmat3x2 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + return Result; + } + + template + inline detail::tmat3x3 diagonal3x3 + ( + detail::tvec3 const & v + ) + { + detail::tmat3x3 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + Result[2][2] = v[2]; + return Result; + } + + template + inline detail::tmat3x4 diagonal3x4 + ( + detail::tvec3 const & v + ) + { + detail::tmat3x4 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + Result[2][2] = v[2]; + return Result; + } + + template + inline detail::tmat4x4 diagonal4x4 + ( + detail::tvec4 const & v + ) + { + detail::tmat4x4 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + Result[2][2] = v[2]; + Result[3][3] = v[3]; + return Result; + } + + template + inline detail::tmat4x3 diagonal4x3 + ( + detail::tvec3 const & v + ) + { + detail::tmat4x3 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + Result[2][2] = v[2]; + return Result; + } + + template + inline detail::tmat4x2 diagonal4x2 + ( + detail::tvec2 const & v + ) + { + detail::tmat4x2 Result(valType(1)); + Result[0][0] = v[0]; + Result[1][1] = v[1]; + return Result; + } + +}//namespace matrix_operation +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/matrix_projection.hpp b/glm/gtx/matrix_projection.hpp new file mode 100644 index 0000000..2f12a35 --- /dev/null +++ b/glm/gtx/matrix_projection.hpp @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_projection.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_matrix_projection +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_projection +#define glm_gtx_matrix_projection + +// Dependency: +#include "../glm.hpp" +#include "../gtc/matrix_projection.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_matrix_projection(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_matrix_projection: Varius ways to build and operate on projection matrices + namespace matrix_projection + { + //! Builds a perspective projection matrix based on a field of view + //! From GLM_GTX_matrix_projection extension. + template + detail::tmat4x4 perspectiveFov( + valType const & fov, + valType const & width, + valType const & height, + valType const & zNear, + valType const & zFar); + + //! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite . + //! From GLM_GTX_matrix_projection extension. + template + detail::tmat4x4 infinitePerspective( + T fovy, T aspect, T zNear); + + //! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping. + //! From GLM_GTX_matrix_projection extension. + template + detail::tmat4x4 tweakedInfinitePerspective( + T fovy, T aspect, T zNear); + + }//namespace matrix_projection + }//namespace gtx +}//namespace glm + +#define GLM_GTX_matrix_projection namespace gtc::matrix_projection; using namespace gtx::matrix_projection +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matrix_projection;} +#endif//GLM_GTX_GLOBAL + +#include "matrix_projection.inl" + +#endif//glm_gtx_matrix_projection diff --git a/glm/gtx/matrix_projection.inl b/glm/gtx/matrix_projection.inl new file mode 100644 index 0000000..6044f00 --- /dev/null +++ b/glm/gtx/matrix_projection.inl @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_projection.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace matrix_projection +{ + template + inline detail::tmat4x4 perspectiveFov + ( + valType const & fov, + valType const & width, + valType const & height, + valType const & zNear, + valType const & zFar + ) + { + valType rad = glm::radians(fov); + valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad); + valType w = h * height / width; + + detail::tmat4x4 Result(valType(0)); + Result[0][0] = w; + Result[1][1] = h; + Result[2][2] = (zFar + zNear) / (zFar - zNear); + Result[2][3] = valType(1); + Result[3][2] = -(valType(2) * zFar * zNear) / (zFar - zNear); + return Result; + } + + template + inline detail::tmat4x4 infinitePerspective( + T fovy, + T aspect, + T zNear) + { + T range = tan(radians(fovy / T(2))) * zNear; + T left = -range * aspect; + T right = range * aspect; + T bottom = -range; + T top = range; + + detail::tmat4x4 Result(T(0)); + Result[0][0] = (T(2) * zNear) / (right - left); + Result[1][1] = (T(2) * zNear) / (top - bottom); + Result[2][2] = - T(1); + Result[2][3] = - T(1); + Result[3][2] = - T(2) * zNear; + return Result; + } + + template + inline detail::tmat4x4 tweakedInfinitePerspective( + T fovy, + T aspect, + T zNear) + { + T range = tan(radians(fovy / T(2))) * zNear; + T left = -range * aspect; + T right = range * aspect; + T bottom = -range; + T top = range; + + detail::tmat4x4 Result(T(0)); + Result[0][0] = (T(2) * zNear) / (right - left); + Result[1][1] = (T(2) * zNear) / (top - bottom); + Result[2][2] = T(0.0001) - T(1); + Result[2][3] = T(-1); + Result[3][2] = - (T(0.0001) - T(2)) * zNear; + return Result; + } + +}//namespace matrix_projection +}//namespace gtc +}//namespace glm diff --git a/glm/gtx/matrix_query.hpp b/glm/gtx/matrix_query.hpp new file mode 100644 index 0000000..9736825 --- /dev/null +++ b/glm/gtx/matrix_query.hpp @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-05 +// Updated : 2007-03-05 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_query.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_query +#define glm_gtx_matrix_query + +// Dependency: +#include "../glm.hpp" +//#include +#include + +namespace glm +{ + namespace test{ + void main_gtx_matrix_query(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_matrix_query: Query to evaluate matrices properties + namespace matrix_query + { + //! Return if a matrix a null matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isNull( + const detail::tmat2x2& m, + const T epsilon = std::numeric_limits::epsilon()); + + //! Return if a matrix a null matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isNull( + const detail::tmat3x3& m, + const T epsilon = std::numeric_limits::epsilon()); + + //! Return if a matrix a null matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isNull( + const detail::tmat4x4& m, + const T epsilon = std::numeric_limits::epsilon()); + + //! Return if a matrix an identity matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isIdentity( + const genType& m, + const typename genType::value_type epsilon = std::numeric_limits::epsilon()); + + //! Return if a matrix a normalized matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isNormalized( + const detail::tmat2x2& m, + const T epsilon = std::numeric_limits::epsilon()); + + //! Return if a matrix a normalized matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isNormalized( + const detail::tmat3x3& m, + const T epsilon = std::numeric_limits::epsilon()); + + //! Return if a matrix a normalized matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isNormalized( + const detail::tmat4x4& m, + const T epsilon = std::numeric_limits::epsilon()); + + //! Return if a matrix an orthonormalized matrix. + //! From GLM_GTX_matrix_query extension. + template + bool isOrthogonal( + const genType& m, + const typename genType::value_type epsilon = std::numeric_limits::epsilon()); + + }//namespace matrix_query + }//namespace gtx +}//namespace glm + +#define GLM_GTX_matrix_query namespace gtx::matrix_query +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matrix_query;} +#endif//GLM_GTX_GLOBAL + +#include "matrix_query.inl" + +#endif//glm_gtx_matrix_query diff --git a/glm/gtx/matrix_query.inl b/glm/gtx/matrix_query.inl new file mode 100644 index 0000000..8a5023c --- /dev/null +++ b/glm/gtx/matrix_query.inl @@ -0,0 +1,144 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-05 +// Updated : 2007-03-05 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_query.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace matrix_query +{ + template + inline bool isNull( + const detail::tmat2x2& m, + const T epsilon) + { + bool result = true; + for(int i = 0; result && i < 2 ; ++i) + result = isNull(m[i], epsilon); + return result; + } + + template + inline bool isNull( + const detail::tmat3x3& m, + const T epsilon) + { + bool result = true; + for(int i = 0; result && i < 3 ; ++i) + result = isNull(m[i], epsilon); + return result; + } + + template + inline bool isNull( + const detail::tmat4x4& m, + const T epsilon) + { + bool result = true; + for(int i = 0; result && i < 4 ; ++i) + result = isNull(m[i], epsilon); + return result; + } + + template + inline bool isIdentity( + const genType& m, + const typename genType::value_type epsilon) + { + bool result = true; + for(typename genType::value_type i = typename genType::value_type(0); result && i < genType::col_size(); ++i) + { + for(typename genType::value_type j = typename genType::value_type(0); result && j < i ; ++j) + result = abs(m[i][j]) <= epsilon; + if(result) + result = abs(m[i][i] - typename genType::value_type(1)) <= epsilon; + for(typename genType::value_type j = i + typename genType::value_type(1); result && j < genType::row_size(); ++j) + result = abs(m[i][j]) <= epsilon; + } + return result; + } + + template + inline bool isNormalized( + const detail::tmat2x2& m, + const T epsilon) + { + bool result = true; + for(int i = 0; result && i < 2; ++i) + result = isNormalized(m[i], epsilon); + for(int i = 0; result && i < 2; ++i) + { + detail::tvec2 v; + for(int j = 0; j < 2; ++j) + v[j] = m[j][i]; + result = isNormalized(v, epsilon); + } + return result; + } + + template + inline bool isNormalized( + const detail::tmat3x3& m, + const T epsilon) + { + bool result = true; + for(int i = 0; result && i < 3; ++i) + result = isNormalized(m[i], epsilon); + for(int i = 0; result && i < 3; ++i) + { + detail::tvec3 v; + for(int j = 0; j < 3; ++j) + v[j] = m[j][i]; + result = isNormalized(v, epsilon); + } + return result; + } + + template + inline bool isNormalized( + const detail::tmat4x4& m, + const T epsilon) + { + bool result = true; + for(int i = 0; result && i < 4; ++i) + result = isNormalized(m[i], epsilon); + for(int i = 0; result && i < 4; ++i) + { + detail::tvec4 v; + for(int j = 0; j < 4; ++j) + v[j] = m[j][i]; + result = isNormalized(v, epsilon); + } + return result; + } + + template + inline bool isOrthogonal( + const genType& m, + const typename genType::value_type epsilon) + { + bool result = true; + for(int i = 0; result && i < genType::col_size() - 1; ++i) + for(int j= i + 1; result && j < genType::col_size(); ++j) + result = areOrthogonal(m[i], m[j], epsilon); + + if(result) + { + genType tmp = transpose(m); + for(int i = 0; result && i < genType::col_size() - 1 ; ++i) + for(int j = i + 1; result && j < genType::col_size(); ++j) + result = areOrthogonal(tmp[i], tmp[j], epsilon); + } + return result; + } + +}//namespace matrix_query +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/matrix_selection.hpp b/glm/gtx/matrix_selection.hpp new file mode 100644 index 0000000..557c960 --- /dev/null +++ b/glm/gtx/matrix_selection.hpp @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_selection.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matrix_selection +#define glm_gtx_matrix_selection + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_matrix_selection(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_matrix_selection extension: Access to matrix columns or rows. + namespace matrix_selection + { + //! Returns a 2 components vector that contains the row of the matrix m witch values is the ones of the row index. + //! From GLM_GTX_matrix_selection extension. + template + detail::tvec2 row( + const detail::tmat2x2& m, + int index); + + //! Returns a 3 components vector that contains the row of the matrix m witch values is the ones of the row index. + //! From GLM_GTX_matrix_selection extension. + template + detail::tvec3 row( + const detail::tmat3x3& m, + int index); + + //! Returns a 4 components vector that contains the row of the matrix m witch values is the ones of the row index. + //! From GLM_GTX_matrix_selection extension. + template + detail::tvec4 row( + const detail::tmat4x4& m, + int index); + + //! Returns a 2 components vector that contains the row of the matrix m witch values is the ones of the column index. + //! From GLM_GTX_matrix_selection extension. + template + detail::tvec2 column( + const detail::tmat2x2& m, + int index); + + //! Returns a 3 components vector that contains the row of the matrix m witch values is the ones of the column index. + //! From GLM_GTX_matrix_selection extension. + template + detail::tvec3 column( + const detail::tmat3x3& m, + int index); + + //! Returns a 4 components vector that contains the row of the matrix m witch values is the ones of the column index. + //! From GLM_GTX_matrix_selection extension. + template + detail::tvec4 column( + const detail::tmat4x4& m, + int index); + + }//namespace matrix_selection + }//namespace gtx +}//namespace glm + +#define GLM_GTX_matrix_selection namespace gtx::matrix_selection +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matrix_selection;} +#endif//GLM_GTX_GLOBAL + +#include "matrix_selection.inl" + +#endif//glm_gtx_matrix_selection diff --git a/glm/gtx/matrix_selection.inl b/glm/gtx/matrix_selection.inl new file mode 100644 index 0000000..9d7c1b2 --- /dev/null +++ b/glm/gtx/matrix_selection.inl @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_selection.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace matrix_selection +{ + template + inline detail::tvec2 row( + const detail::tmat2x2& m, + int index) + { + return detail::tvec2(m[0][index], m[1][index]); + } + + template + inline detail::tvec3 row( + const detail::tmat3x3& m, + int index) + { + return detail::tvec3(m[0][index], m[1][index], m[2][index]); + } + + template + inline detail::tvec4 row( + const detail::tmat4x4& m, + int index) + { + return detail::tvec4(m[0][index], m[1][index], m[2][index], m[3][index]); + } + + template + inline detail::tvec2 column( + const detail::tmat2x2& m, + int index) + { + return m[index]; + } + + template + inline detail::tvec3 column( + const detail::tmat3x3& m, + int index) + { + return m[index]; + } + + template + inline detail::tvec4 column( + const detail::tmat4x4& m, + int index) + { + return m[index]; + } + +}//namespace matrix_selection +}//namespace gtx +}//namespace glm + diff --git a/glm/gtx/matx.hpp b/glm/gtx/matx.hpp new file mode 100644 index 0000000..ed3a048 --- /dev/null +++ b/glm/gtx/matx.hpp @@ -0,0 +1,182 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-02-21 +// Updated : 2007-03-01 +// Licence : This source is under MIT License +// File : glm/gtx/matx.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_vecx +// - GLM_GTX_matrix_selection +// - GLM_GTX_matrix_access +// - GLM_GTX_inverse_transpose +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_matx +#define glm_gtx_matx + +// Dependency: +#include "../glm.hpp" +#include "../gtx/vecx.hpp" + +namespace glm{ +namespace detail{ + + template + class _xmatxGTX + { + private: + // Data + _xvecxGTX value[N]; + + public: + _xmatxGTX _inverse() const; + + public: + typedef T value_type; + typedef int size_type; + static const size_type value_size; + + // Constructors + _xmatxGTX(); + explicit _xmatxGTX(const T x); + + // Accesses + _xvecxGTX& operator[](int i) {return value[i];} + const _xvecxGTX & operator[](int i) const {return value[i];} + operator T*() {return &value[0][0];} + operator const T*() const {return &value[0][0];} + + // Unary updatable operators + _xmatxGTX& operator= (const _xmatxGTX& m); + _xmatxGTX& operator+= (const T s); + _xmatxGTX& operator+= (const _xmatxGTX& m); + _xmatxGTX& operator-= (const T s); + _xmatxGTX& operator-= (const _xmatxGTX& m); + _xmatxGTX& operator*= (const T s); + _xmatxGTX& operator*= (const _xmatxGTX& m); + _xmatxGTX& operator/= (const T s); + _xmatxGTX& operator/= (const _xmatxGTX& m); + _xmatxGTX& operator++ (); + _xmatxGTX& operator-- (); + }; + + // Binary operators + template + _xmatxGTX operator+ (const _xmatxGTX& m, const T s); + + template + _xmatxGTX operator+ (const T s, const _xmatxGTX& m); + + template + _xvecxGTX operator+ (const _xmatxGTX& m, const _xvecxGTX& v); + + template + _xvecxGTX operator+ (const _xvecxGTX& v, const _xmatxGTX& m); + + template + _xmatxGTX operator+ (const _xmatxGTX& m1, const _xmatxGTX& m2); + + template + _xmatxGTX operator- (const _xmatxGTX& m, const T s); + + template + _xmatxGTX operator- (const T s, const _xmatxGTX& m); + + template + _xvecxGTX operator- (const _xmatxGTX& m, const _xvecxGTX& v); + + template + _xvecxGTX operator- (const _xvecxGTX& v, const _xmatxGTX& m); + + template + _xmatxGTX operator- (const _xmatxGTX& m1, const _xmatxGTX& m2); + + template + _xmatxGTX operator* (const _xmatxGTX& m, const T s); + + template + _xmatxGTX operator* (const T s, const _xmatxGTX& m); + + template + _xvecxGTX operator* (const _xmatxGTX& m, const _xvecxGTX& v); + + template + _xvecxGTX operator* (const _xvecxGTX& v, const _xmatxGTX& m); + + template + _xmatxGTX operator* (const _xmatxGTX& m1, const _xmatxGTX& m2); + + template + _xmatxGTX operator/ (const _xmatxGTX& m, const T s); + + template + _xmatxGTX operator/ (const T s, const _xmatxGTX& m); + + template + _xvecxGTX operator/ (const _xmatxGTX& m, const _xvecxGTX& v); + + template + _xvecxGTX operator/ (const _xvecxGTX& v, const _xmatxGTX& m); + + template + _xmatxGTX operator/ (const _xmatxGTX& m1, const _xmatxGTX& m2); + + // Unary constant operators + template + const _xmatxGTX operator- (const _xmatxGTX& m); + + template + const _xmatxGTX operator-- (const _xmatxGTX& m, int); + + template + const _xmatxGTX operator++ (const _xmatxGTX& m, int); + +}//namespace detail + + // Extension functions + template detail::_xmatxGTX matrixCompMultGTX(const detail::_xmatxGTX& x, const detail::_xmatxGTX& y); + template detail::_xmatxGTX outerProductGTX(const detail::_xvecxGTX& c, const detail::_xvecxGTX& r); + template detail::_xmatxGTX transposeGTX(const detail::_xmatxGTX& x); + + template T determinantGTX(const detail::_xmatxGTX& m); + template detail::_xmatxGTX inverseTransposeGTX(const detail::_xmatxGTX & m); + + template void columnGTX(detail::_xmatxGTX& m, int ColIndex, const detail::_xvecxGTX& v); + template void rowGTX(detail::_xmatxGTX& m, int RowIndex, const detail::_xvecxGTX& v); + + template detail::_xvecxGTX columnGTX(const detail::_xmatxGTX& m, int ColIndex); + template detail::_xvecxGTX rowGTX(const detail::_xmatxGTX& m, int RowIndex); + + namespace gtx + { + //! GLM_GTX_matx extension: - Work in progress - NxN matrix types. + namespace matx + { + // Matrix Functions + template inline detail::_xmatxGTX matrixCompMult(const detail::_xmatxGTX& x, const detail::_xmatxGTX& y){return matrixCompMult(x, y);} + template inline detail::_xmatxGTX outerProduct(const detail::_xvecxGTX& c, const detail::_xvecxGTX& r){return outerProductGTX(c, r);} + template inline detail::_xmatxGTX transpose(const detail::_xmatxGTX& x){return transposeGTX(x);} + + template inline T determinant(const detail::_xmatxGTX& m){return determinantGTX(m);} + template inline detail::_xmatxGTX inverseTranspose(const detail::_xmatxGTX& m){return inverseTransposeGTX(m);} + + template inline void column(detail::_xmatxGTX& m, int ColIndex, const detail::_xvecxGTX& v){setColumnGTX(m, v);} + template inline void row(detail::_xmatxGTX& m, int RowIndex, const detail::_xvecxGTX& v){setRowGTX(m, v);} + + template inline detail::_xvecxGTX column(const detail::_xmatxGTX& m, int ColIndex){return column(m, ColIndex);} + template inline detail::_xvecxGTX row(const detail::_xmatxGTX& m, int RowIndex){return row(m, RowIndex);} + } + } +} + +#define GLM_GTX_matx namespace gtx::matx +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_matx;} +#endif//GLM_GTX_GLOBAL + +#include "matx.inl" + +#endif//glm_gtx_matx diff --git a/glm/gtx/matx.inl b/glm/gtx/matx.inl new file mode 100644 index 0000000..70954a9 --- /dev/null +++ b/glm/gtx/matx.inl @@ -0,0 +1,479 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-02-21 +// Updated : 2007-02-21 +// Licence : This source is under MIT License +// File : glm/gtx/matx.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +namespace glm{ +namespace detail{ + + template const typename _xmatxGTX::size_type _xmatxGTX::value_size = N; + + ////////////////////////////////////////////////////////////// + // _xmatxGTX constructors + + template + inline _xmatxGTX::_xmatxGTX() + { + for(int i = 0; i < N; ++i) + this->value[i][i] = T(0); + } + + template + inline _xmatxGTX::_xmatxGTX(const T f) + { + for(int i = 0; i < N; ++i) + this->value[i][i] = f; + } + + ////////////////////////////////////////////////////////////// + // _xmatxGTX operators + + // This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared + template + inline _xmatxGTX& _xmatxGTX::operator= (const _xmatxGTX& m) + { + //memcpy could be faster + //memcpy(&this->value, &m.value, 16 * sizeof(T)); + for(int i = 0; i < N; ++i) + this->value[i] = m[i]; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator+= (const T s) + { + for(int i = 0; i < N; ++i) + this->value[i] += s; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator+= (const _xmatxGTX& m) + { + for(int i = 0; i < N; ++i) + this->value[i] += m[i]; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator-= (const T s) + { + for(int i = 0; i < N; ++i) + this->value[i] -= s; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator-= (const _xmatxGTX& m) + { + for(int i = 0; i < N; ++i) + this->value[i] -= m[i]; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator*= (const T s) + { + for(int i = 0; i < N; ++i) + this->value[i] *= s; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator*= (const _xmatxGTX& m) + { + return (*this = *this * m); + } + + template + inline _xmatxGTX& _xmatxGTX::operator/= (const T s) + { + for(int i = 0; i < N; ++i) + this->value[i] /= s; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator/= (const _xmatxGTX& m) + { + return (*this = *this / m); + } + + template + inline _xmatxGTX& _xmatxGTX::operator-- () + { + for(int i = 0; i < N; ++i) + --this->value[i]; + return *this; + } + + template + inline _xmatxGTX& _xmatxGTX::operator++ () + { + for(int i = 0; i < N; ++i) + ++this->value[i]; + return *this; + } + + // Private functions + template + inline _xmatxGTX _xmatxGTX::_inverse() const + { + _xmatxGTX Result = *this; + + int ColIndex[N]; + int RowIndex[N]; + bool Pivoted[N]; + memset(ColIndex, 0, N * sizeof(int)); + memset(RowIndex, 0, N * sizeof(int)); + memset(Pivoted, 0, N * sizeof(bool)); + + int iRow = 0, iCol = 0; + + // elimination by full pivoting + for(int i0 = 0; i0 < N; i0++) + { + // search matrix (excluding pivoted rows) for maximum absolute entry + T fMax = T(0); + for(int i1 = 0; i1 < N; i1++) + { + if(Pivoted[i1]) + continue; + + for(int i2 = 0; i2 < N; i2++) + { + if(Pivoted[i2]) + continue; + + T Abs = abs(Result[i1][i2]); + if(Abs > fMax) + { + fMax = Abs; + iRow = i1; + iCol = i2; + } + } + } + + if(fMax == T(0)) + { + return _xmatxGTX(1.0f); // Error + } + + Pivoted[iCol] = true; + + // swap rows so that A[iCol][iCol] contains the pivot entry + if(iRow != iCol) + { + _xvecxGTX Row = rowGTX(Result, iRow); + _xvecxGTX Col = rowGTX(Result, iCol); + rowGTX(Result, iRow, Col); + rowGTX(Result, iCol, Row); + } + + // keep track of the permutations of the rows + RowIndex[i0] = iRow; + ColIndex[i0] = iCol; + + // scale the row so that the pivot entry is 1 + T fInv = T(1) / Result[iCol][iCol]; + Result[iCol][iCol] = T(1); + for(int i2 = 0; i2 < N; i2++) + Result[iCol][i2] *= fInv; + + // zero out the pivot column locations in the other rows + for(int i1 = 0; i1 < N; ++i1) + { + if(i1 == iCol) + continue; + + T Tmp = Result[i1][iCol]; + Result[i1][iCol] = T(0); + for(int i2 = 0; i2 < N; i2++) + Result[i1][i2] -= Result[iCol][i2] * Tmp; + } + } + + // reorder rows so that A[][] stores the inverse of the original matrix + for(int i1 = N-1; i1 >= 0; --i1) + { + if(RowIndex[i1] == ColIndex[i1]) + continue; + for(int i2 = 0; i2 < N; ++i2) + std::swap(Result[i2][RowIndex[i1]], Result[i2][ColIndex[i1]]); + } + + return Result; + } + + // Binary operators + template + inline _xmatxGTX operator+ (const _xmatxGTX& m, const T s) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m[i] + s; + return result; + } + + template + inline _xmatxGTX operator+ (const T s, const _xmatxGTX& m) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = s + m[i]; + return result; + } +/* + template + inline tvec4 operator+ (const _xmatxGTX& m, const tvec4& v) + { + + } + + template + inline tvec4 operator+ (const tvec4& v, const _xmatxGTX& m) + { + + } +*/ + template + inline _xmatxGTX operator+ (const _xmatxGTX& m1, const _xmatxGTX& m2) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m1[i] + m2[i]; + return result; + } + + template + inline _xmatxGTX operator- (const _xmatxGTX& m, const T s) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m[i] - s; + return result; + } + + template + inline _xmatxGTX operator- (const T s, const _xmatxGTX& m) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = s - m[i]; + return result; + } +/* + template + inline tvec4 operator- (const _xmatxGTX& m, const tvec4& v) + { + + } + + template + inline tvec4 operator- (const tvec4& v, const _xmatxGTX& m) + { + + } +*/ + template + inline _xmatxGTX operator- (const _xmatxGTX& m1, const _xmatxGTX& m2) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m1[i] - m2[i]; + return result; + } + + template + inline _xmatxGTX operator* (const _xmatxGTX& m, const T s) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m[i] * s; + return result; + } + + template + inline _xmatxGTX operator* (const T s, const _xmatxGTX& m) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = s * m[i]; + return result; + } + + template + inline _xvecxGTX operator* (const _xmatxGTX& m, const _xvecxGTX& v) + { + _xvecxGTX result(T(0)); + for(int j = 0; j < N; ++j) + for(int i = 0; i < N; ++i) + result[j] += m[i][j] * v[i]; + return result; + } + + template + inline _xvecxGTX operator* (const _xvecxGTX& v, const _xmatxGTX& m) + { + _xvecxGTX result(T(0)); + for(int j = 0; j < N; ++j) + for(int i = 0; i < N; ++i) + result[j] += m[j][i] * v[i]; + return result; + } + + template + inline _xmatxGTX operator* (const _xmatxGTX& m1, const _xmatxGTX& m2) + { + _xmatxGTX Result(T(0)); + for(int k = 0; k < N; ++k) + for(int j = 0; j < N; ++j) + for(int i = 0; i < N; ++i) + Result[k][j] += m1[i][j] * m2[k][i]; + return Result; + } + + template + inline _xmatxGTX operator/ (const _xmatxGTX& m, const T s) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m[i] / s; + return result; + } + + template + inline _xmatxGTX operator/ (const T s, const _xmatxGTX& m) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = s / m[i]; + return result; + } + + template + inline _xvecxGTX operator/ (const _xmatxGTX& m, const _xvecxGTX& v) + { + return m._inverse() * v; + } + + template + inline _xvecxGTX operator/ (const _xvecxGTX& v, const _xmatxGTX& m) + { + return v * m._inverse(); + } + + template + inline _xmatxGTX operator/ (const _xmatxGTX& m1, const _xmatxGTX& m2) + { + return m1 * m2._inverse(); + } + + // Unary constant operators + template + inline const _xmatxGTX operator- (const _xmatxGTX& m) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = -m[i]; + return result; + } + + template + inline const _xmatxGTX operator++ (const _xmatxGTX& m, int) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m[i] + T(1); + return result; + } + + template + inline const _xmatxGTX operator-- (const _xmatxGTX& m, int) + { + _xmatxGTX result; + for(int i = 0; i < N; ++i) + result[i] = m[i] - T(1); + return result; + } +}//namespace detail + + // Matrix Functions + template + inline detail::_xmatxGTX matrixCompMultGTX(const detail::_xmatxGTX& x, const detail::_xmatxGTX& y) + { + detail::_xmatxGTX result; + for(int j = 0; j < N; ++j) + for(int i = 0; i < N; ++i) + result[j][i] = x[j][i] * y[j][i]; + return result; + } + + template + inline detail::_xmatxGTX outerProductGTX(const detail::_xvecxGTX& c, const detail::_xvecxGTX& r) + { + detail::_xmatxGTX result; + for(int j = 0; j < N; ++j) + for(int i = 0; i < N; ++i) + result[j][i] = c[i] * r[j]; + return result; + } + + template + inline detail::_xmatxGTX transposeGTX(const detail::_xmatxGTX& m) + { + detail::_xmatxGTX result; + for(int j = 0; j < N; ++j) + for(int i = 0; i < N; ++i) + result[j][i] = m[i][j]; + return result; + } + + template + inline T determinantGTX(const detail::_xmatxGTX& m) + { + + } + + template + inline detail::_xmatxGTX inverseTransposeGTX(const detail::_xmatxGTX& m) + { + + } + + template + inline void columnGTX(detail::_xmatxGTX& m, int ColIndex, const detail::_xvecxGTX& v) + { + m[ColIndex] = v; + } + + template + inline void rowGTX(detail::_xmatxGTX& m, int RowIndex, const detail::_xvecxGTX& v) + { + for(int i = 0; i < N; ++i) + m[i][RowIndex] = v[i]; + } + + template + inline detail::_xvecxGTX columnGTX(const detail::_xmatxGTX& m, int ColIndex) + { + return m[ColIndex]; + } + + template + inline detail::_xvecxGTX rowGTX(const detail::_xmatxGTX& m, int RowIndex) + { + detail::_xvecxGTX v; + for(int i = 0; i < N; ++i) + v[i] = m[i][RowIndex]; + return v; + } +} //namespace glm diff --git a/glm/gtx/mixed_product.hpp b/glm/gtx/mixed_product.hpp new file mode 100644 index 0000000..4080499 --- /dev/null +++ b/glm/gtx/mixed_product.hpp @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-04-03 +// Updated : 2008-09-17 +// Licence : This source is under MIT License +// File : glm/gtx/mixed_product.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_mixed_product +#define glm_gtx_mixed_product + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_matrix_selection(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_mixed_product extension: Mixed product of 3 vectors. + namespace mixed_product + { + //! \brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) + template + valType mixedProduct( + detail::tvec3 const & v1, + detail::tvec3 const & v2, + detail::tvec3 const & v3); + }//namespace mixed_product + }//namespace gtx +}//namespace glm + +#define GLM_GTX_mixed_product namespace gtx::mixed_product +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_mixed_product;} +#endif//GLM_GTX_GLOBAL + +#include "mixed_product.inl" + +#endif//glm_gtx_mixed_product diff --git a/glm/gtx/mixed_product.inl b/glm/gtx/mixed_product.inl new file mode 100644 index 0000000..06acce5 --- /dev/null +++ b/glm/gtx/mixed_product.inl @@ -0,0 +1,36 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-04-03 +// Updated : 2008-09-17 +// Licence : This source is under MIT License +// File : glm/gtx/mixed_product.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ + +namespace mixed_product +{ + template + inline valType mixedProduct( + detail::tvec3 const & v1, + detail::tvec3 const & v2, + detail::tvec3 const & v3) + { + return dot(cross(v1, v2), v3); + } +} +//namespace mixed_product + +}//namespace gtx +}//namespace glm + + + + + + + + + diff --git a/glm/gtx/norm.hpp b/glm/gtx/norm.hpp new file mode 100644 index 0000000..10bfc2b --- /dev/null +++ b/glm/gtx/norm.hpp @@ -0,0 +1,146 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-07-24 +// Licence : This source is under MIT License +// File : glm/gtx/norm.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_quaternion +// - GLM_GTC_double_float +/////////////////////////////////////////////////////////////////////////////////////////////////// +// ToDo: +// - Study the validity of the notion of length2 to quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_norm +#define glm_gtx_norm + +// Dependency: +#include "../glm.hpp" +#include "../gtc/double_float.hpp" +#include "../gtx/quaternion.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_norm(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_norm extension: Varius way to compute vector norms. + namespace norm + { + //! Returns the squared length of x. + //! From GLM_GTX_norm extension. + template + T length2( + const T x); + + //! Returns the squared length of x. + //! From GLM_GTX_norm extension. + template + T length2( + const detail::tvec2 & x); + + //! Returns the squared length of x. + //! From GLM_GTX_norm extension. + template + T length2( + const detail::tvec3& x); + + //! Returns the squared length of x. + //! From GLM_GTX_norm extension. + template + T length2( + const detail::tvec4& x); + + //! Returns the squared length of x. + //! From GLM_GTX_norm extension. + template + T length2( + const detail::tquat& q); + + //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). + //! From GLM_GTX_norm extension. + template + T distance2( + const T p0, + const T p1); + + //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). + //! From GLM_GTX_norm extension. + template + T distance2( + const detail::tvec2& p0, + const detail::tvec2& p1); + + //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). + //! From GLM_GTX_norm extension. + template + T distance2( + const detail::tvec3& p0, + const detail::tvec3& p1); + + //! Returns the squared distance between p0 and p1, i.e., length(p0 - p1). + //! From GLM_GTX_norm extension. + template + T distance2( + const detail::tvec4& p0, + const detail::tvec4& p1); + + //! Returns the L1 norm between x and y. + //! From GLM_GTX_norm extension. + template + T l1Norm( + const detail::tvec3& x, + const detail::tvec3& y); + + //! Returns the L1 norm of v. + //! From GLM_GTX_norm extension. + template + T l1Norm( + const detail::tvec3& v); + + //! Returns the L2 norm between x and y. + //! From GLM_GTX_norm extension. + template + T l2Norm( + const detail::tvec3& x, + const detail::tvec3& y); + + //! Returns the L2 norm of v. + //! From GLM_GTX_norm extension. + template + T l2Norm( + const detail::tvec3& x); + + //! Returns the L norm between x and y. + //! From GLM_GTX_norm extension. + template + T lxNorm( + const detail::tvec3& x, + const detail::tvec3& y, + unsigned int Depth); + + //! Returns the L norm of v. + //! From GLM_GTX_norm extension. + template + T lxNorm( + const detail::tvec3& x, + unsigned int Depth); + + }//namespace norm + }//namespace gtx +}//namespace glm + +#define GLM_GTX_norm namespace gtx::norm +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_norm;} +#endif//GLM_GTX_GLOBAL + +#include "norm.inl" + +#endif//glm_gtx_norm diff --git a/glm/gtx/norm.inl b/glm/gtx/norm.inl new file mode 100644 index 0000000..f01c16c --- /dev/null +++ b/glm/gtx/norm.inl @@ -0,0 +1,130 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-07-24 +// Licence : This source is under MIT License +// File : glm/gtx/norm.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace norm +{ + template + inline T length2( + const T x) + { + return x * x; + } + + template + inline T length2( + const detail::tvec2& x) + { + return dot(x, x); + } + + template + inline T length2( + const detail::tvec3& x) + { + return dot(x, x); + } + + template + inline T length2( + const detail::tvec4& x) + { + return dot(x, x); + } + + template + inline T length2( + const detail::tquat& q) + { + return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w; + } + + template + T distance2( + const T p0, + const T p1) + { + return length2(p1 - p0); + } + + template + T distance2( + const detail::tvec2& p0, + const detail::tvec2& p1) + { + return length2(p1 - p0); + } + + template + T distance2( + const detail::tvec3& p0, + const detail::tvec3& p1) + { + return length2(p1 - p0); + } + + template + T distance2( + const detail::tvec4& p0, + const detail::tvec4& p1) + { + return length2(p1 - p0); + } + + template + inline T l1Norm( + const detail::tvec3& a, + const detail::tvec3& b) + { + return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z); + } + + template + inline T l1Norm( + const detail::tvec3& v) + { + return abs(v.x) + abs(v.y) + abs(v.z); + } + + template + inline T l2Norm( + const detail::tvec3& a, + const detail::tvec3& b) + { + return length(b - a); + } + + template + inline T l2Norm( + const detail::tvec3& v) + { + return length(v); + } + + template + inline T lxNorm( + const detail::tvec3& x, + const detail::tvec3& y, + unsigned int Depth) + { + return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth)); + } + + template + inline T lxNorm( + const detail::tvec3& v, + unsigned int Depth) + { + return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth)); + } + +}//namespace norm +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/normal.hpp b/glm/gtx/normal.hpp new file mode 100644 index 0000000..6c9eeec --- /dev/null +++ b/glm/gtx/normal.hpp @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/normal.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_normal +#define glm_gtx_normal + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_normal(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_normal extension: Compute the normal of a triangle. + namespace normal + { + //! Computes triangle normal from triangle points. + //! From GLM_GTX_normal extension. + template + detail::tvec3 triangleNormal( + detail::tvec3 const & p1, + detail::tvec3 const & p2, + detail::tvec3 const & p3); + + }//namespace normal + }//namespace gtx +}//namespace glm + +#define GLM_GTX_normal namespace gtx::normal +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_normal;} +#endif//GLM_GTX_GLOBAL + +#include "normal.inl" + +#endif//glm_gtx_normal diff --git a/glm/gtx/normal.inl b/glm/gtx/normal.inl new file mode 100644 index 0000000..630d5df --- /dev/null +++ b/glm/gtx/normal.inl @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2005-12-21 +// Licence : This source is under MIT License +// File : glm/gtx/normal.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace normal{ + + template + inline detail::tvec3 triangleNormal + ( + detail::tvec3 const & p1, + detail::tvec3 const & p2, + detail::tvec3 const & p3 + ) + { + return normalize(cross(p1 - p2, p1 - p3)); + } + +}//namespace normal +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/normalize_dot.hpp b/glm/gtx/normalize_dot.hpp new file mode 100644 index 0000000..1db3aea --- /dev/null +++ b/glm/gtx/normalize_dot.hpp @@ -0,0 +1,54 @@ +////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-09-28 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/normalize_dot.h +////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_fast_square_root +////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_normalize_dot +#define glm_gtx_normalize_dot + +// Dependency: +#include "../glm.hpp" +#include "../gtx/fast_square_root.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_normalize_dot extension: Dot product of vectors that need to be normalize with a single square root. + namespace normalize_dot + { + //! Normalize parameters and returns the dot product of x and y. + //! It's faster that dot(normalize(x), normalize(y)). + //! From GLM_GTX_normalize_dot extension. + template + typename genType::value_type normalizeDot( + genType const & x, + genType const & y); + + //! Normalize parameters and returns the dot product of x and y. + //! Faster that dot(fastNormalize(x), fastNormalize(y)). + //! From GLM_GTX_normalize_dot extension. + template + typename genType::value_type fastNormalizeDot( + genType const & x, + genType const & y); + + }//namespace normalize_dot + }//namespace gtx +}//namespace glm + +#define GLM_GTX_normalize_dot namespace gtx::fast_square_root; using namespace gtx::normalize_dot +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_normalize_dot;} +#endif//GLM_GTX_GLOBAL + +#include "normalize_dot.inl" + +#endif//glm_gtx_normalize_dot diff --git a/glm/gtx/normalize_dot.inl b/glm/gtx/normalize_dot.inl new file mode 100644 index 0000000..5f0527e --- /dev/null +++ b/glm/gtx/normalize_dot.inl @@ -0,0 +1,120 @@ +////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-09-28 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/normalize_dot.inl +////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace normalize_dot{ + +template +inline genType normalizeDot +( + genType const & x, + genType const & y +) +{ + return + glm::dot(x, y) * + glm::inversesqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +template +inline valType normalizeDot +( + detail::tvec2 const & x, + detail::tvec2 const & y +) +{ + return + glm::dot(x, y) * + glm::inversesqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +template +inline valType normalizeDot +( + detail::tvec3 const & x, + detail::tvec3 const & y +) +{ + return + glm::dot(x, y) * + glm::inversesqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +template +inline valType normalizeDot +( + detail::tvec4 const & x, + detail::tvec4 const & y +) +{ + return + glm::dot(x, y) * + glm::inversesqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +template +inline genType fastNormalizeDot +( + genType const & x, + genType const & y +) +{ + return + glm::dot(x, y) * + glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +template +inline valType fastNormalizeDot +( + detail::tvec2 const & x, + detail::tvec2 const & y +) +{ + return + glm::dot(x, y) * + glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +template +inline valType fastNormalizeDot +( + detail::tvec3 const & x, + detail::tvec3 const & y +) +{ + return + glm::dot(x, y) * + glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +template +inline valType fastNormalizeDot +( + detail::tvec4 const & x, + detail::tvec4 const & y +) +{ + return + glm::dot(x, y) * + glm::gtx::fast_square_root::fastInverseSqrt(glm::dot(x, x) * + glm::dot(y, y)); +} + +}//namespace normalize_dot +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/number_precision.hpp b/glm/gtx/number_precision.hpp new file mode 100644 index 0000000..40b3916 --- /dev/null +++ b/glm/gtx/number_precision.hpp @@ -0,0 +1,65 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-05-10 +// Updated : 2009-06-04 +// Licence : This source is under MIT License +// File : glm/gtx/number_precision.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_type_precision +// - GLM_GTC_quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_number_precision +#define glm_gtx_number_precision + +// Dependency: +#include "../glm.hpp" +#include "../gtc/type_precision.hpp" + +namespace glm{ +namespace gtx{ +//! GLM_GTX_number_precision extension: Defined size types. +namespace number_precision +{ + using namespace gtc::type_precision; + + ///////////////////////////// + // Unsigned int vector types + + typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTX_number_precision extension) + typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTX_number_precision extension) + typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTX_number_precision extension) + typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTX_number_precision extension) + + ////////////////////// + // Float vector types + + typedef f16 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension) + typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) + typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) + + ////////////////////// + // Float matrix types + + typedef f16 f16mat1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension) + typedef f16 f16mat1x1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension) + typedef f32 f32mat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) + typedef f32 f32mat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) + typedef f64 f64mat1; //!< \brief Double-precision floating-point scalar. (from GLM_GTX_number_precision extension) + typedef f64 f64mat1x1; //!< \brief Double-precision floating-point scalar. (from GLM_GTX_number_precision extension) + +}//namespace number_precision +}//namespace gtx +}//namespace glm + +#define GLM_GTX_number_precision namespace gtx::number_precision +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_number_precision;} +#endif//GLM_GTX_GLOBAL + +#include "number_precision.inl" + +#endif//glm_gtx_number_precision diff --git a/glm/gtx/number_precision.inl b/glm/gtx/number_precision.inl new file mode 100644 index 0000000..37b9419 --- /dev/null +++ b/glm/gtx/number_precision.inl @@ -0,0 +1,13 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-05-10 +// Updated : 2007-05-10 +// Licence : This source is under MIT License +// File : glm/gtx/number_precision.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + +} diff --git a/glm/gtx/ocl_type.hpp b/glm/gtx/ocl_type.hpp new file mode 100644 index 0000000..c7814c9 --- /dev/null +++ b/glm/gtx/ocl_type.hpp @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-07 +// Updated : 2009-05-07 +// Licence : This source is under MIT License +// File : glm/gtx/number_precision.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_ocl_type +#define glm_gtx_ocl_type + +// Dependency: +#include "../glm.hpp" + +namespace glm{ +namespace gtx{ +//! GLM_GTX_ocl_type extension: OpenCL types. +namespace ocl_type +{ + /////////////////////////// + // Scalar types + + typedef detail::int8 cl_char; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::int16 cl_short; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::int32 cl_int; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::int64 cl_long; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + typedef detail::uint8 cl_uchar; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::uint16 cl_ushort; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::uint32 cl_uint; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::uint64 cl_ulong; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + typedef detail::float16 cl_half; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + typedef detail::float32 cl_float; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + + + typedef detail::int8 cl_char1; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::int16 cl_short1; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::int32 cl_int1; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::int64 cl_long1; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + typedef detail::uint8 cl_uchar1; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::uint16 cl_ushort1; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::uint32 cl_uint1; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::uint64 cl_ulong1; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + //typedef detail::float16 cl_half1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + typedef detail::float32 cl_float1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + + + typedef detail::tvec2 cl_char2; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec2 cl_short2; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec2 cl_int2; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec2 cl_long2; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + typedef detail::tvec2 cl_uchar2; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec2 cl_ushort2; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec2 cl_uint2; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec2 cl_ulong2; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + //typedef detail::tvec2 cl_half2; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + typedef detail::tvec2 cl_float2; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + + + typedef detail::tvec3 cl_char3; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec3 cl_short3; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec3 cl_int3; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec3 cl_long3; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + typedef detail::tvec3 cl_uchar3; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec3 cl_ushort3; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec3 cl_uint3; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec3 cl_ulong3; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + //typedef detail::tvec3 cl_half3; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + typedef detail::tvec3 cl_float3; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + + + typedef detail::tvec4 cl_char4; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_short4; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_int4; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_long4; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_uchar4; //!< \brief 8bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_ushort4; //!< \brief 16bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_uint4; //!< \brief 32bit signed integer. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_ulong4; //!< \brief 64bit signed integer. (from GLM_GTX_ocl_type extension) + + //typedef detail::tvec4 cl_half4; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + typedef detail::tvec4 cl_float4; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_ocl_type extension) + +}//namespace ocl_type +}//namespace gtx +}//namespace glm + +#define GLM_GTX_ocl_type namespace gtx::ocl_type; +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_ocl_type;} +#endif//GLM_GTX_GLOBAL + +#include "ocl_type.inl" + +#endif//glm_gtx_ocl_type diff --git a/glm/gtx/ocl_type.inl b/glm/gtx/ocl_type.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtx/optimum_pow.hpp b/glm/gtx/optimum_pow.hpp new file mode 100644 index 0000000..31af92e --- /dev/null +++ b/glm/gtx/optimum_pow.hpp @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/optimum_pow.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_optimum_pow +#define glm_gtx_optimum_pow + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_optimum_pow(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_optimum_pow extension: Integer exponenciation of power functions. + namespace optimum_pow + { + //! Returns x raised to the power of 2. + //! From GLM_GTX_optimum_pow extension. + template + genType pow2(const genType& x); + + //! Returns x raised to the power of 3. + //! From GLM_GTX_optimum_pow extension. + template + genType pow3(const genType& x); + + //! Returns x raised to the power of 4. + //! From GLM_GTX_optimum_pow extension. + template + genType pow4(const genType& x); + + //! Checks if the parameter is a power of 2 number. + //! From GLM_GTX_optimum_pow extension. + bool powOfTwo(int num); + + //! Checks to determine if the parameter component are power of 2 numbers. + //! From GLM_GTX_optimum_pow extension. + detail::tvec2 powOfTwo(const detail::tvec2& x); + + //! Checks to determine if the parameter component are power of 2 numbers. + //! From GLM_GTX_optimum_pow extension. + detail::tvec3 powOfTwo(const detail::tvec3& x); + + //! Checks to determine if the parameter component are power of 2 numbers. + //! From GLM_GTX_optimum_pow extension. + detail::tvec4 powOfTwo(const detail::tvec4& x); + + }//namespace optimum_pow + }//namespace gtx +}//namespace glm + +#define GLM_GTX_optimum_pow namespace gtx::optimum_pow +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_optimum_pow;} +#endif//GLM_GTX_GLOBAL + +#include "optimum_pow.inl" + +#endif//glm_gtx_optimum_pow diff --git a/glm/gtx/optimum_pow.inl b/glm/gtx/optimum_pow.inl new file mode 100644 index 0000000..4176a29 --- /dev/null +++ b/glm/gtx/optimum_pow.inl @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2005-12-27 +// Licence : This source is under MIT License +// File : glm/gtx/optimum_pow.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace optimum_pow{ + + template + inline genType pow2(const genType& x) + { + return x * x; + } + + template + inline genType pow3(const genType& x) + { + return x * x * x; + } + + template + inline genType pow4(const genType& x) + { + return x * x * x * x; + } + + inline bool powOfTwo(int x) + { + return !(x & (x - 1)); + } + + inline detail::tvec2 powOfTwo(const detail::tvec2& x) + { + return detail::tvec2( + powOfTwo(x.x), + powOfTwo(x.y)); + } + + inline detail::tvec3 powOfTwo(const detail::tvec3& x) + { + return detail::tvec3( + powOfTwo(x.x), + powOfTwo(x.y), + powOfTwo(x.z)); + } + + inline detail::tvec4 powOfTwo(const detail::tvec4& x) + { + return detail::tvec4( + powOfTwo(x.x), + powOfTwo(x.y), + powOfTwo(x.z), + powOfTwo(x.w)); + } + +}//namespace optimum_pow +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/orthonormalize.hpp b/glm/gtx/orthonormalize.hpp new file mode 100644 index 0000000..e6eda84 --- /dev/null +++ b/glm/gtx/orthonormalize.hpp @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/orthonormalize.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_orthonormalize +#define glm_gtx_orthonormalize + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_orthonormalize(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_orthonormalize extension: Orthonormalize matrices. + namespace orthonormalize + { + //! Returns the orthonormalized matrix of m. + //! From GLM_GTX_orthonormalize extension. + template + detail::tmat3x3 orthonormalize( + const detail::tmat3x3& m); + + //! Orthonormalizes x according y. + //! From GLM_GTX_orthonormalize extension. + template + detail::tvec3 orthonormalize( + const detail::tvec3& x, + const detail::tvec3& y); + + }//namespace orthonormalize + }//namespace gtx +}//namespace glm + +#define GLM_GTX_orthonormalize namespace gtx::orthonormalize +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_orthonormalize;} +#endif//GLM_GTX_GLOBAL + +#include "orthonormalize.inl" + +#endif//glm_gtx_orthonormalize diff --git a/glm/gtx/orthonormalize.inl b/glm/gtx/orthonormalize.inl new file mode 100644 index 0000000..bd6857d --- /dev/null +++ b/glm/gtx/orthonormalize.inl @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2005-12-21 +// Licence : This source is under MIT License +// File : glm/gtx/orthonormalize.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace orthonormalize{ + + template + inline detail::tmat3x3 orthonormalize + ( + const detail::tmat3x3& m + ) + { + detail::tmat3x3 r = m; + + r[0] = normalize(r[0]); + + float d0 = dot(r[0], r[1]); + r[1] -= r[0] * d0; + r[1] = normalize(r[1]); + + float d1 = dot(r[1], r[2]); + d0 = dot(r[0], r[2]); + r[2] -= r[0] * d0 + r[1] * d1; + r[2] = normalize(r[2]); + + return r; + } + + template + inline detail::tvec3 orthonormalize + ( + const detail::tvec3& x, + const detail::tvec3& y + ) + { + return normalize(x - y * dot(y, x)); + } + +}//namespace orthonormalize +}//namespace gtx +}//namespace glm + diff --git a/glm/gtx/perpendicular.hpp b/glm/gtx/perpendicular.hpp new file mode 100644 index 0000000..9eb07b6 --- /dev/null +++ b/glm/gtx/perpendicular.hpp @@ -0,0 +1,63 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-03-06 +// Licence : This source is under MIT License +// File : glm/gtx/perpendicular.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_projection +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_perpendicular +#define glm_gtx_perpendicular + +// Dependency: +#include "../glm.hpp" +#include "../gtx/projection.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_perpendicular(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_perpendicular extension: Perpendicular of a vector from other one + namespace perpendicular + { + //! Projects x a perpendicular axis of Normal. + //! From GLM_GTX_perpendicular extension. + template + detail::tvec2 perp( + detail::tvec2 const & x, + detail::tvec2 const & Normal); + + //! Projects x a perpendicular axis of Normal. + //! From GLM_GTX_perpendicular extension. + template + detail::tvec3 perp( + detail::tvec3 const & x, + detail::tvec3 const & Normal); + + //! Projects x a perpendicular axis of Normal. + //! From GLM_GTX_perpendicular extension. + template + detail::tvec4 perp( + detail::tvec4 const & x, + detail::tvec4 const & Normal); + + }//namespace perpendicular + }//namespace gtx +}//namespace glm + +#define GLM_GTX_perpendicular namespace gtx::perpendicular +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_perpendicular;} +#endif//GLM_GTX_GLOBAL + +#include "perpendicular.inl" + +#endif//glm_gtx_perpendicular diff --git a/glm/gtx/perpendicular.inl b/glm/gtx/perpendicular.inl new file mode 100644 index 0000000..8732653 --- /dev/null +++ b/glm/gtx/perpendicular.inl @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-03-06 +// Licence : This source is under MIT License +// File : glm/gtx/perpendicular.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace perpendicular{ + +template +inline detail::tvec2 perp( + detail::tvec2 const & x, + detail::tvec2 const & Normal) +{ + return x - projection::proj(x, Normal); +} + +template +inline detail::tvec3 perp( + detail::tvec3 const & x, + detail::tvec3 const & Normal) +{ + return x - projection::proj(x, Normal); +} + +template +inline detail::tvec4 perp( + detail::tvec4 const & x, + detail::tvec4 const & Normal) +{ + return x - projection::proj(x, Normal); +} + +}//namespace perpendicular +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/polar_coordinates.hpp b/glm/gtx/polar_coordinates.hpp new file mode 100644 index 0000000..e6b22f5 --- /dev/null +++ b/glm/gtx/polar_coordinates.hpp @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-06 +// Updated : 2009-05-01 +// Licence : This source is under MIT License +// File : glm/gtx/polar_coordinates.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_polar_coordinates +#define glm_gtx_polar_coordinates + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_polar_coordinates extension: Conversion from Euclidean space to polar space and revert. + namespace polar_coordinates + { + //! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. + //! From GLM_GTX_polar_coordinates extension. + template + detail::tvec3 polar(const detail::tvec3& euclidean); + + //! Convert Polar to Euclidean coordinates. + //! From GLM_GTX_polar_coordinates extension. + template + detail::tvec3 euclidean(const detail::tvec3& polar); + + }//namespace polar_coordinates + }//namespace gtx +}//namespace glm + +#define GLM_GTX_polar_coordinates namespace gtx::polar_coordinates +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_polar_coordinates;} +#endif//GLM_GTX_GLOBAL + +#include "polar_coordinates.inl" + +#endif//glm_gtx_polar_coordinates diff --git a/glm/gtx/polar_coordinates.inl b/glm/gtx/polar_coordinates.inl new file mode 100644 index 0000000..4b9295c --- /dev/null +++ b/glm/gtx/polar_coordinates.inl @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-06 +// Updated : 2009-05-01 +// Licence : This source is under MIT License +// File : glm/gtx/polar_coordinates.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace polar_coordinates +{ + template + inline detail::tvec3 polar( + const detail::tvec3& euclidean) + { + T length = length(euclidean); + detail::tvec3 tmp = euclidean / length; + T xz_dist = sqrt(tmp.x * tmp.x + tmp.z * tmp.z); + + return detail::tvec3( + degrees(atan(xz_dist, tmp.y)), // latitude + degrees(atan(tmp.x, tmp.z)), // longitude + xz_dist); // xz distance + } + + template + inline detail::tvec3 euclidean( + const detail::tvec3& polar) + { + T latitude = radians(polar.x); + T longitude = radians(polar.y); + return detail::tvec3( + cos(latitude) * sin(longitude), + sin(latitude), + cos(latitude) * cos(longitude)); + } + +}//namespace polar_coordinates +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/projection.hpp b/glm/gtx/projection.hpp new file mode 100644 index 0000000..e542565 --- /dev/null +++ b/glm/gtx/projection.hpp @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-03-06 +// Licence : This source is under MIT License +// File : glm/gtx/projection.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_projection +#define glm_gtx_projection + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_projection(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_projection extension: Projection of a vector to other one + namespace projection + { + //! Projects x on Normal. + //! From GLM_GTX_projection extension. + template + detail::tvec2 proj( + detail::tvec2 const & x, + detail::tvec2 const & Normal); + + //! Projects x on Normal. + //! From GLM_GTX_projection extension. + template + detail::tvec3 proj( + detail::tvec3 const & x, + detail::tvec3 const & Normal); + + //! Projects x on Normal. + //! From GLM_GTX_projection extension. + template + detail::tvec4 proj( + detail::tvec4 const & x, + detail::tvec4 const & Normal); + + }//namespace projection + }//namespace gtx +}//namespace glm + +#define GLM_GTX_projection namespace gtx::projection +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_projection;} +#endif//GLM_GTX_GLOBAL + +#include "projection.inl" + +#endif//glm_gtx_projection diff --git a/glm/gtx/projection.inl b/glm/gtx/projection.inl new file mode 100644 index 0000000..d7fcb7d --- /dev/null +++ b/glm/gtx/projection.inl @@ -0,0 +1,40 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-03-06 +// Licence : This source is under MIT License +// File : glm/gtx/projection.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace projection{ + +template +inline detail::tvec2 proj( + detail::tvec2 const & x, + detail::tvec2 const & Normal) +{ + return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; +} + +template +inline detail::tvec3 proj( + detail::tvec3 const & x, + detail::tvec3 const & Normal) +{ + return dot(x, Normal) / glm::dot(Normal, Normal) * Normal; +} + +template +inline detail::tvec4 proj( + detail::tvec4 const & x, + detail::tvec4 const & Normal) +{ + return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; +} + +}//namespace projection +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/quaternion.hpp b/glm/gtx/quaternion.hpp new file mode 100644 index 0000000..f339b9d --- /dev/null +++ b/glm/gtx/quaternion.hpp @@ -0,0 +1,198 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-05-21 +// Licence : This source is under MIT License +// File : glm/gtx/quaternion.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// +// ToDo: +// - Study constructors with angles and axis +// - Study constructors with vec3 that are the imaginary component of quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_quaternion +#define glm_gtx_quaternion + +// Dependency: +#include "../glm.hpp" +#include "../gtc/quaternion.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_quaternion extension: Quaternion types and functions + namespace quaternion + { + using namespace gtc::quaternion; + + //! Compute a cross product between a quaternion and a vector. + //! From GLM_GTX_quaternion extension. + template + detail::tvec3 cross( + detail::tquat const & q, + detail::tvec3 const & v); + + //! Compute a cross product between a vector and a quaternion. + //! From GLM_GTX_quaternion extension. + template + detail::tvec3 cross( + detail::tvec3 const & v, + detail::tquat const & q); + + //! Compute a point on a path according squad equation. + //! q1 and q2 are control points; s1 and s2 are intermediate control points. + //! From GLM_GTX_quaternion extension. + template + detail::tquat squad( + detail::tquat const & q1, + detail::tquat const & q2, + detail::tquat const & s1, + detail::tquat const & s2, + valType const & h); + + //! Returns an intermediate control point for squad interpolation. + //! From GLM_GTX_quaternion extension. + template + detail::tquat intermediate( + detail::tquat const & prev, + detail::tquat const & curr, + detail::tquat const & next); + + //! Returns a exp of a quaternion. + //! From GLM_GTX_quaternion extension. + template + detail::tquat exp( + detail::tquat const & q, + valType const & exponent); + + //! Returns a log of a quaternion. + //! From GLM_GTX_quaternion extension. + template + detail::tquat log( + detail::tquat const & q); + + //! Returns x raised to the y power. + //! From GLM_GTX_quaternion extension. + template + detail::tquat pow( + detail::tquat const & x, + valType const & y); + + //! Returns quarternion square root. + //! From GLM_GTX_quaternion extension. + //template + //detail::tquat sqrt( + // detail::tquat const & q); + + //! Rotates a 3 components vector by a quaternion. + //! From GLM_GTX_transform extension. + template + detail::tvec3 rotate( + detail::tquat const & q, + detail::tvec3 const & v); + + //! Rotates a 4 components vector by a quaternion. + //! From GLM_GTX_transform extension. + template + detail::tvec4 rotate( + detail::tquat const & q, + detail::tvec4 const & v); + + //! Returns the q rotation angle. + //! From GLM_GTX_quaternion extension. + template + valType angle( + detail::tquat const & x); + + //! Returns the q rotation axis. + //! From GLM_GTX_quaternion extension. + template + detail::tvec3 axis( + detail::tquat const & x); + + //! Build a quaternion from an angle and an axis. + //! From GLM_GTX_quaternion extension. + template + detail::tquat angleAxis( + valType const & angle, + valType const & x, + valType const & y, + valType const & z); + + //! Build a quaternion from an angle and an axis. + //! From GLM_GTX_quaternion extension. + template + detail::tquat angleAxis( + valType const & angle, + detail::tvec3 const & v); + + //! Extract the real component of a quaternion. + //! From GLM_GTX_quaternion extension. + template + valType extractRealComponent( + detail::tquat const & q); + + //! Returns roll value of euler angles. + //! From GLM_GTX_quaternion extension. + template + valType roll( + detail::tquat const & x); + + //! Returns pitch value of euler angles. + //! From GLM_GTX_quaternion extension. + template + valType pitch( + detail::tquat const & x); + + //! Returns yaw value of euler angles. + //! From GLM_GTX_quaternion extension. + template + valType yaw( + detail::tquat const & x); + + //! Returns euler angles, yitch as x, yaw as y, roll as z. + //! From GLM_GTX_quaternion extension. + template + detail::tvec3 eularAngles( + detail::tquat const & x); + + //! Converts a quaternion to a 3 * 3 matrix. + //! From GLM_GTX_quaternion extension. + template + detail::tmat3x3 toMat3( + detail::tquat const & x){return gtc::quaternion::mat3_cast(x);} + + //! Converts a quaternion to a 4 * 4 matrix. + //! From GLM_GTX_quaternion extension. + template + detail::tmat4x4 toMat4( + detail::tquat const & x){return gtc::quaternion::mat4_cast(x);} + + //! Converts a 3 * 3 matrix to a quaternion. + //! From GLM_GTX_quaternion extension. + template + detail::tquat toQuat( + detail::tmat3x3 const & x){return gtc::quaternion::quat_cast(x);} + + //! Converts a 4 * 4 matrix to a quaternion. + //! From GLM_GTX_quaternion extension. + template + detail::tquat toQuat( + detail::tmat4x4 const & x){return gtc::quaternion::quat_cast(x);} + + }//namespace quaternion + }//namespace gtx +} //namespace glm + +#define GLM_GTX_quaternion namespace gtx::quaternion +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_quaternion;} +#endif//GLM_GTX_GLOBAL + +#include "quaternion.inl" + +#endif//glm_gtx_quaternion diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl new file mode 100644 index 0000000..405b675 --- /dev/null +++ b/glm/gtx/quaternion.inl @@ -0,0 +1,251 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2008-11-27 +// Licence : This source is under MIT License +// File : glm/gtx/quaternion.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm{ +namespace gtx{ +namespace quaternion +{ + template + inline detail::tvec3 cross + ( + detail::tvec3 const & v, + detail::tquat const & q + ) + { + return gtc::quaternion::inverse(q) * v; + } + + template + inline detail::tvec3 cross + ( + detail::tquat const & q, + detail::tvec3 const & v + ) + { + return q * v; + } + + template + inline detail::tquat squad + ( + detail::tquat const & q1, + detail::tquat const & q2, + detail::tquat const & s1, + detail::tquat const & s2, + T const & h) + { + return mix(mix(q1, q2, h), mix(s1, s2, h), T(2) * h (T(1) - h)); + } + + template + inline detail::tquat intermediate + ( + detail::tquat const & prev, + detail::tquat const & curr, + detail::tquat const & next + ) + { + detail::tquat invQuat = gtc::quaternion::inverse(curr); + return ext((log(next + invQuat) + log(prev + invQuat)) / T(-4)) * curr; + } + + template + inline detail::tquat exp + ( + detail::tquat const & q, + T const & exponent + ) + { + detail::tvec3 u(q.x, q.y, q.z); + float a = glm::length(u); + detail::tvec3 v(u / a); + return detail::tquat(cos(a), sin(a) * v); + } + + template + inline detail::tquat log + ( + detail::tquat const & q + ) + { + if((q.x == T(0)) && (q.y == T(0)) && (q.z == T(0))) + { + if(q.w > T(0)) + return detail::tquat(log(q.w), T(0), T(0), T(0)); + else if(q.w < T(0)) + return detail::tquat(log(-q.w), T(3.1415926535897932384626433832795), T(0),T(0)); + else + return detail::tquat(std::numeric_limits::infinity(), std::numeric_limits::infinity(), std::numeric_limits::infinity(), std::numeric_limits::infinity()); + } + else + { + T Vec3Len = sqrt(q.x * q.x + q.y * q.y + q.z * q.z); + T QuatLen = sqrt(Vec3Len * Vec3Len + q.w * q.w); + T t = atan(Vec3Len, T(q.w)) / Vec3Len; + return detail::tquat(t * q.x, t * q.y, t * q.z, log(QuatLen)); + } + } + + template + inline detail::tquat pow + ( + detail::tquat const & x, + T const & y + ) + { + if(abs(x.w) > T(0.9999)) + return x; + float Angle = acos(y); + float NewAngle = Angle * y; + float Div = sin(NewAngle) / sin(Angle); + return detail::tquat( + cos(NewAngle), + x.x * Div, + x.y * Div, + x.z * Div); + } + + //template + //inline detail::tquat sqrt + //( + // detail::tquat const & q + //) + //{ + // T q0 = T(1) - dot(q, q); + // return T(2) * (T(1) + q0) * q; + //} + + template + inline detail::tvec3 rotate + ( + detail::tquat const & q, + detail::tvec3 const & v + ) + { + return q * v; + } + + template + inline detail::tvec4 rotate + ( + detail::tquat const & q, + detail::tvec4 const & v + ) + { + return q * v; + } + + template + inline T angle + ( + detail::tquat const & x + ) + { + return acos(x.w) * T(2); + } + + template + inline detail::tvec3 axis + ( + detail::tquat const & x + ) + { + T tmp1 = T(1) - x.w * x.w; + if(tmp1 <= T(0)) + return detail::tvec3(0, 0, 1); + T tmp2 = T(1) / sqrt(tmp1); + return detail::tvec3(x.x * tmp2, x.y * tmp2, x.z * tmp2); + } + + template + inline detail::tquat angleAxis + ( + valType const & angle, + valType const & x, + valType const & y, + valType const & z + ) + { + return angleAxis(angle, detail::tvec3(x, y, z)); + } + + template + inline detail::tquat angleAxis + ( + valType const & angle, + detail::tvec3 const & v + ) + { + detail::tquat result; + detail::tvec3 v_normalized = glm::normalize(v); + + valType a = glm::radians(angle); + valType s = glm::sin(a * valType(0.5)); + + result.w = glm::cos(a * valType(0.5)); + result.x = v.x * s; + result.y = v.y * s; + result.z = v.z * s; + return result; + } + + template + inline T extractRealComponent + ( + detail::tquat const & q + ) + { + T w = T(1.0) - q.x * q.x - q.y * q.y - q.z * q.z; + if(w < T(0)) + return T(0); + else + return -sqrt(w); + } + + template + inline valType roll + ( + detail::tquat const & q + ) + { + return atan2(valType(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z); + } + + template + inline valType pitch + ( + detail::tquat const & q + ) + { + return atan2(valType(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z); + } + + template + inline valType yaw + ( + detail::tquat const & q + ) + { + return asin(valType(-2) * (q.x * q.z - q.w * q.y)); + } + + template + inline detail::tvec3 eularAngles + ( + detail::tquat const & x + ) + { + return detail::tvec3(pitch(x), yaw(x), roll(x)); + } + +}//namespace quaternion +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/random.hpp b/glm/gtx/random.hpp new file mode 100644 index 0000000..c35b70a --- /dev/null +++ b/glm/gtx/random.hpp @@ -0,0 +1,85 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-16 +// Updated : 2007-08-30 +// Licence : This source is under MIT License +// File : glm/gtx/random.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_vecx +// - GLM_GTX_half_float +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_random +#define glm_gtx_random + +// Dependency: +#include "../glm.hpp" +#include "../gtx/half_float.hpp" + +namespace glm{ +namespace gtx{ +//! GLM_GTX_random extension: Generate random number from varius distribution methods +namespace random +{ + //! Generate a random number in the interval [-1, 1], according a linear distribution. + //! From GLM_GTX_random extension. + template T signedRand1(); + + template <> float signedRand1(); //!< \brief Generate a random number in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension) + template <> double signedRand1(); //!< \brief Generate a random number in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec2 signedRand2(); //!< \brief Generate 2 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec3 signedRand3(); //!< \brief Generate 3 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec4 signedRand4(); //!< \brief Generate 4 random numbers in the interval [-1, 1], according a linear distribution (From GLM_GTX_random extension) + + template detail::tvec2 normalizedRand2(); //!< \brief Generate a normalized 2D vector regulary distribute on a circle (From GLM_GTX_random extension) + template detail::tvec2 normalizedRand2(T Min, T Max); //!< \brief Generate a scaled and normalized 2D vector regulary distribute on a circle (From GLM_GTX_random extension) + template detail::tvec3 normalizedRand3(); //!< \brief Generate a normalized 3D vector regulary distribute on a sphere (From GLM_GTX_random extension) + template detail::tvec3 normalizedRand3(T Min, T Max); //!< \brief Generate a scaled and normalized 3D vector regulary distribute on a sphere (From GLM_GTX_random extension) + + template T compRand1(); //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension) + template <> float compRand1(); //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension) + template <> double compRand1(); //!< \brief Generate a random number in the interval [0, 1], according a linear distribution (From GLM_GTX_random extension) + template T compRand1(T Min, T Max); //!< \brief Generate a random number in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec2 compRand2(T Min, T Max); //!< \brief Generate 2 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec3 compRand3(T Min, T Max); //!< \brief Generate 3 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec4 compRand4(T Min, T Max); //!< \brief Generate 4 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec2 compRand2(const detail::tvec2& Min, const detail::tvec2& Max); //!< \brief Generate 2 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec3 compRand3(const detail::tvec3& Min, const detail::tvec3& Max); //!< \brief Generate 3 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension) + template detail::tvec3 compRand4(const detail::tvec4& Min, const detail::tvec4& Max); //!< \brief Generate 4 random numbers in the interval [Min, Max], according a linear distribution (From GLM_GTX_random extension) + + template detail::tvec2 vecRand2(); //!< \brief Generate a random normalized 2 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension) + template detail::tvec2 vecRand2(T MinRadius, T MaxRadius); //!< \brief Generate a random normalized 2 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension) + template detail::tvec3 vecRand3(); //!< \brief Generate a random normalized 3 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension) + template detail::tvec3 vecRand3(T MinRadius, T MaxRadius); //!< \brief Generate a random normalized 3 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension) + template detail::tvec4 vecRand4(); //!< \brief Generate a random normalized 4 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension) + template detail::tvec4 vecRand4(T MinRadius, T MaxRadius); //!< \brief Generate a random normalized 4 component vector. It's a spherical uniform distribution. (From GLM_GTX_random extension) + + template T gaussRand1(T mean, T std_deviation); //!< \brief Gererate a random floating number according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec2 gaussRand2(T mean, T std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec3 gaussRand3(T mean, T std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec4 gaussRand4(T mean, T std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec2 gaussRand2(const detail::tvec2& mean, T std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec3 gaussRand3(const detail::tvec3& mean, T std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec4 gaussRand4(const detail::tvec4& mean, T std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec2 gaussRand2(T mean, const detail::tvec2& std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec3 gaussRand3(T mean, const detail::tvec3& std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec4 gaussRand4(T mean, const detail::tvec4& std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec2 gaussRand2(const detail::tvec2& mean, const detail::tvec2& std_deviation); //!< \brief Gererate 2 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec3 gaussRand3(const detail::tvec3& mean, const detail::tvec3& std_deviation); //!< \brief Gererate 3 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + template detail::tvec4 gaussRand4(const detail::tvec4& mean, const detail::tvec4& std_deviation); //!< \brief Gererate 4 random floating numbers according a Gauss distribution. (From GLM_GTX_random extension) + +}//namespace random +}//namespace gtx +}//namespace glm + +#define GLM_GTX_random namespace gtx::random +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_random;} +#endif//GLM_GTX_GLOBAL + +#include "random.inl" + +#endif//glm_gtx_random diff --git a/glm/gtx/random.inl b/glm/gtx/random.inl new file mode 100644 index 0000000..5a87681 --- /dev/null +++ b/glm/gtx/random.inl @@ -0,0 +1,515 @@ +////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-16 +// Updated : 2006-01-16 +// Licence : This source is under MIT License +// File : glm/gtx/random.inl +////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +namespace glm{ +namespace gtx{ +namespace random +{ + template <> + inline float signedRand1() + { + #if(GLM_COMPILER == GLM_COMPILER_VC80) + #define RAND_SHIFT_NUM 5 + #else + #define RAND_SHIFT_NUM 0 + #endif + return float((std::rand() - (RAND_MAX >> 1) - 1) << 1) / float(RAND_MAX - RAND_SHIFT_NUM); + } + + template <> + inline double signedRand1() + { + return double(signedRand1()); + } + + template + inline detail::tvec2 signedRand2() + { + return detail::tvec2( + signedRand1(), + signedRand1()); + } + + template + inline detail::tvec3 signedRand3() + { + return detail::tvec3( + signedRand1(), + signedRand1(), + signedRand1()); + } + + template + inline detail::tvec4 signedRand4() + { + return detail::tvec4( + signedRand1(), + signedRand1(), + signedRand1(), + signedRand1()); + } + + template + inline detail::tvec2 normalizedRand2() + { + T a = compRand1(T(0), T(6.283185307179586476925286766559f)); + return detail::tvec2(cos(a), sin(a)); + } + + template + inline detail::tvec3 normalizedRand3() + { + T z = compRand1(T(-1), T(1)); + T a = compRand1(T(0), T(6.283185307179586476925286766559f)); + + T r = sqrt(T(1) - z * z); + + T x = r * cos(a); + T y = r * sin(a); + + return detail::tvec3(x, y, z); + } + + template + inline detail::tvec3 normalizedRand3( + T Min, + T Max) + { + return normalizedRand3() * compRand1(Min, Max); + } + + template <> + inline float compRand1() + { + return float(std::rand()) / float(RAND_MAX); + } + + template <> + inline double compRand1() + { + return double(std::rand()) / double(RAND_MAX); + } + + template + inline T compRand1( + T Min, + T Max) + { + return compRand1() * (Max - Min) + Min; + } + + template + inline detail::tvec2 compRand2( + T Min, + T Max) + { + return detail::tvec2( + compRand1(Min, Max), + compRand1(Min, Max)); + } + + template + inline detail::tvec3 compRand3( + T Min, + T Max) + { + return detail::tvec3( + compRand1(Min, Max), + compRand1(Min, Max), + compRand1(Min, Max)); + } + + template + inline detail::tvec4 compRand4( + T Min, + T Max) + { + return detail::tvec4( + compRand1(Min, Max), + compRand1(Min, Max), + compRand1(Min, Max), + compRand1(Min, Max)); + } + + template + inline detail::tvec2 compRand2( + T Min, + const detail::tvec2& Max) + { + return detail::tvec2( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y)); + } + + template + inline detail::tvec3 compRand3( + T Min, + const detail::tvec3& Max) + { + return detail::tvec3( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y), + compRand1(Min.z, Max.z)); + } + + template + inline detail::tvec4 compRand4( + T Min, + const detail::tvec4& Max) + { + return detail::tvec4( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y), + compRand1(Min.z, Max.z), + compRand1(Min.w, Max.w)); + } + + template + inline detail::tvec2 compRand2( + const detail::tvec2& Min, + T Max) + { + return detail::tvec2( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y)); + } + + template + inline detail::tvec3 compRand3( + const detail::tvec3& Min, + T Max) + { + return detail::tvec3( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y), + compRand1(Min.z, Max.z)); + } + + template + inline detail::tvec4 compRand4( + const detail::tvec4& Min, + T Max) + { + return detail::tvec4( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y), + compRand1(Min.z, Max.z), + compRand1(Min.w, Max.w)); + } + + template + inline detail::tvec2 compRand2( + const detail::tvec2& Min, + const detail::tvec2& Max) + { + return detail::tvec2( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y)); + } + + template + inline detail::tvec3 compRand3( + const detail::tvec3& Min, + const detail::tvec3& Max) + { + return detail::tvec3( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y), + compRand1(Min.z, Max.z)); + } + + template + inline detail::tvec4 compRand4( + const detail::tvec4& Min, + const detail::tvec4& Max) + { + return detail::tvec4( + compRand1(Min.x, Max.x), + compRand1(Min.y, Max.y), + compRand1(Min.z, Max.z), + compRand1(Min.w, Max.w)); + } + + template + inline detail::tvec2 vecRand2() + { + detail::tvec2 result(float(0)); + do + { + result = compRand2(float(-1), float(1)); + } while (length(result) > float(1)); + + return result; + } + + template + inline detail::tvec2 vecRand2() + { + detail::tvec2 result(double(0)); + do + { + result = compRand2(double(-1), double(1)); + } while (length(result) > double(1)); + + return result; + } + + template + inline detail::tvec2 vecRand2( + T MinRadius, + T MaxRadius) + { + assert(MinRadius <= MaxRadius); + + detail::tvec2 Result(T(0)); + T LenRadius(0); + + do + { + Result = compRand2(-MaxRadius, MaxRadius); + LenRadius = length(Result); + } + while(LenRadius > MaxRadius || LenRadius < MinRadius); + + return Result; + } + + template + inline detail::tvec3 vecRand3() + { + detail::tvec3 Result(T(0)); + do + { + Result = compRand3(T(-1), T(1)); + } + while(length(Result) > T(1)); + + return Result; + } + + template + inline detail::tvec3 vecRand3( + T MinRadius, + T MaxRadius) + { + assert(MinRadius <= MaxRadius); + + detail::tvec3 Result(0); + T LenRadius(0); + + do + { + Result = compRand3(-MaxRadius, MaxRadius); + LenRadius = length(Result); + } + while(LenRadius > MaxRadius || LenRadius < MinRadius); + + return Result; + } + + template + inline detail::tvec4 vecRand4() + { + detail::tvec4 result(float(0)); + do + { + result = compRand4(float(-1), float(1)); + } while (length(result) > float(1)); + + return result; + } + + template + inline detail::tvec4 vecRand4() + { + detail::tvec4 result(double(0)); + do + { + result = compRand4(double(-1), double(1)); + } while (length(result) > double(1)); + + return result; + } + + template + inline detail::tvec4 vecRand4( + T MinRadius, + T MaxRadius) + { + assert(MinRadius <= MaxRadius); + + detail::tvec4 Result(T(0)); + T LenRadius(T(0)); + + do + { + Result = compRand4(-MaxRadius, MaxRadius); + LenRadius = length(Result); + } + while(LenRadius > MaxRadius || LenRadius < MinRadius); + + return Result; + } + + template + inline T gaussRand1( + T mean, + T std_deviation) + { + T w, x1, x2; + + do + { + x1 = compRand1(T(-1), T(1)); + x2 = compRand1(T(-1), T(1)); + + w = x1 * x1 + x2 * x2; + } while(w > T(1)); + + return x2 * std_deviation * std_deviation * sqrt((T(-2) * log(w)) / w) + mean; + } + + template + inline detail::tvec2 gaussRand2( + T mean, + T std_deviation) + { + return detail::tvec2( + gaussRand1(mean, std_deviation), + gaussRand1(mean, std_deviation)); + } + + template + inline detail::tvec3 gaussRand3( + T mean, + T std_deviation) + { + return detail::tvec3( + gaussRand1(mean, std_deviation), + gaussRand1(mean, std_deviation), + gaussRand1(mean, std_deviation)); + } + + template + inline detail::tvec4 gaussRand4( + T mean, + T std_deviation) + { + return detail::tvec4( + gaussRand1(mean, std_deviation), + gaussRand1(mean, std_deviation), + gaussRand1(mean, std_deviation), + gaussRand1(mean, std_deviation)); + } + + template + inline detail::tvec2 gaussRand2( + T mean, + const detail::tvec2& std_deviation) + { + return detail::tvec2( + gaussRand1(mean, std_deviation.x), + gaussRand1(mean, std_deviation.y)); + } + + template + inline detail::tvec3 gaussRand3( + T mean, + const detail::tvec3& std_deviation) + { + return detail::tvec3( + gaussRand1(mean, std_deviation.x), + gaussRand1(mean, std_deviation.y), + gaussRand1(mean, std_deviation.z)); + } + + template + inline detail::tvec4 gaussRand4( + T mean, + const detail::tvec4& std_deviation) + { + return detail::tvec4( + gaussRand1(mean, std_deviation.x), + gaussRand1(mean, std_deviation.y), + gaussRand1(mean, std_deviation.z), + gaussRand1(mean, std_deviation.w)); + } + + template + inline detail::tvec2 gaussRand2( + const detail::tvec2& mean, + T std_deviation) + { + return detail::tvec2( + gaussRand1(mean.x, std_deviation), + gaussRand1(mean.y, std_deviation)); + } + + template + inline detail::tvec3 gaussRand3( + const detail::tvec3& mean, + T std_deviation) + { + return detail::tvec3( + gaussRand1(mean.x, std_deviation), + gaussRand1(mean.y, std_deviation), + gaussRand1(mean.z, std_deviation)); + } + + template + inline detail::tvec4 gaussRand4( + const detail::tvec4& mean, + T std_deviation) + { + return detail::tvec4( + gaussRand1(mean.x, std_deviation), + gaussRand1(mean.y, std_deviation), + gaussRand1(mean.z, std_deviation), + gaussRand1(mean.w, std_deviation)); + } + + template + inline detail::tvec2 gaussRand2( + const detail::tvec2& mean, + const detail::tvec2& std_deviation) + { + return detail::tvec2( + gaussRand1(mean.x, std_deviation.x), + gaussRand1(mean.y, std_deviation.y)); + } + + template + inline detail::tvec3 gaussRand3( + const detail::tvec3& mean, + const detail::tvec3& std_deviation) + { + return detail::tvec3( + gaussRand1(mean.x, std_deviation.x), + gaussRand1(mean.y, std_deviation.y), + gaussRand1(mean.z, std_deviation.z)); + } + + template + inline detail::tvec4 gaussRand4( + const detail::tvec4& mean, + const detail::tvec4& std_deviation) + { + return detail::tvec4( + gaussRand1(mean.x, std_deviation.x), + gaussRand1(mean.y, std_deviation.y), + gaussRand1(mean.z, std_deviation.z), + gaussRand1(mean.w, std_deviation.w)); + } + +}//namespace random +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/raw_data.hpp b/glm/gtx/raw_data.hpp new file mode 100644 index 0000000..0a51da1 --- /dev/null +++ b/glm/gtx/raw_data.hpp @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-11-19 +// Updated : 2008-11-19 +// Licence : This source is under MIT License +// File : glm/gtx/raw_data.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_raw_data +#define glm_gtx_raw_data + +// Dependency: +#include "../glm.hpp" +#include "../gtc/type_precision.hpp" + +namespace glm +{ + namespace gtx + { + //! GLM_GTX_raw_data extension: Projection of a vector to other one + namespace raw_data + { + //! Type for byte numbers. + //! From GLM_GTX_raw_data extension. + typedef gtc::type_precision::uint8 byte; + + //! Type for word numbers. + //! From GLM_GTX_raw_data extension. + typedef gtc::type_precision::uint16 word; + + //! Type for dword numbers. + //! From GLM_GTX_raw_data extension. + typedef gtc::type_precision::uint32 dword; + + //! Type for qword numbers. + //! From GLM_GTX_raw_data extension. + typedef gtc::type_precision::uint64 qword; + } + } +} + +#define GLM_GTX_raw_data namespace gtx::raw_data +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_raw_data;} +#endif//GLM_GTX_GLOBAL + +#include "raw_data.inl" + +#endif//glm_gtx_raw_data diff --git a/glm/gtx/raw_data.inl b/glm/gtx/raw_data.inl new file mode 100644 index 0000000..fa89e37 --- /dev/null +++ b/glm/gtx/raw_data.inl @@ -0,0 +1,11 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-11-19 +// Updated : 2008-11-19 +// Licence : This source is under MIT License +// File : glm/gtx/raw_data.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/glm/gtx/reciprocal.hpp b/glm/gtx/reciprocal.hpp new file mode 100644 index 0000000..21e4e9f --- /dev/null +++ b/glm/gtx/reciprocal.hpp @@ -0,0 +1,100 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-09 +// Updated : 2008-10-09 +// Licence : This source is under MIT License +// File : glm/gtx/reciprocal.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_reciprocal +#define glm_gtx_reciprocal + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_reciprocal(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_reciprocal extension: Define secant, cosecant and cotangent functions. + namespace reciprocal + { + //! Secant function. + //! hypotenuse / adjacent or 1 / cos(x) + //! From GLM_GTX_reciprocal extension. + template + genType sec(genType const & angle); + + //! Cosecant function. + //! hypotenuse / opposite or 1 / sin(x) + //! From GLM_GTX_reciprocal extension. + template + genType csc(genType const & angle); + + //! Cotangent function. + //! adjacent / opposite or 1 / tan(x) + //! From GLM_GTX_reciprocal extension. + template + genType cot(genType const & angle); + + //! Inverse secant function. + //! From GLM_GTX_reciprocal extension. + template + genType asec(genType const & x); + + //! Inverse cosecant function. + //! From GLM_GTX_reciprocal extension. + template + genType acsc(genType const & x); + + //! Inverse cotangent function. + //! From GLM_GTX_reciprocal extension. + template + genType acot(genType const & x); + + //! Secant hyperbolic function. + //! From GLM_GTX_reciprocal extension. + template + genType sech(genType const & angle); + + //! Cosecant hyperbolic function. + //! From GLM_GTX_reciprocal extension. + template + genType csch(genType const & angle); + + //! Cotangent hyperbolic function. + //! From GLM_GTX_reciprocal extension. + template + genType coth(genType const & angle); + + //! Inverse secant hyperbolic function. + //! From GLM_GTX_reciprocal extension. + template + genType asech(genType const & x); + + //! Inverse cosecant hyperbolic function. + //! From GLM_GTX_reciprocal extension. + template + genType acsch(genType const & x); + + //! Inverse cotangent hyperbolic function. + //! From GLM_GTX_reciprocal extension. + template + genType acoth(genType const & x); + + }//namespace reciprocal + }//namespace gtx +}//namespace glm + +#define GLM_GTX_reciprocal namespace gtx::reciprocal +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_reciprocal;} +#endif//GLM_GTX_GLOBAL + +#include "reciprocal.inl" + +#endif//glm_gtx_reciprocal diff --git a/glm/gtx/reciprocal.inl b/glm/gtx/reciprocal.inl new file mode 100644 index 0000000..e13f677 --- /dev/null +++ b/glm/gtx/reciprocal.inl @@ -0,0 +1,593 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-09 +// Updated : 2008-10-09 +// Licence : This source is under MIT License +// File : glm/gtx/reciprocal.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace reciprocal{ + +// sec +template +inline genType sec +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(1) / glm::cos(angle); +} + +template +inline detail::tvec2 sec +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + sec(angle.x), + sec(angle.y)); +} + +template +inline detail::tvec3 sec +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + sec(angle.x), + sec(angle.y), + sec(angle.z)); +} + +template +inline detail::tvec4 sec +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + sec(angle.x), + sec(angle.y), + sec(angle.z), + sec(angle.w)); +} + +// csc +template +inline genType csc +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(1) / glm::sin(angle); +} + +template +inline detail::tvec2 csc +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + csc(angle.x), + csc(angle.y)); +} + +template +inline detail::tvec3 csc +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + csc(angle.x), + csc(angle.y), + csc(angle.z)); +} + +template +inline detail::tvec4 csc +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + csc(angle.x), + csc(angle.y), + csc(angle.z), + csc(angle.w)); +} + +// cot +template +inline genType cot +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(1) / glm::tan(angle); +} + +template +inline detail::tvec2 cot +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + cot(angle.x), + cot(angle.y)); +} + +template +inline detail::tvec3 cot +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + cot(angle.x), + cot(angle.y), + cot(angle.z)); +} + +template +inline detail::tvec4 cot +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + cot(angle.x), + cot(angle.y), + cot(angle.z), + cot(angle.w)); +} + +// asec +template +inline genType asec +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return acos(genType(1) / x); +} + +template +inline detail::tvec2 asec +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + asec(x.x), + asec(x.y)); +} + +template +inline detail::tvec3 asec +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + asec(x.x), + asec(x.y), + asec(x.z)); +} + +template +inline detail::tvec4 asec +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + asec(x.x), + asec(x.y), + asec(x.z), + asec(x.w)); +} + +// acsc +template +inline genType acsc +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return asin(genType(1) / x); +} + +template +inline detail::tvec2 acsc +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + acsc(x.x), + acsc(x.y)); +} + +template +inline detail::tvec3 acsc +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + acsc(x.x), + acsc(x.y), + acsc(x.z)); +} + +template +inline detail::tvec4 acsc +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + acsc(x.x), + acsc(x.y), + acsc(x.z), + acsc(x.w)); +} + +// acot +template +inline genType acot +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0); + return pi_over_2 - atan(x); +} + +template +inline detail::tvec2 acot +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + acot(x.x), + acot(x.y)); +} + +template +inline detail::tvec3 acot +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + acot(x.x), + acot(x.y), + acot(x.z)); +} + +template +inline detail::tvec4 acot +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + acot(x.x), + acot(x.y), + acot(x.z), + acot(x.w)); +} + +// sech +template +inline genType sech +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(1) / glm::cosh(angle); +} + +template +inline detail::tvec2 sech +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + sech(angle.x), + sech(angle.y)); +} + +template +inline detail::tvec3 sech +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + sech(angle.x), + sech(angle.y), + sech(angle.z)); +} + +template +inline detail::tvec4 sech +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + sech(angle.x), + sech(angle.y), + sech(angle.z), + sech(angle.w)); +} + +// csch +template +inline genType csch +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return genType(1) / glm::sinh(angle); +} + +template +inline detail::tvec2 csch +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + csch(angle.x), + csch(angle.y)); +} + +template +inline detail::tvec3 csch +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + csch(angle.x), + csch(angle.y), + csch(angle.z)); +} + +template +inline detail::tvec4 csch +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + csch(angle.x), + csch(angle.y), + csch(angle.z), + csch(angle.w)); +} + +// coth +template +inline genType coth +( + genType const & angle +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return glm::cosh(angle) / glm::sinh(angle); +} + +template +inline detail::tvec2 coth +( + detail::tvec2 const & angle +) +{ + return detail::tvec2( + coth(angle.x), + coth(angle.y)); +} + +template +inline detail::tvec3 coth +( + detail::tvec3 const & angle +) +{ + return detail::tvec3( + coth(angle.x), + coth(angle.y), + coth(angle.z)); +} + +template +inline detail::tvec4 coth +( + detail::tvec4 const & angle +) +{ + return detail::tvec4( + coth(angle.x), + coth(angle.y), + coth(angle.z), + coth(angle.w)); +} + +// asech +template +inline genType asech +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return acosh(genType(1) / x); +} + +template +inline detail::tvec2 asech +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + asech(x.x), + asech(x.y)); +} + +template +inline detail::tvec3 asech +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + asech(x.x), + asech(x.y), + asech(x.z)); +} + +template +inline detail::tvec4 asech +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + asech(x.x), + asech(x.y), + asech(x.z), + asech(x.w)); +} + +// acsch +template +inline genType acsch +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return asinh(genType(1) / x); +} + +template +inline detail::tvec2 acsch +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + acsch(x.x), + acsch(x.y)); +} + +template +inline detail::tvec3 acsch +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + acsch(x.x), + acsch(x.y), + acsch(x.z)); +} + +template +inline detail::tvec4 acsch +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + acsch(x.x), + acsch(x.y), + acsch(x.z), + acsch(x.w)); +} + +// acoth +template +inline genType acoth +( + genType const & x +) +{ + GLM_STATIC_ASSERT(detail::type::is_float); + + return atanh(genType(1) / x); +} + +template +inline detail::tvec2 acoth +( + detail::tvec2 const & x +) +{ + return detail::tvec2( + acoth(x.x), + acoth(x.y)); +} + +template +inline detail::tvec3 acoth +( + detail::tvec3 const & x +) +{ + return detail::tvec3( + acoth(x.x), + acoth(x.y), + acoth(x.z)); +} + +template +inline detail::tvec4 acoth +( + detail::tvec4 const & x +) +{ + return detail::tvec4( + acoth(x.x), + acoth(x.y), + acoth(x.z), + acoth(x.w)); +} + +}//namespace reciprocal +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/rotate_vector.hpp b/glm/gtx/rotate_vector.hpp new file mode 100644 index 0000000..efb5ad2 --- /dev/null +++ b/glm/gtx/rotate_vector.hpp @@ -0,0 +1,110 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-11-02 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/rotate_vector.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_rotate_vector +#define glm_gtx_rotate_vector + +// Dependency: +#include "../glm.hpp" +#include "../gtx/transform.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_rotate_vector extension: Function to directly rotate a vector + namespace rotate_vector + { + using namespace transform; + + //! Rotate a two dimentionnals vector. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec2 rotate( + const detail::tvec2& v, + T angle); + + //! Rotate a three dimentionnals vector around an axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec3 rotate( + const detail::tvec3& v, + T angle, + const detail::tvec3& normal); + + //! Rotate a four dimentionnals vector around an axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec4 rotate( + const detail::tvec4& v, T angle, + const detail::tvec3& normal); + + //! Rotate a three dimentionnals vector around the X axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec3 rotateX( + const detail::tvec3& v, + T angle); + + //! Rotate a three dimentionnals vector around the Y axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec3 rotateY( + const detail::tvec3& v, + T angle); + + //! Rotate a three dimentionnals vector around the Z axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec3 rotateZ( + const detail::tvec3& v, + T angle); + + //! Rotate a four dimentionnals vector around the X axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec4 rotateX( + const detail::tvec4& v, + T angle); + + //! Rotate a four dimentionnals vector around the X axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec4 rotateY( + const detail::tvec4& v, + T angle); + + //! Rotate a four dimentionnals vector around the X axis. + //! From GLM_GTX_rotate_vector extension. + template + detail::tvec4 rotateZ( + const detail::tvec4& v, + T angle); + + //! Build a rotation matrix from a normal and a up vector. + //! From GLM_GTX_rotate_vector extension. + template + detail::tmat4x4 orientation( + const detail::tvec3& Normal, + const detail::tvec3& Up); + + }//namespace rotate_vector + }//namespace gtx +}//namespace glm + +#define GLM_GTX_rotate_vector namespace gtx::rotate_vector +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_rotate_vector;} +#endif//GLM_GTX_GLOBAL + +#include "rotate_vector.inl" + +#endif//glm_gtx_rotate_vector diff --git a/glm/gtx/rotate_vector.inl b/glm/gtx/rotate_vector.inl new file mode 100644 index 0000000..d2200e8 --- /dev/null +++ b/glm/gtx/rotate_vector.inl @@ -0,0 +1,145 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-11-02 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/rotate_vector.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace rotate_vector +{ + template + inline detail::tvec2 rotate( + const detail::tvec2& v, + T angle) + { + detail::tvec2 Result; + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + Result.x = v.x * Cos - v.y * Sin; + Result.y = v.x * Sin + v.y * Cos; + return Result; + } + + template + inline detail::tvec3 rotate( + const detail::tvec3& v, T angle, + const detail::tvec3& normal) + { + return detail::tmat3x3(transform::rotate(angle, normal)) * v; + } +/* + template + inline detail::tvec3 rotateGTX(const detail::tvec3& x, T angle, const detail::tvec3& normal) + { + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + return x * Cos + ((x * normal) * (T(1) - Cos)) * normal + cross(x, normal) * Sin; + } +*/ + template + inline detail::tvec4 rotate( + const detail::tvec4& v, + T angle, + const detail::tvec3& normal) + { + return transform::rotate(angle, normal) * v; + } + + template + inline detail::tvec3 rotateX( + const detail::tvec3& v, + T angle) + { + detail::tvec3 Result = v; + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + Result.y = v.y * Cos - v.z * Sin; + Result.z = v.y * Sin + v.z * Cos; + return Result; + } + + template + inline detail::tvec3 rotateY( + const detail::tvec3& v, + T angle) + { + detail::tvec3 Result = v; + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + Result.x = v.x * Cos + v.z * Sin; + Result.z = -v.x * Sin + v.z * Cos; + return Result; + } + + template + inline detail::tvec3 rotateZ( + const detail::tvec3& v, + T angle) + { + detail::tvec3 Result = v; + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + Result.x = v.x * Cos - v.y * Sin; + Result.y = v.x * Sin + v.y * Cos; + return Result; + } + + template + inline detail::tvec4 rotateX( + const detail::tvec4& v, + T angle) + { + detail::tvec4 Result = v; + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + Result.y = v.y * Cos - v.z * Sin; + Result.z = v.y * Sin + v.z * Cos; + return Result; + } + + template + inline detail::tvec4 rotateY( + const detail::tvec4& v, + T angle) + { + detail::tvec4 Result = v; + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + Result.x = v.x * Cos + v.z * Sin; + Result.z = -v.x * Sin + v.z * Cos; + return Result; + } + + template + inline detail::tvec4 rotateZ( + const detail::tvec4& v, + T angle) + { + detail::tvec4 Result = v; + const T Cos = cos(radians(angle)); + const T Sin = sin(radians(angle)); + Result.x = v.x * Cos - v.y * Sin; + Result.y = v.x * Sin + v.y * Cos; + return Result; + } + + template + inline detail::tmat4x4 orientation( + const detail::tvec3& Normal, + const detail::tvec3& Up) + { + if(all(equal(Normal, Up))) + return detail::tmat4x4(T(1)); + + detail::tvec3 RotationAxis = cross(Up, Normal); + T Angle = degrees(acos(dot(Normal, Up))); + return rotate(Angle, RotationAxis); + } + +}//namespace rotate_vector +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/simd_common.hpp b/glm/gtx/simd_common.hpp new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtx/simd_common.inl b/glm/gtx/simd_common.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtx/simd_geometric.hpp b/glm/gtx/simd_geometric.hpp new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtx/simd_geometric.inl b/glm/gtx/simd_geometric.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp new file mode 100644 index 0000000..8c94ec1 --- /dev/null +++ b/glm/gtx/simd_mat4.hpp @@ -0,0 +1,144 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-07 +// Updated : 2009-05-07 +// Licence : This source is under MIT License +// File : glm/gtx/simd_vec4.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - intrinsic +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_simd_mat4 +#define glm_gtx_simd_mat4 + +// Dependency: +#include "../glm.hpp" +#include +#include + +namespace glm +{ + namespace detail + { + GLM_ALIGN(16) struct fmat4x4SIMD + { + static __m128 one; + + enum no_init + { + NO_INIT + }; + + typedef float value_type; + typedef fvec4SIMD col_type; + typedef fvec4SIMD row_type; + typedef glm::sizeType size_type; + static size_type value_size(); + static size_type col_size(); + static size_type row_size(); + static bool is_matrix(); + + fvec4SIMD Data[4]; + + ////////////////////////////////////// + // Constructors + + fmat4x4SIMD(); + explicit fmat4x4SIMD(float const & s); + explicit fmat4x4SIMD( + float const & x0, float const & y0, float const & z0, float const & w0, + float const & x1, float const & y1, float const & z1, float const & w1, + float const & x2, float const & y2, float const & z2, float const & w2, + float const & x3, float const & y3, float const & z3, float const & w3); + explicit fmat4x4SIMD( + fvec4SIMD const & v0, + fvec4SIMD const & v1, + fvec4SIMD const & v2, + fvec4SIMD const & v3); + explicit fmat4x4SIMD( + tmat4x4 const & m); + + // Conversions + //template + //explicit tmat4x4(tmat4x4 const & m); + + //explicit tmat4x4(tmat2x2 const & x); + //explicit tmat4x4(tmat3x3 const & x); + //explicit tmat4x4(tmat2x3 const & x); + //explicit tmat4x4(tmat3x2 const & x); + //explicit tmat4x4(tmat2x4 const & x); + //explicit tmat4x4(tmat4x2 const & x); + //explicit tmat4x4(tmat3x4 const & x); + //explicit tmat4x4(tmat4x3 const & x); + + // Accesses + fvec4SIMD & operator[](size_type i); + fvec4SIMD const & operator[](size_type i) const; + + // Unary updatable operators + fmat4x4SIMD & operator= (fmat4x4SIMD const & m); + fmat4x4SIMD & operator+= (float const & s); + fmat4x4SIMD & operator+= (fmat4x4SIMD const & m); + fmat4x4SIMD & operator-= (float const & s); + fmat4x4SIMD & operator-= (fmat4x4SIMD const & m); + fmat4x4SIMD & operator*= (float const & s); + fmat4x4SIMD & operator*= (fmat4x4SIMD const & m); + fmat4x4SIMD & operator/= (float const & s); + fmat4x4SIMD & operator/= (fmat4x4SIMD const & m); + fmat4x4SIMD & operator++ (); + fmat4x4SIMD & operator-- (); + }; + + // Binary operators + fmat4x4SIMD operator+ (fmat4x4SIMD const & m, float const & s); + fmat4x4SIMD operator+ (float const & s, fmat4x4SIMD const & m); + fmat4x4SIMD operator+ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2); + + fmat4x4SIMD operator- (fmat4x4SIMD const & m, float const & s); + fmat4x4SIMD operator- (float const & s, fmat4x4SIMD const & m); + fmat4x4SIMD operator- (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2); + + fmat4x4SIMD operator* (fmat4x4SIMD const & m, float const & s); + fmat4x4SIMD operator* (float const & s, fmat4x4SIMD const & m); + + fvec4SIMD operator* (fmat4x4SIMD const & m, fvec4SIMD const & v); + fvec4SIMD operator* (fvec4SIMD const & v, fmat4x4SIMD const & m); + + fmat4x4SIMD operator* (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2); + + fmat4x4SIMD operator/ (fmat4x4SIMD const & m, float const & s); + fmat4x4SIMD operator/ (float const & s, fmat4x4SIMD const & m); + + fvec4SIMD operator/ (fmat4x4SIMD const & m, fvec4SIMD const & v); + fvec4SIMD operator/ (fvec4SIMD const & v, fmat4x4SIMD const & m); + + fmat4x4SIMD operator/ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2); + + // Unary constant operators + fmat4x4SIMD const operator- (fmat4x4SIMD const & m); + fmat4x4SIMD const operator-- (fmat4x4SIMD const & m, int); + fmat4x4SIMD const operator++ (fmat4x4SIMD const & m, int); + + }//namespace detail + + namespace gtx{ + //! GLM_GTX_simd_mat4 extension: SIMD implementation of vec4 type. + namespace simd_mat4 + { + typedef detail::fmat4SIMD mat4SIMD; + + }//namespace simd_mat4 + }//namespace gtx +}//namespace glm + +#define GLM_GTX_simd_mat4 namespace gtx::simd_mat4; +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_simd_mat4;} +#endif//GLM_GTX_GLOBAL + +#include "simd_mat4.inl" + +#endif//glm_gtx_simd_mat4 diff --git a/glm/gtx/simd_mat4.inl b/glm/gtx/simd_mat4.inl new file mode 100644 index 0000000..a66a22c --- /dev/null +++ b/glm/gtx/simd_mat4.inl @@ -0,0 +1,221 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-19 +// Updated : 2009-05-19 +// Licence : This source is under MIT License +// File : glm/gtx/simd_mat4.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace detail +{ + inline fmat4x4SIMD::fmat4x4SIMD() + {} + + inline fmat4x4SIMD::fmat4x4SIMD(float const & s) + { + this->value[0] = fvec4SIMD(s, 0, 0, 0); + this->value[1] = fvec4SIMD(0, s, 0, 0); + this->value[2] = fvec4SIMD(0, 0, s, 0); + this->value[3] = fvec4SIMD(0, 0, 0, s); + } + + inline fmat4x4SIMD::fmat4x4SIMD + ( + float const & x0, float const & y0, float const & z0, float const & w0, + float const & x1, float const & y1, float const & z1, float const & w1, + float const & x2, float const & y2, float const & z2, float const & w2, + float const & x3, float const & y3, float const & z3, float const & w3 + ) + { + this->value[0] = fvec4SIMD(x0, y0, z0, w0); + this->value[1] = fvec4SIMD(x1, y1, z1, w1); + this->value[2] = fvec4SIMD(x2, y2, z2, w2); + this->value[3] = fvec4SIMD(x3, y3, z3, w3); + } + + inline fmat4x4SIMD::fmat4x4SIMD + ( + fvec4SIMD const & v0, + fvec4SIMD const & v1, + fvec4SIMD const & v2, + fvec4SIMD const & v3 + ) + { + this->value[0] = v0; + this->value[1] = v1; + this->value[2] = v2; + this->value[3] = v3; + } + + inline fmat4x4SIMD::fmat4x4SIMD + ( + tmat4x4 const & m + ) + { + this->value[0] = fvec4SIMD(m[0]); + this->value[1] = fvec4SIMD(m[1]); + this->value[2] = fvec4SIMD(m[2]); + this->value[3] = fvec4SIMD(m[3]); + } + + ////////////////////////////////////// + // Accesses + + inline fvec4SIMD & fmat4x4SIMD::operator[] + ( + typename fmat4x4SIMD::size_type i + ) + { + assert( + i >= typename tmat4x4::size_type(0) && + i < tmat4x4::col_size()); + + return value[i]; + } + + inline fvec4SIMD const & fmat4x4SIMD::operator[] + ( + typename fmat4x4SIMD::size_type i + ) const + { + assert( + i >= typename fmat4x4SIMD::size_type(0) && + i < fmat4x4SIMD::col_size()); + + return value[i]; + } + + ////////////////////////////////////////////////////////////// + // mat4 operators + + inline fmat4x4SIMD& fmat4x4SIMD::operator= + ( + fmat4x4SIMD const & m + ) + { + this->value[0].Data = m[0].Data; + this->value[1].Data = m[1].Data; + this->value[2].Data = m[2].Data; + this->value[3].Data = m[3].Data; + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator+= + ( + fmat4x4SIMD const & m + ) + { + this->value[0].Data = _mm_add_ps(this->value[0].Data, m[0].Data); + this->value[1].Data = _mm_add_ps(this->value[1].Data, m[1].Data); + this->value[2].Data = _mm_add_ps(this->value[2].Data, m[2].Data); + this->value[3].Data = _mm_add_ps(this->value[3].Data, m[3].Data); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator-= + ( + fmat4x4SIMD const & m + ) + { + this->value[0].Data = _mm_sub_ps(this->value[0].Data, m[0].Data); + this->value[1].Data = _mm_sub_ps(this->value[1].Data, m[1].Data); + this->value[2].Data = _mm_sub_ps(this->value[2].Data, m[2].Data); + this->value[3].Data = _mm_sub_ps(this->value[3].Data, m[3].Data); + + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator*= + ( + fmat4x4SIMD const & m + ) + { + _mm_mul_ps(this->Data, m.Data, this->Data); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator/= + ( + fmat4x4SIMD const & m + ) + { + __m128 Inv[4]; + _mm_inverse_ps(m.Data, Inv); + _mm_mul_ps(this->Data, Inv, this->Data); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator+= + ( + float const & s + ) + { + __m128 Operand = _mm_set_ps1(s); + this->value[0].Data = _mm_add_ps(this->value[0].Data, Operand); + this->value[1].Data = _mm_add_ps(this->value[1].Data, Operand); + this->value[2].Data = _mm_add_ps(this->value[2].Data, Operand); + this->value[3].Data = _mm_add_ps(this->value[3].Data, Operand); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator-= + ( + float const & s + ) + { + __m128 Operand = _mm_set_ps1(s); + this->value[0].Data = _mm_sub_ps(this->value[0].Data, Operand); + this->value[1].Data = _mm_sub_ps(this->value[1].Data, Operand); + this->value[2].Data = _mm_sub_ps(this->value[2].Data, Operand); + this->value[3].Data = _mm_sub_ps(this->value[3].Data, Operand); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator*= + ( + float const & s + ) + { + __m128 Operand = _mm_set_ps1(s); + this->value[0].Data = _mm_mul_ps(this->value[0].Data, Operand); + this->value[1].Data = _mm_mul_ps(this->value[1].Data, Operand); + this->value[2].Data = _mm_mul_ps(this->value[2].Data, Operand); + this->value[3].Data = _mm_mul_ps(this->value[3].Data, Operand); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator/= + ( + float const & s + ) + { + __m128 Operand = _mm_div_ps(one, s)); + this->value[0].Data = _mm_mul_ps(this->value[0].Data, Operand); + this->value[1].Data = _mm_mul_ps(this->value[1].Data, Operand); + this->value[2].Data = _mm_mul_ps(this->value[2].Data, Operand); + this->value[3].Data = _mm_mul_ps(this->value[3].Data, Operand); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator++ () + { + this->value[0].Data = _mm_add_ps(this->value[0].Data, one); + this->value[1].Data = _mm_add_ps(this->value[1].Data, one); + this->value[2].Data = _mm_add_ps(this->value[2].Data, one); + this->value[3].Data = _mm_add_ps(this->value[3].Data, one); + return *this; + } + + inline fmat4x4SIMD & fmat4x4SIMD::operator-- () + { + this->value[0].Data = _mm_sub_ps(this->value[0].Data, one); + this->value[1].Data = _mm_sub_ps(this->value[1].Data, one); + this->value[2].Data = _mm_sub_ps(this->value[2].Data, one); + this->value[3].Data = _mm_sub_ps(this->value[3].Data, one); + return *this; + } + +}//namespace detail +}//namespace glm diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp new file mode 100644 index 0000000..daf7d4d --- /dev/null +++ b/glm/gtx/simd_vec4.hpp @@ -0,0 +1,130 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-07 +// Updated : 2009-05-07 +// Licence : This source is under MIT License +// File : glm/gtx/simd_vec4.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - intrinsic +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_simd_vec4 +#define glm_gtx_simd_vec4 + +// Dependency: +#include "../glm.hpp" +#include "../core/intrinsic_common.hpp" + +namespace glm +{ + namespace detail + { + GLM_ALIGN(4) struct fvec4SIMD + { + static __m128 one; + + union + { + __m128 Data; + struct{float x, y, z, w;}; + float array[4]; + }; + + ////////////////////////////////////// + // Implicit basic constructors + + fvec4SIMD(); + fvec4SIMD(__m128 const & Data); + fvec4SIMD(fvec4SIMD const & v); + fvec4SIMD(tvec4 const & v); + + ////////////////////////////////////// + // Explicit basic constructors + + fvec4SIMD(float const & s); + fvec4SIMD(float const & x, float const & y, float const & z, float const & w); + fvec4SIMD(float const v[4]); + + //////////////////////////////////////// + //// Swizzle constructors + + //fvec4SIMD(ref4 const & r); + + //////////////////////////////////////// + //// Convertion vector constructors + + fvec4SIMD(vec2 const & v, float const & s1, float const & s2); + fvec4SIMD(float const & s1, vec2 const & v, float const & s2); + fvec4SIMD(float const & s1, float const & s2, vec2 const & v); + fvec4SIMD(vec3 const & v, float const & s); + fvec4SIMD(float const & s, vec3 const & v); + fvec4SIMD(vec2 const & v1, vec2 const & v2); + //fvec4SIMD(ivec4SIMD const & v); + + ////////////////////////////////////// + // Unary arithmetic operators + + fvec4SIMD& operator= (fvec4SIMD const & v); + fvec4SIMD& operator+=(fvec4SIMD const & v); + fvec4SIMD& operator-=(fvec4SIMD const & v); + fvec4SIMD& operator*=(fvec4SIMD const & v); + fvec4SIMD& operator/=(fvec4SIMD const & v); + + fvec4SIMD& operator+=(float const & s); + fvec4SIMD& operator-=(float const & s); + fvec4SIMD& operator*=(float const & s); + fvec4SIMD& operator/=(float const & s); + + fvec4SIMD& operator++(); + fvec4SIMD& operator--(); + + //////////////////////////////////////// + //// Unary bit operators + + //fvec4SIMD& operator%= (float s); + //fvec4SIMD& operator%= (fvec4SIMD const & v); + //fvec4SIMD& operator&= (float s); + //fvec4SIMD& operator&= (fvec4SIMD const & v); + //fvec4SIMD& operator|= (float s); + //fvec4SIMD& operator|= (fvec4SIMD const & v); + //fvec4SIMD& operator^= (float s); + //fvec4SIMD& operator^= (fvec4SIMD const & v); + //fvec4SIMD& operator<<=(float s); + //fvec4SIMD& operator<<=(fvec4SIMD const & v); + //fvec4SIMD& operator>>=(float s); + //fvec4SIMD& operator>>=(fvec4SIMD const & v); + + ////////////////////////////////////// + // Swizzle operators + + //float swizzle(comp X) const; + //vec2 const swizzle(comp X, comp Y) const; + //vec3 const swizzle(comp X, comp Y, comp Z) const; + //fvec4SIMD const swizzle(comp X, comp Y, comp Z, comp W) const; + //fvec4SIMD const swizzle(int X, int Y, int Z, int W) const; + //ref4 swizzle(comp X, comp Y, comp Z, comp W); + }; + + }//namespace detail + + namespace gtx{ + //! GLM_GTX_simd_vec4 extension: SIMD implementation of vec4 type. + namespace simd_vec4 + { + typedef detail::fvec4SIMD vec4SIMD; + + }//namespace simd_vec4 + }//namespace gtx +}//namespace glm + +#define GLM_GTX_simd_vec4 namespace gtx::simd_vec4; +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_simd_vec4;} +#endif//GLM_GTX_GLOBAL + +#include "simd_vec4.inl" + +#endif//glm_gtx_simd_vec4 diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl new file mode 100644 index 0000000..461675b --- /dev/null +++ b/glm/gtx/simd_vec4.inl @@ -0,0 +1,263 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-07 +// Updated : 2009-05-07 +// Licence : This source is under MIT License +// File : glm/gtx/simd_vec4.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + namespace detail + { + __m128 fvec4SIMD::one = _mm_set_ps1(1.f); + + ////////////////////////////////////// + // Implicit basic constructors + + inline fvec4SIMD::fvec4SIMD() + {} + + inline fvec4SIMD::fvec4SIMD(__m128 const & Data) : + Data(Data) + {} + + inline fvec4SIMD::fvec4SIMD(fvec4SIMD const & v) : + Data(v.Data) + {} + + inline fvec4SIMD::fvec4SIMD(tvec4 const & v) : + Data(_mm_set_ps(v.w, v.z, v.y, v.x)) + {} + + ////////////////////////////////////// + // Explicit basic constructors + + inline fvec4SIMD::fvec4SIMD(float const & s) : + Data(_mm_set1_ps(s)) + {} + + inline fvec4SIMD::fvec4SIMD(float const & x, float const & y, float const & z, float const & w) : + // Data(_mm_setr_ps(x, y, z, w)) + Data(_mm_set_ps(w, z, y, x)) + {} + + inline fvec4SIMD::fvec4SIMD(float const v[4]) : + Data(_mm_load_ps(v)) + {} + + ////////////////////////////////////// + // Swizzle constructors + + //fvec4SIMD(ref4 const & r); + + ////////////////////////////////////// + // Convertion vector constructors + + inline fvec4SIMD::fvec4SIMD(vec2 const & v, float const & s1, float const & s2) : + Data(_mm_set_ps(s2, s1, v.y, v.x)) + {} + + inline fvec4SIMD::fvec4SIMD(float const & s1, vec2 const & v, float const & s2) : + Data(_mm_set_ps(s2, v.y, v.x, s1)) + {} + + inline fvec4SIMD::fvec4SIMD(float const & s1, float const & s2, vec2 const & v) : + Data(_mm_set_ps(v.y, v.x, s2, s1)) + {} + + inline fvec4SIMD::fvec4SIMD(vec3 const & v, float const & s) : + Data(_mm_set_ps(s, v.z, v.y, v.x)) + {} + + inline fvec4SIMD::fvec4SIMD(float const & s, vec3 const & v) : + Data(_mm_set_ps(v.z, v.y, v.x, s)) + {} + + inline fvec4SIMD::fvec4SIMD(vec2 const & v1, vec2 const & v2) : + Data(_mm_set_ps(v2.y, v2.x, v1.y, v1.x)) + {} + + //inline fvec4SIMD::fvec4SIMD(ivec4SIMD const & v) : + // Data(_mm_cvtepi32_ps(v.Data)) + //{} + + ////////////////////////////////////// + // Unary arithmetic operators + + inline fvec4SIMD& fvec4SIMD::operator=(fvec4SIMD const & v) + { + this->Data = v.Data; + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator+=(float const & s) + { + this->Data = _mm_add_ps(Data, _mm_set_ps1(s)); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator+=(fvec4SIMD const & v) + { + this->Data = _mm_add_ps(this->Data , v.Data); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator-=(float const & s) + { + this->Data = _mm_sub_ps(Data, _mm_set_ps1(s)); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator-=(fvec4SIMD const & v) + { + this->Data = _mm_sub_ps(this->Data , v.Data); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator*=(float const & s) + { + this->Data = _mm_mul_ps(this->Data, _mm_set_ps1(s)); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator*=(fvec4SIMD const & v) + { + this->Data = _mm_mul_ps(this->Data , v.Data); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator/=(float const & s) + { + this->Data = _mm_div_ps(Data, _mm_set1_ps(s)); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator/=(fvec4SIMD const & v) + { + this->Data = _mm_div_ps(this->Data , v.Data); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator++() + { + this->Data = _mm_add_ps(this->Data , glm::detail::one); + return *this; + } + + inline fvec4SIMD& fvec4SIMD::operator--() + { + this->Data = _mm_sub_ps(this->Data , glm::detail::one); + return *this; + } + + ////////////////////////////////////// + // Swizzle operators + + //inline fvec4SIMD const fvec4SIMD::swizzle(int d, int c, int b, int a) const + //{ + // int const Mask = ((d << 6) | (c << 4) | (b << 2) | (a << 0)); + + // __m128 Data = _mm_shuffle_ps(this->Data, this->Data, Mask); + // return fvec4SIMD(Data); + //} + + // operator+ + inline fvec4SIMD operator+ (fvec4SIMD const & v, float s) + { + return fvec4SIMD(_mm_add_ps(v.Data, _mm_set1_ps(s))); + } + + inline fvec4SIMD operator+ (float s, fvec4SIMD const & v) + { + return fvec4SIMD(_mm_add_ps(_mm_set1_ps(s), v.Data)); + } + + inline fvec4SIMD operator+ (fvec4SIMD const & v1, fvec4SIMD const & v2) + { + return fvec4SIMD(_mm_add_ps(v1.Data, v2.Data)); + } + + //operator- + inline fvec4SIMD operator- (fvec4SIMD const & v, float s) + { + return fvec4SIMD(_mm_sub_ps(v.Data, _mm_set1_ps(s))); + } + + inline fvec4SIMD operator- (float s, fvec4SIMD const & v) + { + return fvec4SIMD(_mm_sub_ps(_mm_set1_ps(s), v.Data)); + } + + inline fvec4SIMD operator- (fvec4SIMD const & v1, fvec4SIMD const & v2) + { + return fvec4SIMD(_mm_sub_ps(v1.Data, v2.Data)); + } + + //operator* + inline fvec4SIMD operator* (fvec4SIMD const & v, float s) + { + __m128 par0 = v.Data; + __m128 par1 = _mm_set1_ps(s); + return fvec4SIMD(_mm_mul_ps(par0, par1)); + } + + inline fvec4SIMD operator* (float s, fvec4SIMD const & v) + { + __m128 par0 = _mm_set1_ps(s); + __m128 par1 = v.Data; + return fvec4SIMD(_mm_mul_ps(par0, par1)); + } + + inline fvec4SIMD operator* (fvec4SIMD const & v1, fvec4SIMD const & v2) + { + return fvec4SIMD(_mm_mul_ps(v1.Data, v2.Data)); + } + + //operator/ + inline fvec4SIMD operator/ (fvec4SIMD const & v, float s) + { + __m128 par0 = v.Data; + __m128 par1 = _mm_set1_ps(s); + return fvec4SIMD(_mm_div_ps(par0, par1)); + } + + inline fvec4SIMD operator/ (float s, fvec4SIMD const & v) + { + __m128 par0 = _mm_set1_ps(s); + __m128 par1 = v.Data; + return fvec4SIMD(_mm_div_ps(par0, par1)); + } + + inline fvec4SIMD operator/ (fvec4SIMD const & v1, fvec4SIMD const & v2) + { + return fvec4SIMD(_mm_div_ps(v1.Data, v2.Data)); + } + + // Unary constant operators + inline fvec4SIMD operator- (fvec4SIMD const & v) + { + return fvec4SIMD(_mm_sub_ps(_mm_setzero_ps(), v.Data)); + } + + inline fvec4SIMD operator++ (fvec4SIMD const & v, int) + { + return fvec4SIMD(_mm_add_ps(v.Data, glm::detail::one)); + } + + inline fvec4SIMD operator-- (fvec4SIMD const & v, int) + { + return fvec4SIMD(_mm_sub_ps(v.Data, glm::detail::one)); + } + + }//namespace detail + + namespace gtx{ + namespace simd_vec4 + { + + + }//namespace simd_vec4 + }//namespace gtx +}//namespace glm diff --git a/glm/gtx/spline.hpp b/glm/gtx/spline.hpp new file mode 100644 index 0000000..bff9e58 --- /dev/null +++ b/glm/gtx/spline.hpp @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-01-25 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/spline.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_spline +#define glm_gtx_spline + +// Dependency: +#include "../glm.hpp" +#include "../gtx/optimum_pow.hpp" + +namespace glm +{ + namespace gtx{ + //! GLM_GTX_spline extension: Spline functions + namespace spline + { + //! Return a point from a catmull rom curve. + //! From GLM_GTX_spline extension. + template + genType catmullRom( + const genType& v1, + const genType& v2, + const genType& v3, + const genType& v4, + const GLMvalType& s); + + //! Return a point from a hermite curve. + //! From GLM_GTX_spline extension. + template + genType hermite( + const genType& v1, + const genType& t1, + const genType& v2, + const genType& t2, + const GLMvalType& s); + + //! Return a point from a cubic curve. + //! From GLM_GTX_spline extension. + template + genType cubic( + const genType& v1, + const genType& v2, + const genType& v3, + const genType& v4, + const GLMvalType& s); + + }//namespace spline + }//namespace gtx +}//namespace glm + +#define GLM_GTX_spline namespace gtx::optimum_pow; using namespace gtx::spline +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_spline;} +#endif//GLM_GTX_GLOBAL + +#include "spline.inl" + +#endif//glm_gtx_spline + diff --git a/glm/gtx/spline.inl b/glm/gtx/spline.inl new file mode 100644 index 0000000..5427ce5 --- /dev/null +++ b/glm/gtx/spline.inl @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-01-25 +// Updated : 2009-02-19 +// Licence : This source is under MIT License +// File : glm/gtx/spline.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace spline +{ + template + inline genType catmullRom( + const genType& v1, + const genType& v2, + const genType& v3, + const genType& v4, + const GLMvalType& s) + { + GLMvalType s1 = s; + GLMvalType s2 = optimum_pow::pow2(s); + GLMvalType s3 = optimum_pow::pow3(s); + + GLMvalType f1 = -s3 + GLMvalType(2) * s2 - s; + GLMvalType f2 = GLMvalType(3) * s3 - GLMvalType(5) * s2 + GLMvalType(2); + GLMvalType f3 = GLMvalType(-3) * s3 + GLMvalType(4) * s2 + s; + GLMvalType f4 = s3 - s2; + + return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / GLMvalType(2); + + } + + template + inline genType hermite( + const genType& v1, + const genType& t1, + const genType& v2, + const genType& t2, + const GLMvalType& s) + { + GLMvalType s1 = s; + GLMvalType s2 = optimum_pow::pow2(s); + GLMvalType s3 = optimum_pow::pow3(s); + + GLMvalType f1 = GLMvalType(2) * s3 - GLMvalType(3) * s2 + GLMvalType(1); + GLMvalType f2 = GLMvalType(-2) * s3 + GLMvalType(3) * s2; + GLMvalType f3 = s3 - GLMvalType(2) * s2 + s; + GLMvalType f4 = s3 - s2; + + return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; + } + + template + inline genType cubic( + const genType& v1, + const genType& v2, + const genType& v3, + const genType& v4, + const GLMvalType& s) + { + return ((v1 * s + v2) * s + v3) * s + v4; + } + +}//namespace spline +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/statistics_operation.hpp b/glm/gtx/statistics_operation.hpp new file mode 100644 index 0000000..65429e3 --- /dev/null +++ b/glm/gtx/statistics_operation.hpp @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-11-21 +// Updated : 2007-11-21 +// Licence : This source is under MIT License +// File : glm/gtx/statistics_operation.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_statistics_operation +#define glm_gtx_statistics_operation + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + template T statDistanceGTX(const detail::tvec2& v1, const detail::tvec2& v2); + template T statDistanceGTX(const detail::tvec3& v1, const detail::tvec3& v2); + template T statDistanceGTX(const detail::tvec4& v1, const detail::tvec4& v2); + + template T statDistanceGTX(const detail::tmat2x2& m1, const detail::tmat2x2& m2); + template T statDistanceGTX(const detail::tmat3x3& m1, const detail::tmat3x3& m2); + template T statDistanceGTX(const detail::tmat4x4& m1, const detail::tmat4x4& m2); + + template T expectedValueGTX(const detail::tvec2& v1, const detail::tvec2& v2); + template T expectedValueGTX(const detail::tvec3& v1, const detail::tvec3& v2); + template T expectedValueGTX(const detail::tvec4& v1, const detail::tvec4& v2); + + template T expectedValueGTX(const detail::tmat2x2& m1, const detail::tmat2x2& m2); + template T expectedValueGTX(const detail::tmat3x3& m1, const detail::tmat3x3& m2); + template T expectedValueGTX(const detail::tmat4x4& m1, const detail::tmat4x4& m2); + + template T varianceGTX(const detail::tvec2& v1, const detail::tvec2& v2); + template T varianceGTX(const detail::tvec3& v1, const detail::tvec3& v2); + template T varianceGTX(const detail::tvec4& v1, const detail::tvec4& v2); + + template T varianceGTX(const detail::tmat2x2& m1, const detail::tmat2x2& m2); + template T varianceGTX(const detail::tmat3x3& m1, const detail::tmat3x3& m2); + template T varianceGTX(const detail::tmat4x4& m1, const detail::tmat4x4& m2); + + template T standardDevitionGTX(const detail::tvec2& v1, const detail::tvec2& v2); + template T standardDevitionGTX(const detail::tvec3& v1, const detail::tvec3& v2); + template T standardDevitionGTX(const detail::tvec4& v1, const detail::tvec4& v2); + + template T standardDevitionGTX(const detail::tmat2x2& m1, const detail::tmat2x2& m2); + template T standardDevitionGTX(const detail::tmat3x3& m1, const detail::tmat3x3& m2); + template T standardDevitionGTX(const detail::tmat4x4& m1, const detail::tmat4x4& m2); + + namespace gtx + { + //! GLM_GTX_statistics_operation extension: - Work in progress - Statistics functions + namespace statistics_operation + { + + } + } +} + +#define GLM_GTX_statistics_operation namespace gtx::statistics_operation +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_statistics_operation;} +#endif//GLM_GTX_GLOBAL + +#include "statistics_operation.inl" + +#endif//glm_gtx_statistics_operation diff --git a/glm/gtx/statistics_operation.inl b/glm/gtx/statistics_operation.inl new file mode 100644 index 0000000..7c3b9e4 --- /dev/null +++ b/glm/gtx/statistics_operation.inl @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-11-21 +// Updated : 2007-11-21 +// Licence : This source is under MIT License +// File : glm/gtx/statistics_operator.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm +{ + //! Compute the sum of square of differences between each matrices paremeters + template + inline T statDistanceGTX(const detail::tmat2x2& m1, const detail::tmat2x2& m2) + { + T result = T(0); + for(int j = 0; j < 2; ++j) + for(int i = 0; i < 2; ++i) + { + T diff = m1[j][i] - m2[j][i]; + result += diff * diff; + } + return result; + } + + template + inline T statDistanceGTX(const detail::tmat3x3& m1, const detail::tmat3x3& m2) + { + T result = T(0); + for(int j = 0; j < 3; ++j) + for(int i = 0; i < 3; ++i) + { + T diff = m1[j][i] - m2[j][i]; + result += diff * diff; + } + return result; + } + + template + inline T statDistanceGTX(const detail::tmat4x4& m1, const detail::tmat4x4& m2) + { + T result = T(0); + for(int j = 0; j < 4; ++j) + for(int i = 0; i < 4; ++i) + { + T diff = m1[j][i] - m2[j][i]; + result += diff * diff; + } + return result; + } + + template + T expectedValueGTX(const detail::tmat4x4& m) + { + T result = T(0); + for(int j = 0; j < 4; ++j) + for(int i = 0; i < 4; ++i) + result += m[j][i]; + result *= T(0,0625); + return result; + } + + template + T varianceGTX(const detail::tmat4x4& m) + { + T ExpectedValue = expectedValueGTX(m); + T ExpectedValueOfSquaredMatrix = expectedValueGTX(matrixCompMult(m)); + return ExpectedValueOfSquaredMatrix - ExpectedValue * ExpectedValue; + } + + template + T standardDevitionGTX(const detail::tmat4x4& m) + { + return sqrt(varianceGTX(m)); + } +} diff --git a/glm/gtx/std_based_type.hpp b/glm/gtx/std_based_type.hpp new file mode 100644 index 0000000..4a88053 --- /dev/null +++ b/glm/gtx/std_based_type.hpp @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-06-08 +// Updated : 2008-06-08 +// Licence : This source is under MIT License +// File : glm/gtx/std_based_type.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_std_based_type +#define glm_gtx_std_based_type + +// Dependency: +#include "../glm.hpp" +#include + +namespace glm +{ + namespace test{ + void main_gtx_std_based_type(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_std_based_type extension: Add support vector types based on C++ standard type + namespace std_based_type + { + typedef detail::tvec2 size2; + typedef detail::tvec3 size3; + typedef detail::tvec4 size4; + + typedef detail::tvec2 scvec2; + typedef detail::tvec3 scvec3; + typedef detail::tvec4 scvec4; + + typedef detail::tvec2 ucvec2; + typedef detail::tvec3 ucvec3; + typedef detail::tvec4 ucvec4; + + typedef detail::tvec2 ssvec2; + typedef detail::tvec3 ssvec3; + typedef detail::tvec4 ssvec4; + + typedef detail::tvec2 usvec2; + typedef detail::tvec3 usvec3; + typedef detail::tvec4 usvec4; + + typedef detail::tvec2 sivec2; + typedef detail::tvec3 sivec3; + typedef detail::tvec4 sivec4; + + typedef detail::tvec2 uivec2; + typedef detail::tvec3 uivec3; + typedef detail::tvec4 uivec4; + + typedef detail::tvec2 slvec2; + typedef detail::tvec3 slvec3; + typedef detail::tvec4 slvec4; + + typedef detail::tvec2 ulvec2; + typedef detail::tvec3 ulvec3; + typedef detail::tvec4 ulvec4; + + }//namespace std_based_type + }//namespace gtx +}//namespace glm + +#define GLM_GTX_std_based_type namespace gtx::std_based_type +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_std_based_type;} +#endif//GLM_GTX_GLOBAL + +#include "std_based_type.inl" + +#endif//glm_gtx_std_based_type diff --git a/glm/gtx/std_based_type.inl b/glm/gtx/std_based_type.inl new file mode 100644 index 0000000..877436f --- /dev/null +++ b/glm/gtx/std_based_type.inl @@ -0,0 +1,13 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-06-08 +// Updated : 2008-06-08 +// Licence : This source is under MIT License +// File : glm/gtx/std_based_type.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + +} diff --git a/glm/gtx/string_cast.hpp b/glm/gtx/string_cast.hpp new file mode 100644 index 0000000..ce980c2 --- /dev/null +++ b/glm/gtx/string_cast.hpp @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2006 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-04-26 +// Updated : 2008-05-24 +// Licence : This source is under MIT License +// File : glm/gtx/string_cast.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_double +// - GLM_GTX_half +// - GLM_GTX_integer +// - GLM_GTX_quaternion +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_string_cast +#define glm_gtx_string_cast + +// Dependency: +#include "../glm.hpp" +#include "../gtc/double_float.hpp" +#include "../gtc/half_float.hpp" +#include "../gtx/integer.hpp" +#include "../gtx/unsigned_int.hpp" +#include "../gtx/quaternion.hpp" +#include + +namespace glm +{ + namespace test{ + void main_gtx_string_cast(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_string_cast extension: Setup strings for GLM type values + namespace string_cast + { + using namespace gtc::double_float; + using namespace gtc::half_float; + using namespace gtx::integer; + using namespace gtx::unsigned_int; + using namespace gtx::quaternion; + + //! Create a string from a GLM type value. + //! From GLM_GTX_string_cast extension. + template + std::string string(genType const & x); + + }//namespace string_cast + }//namespace gtx +}//namespace glm + +#define GLM_GTX_string_cast namespace gtx::string_cast +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_string_cast;} +#endif//GLM_GTX_GLOBAL + +#include "string_cast.inl" + +#endif//glm_gtx_string_cast diff --git a/glm/gtx/string_cast.inl b/glm/gtx/string_cast.inl new file mode 100644 index 0000000..c9e9134 --- /dev/null +++ b/glm/gtx/string_cast.inl @@ -0,0 +1,597 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2006 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-04-27 +// Updated : 2008-05-24 +// Licence : This source is under MIT License +// File : glm/gtx/string_cast.h +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +namespace glm{ +namespace detail +{ + inline std::string format(const char* msg, ...) + { + const int STRING_BUFFER = 4096; + char text[STRING_BUFFER]; + va_list list; + + if(msg == 0) + return std::string(); + + va_start(list, msg); + vsprintf(text, msg, list); + va_end(list); + + return std::string(text); + } + + static const char* True = "true"; + static const char* False = "false"; +}//namespace detail + +namespace gtx{ +namespace string_cast +{ + //////////////////////////////// + // Scalars + + inline std::string string(detail::thalf const & x) + { + return detail::format("half(%f)", float(x)); + } + + inline std::string string(float x) + { + return detail::format("float(%f)", x); + } + + inline std::string string(double x) + { + return detail::format("double(%f)", x); + } + + inline std::string string(int x) + { + return detail::format("int(%d)", x); + } + + inline std::string string(unsigned int x) + { + return detail::format("uint(%d)", x); + } + + //////////////////////////////// + // Bool vectors + + inline std::string string + ( + detail::tvec2 const & v + ) + { + return detail::format("bvec2(%s, %s)", + v.x ? detail::True : detail::False, + v.y ? detail::True : detail::False); + } + + inline std::string string + ( + detail::tvec3 const & v + ) + { + return detail::format("bvec3(%s, %s, %s)", + v.x ? detail::True : detail::False, + v.y ? detail::True : detail::False, + v.z ? detail::True : detail::False); + } + + inline std::string string + ( + detail::tvec4 const & v + ) + { + return detail::format("bvec4(%s, %s, %s, %s)", + v.x ? detail::True : detail::False, + v.y ? detail::True : detail::False, + v.z ? detail::True : detail::False, + v.w ? detail::True : detail::False); + } + + //////////////////////////////// + // Half vectors + + template <> + inline std::string string + ( + detail::tvec2 const & v + ) + { + return detail::format("hvec2(%f, %f)", float(v.x), float(v.y)); + } + + template <> + inline std::string string + ( + detail::tvec3 const & v + ) + { + return detail::format("hvec3(%f, %f, %f)", float(v.x), float(v.y), float(v.z)); + } + + template <> + inline std::string string + ( + detail::tvec4 const & v + ) + { + return detail::format("hvec4(%f, %f, %f, %f)", float(v.x), float(v.y), float(v.z), float(v.w)); + } + + //////////////////////////////// + // Float vectors + + template <> + inline std::string string + ( + detail::tvec2 const & v + ) + { + return detail::format("fvec2(%f, %f)", v.x, v.y); + } + + template <> + inline std::string string + ( + detail::tvec3 const & v + ) + { + return detail::format("fvec3(%f, %f, %f)", v.x, v.y, v.z); + } + + template <> + inline std::string string + ( + detail::tvec4 const & v + ) + { + return detail::format("fvec4(%f, %f, %f, %f)", v.x, v.y, v.z, v.w); + } + + //////////////////////////////// + // Double vectors + + template <> + inline std::string string + ( + detail::tvec2 const & v + ) + { + return detail::format("dvec2(%f, %f)", v.x, v.y); + } + + template <> + inline std::string string + ( + detail::tvec3 const & v + ) + { + return detail::format("dvec3(%f, %f, %f)", v.x, v.y, v.z); + } + + template <> + inline std::string string + ( + detail::tvec4 const & v + ) + { + return detail::format("dvec4(%f, %f, %f, %f)", v.x, v.y, v.z, v.w); + } + + //////////////////////////////// + // Int vectors + + template <> + inline std::string string + ( + detail::tvec2 const & v + ) + { + return detail::format("ivec2(%d, %d)", v.x, v.y); + } + + template <> + inline std::string string + ( + detail::tvec3 const & v + ) + { + return detail::format("ivec3(%d, %d, %d)", v.x, v.y, v.z); + } + + template <> + inline std::string string + ( + detail::tvec4 const & v + ) + { + return detail::format("ivec4(%d, %d, %d, %d)", v.x, v.y, v.z, v.w); + } + + //////////////////////////////// + // Unsigned int vectors + + template <> + inline std::string string + ( + detail::tvec2 const & v + ) + { + return detail::format("uvec2(%d, %d)", v.x, v.y); + } + + template <> + inline std::string string + ( + detail::tvec3 const & v + ) + { + return detail::format("uvec3(%d, %d, %d)", v.x, v.y, v.z); + } + + template <> + inline std::string string + ( + detail::tvec4 const & v + ) + { + return detail::format("uvec4(%d, %d, %d, %d)", v.x, v.y, v.z, v.w); + } + + //////////////////////////////// + // Half matrices + + template <> + inline std::string string + ( + detail::tmat2x2 const & m + ) + { + detail::tmat2x2 x(m); + return detail::format("hmat2x2((%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1]); + } + + template <> + inline std::string string + ( + detail::tmat2x3 const & m + ) + { + detail::tmat2x3 x(m); + return detail::format("hmat2x3((%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2]); + } + + template <> + inline std::string string + ( + detail::tmat2x4 const & m + ) + { + detail::tmat2x4 x(m); + return detail::format("hmat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3]); + } + + template <> + inline std::string string + ( + detail::tmat3x2 const & m + ) + { + detail::tmat3x2 x(m); + return detail::format("hmat3x2((%f, %f), (%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1], + x[2][0], x[2][1]); + } + + template <> + inline std::string string + ( + detail::tmat3x3 const & m + ) + { + detail::tmat3x3 x(m); + return detail::format("hmat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2], + x[2][0], x[2][1], x[2][2]); + } + + template <> + inline std::string string + ( + detail::tmat3x4 const & m + ) + { + detail::tmat3x4 x(m); + return detail::format("hmat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3], + x[2][0], x[2][1], x[2][2], x[2][3]); + } + + template <> + inline std::string string + ( + detail::tmat4x2 const & m + ) + { + detail::tmat4x2 x(m); + return detail::format("hmat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1], + x[2][0], x[2][1], + x[3][0], x[3][1]); + } + + template <> + inline std::string string + ( + detail::tmat4x3 const & m + ) + { + detail::tmat4x3 x(m); + return detail::format("hmat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2], + x[2][0], x[2][1], x[2][2], + x[3][0], x[3][1], x[3][2]); + } + + template <> + inline std::string string + ( + detail::tmat4x4 const & m + ) + { + detail::tmat4x4 x(m); + return detail::format("hmat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3], + x[2][0], x[2][1], x[2][2], x[2][3], + x[3][0], x[3][1], x[3][2], x[3][3]); + } + + //////////////////////////////// + // Float matrices + + template <> + inline std::string string + ( + detail::tmat2x2 const & x + ) + { + return detail::format("mat2x2((%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1]); + } + + template <> + inline std::string string + ( + detail::tmat2x3 const & x + ) + { + return detail::format("mat2x3((%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2]); + } + + template <> + inline std::string string + ( + detail::tmat2x4 const & x + ) + { + return detail::format("mat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3]); + } + + template <> + inline std::string string + ( + detail::tmat3x2 const & x + ) + { + return detail::format("mat3x2((%f, %f), (%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1], + x[2][0], x[2][1]); + } + + template <> + inline std::string string + ( + detail::tmat3x3 const & x + ) + { + return detail::format("mat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2], + x[2][0], x[2][1], x[2][2]); + } + + template <> + inline std::string string + ( + detail::tmat3x4 const & x + ) + { + return detail::format("mat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3], + x[2][0], x[2][1], x[2][2], x[2][3]); + } + + template <> + inline std::string string + ( + detail::tmat4x2 const & x + ) + { + return detail::format("mat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1], + x[2][0], x[2][1], + x[3][0], x[3][1]); + } + + template <> + inline std::string string + ( + detail::tmat4x3 const & x + ) + { + return detail::format("mat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2], + x[2][0], x[2][1], x[2][2], + x[3][0], x[3][1], x[3][2]); + } + + template <> + inline std::string string + ( + detail::tmat4x4 const & x + ) + { + return detail::format("mat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3], + x[2][0], x[2][1], x[2][2], x[2][3], + x[3][0], x[3][1], x[3][2], x[3][3]); + } + + //////////////////////////////// + // Double matrices + + template <> + inline std::string string + ( + detail::tmat2x2 const & x + ) + { + return detail::format("dmat2x2((%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1]); + } + + template <> + inline std::string string + ( + detail::tmat2x3 const & x + ) + { + return detail::format("dmat2x3((%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2]); + } + + template <> + inline std::string string + ( + detail::tmat2x4 const & x + ) + { + return detail::format("dmat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3]); + } + + template <> + inline std::string string + ( + detail::tmat3x2 const & x + ) + { + return detail::format("dmat3x2((%f, %f), (%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1], + x[2][0], x[2][1]); + } + + template <> + inline std::string string + ( + detail::tmat3x3 const & x + ) + { + return detail::format("dmat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2], + x[2][0], x[2][1], x[2][2]); + } + + template <> + inline std::string string + ( + detail::tmat3x4 const & x + ) + { + return detail::format("dmat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3], + x[2][0], x[2][1], x[2][2], x[2][3]); + } + + template <> + inline std::string string + ( + detail::tmat4x2 const & x + ) + { + return detail::format("dmat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))", + x[0][0], x[0][1], + x[1][0], x[1][1], + x[2][0], x[2][1], + x[3][0], x[3][1]); + } + + template <> + inline std::string string + ( + detail::tmat4x3 const & x + ) + { + return detail::format("dmat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", + x[0][0], x[0][1], x[0][2], + x[1][0], x[1][1], x[1][2], + x[2][0], x[2][1], x[2][2], + x[3][0], x[3][1], x[3][2]); + } + + template <> + inline std::string string + ( + detail::tmat4x4 const & x + ) + { + return detail::format("dmat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", + x[0][0], x[0][1], x[0][2], x[0][3], + x[1][0], x[1][1], x[1][2], x[1][3], + x[2][0], x[2][1], x[2][2], x[2][3], + x[3][0], x[3][1], x[3][2], x[3][3]); + } + + }//namespace string_cast + }//namespace gtx +}//namespace glm diff --git a/glm/gtx/transform.hpp b/glm/gtx/transform.hpp new file mode 100644 index 0000000..410527e --- /dev/null +++ b/glm/gtx/transform.hpp @@ -0,0 +1,104 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtx/transform.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTC_matric_transform +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_transform +#define glm_gtx_transform + +// Dependency: +#include "../glm.hpp" +#include "../gtc/matrix_transform.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_transform(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_transform extension: Add transformation matrices + namespace transform + { + using namespace gtc::matrix_transform; + + //! Builds a translation 4 * 4 matrix created from 3 scalars. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 translate( + T x, T y, T z); + + //! Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 translate( + detail::tmat4x4 const & m, + T x, T y, T z); + + //! Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 translate( + detail::tvec3 const & v); + + //! Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 rotate( + T angle, + T x, T y, T z); + + //! Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 rotate( + T angle, + detail::tvec3 const & v); + + //! Transforms a matrix with a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 rotate( + detail::tmat4x4 const & m, + T angle, + T x, T y, T z); + + //! Builds a scale 4 * 4 matrix created from 3 scalars. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 scale( + T x, T y, T z); + + //! Transforms a matrix with a scale 4 * 4 matrix created from 3 scalars. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 scale( + detail::tmat4x4 const & m, + T x, T y, T z); + + //! Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components. + //! From GLM_GTX_transform extension. + template + detail::tmat4x4 scale( + detail::tvec3 const & v); + + }//namespace transform + }//namespace gtx +}//namespace glm + +#define GLM_GTX_transform namespace gtx::transform +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_transform;} +#endif//GLM_GTX_GLOBAL + +#include "transform.inl" + +#endif//glm_gtx_transform diff --git a/glm/gtx/transform.inl b/glm/gtx/transform.inl new file mode 100644 index 0000000..9f2950c --- /dev/null +++ b/glm/gtx/transform.inl @@ -0,0 +1,94 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2009-04-29 +// Licence : This source is under MIT License +// File : glm/gtx/transform.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace transform +{ + template + inline detail::tmat4x4 translate( + T x, T y, T z) + { + return gtc::matrix_transform::translate( + detail::tmat4x4(1.0f), + detail::tvec3(x, y , z)); + } + + template + inline detail::tmat4x4 translate( + detail::tmat4x4 const & m, + T x, T y, T z) + { + return gtc::matrix_transform::translate( + m, detail::tvec3(x, y , z)); + } + + template + inline detail::tmat4x4 translate( + detail::tvec3 const & v) + { + return gtc::matrix_transform::translate( + detail::tmat4x4(1.0f), v); + } + + template + inline detail::tmat4x4 rotate( + T angle, + T x, T y, T z) + { + return gtc::matrix_transform::rotate( + detail::tmat4x4(1), angle, detail::tvec3(x, y, z)); + } + + template + inline detail::tmat4x4 rotate( + T angle, + detail::tvec3 const & v) + { + return gtc::matrix_transform::rotate( + detail::tmat4x4(1), angle, v); + } + + template + inline detail::tmat4x4 rotate( + detail::tmat4x4 const & m, + T angle, + T x, T y, T z) + { + return gtc::matrix_transform::rotate( + m, angle, detail::tvec3(x, y, z)); + } + + template + inline detail::tmat4x4 scale(T x, T y, T z) + { + return gtc::matrix_transform::scale( + detail::tmat4x4(1), detail::tvec3(x, y, z)); + } + + template + inline detail::tmat4x4 scale( + detail::tmat4x4 const & m, + T x, T y, T z) + { + return gtc::matrix_transform::scale( + m, detail::tvec3(x, y, z)); + } + + template + inline detail::tmat4x4 scale( + detail::tvec3 const & v) + { + return gtc::matrix_transform::scale( + detail::tmat4x4(1.0f), v); + } + +}//namespace transform +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/transform2.hpp b/glm/gtx/transform2.hpp new file mode 100644 index 0000000..d6c317c --- /dev/null +++ b/glm/gtx/transform2.hpp @@ -0,0 +1,127 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-21 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/transform2.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_transform +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_transform2 +#define glm_gtx_transform2 + +// Dependency: +#include "../glm.hpp" +#include "../gtx/transform.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_transform2(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_transform2 extension: Add extra transformation matrices + namespace transform2 + { + using namespace gtx::transform; + + //! Transforms a matrix with a shearing on X axis. + //! From GLM_GTX_transform2 extension. + template + detail::tmat3x3 shearX2D( + detail::tmat3x3 const & m, + T y); + + //! Transforms a matrix with a shearing on Y axis. + //! From GLM_GTX_transform2 extension. + template + detail::tmat3x3 shearY2D( + detail::tmat3x3 const & m, + T x); + + //! Transforms a matrix with a shearing on X axis + //! From GLM_GTX_transform2 extension. + template + detail::tmat4x4 shearX3D( + const detail::tmat4x4 & m, + T y, + T z); + + //! Transforms a matrix with a shearing on Y axis. + //! From GLM_GTX_transform2 extension. + template + detail::tmat4x4 shearY3D( + const detail::tmat4x4 & m, + T x, + T z); + + //! Transforms a matrix with a shearing on Z axis. + //! From GLM_GTX_transform2 extension. + template + detail::tmat4x4 shearZ3D( + const detail::tmat4x4 & m, + T x, + T y); + + //template inline detail::tmat4x4 shear(const detail::tmat4x4 & m, shearPlane, planePoint, angle) + // Identity + tan(angle) * cross(Normal, OnPlaneVector) 0 + // - dot(PointOnPlane, normal) * OnPlaneVector 1 + + // Reflect functions seem to don't work + //template detail::tmat3x3 reflect2D(const detail::tmat3x3 & m, const detail::tvec3& normal){return reflect2DGTX(m, normal);} //!< \brief Build a reflection matrix (from GLM_GTX_transform2 extension) + //template detail::tmat4x4 reflect3D(const detail::tmat4x4 & m, const detail::tvec3& normal){return reflect3DGTX(m, normal);} //!< \brief Build a reflection matrix (from GLM_GTX_transform2 extension) + + //! Build planar projection matrix along normal axis. + //! From GLM_GTX_transform2 extension. + template + detail::tmat3x3 proj2D( + const detail::tmat3x3 & m, + const detail::tvec3& normal); + + //! Build planar projection matrix along normal axis. + //! From GLM_GTX_transform2 extension. + template + detail::tmat4x4 proj3D( + const detail::tmat4x4 & m, + const detail::tvec3& normal); + + //! Build a look at view matrix. + //! From GLM_GTX_transform2 extension. + template + detail::tmat4x4 lookAt( + detail::tvec3 const & eye, + detail::tvec3 const & center, + detail::tvec3 const & up); + + //! Build a scale bias matrix. + //! From GLM_GTX_transform2 extension. + template + detail::tmat4x4 scaleBias( + valType scale, + valType bias); + + //! Build a scale bias matrix. + //! From GLM_GTX_transform2 extension. + template + detail::tmat4x4 scaleBias( + detail::tmat4x4 const & m, + valType scale, + valType bias); + + }//namespace transform2 + }//namespace gtx +}//namespace glm + +#define GLM_GTX_transform2 namespace gtx::transform2 +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_transform2;} +#endif//GLM_GTX_GLOBAL + +#include "transform2.inl" + +#endif//glm_gtx_transform2 diff --git a/glm/gtx/transform2.inl b/glm/gtx/transform2.inl new file mode 100644 index 0000000..1d56686 --- /dev/null +++ b/glm/gtx/transform2.inl @@ -0,0 +1,187 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-02-28 +// Updated : 2005-04-23 +// Licence : This source is under MIT License +// File : glm/gtx/transform2.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace transform2 +{ + template + inline detail::tmat3x3 shearX2D( + const detail::tmat3x3& m, + T s) + { + detail::tmat3x3 r(1); + r[0][1] = s; + return m * r; + } + + template + inline detail::tmat3x3 shearY2D( + const detail::tmat3x3& m, + T s) + { + detail::tmat3x3 r(1); + r[1][0] = s; + return m * r; + } + + template + inline detail::tmat4x4 shearX3D( + const detail::tmat4x4& m, + T s, + T t) + { + detail::tmat4x4 r(1); + r[1][0] = s; + r[2][0] = t; + return m * r; + } + + template + inline detail::tmat4x4 shearY3D( + const detail::tmat4x4& m, + T s, + T t) + { + detail::tmat4x4 r(1); + r[0][1] = s; + r[2][1] = t; + return m * r; + } + + template + inline detail::tmat4x4 shearZ3D( + const detail::tmat4x4& m, + T s, + T t) + { + detail::tmat4x4 r(1); + r[0][2] = s; + r[1][2] = t; + return m * r; + } + + template + inline detail::tmat3x3 reflect2D( + const detail::tmat3x3& m, + const detail::tvec3& normal) + { + detail::tmat3x3 r(1); + r[0][0] = 1 - 2 * normal.x * normal.x; + r[0][1] = -2 * normal.x * normal.y; + r[1][0] = -2 * normal.x * normal.y; + r[1][1] = 1 - 2 * normal.y * normal.y; + return m * r; + } + + template + inline detail::tmat4x4 reflect3D( + const detail::tmat4x4& m, + const detail::tvec3& normal) + { + detail::tmat4x4 r(1); + r[0][0] = 1 - 2 * normal.x * normal.x; + r[0][1] = -2 * normal.x * normal.y; + r[0][2] = -2 * normal.x * normal.z; + + r[1][0] = -2 * normal.x * normal.y; + r[1][1] = 1 - 2 * normal.y * normal.y; + r[1][2] = -2 * normal.y * normal.z; + + r[2][0] = -2 * normal.x * normal.z; + r[2][1] = -2 * normal.y * normal.z; + r[2][2] = 1 - 2 * normal.z * normal.z; + return m * r; + } + + template + inline detail::tmat3x3 proj2D( + const detail::tmat3x3& m, + const detail::tvec3& normal) + { + detail::tmat3x3 r(1); + r[0][0] = 1 - normal.x * normal.x; + r[0][1] = - normal.x * normal.y; + r[1][0] = - normal.x * normal.y; + r[1][1] = 1 - normal.y * normal.y; + return m * r; + } + + template + inline detail::tmat4x4 proj3D( + const detail::tmat4x4& m, + const detail::tvec3& normal) + { + detail::tmat4x4 r(1); + r[0][0] = 1 - normal.x * normal.x; + r[0][1] = - normal.x * normal.y; + r[0][2] = - normal.x * normal.z; + r[1][0] = - normal.x * normal.y; + r[1][1] = 1 - normal.y * normal.y; + r[1][2] = - normal.y * normal.z; + r[2][0] = - normal.x * normal.z; + r[2][1] = - normal.y * normal.z; + r[2][2] = 1 - normal.z * normal.z; + return m * r; + } + + template + inline detail::tmat4x4 lookAt( + const detail::tvec3& eye, + const detail::tvec3& center, + const detail::tvec3& up) + { + detail::tvec3 f = normalize(center - eye); + detail::tvec3 u = normalize(up); + detail::tvec3 s = normalize(cross(f, u)); + u = cross(s, f); + + detail::tmat4x4 Result(1); + Result[0][0] = s.x; + Result[1][0] = s.y; + Result[2][0] = s.z; + Result[0][1] = u.x; + Result[1][1] = u.y; + Result[2][1] = u.z; + Result[0][2] =-f.x; + Result[1][2] =-f.y; + Result[2][2] =-f.z; + /* Test this instead of translate3D + Result[3][0] =-dot(s, eye); + Result[3][1] =-dot(y, eye); + Result[3][2] = dot(f, eye); + */ + return gtc::matrix_transform::translate(Result, -eye); + } + + template + inline detail::tmat4x4 scaleBias( + T scale, + T bias) + { + detail::tmat4x4 result; + result[3] = detail::tvec4(detail::tvec3(bias), T(1)); + result[0][0] = scale; + result[1][1] = scale; + result[2][2] = scale; + } + + template + inline detail::tmat4x4 scaleBias( + const detail::tmat4x4& m, + T scale, + T bias) + { + return m * scaleBias(scale, bias); + } + +}//namespace transform2 +}//namespace gtx +}//namespace glm + diff --git a/glm/gtx/type_ptr.hpp b/glm/gtx/type_ptr.hpp new file mode 100644 index 0000000..feedb14 --- /dev/null +++ b/glm/gtx/type_ptr.hpp @@ -0,0 +1,233 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-05-06 +// Updated : 2009-05-06 +// Licence : This source is under MIT License +// File : glm/gtx/type_ptr.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_type_ptr +#define glm_gtx_type_ptr + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_type_ptr(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_type_ptr extension: Get access to vectors & matrices value type address. + namespace type_ptr{ + + //! Get the const address of the vector content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tvec2 const & vec) + { + return &(vec.x); + } + + //! Get the address of the vector content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tvec2 & vec) + { + return &(vec.x); + } + + //! Get the const address of the vector content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tvec3 const & vec) + { + return &(vec.x); + } + + //! Get the address of the vector content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tvec3 & vec) + { + return &(vec.x); + } + + //! Get the const address of the vector content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tvec4 const & vec) + { + return &(vec.x); + } + + //! Get the address of the vector content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tvec4 & vec) + { + return &(vec.x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat2x2 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat2x2 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat3x3 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat3x3 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat4x4 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat4x4 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat2x3 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat2x3 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat3x2 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat3x2 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat2x4 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat2x4 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat4x2 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat4x2 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat3x4 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat3x4 & mat) + { + return &(mat[0].x); + } + + //! Get the const address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType const * value_ptr(detail::tmat4x3 const & mat) + { + return &(mat[0].x); + } + + //! Get the address of the matrix content. + //! From GLM_GTX_type_ptr extension. + template + inline valType * value_ptr(detail::tmat4x3 & mat) + { + return &(mat[0].x); + } + + }//namespace type_ptr + }//namespace gtx +}//namespace glm + +#define GLM_GTX_type_ptr namespace gtx::type_ptr +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_type_ptr;} +#endif//GLM_GTX_GLOBAL + +#include "type_ptr.inl" + +#endif//glm_gtx_type_ptr + diff --git a/glm/gtx/type_ptr.inl b/glm/gtx/type_ptr.inl new file mode 100644 index 0000000..e69de29 diff --git a/glm/gtx/unsigned_int.hpp b/glm/gtx/unsigned_int.hpp new file mode 100644 index 0000000..73f1ca4 --- /dev/null +++ b/glm/gtx/unsigned_int.hpp @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-24 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/unsigned_int.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_integer +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_unsigned_int +#define glm_gtx_unsigned_int + +// Dependency: +#include "../glm.hpp" +#include "../gtx/integer.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_unsigned_int(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_unsigned_int extension: Add support for unsigned integer for core functions + namespace unsigned_int + { + //! 32bit signed integer. + //! From GLM_GTX_unsigned_int extension. + typedef signed int sint; + + //! Returns x raised to the y power. + //! From GLM_GTX_unsigned_int extension. + uint pow(uint x, uint y); + + //! Returns the positive square root of x. + //! From GLM_GTX_unsigned_int extension. + uint sqrt(uint x); + + //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. + //! From GLM_GTX_unsigned_int extension. + uint mod(uint x, uint y); + + }//namespace unsigned_int + }//namespace gtx +}//namespace glm + +#define GLM_GTX_unsigned_int namespace gtx::unsigned_int; using namespace gtx::integer +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_unsigned_int;} +#endif//GLM_GTX_GLOBAL + +#include "unsigned_int.inl" + +#endif//glm_gtx_unsigned_int diff --git a/glm/gtx/unsigned_int.inl b/glm/gtx/unsigned_int.inl new file mode 100644 index 0000000..9bb5ec3 --- /dev/null +++ b/glm/gtx/unsigned_int.inl @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-24 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/unsigned_int.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace unsigned_int{ + +inline uint pow(uint x, uint y) +{ + uint result = x; + for(uint i = 1; i < y; ++i) + result *= x; + return result; +} + +inline uint sqrt(uint x) +{ + if(x <= 1) return x; + + uint NextTrial = x >> 1; + uint CurrentAnswer; + + do + { + CurrentAnswer = NextTrial; + NextTrial = (NextTrial + x / NextTrial) >> 1; + } while(NextTrial < CurrentAnswer); + + return CurrentAnswer; +} + +inline uint mod(uint x, uint y) +{ + return x - y * (x / y); +} + +}//namespace unsigned_int +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/vector_access.hpp b/glm/gtx/vector_access.hpp new file mode 100644 index 0000000..dff8b87 --- /dev/null +++ b/glm/gtx/vector_access.hpp @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-16 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/vector_access.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_vector_access +#define glm_gtx_vector_access + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_vector_access(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_vector_access extension: Function to set values to vectors + namespace vector_access + { + //! Set values to a 2 components vector. + //! From GLM_GTX_vector_access extension. + template + void set( + detail::tvec2 & v, + valType const & x, + valType const & y); + + //! Set values to a 3 components vector. + //! From GLM_GTX_vector_access extension. + template + void set( + detail::tvec3 & v, + valType const & x, + valType const & y, + valType const & z); + + //! Set values to a 4 components vector. + //! From GLM_GTX_vector_access extension. + template + void set( + detail::tvec4 & v, + valType const & x, + valType const & y, + valType const & z, + valType const & w); + + }//namespace vector_access + }//namespace gtx +}//namespace glm + +#define GLM_GTX_vector_access namespace gtx::vector_access +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_vector_access;} +#endif//GLM_GTX_GLOBAL + +#include "vector_access.inl" + +#endif//glm_gtx_vector_access diff --git a/glm/gtx/vector_access.inl b/glm/gtx/vector_access.inl new file mode 100644 index 0000000..88d38ea --- /dev/null +++ b/glm/gtx/vector_access.inl @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-01-16 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/gtx/vector_access.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace vector_access{ + +template +inline void set +( + detail::tvec2& v, + valType const & x, + valType const & y +) +{ + v.x = x; + v.y = y; +} + +template +inline void set +( + detail::tvec3& v, + valType const & x, + valType const & y, + valType const & z +) +{ + v.x = x; + v.y = y; + v.z = z; +} + +template +inline void set +( + detail::tvec4& v, + valType const & x, + valType const & y, + valType const & z, + valType const & w +) +{ + v.x = x; + v.y = y; + v.z = z; + v.w = w; +} + +}//namespace vector_access +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/vector_angle.hpp b/glm/gtx/vector_angle.hpp new file mode 100644 index 0000000..c86ffbf --- /dev/null +++ b/glm/gtx/vector_angle.hpp @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-30 +// Updated : 2006-11-13 +// Licence : This source is under MIT License +// File : glm/gtx/vector_angle.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_quaternion +// - GLM_GTX_epsilon +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_vector_angle +#define glm_gtx_vector_angle + +// Dependency: +#include "../glm.hpp" +#include "../gtx/quaternion.hpp" +#include "../gtx/epsilon.hpp" + +namespace glm +{ + namespace test{ + void main_gtx_vector_angle(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_vector_angle extension: Compute angle between vectors + namespace vector_angle + { + //! Returns the absolute angle between x and y. + //! Parameters need to be normalized. + //! From GLM_GTX_vector_angle extension + template + typename vecType::value_type angle( + vecType const & x, + vecType const & y); + + //! Returns the oriented angle between x and y + //! Parameters need to be normalized. + //! From GLM_GTX_vector_angle extension. + template + typename vecType::value_type orientedAngle( + vecType const & x, + vecType const & y); + + //! Returns the orientation of a two vector base from a normal. + //! Parameters need to be normalized. + //! From GLM_GTX_vector_angle extension. + template + typename vecType::value_type orientedAngleFromRef( + vecType const & x, + vecType const & y, + detail::tvec3 const & ref); + }//namespace vector_angle + }//namespace gtx +}//namespace glm + +#define GLM_GTX_vector_angle namespace gtx::quaternion; using namespace gtx::epsilon; using namespace gtx::vector_angle +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_vector_angle;} +#endif//GLM_GTX_GLOBAL + +#include "vector_angle.inl" + +#endif//glm_gtx_vector_angle diff --git a/glm/gtx/vector_angle.inl b/glm/gtx/vector_angle.inl new file mode 100644 index 0000000..eec01da --- /dev/null +++ b/glm/gtx/vector_angle.inl @@ -0,0 +1,124 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-30 +// Updated : 2008-09-29 +// Licence : This source is under MIT License +// File : glm/gtx/vector_angle.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace vector_angle{ + +template +inline typename genType::value_type angle +( + genType const & x, + genType const & y +) +{ + return degrees(acos(dot(x, y))); +} + +//! \todo epsilon is hard coded to 0.01 +template +inline valType orientedAngle +( + detail::tvec2 const & x, + detail::tvec2 const & y +) +{ + valType Angle = acos(dot(x, y)); + valType c = cos(Angle); + valType s = sin(Angle); + detail::tvec2 TransformedVector = detail::tvec2(c * y.x - s * y.y, s * y.x + c * y.y); + if(all(equalEpsilonGTX(x, TransformedVector, valType(0.01)))) + return -degrees(Angle); + else + return degrees(Angle); +} + +//! \todo epsilon is hard coded to 0.01 +template +inline valType orientedAngle +( + detail::tvec3 const & x, + detail::tvec3 const & y +) +{ + valType Angle = degrees(acos(dot(x, y))); + detail::tvec3 TransformedVector = rotate(detail::tquat(), Angle, cross(x, y)) * y; + if(all(equalEpsilon(x, TransformedVector, valType(0.01)))) + return -degrees(Angle); + else + return degrees(Angle); +} + +//! \todo epsilon is hard coded to 0.01 +template +inline valType orientedAngle +( + detail::tvec4 const & x, + detail::tvec4 const & y +) +{ + valType Angle = degrees(acos(dot(x, y))); + detail::tvec4 TransformedVector = rotate(detail::tquat(), Angle, cross(x, y)) * y; + if(all(equalEpsilon(x, TransformedVector, valType(0.01)))) + return -degrees(Angle); + else + return degrees(Angle); +} + +template +inline valType orientedAngleFromRef +( + detail::tvec2 const & x, + detail::tvec2 const & y, + detail::tvec3 const & ref +) +{ + valType Angle = glm::acos(glm::dot(x, y)); + + if(glm::dot(ref, detail::tvec3(glm::cross(x, y), valType(0))) < valType(0)) + return -glm::degrees(Angle); + else + return glm::degrees(Angle); +} + +template +inline valType orientedAngleFromRef +( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 const & ref +) +{ + valType Angle = glm::acos(glm::dot(x, y)); + + if(glm::dot(ref, glm::cross(x, y)) < valType(0)) + return -glm::degrees(Angle); + else + return glm::degrees(Angle); +} + +template +inline valType orientedAngleFromRef +( + detail::tvec4 const & x, + detail::tvec4 const & y, + detail::tvec3 const & ref +) +{ + valType Angle = glm::acos(glm::dot(x, y)); + + if(glm::dot(ref, glm::cross(detail::tvec3(x), detail::tvec3(y))) < valType(0)) + return -glm::degrees(Angle); + else + return glm::degrees(Angle); +} + +}//namespace vector_angle +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/vector_query.hpp b/glm/gtx/vector_query.hpp new file mode 100644 index 0000000..61555fc --- /dev/null +++ b/glm/gtx/vector_query.hpp @@ -0,0 +1,96 @@ + /////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-05 +// Updated : 2007-03-05 +// Licence : This source is under MIT License +// File : glm/gtx/vector_query.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_vector_query +#define glm_gtx_vector_query + +// Dependency: +#include "../glm.hpp" +#include +#include + +namespace glm +{ + namespace test{ + void main_ext_gtx_vector_query(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_vector_query extension: Query informations of vector types + namespace vector_query + { + //! Check if two vectors are collinears. + //! From GLM_GTX_vector_query extensions. + template + bool areCollinear( + const genType & v0, + const genType & v1, + const GLMvalType epsilon = std::numeric_limits::epsilon()); + + //! Check if two vectors are opposites. + //! From GLM_GTX_vector_query extensions. + template + bool areOpposite( + const genType & v0, + const genType & v1, + const GLMvalType epsilon = std::numeric_limits::epsilon()); + + //! Check if two vectors are orthogonals. + //! From GLM_GTX_vector_query extensions. + template + bool areOrthogonal( + const genType & v0, + const genType & v1, + const GLMvalType epsilon = std::numeric_limits::epsilon()); + + //! Check if a vector is normalized. + //! From GLM_GTX_vector_query extensions. + template + bool isNormalized( + const genType & v, + const GLMvalType epsilon = std::numeric_limits::epsilon()); + + //! Check if a vector is null. + //! From GLM_GTX_vector_query extensions. + template + bool isNull( + const genType& v, + const GLMvalType epsilon = std::numeric_limits::epsilon()); + + //! Check if two vectors are orthonormal. + //! From GLM_GTX_vector_query extensions. + template + bool areOrthonormal( + const genType & v0, + const genType & v1, + const GLMvalType epsilon = std::numeric_limits::epsilon()); + + //! Check if two vectors are similar. + //! From GLM_GTX_vector_query extensions. + template + bool areSimilar( + const genType& v0, + const genType& v1, + const GLMvalType epsilon = std::numeric_limits::epsilon()); + + }//namespace vector_query + }//namespace gtx +}//namespace glm + +#define GLM_GTX_vector_query namespace gtx::vector_query +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_vector_query;} +#endif//GLM_GTX_GLOBAL + +#include "vector_query.inl" + +#endif//glm_gtx_vector_query diff --git a/glm/gtx/vector_query.inl b/glm/gtx/vector_query.inl new file mode 100644 index 0000000..507b7a8 --- /dev/null +++ b/glm/gtx/vector_query.inl @@ -0,0 +1,143 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-05 +// Updated : 2007-03-05 +// Licence : This source is under MIT License +// File : glm/gtx/vector_query.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm{ +namespace gtx{ +namespace vector_query +{ + template + inline bool areCollinear( + const detail::tvec2& v0, + const detail::tvec2& v1, + const T epsilon) + { + return length(cross(detail::tvec3(v0, T(0)), detail::tvec3(v1, T(0)))) < epsilon; + } + + template + inline bool areCollinear( + const detail::tvec3& v0, + const detail::tvec3& v1, + const T epsilon) + { + return length(cross(v0, v1)) < epsilon; + } + + template + inline bool areCollinear( + const detail::tvec4& v0, + const detail::tvec4& v1, + const T epsilon) + { + return length(cross(detail::tvec3(v0), detail::tvec3(v1))) < epsilon; + } + + template + inline bool areOpposite( + const genType& v0, + const genType& v1, + const GLMvalType epsilon) + { + assert(isNormalized(v0) && isNormalized(v1)); + return((genType::value_type(1) + dot(v0, v1)) <= epsilon); + } + + template + inline bool areOrthogonal( + const genType& v0, + const genType& v1, + const GLMvalType epsilon) + { + return abs(dot(v0, v1)) <= max(GLMvalType(1), length(v0)) * max(GLMvalType(1), length(v1)) * epsilon; + } + + template + inline bool isNormalized( + const genType& v, + const GLMvalType epsilon) + { + return abs(length(v) - GLMvalType(1)) <= GLMvalType(2) * epsilon; + } + + template + inline bool isNull(const genType& v, const GLMvalType epsilon) + { + return length(v) <= epsilon; + } + + template + inline bool isCompNull( + const T s, + const T epsilon) + { + return abs(s) < epsilon; + } + + template + inline detail::tvec2 isCompNull( + const detail::tvec2& v, + const T epsilon) + { + return detail::tvec2( + (abs(v.x) < epsilon), + (abs(v.y) < epsilon)); + } + + template + inline detail::tvec3 isCompNull( + const detail::tvec3& v, + const T epsilon) + { + return detail::tvec3( + abs(v.x) < epsilon, + abs(v.y) < epsilon, + abs(v.z) < epsilon); + } + + template + inline detail::tvec4 isCompNull( + const detail::tvec4& v, + const T epsilon) + { + return detail::tvec4( + abs(v.x) < epsilon, + abs(v.y) < epsilon, + abs(v.z) < epsilon, + abs(v.w) < epsilon); + } + + template + inline bool areOrthonormal( + const genType& v0, + const genType& v1, + const GLMvalType epsilon) + { + return isNormalized(v0, epsilon) && isNormalized(v1, epsilon) && (abs(dot(v0, v1)) <= epsilon); + } + + template + inline bool areSimilar( + const genType& v0, + const genType& v1, + const GLMvalType epsilon) + { + bool similar = true; + for(typename genType::size_type i = 0; similar && i < genType::value_size(); i++) + similar = (abs(v0[i] - v1[i]) <= epsilon); + return similar; + } + +}//namespace vector_query +}//namespace gtx +}//namespace glm diff --git a/glm/gtx/vecx.hpp b/glm/gtx/vecx.hpp new file mode 100644 index 0000000..cdb178f --- /dev/null +++ b/glm/gtx/vecx.hpp @@ -0,0 +1,218 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-02-21 +// Updated : 2007-02-21 +// Licence : This source is under MIT License +// File : glm/gtx/vecx.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_vecx +#define glm_gtx_vecx + +namespace glm{ +namespace detail{ + + template + class _bvecxGTX + { + private: + bool data[N]; + + public: + typedef bool value_type; + typedef int size_type; + static const size_type value_size; + static const size_type col_size; + static const size_type row_size; + + // Common constructors + _bvecxGTX(); + _bvecxGTX(const _bvecxGTX& v); + + // Accesses + bool& operator[](int i); + bool operator[](int i) const; + operator bool*(); + operator const bool*() const; + + // Bool constructors + explicit _bvecxGTX(const bool a); + + // Operators + _bvecxGTX& operator=(const _bvecxGTX& v); + _bvecxGTX operator! () const; + }; + + template + class _xvecxGTX + { + private: + T data[N]; + + public: + typedef T value_type; + typedef int size_type; + static const size_type value_size; + + // Common constructors + _xvecxGTX(); + _xvecxGTX(const _xvecxGTX& v); + + // Accesses + T& operator[](int i); + T operator[](int i) const; + operator T*(); + operator const T*() const; + + // T constructors + explicit _xvecxGTX(const T x); + + // Unary updatable operators + _xvecxGTX& operator= (const _xvecxGTX& v); + _xvecxGTX& operator+=(const T s); + _xvecxGTX& operator+=(const _xvecxGTX& v); + _xvecxGTX& operator-=(const T s); + _xvecxGTX& operator-=(const _xvecxGTX& v); + _xvecxGTX& operator*=(const T s); + _xvecxGTX& operator*=(const _xvecxGTX& v); + _xvecxGTX& operator/=(const T s); + _xvecxGTX& operator/=(const _xvecxGTX& v); + _xvecxGTX& operator++(); + _xvecxGTX& operator--(); + }; + + // Binary operators + template + detail::_xvecxGTX operator+ (const detail::_xvecxGTX& v, const T s); + + template + detail::_xvecxGTX operator+ (const T s, const detail::_xvecxGTX& v); + + template + detail::_xvecxGTX operator+ (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2); + + template + detail::_xvecxGTX operator- (const detail::_xvecxGTX& v, const T s); + + template + detail::_xvecxGTX operator- (const T s, const detail::_xvecxGTX& v); + + template + detail::_xvecxGTX operator- (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2); + + template + detail::_xvecxGTX operator* (const detail::_xvecxGTX& v, const T s); + + template + detail::_xvecxGTX operator* (const T s, const detail::_xvecxGTX& v); + + template + detail::_xvecxGTX operator* (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2); + + template + detail::_xvecxGTX operator/ (const detail::_xvecxGTX& v, const T s); + + template + detail::_xvecxGTX operator/ (const T s, const detail::_xvecxGTX& v); + + template + detail::_xvecxGTX operator/ (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2); + + // Unary constant operators + template + const detail::_xvecxGTX operator- (const detail::_xvecxGTX& v); + + template + const detail::_xvecxGTX operator-- (const detail::_xvecxGTX& v, int); + + template + const detail::_xvecxGTX operator++ (const detail::_xvecxGTX& v, int); + +}//namespace detail + + namespace gtx + { + //! GLM_GTX_vecx extension: - Work in progress - Add custom size vectors + namespace vecx + { + template + struct vec + { + typedef detail::_xvecxGTX type; + }; + + // Trigonometric Functions + template detail::_xvecxGTX radiansGTX(const detail::_xvecxGTX& degrees); //< \brief Converts degrees to radians and returns the result. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX degreesGTX(const detail::_xvecxGTX& radians); //< \brief Converts radians to degrees and returns the result. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX sinGTX(const detail::_xvecxGTX& angle); //< \brief The standard trigonometric sine function. The values returned by this function will range from [-1, 1]. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX cosGTX(const detail::_xvecxGTX& angle); //< \brief The standard trigonometric cosine function. The values returned by this function will range from [-1, 1]. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX tanGTX(const detail::_xvecxGTX& angle); //< \brief The standard trigonometric tangent function. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX asinGTX(const detail::_xvecxGTX& x); //< \brief 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 GLM_GTX_vecx extension) + template detail::_xvecxGTX acosGTX(const detail::_xvecxGTX& x); //< \brief 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 GLM_GTX_vecx extension) + template detail::_xvecxGTX atanGTX(const detail::_xvecxGTX& y, const detail::_xvecxGTX& x); //< \brief 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 GLM_GTX_vecx extension) + template detail::_xvecxGTX atanGTX(const detail::_xvecxGTX& y_over_x); //< \brief 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 GLM_GTX_vecx extension) + + // Exponential Functions + template detail::_xvecxGTX powGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns x raised to the y power. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX expGTX(const detail::_xvecxGTX& x); //< \brief Returns the natural exponentiation of x, i.e., e^x. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX logGTX(const detail::_xvecxGTX& x); //< \brief 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 GLM_GTX_vecx extension) + template detail::_xvecxGTX exp2GTX(const detail::_xvecxGTX& x); //< \brief Returns 2 raised to the x power. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX log2GTX(const detail::_xvecxGTX& x); //< \brief Returns the base 2 log of x, i.e., returns the value y, which satisfies the equation x = 2 ^ y. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX sqrtGTX(const detail::_xvecxGTX& x); //< \brief Returns the positive square root of x. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX inversesqrtGTX(const detail::_xvecxGTX& x); //< \brief Returns the reciprocal of the positive square root of x. (From GLM_GTX_vecx extension) + + // Common Functions + template detail::_xvecxGTX absGTX(const detail::_xvecxGTX& x); //< \brief Returns x if x >= 0; otherwise, it returns -x. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX floorGTX(const detail::_xvecxGTX& x); //< \brief Returns a value equal to the nearest integer that is less then or equal to x. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX ceilGTX(const detail::_xvecxGTX& x); //< \brief Returns a value equal to the nearest integer that is greater than or equal to x. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX fractGTX(const detail::_xvecxGTX& x); //< \brief Return x - floor(x). (From GLM_GTX_vecx extension) + template detail::_xvecxGTX modGTX(const detail::_xvecxGTX& x, T y); //< \brief Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX modGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Modulus. Returns x - y * floor(x / y) for each component in x using the corresponding component of y. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX minGTX(const detail::_xvecxGTX& x, T y); //< \brief Returns y if y < x; otherwise, it returns x. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX minGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns minimum of each component of x compared with the floating-point value y. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX maxGTX(const detail::_xvecxGTX& x, T y); //< \brief Returns y if x < y; otherwise, it returns x. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX maxGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns maximum of each component of x compared with the floating-point value y. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX clampGTX(const detail::_xvecxGTX& x, T minVal, T maxVal); //< \brief Returns min(max(x, minVal), maxVal) for each component in x using the floating-point values minVal and maxVal. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX clampGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& minVal, const detail::_xvecxGTX& maxVal); //< \brief Returns the component-wise result of min(max(x, minVal), maxVal). (From GLM_GTX_vecx extension) + template detail::_xvecxGTX stepGTX(T edge, const detail::_xvecxGTX& x); //< \brief Returns 0.0 if x <= edge; otherwise, it returns 1.0. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX stepGTX(const detail::_xvecxGTX& edge, const detail::_xvecxGTX& x); //< \brief Returns 0.0 if x <= edge; otherwise, it returns 1.0. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX smoothstepGTX(T edge0, T edge1, const detail::_xvecxGTX& x); //< \brief 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. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX smoothstepGTX(const detail::_xvecxGTX& edge0, const detail::_xvecxGTX& edge1, const detail::_xvecxGTX& x);//< \brief 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. (From GLM_GTX_vecx extension) + + // Geometric Functions + template T lengthGTX(const detail::_xvecxGTX& x); //< \brief Returns the length of x, i.e., sqrt(x * x). (From GLM_GTX_vecx extension) + template T distanceGTX(const detail::_xvecxGTX& p0, const detail::_xvecxGTX& p1); //< \brief Returns the distance betwwen p0 and p1, i.e., length(p0 - p1). (From GLM_GTX_vecx extension) + template T dotGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns the dot product of x and y, i.e., result = x[0] * y[0] + x[1] * y[1]. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX normalizeGTX(const detail::_xvecxGTX& x); //< \brief Returns a vector in the same direction as x but with length of 1. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX faceforwardGTX(const detail::_xvecxGTX& Norm, const detail::_xvecxGTX& I, const detail::_xvecxGTX& Nref); //< \brief If dot(Nref, I) < 0.0, return N, otherwise, return -N. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX reflectGTX(const detail::_xvecxGTX& I, const detail::_xvecxGTX& N); //< \brief For the incident vector I and surface orientation N, returns the reflection direction : result = I - 2.0 * dot(N, I) * N. (From GLM_GTX_vecx extension) + template detail::_xvecxGTX refractGTX(const detail::_xvecxGTX& I, const detail::_xvecxGTX& N, T eta); //< \brief For the incident vector I and surface normal N, and the ratio of indices of refraction eta, return the refraction vector. (From GLM_GTX_vecx extension) + + // Vector Relational Functions + template detail::_bvecxGTX lessThanGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns the component-wise compare of x < y. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX lessThanEqualGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns the component-wise compare of x <= y. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX greaterThanGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns the component-wise compare of x > y. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX greaterThanEqualGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns the component-wise compare of x >= y. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX equalGTX(const detail::_bvecxGTX& x, const detail::_bvecxGTX& y); //< \brief Returns the component-wise compare of x == y. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX equalGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns the component-wise compare of x == y. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX notEqualGTX(const detail::_bvecxGTX& x, const detail::_bvecxGTX& y); //< \brief Returns the component-wise compare of x != y. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX notEqualGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y); //< \brief Returns the component-wise compare of x != y. (From GLM_GTX_vecx extension) + template bool anyGTX(const detail::_bvecxGTX& x); //< \brief Returns true if any component of x is true. (From GLM_GTX_vecx extension) + template bool allGTX(const detail::_bvecxGTX& x); //< \brief Returns true if all component of x is true. (From GLM_GTX_vecx extension) + template detail::_bvecxGTX notGTX(const detail::_bvecxGTX& v); //< \brief Returns the component-wise logical complement of x. (From GLM_GTX_vecx extension) + } + } +} + +#define GLM_GTX_vecx namespace gtx::vecx +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_vecx;} +#endif//GLM_GTX_GLOBAL + +#include "vecx.inl" + +#endif//glm_gtx_vecx diff --git a/glm/gtx/vecx.inl b/glm/gtx/vecx.inl new file mode 100644 index 0000000..4b2807a --- /dev/null +++ b/glm/gtx/vecx.inl @@ -0,0 +1,863 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-02-21 +// Updated : 2007-02-21 +// Licence : This source is under MIT License +// File : glm/gtx/vecx.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm +{ +namespace detail{ + + template const typename _bvecxGTX::size_type _bvecxGTX::value_size = N; + + // Bool constructors + template + inline _bvecxGTX::_bvecxGTX() + { + for(int i = 0; i < N; ++i) + this->data[i] = false; + } + + template + inline _bvecxGTX::_bvecxGTX(const _bvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] = v[i]; + } + + template + inline _bvecxGTX::_bvecxGTX(const bool s) + { + for(int i = 0; i < N; ++i) + this->data[i] = s; + } + + // Accesses + template + inline bool& _bvecxGTX::operator[](int i) + { + assert(i >= 0 && i < N); + return this->data[i]; + } + + template + inline bool _bvecxGTX::operator[](int i) const + { + assert(i >= 0 && i < N); + return this->data[i]; + } + + template + inline _bvecxGTX::operator bool*() + { + return data; + } + + template + inline _bvecxGTX::operator const bool*() const + { + return data; + } + + // Operators + template + inline _bvecxGTX& _bvecxGTX::operator=(const _bvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] = v[i]; + return *this; + } + + template + inline _bvecxGTX _bvecxGTX::operator! () const + { + _bvecxGTX result; + for(int i = 0; i < N; ++i) + result[i] = !this->data[i]; + return result; + } + + template const typename _xvecxGTX::size_type _xvecxGTX::value_size = N; + + // Common constructors + template + inline _xvecxGTX::_xvecxGTX() + { + for(int i = 0; i < N; ++i) + this->data[i] = T(0); + } + + template + inline _xvecxGTX::_xvecxGTX(const _xvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] = v[i]; + } + + // T constructors + template + inline _xvecxGTX::_xvecxGTX(const T s) + { + for(int i = 0; i < N; ++i) + this->data[i] = s; + } + + // Accesses + template + inline T& _xvecxGTX::operator[](int i) + { + assert(i >= 0 && i < N); + return this->data[i]; + } + + template + inline T _xvecxGTX::operator[](int i) const + { + assert(i >= 0 && i < N); + return this->data[i]; + } + + template + inline _xvecxGTX::operator T*() + { + return data; + } + + template + inline _xvecxGTX::operator const T*() const + { + return data; + } + + template + inline _xvecxGTX& _xvecxGTX::operator=(const _xvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] = v[i]; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator+= (const T s) + { + for(int i = 0; i < N; ++i) + this->data[i] += s; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator+=(const _xvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] += v[i]; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator-= (const T s) + { + for(int i = 0; i < N; ++i) + this->data[i] -= s; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator-=(const _xvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] -= v[i]; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator*=(const T s) + { + for(int i = 0; i < N; ++i) + this->data[i] *= s; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator*= (const _xvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] *= v[i]; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator/=(const T s) + { + for(int i = 0; i < N; ++i) + this->data[i] /= s; + return *this; + } + + template + inline _xvecxGTX& _xvecxGTX::operator/= (const _xvecxGTX& v) + { + for(int i = 0; i < N; ++i) + this->data[i] /= v[i]; + return *this; + } + + + // Unary constant operators + template + inline const detail::_xvecxGTX operator- (const detail::_xvecxGTX& v) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = -v[i]; + return result; + } + + template + inline const detail::_xvecxGTX operator++ (const detail::_xvecxGTX& v, int) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v[i] + T(1); + return result; + } + + template + inline const detail::_xvecxGTX operator-- (const detail::_xvecxGTX& v, int) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v[i] - T(1); + return result; + } + + // Binary operators + template + inline detail::_xvecxGTX operator+ (const detail::_xvecxGTX& v, const T s) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v[i] + s; + return result; + } + + template + inline detail::_xvecxGTX operator+ (const T s, const detail::_xvecxGTX& v) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v[i] + s; + return result; + } + + template + inline detail::_xvecxGTX operator+ (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v1[i] + v2[i]; + return result; + } + + template + inline detail::_xvecxGTX operator- (const detail::_xvecxGTX& v, const T s) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v[i] - s; + return result; + } + + template + inline detail::_xvecxGTX operator- (const T s, const detail::_xvecxGTX& v) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = s - v[i]; + return result; + } + + template + inline detail::_xvecxGTX operator- (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v1[i] - v2[i]; + return result; + } + + template + inline detail::_xvecxGTX operator* (const detail::_xvecxGTX& v, const T s) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v[i] * s; + return result; + } + + template + inline detail::_xvecxGTX operator* (const T s, const detail::_xvecxGTX& v) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = s * v[i]; + return result; + } + + template + inline detail::_xvecxGTX operator* (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v1[i] * v2[i]; + return result; + } + + template + inline detail::_xvecxGTX operator/ (const detail::_xvecxGTX& v, const T s) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v[i] / s; + return result; + } + + template + inline detail::_xvecxGTX operator/ (const T s, const detail::_xvecxGTX& v) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = s / v[i]; + return result; + } + + template + inline detail::_xvecxGTX operator/ (const detail::_xvecxGTX& v1, const detail::_xvecxGTX& v2) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = v1[i] / v2[i]; + return result; + } + +}//namespace detail + + namespace gtx{ + namespace vecx{ + + // Trigonometric Functions + template + detail::_xvecxGTX radiansGTX(const detail::_xvecxGTX& degrees) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = radians(degrees[i]); + return result; + } + + template + detail::_xvecxGTX degreesGTX(const detail::_xvecxGTX& radians) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = degrees(radians[i]); + return result; + } + + template + detail::_xvecxGTX sinGTX(const detail::_xvecxGTX& angle) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = sin(angle[i]); + return result; + } + + template + detail::_xvecxGTX cosGTX(const detail::_xvecxGTX& angle) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = cos(angle[i]); + return result; + } + + template + detail::_xvecxGTX tanGTX(const detail::_xvecxGTX& angle) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = tan(angle[i]); + return result; + } + + template + detail::_xvecxGTX asinGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = asin(x[i]); + return result; + } + + template + detail::_xvecxGTX acosGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = acos(x[i]); + return result; + } + + template + detail::_xvecxGTX atanGTX(const detail::_xvecxGTX& y, const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = atan(y[i], x[i]); + return result; + } + + template + detail::_xvecxGTX atanGTX(const detail::_xvecxGTX& y_over_x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = atan(y_over_x[i]); + return result; + } + + // Exponential Functions + template + detail::_xvecxGTX powGTX(const detail::_xvecxGTX& x, const detail::_xvecxGTX& y) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = pow(x[i], y[i]); + return result; + } + + template + detail::_xvecxGTX expGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = exp(x[i]); + return result; + } + + template + detail::_xvecxGTX logGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = log(x[i]); + return result; + } + + template + detail::_xvecxGTX exp2GTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = exp2(x[i]); + return result; + } + + template + detail::_xvecxGTX log2GTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = log2(x[i]); + return result; + } + + template + detail::_xvecxGTX sqrtGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = sqrt(x[i]); + return result; + } + + template + detail::_xvecxGTX inversesqrtGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = inversesqrt(x[i]); + return result; + } + + // Common Functions + template + detail::_xvecxGTX absGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = abs(x[i]); + return result; + } + + template + detail::_xvecxGTX signGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = sign(x[i]); + return result; + } + + template + detail::_xvecxGTX floorGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = floor(x[i]); + return result; + } + + template + detail::_xvecxGTX ceilGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = ceil(x[i]); + return result; + } + + template + detail::_xvecxGTX fractGTX(const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = fract(x[i]); + return result; + } + + template + detail::_xvecxGTX modGTX(const detail::_xvecxGTX& x, T y) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = mod(x[i], y); + return result; + } + + template + detail::_xvecxGTX modGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = mod(x[i], y[i]); + return result; + } + + template + detail::_xvecxGTX minGTX( + const detail::_xvecxGTX& x, + T y) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = min(x[i], y); + return result; + } + + template + detail::_xvecxGTX minGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = min(x[i], y[i]); + return result; + } + + template + detail::_xvecxGTX maxGTX( + const detail::_xvecxGTX& x, + T y) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = max(x[i], y); + return result; + } + + template + detail::_xvecxGTX maxGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = max(x[i], y[i]); + return result; + } + + template + detail::_xvecxGTX clampGTX( + const detail::_xvecxGTX& x, + T minVal, + T maxVal) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = clamp(x[i], minVal, maxVal); + return result; + } + + template + detail::_xvecxGTX clampGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& minVal, + const detail::_xvecxGTX& maxVal) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = clamp(x[i], minVal[i], maxVal[i]); + return result; + } + + template + detail::_xvecxGTX stepGTX( + T edge, + const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = step(edge, x[i]); + return result; + } + + template + detail::_xvecxGTX stepGTX( + const detail::_xvecxGTX& edge, + const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = step(edge[i], x[i]); + return result; + } + + template + detail::_xvecxGTX smoothstepGTX( + T edge0, + T edge1, + const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = step(edge0, edge1, x[i]); + return result; + } + + template + detail::_xvecxGTX smoothstepGTX( + const detail::_xvecxGTX& edge0, + const detail::_xvecxGTX& edge1, + const detail::_xvecxGTX& x) + { + detail::_xvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = step(edge0[i], edge1[i], x[i]); + return result; + } + + // Geometric Functions + template + T lengthGTX( + const detail::_xvecxGTX& x) + { + T sqr = dot(x, x); + return sqrt(sqr); + } + + template + T distanceGTX( + const detail::_xvecxGTX& p0, + const detail::_xvecxGTX& p1) + { + return lengthGTX(p1 - p0); + } + + template + T dotGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + T result = T(0); + for(int i = 0; i < N; ++i) + result += x[i] * y[i]; + return result; + } + + template + detail::_xvecxGTX normalizeGTX( + const detail::_xvecxGTX& x) + { + T sqr = dot(x, x); + return x * inversesqrt(sqr); + } + + template + detail::_xvecxGTX faceforwardGTX( + const detail::_xvecxGTX& Normal, + const detail::_xvecxGTX& I, + const detail::_xvecxGTX& Nref) + { + return dot(Nref, I) < T(0) ? Normal : -Normal; + } + + template + detail::_xvecxGTX reflectGTX( + const detail::_xvecxGTX& I, + const detail::_xvecxGTX& Normal) + { + return I - Normal * dot(Normal, I) * T(2); + } + + template + detail::_xvecxGTX refractGTX( + const detail::_xvecxGTX& I, + const detail::_xvecxGTX& Normal, + T eta) + { + T dot = dot(Normal, I); + T k = T(1) - eta * eta * (T(1) - dot * dot); + if(k < T(0)) + return detail::_xvecxGTX(T(0)); + else + return eta * I - (eta * dot + sqrt(k)) * Normal; + } + + // Vector Relational Functions + template + detail::_bvecxGTX lessThanGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = lessThan(x[i], y[i]); + return result; + } + + template + detail::_bvecxGTX lessThanEqualGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = lessThanEqual(x[i], y[i]); + return result; + } + + template + detail::_bvecxGTX greaterThanGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = greaterThan(x[i], y[i]); + return result; + } + + template + detail::_bvecxGTX greaterThanEqualGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = greaterThanEqual(x[i], y[i]); + return result; + } + + template + detail::_bvecxGTX equalGTX( + const detail::_bvecxGTX& x, + const detail::_bvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = equal(x[i], y[i]); + return result; + } + + template + detail::_bvecxGTX equalGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = equal(x[i], y[i]); + return result; + } + + template + detail::_bvecxGTX notEqualGTX( + const detail::_bvecxGTX& x, + const detail::_bvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = equal(x[i], y[i]); + return result; + } + + template + detail::_bvecxGTX notEqualGTX( + const detail::_xvecxGTX& x, + const detail::_xvecxGTX& y) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = notEqual(x[i], y[i]); + return result; + } + + template + bool anyGTX(const detail::_bvecxGTX& x) + { + for(int i = 0; i< N; ++i) + if(x[i]) return true; + return false; + } + + template + bool allGTX(const detail::_bvecxGTX& x) + { + for(int i = 0; i< N; ++i) + if(!x[i]) return false; + return true; + } + + template + detail::_bvecxGTX notGTX( + const detail::_bvecxGTX& v) + { + detail::_bvecxGTX result; + for(int i = 0; i< N; ++i) + result[i] = !v[i]; + return result; + } + + }//namespace vecx + }//namespace gtx + +} //namespace glm diff --git a/glm/gtx/verbose_operator.hpp b/glm/gtx/verbose_operator.hpp new file mode 100644 index 0000000..adb8d91 --- /dev/null +++ b/glm/gtx/verbose_operator.hpp @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-05-21 +// Updated : 2007-05-21 +// Licence : This source is under MIT License +// File : glm/gtx/verbose_operator.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_verbose_operator +#define glm_gtx_verbose_operator + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + void main_ext_gtx_verbose_operator(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_verbose_operator extension: Use words to replace operators + namespace verbose_operator + { + //! Addition of two values + //! From GLM_GTX_verbose_operator extension. + template + genTypeT add(genTypeT const & a, genTypeU const & b); + + //! Substration of two values + //! From GLM_GTX_verbose_operator extension. + template + genTypeT sub(genTypeT const & a, genTypeU const & b); + + //! Multiplication of two values + //! From GLM_GTX_verbose_operator extension. + template + genTypeT mul(genTypeT const & a, genTypeU const & b); + + //! Division of two values + //! From GLM_GTX_verbose_operator extension. + template + genTypeT div(genTypeT const & a, genTypeU const & b); + + //! Multiplication and addition of three values + //! From GLM_GTX_verbose_operator extension. + template + genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV const & c); + }//namespace verbose_operator + }//namespace gtx +}//namespace glm + +#include "verbose_operator.inl" + +#define GLM_GTX_verbose_operator namespace gtx::verbose_operator +#ifndef GLM_GTX_GLOBAL +namespace glm {using GLM_GTX_verbose_operator;} +#endif//GLM_GTX_GLOBAL + +#endif//glm_gtx_verbose_operator diff --git a/glm/gtx/verbose_operator.inl b/glm/gtx/verbose_operator.inl new file mode 100644 index 0000000..08c0aae --- /dev/null +++ b/glm/gtx/verbose_operator.inl @@ -0,0 +1,129 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-04-20 +// Updated : 2008-09-29 +// Licence : This source is under MIT License +// File : glm/gtx/verbose_operator.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace verbose_operator{ + +template +inline genType add(genType const & a, genType const & b) +{ + return a + b; +} + +template +inline genType sub(genType const & a, genType const & b) +{ + return a - b; +} + +template +inline detail::tmat2x2 mul +( + detail::tmat2x2 const & a, + detail::tmat2x2 const & b +) +{ + return a * b; +} + +template +inline detail::tmat3x3 mul +( + detail::tmat3x3 const & a, + detail::tmat3x3 const & b +) +{ + return a * b; +} + +template +inline detail::tmat4x4 mul +( + detail::tmat4x4 const & a, + detail::tmat4x4 const & b +) +{ + return a * b; +} + +template +inline detail::tvec2 mul +( + detail::tmat2x2 const & m, + detail::tvec2 const & v +) +{ + return m * v; +} + +template +inline detail::tvec3 mul +( + detail::tmat3x3 const & m, + detail::tvec3 const & v) +{ + return m * v; +} + +template +inline detail::tvec4 mul +( + detail::tmat4x4 const & m, + detail::tvec4 const & v +) +{ + return m * v; +} + +template +inline detail::tvec2 mul +( + detail::tvec2 const & v, + detail::tmat2x2 const & m +) +{ + return v * m; +} + +template +inline detail::tvec3 mul +( + detail::tvec3 const & v, + detail::tmat3x3 const & m +) +{ + return v * m; +} + +template +inline detail::tvec4 mul +( + detail::tvec4 const & v, + detail::tmat4x4 const & m +) +{ + return v * m; +} + +template +inline genType div(genType const & a, genType const & b) +{ + return a / b; +} + +template +inline genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV const & c) +{ + return a * b + c; +} + +}//namespace verbose_operator +}//namespace gtx +}//namespace glm diff --git a/glm/img.hpp b/glm/img.hpp new file mode 100644 index 0000000..d494b45 --- /dev/null +++ b/glm/img.hpp @@ -0,0 +1,17 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-11-14 +// Updated : 2009-11-14 +// Licence : This source is under MIT License +// File : glm/img.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_img +#define glm_img + +#define GLM_IMG_GLOBAL 1 + +#include "./img/multiple.hpp" + +#endif//glm_img diff --git a/glm/img/multiple.hpp b/glm/img/multiple.hpp new file mode 100644 index 0000000..b7e7246 --- /dev/null +++ b/glm/img/multiple.hpp @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-10-26 +// Updated : 2009-10-26 +// Licence : This source is under MIT License +// File : glm/img/multiple.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_img_multiple +#define glm_img_multiple + +// Dependency: +#include "../glm.hpp" + +namespace glm +{ + namespace test{ + bool main_img_multiple(); + }//namespace test + + namespace img + { + //! GLM_IMG_multiple: Find the closest number of a number multiple of other number. + namespace multiple + { + //! Higher Multiple number of Source. + //! From GLM_IMG_multiple extension. + template + genType higherMultiple( + genType const & Source, + genType const & Multiple); + + //! Lower Multiple number of Source. + //! From GLM_IMG_multiple extension. + template + genType lowerMultiple( + genType const & Source, + genType const & Multiple); + + }//namespace multiple + }//namespace img +}//namespace glm + +#define GLM_IMG_multiple namespace img::multiple +#ifndef GLM_IMG_GLOBAL +namespace glm {using GLM_IMG_multiple;} +#endif//GLM_IMG_GLOBAL + +#include "multiple.inl" + +#endif//glm_img_multiple diff --git a/glm/img/multiple.inl b/glm/img/multiple.inl new file mode 100644 index 0000000..8fab1b9 --- /dev/null +++ b/glm/img/multiple.inl @@ -0,0 +1,191 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-10-26 +// Updated : 2009-10-26 +// Licence : This source is under MIT License +// File : glm/img/multiple.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace img{ +namespace multiple +{ + ////////////////////// + // higherMultiple + + template + inline genType higherMultiple + ( + genType const & Source, + genType const & Multiple + ) + { + genType Tmp = Source % Multiple; + return Tmp ? Source + Multiple - Tmp : Source; + } + + template <> + inline detail::thalf higherMultiple + ( + detail::thalf const & Source, + detail::thalf const & Multiple + ) + { + int Tmp = int(float(Source)) % int(float(Multiple)); + return Tmp ? Source + Multiple - detail::thalf(float(Tmp)) : Source; + } + + template <> + inline float higherMultiple + ( + float const & Source, + float const & Multiple + ) + { + int Tmp = int(Source) % int(Multiple); + return Tmp ? Source + Multiple - float(Tmp) : Source; + } + + template <> + inline double higherMultiple + ( + double const & Source, + double const & Multiple + ) + { + long Tmp = long(Source) % long(Multiple); + return Tmp ? Source + Multiple - double(Tmp) : Source; + } + + template + inline detail::tvec2 higherMultiple + ( + detail::tvec2 const & Source, + detail::tvec2 const & Multiple + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = higherMultiple(Source[i], Multiple[i]); + return Result; + } + + template + inline detail::tvec3 higherMultiple + ( + detail::tvec3 const & Source, + detail::tvec3 const & Multiple + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = higherMultiple(Source[i], Multiple[i]); + return Result; + } + + template + inline detail::tvec4 higherMultiple + ( + detail::tvec4 const & Source, + detail::tvec4 const & Multiple + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = higherMultiple(Source[i], Multiple[i]); + return Result; + } + + ////////////////////// + // lowerMultiple + + template + inline genType lowerMultiple + ( + genType const & Source, + genType const & Multiple + ) + { + genType Tmp = Source % Multiple; + return Tmp ? Source - Tmp : Source; + } + + template <> + inline detail::thalf lowerMultiple + ( + detail::thalf const & Source, + detail::thalf const & Multiple + ) + { + int Tmp = int(float(Source)) % int(float(Multiple)); + return Tmp ? Source - detail::thalf(float(Tmp)) : Source; + } + + template <> + inline float lowerMultiple + ( + float const & Source, + float const & Multiple + ) + { + int Tmp = int(Source) % int(Multiple); + return Tmp ? Source - float(Tmp) : Source; + } + + template <> + inline double lowerMultiple + ( + double const & Source, + double const & Multiple + ) + { + long Tmp = long(Source) % long(Multiple); + return Tmp ? Source - double(Tmp) : Source; + } + + template + inline detail::tvec2 lowerMultiple + ( + detail::tvec2 const & Source, + detail::tvec2 const & Multiple + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = lowerMultiple(Source[i], Multiple[i]); + return Result; + } + + template + inline detail::tvec3 lowerMultiple + ( + detail::tvec3 const & Source, + detail::tvec3 const & Multiple + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = lowerMultiple(Source[i], Multiple[i]); + return Result; + } + + template + inline detail::tvec4 lowerMultiple + ( + detail::tvec4 const & Source, + detail::tvec4 const & Multiple + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = lowerMultiple(Source[i], Multiple[i]); + return Result; + } + +}//namespace multiple +}//namespace img +}//namespace glm diff --git a/glm/setup.hpp b/glm/setup.hpp new file mode 100644 index 0000000..97853b4 --- /dev/null +++ b/glm/setup.hpp @@ -0,0 +1,369 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2006-11-13 +// Updated : 2009-08-24 +// Licence : This source is under MIT License +// File : glm/setup.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_setup +#define glm_setup + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Version + +#define GLM_VERSION 84 +#define GLM_REVISION 724 + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Common values + +#define GLM_DISABLE 0x00000000 +#define GLM_ENABLE 0x00000001 + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Message + +#define GLM_MESSAGE_QUIET 0x00000000 + +#define GLM_MESSAGE_WARNING 0x00000001 +#define GLM_MESSAGE_NOTIFICATION 0x00000002 +#define GLM_MESSAGE_CORE 0x00000004 +#define GLM_MESSAGE_EXTS 0x00000008 +#define GLM_MESSAGE_SETUP 0x00000010 + +#define GLM_MESSAGE_ALL GLM_MESSAGE_WARNING | GLM_MESSAGE_NOTIFICATION | GLM_MESSAGE_CORE | GLM_MESSAGE_EXTS | GLM_MESSAGE_SETUP + +//! By default: +// #define GLM_MESSAGE GLM_MESSAGE_QUIET + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Precision + +#define GLM_PRECISION_NONE 0x00000000 + +#define GLM_PRECISION_LOWP_FLOAT 0x00000011 +#define GLM_PRECISION_MEDIUMP_FLOAT 0x00000012 +#define GLM_PRECISION_HIGHP_FLOAT 0x00000013 + +#define GLM_PRECISION_LOWP_INT 0x00001100 +#define GLM_PRECISION_MEDIUMP_INT 0x00001200 +#define GLM_PRECISION_HIGHP_INT 0x00001300 + +#define GLM_PRECISION_LOWP_UINT 0x00110000 +#define GLM_PRECISION_MEDIUMP_UINT 0x00120000 +#define GLM_PRECISION_HIGHP_UINT 0x00130000 + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Use options + +// To disable multiple vector component names access. +// GLM_USE_ONLY_XYZW + +// To use anonymous union to provide multiple component names access for class valType. Visual C++ only. +// GLM_USE_ANONYMOUS_UNION + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Compiler + +#define GLM_COMPILER_NONE 0x00000000 + +// Visual C++ defines +#define GLM_COMPILER_VC 0x01000000 +#define GLM_COMPILER_VC60 0x01000040 // unsupported +#define GLM_COMPILER_VC70 0x01000080 // unsupported +#define GLM_COMPILER_VC71 0x01000100 // unsupported +#define GLM_COMPILER_VC80 0x01000200 +#define GLM_COMPILER_VC90 0x01000400 +#define GLM_COMPILER_VC2010 0x01000800 + +// GCC defines +#define GLM_COMPILER_GCC 0x02000000 +#define GLM_COMPILER_GCC28 0x02000020 // unsupported +#define GLM_COMPILER_GCC29 0x02000040 // unsupported +#define GLM_COMPILER_GCC30 0x02000080 // unsupported +#define GLM_COMPILER_GCC31 0x02000100 // unsupported +#define GLM_COMPILER_GCC32 0x02000200 +#define GLM_COMPILER_GCC33 0x02000400 +#define GLM_COMPILER_GCC34 0x02000800 +#define GLM_COMPILER_GCC35 0x02001000 +#define GLM_COMPILER_GCC40 0x02002000 +#define GLM_COMPILER_GCC41 0x02004000 +#define GLM_COMPILER_GCC42 0x02008000 +#define GLM_COMPILER_GCC43 0x02010000 +#define GLM_COMPILER_GCC44 0x02020000 +#define GLM_COMPILER_GCC45 0x02040000 +#define GLM_COMPILER_GCC46 0x02080000 +#define GLM_COMPILER_GCC50 0x0210000 + +#define GLM_MODEL_32 0x00000010 +#define GLM_MODEL_64 0x00000020 + +#ifndef GLM_COMPILER + +///////////////// +// Visual C++ // + +#ifdef _MSC_VER + +#if defined(_WIN64) +#define GLM_MODEL GLM_MODEL_64 +#else +#define GLM_MODEL GLM_MODEL_32 +#endif// + +#if _MSC_VER == 1200 +#define GLM_COMPILER GLM_COMPILER_VC60 +#endif + +#if _MSC_VER == 1300 +#define GLM_COMPILER GLM_COMPILER_VC70 +#endif + +#if _MSC_VER == 1310 +#define GLM_COMPILER GLM_COMPILER_VC71 +#endif + +#if _MSC_VER == 1400 +#define GLM_COMPILER GLM_COMPILER_VC80 +#endif + +#if _MSC_VER == 1500 +#define GLM_COMPILER GLM_COMPILER_VC90 +#endif + +#if _MSC_VER == 1600 +#define GLM_COMPILER GLM_COMPILER_VC2010 +#endif + +#endif//_MSC_VER + +////////////////// +// GCC defines // + +#ifdef __GNUC__ + +#if(defined(__WORDSIZE) && (__WORDSIZE == 64)) || defined(__arch64__) +#define GLM_MODEL GLM_MODEL_64 +#else +#define GLM_MODEL GLM_MODEL_32 +#endif// + +#if (__GNUC__ == 2) && (__GNUC_MINOR__ == 8) +#error "GCC 2.8x isn't supported" +#define GLM_COMPILER GLM_COMPILER_GCC28 +#endif + +#if (__GNUC__ == 2) && (__GNUC_MINOR__ == 9) +#error "GCC 2.9x isn't supported" +#define GLM_COMPILER GLM_COMPILER_GCC29 +#endif + +#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 0) +#error "GCC 3.0 isn't supported" +#define GLM_COMPILER GLM_COMPILER_GCC30 +#endif + +#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1) +#error "GCC 3.1 isn't supported" +#define GLM_COMPILER GLM_COMPILER_GCC31 +#endif + +#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2) +#define GLM_COMPILER GLM_COMPILER_GCC32 +#endif + +#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 3) +#define GLM_COMPILER GLM_COMPILER_GCC33 +#endif + +#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 4) +#define GLM_COMPILER GLM_COMPILER_GCC34 +#endif + +#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 5) +#define GLM_COMPILER GLM_COMPILER_GCC35 +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 0) +#define GLM_COMPILER GLM_COMPILER_GCC40 +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 1) +#define GLM_COMPILER GLM_COMPILER_GCC41 +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) +#define GLM_COMPILER GLM_COMPILER_GCC42 +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) +#define GLM_COMPILER GLM_COMPILER_GCC43 +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 4) +#define GLM_COMPILER GLM_COMPILER_GCC44 +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 5) +#define GLM_COMPILER GLM_COMPILER_GCC45 +#endif + +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 6) +#define GLM_COMPILER GLM_COMPILER_GCC46 +#endif + +#if (__GNUC__ == 5) && (__GNUC_MINOR__ == 0) +#define GLM_COMPILER GLM_COMPILER_GCC50 +#endif + +#endif//__GNUC__ + +#endif//GLM_COMPILER + +#ifndef GLM_COMPILER +#error "GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message." +#endif//GLM_COMPILER + +#if(!defined(GLM_MODEL) && GLM_COMPILER != 0) +#error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message." +#endif//GLM_MODEL + +#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_SETUP | GLM_MESSAGE_NOTIFICATION))) +# if(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_VC) +# pragma message("GLM message: Compiled with Visual C++") +# elif(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_GCC) +# pragma message("GLM message: Compiled with GCC") +# else +# pragma message("GLM warning: Compiler not detected") +# endif +#endif//GLM_MESSAGE + +#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_SETUP | GLM_MESSAGE_NOTIFICATION))) +# if(GLM_MODEL == GLM_MODEL_64) +# pragma message("GLM message: 64 bits model") +# elif(GLM_MODEL == GLM_MODEL_32) +# pragma message("GLM message: 32 bits model") +# endif//GLM_MODEL +#endif//GLM_MESSAGE + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Compatibility + +#define GLM_COMPATIBILITY_DEFAULT 0 +#define GLM_COMPATIBILITY_STRICT 1 + +//! By default: +//#define GLM_COMPATIBILITY GLM_COMPATIBILITY_DEFAULT + +#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_SETUP | GLM_MESSAGE_NOTIFICATION))) +# if(!defined(GLM_COMPATIBILITY) || (defined(GLM_COMPATIBILITY) && (GLM_COMPATIBILITY == GLM_COMPATIBILITY_STRICT))) +# +# elif(defined(GLM_COMPATIBILITY) && (GLM_COMPATIBILITY == GLM_COMPATIBILITY_STRICT)) +# pragma message("GLM message: compatibility strict") +# endif//GLM_AUTO_CAST +#endif//GLM_MESSAGE + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// External dependencies + +#define GLM_DEPENDENCE_NONE 0x00000000 +#define GLM_DEPENDENCE_GLEW 0x00000001 +#define GLM_DEPENDENCE_GLEE 0x00000002 +#define GLM_DEPENDENCE_GL 0x00000004 +#define GLM_DEPENDENCE_GL3 0x00000008 +#define GLM_DEPENDENCE_BOOST 0x00000010 +#define GLM_DEPENDENCE_STL 0x00000020 +#define GLM_DEPENDENCE_TR1 0x00000040 +#define GLM_DEPENDENCE_TR2 0x00000080 + +//! By default: +// #define GLM_DEPENDENCE GLM_DEPENDENCE_NONE + +#if(defined(GLM_DEPENDENCE) && (GLM_DEPENDENCE & GLM_DEPENDENCE_GLEW)) +#include +#elif(defined(GLM_DEPENDENCE) && (GLM_DEPENDENCE & GLM_DEPENDENCE_GLEE)) +#include +#elif(defined(GLM_DEPENDENCE) && (GLM_DEPENDENCE & GLM_DEPENDENCE_GL)) +#include +#elif(defined(GLM_DEPENDENCE) && (GLM_DEPENDENCE & GLM_DEPENDENCE_GL3)) +#include +#endif//GLM_DEPENDENCE + +#if(defined(GLM_DEPENDENCE) && (GLM_DEPENDENCE & GLM_DEPENDENCE_BOOST)) +#include +#endif//GLM_DEPENDENCE + +#if(defined(GLM_DEPENDENCE) && (GLM_DEPENDENCE & GLM_DEPENDENCE_BOOST)) || defined(BOOST_STATIC_ASSERT) +#define GLM_STATIC_ASSERT(x) BOOST_STATIC_ASSERT(x) +#else +#define GLM_STATIC_ASSERT(x) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1] +#endif//GLM_DEPENDENCE + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Cast + +#define GLM_CAST_NONE 0x00000000 +#define GLM_CAST_DIRECTX_9 0x00000001 +#define GLM_CAST_DIRECTX_10 0x00000002 +#define GLM_CAST_NVSG 0x00000004 +#define GLM_CAST_WILD_MAGIC_3 0x00000008 +#define GLM_CAST_WILD_MAGIC_4 0x00000010 +#define GLM_CAST_PHYSX 0x00000020 +#define GLM_CAST_ODE 0x00000040 + +//! By default: +// #define GLM_CAST GLM_CAST_NONE +// #define GLM_CAST_EXT GLM_CAST_NONE + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Automatic cast +// glColor4fv(glm::vec4(1.0)) + +//! By default: +// #define GLM_AUTO_CAST GLM_ENABLE + +// GLM_AUTO_CAST isn't defined by defaut but also enable by default with GLM 0.7.x +// Disable GLM_AUTO_CAST by default on Visual C++ 7.1 +#if(defined(GLM_COMPILER) && GLM_COMPILER & GLM_COMPILER_VC && GLM_COMPILER <= GLM_COMPILER_VC71) +# if(defined(GLM_AUTO_CAST) || (GLM_AUTO_CAST == GLM_ENABLE)) +# error "GLM_AUTO_CAST isn't supported by Visual C++ 7.1 and below" +# else +# define GLM_AUTO_CAST GLM_DISABLE +# endif//GLM_AUTO_CAST +#endif//GLM_COMPILER + +#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_SETUP | GLM_MESSAGE_NOTIFICATION))) +# if(!defined(GLM_AUTO_CAST) || (defined(GLM_AUTO_CAST) && (GLM_AUTO_CAST == GLM_ENABLE))) +# pragma message("GLM message: Auto cast enabled") +# else +# pragma message("GLM message: Auto cast disabled") +# endif//GLM_AUTO_CAST +#endif//GLM_MESSAGE + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Swizzle operators + +#define GLM_SWIZZLE_NONE 0x00000000 +#define GLM_SWIZZLE_XYZW 0x00000002 +#define GLM_SWIZZLE_RGBA 0x00000004 +#define GLM_SWIZZLE_STQP 0x00000008 +#define GLM_SWIZZLE_FULL (GLM_SWIZZLE_XYZW | GLM_SWIZZLE_RGBA | GLM_SWIZZLE_STQP) + +//! By default: +// #define GLM_SWIZZLE GLM_SWIZZLE_NONE + +#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_SETUP | GLM_MESSAGE_NOTIFICATION))) +# if !defined(GLM_SWIZZLE)|| (defined(GLM_SWIZZLE) && GLM_SWIZZLE == GLM_SWIZZLE_NONE) +# pragma message("GLM message: No swizzling operator used") +# elif(defined(GLM_SWIZZLE) && GLM_SWIZZLE == GLM_SWIZZLE_FULL) +# pragma message("GLM message: Full swizzling operator support enabled") +# elif(defined(GLM_SWIZZLE) && GLM_SWIZZLE & GLM_SWIZZLE_FULL) +# pragma message("GLM message: Partial swizzling operator support enabled") +# endif//GLM_SWIZZLE +#endif//GLM_MESSAGE + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#endif//glm_setup diff --git a/glm/virtrev.hpp b/glm/virtrev.hpp new file mode 100644 index 0000000..ec368e4 --- /dev/null +++ b/glm/virtrev.hpp @@ -0,0 +1,29 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2008 G-Truc Creation (www.g-truc.net) +// Virtrev SDK copyright matrem (matrem84.free.fr) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-05-29 +// Updated : 2008-10-06 +// Licence : This source is under MIT License +// File : glm/virtrev.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Note: +// Virtrev SDK extensions +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_virtrev +#define glm_virtrev + +#define GLM_VIRTREV_GLOBAL 1 + +#if(defined(GLM_DEPENDENCE) && ( \ + (GLM_DEPENDENCE & GLM_DEPENDENCE_GLEW) || \ + (GLM_DEPENDENCE & GLM_DEPENDENCE_GLEE) || \ + (GLM_DEPENDENCE & GLM_DEPENDENCE_GL))) +#include "./virtrev/gl.hpp" +#endif +#include "./virtrev/address.hpp" +#include "./virtrev/equal_operator.hpp" +#include "./virtrev/xstream.hpp" + +#endif//glm_virtrev diff --git a/glm/virtrev/address.hpp b/glm/virtrev/address.hpp new file mode 100644 index 0000000..70c77e8 --- /dev/null +++ b/glm/virtrev/address.hpp @@ -0,0 +1,192 @@ +#ifndef GLM_EXT_VIRTREV_ADDRESS_HPP +#define GLM_EXT_VIRTREV_ADDRESS_HPP + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// Virtrev SDK copyright matrem (matrem84.free.fr) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-10-07 +// Updated : +// Licence : This source is under MIT License +// File : glm/ext/virtrev/address.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "../glm.hpp" + + +namespace glm +{ + namespace virtrev_glmext + { + //! GLM_VIRTREV_address extension: Vector & matrix content address (T const * type pointer). + namespace address + { + /** Get the const address of the vector content. */ + template + T const * address(detail::tvec2 const & vec) + { + return &(vec.x); + } + /** Get the address of the vector content. */ + template + T * address(detail::tvec2 & vec) + { + return &(vec.x); + } + + /** Get the const address of the vector content. */ + template + T const * address(detail::tvec3 const & vec) + { + return &(vec.x); + } + /** Get the address of the vector content. */ + template + T * address(detail::tvec3 & vec) + { + return &(vec.x); + } + + /** Get the const address of the vector content. */ + template + T const * address(detail::tvec4 const & vec) + { + return &(vec.x); + } + /** Get the address of the vector content. */ + template + T * address(detail::tvec4 & vec) + { + return &(vec.x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat2x2 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat2x2 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat3x3 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat3x3 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat4x4 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat4x4 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat2x3 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat2x3 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat3x2 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat3x2 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat2x4 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat2x4 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat4x2 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat4x2 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat3x4 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat3x4 & mat) + { + return &(mat[0].x); + } + + /** Get the const address of the matrix content. */ + template + T const * address(detail::tmat4x3 const & mat) + { + return &(mat[0].x); + } + /** Get the address of the matrix content. */ + template + T * address(detail::tmat4x3 & mat) + { + return &(mat[0].x); + } + } + } +} + +#define GLM_VIRTREV_address namespace virtrev_glmext::address +#ifndef GLM_VIRTREV_GLOBAL +namespace glm {using GLM_VIRTREV_address;} +#endif//GLM_VIRTREV_GLOBAL + +#endif//GLM_EXT_VIRTREV_ADDRESS_HPP + diff --git a/glm/virtrev/equal_operator.hpp b/glm/virtrev/equal_operator.hpp new file mode 100644 index 0000000..c252bc4 --- /dev/null +++ b/glm/virtrev/equal_operator.hpp @@ -0,0 +1,71 @@ +#ifndef GLM_EXT_VIRTREV_EQUAL_OPERATOR_HPP +#define GLM_EXT_VIRTREV_EQUAL_OPERATOR_HPP + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// VirtreV SDK copyright matrem (matrem84.free.fr) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-09-23 +// Updated : +// Licence : This source is under MIT License +// File : glm/ext/virtrev/equal_operator.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "../glm.hpp" + +namespace glm +{ + namespace virtrev_glmext + { + //! GLM_VIRTREV_gl extension: Vector & matrix integration with OpenGL. + namespace equal_operator + { + template + inline bool operator == (glm::detail::tvec2 const & v1, glm::detail::tvec2 const & v2) + { + return v1.x==v2.x && v1.y==v2.y; + } + + template + inline bool operator == (glm::detail::tvec3 const & v1, glm::detail::tvec3 const & v2) + { + return v1.x==v2.x && v1.y==v2.y && v1.z==v2.z; + } + + template + inline bool operator == (glm::detail::tvec4 const & v1, glm::detail::tvec4 const & v2) + { + return v1.x==v2.x && v1.y==v2.y && v1.z==v2.z && v1.w==v2.w; + } + + template + inline bool operator != (glm::detail::tvec2 const & v1, glm::detail::tvec2 const & v2) + { + return v1.x!=v2.x || v1.y!=v2.y; + } + + template + inline bool operator != (glm::detail::tvec3 const & v1, glm::detail::tvec3 const & v2) + { + return v1.x!=v2.x || v1.y!=v2.y || v1.z!=v2.z; + } + + template + inline bool operator != (glm::detail::tvec4 const & v1, glm::detail::tvec4 const & v2) + { + return v1.x!=v2.x || v1.y!=v2.y || v1.z!=v2.z || v1.w!=v2.w; + } + } + } +} + +#define GLM_VIRTREV_equal_operator namespace glm::virtrev_glmext::equal_operator +#ifndef GLM_VIRTREV_GLOBAL +namespace glm {using GLM_VIRTREV_equal_operator;} +#endif//GLM_VIRTREV_GLOBAL + +#endif//GLM_EXT_VIRTREV_EQUAL_OPERATOR_HPP + diff --git a/glm/virtrev/gl.hpp b/glm/virtrev/gl.hpp new file mode 100644 index 0000000..e19cee3 --- /dev/null +++ b/glm/virtrev/gl.hpp @@ -0,0 +1,64 @@ +#ifndef GLM_EXT_VIRTREV_GL_HPP +#define GLM_EXT_VIRTREV_GL_HPP + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// Virtrev SDK copyright matrem (matrem84.free.fr) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-04-24 +// Updated : 2008-10-07 +// Licence : This source is under MIT License +// File : glm/ext/virtrev/gl.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - glew or glee or gl library header +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "../glm.hpp" + +#if !defined(GLM_DEPENDENCE) || !(GLM_DEPENDENCE & (GLM_DEPENDENCE_GLEW|GLM_DEPENDENCE_GLEE|GLM_DEPENDENCE_GL)) +#error GLM_VIRTREV_gl requires OpenGL to build. GLM_DEPENDENCE doesn't define the dependence. +#endif//GLM_DEPENDENCE + +namespace glm +{ + namespace virtrev_glmext + { + //! GLM_VIRTREV_gl extension: Vector & matrix integration with OpenGL. + namespace gl + { + typedef detail::tvec2 gl_vec2; ///< vec2 for GLfloat OpenGL type + typedef detail::tvec3 gl_vec3; ///< vec3 for GLfloat OpenGL type + typedef detail::tvec4 gl_vec4; ///< vec4 for GLfloat OpenGL type + + typedef detail::tvec2 gl_svec2; ///< vec2 for GLshort OpenGL type + typedef detail::tvec3 gl_svec3; ///< vec3 for GLshort OpenGL type + typedef detail::tvec4 gl_svec4; ///< vec4 for GLshort OpenGL type + + typedef detail::tvec2 gl_ivec2; ///< vec2 for GLint OpenGL type + typedef detail::tvec3 gl_ivec3; ///< vec3 for GLint OpenGL type + typedef detail::tvec4 gl_ivec4; ///< vec4 for GLint OpenGL type + + typedef detail::tmat2x2 gl_mat2; ///< mat2x2 for GLfloat OpenGL type + typedef detail::tmat3x3 gl_mat3; ///< mat3x3 for GLfloat OpenGL type + typedef detail::tmat4x4 gl_mat4; ///< mat4x4 for GLfloat OpenGL type + + typedef detail::tmat2x3 gl_mat2x3; ///< mat2x3 for GLfloat OpenGL type + typedef detail::tmat3x2 gl_mat3x2; ///< mat3x2 for GLfloat OpenGL type + typedef detail::tmat2x4 gl_mat2x4; ///< mat2x4 for GLfloat OpenGL type + typedef detail::tmat4x2 gl_mat4x2; ///< mat4x2 for GLfloat OpenGL type + typedef detail::tmat3x4 gl_mat3x4; ///< mat3x4 for GLfloat OpenGL type + typedef detail::tmat4x3 gl_mat4x3; ///< mat4x3 for GLfloat OpenGL type + + } + } +} + +#define GLM_VIRTREV_gl namespace glm::virtrev_glmext::gl +#ifndef GLM_VIRTREV_GLOBAL +namespace glm {using GLM_VIRTREV_gl;} +#endif//GLM_VIRTREV_GLOBAL + +#endif//GLM_EXT_VIRTREV_GL_HPP + diff --git a/glm/virtrev/xstream.hpp b/glm/virtrev/xstream.hpp new file mode 100644 index 0000000..2bfaa68 --- /dev/null +++ b/glm/virtrev/xstream.hpp @@ -0,0 +1,147 @@ +#ifndef GLM_EXT_VIRTREV_XSTREAM_HPP +#define GLM_EXT_VIRTREV_XSTREAM_HPP + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) +// Virtrev SDK copyright matrem (matrem84.free.fr) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2008-05-24 +// Updated : 2008-05-26 +// Licence : This source is under MIT License +// File : glm/ext/virtrev/xstream.h +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +// - GLM_GTX_matrix_selection +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "../glm.hpp" +#include "../gtx/matrix_selection.hpp" +#include + +namespace glm +{ + namespace virtrev_glmext + { + //! GLM_VIRTREV_xstream extension: Streaming vector and matrix in a xml way + namespace xstream + { + template + std::ostream & operator << (std::ostream & stream, glm::detail::tvec2 const & vec) + { + stream << ""; + + return stream; + } + + template + std::ostream & operator << (std::ostream & stream, glm::detail::tvec3 const & vec) + { + stream << ""; + + return stream; + } + + template + std::ostream & operator << (std::ostream & stream, glm::detail::tvec4 const & vec) + { + stream << ""; + + return stream; + } + + template + std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2 const & mat) + { + stream << "" << std::endl; + stream << "" << std::endl; + stream << "" << std::endl; + stream << ""; + + return stream; + } + + template + std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3 const & mat) + { + stream << "" << std::endl; + stream << "" << std::endl; + stream << "" << std::endl; + stream << "" << std::endl; + stream << ""; + + return stream; + } + + template + std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4 const & mat) + { + stream << "" << std::endl; + stream << "" << std::endl; + stream << "" << std::endl; + stream << "" << std::endl; + stream << "" << std::endl; + stream << ""; + + return stream; + } + } + } +} + +#define GLM_VIRTREV_xstream namespace glm::virtrev_glmext::xstream +#ifndef GLM_VIRTREV_GLOBAL +namespace glm {using GLM_VIRTREV_xstream;} +#endif//GLM_VIRTREV_GLOBAL + +#endif diff --git a/md5view.pro b/md5view.pro index 99d63ef..589322c 100644 --- a/md5view.pro +++ b/md5view.pro @@ -6,7 +6,9 @@ TARGET = md5view TEMPLATE = app SOURCES += main.cpp \ mainwindow.cpp \ - viewerwidget.cpp + viewerwidget.cpp \ + md5model.cpp HEADERS += mainwindow.h \ - viewerwidget.h + viewerwidget.h \ + md5model.h FORMS += mainwindow.ui diff --git a/meshes/imp.md5mesh b/meshes/imp.md5mesh new file mode 100644 index 0000000..2d82518 --- /dev/null +++ b/meshes/imp.md5mesh @@ -0,0 +1,3728 @@ +MD5Version 10 +commandline "mesh models/monsters/imp/animation/cycles/imp.mb -dest models/md5/monsters/imp/imp.md5mesh -game Doom -prefix IMP1_ -keep Lknee Rknee Lelbow Relbow camera Body -keep Rmissile Lmissile -parent Rmissile Rhand -parent Lmissile Lhand -parent Rwing Chest -parent Lwing Chest -parent Hips Body -parent Waist Body -parent camera Head -prefix IMP2_ -prefix IMP_ -align ALL" + +numJoints 71 +numMeshes 1 + +joints { + "origin" -1 ( 0 0 0 ) ( -0.5 -0.5 -0.5 ) // + "Body" 0 ( -0.0000002384 0 56.5783920288 ) ( -0.5 -0.5 -0.5 ) // origin + "Hips" 1 ( 3.3494229317 -0.0225959271 62.0168151855 ) ( -0.5 -0.5 -0.5 ) // Body + "Lupleg" 2 ( -0.1500415802 4.8255143166 54.5172233582 ) ( 0.5614669323 -0.3771466613 -0.4900334179 ) // Hips + "Lloleg" 3 ( 3.5001502037 6.8211932182 31.0613594055 ) ( 0.4744751453 -0.4736278951 -0.590847671 ) // Lupleg + "Lankle_r" 4 ( -0.7495136261 9.0730142593 5.5066628456 ) ( -0.5868187547 -0.481595099 0.296489656 ) // Lloleg + "Lball_r" 5 ( 2.1382782459 9.4164094925 -1.6956970692 ) ( 0.0728539601 -0.1073002592 0.3467582464 ) // Lankle_r + "Ltoe1_r" 6 ( 5.8043384552 8.8547563553 -2.1653971672 ) ( -0.9890788794 -0.0974018201 0.0795167163 ) // Lball_r + "Ltip1_r" 7 ( 11.4689292908 10.2455282211 -2.7404873371 ) ( 0.0728536099 -0.1073002964 0.3467582762 ) // Ltoe1_r + "Ltoe2_r" 6 ( 4.7200937271 13.4133682251 -2.7574617863 ) ( -0.9792345166 -0.1698939353 0.0849573314 ) // Lball_r + "Lknee" 4 ( 18.8344936371 6.8211922646 42.936958313 ) ( -0.4999999702 -0.5 -0.5 ) // Lloleg + "Rupleg" 2 ( -0.1500415802 -4.5701680183 54.5172233582 ) ( 0.5689209104 -0.4676292539 -0.421169579 ) // Hips + "Rloleg" 11 ( 4.3707418442 -6.3708400726 31.0744743347 ) ( 0.4559702575 -0.5845044851 -0.5221133232 ) // Rupleg + "Rankle_r" 12 ( -0.524418354 -9.0240345001 5.7276988029 ) ( -0.6380540133 -0.4521044493 0.3826819658 ) // Rloleg + "Rball_r" 13 ( 2.6161766052 -9.5887231827 -1.316108942 ) ( -0.0830028579 -0.1591864675 0.3980002105 ) // Rankle_r + "Rtoe1_r" 14 ( 5.9368748665 -11.5404500961 -2.141885519 ) ( 0.9940758348 0.0303506274 -0.0628471076 ) // Rball_r + "Rtip1_r" 15 ( 12.3385314941 -9.8679914474 -2.1791322231 ) ( -0.0830028877 -0.1591864675 0.3980002403 ) // Rtoe1_r + "Rtoe2_r" 14 ( 6.4745693207 -6.8747558594 -1.3658405542 ) ( 0.9891501069 0.1033919677 -0.0565476157 ) // Rball_r + "Rtip2_r" 17 ( 11.753780365 -6.8669633865 -1.6503264904 ) ( -0.0830032304 -0.1591864973 0.3980002105 ) // Rtoe2_r + "Rknee" 12 ( 19.7050857544 -6.3708386421 42.9500770569 ) ( -0.4999999702 -0.5 -0.5 ) // Rloleg + "Waist" 1 ( 0.2927730083 0 59.4694366455 ) ( -0.5 -0.5 -0.5 ) // Body + "Chest" 20 ( -2.3445606232 0 66.5029754639 ) ( -0.5 -0.5 -0.5 ) // Waist + "Lrib" 21 ( 7.3695240021 5.5330324173 71.9951324463 ) ( -0.5 -0.5 -0.5 ) // Chest + "Rrib" 21 ( 7.3695240021 -5.1057934761 71.8560638428 ) ( -0.5 -0.5 -0.5 ) // Chest + "Shoulders" 21 ( -0.9038720131 0 73.4102478027 ) ( -0.5 -0.5 -0.5 ) // Chest + "Lshldr" 24 ( 4.8692617416 1.357098937 78.6024856567 ) ( -0.5 -0.5 -0.5 ) // Shoulders + "Luparm" 25 ( 1.0166268349 5.5905423164 81.2515563965 ) ( -0.5 -0.5 -0.5 ) // Lshldr + "Lloarm" 26 ( -3.8193283081 21.1066417694 72.8406829834 ) ( -0.5 -0.5 -0.5 ) // Luparm + "Lelbow" 27 ( -14.6793737411 21.1066417694 67.7180480957 ) ( -0.5 -0.5 -0.5 ) // Lloarm + "Lhand" 27 ( 1.9877896309 37.2198066711 71.9780807495 ) ( -0.3105591238 -0.5108622909 -0.6902129054 ) // Lloarm + "Lindex_lo" 29 ( 3.908916235 42.5809516907 72.9746627808 ) ( -0.3105591238 -0.5108622909 -0.6902129054 ) // Lhand + "Lindex_base" 30 ( 5.0472903252 44.2703590393 75.9137496948 ) ( -0.3105591238 -0.5108622909 -0.6902129054 ) // Lindex_lo + "Lindex_mid" 31 ( 5.7127923965 46.560295105 76.6713256836 ) ( -0.3105591238 -0.5108622909 -0.6902129054 ) // Lindex_base + "Lindex_tip" 32 ( 4.9341306686 49.7012405396 76.9152145386 ) ( -0.3105591238 -0.5108622909 -0.6902129054 ) // Lindex_mid + "Lmissile" 29 ( 2.0349760056 45.0360450745 70.9159393311 ) ( -0.4999999702 -0.4999999702 -0.5 ) // Lhand + "Lpinky_base" 29 ( -0.3004188538 41.9372177124 73.1500167847 ) ( -0.1526525021 -0.5874319673 -0.7413083315 ) // Lhand + "Lpinky_mid" 35 ( -1.852424264 45.7090415955 74.587348938 ) ( -0.1526525021 -0.5874319673 -0.7413083315 ) // Lpinky_base + "Lpinky_tip" 36 ( -1.6164255142 48.6077842712 73.5294952393 ) ( -0.1526525021 -0.5874319673 -0.7413083315 ) // Lpinky_mid + "Lring_lo" 29 ( 2.1891980171 42.5758743286 74.5430450439 ) ( -0.1526525021 -0.5874319673 -0.7413083315 ) // Lhand + "Lring_base" 38 ( 1.830731988 45.3891906738 77.0519714355 ) ( -0.1526525021 -0.5874319673 -0.7413083315 ) // Lring_lo + "Lring_mid" 39 ( 1.262499094 48.2335281372 78.4642181396 ) ( -0.1526525021 -0.5874319673 -0.7413083315 ) // Lring_base + "Lring_tip" 40 ( 0.4961673617 51.3678245544 78.1024780273 ) ( -0.1526525021 -0.5874319673 -0.7413083315 ) // Lring_mid + "Lthumb_lo" 29 ( 3.357609272 37.4952087402 71.1309204102 ) ( -0.2624037266 -0.7686331272 -0.4722203016 ) // Lhand + "Lthumb_base" 42 ( 4.7565379143 40.4100418091 69.7664642334 ) ( -0.2624037266 -0.7686331272 -0.4722203016 ) // Lthumb_lo + "Lthumb_mid" 43 ( 4.9935097694 43.29895401 68.390296936 ) ( -0.2624037266 -0.7686331272 -0.4722203016 ) // Lthumb_base + "Lthumb_tip" 44 ( 3.333419323 45.0855636597 67.994178772 ) ( -0.2624037266 -0.7686331272 -0.4722203016 ) // Lthumb_mid + "Neck" 24 ( 1.6579480171 0 80.5833435059 ) ( -0.5 -0.5 -0.5 ) // Shoulders + "Head" 46 ( 4.1499004364 0 83.8904190063 ) ( -0.5 -0.5 -0.5 ) // Neck + "Jaw" 47 ( 6.4089598656 0 84.8219909668 ) ( -0.5 -0.5 -0.5 ) // Head + "camera" 47 ( 12.2084655762 -0.0402986743 85.314956665 ) ( 0.0090039046 -0.1247913837 -0.0010257054 ) // Head + "Rshldr" 24 ( 4.8692622185 -1.3571000099 78.6024932861 ) ( -0.5 -0.5 -0.5 ) // Shoulders + "Ruparm" 50 ( 1.0166249275 -5.5905375481 81.2514953613 ) ( -0.5 -0.5 -0.5 ) // Rshldr + "Rloarm" 51 ( -3.8193254471 -21.1066246033 72.8407440186 ) ( -0.5 -0.5 -0.5 ) // Ruparm + "Relbow" 52 ( -14.6793699265 -21.1066246033 67.7181091309 ) ( -0.5 -0.5 -0.5 ) // Rloarm + "Rhand" 52 ( 1.9877872467 -37.2197494507 71.9781188965 ) ( -0.6679188013 -0.2811743915 -0.460739851 ) // Rloarm + "Rindex_lo" 54 ( 5.608399868 -41.4205284119 73.5562438965 ) ( -0.6715649962 -0.3042283654 -0.4568676353 ) // Rhand + "Rindex_base" 55 ( 7.5318174362 -43.3202056885 74.7202148438 ) ( -0.6715649962 -0.3042283654 -0.4568676353 ) // Rindex_lo + "Rindex_mid" 56 ( 9.0574998856 -45.2582817078 75.9236450195 ) ( -0.7008211613 -0.2686780095 -0.4510940909 ) // Rindex_base + "Rindex_tip" 57 ( 9.0185976028 -47.9933700562 75.2492294312 ) ( -0.7008211613 -0.2686780095 -0.4510940909 ) // Rindex_mid + "Rmissile" 54 ( 3.612036705 -43.5896911621 69.6388015747 ) ( -0.6817477942 -0.0655400082 -0.1850441098 ) // Rhand + "Rpinky_base" 54 ( 1.2438013554 -42.7748680115 72.7645950317 ) ( -0.4426555634 -0.3011793494 -0.7501675487 ) // Rhand + "Rpinky_mid" 60 ( 1.4834923744 -45.5311279297 73.8436965942 ) ( -0.4426555634 -0.3011793494 -0.7501675487 ) // Rpinky_base + "Rpinky_tip" 61 ( 3.2868413925 -49.1914558411 73.0318069458 ) ( -0.4426555634 -0.3011793494 -0.7501675487 ) // Rpinky_mid + "Rring_lo" 54 ( 3.7522134781 -42.0048370361 74.3459777832 ) ( -0.5458689928 -0.3377533853 -0.6405339241 ) // Rhand + "Rring_base" 63 ( 4.4562039375 -45.54479599 76.5597915649 ) ( -0.5458689928 -0.3377533853 -0.6405339241 ) // Rring_lo + "Rring_mid" 64 ( 4.8783464432 -48.4118385315 77.7644424438 ) ( -0.5458689928 -0.3377533853 -0.6405339241 ) // Rring_base + "Rring_tip" 65 ( 5.1997308731 -51.8249702454 76.8283843994 ) ( -0.5458689928 -0.3377533853 -0.6405339241 ) // Rring_mid + "Rthumb_lo" 54 ( 4.0275745392 -36.9916038513 71.0148696899 ) ( -0.5852108002 -0.1316827238 -0.7178010345 ) // Rhand + "Rthumb_base" 67 ( 6.2269821167 -39.4013442993 69.4674758911 ) ( -0.5142287612 -0.096853286 -0.8463736176 ) // Rthumb_lo + "Rthumb_mid" 68 ( 8.3318214417 -40.2367553711 67.5116119385 ) ( -0.5142287612 -0.096853286 -0.8463736176 ) // Rthumb_base + "Rthumb_tip" 69 ( 8.5969076157 -42.6055335999 65.892364502 ) ( -0.5142287612 -0.096853286 -0.8463736176 ) // Rthumb_mid +} + +mesh { + // meshes: polySurface1 + shader "models/monsters/imp/imp" + + numverts 891 + vert 0 ( 0.8658549786 0.3910109997 ) 1377 2 + vert 1 ( 0.9047420025 0.3801220059 ) 764 2 + vert 2 ( 0.892663002 0.4162740111 ) 762 2 + vert 3 ( 0.8819209933 0.4923700094 ) 1230 1 + vert 4 ( 0.8432620168 0.4713640213 ) 1211 1 + vert 5 ( 0.9089090228 0.3466039896 ) 1379 2 + vert 6 ( 0.9402530193 0.356589973 ) 622 2 + vert 7 ( 0.936702013 0.3991870284 ) 642 2 + vert 8 ( 0.9622219801 0.4039859772 ) 644 2 + vert 9 ( 0.9113950133 0.4784160256 ) 646 1 + vert 10 ( 0.4455760121 0.3779770136 ) 211 2 + vert 11 ( 0.4935880005 0.3773649931 ) 395 2 + vert 12 ( 0.4725199938 0.407877028 ) 202 2 + vert 13 ( 0.46083799 0.3574039936 ) 414 2 + vert 14 ( 0.4226379991 0.3312609792 ) 416 3 + vert 15 ( 0.5098860264 0.395851016 ) 397 1 + vert 16 ( 0.4714680016 0.4320170283 ) 204 2 + vert 17 ( 0.4320049882 0.2953100204 ) 419 3 + vert 18 ( 0.4699369967 0.3354099989 ) 422 2 + vert 19 ( 0.502448976 0.3553580046 ) 398 2 + vert 20 ( 0.5594859719 0.3856170177 ) 400 2 + vert 21 ( 0.5534120202 0.3623949885 ) 402 3 + vert 22 ( 0.4762170017 0.272973001 ) 424 3 + vert 23 ( 0.5603200197 0.2951329947 ) 405 4 + vert 24 ( 0.5784839988 0.2735880017 ) 624 4 + vert 25 ( 0.5618100166 0.2347249985 ) 628 2 + vert 26 ( 0.484780997 0.1441540122 ) 644 2 + vert 27 ( 0.5036510229 0.1811059713 ) 650 3 + vert 28 ( 0.4721060097 0.2094669938 ) 647 3 + vert 29 ( 0.4011240005 0.1726250052 ) 653 1 + vert 30 ( 0.4260840118 0.1079699993 ) 646 1 + vert 31 ( 0.4066579938 0.1979320049 ) 654 2 + vert 32 ( 0.4309540093 0.3848189712 ) 213 2 + vert 33 ( 0.3752120137 0.406431973 ) 974 4 + vert 34 ( 0.4444699883 0.4874569774 ) 206 3 + vert 35 ( 0.4021719992 0.3311830163 ) 1082 4 + vert 36 ( 0.4467209876 0.2578369975 ) 656 4 + vert 37 ( 0.3922060132 0.2356569767 ) 1212 3 + vert 38 ( 0.378320992 0.2664020061 ) 1215 4 + vert 39 ( 0.4111439884 0.3003469706 ) 427 4 + vert 40 ( 0.5890610218 0.3038640022 ) 368 1 + vert 41 ( 0.5908010006 0.3545749784 ) 364 4 + vert 42 ( 0.5940819979 0.3766099811 ) 369 4 + vert 43 ( 0.486315012 0.4641780257 ) 209 2 + vert 44 ( 0.5296769738 0.4387519956 ) 409 1 + vert 45 ( 0.5646640062 0.4159449935 ) 410 2 + vert 46 ( 0.5531259775 0.4516389966 ) 412 2 + vert 47 ( 0.5929830074 0.4274849892 ) 373 3 + vert 48 ( 0.5581700206 0.5044209957 ) 140 2 + vert 49 ( 0.3342550099 0.3271899819 ) 1086 2 + vert 50 ( 0.3446899951 0.3903080225 ) 982 5 + vert 51 ( 0.2906930149 0.4331480265 ) 978 4 + vert 52 ( 0.2780939937 0.36629498 ) 1088 4 + vert 53 ( 0.350165993 0.4602569938 ) 987 3 + vert 54 ( 0.2415779978 0.469456017 ) 964 2 + vert 55 ( 0.6278759837 0.4150900245 ) 1212 3 + vert 56 ( 0.6617609859 0.3855559826 ) 1215 4 + vert 57 ( 0.7017890215 0.4796990156 ) 1095 2 + vert 58 ( 0.6637650132 0.4906160235 ) 1097 1 + vert 59 ( 0.6110360026 0.4584259987 ) 660 2 + vert 60 ( 0.9401680231 0.4473029971 ) 653 1 + vert 61 ( 0.9440479875 0.4652580023 ) 654 2 + vert 62 ( 0.9164919853 0.587051034 ) 431 2 + vert 63 ( 0.8897489905 0.5668550134 ) 1231 1 + vert 64 ( 0.9509649873 0.589779973 ) 1098 2 + vert 65 ( 0.9744719863 0.4522749782 ) 660 2 + vert 66 ( 0.9928060174 0.472630024 ) 1097 1 + vert 67 ( 0.8674150109 0.6261509657 ) 1236 2 + vert 68 ( 0.7217270136 0.4029960036 ) 1092 3 + vert 69 ( 0.7304599881 0.4685429931 ) 1100 2 + vert 70 ( 0.3617520034 0.2754740119 ) 1092 3 + vert 71 ( 0.7648109794 0.4058899879 ) 1219 2 + vert 72 ( 0.3319259882 0.2511690259 ) 1219 2 + vert 73 ( 0.992644012 0.6031559706 ) 1102 2 + vert 74 ( 0.8997570276 0.6710929871 ) 1110 2 + vert 75 ( 0.6808909774 0.5813779831 ) 1102 2 + vert 76 ( 0.8233590126 0.5001620054 ) 1232 1 + vert 77 ( 0.8196020126 0.4549049735 ) 1221 1 + vert 78 ( 0.8037059903 0.3945549726 ) 1222 2 + vert 79 ( 0.8531119823 0.3535869718 ) 1381 2 + vert 80 ( 0.5623360276 0.1429389715 ) 622 2 + vert 81 ( 0.6112840176 0.1612300277 ) 736 2 + vert 82 ( 0.5552790165 0.192900002 ) 630 3 + vert 83 ( 0.614297986 0.2496349812 ) 585 3 + vert 84 ( 0.5711550117 0.0786780119 ) 1379 2 + vert 85 ( 0.6336380243 0.106226027 ) 1341 1 + vert 86 ( 0.6061859727 0.130810976 ) 738 1 + vert 87 ( 0.1456640065 0.0616189837 ) 1342 1 + vert 88 ( 0.1655959934 0.004290998 ) 1379 2 + vert 89 ( 0.2381079942 0.059795022 ) 1381 2 + vert 90 ( 0.0592989996 0.0097569823 ) 1341 1 + vert 91 ( 0.6810920238 0.1442700028 ) 740 1 + vert 92 ( 0.6632720232 0.171431005 ) 739 1 + vert 93 ( 0.1714700013 0.0926010013 ) 1343 3 + vert 94 ( 0.0638689995 0.0808969736 ) 1346 1 + vert 95 ( 0.1359560043 0.1618999839 ) 1351 1 + vert 96 ( 0.1298909932 0.1286990047 ) 1350 1 + vert 97 ( 0.1932709962 0.1180869937 ) 1347 3 + vert 98 ( 0.0523019992 0.1063830256 ) 1353 4 + vert 99 ( 0.0725580007 0.1149970293 ) 1352 1 + vert 100 ( 0.0086899996 0.0989540219 ) 1261 4 + vert 101 ( 0.6630539894 0.2133560181 ) 741 1 + vert 102 ( 0.6120910048 0.1978889704 ) 633 2 + vert 103 ( 0.6431419849 0.2242379785 ) 635 3 + vert 104 ( 0.6822400093 0.2476969957 ) 592 2 + vert 105 ( 0.6627140045 0.2565180063 ) 588 4 + vert 106 ( 0.6318609715 0.2558209896 ) 594 3 + vert 107 ( 0.5955960155 0.261187017 ) 638 3 + vert 108 ( 0.5960209966 0.2845410109 ) 597 3 + vert 109 ( 0.0387790017 0.1839280128 ) 1357 5 + vert 110 ( 0.0081359996 0.1850200295 ) 1269 5 + vert 111 ( 0.0297909994 0.145811975 ) 1265 4 + vert 112 ( 0.0441460013 0.2091749907 ) 1274 5 + vert 113 ( 0.0748410001 0.1921110153 ) 1279 5 + vert 114 ( 0.0733010024 0.1601880193 ) 1362 5 + vert 115 ( 0.0693050027 0.137567997 ) 1367 1 + vert 116 ( 0.0396150015 0.1270449758 ) 1368 3 + vert 117 ( 0.1337530017 0.1994839907 ) 1371 6 + vert 118 ( 0.2137950063 0.1536509991 ) 1383 3 + vert 119 ( 0.209691003 0.20184201 ) 1190 3 + vert 120 ( 0.225722 0.1374539733 ) 1386 3 + vert 121 ( 0.2373339981 0.160359025 ) 1389 3 + vert 122 ( 0.1154550016 0.2254359722 ) 1284 5 + vert 123 ( 0.1344970018 0.2540029883 ) 1161 5 + vert 124 ( 0.189914003 0.2325739861 ) 1193 5 + vert 125 ( 0.2663919926 0.134995997 ) 1392 3 + vert 126 ( 0.8136450052 0.3329290152 ) 1392 3 + vert 127 ( 0.3206700087 0.2083330154 ) 1222 2 + vert 128 ( 0.3068070114 0.2415360212 ) 1224 3 + vert 129 ( 0.1939010024 0.2994419932 ) 1198 4 + vert 130 ( 0.2351350039 0.2487829924 ) 1227 3 + vert 131 ( 0.2311999947 0.292764008 ) 1202 4 + vert 132 ( 0.218197003 0.3390269876 ) 1066 4 + vert 133 ( 0.7738569975 0.4659230113 ) 1233 2 + vert 134 ( 0.2145709991 0.4182940125 ) 966 3 + vert 135 ( 0.1918659955 0.3579739928 ) 1070 3 + vert 136 ( 0.1817969978 0.4129549861 ) 1073 3 + vert 137 ( 0.2277680039 0.4995999932 ) 969 2 + vert 138 ( 0.3483670056 0.5014640093 ) 971 3 + vert 139 ( 0.3023670018 0.5384190083 ) 918 3 + vert 140 ( 0.415775001 0.5519819856 ) 151 2 + vert 141 ( 0.3364549875 0.5936729908 ) 916 2 + vert 142 ( 0.4975549877 0.5117490292 ) 153 3 + vert 143 ( 0.526736021 0.593520999 ) 142 1 + vert 144 ( 0.1624359936 0.2635220289 ) 1206 5 + vert 145 ( 0.1370539963 0.2855669856 ) 1166 3 + vert 146 ( 0.1553609967 0.3155130148 ) 1076 3 + vert 147 ( 0.1354340017 0.3553630114 ) 1042 3 + vert 148 ( 0.1748200059 0.3456419706 ) 1079 3 + vert 149 ( 0.152936995 0.4044020176 ) 1048 3 + vert 150 ( 0.1349190027 0.389113009 ) 1045 3 + vert 151 ( 0.1743330061 0.468438983 ) 951 2 + vert 152 ( 0.2426660061 0.6310210228 ) 921 4 + vert 153 ( 0.1981779933 0.561604023 ) 898 2 + vert 154 ( 0.1950149983 0.5101790428 ) 953 2 + vert 155 ( 0.2358549982 0.5534809828 ) 925 3 + vert 156 ( 0.2165379971 0.6001880169 ) 900 2 + vert 157 ( 0.2024459988 0.6367000341 ) 902 4 + vert 158 ( 0.8699700236 0.062681973 ) 775 1 + vert 159 ( 0.7933419943 0.0067750216 ) 766 1 + vert 160 ( 0.8175349832 0.0708159804 ) 774 1 + vert 161 ( 0.8546739817 0.008400023 ) 767 1 + vert 162 ( 0.7171040177 0.0504220128 ) 768 1 + vert 163 ( 0.7510849833 0.099018991 ) 776 1 + vert 164 ( 0.6812340021 0.1054490209 ) 697 1 + vert 165 ( 0.7195789814 0.1319010258 ) 742 1 + vert 166 ( 0.6884329915 0.1544950008 ) 698 1 + vert 167 ( 0.8483690023 0.2963799834 ) 741 1 + vert 168 ( 0.8496410251 0.259962976 ) 739 1 + vert 169 ( 0.7789930105 0.3217620254 ) 641 1 + vert 170 ( 0.7764490247 0.3626620173 ) 592 2 + vert 171 ( 0.8296459913 0.1979560256 ) 746 2 + vert 172 ( 0.7968490124 0.1361960173 ) 745 1 + vert 173 ( 0.7839310169 0.1836779714 ) 743 2 + vert 174 ( 0.7251989841 0.3290519714 ) 600 1 + vert 175 ( 0.7437710166 0.2796570063 ) 748 1 + vert 176 ( 0.711763978 0.2806159854 ) 699 1 + vert 177 ( 0.718125999 0.1712639928 ) 749 1 + vert 178 ( 0.7508630157 0.2160159945 ) 751 1 + vert 179 ( 0.719013989 0.2146760225 ) 750 1 + vert 180 ( 0.7891539931 0.2574819922 ) 752 1 + vert 181 ( 0.3591209948 0.7251099944 ) 106 1 + vert 182 ( 0.3927290142 0.6674389839 ) 105 1 + vert 183 ( 0.3162479997 0.7084549665 ) 92 2 + vert 184 ( 0.3360419869 0.7445850372 ) 94 2 + vert 185 ( 0.4709730148 0.7174290419 ) 109 1 + vert 186 ( 0.5518569946 0.6541960239 ) 126 3 + vert 187 ( 0.5285440087 0.7387089729 ) 114 1 + vert 188 ( 0.5532469749 0.7149789929 ) 129 1 + vert 189 ( 0.3170320094 0.7504550219 ) 96 2 + vert 190 ( 0.3135139942 0.7971960306 ) 100 2 + vert 191 ( 0.258810997 0.7782310247 ) 81 1 + vert 192 ( 0.2556129992 0.7467960119 ) 79 1 + vert 193 ( 0.2687860131 0.684746027 ) 80 1 + vert 194 ( 0.5329959989 0.7829660177 ) 134 1 + vert 195 ( 0.4004510045 0.7816889882 ) 107 1 + vert 196 ( 0.5319129825 0.8484209776 ) 889 1 + vert 197 ( 0.3534800112 0.8119220138 ) 877 2 + vert 198 ( 0.3721509874 0.8658800125 ) 876 1 + vert 199 ( 0.3290500045 0.8738279939 ) 867 2 + vert 200 ( 0.1511140019 0.7662889957 ) 67 1 + vert 201 ( 0.1949339956 0.7039160132 ) 72 1 + vert 202 ( 0.128057003 0.7114620209 ) 844 1 + vert 203 ( 0.1920520067 0.7645189762 ) 73 1 + vert 204 ( 0.2178730071 0.6518000364 ) 851 1 + vert 205 ( 0.2710539997 0.8663890362 ) 861 1 + vert 206 ( 0.3133589923 0.9429730177 ) 858 1 + vert 207 ( 0.2530179918 0.9317960143 ) 860 1 + vert 208 ( 0.2457190007 0.98517102 ) 851 1 + vert 209 ( 0.5787479877 0.5270869732 ) 51 2 + vert 210 ( 0.5919589996 0.4690170288 ) 40 2 + vert 211 ( 0.554445982 0.5257560015 ) 49 2 + vert 212 ( 0.6098080277 0.5212370157 ) 44 2 + vert 213 ( 0.6399019957 0.5217280388 ) 30 3 + vert 214 ( 0.6255040169 0.4680550098 ) 42 2 + vert 215 ( 0.6059569716 0.4835230112 ) 46 1 + vert 216 ( 0.8890010118 0.3160259724 ) 46 1 + vert 217 ( 0.9252679944 0.3106799722 ) 33 3 + vert 218 ( 0.8620030284 0.2712230086 ) 49 2 + vert 219 ( 0.8997160196 0.339312017 ) 42 2 + vert 220 ( 0.6338729858 0.6179389954 ) 820 2 + vert 221 ( 0.5853270292 0.6541830301 ) 796 5 + vert 222 ( 0.6633300185 0.6478710175 ) 791 5 + vert 223 ( 0.6105780005 0.6199960113 ) 832 2 + vert 224 ( 0.6069740057 0.6015210152 ) 834 4 + vert 225 ( 0.8651260138 0.3174859881 ) 40 2 + vert 226 ( 0.0562979989 0.9080989957 ) 824 2 + vert 227 ( 0.0805179998 0.8763459921 ) 822 2 + vert 228 ( 0.039241001 0.881411016 ) 832 2 + vert 229 ( 0.0206809994 0.8567830324 ) 834 4 + vert 230 ( 0.0703490004 0.8341609836 ) 838 2 + vert 231 ( 0.0693550035 0.7821719646 ) 59 2 + vert 232 ( 0.0415229984 0.7456760406 ) 826 2 + vert 233 ( 0.6154680252 0.5810270309 ) 63 3 + vert 234 ( 0.6318259835 0.5838260055 ) 36 2 + vert 235 ( 0.641735971 0.6090250015 ) 801 2 + vert 236 ( 0.0369510017 0.7082769871 ) 61 2 + vert 237 ( 0.0161380004 0.674703002 ) 801 2 + vert 238 ( 0.0481689982 0.6478599906 ) 828 2 + vert 239 ( 0.0270489994 0.7911729813 ) 47 2 + vert 240 ( 0.0620450005 0.942456007 ) 830 2 + vert 241 ( 0.6179710031 0.5927380323 ) 47 2 + vert 242 ( 0.9776629806 0.2034860253 ) 791 5 + vert 243 ( 0.9466549754 0.1849660277 ) 796 5 + vert 244 ( 0.9366390109 0.2703830004 ) 38 2 + vert 245 ( 0.6658239961 0.5564789772 ) 38 2 + vert 246 ( 0.6554399729 0.5084289908 ) 33 3 + vert 247 ( 0.5747799873 0.7488210201 ) 135 1 + vert 248 ( 0.6027539968 0.7422770262 ) 160 2 + vert 249 ( 0.6170430183 0.7931050062 ) 928 2 + vert 250 ( 0.5646809936 0.9009640217 ) 892 2 + vert 251 ( 0.6111860275 0.8431279659 ) 930 2 + vert 252 ( 0.6461409926 0.7729799747 ) 151 2 + vert 253 ( 0.6089860201 0.7124739885 ) 156 2 + vert 254 ( 0.6387400031 0.9051539898 ) 921 4 + vert 255 ( 0.216564998 0.7628619671 ) 74 1 + vert 256 ( 0.5731310248 0.9904959798 ) 126 3 + vert 257 ( 0.5315089822 0.9500119686 ) 886 1 + vert 258 ( 0.4229629934 0.9944400191 ) 105 1 + vert 259 ( 0.6274639964 0.6811360121 ) 158 2 + vert 260 ( 0.4683719873 0.5763419867 ) 158 2 + vert 261 ( 0.4571210146 0.5950269699 ) 130 3 + vert 262 ( 0.5894079804 0.6624879837 ) 130 3 + vert 263 ( 0.4750989974 0.923658967 ) 880 1 + vert 264 ( 0.3598459959 0.9482370019 ) 869 2 + vert 265 ( 0.4910649955 0.6453230381 ) 118 3 + vert 266 ( 0.4177440107 0.5978900194 ) 126 3 + vert 267 ( 0.220660001 0.8181809783 ) 852 1 + vert 268 ( 0.4234629869 0.6556029916 ) 111 3 + vert 269 ( 0.352609992 0.6611759663 ) 883 1 + vert 270 ( 0.3488979936 0.6011179686 ) 886 1 + vert 271 ( 0.5621669888 0.939233005 ) 883 1 + vert 272 ( 0.5293869972 0.9176909924 ) 887 2 + vert 273 ( 0.5633839965 0.7838380337 ) 136 2 + vert 274 ( 0.1028470024 0.7701100111 ) 846 1 + vert 275 ( 0.1076949984 0.8272809982 ) 847 1 + vert 276 ( 0.1552740037 0.8225290179 ) 853 1 + vert 277 ( 0.3299930096 0.6695460081 ) 98 2 + vert 278 ( 0.3602269888 0.9965459704 ) 98 2 + vert 279 ( 0.0040460001 0.7464909554 ) 36 2 + vert 280 ( 0.0390960015 0.9554070234 ) 820 2 + vert 281 ( 0.0653230026 0.9697819948 ) 828 2 + vert 282 ( 0.0236259997 0.6419839859 ) 820 2 + vert 283 ( 0.1939560026 0.800639987 ) 75 1 + vert 284 ( 0.6380659938 0.8520100117 ) 916 2 + vert 285 ( 0.6465619802 0.9309120178 ) 902 4 + vert 286 ( 0.5762540102 0.7065330148 ) 133 1 + vert 287 ( 0.3161180019 0.974815011 ) 859 1 + vert 288 ( 0.2858850062 0.6478140354 ) 859 1 + vert 289 ( 0.3197619915 0.9033539891 ) 871 1 + vert 290 ( 0.1184799969 0.6740809679 ) 845 1 + vert 291 ( 0.1428450048 0.9657809734 ) 845 1 + vert 292 ( 0.8408759832 0.6830760241 ) 1238 2 + vert 293 ( 0.8901820183 0.7600290179 ) 1117 1 + vert 294 ( 0.8206200004 0.6564400196 ) 1242 2 + vert 295 ( 0.8459489942 0.7727829814 ) 1244 1 + vert 296 ( 0.7961320281 0.6472159624 ) 1240 2 + vert 297 ( 0.8983619809 0.8628740311 ) 434 1 + vert 298 ( 0.8143669963 0.5759320259 ) 1235 1 + vert 299 ( 0.7627589703 0.6211520433 ) 1112 2 + vert 300 ( 0.779073 0.5567619801 ) 1104 2 + vert 301 ( 0.8393570185 0.8992350101 ) 436 1 + vert 302 ( 0.7980229855 0.788064003 ) 1245 1 + vert 303 ( 0.8703290224 0.9544910192 ) 662 2 + vert 304 ( 0.835457027 0.9562709928 ) 437 2 + vert 305 ( 0.8181689978 0.937714994 ) 1121 1 + vert 306 ( 0.9660210013 0.7194709778 ) 1114 1 + vert 307 ( 0.9539650083 0.8656380177 ) 435 1 + vert 308 ( 0.7467960119 0.541285038 ) 1106 2 + vert 309 ( 0.7331050038 0.621508956 ) 1115 2 + vert 310 ( 0.7109590173 0.5591279864 ) 1108 2 + vert 311 ( 0.9777879715 0.959363997 ) 439 2 + vert 312 ( 0.9401940107 0.968922019 ) 441 2 + vert 313 ( 0.9942640066 0.7332969904 ) 433 1 + vert 314 ( 0.6586520076 0.729196012 ) 433 1 + vert 315 ( 0.7038180232 0.7743589878 ) 990 1 + vert 316 ( 0.6476070285 0.7901499867 ) 1118 1 + vert 317 ( 0.9832199812 0.7942509651 ) 1118 1 + vert 318 ( 0.6696500182 0.8830670118 ) 435 1 + vert 319 ( 0.7198809981 0.993309021 ) 443 2 + vert 320 ( 0.6647819877 0.9921709895 ) 439 2 + vert 321 ( 0.739601016 0.7770649791 ) 1119 1 + vert 322 ( 0.7652369738 0.8088859916 ) 1120 1 + vert 323 ( 0.7581189871 0.9959750175 ) 1123 2 + vert 324 ( 0.9850739837 0.1069149971 ) 1395 1 + vert 325 ( 0.9403719902 0.1295740008 ) 1399 1 + vert 326 ( 0.9505029917 0.1768910289 ) 753 1 + vert 327 ( 0.9950500131 0.1763929725 ) 1289 1 + vert 328 ( 0.9075570107 0.0354380012 ) 769 1 + vert 329 ( 0.9097959995 0.1049000025 ) 777 1 + vert 330 ( 0.9432600141 0.1070929766 ) 1400 1 + vert 331 ( 0.9840530157 0.0859479904 ) 1396 1 + vert 332 ( 0.9125699997 0.1805279851 ) 740 1 + vert 333 ( 0.6656240225 0.0728669763 ) 753 1 + vert 334 ( 0.8040570021 0.9843299985 ) 445 2 + vert 335 ( 0.7865899801 0.9478669763 ) 1122 1 + vert 336 ( 0.9080340266 0.9559050202 ) 449 2 + vert 337 ( 0.8686590195 0.9862880111 ) 447 2 + vert 338 ( 0.3373509943 0.1445180178 ) 670 2 + vert 339 ( 0.3347780108 0.0907649994 ) 453 2 + vert 340 ( 0.327560991 0.1075019836 ) 451 2 + vert 341 ( 0.3435400128 0.1323050261 ) 664 2 + vert 342 ( 0.3465929925 0.0791910291 ) 458 2 + vert 343 ( 0.3712880015 0.1355190277 ) 672 2 + vert 344 ( 0.3593690097 0.0873770118 ) 455 3 + vert 345 ( 0.3597230017 0.1277499795 ) 666 2 + vert 346 ( 0.4457809925 0.0659499764 ) 672 2 + vert 347 ( 0.4533370137 0.0418220162 ) 670 2 + vert 348 ( 0.4853880107 0.0488749743 ) 451 2 + vert 349 ( 0.4816879928 0.0832319856 ) 455 3 + vert 350 ( 0.4245269895 0.0573260188 ) 676 2 + vert 351 ( 0.4303619862 0.0334470272 ) 674 2 + vert 352 ( 0.3526870012 0.1682530046 ) 678 2 + vert 353 ( 0.348623991 0.1910809875 ) 674 2 + vert 354 ( 0.3685989976 0.1636440158 ) 680 2 + vert 355 ( 0.382562995 0.1823400259 ) 676 2 + vert 356 ( 0.3985010087 0.0333930254 ) 682 2 + vert 357 ( 0.3596839905 0.1896600127 ) 684 2 + vert 358 ( 0.3702119887 0.2058439851 ) 682 2 + vert 359 ( 0.3717960119 0.18700701 ) 686 2 + vert 360 ( 0.3089720011 0.1347830296 ) 464 2 + vert 361 ( 0.303245008 0.0918400288 ) 462 2 + vert 362 ( 0.2927460074 0.0936490297 ) 460 2 + vert 363 ( 0.3002550006 0.1380410194 ) 466 2 + vert 364 ( 0.3222639859 0.1323840022 ) 470 2 + vert 365 ( 0.3310190141 0.1299099922 ) 468 2 + vert 366 ( 0.3172639906 0.0896959901 ) 472 2 + vert 367 ( 0.4602299929 0.0382009745 ) 468 2 + vert 368 ( 0.4652990103 0.0162109733 ) 466 2 + vert 369 ( 0.4916099906 0.0249140263 ) 460 2 + vert 370 ( 0.4315260053 0.0279629827 ) 476 2 + vert 371 ( 0.4363319874 0.006716013 ) 474 2 + vert 372 ( 0.3073540032 0.1744940281 ) 474 2 + vert 373 ( 0.3161199987 0.1741930246 ) 478 2 + vert 374 ( 0.3299629986 0.1716979742 ) 668 2 + vert 375 ( 0.337199986 0.1560660005 ) 476 2 + vert 376 ( 0.4057050049 0.0110350251 ) 504 2 + vert 377 ( 0.3230539858 0.1907969713 ) 506 2 + vert 378 ( 0.3302969933 0.1877800226 ) 508 2 + vert 379 ( 0.3317849934 0.2105469704 ) 504 2 + vert 380 ( 0.3863030076 0.1229060292 ) 514 2 + vert 381 ( 0.383284986 0.1455370188 ) 512 2 + vert 382 ( 0.3926460147 0.130226016 ) 510 2 + vert 383 ( 0.3804560006 0.1284040213 ) 688 3 + vert 384 ( 0.3766250014 0.1047739983 ) 691 2 + vert 385 ( 0.3859379888 0.1626679897 ) 516 2 + vert 386 ( 0.3886300027 0.0971239805 ) 518 1 + vert 387 ( 0.407709986 0.1334480047 ) 519 2 + vert 388 ( 0.4417879879 0.0739430189 ) 521 3 + vert 389 ( 0.4393959939 0.0885879993 ) 519 2 + vert 390 ( 0.427233994 0.0775799751 ) 516 2 + vert 391 ( 0.3728730083 0.1242009997 ) 521 3 + vert 392 ( 0.3601149917 0.0712159872 ) 480 2 + vert 393 ( 0.3679949939 0.1086779833 ) 524 2 + vert 394 ( 0.4090180099 0.1032549739 ) 528 2 + vert 395 ( 0.4169389904 0.1050739884 ) 526 2 + vert 396 ( 0.3994820118 0.0794129968 ) 530 2 + vert 397 ( 0.3812460005 0.0424799919 ) 482 2 + vert 398 ( 0.3389190137 0.0120249987 ) 445 2 + vert 399 ( 0.3200539947 0.025052011 ) 447 2 + vert 400 ( 0.3000009954 0.0298609734 ) 441 2 + vert 401 ( 0.2879619896 0.0760909915 ) 484 3 + vert 402 ( 0.2902429998 0.0590929985 ) 487 3 + vert 403 ( 0.2706010044 0.0740609765 ) 218 2 + vert 404 ( 0.273950994 0.087511003 ) 215 3 + vert 405 ( 0.2582120001 0.0876759887 ) 220 3 + vert 406 ( 0.256716013 0.072142005 ) 223 2 + vert 407 ( 0.2830049992 0.0309460163 ) 439 2 + vert 408 ( 0.351229012 -0.0008690357 ) 1123 2 + vert 409 ( 0.3690010011 0.0031449795 ) 1125 3 + vert 410 ( 0.2570660114 0.0305629969 ) 443 2 + vert 411 ( 0.5449799895 0.1229529977 ) 1123 2 + vert 412 ( 0.5312179923 0.1350970268 ) 1125 3 + vert 413 ( 0.5371990204 0.0950000286 ) 490 2 + vert 414 ( 0.5640779734 0.0809000134 ) 443 2 + vert 415 ( 0.5405970216 0.0565090179 ) 229 3 + vert 416 ( 0.5238739848 0.028726995 ) 227 2 + vert 417 ( 0.5366640091 0.0342630148 ) 225 2 + vert 418 ( 0.5216439962 0.0386400223 ) 492 4 + vert 419 ( 0.5549640059 0.0246229768 ) 220 3 + vert 420 ( 0.5408449769 0.0149279833 ) 232 2 + vert 421 ( 0.2775950134 0.1015840173 ) 234 2 + vert 422 ( 0.2625280023 0.1049659848 ) 232 2 + vert 423 ( 0.291613996 0.1033419967 ) 227 2 + vert 424 ( 0.2894070148 0.0893080235 ) 492 4 + vert 425 ( 0.5155829787 0.0192989707 ) 238 2 + vert 426 ( 0.5262960196 0.0097550154 ) 236 2 + vert 427 ( 0.526786983 0.0039979815 ) 240 2 + vert 428 ( 0.2690129876 0.1203039885 ) 240 2 + vert 429 ( 0.282882005 0.1167050004 ) 242 2 + vert 430 ( 0.2931900024 0.1148449779 ) 238 2 + vert 431 ( 0.5072339773 0.0048000216 ) 244 2 + vert 432 ( 0.2871229947 0.1299539804 ) 244 2 + vert 433 ( 0.5637699962 0.0322920084 ) 223 2 + vert 434 ( 0.4546880126 0.0763549805 ) 524 2 + vert 435 ( 0.455471009 0.0957729816 ) 532 2 + vert 436 ( 0.4164020121 0.1195030212 ) 532 2 + vert 437 ( 0.4120169878 0.0711200237 ) 534 3 + vert 438 ( 0.4609180093 0.1166200042 ) 534 3 + vert 439 ( 0.4403850138 0.094950974 ) 526 2 + vert 440 ( 0.3920710087 0.0341650248 ) 496 2 + vert 441 ( 0.4966470003 0.125048995 ) 496 2 + vert 442 ( 0.4959709942 0.0842580199 ) 498 4 + vert 443 ( 0.5032070279 0.044878006 ) 502 2 + vert 444 ( 0.5148689747 0.0256670117 ) 484 3 + vert 445 ( 0.6944620013 0.214230001 ) 701 1 + vert 446 ( 0.6946520209 0.2473229766 ) 700 1 + vert 447 ( 0.6684259772 0.1738259792 ) 702 1 + vert 448 ( 0.3892169893 0.2115769982 ) 660 2 + vert 449 ( 0.6264640093 0.0478910208 ) 1261 4 + vert 450 ( 0.6539670229 0.0441989899 ) 1289 1 + vert 451 ( 0.7198489904 0.2486060262 ) 754 1 + vert 452 ( 0.7547780275 0.2374569774 ) 755 1 + vert 453 ( 0.6504539847 0.0100640059 ) 756 1 + vert 454 ( 0.6260309815 0.0222219825 ) 751 1 + vert 455 ( 0.6270130277 0.040103972 ) 755 1 + vert 456 ( 0.6537860036 0.0274119973 ) 0 1 + vert 457 ( 0.7295759916 0.2524539828 ) 757 1 + vert 458 ( 0.6972550154 0.2525650263 ) 703 1 + vert 459 ( 0.7659860253 0.2378540039 ) 758 1 + vert 460 ( 0.9725189805 0.0084909797 ) 759 1 + vert 461 ( 0.95559901 0.0141710043 ) 758 1 + vert 462 ( 0.963958025 0.0304809809 ) 752 1 + vert 463 ( 0.9821529984 0.0269889832 ) 1 1 + vert 464 ( 0.6499459743 0.2994199991 ) 761 1 + vert 465 ( 0.6556820273 0.3456320167 ) 760 1 + vert 466 ( 0.7014049888 0.3363400102 ) 752 1 + vert 467 ( 0.693911016 0.2944120169 ) 751 1 + vert 468 ( 0.6077020168 0.2812240124 ) 704 1 + vert 469 ( 0.6587949991 0.2668409944 ) 705 1 + vert 470 ( 0.6287959814 0.3809159994 ) 707 1 + vert 471 ( 0.6849489808 0.3723090291 ) 706 1 + vert 472 ( 0.6045209765 0.3379330039 ) 708 1 + vert 473 ( 0.9047420025 0.3801220059 ) 695 2 + vert 474 ( 0.8658549786 0.3910109997 ) 1246 2 + vert 475 ( 0.892663002 0.4162740111 ) 693 2 + vert 476 ( 0.8819209933 0.4923700094 ) 1138 1 + vert 477 ( 0.8432620168 0.4713640213 ) 1143 1 + vert 478 ( 0.9402530193 0.356589973 ) 601 2 + vert 479 ( 0.9089090228 0.3466039896 ) 1248 2 + vert 480 ( 0.936702013 0.3991870284 ) 567 2 + vert 481 ( 0.9622219801 0.4039859772 ) 569 2 + vert 482 ( 0.9113950133 0.4784160256 ) 571 1 + vert 483 ( 0.4935880005 0.3773649931 ) 376 2 + vert 484 ( 0.4455760121 0.3779770136 ) 190 2 + vert 485 ( 0.4725199938 0.407877028 ) 194 2 + vert 486 ( 0.46083799 0.3574039936 ) 347 2 + vert 487 ( 0.4226379991 0.3312609792 ) 349 2 + vert 488 ( 0.5098860264 0.395851016 ) 378 2 + vert 489 ( 0.4714680016 0.4320170283 ) 196 2 + vert 490 ( 0.4320049882 0.2953100204 ) 351 3 + vert 491 ( 0.4699369967 0.3354099989 ) 354 3 + vert 492 ( 0.502448976 0.3553580046 ) 380 3 + vert 493 ( 0.5594859719 0.3856170177 ) 383 2 + vert 494 ( 0.5534120202 0.3623949885 ) 385 2 + vert 495 ( 0.4762170017 0.272973001 ) 357 3 + vert 496 ( 0.5603200197 0.2951329947 ) 387 3 + vert 497 ( 0.5784839988 0.2735880017 ) 603 4 + vert 498 ( 0.5618100166 0.2347249985 ) 607 3 + vert 499 ( 0.5036510229 0.1811059713 ) 575 3 + vert 500 ( 0.484780997 0.1441540122 ) 569 2 + vert 501 ( 0.4721060097 0.2094669938 ) 572 3 + vert 502 ( 0.4011240005 0.1726250052 ) 578 1 + vert 503 ( 0.4260840118 0.1079699993 ) 571 1 + vert 504 ( 0.4066579938 0.1979320049 ) 579 1 + vert 505 ( 0.4309540093 0.3848189712 ) 192 2 + vert 506 ( 0.3752120137 0.406431973 ) 934 5 + vert 507 ( 0.4444699883 0.4874569774 ) 198 2 + vert 508 ( 0.4021719992 0.3311830163 ) 1026 5 + vert 509 ( 0.4467209876 0.2578369975 ) 580 4 + vert 510 ( 0.3922060132 0.2356569767 ) 1144 3 + vert 511 ( 0.378320992 0.2664020061 ) 1147 4 + vert 512 ( 0.4111439884 0.3003469706 ) 360 4 + vert 513 ( 0.486315012 0.4641780257 ) 200 2 + vert 514 ( 0.5296769738 0.4387519956 ) 390 1 + vert 515 ( 0.5646640062 0.4159449935 ) 391 2 + vert 516 ( 0.5531259775 0.4516389966 ) 393 2 + vert 517 ( 0.3446899951 0.3903080225 ) 943 5 + vert 518 ( 0.3342550099 0.3271899819 ) 1031 2 + vert 519 ( 0.2906930149 0.4331480265 ) 939 4 + vert 520 ( 0.2780939937 0.36629498 ) 1033 5 + vert 521 ( 0.350165993 0.4602569938 ) 948 3 + vert 522 ( 0.2415779978 0.469456017 ) 955 2 + vert 523 ( 0.6617609859 0.3855559826 ) 1147 4 + vert 524 ( 0.6278759837 0.4150900245 ) 1144 3 + vert 525 ( 0.7017890215 0.4796990156 ) 1013 2 + vert 526 ( 0.6637650132 0.4906160235 ) 1015 1 + vert 527 ( 0.6110360026 0.4584259987 ) 584 1 + vert 528 ( 0.9401680231 0.4473029971 ) 578 1 + vert 529 ( 0.9440479875 0.4652580023 ) 579 1 + vert 530 ( 0.9164919853 0.587051034 ) 346 1 + vert 531 ( 0.8897489905 0.5668550134 ) 1139 1 + vert 532 ( 0.9509649873 0.589779973 ) 1016 1 + vert 533 ( 0.9744719863 0.4522749782 ) 584 1 + vert 534 ( 0.9928060174 0.472630024 ) 1015 1 + vert 535 ( 0.8674150109 0.6261509657 ) 1130 2 + vert 536 ( 0.7304599881 0.4685429931 ) 1017 1 + vert 537 ( 0.7217270136 0.4029960036 ) 1038 4 + vert 538 ( 0.3617520034 0.2754740119 ) 1038 4 + vert 539 ( 0.7648109794 0.4058899879 ) 1151 2 + vert 540 ( 0.3319259882 0.2511690259 ) 1151 2 + vert 541 ( 0.992644012 0.6031559706 ) 1018 2 + vert 542 ( 0.8997570276 0.6710929871 ) 1005 2 + vert 543 ( 0.6808909774 0.5813779831 ) 1018 2 + vert 544 ( 0.8233590126 0.5001620054 ) 1140 1 + vert 545 ( 0.8196020126 0.4549049735 ) 1153 1 + vert 546 ( 0.8037059903 0.3945549726 ) 1154 2 + vert 547 ( 0.8531119823 0.3535869718 ) 1250 2 + vert 548 ( 0.6112840176 0.1612300277 ) 709 2 + vert 549 ( 0.5623360276 0.1429389715 ) 601 2 + vert 550 ( 0.5552790165 0.192900002 ) 610 3 + vert 551 ( 0.6336380243 0.106226027 ) 1290 2 + vert 552 ( 0.5711550117 0.0786780119 ) 1248 2 + vert 553 ( 0.6061859727 0.130810976 ) 711 2 + vert 554 ( 0.1655959934 0.004290998 ) 1248 2 + vert 555 ( 0.1456640065 0.0616189837 ) 1292 2 + vert 556 ( 0.2381079942 0.059795022 ) 1250 2 + vert 557 ( 0.0592989996 0.0097569823 ) 1290 2 + vert 558 ( 0.6632720232 0.171431005 ) 714 1 + vert 559 ( 0.6810920238 0.1442700028 ) 713 1 + vert 560 ( 0.1714700013 0.0926010013 ) 1294 2 + vert 561 ( 0.0638689995 0.0808969736 ) 1296 4 + vert 562 ( 0.1298909932 0.1286990047 ) 1307 4 + vert 563 ( 0.1359560043 0.1618999839 ) 1303 4 + vert 564 ( 0.1932709962 0.1180869937 ) 1300 3 + vert 565 ( 0.0523019992 0.1063830256 ) 1315 4 + vert 566 ( 0.0725580007 0.1149970293 ) 1311 4 + vert 567 ( 0.6630539894 0.2133560181 ) 715 1 + vert 568 ( 0.6120910048 0.1978889704 ) 613 2 + vert 569 ( 0.6431419849 0.2242379785 ) 615 3 + vert 570 ( 0.5955960155 0.261187017 ) 618 3 + vert 571 ( 0.0387790017 0.1839280128 ) 1319 5 + vert 572 ( 0.0733010024 0.1601880193 ) 1324 5 + vert 573 ( 0.0693050027 0.137567997 ) 1329 4 + vert 574 ( 0.0396150015 0.1270449758 ) 1333 3 + vert 575 ( 0.1337530017 0.1994839907 ) 1336 5 + vert 576 ( 0.2137950063 0.1536509991 ) 1252 2 + vert 577 ( 0.209691003 0.20184201 ) 1169 3 + vert 578 ( 0.225722 0.1374539733 ) 1254 2 + vert 579 ( 0.2373339981 0.160359025 ) 1256 2 + vert 580 ( 0.189914003 0.2325739861 ) 1172 6 + vert 581 ( 0.2663919926 0.134995997 ) 1258 3 + vert 582 ( 0.8136450052 0.3329290152 ) 1258 3 + vert 583 ( 0.3206700087 0.2083330154 ) 1154 2 + vert 584 ( 0.3068070114 0.2415360212 ) 1156 2 + vert 585 ( 0.1939010024 0.2994419932 ) 1178 3 + vert 586 ( 0.2351350039 0.2487829924 ) 1158 3 + vert 587 ( 0.2311999947 0.292764008 ) 1181 4 + vert 588 ( 0.218197003 0.3390269876 ) 1051 3 + vert 589 ( 0.7738569975 0.4659230113 ) 1141 1 + vert 590 ( 0.2145709991 0.4182940125 ) 957 3 + vert 591 ( 0.1918659955 0.3579739928 ) 1054 3 + vert 592 ( 0.1817969978 0.4129549861 ) 1057 3 + vert 593 ( 0.2277680039 0.4995999932 ) 960 2 + vert 594 ( 0.3483670056 0.5014640093 ) 962 2 + vert 595 ( 0.415775001 0.5519819856 ) 143 2 + vert 596 ( 0.3023670018 0.5384190083 ) 908 2 + vert 597 ( 0.3364549875 0.5936729908 ) 906 2 + vert 598 ( 0.4975549877 0.5117490292 ) 145 2 + vert 599 ( 0.1624359936 0.2635220289 ) 1185 5 + vert 600 ( 0.1553609967 0.3155130148 ) 1060 3 + vert 601 ( 0.1748200059 0.3456419706 ) 1063 3 + vert 602 ( 0.2426660061 0.6310210228 ) 910 3 + vert 603 ( 0.2358549982 0.5534809828 ) 913 3 + vert 604 ( 0.8699700236 0.062681973 ) 771 1 + vert 605 ( 0.8175349832 0.0708159804 ) 770 1 + vert 606 ( 0.7510849833 0.099018991 ) 772 1 + vert 607 ( 0.7195789814 0.1319010258 ) 716 1 + vert 608 ( 0.8496410251 0.259962976 ) 714 1 + vert 609 ( 0.8483690023 0.2963799834 ) 715 1 + vert 610 ( 0.7789930105 0.3217620254 ) 621 1 + vert 611 ( 0.7968490124 0.1361960173 ) 721 1 + vert 612 ( 0.8296459913 0.1979560256 ) 719 2 + vert 613 ( 0.7839310169 0.1836779714 ) 717 2 + vert 614 ( 0.7437710166 0.2796570063 ) 722 1 + vert 615 ( 0.718125999 0.1712639928 ) 723 1 + vert 616 ( 0.7508630157 0.2160159945 ) 725 1 + vert 617 ( 0.719013989 0.2146760225 ) 724 1 + vert 618 ( 0.7891539931 0.2574819922 ) 726 1 + vert 619 ( 0.3927290142 0.6674389839 ) 104 1 + vert 620 ( 0.3591209948 0.7251099944 ) 103 1 + vert 621 ( 0.3162479997 0.7084549665 ) 84 2 + vert 622 ( 0.3360419869 0.7445850372 ) 86 2 + vert 623 ( 0.4709730148 0.7174290419 ) 108 1 + vert 624 ( 0.5518569946 0.6541960239 ) 121 1 + vert 625 ( 0.5532469749 0.7149789929 ) 122 1 + vert 626 ( 0.5285440087 0.7387089729 ) 110 1 + vert 627 ( 0.3170320094 0.7504550219 ) 88 2 + vert 628 ( 0.3135139942 0.7971960306 ) 82 2 + vert 629 ( 0.258810997 0.7782310247 ) 76 1 + vert 630 ( 0.2556129992 0.7467960119 ) 77 1 + vert 631 ( 0.2687860131 0.684746027 ) 78 1 + vert 632 ( 0.5329959989 0.7829660177 ) 115 1 + vert 633 ( 0.4004510045 0.7816889882 ) 102 1 + vert 634 ( 0.5319129825 0.8484209776 ) 881 2 + vert 635 ( 0.3534800112 0.8119220138 ) 872 2 + vert 636 ( 0.3721509874 0.8658800125 ) 874 2 + vert 637 ( 0.3290500045 0.8738279939 ) 862 2 + vert 638 ( 0.1949339956 0.7039160132 ) 71 1 + vert 639 ( 0.1511140019 0.7662889957 ) 66 1 + vert 640 ( 0.128057003 0.7114620209 ) 842 1 + vert 641 ( 0.1920520067 0.7645189762 ) 68 1 + vert 642 ( 0.2178730071 0.6518000364 ) 850 1 + vert 643 ( 0.2710539997 0.8663890362 ) 854 1 + vert 644 ( 0.2530179918 0.9317960143 ) 855 1 + vert 645 ( 0.3133589923 0.9429730177 ) 856 1 + vert 646 ( 0.2457190007 0.98517102 ) 850 1 + vert 647 ( 0.5919589996 0.4690170288 ) 9 1 + vert 648 ( 0.5787479877 0.5270869732 ) 7 2 + vert 649 ( 0.554445982 0.5257560015 ) 4 3 + vert 650 ( 0.6399019957 0.5217280388 ) 20 2 + vert 651 ( 0.6098080277 0.5212370157 ) 12 4 + vert 652 ( 0.6255040169 0.4680550098 ) 10 2 + vert 653 ( 0.6059569716 0.4835230112 ) 16 3 + vert 654 ( 0.9252679944 0.3106799722 ) 22 2 + vert 655 ( 0.8890010118 0.3160259724 ) 16 3 + vert 656 ( 0.8620030284 0.2712230086 ) 4 3 + vert 657 ( 0.8997160196 0.339312017 ) 10 2 + vert 658 ( 0.5853270292 0.6541830301 ) 783 5 + vert 659 ( 0.6338729858 0.6179389954 ) 809 2 + vert 660 ( 0.6633300185 0.6478710175 ) 778 5 + vert 661 ( 0.6105780005 0.6199960113 ) 803 2 + vert 662 ( 0.6069740057 0.6015210152 ) 805 2 + vert 663 ( 0.8651260138 0.3174859881 ) 9 1 + vert 664 ( 0.0805179998 0.8763459921 ) 813 1 + vert 665 ( 0.0562979989 0.9080989957 ) 811 2 + vert 666 ( 0.039241001 0.881411016 ) 803 2 + vert 667 ( 0.0206809994 0.8567830324 ) 805 2 + vert 668 ( 0.0693550035 0.7821719646 ) 55 2 + vert 669 ( 0.0703490004 0.8341609836 ) 807 2 + vert 670 ( 0.0415229984 0.7456760406 ) 814 2 + vert 671 ( 0.6154680252 0.5810270309 ) 53 2 + vert 672 ( 0.6318259835 0.5838260055 ) 24 2 + vert 673 ( 0.641735971 0.6090250015 ) 788 3 + vert 674 ( 0.0369510017 0.7082769871 ) 57 2 + vert 675 ( 0.0161380004 0.674703002 ) 788 3 + vert 676 ( 0.0481689982 0.6478599906 ) 816 2 + vert 677 ( 0.0270489994 0.7911729813 ) 19 1 + vert 678 ( 0.0620450005 0.942456007 ) 818 2 + vert 679 ( 0.6179710031 0.5927380323 ) 19 1 + vert 680 ( 0.9466549754 0.1849660277 ) 783 5 + vert 681 ( 0.9776629806 0.2034860253 ) 778 5 + vert 682 ( 0.9366390109 0.2703830004 ) 26 4 + vert 683 ( 0.6658239961 0.5564789772 ) 26 4 + vert 684 ( 0.6554399729 0.5084289908 ) 22 2 + vert 685 ( 0.6027539968 0.7422770262 ) 138 2 + vert 686 ( 0.5747799873 0.7488210201 ) 116 1 + vert 687 ( 0.6170430183 0.7931050062 ) 894 2 + vert 688 ( 0.6111860275 0.8431279659 ) 896 2 + vert 689 ( 0.5646809936 0.9009640217 ) 890 2 + vert 690 ( 0.6461409926 0.7729799747 ) 143 2 + vert 691 ( 0.6089860201 0.7124739885 ) 147 2 + vert 692 ( 0.6387400031 0.9051539898 ) 910 3 + vert 693 ( 0.216564998 0.7628619671 ) 69 1 + vert 694 ( 0.5315089822 0.9500119686 ) 884 1 + vert 695 ( 0.5731310248 0.9904959798 ) 121 1 + vert 696 ( 0.4229629934 0.9944400191 ) 104 1 + vert 697 ( 0.6274639964 0.6811360121 ) 149 2 + vert 698 ( 0.4683719873 0.5763419867 ) 149 2 + vert 699 ( 0.4571210146 0.5950269699 ) 123 2 + vert 700 ( 0.5894079804 0.6624879837 ) 123 2 + vert 701 ( 0.4750989974 0.923658967 ) 879 1 + vert 702 ( 0.3598459959 0.9482370019 ) 864 1 + vert 703 ( 0.4177440107 0.5978900194 ) 121 1 + vert 704 ( 0.220660001 0.8181809783 ) 848 1 + vert 705 ( 0.3488979936 0.6011179686 ) 884 1 + vert 706 ( 0.5293869972 0.9176909924 ) 885 1 + vert 707 ( 0.5633839965 0.7838380337 ) 117 1 + vert 708 ( 0.1028470024 0.7701100111 ) 840 1 + vert 709 ( 0.1076949984 0.8272809982 ) 841 1 + vert 710 ( 0.1552740037 0.8225290179 ) 849 1 + vert 711 ( 0.3299930096 0.6695460081 ) 90 2 + vert 712 ( 0.3602269888 0.9965459704 ) 90 2 + vert 713 ( 0.0040460001 0.7464909554 ) 24 2 + vert 714 ( 0.0390960015 0.9554070234 ) 809 2 + vert 715 ( 0.0653230026 0.9697819948 ) 816 2 + vert 716 ( 0.0236259997 0.6419839859 ) 809 2 + vert 717 ( 0.1939560026 0.800639987 ) 70 1 + vert 718 ( 0.6380659938 0.8520100117 ) 906 2 + vert 719 ( 0.5762540102 0.7065330148 ) 125 1 + vert 720 ( 0.3161180019 0.974815011 ) 857 1 + vert 721 ( 0.2858850062 0.6478140354 ) 857 1 + vert 722 ( 0.3197619915 0.9033539891 ) 865 2 + vert 723 ( 0.1184799969 0.6740809679 ) 843 1 + vert 724 ( 0.1428450048 0.9657809734 ) 843 1 + vert 725 ( 0.8408759832 0.6830760241 ) 1132 2 + vert 726 ( 0.8901820183 0.7600290179 ) 999 2 + vert 727 ( 0.8459489942 0.7727829814 ) 1128 1 + vert 728 ( 0.8206200004 0.6564400196 ) 1136 2 + vert 729 ( 0.7961320281 0.6472159624 ) 1134 2 + vert 730 ( 0.8983619809 0.8628740311 ) 342 1 + vert 731 ( 0.8143669963 0.5759320259 ) 1142 1 + vert 732 ( 0.7627589703 0.6211520433 ) 1007 2 + vert 733 ( 0.779073 0.5567619801 ) 1020 2 + vert 734 ( 0.8393570185 0.8992350101 ) 333 2 + vert 735 ( 0.7980229855 0.788064003 ) 1129 1 + vert 736 ( 0.8703290224 0.9544910192 ) 566 1 + vert 737 ( 0.835457027 0.9562709928 ) 335 1 + vert 738 ( 0.8181689978 0.937714994 ) 995 2 + vert 739 ( 0.9660210013 0.7194709778 ) 1009 2 + vert 740 ( 0.9539650083 0.8656380177 ) 343 1 + vert 741 ( 0.7467960119 0.541285038 ) 1022 2 + vert 742 ( 0.7331050038 0.621508956 ) 1011 2 + vert 743 ( 0.7109590173 0.5591279864 ) 1024 2 + vert 744 ( 0.9777879715 0.959363997 ) 336 1 + vert 745 ( 0.9401940107 0.968922019 ) 337 1 + vert 746 ( 0.9942640066 0.7332969904 ) 344 2 + vert 747 ( 0.6586520076 0.729196012 ) 344 2 + vert 748 ( 0.7038180232 0.7743589878 ) 932 2 + vert 749 ( 0.6476070285 0.7901499867 ) 1001 1 + vert 750 ( 0.9832199812 0.7942509651 ) 1001 1 + vert 751 ( 0.6696500182 0.8830670118 ) 343 1 + vert 752 ( 0.7198809981 0.993309021 ) 338 1 + vert 753 ( 0.6647819877 0.9921709895 ) 336 1 + vert 754 ( 0.739601016 0.7770649791 ) 1002 2 + vert 755 ( 0.7652369738 0.8088859916 ) 1004 1 + vert 756 ( 0.7581189871 0.9959750175 ) 991 1 + vert 757 ( 0.9403719902 0.1295740008 ) 1397 1 + vert 758 ( 0.9505029917 0.1768910289 ) 727 1 + vert 759 ( 0.9097959995 0.1049000025 ) 773 1 + vert 760 ( 0.9432600141 0.1070929766 ) 1398 1 + vert 761 ( 0.9125699997 0.1805279851 ) 713 1 + vert 762 ( 0.6656240225 0.0728669763 ) 727 1 + vert 763 ( 0.8040570021 0.9843299985 ) 339 1 + vert 764 ( 0.7865899801 0.9478669763 ) 997 2 + vert 765 ( 0.9080340266 0.9559050202 ) 341 1 + vert 766 ( 0.8686590195 0.9862880111 ) 340 1 + vert 767 ( 0.3347780108 0.0907649994 ) 280 2 + vert 768 ( 0.3373509943 0.1445180178 ) 537 2 + vert 769 ( 0.327560991 0.1075019836 ) 278 2 + vert 770 ( 0.3435400128 0.1323050261 ) 560 2 + vert 771 ( 0.3712880015 0.1355190277 ) 539 2 + vert 772 ( 0.3465929925 0.0791910291 ) 284 2 + vert 773 ( 0.3593690097 0.0873770118 ) 282 2 + vert 774 ( 0.3597230017 0.1277499795 ) 562 2 + vert 775 ( 0.4533370137 0.0418220162 ) 537 2 + vert 776 ( 0.4457809925 0.0659499764 ) 539 2 + vert 777 ( 0.4853880107 0.0488749743 ) 278 2 + vert 778 ( 0.4816879928 0.0832319856 ) 282 2 + vert 779 ( 0.4303619862 0.0334470272 ) 543 2 + vert 780 ( 0.4245269895 0.0573260188 ) 541 2 + vert 781 ( 0.3526870012 0.1682530046 ) 545 2 + vert 782 ( 0.348623991 0.1910809875 ) 543 2 + vert 783 ( 0.3685989976 0.1636440158 ) 547 2 + vert 784 ( 0.382562995 0.1823400259 ) 541 2 + vert 785 ( 0.3985010087 0.0333930254 ) 549 2 + vert 786 ( 0.3596839905 0.1896600127 ) 551 2 + vert 787 ( 0.3702119887 0.2058439851 ) 549 2 + vert 788 ( 0.3717960119 0.18700701 ) 553 2 + vert 789 ( 0.303245008 0.0918400288 ) 291 2 + vert 790 ( 0.3089720011 0.1347830296 ) 289 2 + vert 791 ( 0.2927460074 0.0936490297 ) 286 3 + vert 792 ( 0.3002550006 0.1380410194 ) 293 2 + vert 793 ( 0.3310190141 0.1299099922 ) 297 2 + vert 794 ( 0.3222639859 0.1323840022 ) 295 2 + vert 795 ( 0.3172639906 0.0896959901 ) 299 2 + vert 796 ( 0.4652990103 0.0162109733 ) 293 2 + vert 797 ( 0.4602299929 0.0382009745 ) 297 2 + vert 798 ( 0.4916099906 0.0249140263 ) 286 3 + vert 799 ( 0.4363319874 0.006716013 ) 303 2 + vert 800 ( 0.4315260053 0.0279629827 ) 301 2 + vert 801 ( 0.3073540032 0.1744940281 ) 303 2 + vert 802 ( 0.3161199987 0.1741930246 ) 305 2 + vert 803 ( 0.3299629986 0.1716979742 ) 564 2 + vert 804 ( 0.337199986 0.1560660005 ) 301 2 + vert 805 ( 0.4057050049 0.0110350251 ) 246 2 + vert 806 ( 0.3230539858 0.1907969713 ) 248 2 + vert 807 ( 0.3302969933 0.1877800226 ) 250 2 + vert 808 ( 0.3317849934 0.2105469704 ) 246 2 + vert 809 ( 0.383284986 0.1455370188 ) 257 2 + vert 810 ( 0.3863030076 0.1229060292 ) 254 3 + vert 811 ( 0.3926460147 0.130226016 ) 252 2 + vert 812 ( 0.3804560006 0.1284040213 ) 555 3 + vert 813 ( 0.3766250014 0.1047739983 ) 558 2 + vert 814 ( 0.3859379888 0.1626679897 ) 259 2 + vert 815 ( 0.3886300027 0.0971239805 ) 261 2 + vert 816 ( 0.407709986 0.1334480047 ) 263 1 + vert 817 ( 0.4393959939 0.0885879993 ) 263 1 + vert 818 ( 0.4417879879 0.0739430189 ) 264 3 + vert 819 ( 0.427233994 0.0775799751 ) 259 2 + vert 820 ( 0.3728730083 0.1242009997 ) 264 3 + vert 821 ( 0.3601149917 0.0712159872 ) 307 2 + vert 822 ( 0.3679949939 0.1086779833 ) 267 2 + vert 823 ( 0.4090180099 0.1032549739 ) 271 2 + vert 824 ( 0.4169389904 0.1050739884 ) 269 2 + vert 825 ( 0.3994820118 0.0794129968 ) 273 2 + vert 826 ( 0.3812460005 0.0424799919 ) 309 2 + vert 827 ( 0.3389190137 0.0120249987 ) 339 1 + vert 828 ( 0.3200539947 0.025052011 ) 340 1 + vert 829 ( 0.3000009954 0.0298609734 ) 337 1 + vert 830 ( 0.2879619896 0.0760909915 ) 311 4 + vert 831 ( 0.2902429998 0.0590929985 ) 315 3 + vert 832 ( 0.2706010044 0.0740609765 ) 163 2 + vert 833 ( 0.273950994 0.087511003 ) 162 1 + vert 834 ( 0.2582120001 0.0876759887 ) 165 1 + vert 835 ( 0.256716013 0.072142005 ) 166 2 + vert 836 ( 0.2830049992 0.0309460163 ) 336 1 + vert 837 ( 0.351229012 -0.0008690357 ) 991 1 + vert 838 ( 0.3690010011 0.0031449795 ) 992 3 + vert 839 ( 0.2570660114 0.0305629969 ) 338 1 + vert 840 ( 0.5312179923 0.1350970268 ) 992 3 + vert 841 ( 0.5449799895 0.1229529977 ) 991 1 + vert 842 ( 0.5371990204 0.0950000286 ) 318 2 + vert 843 ( 0.5640779734 0.0809000134 ) 338 1 + vert 844 ( 0.5238739848 0.028726995 ) 174 2 + vert 845 ( 0.5405970216 0.0565090179 ) 171 3 + vert 846 ( 0.5366640091 0.0342630148 ) 168 3 + vert 847 ( 0.5216439962 0.0386400223 ) 320 3 + vert 848 ( 0.5549640059 0.0246229768 ) 165 1 + vert 849 ( 0.5408449769 0.0149279833 ) 176 2 + vert 850 ( 0.2775950134 0.1015840173 ) 178 2 + vert 851 ( 0.2625280023 0.1049659848 ) 176 2 + vert 852 ( 0.291613996 0.1033419967 ) 174 2 + vert 853 ( 0.2894070148 0.0893080235 ) 320 3 + vert 854 ( 0.5155829787 0.0192989707 ) 182 2 + vert 855 ( 0.5262960196 0.0097550154 ) 180 2 + vert 856 ( 0.526786983 0.0039979815 ) 184 2 + vert 857 ( 0.2690129876 0.1203039885 ) 184 2 + vert 858 ( 0.282882005 0.1167050004 ) 186 2 + vert 859 ( 0.2931900024 0.1148449779 ) 182 2 + vert 860 ( 0.5072339773 0.0048000216 ) 188 2 + vert 861 ( 0.2871229947 0.1299539804 ) 188 2 + vert 862 ( 0.5637699962 0.0322920084 ) 166 2 + vert 863 ( 0.4546880126 0.0763549805 ) 267 2 + vert 864 ( 0.455471009 0.0957729816 ) 275 1 + vert 865 ( 0.4164020121 0.1195030212 ) 275 1 + vert 866 ( 0.4120169878 0.0711200237 ) 276 2 + vert 867 ( 0.4609180093 0.1166200042 ) 276 2 + vert 868 ( 0.4403850138 0.094950974 ) 269 2 + vert 869 ( 0.3920710087 0.0341650248 ) 323 2 + vert 870 ( 0.4966470003 0.125048995 ) 323 2 + vert 871 ( 0.4959709942 0.0842580199 ) 325 4 + vert 872 ( 0.5032070279 0.044878006 ) 329 4 + vert 873 ( 0.5148689747 0.0256670117 ) 311 4 + vert 874 ( 0.3892169893 0.2115769982 ) 584 1 + vert 875 ( 0.7198489904 0.2486060262 ) 728 1 + vert 876 ( 0.7547780275 0.2374569774 ) 729 1 + vert 877 ( 0.6260309815 0.0222219825 ) 725 1 + vert 878 ( 0.6504539847 0.0100640059 ) 730 1 + vert 879 ( 0.6270130277 0.040103972 ) 729 1 + vert 880 ( 0.6537860036 0.0274119973 ) 2 1 + vert 881 ( 0.7295759916 0.2524539828 ) 731 1 + vert 882 ( 0.7659860253 0.2378540039 ) 732 1 + vert 883 ( 0.95559901 0.0141710043 ) 732 1 + vert 884 ( 0.9725189805 0.0084909797 ) 733 1 + vert 885 ( 0.963958025 0.0304809809 ) 726 1 + vert 886 ( 0.9821529984 0.0269889832 ) 3 1 + vert 887 ( 0.6556820273 0.3456320167 ) 735 1 + vert 888 ( 0.6499459743 0.2994199991 ) 734 1 + vert 889 ( 0.7014049888 0.3363400102 ) 726 1 + vert 890 ( 0.693911016 0.2944120169 ) 725 1 + + numtris 1346 + tri 0 2 1 0 + tri 1 3 2 0 + tri 2 3 0 4 + tri 3 7 6 5 + tri 4 7 5 1 + tri 5 8 6 7 + tri 6 7 1 2 + tri 7 3 7 2 + tri 8 9 7 3 + tri 9 9 8 7 + tri 10 12 11 10 + tri 11 10 11 13 + tri 12 10 13 14 + tri 13 16 15 12 + tri 14 12 15 11 + tri 15 13 17 14 + tri 16 13 18 17 + tri 17 19 18 13 + tri 18 11 19 13 + tri 19 15 20 11 + tri 20 11 20 21 + tri 21 19 22 18 + tri 22 19 23 22 + tri 23 22 23 24 + tri 24 22 24 25 + tri 25 28 27 26 + tri 26 25 27 28 + tri 27 22 25 28 + tri 28 28 26 29 + tri 29 29 26 30 + tri 30 31 28 29 + tri 31 22 28 31 + tri 32 12 10 32 + tri 33 16 12 32 + tri 34 34 16 33 + tri 35 16 32 33 + tri 36 10 14 32 + tri 37 33 32 14 + tri 38 33 14 35 + tri 39 17 22 36 + tri 40 18 22 17 + tri 41 17 36 37 + tri 42 17 37 38 + tri 43 17 38 39 + tri 44 14 17 39 + tri 45 35 14 39 + tri 46 35 39 38 + tri 47 41 40 21 + tri 48 21 40 23 + tri 49 19 21 23 + tri 50 41 21 42 + tri 51 20 42 21 + tri 52 34 43 16 + tri 53 43 44 16 + tri 54 15 45 20 + tri 55 15 44 45 + tri 56 44 46 45 + tri 57 47 42 20 + tri 58 47 45 46 + tri 59 43 46 44 + tri 60 48 47 46 + tri 61 48 46 43 + tri 62 47 20 45 + tri 63 51 50 49 + tri 64 51 49 52 + tri 65 50 33 49 + tri 66 33 35 49 + tri 67 53 50 51 + tri 68 53 51 54 + tri 69 34 33 53 + tri 70 53 33 50 + tri 71 57 56 55 + tri 72 57 55 58 + tri 73 58 55 59 + tri 74 61 60 9 + tri 75 62 61 9 + tri 76 62 9 63 + tri 77 64 61 62 + tri 78 64 65 61 + tri 79 64 66 65 + tri 80 63 9 3 + tri 81 62 63 67 + tri 82 57 69 68 + tri 83 35 38 70 + tri 84 35 70 49 + tri 85 57 68 56 + tri 86 69 71 68 + tri 87 49 70 72 + tri 88 73 66 64 + tri 89 64 62 74 + tri 90 73 64 74 + tri 91 74 62 67 + tri 92 57 58 75 + tri 93 63 3 4 + tri 94 63 4 76 + tri 95 77 76 4 + tri 96 78 77 4 + tri 97 4 0 79 + tri 98 79 0 5 + tri 99 1 5 0 + tri 100 82 81 80 + tri 101 82 80 26 + tri 102 83 82 25 + tri 103 86 85 84 + tri 104 80 86 84 + tri 105 89 88 87 + tri 106 87 88 90 + tri 107 81 92 91 + tri 108 89 87 93 + tri 109 87 90 94 + tri 110 97 96 95 + tri 111 99 94 98 + tri 112 81 91 86 + tri 113 86 91 85 + tri 114 94 100 98 + tri 115 90 100 94 + tri 116 102 101 81 + tri 117 81 101 92 + tri 118 103 101 102 + tri 119 105 104 103 + tri 120 103 104 101 + tri 121 83 106 102 + tri 122 106 103 102 + tri 123 106 105 103 + tri 124 83 25 107 + tri 125 108 83 107 + tri 126 40 108 24 + tri 127 40 24 23 + tri 128 108 107 24 + tri 129 24 107 25 + tri 130 111 110 109 + tri 131 112 109 110 + tri 132 113 109 112 + tri 133 113 114 109 + tri 134 114 95 96 + tri 135 99 96 94 + tri 136 93 94 96 + tri 137 115 114 96 + tri 138 115 96 99 + tri 139 115 99 116 + tri 140 116 99 98 + tri 141 114 116 111 + tri 142 115 116 114 + tri 143 116 100 111 + tri 144 116 98 100 + tri 145 117 97 95 + tri 146 117 95 114 + tri 147 87 94 93 + tri 148 80 81 86 + tri 149 119 118 97 + tri 150 118 120 97 + tri 151 121 120 118 + tri 152 97 93 96 + tri 153 89 93 97 + tri 154 123 117 122 + tri 155 124 119 117 + tri 156 119 97 117 + tri 157 125 97 120 + tri 158 125 120 121 + tri 159 4 79 126 + tri 160 125 89 97 + tri 161 78 4 126 + tri 162 127 125 121 + tri 163 128 127 121 + tri 164 119 121 118 + tri 165 129 124 117 + tri 166 129 119 124 + tri 167 129 130 119 + tri 168 131 130 129 + tri 169 130 121 119 + tri 170 128 121 130 + tri 171 131 128 130 + tri 172 71 77 78 + tri 173 72 127 128 + tri 174 49 72 128 + tri 175 132 131 129 + tri 176 52 131 132 + tri 177 69 133 71 + tri 178 133 77 71 + tri 179 133 76 77 + tri 180 54 51 134 + tri 181 51 52 134 + tri 182 134 52 132 + tri 183 134 132 135 + tri 184 54 134 136 + tri 185 54 136 137 + tri 186 134 135 136 + tri 187 135 132 129 + tri 188 138 53 137 + tri 189 53 54 137 + tri 190 141 140 139 + tri 191 140 138 139 + tri 192 48 43 142 + tri 193 142 43 34 + tri 194 143 48 142 + tri 195 145 144 123 + tri 196 129 117 144 + tri 197 144 117 123 + tri 198 146 144 145 + tri 199 147 146 145 + tri 200 114 111 109 + tri 201 135 129 148 + tri 202 148 129 144 + tri 203 148 144 146 + tri 204 136 135 148 + tri 205 150 149 148 + tri 206 136 148 149 + tri 207 139 138 137 + tri 208 151 136 149 + tri 209 137 136 151 + tri 210 152 141 139 + tri 211 11 21 19 + tri 212 147 148 146 + tri 213 150 148 147 + tri 214 155 154 153 + tri 215 156 155 153 + tri 216 152 139 155 + tri 217 154 137 151 + tri 218 155 137 154 + tri 219 152 155 156 + tri 220 152 156 157 + tri 221 16 44 15 + tri 222 83 102 82 + tri 223 82 102 81 + tri 224 160 159 158 + tri 225 158 159 161 + tri 226 163 162 160 + tri 227 164 162 163 + tri 228 162 159 160 + tri 229 166 164 165 + tri 230 169 168 167 + tri 231 169 167 170 + tri 232 173 172 171 + tri 233 174 169 170 + tri 234 174 175 169 + tri 235 174 176 175 + tri 236 165 164 163 + tri 237 172 163 160 + tri 238 177 166 165 + tri 239 165 163 172 + tri 240 173 165 172 + tri 241 177 165 173 + tri 242 179 177 178 + tri 243 178 177 173 + tri 244 52 128 131 + tri 245 52 49 128 + tri 246 25 82 27 + tri 247 82 26 27 + tri 248 180 173 171 + tri 249 180 178 173 + tri 250 171 160 158 + tri 251 171 172 160 + tri 252 168 171 158 + tri 253 117 114 113 + tri 254 122 117 113 + tri 255 183 182 181 + tri 256 183 181 184 + tri 257 181 182 185 + tri 258 182 186 185 + tri 259 185 188 187 + tri 260 185 186 188 + tri 261 183 184 189 + tri 262 191 189 190 + tri 263 192 183 189 + tri 264 192 193 183 + tri 265 195 187 194 + tri 266 197 195 196 + tri 267 197 196 198 + tri 268 184 181 195 + tri 269 184 195 197 + tri 270 189 184 197 + tri 271 181 185 195 + tri 272 195 185 187 + tri 273 190 197 199 + tri 274 190 189 197 + tri 275 202 201 200 + tri 276 200 201 203 + tri 277 201 204 193 + tri 278 205 190 199 + tri 279 208 207 206 + tri 280 211 210 209 + tri 281 214 213 212 + tri 282 215 214 212 + tri 283 218 217 216 + tri 284 217 219 216 + tri 285 210 212 209 + tri 286 222 221 220 + tri 287 221 223 220 + tri 288 221 224 223 + tri 289 211 209 224 + tri 290 215 212 210 + tri 291 218 216 225 + tri 292 228 227 226 + tri 293 229 227 228 + tri 294 232 231 230 + tri 295 209 233 224 + tri 296 213 234 233 + tri 297 213 235 234 + tri 298 237 202 236 + tri 299 237 238 202 + tri 300 239 232 230 + tri 301 239 230 229 + tri 302 229 230 227 + tri 303 202 204 201 + tri 304 240 226 205 + tri 305 226 227 205 + tri 306 241 224 233 + tri 307 234 241 233 + tri 308 222 220 235 + tri 309 218 243 242 + tri 310 218 242 244 + tri 311 218 244 217 + tri 312 246 245 213 + tri 313 245 235 213 + tri 314 222 235 245 + tri 315 211 224 221 + tri 316 199 197 198 + tri 317 188 248 247 + tri 318 247 248 249 + tri 319 196 251 250 + tri 320 253 252 248 + tri 321 248 252 249 + tri 322 251 249 252 + tri 323 250 251 254 + tri 324 201 193 192 + tri 325 201 192 255 + tri 326 203 201 255 + tri 327 258 257 256 + tri 328 253 259 252 + tri 329 261 143 260 + tri 330 187 188 247 + tri 331 262 259 253 + tri 332 264 263 258 + tri 333 258 263 257 + tri 334 198 196 263 + tri 335 265 143 261 + tri 336 266 265 261 + tri 337 196 249 251 + tri 338 267 190 205 + tri 339 195 194 196 + tri 340 187 247 194 + tri 341 270 269 268 + tri 342 272 250 271 + tri 343 257 272 271 + tri 344 263 272 257 + tri 345 263 196 272 + tri 346 272 196 250 + tri 347 194 247 273 + tri 348 273 247 249 + tri 349 196 273 249 + tri 350 196 194 273 + tri 351 268 265 266 + tri 352 270 268 266 + tri 353 264 198 263 + tri 354 192 189 191 + tri 355 213 233 212 + tri 356 209 212 233 + tri 357 236 202 232 + tri 358 274 202 200 + tri 359 232 202 274 + tri 360 232 274 231 + tri 361 231 274 275 + tri 362 231 275 230 + tri 363 230 275 227 + tri 364 275 200 276 + tri 365 274 200 275 + tri 366 227 275 276 + tri 367 227 276 205 + tri 368 276 267 205 + tri 369 183 277 182 + tri 370 193 277 183 + tri 371 278 264 258 + tri 372 246 213 214 + tri 373 237 236 279 + tri 374 279 232 239 + tri 375 279 236 232 + tri 376 280 228 226 + tri 377 280 226 240 + tri 378 280 240 281 + tri 379 237 282 238 + tri 380 276 283 267 + tri 381 200 283 276 + tri 382 200 203 283 + tri 383 203 255 283 + tri 384 283 255 267 + tri 385 260 143 142 + tri 386 260 142 140 + tri 387 251 252 284 + tri 388 251 284 254 + tri 389 271 250 254 + tri 390 271 254 285 + tri 391 188 286 248 + tri 392 186 286 188 + tri 393 186 262 286 + tri 394 286 262 253 + tri 395 286 253 248 + tri 396 138 34 53 + tri 397 140 142 34 + tri 398 140 34 138 + tri 399 139 137 155 + tri 400 208 206 287 + tri 401 287 206 264 + tri 402 287 264 278 + tri 403 193 288 277 + tri 404 204 288 193 + tri 405 199 198 264 + tri 406 207 205 289 + tri 407 205 199 289 + tri 408 289 199 264 + tri 409 206 289 264 + tri 410 207 289 206 + tri 411 290 204 202 + tri 412 238 290 202 + tri 413 291 207 208 + tri 414 240 205 207 + tri 415 281 240 291 + tri 416 240 207 291 + tri 417 255 192 191 + tri 418 267 255 191 + tri 419 267 191 190 + tri 420 293 67 292 + tri 421 296 295 294 + tri 422 293 292 295 + tri 423 295 292 294 + tri 424 297 293 295 + tri 425 296 294 298 + tri 426 67 294 292 + tri 427 67 63 298 + tri 428 298 63 76 + tri 429 299 296 298 + tri 430 67 298 294 + tri 431 298 76 133 + tri 432 69 300 133 + tri 433 300 298 133 + tri 434 297 295 301 + tri 435 301 295 302 + tri 436 296 302 295 + tri 437 297 301 303 + tri 438 304 303 301 + tri 439 305 304 301 + tri 440 307 306 293 + tri 441 306 74 293 + tri 442 74 67 293 + tri 443 299 302 296 + tri 444 299 298 300 + tri 445 299 300 308 + tri 446 309 299 308 + tri 447 310 57 75 + tri 448 310 308 57 + tri 449 57 308 69 + tri 450 308 300 69 + tri 451 309 308 310 + tri 452 311 307 297 + tri 453 311 297 312 + tri 454 73 74 306 + tri 455 313 73 306 + tri 456 314 310 75 + tri 457 315 310 314 + tri 458 315 314 316 + tri 459 317 306 307 + tri 460 317 313 306 + tri 461 307 293 297 + tri 462 315 316 318 + tri 463 315 318 319 + tri 464 319 318 320 + tri 465 315 321 309 + tri 466 315 309 310 + tri 467 321 299 309 + tri 468 322 302 299 + tri 469 321 322 299 + tri 470 319 323 321 + tri 471 305 301 302 + tri 472 322 305 302 + tri 473 315 319 321 + tri 474 321 323 322 + tri 475 326 325 324 + tri 476 326 324 327 + tri 477 329 158 328 + tri 478 331 330 328 + tri 479 330 329 328 + tri 480 158 161 328 + tri 481 324 325 331 + tri 482 325 330 331 + tri 483 325 329 330 + tri 484 332 325 326 + tri 485 332 329 325 + tri 486 168 329 332 + tri 487 168 158 329 + tri 488 85 91 333 + tri 489 334 304 305 + tri 490 335 334 305 + tri 491 337 336 303 + tri 492 312 336 337 + tri 493 337 303 304 + tri 494 334 337 304 + tri 495 323 334 335 + tri 496 340 339 338 + tri 497 339 341 338 + tri 498 344 343 342 + tri 499 342 343 345 + tri 500 339 342 345 + tri 501 339 345 341 + tri 502 348 347 346 + tri 503 348 346 349 + tri 504 347 351 350 + tri 505 347 350 346 + tri 506 338 341 352 + tri 507 338 352 353 + tri 508 341 345 354 + tri 509 341 354 352 + tri 510 343 355 354 + tri 511 343 354 345 + tri 512 356 350 351 + tri 513 358 353 357 + tri 514 353 352 357 + tri 515 357 352 354 + tri 516 357 354 359 + tri 517 358 359 355 + tri 518 355 359 354 + tri 519 358 357 359 + tri 520 362 361 360 + tri 521 362 360 363 + tri 522 340 365 364 + tri 523 340 364 366 + tri 524 361 366 364 + tri 525 361 364 360 + tri 526 369 368 367 + tri 527 369 367 348 + tri 528 368 371 370 + tri 529 368 370 367 + tri 530 363 360 372 + tri 531 372 360 373 + tri 532 360 364 374 + tri 533 360 374 373 + tri 534 365 375 364 + tri 535 375 374 364 + tri 536 371 376 370 + tri 537 377 373 374 + tri 538 377 374 378 + tri 539 379 377 378 + tri 540 382 381 380 + tri 541 381 383 380 + tri 542 380 383 384 + tri 543 385 381 382 + tri 544 382 380 386 + tri 545 385 382 387 + tri 546 390 389 388 + tri 547 385 391 381 + tri 548 387 382 386 + tri 549 393 392 384 + tri 550 344 392 393 + tri 551 393 383 391 + tri 552 393 384 383 + tri 553 381 391 383 + tri 554 344 342 392 + tri 555 340 366 339 + tri 556 395 387 394 + tri 557 397 396 386 + tri 558 397 384 392 + tri 559 397 386 384 + tri 560 386 380 384 + tri 561 397 392 398 + tri 562 342 399 392 + tri 563 398 392 399 + tri 564 339 399 342 + tri 565 361 400 366 + tri 566 401 361 362 + tri 567 401 402 361 + tri 568 404 403 401 + tri 569 403 402 401 + tri 570 405 403 404 + tri 571 405 406 403 + tri 572 402 400 361 + tri 573 402 407 400 + tri 574 403 407 402 + tri 575 406 407 403 + tri 576 409 397 408 + tri 577 408 397 398 + tri 578 406 410 407 + tri 579 413 412 411 + tri 580 414 413 411 + tri 581 417 416 415 + tri 582 415 416 418 + tri 583 420 417 419 + tri 584 417 415 419 + tri 585 422 405 421 + tri 586 421 405 404 + tri 587 421 404 423 + tri 588 404 424 423 + tri 589 426 425 416 + tri 590 426 416 417 + tri 591 427 426 420 + tri 592 420 426 417 + tri 593 428 422 421 + tri 594 428 421 429 + tri 595 429 421 430 + tri 596 421 423 430 + tri 597 427 431 426 + tri 598 428 429 432 + tri 599 429 430 432 + tri 600 426 431 425 + tri 601 404 401 424 + tri 602 415 413 414 + tri 603 433 415 414 + tri 604 419 415 433 + tri 605 435 434 388 + tri 606 389 435 388 + tri 607 395 436 387 + tri 608 387 386 396 + tri 609 394 387 396 + tri 610 395 394 437 + tri 611 437 394 396 + tri 612 439 438 435 + tri 613 437 396 397 + tri 614 440 437 397 + tri 615 349 434 435 + tri 616 441 349 435 + tri 617 441 435 438 + tri 618 441 442 349 + tri 619 443 369 348 + tri 620 443 348 442 + tri 621 442 348 349 + tri 622 418 444 443 + tri 623 444 369 443 + tri 624 413 442 441 + tri 625 415 418 413 + tri 626 413 443 442 + tri 627 418 443 413 + tri 628 409 440 397 + tri 629 413 441 412 + tri 630 297 303 336 + tri 631 312 297 336 + tri 632 323 335 322 + tri 633 322 335 305 + tri 634 372 373 377 + tri 635 372 377 379 + tri 636 379 378 375 + tri 637 375 378 374 + tri 638 169 175 180 + tri 639 169 180 168 + tri 640 180 171 168 + tri 641 179 446 445 + tri 642 179 445 177 + tri 643 445 166 447 + tri 644 445 447 177 + tri 645 177 447 166 + tri 646 366 400 399 + tri 647 366 399 339 + tri 648 36 448 37 + tri 649 36 31 448 + tri 650 22 31 36 + tri 651 85 333 449 + tri 652 449 333 450 + tri 653 451 446 179 + tri 654 452 179 178 + tri 655 451 179 452 + tri 656 455 454 453 + tri 657 455 453 456 + tri 658 176 458 457 + tri 659 176 457 175 + tri 660 175 457 180 + tri 661 457 459 180 + tri 662 462 461 460 + tri 663 462 460 463 + tri 664 466 465 464 + tri 665 466 464 467 + tri 666 467 464 468 + tri 667 467 468 469 + tri 668 471 470 466 + tri 669 470 465 466 + tri 670 470 472 465 + tri 671 465 472 464 + tri 672 472 468 464 + tri 673 475 474 473 + tri 674 476 474 475 + tri 675 476 477 474 + tri 676 480 479 478 + tri 677 480 473 479 + tri 678 481 480 478 + tri 679 480 475 473 + tri 680 476 475 480 + tri 681 482 476 480 + tri 682 482 480 481 + tri 683 485 484 483 + tri 684 484 486 483 + tri 685 484 487 486 + tri 686 489 485 488 + tri 687 485 483 488 + tri 688 486 487 490 + tri 689 486 490 491 + tri 690 492 486 491 + tri 691 483 486 492 + tri 692 488 483 493 + tri 693 483 494 493 + tri 694 492 491 495 + tri 695 492 495 496 + tri 696 495 497 496 + tri 697 495 498 497 + tri 698 501 500 499 + tri 699 498 501 499 + tri 700 495 501 498 + tri 701 501 502 500 + tri 702 502 503 500 + tri 703 504 502 501 + tri 704 495 504 501 + tri 705 485 505 484 + tri 706 489 505 485 + tri 707 507 506 489 + tri 708 489 506 505 + tri 709 484 505 487 + tri 710 506 487 505 + tri 711 506 508 487 + tri 712 490 509 495 + tri 713 491 490 495 + tri 714 490 510 509 + tri 715 490 511 510 + tri 716 490 512 511 + tri 717 487 512 490 + tri 718 508 512 487 + tri 719 508 511 512 + tri 720 41 494 40 + tri 721 494 496 40 + tri 722 492 496 494 + tri 723 41 42 494 + tri 724 493 494 42 + tri 725 507 489 513 + tri 726 513 489 514 + tri 727 488 493 515 + tri 728 488 515 514 + tri 729 514 515 516 + tri 730 47 493 42 + tri 731 47 516 515 + tri 732 513 514 516 + tri 733 48 516 47 + tri 734 48 513 516 + tri 735 47 515 493 + tri 736 519 518 517 + tri 737 519 520 518 + tri 738 517 518 506 + tri 739 506 518 508 + tri 740 521 519 517 + tri 741 521 522 519 + tri 742 507 521 506 + tri 743 521 517 506 + tri 744 525 524 523 + tri 745 525 526 524 + tri 746 526 527 524 + tri 747 529 482 528 + tri 748 530 482 529 + tri 749 530 531 482 + tri 750 532 530 529 + tri 751 532 529 533 + tri 752 532 533 534 + tri 753 531 476 482 + tri 754 530 535 531 + tri 755 525 537 536 + tri 756 508 538 511 + tri 757 508 518 538 + tri 758 525 523 537 + tri 759 536 537 539 + tri 760 518 540 538 + tri 761 541 532 534 + tri 762 532 542 530 + tri 763 541 542 532 + tri 764 542 535 530 + tri 765 525 543 526 + tri 766 531 477 476 + tri 767 531 544 477 + tri 768 545 477 544 + tri 769 546 477 545 + tri 770 477 547 474 + tri 771 547 479 474 + tri 772 473 474 479 + tri 773 550 549 548 + tri 774 550 500 549 + tri 775 83 498 550 + tri 776 553 552 551 + tri 777 549 552 553 + tri 778 556 555 554 + tri 779 555 557 554 + tri 780 548 559 558 + tri 781 556 560 555 + tri 782 555 561 557 + tri 783 564 563 562 + tri 784 566 565 561 + tri 785 548 553 559 + tri 786 553 551 559 + tri 787 561 565 100 + tri 788 557 561 100 + tri 789 568 548 567 + tri 790 548 558 567 + tri 791 569 568 567 + tri 792 105 569 104 + tri 793 569 567 104 + tri 794 83 568 106 + tri 795 106 568 569 + tri 796 106 569 105 + tri 797 83 570 498 + tri 798 108 570 83 + tri 799 40 497 108 + tri 800 40 496 497 + tri 801 108 497 570 + tri 802 497 498 570 + tri 803 111 571 110 + tri 804 112 110 571 + tri 805 113 112 571 + tri 806 113 571 572 + tri 807 572 562 563 + tri 808 566 561 562 + tri 809 560 562 561 + tri 810 573 562 572 + tri 811 573 566 562 + tri 812 573 574 566 + tri 813 574 565 566 + tri 814 572 111 574 + tri 815 573 572 574 + tri 816 574 111 100 + tri 817 574 100 565 + tri 818 575 563 564 + tri 819 575 572 563 + tri 820 555 560 561 + tri 821 549 553 548 + tri 822 577 564 576 + tri 823 576 564 578 + tri 824 579 576 578 + tri 825 564 562 560 + tri 826 556 564 560 + tri 827 123 122 575 + tri 828 580 575 577 + tri 829 577 575 564 + tri 830 581 578 564 + tri 831 581 579 578 + tri 832 477 582 547 + tri 833 581 564 556 + tri 834 546 582 477 + tri 835 583 579 581 + tri 836 584 579 583 + tri 837 577 576 579 + tri 838 585 575 580 + tri 839 585 580 577 + tri 840 585 577 586 + tri 841 587 585 586 + tri 842 586 577 579 + tri 843 584 586 579 + tri 844 587 586 584 + tri 845 539 546 545 + tri 846 540 584 583 + tri 847 518 584 540 + tri 848 588 585 587 + tri 849 520 588 587 + tri 850 536 539 589 + tri 851 589 539 545 + tri 852 589 545 544 + tri 853 522 590 519 + tri 854 519 590 520 + tri 855 590 588 520 + tri 856 590 591 588 + tri 857 522 592 590 + tri 858 522 593 592 + tri 859 590 592 591 + tri 860 591 585 588 + tri 861 594 593 521 + tri 862 521 593 522 + tri 863 597 596 595 + tri 864 595 596 594 + tri 865 48 598 513 + tri 866 598 507 513 + tri 867 143 598 48 + tri 868 145 123 599 + tri 869 585 599 575 + tri 870 599 123 575 + tri 871 600 145 599 + tri 872 147 145 600 + tri 873 572 571 111 + tri 874 591 601 585 + tri 875 601 599 585 + tri 876 601 600 599 + tri 877 592 601 591 + tri 878 150 601 149 + tri 879 592 149 601 + tri 880 596 593 594 + tri 881 151 149 592 + tri 882 593 151 592 + tri 883 602 596 597 + tri 884 483 492 494 + tri 885 147 600 601 + tri 886 150 147 601 + tri 887 603 153 154 + tri 888 156 153 603 + tri 889 602 603 596 + tri 890 154 151 593 + tri 891 603 154 593 + tri 892 602 156 603 + tri 893 602 157 156 + tri 894 489 488 514 + tri 895 83 550 568 + tri 896 550 548 568 + tri 897 605 604 159 + tri 898 604 161 159 + tri 899 606 605 162 + tri 900 164 606 162 + tri 901 162 605 159 + tri 902 166 607 164 + tri 903 610 609 608 + tri 904 610 170 609 + tri 905 613 612 611 + tri 906 174 170 610 + tri 907 174 610 614 + tri 908 174 614 176 + tri 909 607 606 164 + tri 910 611 605 606 + tri 911 615 607 166 + tri 912 607 611 606 + tri 913 613 611 607 + tri 914 615 613 607 + tri 915 617 616 615 + tri 916 616 613 615 + tri 917 520 587 584 + tri 918 520 584 518 + tri 919 498 499 550 + tri 920 550 499 500 + tri 921 618 612 613 + tri 922 618 613 616 + tri 923 612 604 605 + tri 924 612 605 611 + tri 925 608 604 612 + tri 926 575 113 572 + tri 927 122 113 575 + tri 928 621 620 619 + tri 929 621 622 620 + tri 930 620 623 619 + tri 931 619 623 624 + tri 932 623 626 625 + tri 933 623 625 624 + tri 934 621 627 622 + tri 935 629 628 627 + tri 936 630 627 621 + tri 937 630 621 631 + tri 938 633 632 626 + tri 939 635 634 633 + tri 940 635 636 634 + tri 941 622 633 620 + tri 942 622 635 633 + tri 943 627 635 622 + tri 944 620 633 623 + tri 945 633 626 623 + tri 946 628 637 635 + tri 947 628 635 627 + tri 948 640 639 638 + tri 949 639 641 638 + tri 950 638 631 642 + tri 951 643 637 628 + tri 952 646 645 644 + tri 953 649 648 647 + tri 954 652 651 650 + tri 955 653 651 652 + tri 956 656 655 654 + tri 957 654 655 657 + tri 958 647 648 651 + tri 959 660 659 658 + tri 960 658 659 661 + tri 961 658 661 662 + tri 962 649 662 648 + tri 963 653 647 651 + tri 964 656 663 655 + tri 965 666 665 664 + tri 966 667 666 664 + tri 967 670 669 668 + tri 968 648 662 671 + tri 969 650 671 672 + tri 970 650 672 673 + tri 971 675 674 640 + tri 972 675 640 676 + tri 973 677 669 670 + tri 974 677 667 669 + tri 975 667 664 669 + tri 976 640 638 642 + tri 977 678 643 665 + tri 978 665 643 664 + tri 979 679 671 662 + tri 980 672 671 679 + tri 981 660 673 659 + tri 982 656 681 680 + tri 983 656 682 681 + tri 984 656 654 682 + tri 985 684 650 683 + tri 986 683 650 673 + tri 987 660 683 673 + tri 988 649 658 662 + tri 989 637 636 635 + tri 990 625 686 685 + tri 991 686 687 685 + tri 992 634 689 688 + tri 993 691 685 690 + tri 994 685 687 690 + tri 995 688 690 687 + tri 996 689 692 688 + tri 997 638 630 631 + tri 998 638 693 630 + tri 999 641 693 638 + tri 1000 696 695 694 + tri 1001 691 690 697 + tri 1002 699 698 143 + tri 1003 626 686 625 + tri 1004 700 691 697 + tri 1005 702 696 701 + tri 1006 696 694 701 + tri 1007 636 701 634 + tri 1008 265 699 143 + tri 1009 703 699 265 + tri 1010 634 688 687 + tri 1011 704 643 628 + tri 1012 633 634 632 + tri 1013 626 632 686 + tri 1014 705 268 269 + tri 1015 706 271 689 + tri 1016 694 271 706 + tri 1017 701 694 706 + tri 1018 701 706 634 + tri 1019 706 689 634 + tri 1020 632 707 686 + tri 1021 707 687 686 + tri 1022 634 687 707 + tri 1023 634 707 632 + tri 1024 268 703 265 + tri 1025 705 703 268 + tri 1026 702 701 636 + tri 1027 630 629 627 + tri 1028 650 651 671 + tri 1029 648 671 651 + tri 1030 674 670 640 + tri 1031 708 639 640 + tri 1032 670 708 640 + tri 1033 670 668 708 + tri 1034 668 709 708 + tri 1035 668 669 709 + tri 1036 669 664 709 + tri 1037 709 710 639 + tri 1038 708 709 639 + tri 1039 664 710 709 + tri 1040 664 643 710 + tri 1041 710 643 704 + tri 1042 621 619 711 + tri 1043 631 621 711 + tri 1044 712 696 702 + tri 1045 684 652 650 + tri 1046 675 713 674 + tri 1047 713 677 670 + tri 1048 713 670 674 + tri 1049 714 665 666 + tri 1050 714 678 665 + tri 1051 714 715 678 + tri 1052 675 676 716 + tri 1053 710 704 717 + tri 1054 639 710 717 + tri 1055 639 717 641 + tri 1056 641 717 693 + tri 1057 717 704 693 + tri 1058 698 598 143 + tri 1059 698 595 598 + tri 1060 688 718 690 + tri 1061 688 692 718 + tri 1062 271 692 689 + tri 1063 271 285 692 + tri 1064 625 685 719 + tri 1065 624 625 719 + tri 1066 624 719 700 + tri 1067 719 691 700 + tri 1068 719 685 691 + tri 1069 594 521 507 + tri 1070 595 507 598 + tri 1071 595 594 507 + tri 1072 596 603 593 + tri 1073 646 720 645 + tri 1074 720 702 645 + tri 1075 720 712 702 + tri 1076 631 711 721 + tri 1077 642 631 721 + tri 1078 637 702 636 + tri 1079 644 722 643 + tri 1080 643 722 637 + tri 1081 722 702 637 + tri 1082 645 702 722 + tri 1083 644 645 722 + tri 1084 723 640 642 + tri 1085 676 640 723 + tri 1086 724 646 644 + tri 1087 678 644 643 + tri 1088 715 724 678 + tri 1089 678 724 644 + tri 1090 693 629 630 + tri 1091 704 629 693 + tri 1092 704 628 629 + tri 1093 726 725 535 + tri 1094 729 728 727 + tri 1095 726 727 725 + tri 1096 727 728 725 + tri 1097 730 727 726 + tri 1098 729 731 728 + tri 1099 535 725 728 + tri 1100 535 731 531 + tri 1101 731 544 531 + tri 1102 732 731 729 + tri 1103 535 728 731 + tri 1104 731 589 544 + tri 1105 536 589 733 + tri 1106 733 589 731 + tri 1107 730 734 727 + tri 1108 734 735 727 + tri 1109 729 727 735 + tri 1110 730 736 734 + tri 1111 737 734 736 + tri 1112 738 734 737 + tri 1113 740 726 739 + tri 1114 739 726 542 + tri 1115 542 726 535 + tri 1116 732 729 735 + tri 1117 732 733 731 + tri 1118 732 741 733 + tri 1119 742 741 732 + tri 1120 743 543 525 + tri 1121 743 525 741 + tri 1122 525 536 741 + tri 1123 741 536 733 + tri 1124 742 743 741 + tri 1125 744 730 740 + tri 1126 744 745 730 + tri 1127 541 739 542 + tri 1128 746 739 541 + tri 1129 747 543 743 + tri 1130 748 747 743 + tri 1131 748 749 747 + tri 1132 750 740 739 + tri 1133 750 739 746 + tri 1134 740 730 726 + tri 1135 748 751 749 + tri 1136 748 752 751 + tri 1137 752 753 751 + tri 1138 748 742 754 + tri 1139 748 743 742 + tri 1140 754 742 732 + tri 1141 755 732 735 + tri 1142 754 732 755 + tri 1143 752 754 756 + tri 1144 738 735 734 + tri 1145 755 735 738 + tri 1146 748 754 752 + tri 1147 754 755 756 + tri 1148 758 324 757 + tri 1149 758 327 324 + tri 1150 759 328 604 + tri 1151 331 328 760 + tri 1152 760 328 759 + tri 1153 604 328 161 + tri 1154 324 331 757 + tri 1155 757 331 760 + tri 1156 757 760 759 + tri 1157 761 758 757 + tri 1158 761 757 759 + tri 1159 608 761 759 + tri 1160 608 759 604 + tri 1161 551 762 559 + tri 1162 763 738 737 + tri 1163 764 738 763 + tri 1164 766 736 765 + tri 1165 745 766 765 + tri 1166 766 737 736 + tri 1167 763 737 766 + tri 1168 756 764 763 + tri 1169 769 768 767 + tri 1170 767 768 770 + tri 1171 773 772 771 + tri 1172 772 774 771 + tri 1173 767 774 772 + tri 1174 767 770 774 + tri 1175 777 776 775 + tri 1176 777 778 776 + tri 1177 775 780 779 + tri 1178 775 776 780 + tri 1179 768 781 770 + tri 1180 768 782 781 + tri 1181 770 783 774 + tri 1182 770 781 783 + tri 1183 771 783 784 + tri 1184 771 774 783 + tri 1185 785 779 780 + tri 1186 787 786 782 + tri 1187 782 786 781 + tri 1188 786 783 781 + tri 1189 786 788 783 + tri 1190 787 784 788 + tri 1191 784 783 788 + tri 1192 787 788 786 + tri 1193 791 790 789 + tri 1194 791 792 790 + tri 1195 769 794 793 + tri 1196 769 795 794 + tri 1197 789 794 795 + tri 1198 789 790 794 + tri 1199 798 797 796 + tri 1200 798 777 797 + tri 1201 796 800 799 + tri 1202 796 797 800 + tri 1203 792 801 790 + tri 1204 801 802 790 + tri 1205 790 803 794 + tri 1206 790 802 803 + tri 1207 793 794 804 + tri 1208 804 794 803 + tri 1209 799 800 805 + tri 1210 806 803 802 + tri 1211 806 807 803 + tri 1212 808 807 806 + tri 1213 811 810 809 + tri 1214 809 810 812 + tri 1215 810 813 812 + tri 1216 814 811 809 + tri 1217 811 815 810 + tri 1218 814 816 811 + tri 1219 819 818 817 + tri 1220 814 809 820 + tri 1221 816 815 811 + tri 1222 822 813 821 + tri 1223 773 822 821 + tri 1224 822 820 812 + tri 1225 822 812 813 + tri 1226 809 812 820 + tri 1227 773 821 772 + tri 1228 769 767 795 + tri 1229 824 823 816 + tri 1230 826 815 825 + tri 1231 826 821 813 + tri 1232 826 813 815 + tri 1233 815 813 810 + tri 1234 826 827 821 + tri 1235 772 821 828 + tri 1236 827 828 821 + tri 1237 767 772 828 + tri 1238 789 795 829 + tri 1239 830 791 789 + tri 1240 830 789 831 + tri 1241 833 830 832 + tri 1242 832 830 831 + tri 1243 834 833 832 + tri 1244 834 832 835 + tri 1245 831 789 829 + tri 1246 831 829 836 + tri 1247 832 831 836 + tri 1248 835 832 836 + tri 1249 838 837 826 + tri 1250 837 827 826 + tri 1251 835 836 839 + tri 1252 842 841 840 + tri 1253 843 841 842 + tri 1254 846 845 844 + tri 1255 845 847 844 + tri 1256 849 848 846 + tri 1257 846 848 845 + tri 1258 851 850 834 + tri 1259 850 833 834 + tri 1260 850 852 833 + tri 1261 833 852 853 + tri 1262 855 844 854 + tri 1263 855 846 844 + tri 1264 856 849 855 + tri 1265 849 846 855 + tri 1266 857 850 851 + tri 1267 857 858 850 + tri 1268 858 859 850 + tri 1269 850 859 852 + tri 1270 856 855 860 + tri 1271 857 861 858 + tri 1272 858 861 859 + tri 1273 855 854 860 + tri 1274 833 853 830 + tri 1275 845 843 842 + tri 1276 862 843 845 + tri 1277 848 862 845 + tri 1278 864 818 863 + tri 1279 817 818 864 + tri 1280 824 816 865 + tri 1281 816 825 815 + tri 1282 823 825 816 + tri 1283 824 866 823 + tri 1284 866 825 823 + tri 1285 868 864 867 + tri 1286 866 826 825 + tri 1287 869 826 866 + tri 1288 778 864 863 + tri 1289 870 864 778 + tri 1290 870 867 864 + tri 1291 870 778 871 + tri 1292 872 777 798 + tri 1293 872 871 777 + tri 1294 871 778 777 + tri 1295 847 872 873 + tri 1296 873 872 798 + tri 1297 842 870 871 + tri 1298 845 842 847 + tri 1299 842 871 872 + tri 1300 847 842 872 + tri 1301 838 826 869 + tri 1302 842 840 870 + tri 1303 730 765 736 + tri 1304 745 765 730 + tri 1305 756 755 764 + tri 1306 755 738 764 + tri 1307 801 806 802 + tri 1308 801 808 806 + tri 1309 808 804 807 + tri 1310 804 803 807 + tri 1311 610 618 614 + tri 1312 610 608 618 + tri 1313 618 608 612 + tri 1314 617 445 446 + tri 1315 617 615 445 + tri 1316 445 447 166 + tri 1317 445 615 447 + tri 1318 615 166 447 + tri 1319 795 828 829 + tri 1320 795 767 828 + tri 1321 509 510 874 + tri 1322 509 874 504 + tri 1323 495 509 504 + tri 1324 551 449 762 + tri 1325 449 450 762 + tri 1326 875 617 446 + tri 1327 876 616 617 + tri 1328 875 876 617 + tri 1329 879 878 877 + tri 1330 879 880 878 + tri 1331 176 881 458 + tri 1332 176 614 881 + tri 1333 614 618 881 + tri 1334 881 618 882 + tri 1335 885 884 883 + tri 1336 885 886 884 + tri 1337 889 888 887 + tri 1338 889 890 888 + tri 1339 890 468 888 + tri 1340 890 469 468 + tri 1341 471 889 470 + tri 1342 470 889 887 + tri 1343 470 887 472 + tri 1344 887 888 472 + tri 1345 472 888 468 + + numweights 1401 + weight 0 47 1 ( 1.5918749571 -0.9465401769 4.3310847282 ) + weight 1 47 1 ( 1.6758500338 -1.577014327 4.0544595718 ) + weight 2 47 1 ( -1.5918749571 -0.9465401769 4.3310847282 ) + weight 3 47 1 ( -1.6758500338 -1.577014327 4.0544595718 ) + weight 4 13 0.053187836 ( 8.4481897354 3.2544219494 6.9728450775 ) + weight 5 14 0.4734061062 ( 5.2661533356 -1.6828705072 0.4450342655 ) + weight 6 15 0.4734061062 ( -1.2594890594 2.9372439384 0.3122821152 ) + weight 7 14 0.5 ( 4.4865937233 -0.5485437512 2.8395075798 ) + weight 8 15 0.5 ( -0.6507510543 1.9244441986 -2.1840326786 ) + weight 9 15 1 ( 5.4889202118 -1.1939901114 0.0387593247 ) + weight 10 17 0.7487224936 ( 4.1981225014 1.0838154554 0.8668574691 ) + weight 11 18 0.2512775064 ( -0.2796498835 -0.85005337 -1.3222959042 ) + weight 12 13 0.0615583919 ( 6.9452548027 5.4839982986 0.9795920253 ) + weight 13 14 0.4294690788 ( 1.6521060467 3.3780589104 2.5603511333 ) + weight 14 15 0.1900289804 ( 0.631133616 -2.7499701977 -2.3765933514 ) + weight 15 17 0.3189435899 ( -0.4228499234 1.9056279659 -2.3026473522 ) + weight 16 15 0.7028055191 ( 3.4897100925 -2.3128495216 0.6414083838 ) + weight 17 16 0.0632485002 ( -2.4303045273 -1.7097656727 -1.533432126 ) + weight 18 17 0.2339460105 ( 2.3406567574 2.7574291229 0.7153545022 ) + weight 19 13 1 ( 2.5890426636 0.9712347984 0.6955299973 ) + weight 20 14 0.5 ( -1.4184651375 5.0567121506 0.8234506249 ) + weight 21 17 0.5 ( -0.6260279417 -1.7949299812 -1.0666476488 ) + weight 22 14 0.5 ( -1.3168833256 5.1115264893 -1.7182623148 ) + weight 23 17 0.5 ( -0.6990675926 -2.0803804398 1.4605665207 ) + weight 24 12 0.1611201018 ( 27.9446182251 -2.7854254246 2.1179125309 ) + weight 25 13 0.8388799429 ( 3.1051416397 0.575112164 -1.5763118267 ) + weight 26 12 0.0601770245 ( 31.6341896057 -1.9060554504 2.9381074905 ) + weight 27 13 0.5841425061 ( 6.2316036224 -1.6949044466 -1.214058876 ) + weight 28 14 0.3033334315 ( -4.350912571 0.0375959501 -0.5482037067 ) + weight 29 17 0.0523469523 ( -6.5181436539 -1.949338913 -0.1015867963 ) + weight 30 5 0.0853635073 ( 6.8468904495 3.6976914406 5.5451822281 ) + weight 31 6 0.4573182464 ( 5.2122297287 -0.5132954717 2.3583621979 ) + weight 32 7 0.4573182464 ( -0.495713681 3.396679163 -1.5696406364 ) + weight 33 5 0.0840295702 ( 8.7717876434 2.2822639942 6.4198098183 ) + weight 34 6 0.4579852223 ( 5.6759700775 -0.7160676718 -0.1351220459 ) + weight 35 7 0.4579852223 ( -0.5821356177 3.5710999966 0.96723634 ) + weight 36 4 0.0821894556 ( 27.8181304932 -1.7949742079 -1.1694817543 ) + weight 37 5 0.9178105593 ( 2.4283726215 1.1873240471 1.6665122509 ) + weight 38 5 0.6676149368 ( 5.4009561539 -1.672555089 3.3675887585 ) + weight 39 6 0.3323850632 ( 0.2716099322 -3.3065977097 0.4982741773 ) + weight 40 7 0.5 ( 6.3368601799 -0.1076524705 -0.7284914255 ) + weight 41 8 0.5 ( 0.3947378397 0.2946861386 0.3103610575 ) + weight 42 7 0.5402719378 ( 5.1529350281 2.6981573105 0.1341468841 ) + weight 43 8 0.4597280324 ( 1.9520330429 -2.3932673931 -0.2963772118 ) + weight 44 6 0.3959079087 ( 3.5102162361 2.8287758827 3.452352047 ) + weight 45 7 0.6040921211 ( 1.1508774757 0.1306394041 -2.9425301552 ) + weight 46 7 1 ( 4.1347055435 0.4154888988 -0.0293651782 ) + weight 47 4 0.0706800967 ( 28.3183269501 -2.2837436199 1.0878134966 ) + weight 48 5 0.9293199182 ( 3.2922086716 1.5207448006 -0.5076752305 ) + weight 49 6 0.3453502953 ( -0.8724885583 6.4404673576 0.1513461918 ) + weight 50 9 0.6546496749 ( 1.2548179626 -1.0199227333 -0.3463726938 ) + weight 51 6 0.3758432567 ( -0.1918802857 5.8881764412 2.7704436779 ) + weight 52 9 0.6241567135 ( 1.2947156429 0.1939728111 -2.8268544674 ) + weight 53 12 0.2124085128 ( 26.8055114746 -4.070306778 -1.0478919744 ) + weight 54 13 0.7875914574 ( 1.6918153763 2.5464425087 1.0858620405 ) + weight 55 12 0.6253005266 ( 24.6087245941 -3.1580626965 0.6038689017 ) + weight 56 13 0.374699533 ( -0.1082467362 2.3272726536 -1.1720380783 ) + weight 57 12 0.4979476035 ( 26.1836776733 -0.9200876951 2.9216632843 ) + weight 58 13 0.5020523667 ( 1.0726652145 -0.5859983563 -2.8981552124 ) + weight 59 4 0.5886960626 ( 24.7740364075 -2.408575058 -0.4452747703 ) + weight 60 5 0.4113039672 ( -0.0128848245 3.0426537991 0.7915845513 ) + weight 61 4 0.4728768468 ( 26.312877655 0.1611661017 -2.4174807072 ) + weight 62 5 0.5271231532 ( 0.1434828043 -0.0170211941 2.6557555199 ) + weight 63 4 0.2854039669 ( 27.2705039978 -3.570245266 1.9158481359 ) + weight 64 5 0.6396251917 ( 2.9475605488 3.1610751152 -1.3008930683 ) + weight 65 6 0.0749708563 ( -1.6356470585 0.7260810733 6.0909228325 ) + weight 66 12 1 ( 15.9022769928 -1.0461764336 0.1106846035 ) + weight 67 4 1 ( 15.9783229828 -0.7058268189 0.0462598726 ) + weight 68 12 1 ( 11.8548564911 -3.2612600327 0.0844356939 ) + weight 69 12 1 ( 10.7426919937 -1.8521358967 -0.2785775065 ) + weight 70 12 1 ( 11.7758760452 -2.4535136223 -2.0854225159 ) + weight 71 12 1 ( 11.1056470871 -0.3666875958 1.7613815069 ) + weight 72 4 1 ( 11.2005519867 -0.0056098253 -1.649836421 ) + weight 73 4 1 ( 12.026263237 -3.0578436852 -0.3254128695 ) + weight 74 4 1 ( 10.8482265472 -1.7486162186 0.1770529151 ) + weight 75 4 1 ( 11.8598070145 -2.533162117 1.9249126911 ) + weight 76 12 1 ( 6.0867600441 -1.6896793842 -1.7174838781 ) + weight 77 12 1 ( 5.939453125 -2.0253684521 0.2332832664 ) + weight 78 12 1 ( 4.020611763 0.2968726158 3.5981557369 ) + weight 79 4 1 ( 6.0705180168 -2.0373017788 -0.4962054491 ) + weight 80 4 1 ( 4.1423454285 0.6158214211 -3.6010718346 ) + weight 81 4 1 ( 6.1550211906 -1.9444662333 1.4847310781 ) + weight 82 11 0.44023633 ( 25.6103229523 -0.3287914395 -3.7324855328 ) + weight 83 12 0.55976367 ( 1.4012981653 -1.2112002373 -3.9970128536 ) + weight 84 11 0.5261281133 ( 23.2936515808 -1.613378644 2.2243275642 ) + weight 85 12 0.4738718569 ( -1.1678849459 -1.8399035931 1.9615757465 ) + weight 86 11 0.6838532686 ( 21.8507728577 -2.567274332 -0.7070226669 ) + weight 87 12 0.3161467016 ( -2.813308239 -2.379347086 -0.9686493874 ) + weight 88 11 0.4959532022 ( 25.0810661316 -3.0262124538 -0.564443469 ) + weight 89 12 0.5040467978 ( 0.1817469001 -3.6738395691 -0.8282930851 ) + weight 90 11 0.7535571456 ( 21.9286689758 0.6332171559 2.5199785233 ) + weight 91 12 0.2464428693 ( -1.8919529915 0.6870872378 2.2579329014 ) + weight 92 3 0.5178353786 ( 23.2522373199 -0.039865531 -2.9057381153 ) + weight 93 4 0.4821645916 ( -0.9930627942 -1.9281506538 -2.38931036 ) + weight 94 3 0.6677844524 ( 21.8719787598 -1.417304039 -0.1060412601 ) + weight 95 4 0.3322155178 ( -2.6876761913 -2.9062848091 0.4057363868 ) + weight 96 3 0.4972632229 ( 25.1040668488 -1.7163251638 -0.3420876563 ) + weight 97 4 0.5027367473 ( 0.3609082401 -4.0224943161 0.1782921702 ) + weight 98 3 0.7104444504 ( 21.811756134 2.1975412369 -2.9111247063 ) + weight 99 4 0.2895555496 ( -1.8129787445 0.6033856273 -2.3971800804 ) + weight 100 3 0.446364224 ( 25.5818843842 0.5703861713 3.1414940357 ) + weight 101 4 0.553635776 ( 1.3982713223 -1.9339448214 3.6646277905 ) + weight 102 11 1 ( 17.3874206543 -2.4439070225 -4.1909017563 ) + weight 103 11 1 ( 19.4429759979 -4.9851694107 1.6527723074 ) + weight 104 11 1 ( 16.6395587921 -1.6049283743 3.0770223141 ) + weight 105 3 1 ( 16.5977191925 -0.1014638767 -3.7165145874 ) + weight 106 3 1 ( 19.5340309143 -3.6067090034 -2.7237975597 ) + weight 107 3 1 ( 17.3854560852 -1.8722593784 3.3556091785 ) + weight 108 11 1 ( 10.8868865967 -6.7459335327 1.1776483059 ) + weight 109 3 1 ( 11.0142002106 -5.6325101852 -2.4598770142 ) + weight 110 11 1 ( 6.0520648956 -7.3734288216 -2.1165277958 ) + weight 111 2 0.155758068 ( 0.0225959271 -11.9973735809 -2.18385005 ) + weight 112 11 0.4663512409 ( 4.2098612785 -0.5591109991 4.9811387062 ) + weight 113 3 0.3778907359 ( 4.085129261 0.3075269461 -5.3351268768 ) + weight 114 3 1 ( 6.226858139 -6.8359003067 0.7576401234 ) + weight 115 11 1 ( 5.5991148949 -3.3546543121 -5.3993344307 ) + weight 116 11 1 ( 1.9934148788 -3.6342060566 -2.676869154 ) + weight 117 11 1 ( 2.0487115383 -1.6355319023 -3.8487095833 ) + weight 118 2 0.316247046 ( 0.0225959271 -10.1363353729 2.8364374638 ) + weight 119 11 0.3584067822 ( 3.1888957024 -5.8143692017 4.8996477127 ) + weight 120 3 0.3253461719 ( 3.3694503307 -4.9728798866 -5.8565268517 ) + weight 121 11 1 ( 3.4229240417 -4.814221859 2.8404312134 ) + weight 122 11 1 ( 2.6637368202 -5.8190793991 -0.4367515743 ) + weight 123 2 0.200000003 ( -2.6205668449 -5.8852128983 2.3104748726 ) + weight 124 11 0.8000000119 ( -0.8292854428 -5.9898080826 1.873357892 ) + weight 125 11 1 ( 0.7808116674 -6.703142643 0.7876654863 ) + weight 126 2 0.3315732479 ( 2.092133522 -10.3415222168 1.8513749838 ) + weight 127 11 0.1196316853 ( 3.0411221981 -4.8039560318 6.9618468285 ) + weight 128 3 0.548795104 ( 3.594884634 -4.2077159882 -3.6980230808 ) + weight 129 3 1 ( 2.9731080532 -5.631746769 -0.5497601032 ) + weight 130 2 0.5014616251 ( 2.6657583714 -5.8852128983 2.3104748726 ) + weight 131 11 0.0887071341 ( -1.3169134855 -5.9766969681 7.13712883 ) + weight 132 3 0.4098312259 ( -0.5585843921 -5.7401132584 -2.8041698933 ) + weight 133 3 1 ( 1.1152558327 -6.4777898788 -1.8376920223 ) + weight 134 3 1 ( 5.6206140518 -3.310931921 4.5146589279 ) + weight 135 3 1 ( 2.2323229313 -3.7672386169 1.9434252977 ) + weight 136 2 0.4008542597 ( 9.0259542465 -8.9648418427 -1.6588504314 ) + weight 137 3 0.5991457105 ( 2.3039045334 -1.9154121876 3.7433154583 ) + weight 138 2 0.200000003 ( -8.4313907623 -4.2338733673 1.4430127144 ) + weight 139 11 0.8000000119 ( -2.0555427074 -5.4154109955 -4.0773949623 ) + weight 140 21 0.2000620514 ( 0 -4.627289772 6.8499207497 ) + weight 141 2 0.7999379635 ( 0.0225959271 -0.1411370933 1.1559374332 ) + weight 142 2 1 ( 0.0225959271 -2.4174098969 2.1181750298 ) + weight 143 2 0.7035011649 ( -5.5259790421 -0.7542257309 -2.4487373829 ) + weight 144 11 0.2964988351 ( -6.3690209389 -2.1308312416 -1.5673086643 ) + weight 145 21 0.1011939198 ( -2.9804124832 -4.4355010986 6.1831336021 ) + weight 146 2 0.8988060355 ( -2.9578166008 0.0506515801 0.4891499877 ) + weight 147 2 0.200000003 ( -5.1491789818 -4.249461174 2.5607750416 ) + weight 148 11 0.8000000119 ( -2.1631352901 -6.5077753067 -0.7883653641 ) + weight 149 2 0.7011694312 ( -4.3949165344 -4.1122465134 0.211800009 ) + weight 150 11 0.2988305986 ( -2.7455039024 -4.2100992203 -0.0905433968 ) + weight 151 2 0.6000000238 ( 5.5711708069 -0.7542257309 -2.4487373829 ) + weight 152 3 0.400000006 ( -6.2266879082 -2.6470460892 1.1611907482 ) + weight 153 21 0.100283742 ( 2.9804124832 -4.4355010986 6.1831336021 ) + weight 154 2 0.8094608784 ( 3.0030083656 0.0506515801 0.4891499877 ) + weight 155 3 0.0902553648 ( -6.6679382324 -5.3812556267 -1.7030479908 ) + weight 156 2 0.3000000119 ( 5.1943712234 -4.249461174 2.5607750416 ) + weight 157 3 0.6999999881 ( -1.7965431213 -6.6439666748 -0.19980371 ) + weight 158 2 0.75 ( 4.4401082993 -4.1122465134 0.211800009 ) + weight 159 3 0.25 ( -2.5262258053 -4.3194832802 -0.6118287444 ) + weight 160 2 0.200000003 ( 8.4765834808 -4.2338733673 1.4430127144 ) + weight 161 3 0.8000000119 ( -1.6731982231 -5.9384698868 3.1927781105 ) + weight 162 68 1 ( -1.0395760536 0.1000350341 0.9358190298 ) + weight 163 67 0.4616160095 ( -2.89077425 -0.2625672221 2.8819909096 ) + weight 164 68 0.5383840203 ( 0.0027371221 -0.2766872048 0.7218831778 ) + weight 165 68 1 ( -1.4338085651 -0.4351946115 0.0209905468 ) + weight 166 67 0.4760879278 ( -3.2765827179 -0.9459189177 1.8811788559 ) + weight 167 68 0.5239120722 ( -0.3830712736 -0.9600389004 -0.2789289057 ) + weight 168 68 0.4535934627 ( -2.7274606228 0.7459554672 -0.6416669488 ) + weight 169 69 0.4927748442 ( 0.1111897677 0.6066168547 -1.5777660608 ) + weight 170 70 0.0536316484 ( 2.2429513931 -1.2223278284 -0.9344015121 ) + weight 171 67 0.3018705547 ( -4.4608612061 0.7101285458 0.8618986607 ) + weight 172 68 0.5631368756 ( -1.5673499107 0.6960085034 -1.2982091904 ) + weight 173 69 0.1349925399 ( 1.2713004351 0.5566698909 -2.2343082428 ) + weight 174 68 0.5701111555 ( -2.1352438927 1.5202844143 0.6470522881 ) + weight 175 69 0.4298888147 ( 0.7034062743 1.3809456825 -0.2890468538 ) + weight 176 68 0.3942388296 ( -3.4299592972 -0.1460768878 0.3467696607 ) + weight 177 69 0.6057611704 ( -0.591309011 -0.2854155302 -0.5893294215 ) + weight 178 68 0.4613237977 ( -2.9241416454 0.6859830022 1.6594445705 ) + weight 179 69 0.5386762023 ( -0.08549124 0.5466443896 0.7233453989 ) + weight 180 69 0.7539294362 ( -1.2403182983 1.5594754219 -1.1925787926 ) + weight 181 70 0.2460705638 ( 0.8914432526 -0.269469291 -0.5492142439 ) + weight 182 69 0.7581167817 ( -0.8320684433 2.0295872688 -0.4538404942 ) + weight 183 70 0.2418832779 ( 1.2996931076 0.200642705 0.1895240396 ) + weight 184 69 0.8665252328 ( -1.9434342384 1.1999920607 -0.7391021848 ) + weight 185 70 0.1334747821 ( 0.1883274913 -0.6289525032 -0.0957376659 ) + weight 186 69 0.7573544383 ( -1.6176607609 1.7227889299 0.1443075538 ) + weight 187 70 0.2426455766 ( 0.5141008496 -0.1061555818 0.7876721025 ) + weight 188 69 0.5 ( -1.6936619282 2.4764661789 -1.1229035854 ) + weight 189 70 0.5 ( 0.4380996823 0.647521615 -0.4795390069 ) + weight 190 21 0.6049628854 ( -7.7385001183 1.8537855148 7.5749835968 ) + weight 191 23 0.3950371444 ( -2.6327066422 -3.4993028641 -2.1391019821 ) + weight 192 21 0.7395432591 ( -7.078499794 1.9775247574 6.4612336159 ) + weight 193 23 0.2604567111 ( -1.9727063179 -3.3755636215 -3.252851963 ) + weight 194 21 0.7290982008 ( -5.5824999809 0.2120256126 8.0314836502 ) + weight 195 23 0.2709017396 ( -0.476706624 -5.1410627365 -1.6826020479 ) + weight 196 21 0.8070091605 ( -5.3703999519 0.0106715783 7.2138333321 ) + weight 197 23 0.1929908395 ( -0.2646064758 -5.3424167633 -2.5002520084 ) + weight 198 20 0.4457392693 ( -4.9759998322 5.2310991287 1.8968998194 ) + weight 199 21 0.5542606711 ( -4.9759998322 -1.8024396896 4.5342335701 ) + weight 200 20 0.2131802291 ( -3.8960874081 6.3706874847 2.7697873116 ) + weight 201 21 0.786819756 ( -3.8960874081 -0.6628513932 5.4071207047 ) + weight 202 21 0.7523798347 ( 5.5824999809 0.2120256126 8.0314836502 ) + weight 203 22 0.2476201952 ( 0.0494676828 -5.2801318169 -1.6826020479 ) + weight 204 21 0.8269272447 ( 5.3703999519 0.0106715783 7.2138333321 ) + weight 205 22 0.1730727553 ( -0.1626324654 -5.4814858437 -2.5002520084 ) + weight 206 20 0.4301334023 ( 4.9759998322 5.2310991287 1.8968998194 ) + weight 207 21 0.4857027531 ( 4.9759998322 -1.8024396896 4.5342335701 ) + weight 208 3 0.084163852 ( -9.3461141586 -4.6180176735 0.7216362953 ) + weight 209 20 0.2122401148 ( 3.8960874081 6.3706874847 2.7697873116 ) + weight 210 21 0.7877599001 ( 3.8960874081 -0.6628513932 5.4071207047 ) + weight 211 21 0.6288941503 ( 7.7385001183 1.8537855148 7.5749835968 ) + weight 212 22 0.3711058497 ( 2.205467701 -3.6383714676 -2.1391019821 ) + weight 213 21 0.7719958425 ( 7.078499794 1.9775247574 6.4612336159 ) + weight 214 22 0.2280042022 ( 1.5454673767 -3.514632225 -3.252851963 ) + weight 215 42 0.0670943782 ( 2.1667346954 0.4200339615 5.0092563629 ) + weight 216 43 0.8406767249 ( 0.5454059243 0.3306784928 1.8982644081 ) + weight 217 44 0.0922289193 ( -1.78956604 0.355511874 -0.3024424314 ) + weight 218 42 0.4065153301 ( 1.1848820448 0.4039087594 4.452650547 ) + weight 219 43 0.5934846997 ( -0.4364467859 0.3145532608 1.341658473 ) + weight 220 42 0.0528391302 ( 2.3949644566 -0.6315246224 4.6614966393 ) + weight 221 43 0.8885747194 ( 0.7736355662 -0.7208800912 1.550504446 ) + weight 222 44 0.0585861206 ( -1.5613363981 -0.69604671 -0.6502023339 ) + weight 223 42 0.4351715147 ( 1.3432525396 -0.8027890921 4.0835413933 ) + weight 224 43 0.5648284554 ( -0.2780762911 -0.8921445012 0.9725490808 ) + weight 225 43 0.5412924886 ( 2.6226649284 -0.6821227074 1.2549462318 ) + weight 226 44 0.4587075114 ( 0.2876930237 -0.6572893858 -0.9457606077 ) + weight 227 43 0.5752940774 ( 2.2837176323 0.8279749155 1.7195134163 ) + weight 228 44 0.4247059226 ( -0.0512543619 0.8528082967 -0.4811933637 ) + weight 229 42 0.1481243521 ( 3.4624328613 -0.5666723251 3.2852530479 ) + weight 230 43 0.7544951439 ( 1.8411041498 -0.6560278535 0.1742607653 ) + weight 231 44 0.0973804742 ( -0.4938677251 -0.6311944723 -2.026446104 ) + weight 232 43 0.5 ( 2.4288897514 -1.05935359 2.6993772984 ) + weight 233 44 0.5 ( 0.0939178541 -1.0345202684 0.4986704886 ) + weight 234 43 0.5 ( 2.1848678589 0.4753195047 3.2058575153 ) + weight 235 44 0.5 ( -0.1501041353 0.5001528859 1.005150795 ) + weight 236 44 0.9197841287 ( 1.798312664 -0.2298886329 -0.29904598 ) + weight 237 45 0.0802158937 ( -0.652690053 -0.48235026 -0.1156174093 ) + weight 238 44 0.9299392104 ( 1.5648198128 0.6806627512 -0.0759208724 ) + weight 239 45 0.0700608119 ( -0.8861828446 0.428201139 0.1075076982 ) + weight 240 44 0.6290175915 ( 2.0372204781 -0.5059825778 0.53518188 ) + weight 241 45 0.3709823787 ( -0.4137822688 -0.7584441304 0.7186104655 ) + weight 242 44 0.6460066438 ( 1.8634063005 0.493686825 0.8961632848 ) + weight 243 45 0.3539933562 ( -0.5875963569 0.2412251979 1.0795918703 ) + weight 244 44 0.5 ( 2.6586465836 0.3265955448 -0.3364367485 ) + weight 245 45 0.5 ( 0.2076440305 0.0741338953 -0.1530081779 ) + weight 246 57 0.5 ( -2.7713627815 0.5875270963 1.6177377701 ) + weight 247 58 0.5 ( -0.2809449732 0.1404728144 0.3787926733 ) + weight 248 57 0.6219800711 ( -1.3772597313 0.7917348146 1.9143089056 ) + weight 249 58 0.3780199289 ( 1.1131579876 0.3446805775 0.6753637195 ) + weight 250 57 0.587695539 ( -1.7254037857 1.6001403332 1.084712863 ) + weight 251 58 0.4123044908 ( 0.7650139332 1.153085947 -0.1542322189 ) + weight 252 61 0.510533154 ( -3.7330980301 1.859791398 0.3115520775 ) + weight 253 62 0.489466846 ( 0.2769410312 1.1808936596 -0.5647704601 ) + weight 254 60 0.1616790891 ( -3.429381609 4.0842399597 0.4938007891 ) + weight 255 61 0.7634017467 ( -1.4805371761 1.875474453 0.1166702956 ) + weight 256 62 0.0749191493 ( 2.5295016766 1.1965765953 -0.7596521974 ) + weight 257 61 0.5032861829 ( -3.5199680328 1.886251092 1.6090922356 ) + weight 258 62 0.4967138767 ( 0.4900707006 1.2073533535 0.7327697277 ) + weight 259 61 0.5 ( -4.5605211258 1.0312472582 1.0713018179 ) + weight 260 62 0.5 ( -0.5504823327 0.3523494601 0.1949792802 ) + weight 261 60 0.1813702881 ( -2.4417381287 2.7686288357 0.2842504978 ) + weight 262 61 0.8186296821 ( -0.4928939044 0.5598632693 -0.0928800032 ) + weight 263 61 1 ( -2.7542662621 0.5748164654 0.6100765467 ) + weight 264 60 0.0580386668 ( -3.7644145489 3.0628700256 2.0378191471 ) + weight 265 61 0.8524241447 ( -1.8155703545 0.8541043997 1.6606885195 ) + weight 266 62 0.0895371661 ( 2.1944684982 0.1752065867 0.7843660116 ) + weight 267 60 0.3058627248 ( -2.6117250919 2.3118133545 1.9362158775 ) + weight 268 61 0.6941372752 ( -0.6628807783 0.1030476764 1.5590853691 ) + weight 269 61 0.7101962566 ( -3.5542309284 -0.2622278631 0.6173524261 ) + weight 270 62 0.2898037434 ( 0.4558079243 -0.9411256313 -0.2589701116 ) + weight 271 61 0.9090378284 ( -3.0096867085 0.2843372524 -0.1926835477 ) + weight 272 62 0.0909621492 ( 1.0003519058 -0.3945605159 -1.0690060854 ) + weight 273 60 0.311775744 ( -3.2107815742 2.5370719433 -0.8293616176 ) + weight 274 61 0.6882243156 ( -1.2619371414 0.3283065557 -1.2064921856 ) + weight 275 61 1 ( -0.8601444364 -0.1662086695 0.3438849449 ) + weight 276 60 0.3610310555 ( -3.3041632175 1.3710100651 -0.6678417325 ) + weight 277 61 0.6389689445 ( -1.3553190231 -0.8377555013 -1.0449721813 ) + weight 278 54 0.4594660997 ( -3.2438788414 2.525652647 5.1648283005 ) + weight 279 55 0.5405339003 ( -1.710138917 0.0553930998 0.1857370138 ) + weight 280 54 0.4171014428 ( -2.2478528023 3.6906957626 4.4456977844 ) + weight 281 63 0.5828985572 ( -0.1452506781 0.0455142893 0.975689888 ) + weight 282 54 0.4769215584 ( -4.3294830322 2.9572627544 3.5671267509 ) + weight 283 63 0.5230785012 ( -1.6738576889 -0.3816465735 -0.791762948 ) + weight 284 54 0.389734 ( -3.0817329884 3.8850939274 3.1684253216 ) + weight 285 63 0.6102659702 ( -0.2892436981 0.3828265667 -0.5176478028 ) + weight 286 54 0.3395999074 ( -2.5298743248 1.7867136002 6.2920155525 ) + weight 287 55 0.5843383074 ( -0.9961344004 -0.6835460663 1.3129241467 ) + weight 288 56 0.0760618076 ( -0.4821526408 -2.3032956123 -1.0902748108 ) + weight 289 55 0.4950400591 ( 0.4890114069 1.7273800373 2.7976408005 ) + weight 290 56 0.5049599409 ( 1.0029932261 0.1076303422 0.3944419026 ) + weight 291 54 0.4328585565 ( -1.1708829403 1.988902688 5.8379764557 ) + weight 292 55 0.5671414137 ( 0.3628570139 -0.4813568592 0.8588849306 ) + weight 293 55 0.4486292005 ( -0.8716393113 1.2403411865 2.8949155807 ) + weight 294 56 0.5513707995 ( -0.357657522 -0.3794085383 0.4917165041 ) + weight 295 55 0.4989314675 ( -0.0058581936 2.700428009 1.7701866627 ) + weight 296 56 0.5010685921 ( 0.5081235766 1.080678463 -0.6330123544 ) + weight 297 55 0.4854052663 ( -1.3327713013 2.1470458508 1.937522769 ) + weight 298 56 0.5145947337 ( -0.8187894821 0.5272961259 -0.4656762481 ) + weight 299 54 0.4394061863 ( -1.8224964142 3.0290915966 4.8107347488 ) + weight 300 55 0.5605938435 ( -0.28875646 0.5588319898 -0.168356657 ) + weight 301 56 0.5856215358 ( -1.4077911377 1.7714693546 0.9887248874 ) + weight 302 57 0.414378494 ( -0.7708082199 0.1174184233 -1.0182901621 ) + weight 303 56 0.6465825438 ( -0.9609650373 0.7695883512 2.0353055 ) + weight 304 57 0.3534174562 ( -0.3344224393 -0.8959318399 0.0216322113 ) + weight 305 56 0.5 ( -0.0443166159 1.7214983702 2.6266515255 ) + weight 306 57 0.5 ( 0.6836009026 -0.0039592097 0.5355195403 ) + weight 307 54 0.4738064408 ( -3.8623600006 3.9406208992 2.4635570049 ) + weight 308 63 0.5261935592 ( -0.6583564878 0.5601946712 -1.4880073071 ) + weight 309 54 0.5 ( -5.639193058 2.2191514969 0.5531668067 ) + weight 310 60 0.5 ( -0.0542565025 0.095743902 -1.4449288845 ) + weight 311 54 0.2885072827 ( -1.6454265118 0.0502118506 5.5385136604 ) + weight 312 67 0.3271217644 ( -2.6467990875 2.1712169647 3.0733158588 ) + weight 313 68 0.3298664689 ( 0.2467122674 2.1570971012 0.913208127 ) + weight 314 69 0.0545044206 ( 3.0853626728 2.0177583694 -0.0228909608 ) + weight 315 54 0.4018228948 ( -0.2864444554 0.2523858249 5.084467411 ) + weight 316 67 0.352889657 ( -1.3162412643 1.603010416 3.0982334614 ) + weight 317 55 0.2452874482 ( 1.2472954988 -2.2178738117 0.1053763106 ) + weight 318 54 0.7998598218 ( -2.3799781799 -1.0421098471 1.1964527369 ) + weight 319 67 0.2001401931 ( -2.1254079342 1.8707454205 -1.4238046408 ) + weight 320 67 0.4174389839 ( -3.4178996086 1.772376895 2.2076632977 ) + weight 321 68 0.5209175944 ( -0.5243881345 1.7582569122 0.0475554317 ) + weight 322 69 0.0616434962 ( 2.3142621517 1.6189181805 -0.8885436654 ) + weight 323 54 0.5 ( -5.8431010246 1.1755847931 1.6658787727 ) + weight 324 60 0.5 ( -1.0985194445 -0.9474959373 -1.0091500282 ) + weight 325 54 0.411233604 ( -4.2994709015 1.4474301338 3.4130120277 ) + weight 326 60 0.3847137094 ( -0.9549801946 -1.4227459431 1.284907937 ) + weight 327 63 0.1389154792 ( -1.7387869358 -1.8774635792 -1.0418868065 ) + weight 328 55 0.065137282 ( -2.7657313347 -1.0228295326 -1.5660791397 ) + weight 329 54 0.4218311012 ( -2.9583892822 0.711068809 5.1654872894 ) + weight 330 67 0.0748788193 ( -3.1961035728 3.4671702385 2.5089380741 ) + weight 331 63 0.0888980106 ( -1.4166228771 -2.8317129612 1.0551384687 ) + weight 332 55 0.4143920541 ( -1.4246493578 -1.7591906786 0.1863958538 ) + weight 333 52 0.8625713587 ( -13.1781005859 1.8281533718 5.0887727737 ) + weight 334 54 0.1374286115 ( 3.0549631119 1.4906463623 -2.1944954395 ) + weight 335 52 1 ( -16.0200881958 1.6692044735 5.5842604637 ) + weight 336 52 1 ( -14.7297000885 -1.5155575275 8.7642850876 ) + weight 337 52 1 ( -14.6001739502 0.3788546026 8.2367229462 ) + weight 338 52 1 ( -15.8221626282 -3.5096189976 5.7821354866 ) + weight 339 52 1 ( -16.4721260071 0.8592442274 5.0787477493 ) + weight 340 52 1 ( -15.7450885773 1.2291935682 6.8492603302 ) + weight 341 52 1 ( -14.5249509811 1.2919547558 8.4333972931 ) + weight 342 52 1 ( -10.2603244781 0.6809071302 5.6612477303 ) + weight 343 52 1 ( -10.2370262146 -1.2293931246 6.3164730072 ) + weight 344 51 0.1528514028 ( -18.557762146 -10.2321329117 0.1420730352 ) + weight 345 52 0.8471485972 ( -3.0416750908 -1.8213818073 4.9780225754 ) + weight 346 51 1 ( -12.5416622162 -6.5576739311 0.3419481218 ) + weight 347 21 0.5517092347 ( -6.6989998817 3.9052724838 8.7423582077 ) + weight 348 23 0.4482907951 ( -1.5932065248 -1.4478160143 -0.9717270732 ) + weight 349 21 0.5897940993 ( -8.2767877579 5.0687122345 5.4984207153 ) + weight 350 23 0.4102058709 ( -3.1709938049 -0.2843762636 -4.2156643867 ) + weight 351 21 0.4541349113 ( -8.9402503967 5.8715248108 6.6592335701 ) + weight 352 51 0.1050690785 ( -3.349711895 -8.8769950867 3.2980480194 ) + weight 353 23 0.4407960474 ( -3.8344569206 0.5184363127 -3.0548520088 ) + weight 354 21 0.4498602748 ( -7.3315000534 4.7027730942 9.271733284 ) + weight 355 51 0.1002794802 ( -1.7409616709 -10.0457468033 5.9105482101 ) + weight 356 23 0.4498602748 ( -2.2257065773 -0.6503154039 -0.4423519969 ) + weight 357 21 0.3977741599 ( -6.717212677 7.8329229355 8.427195549 ) + weight 358 51 0.2044516653 ( -1.1266744137 -6.9155974388 5.0660104752 ) + weight 359 23 0.3977741599 ( -1.6114193201 2.4798343182 -1.2868895531 ) + weight 360 21 0.4424972832 ( -7.4587001801 6.209025383 4.9213585854 ) + weight 361 24 0.0737952366 ( -7.4587001801 -0.6982547045 3.4806699753 ) + weight 362 51 0.2046934217 ( -1.8681615591 -8.5394945145 1.5601731539 ) + weight 363 23 0.2790140808 ( -2.3529064655 0.8559368849 -4.7927269936 ) + weight 364 21 0.4247496724 ( 0 4.2112112045 10.3921089172 ) + weight 365 24 0.0560087487 ( 0 -2.6960687637 8.9514198303 ) + weight 366 23 0.3012194037 ( 5.1057934761 -1.1418772936 0.6780230999 ) + weight 367 22 0.2180222124 ( -5.5330324173 -1.2809457779 0.6780230999 ) + weight 368 21 1 ( 0 7.8568601608 11.1890707016 ) + weight 369 21 0.5777522326 ( 0 4.4999599457 8.5633583069 ) + weight 370 24 0.0826512948 ( 0 -2.4073200226 7.1226701736 ) + weight 371 23 0.1963478476 ( 5.1057934761 -0.8531285524 -1.1507270336 ) + weight 372 22 0.1432486773 ( -5.5330324173 -0.992197156 -1.1507270336 ) + weight 373 20 0.3280990422 ( -0.02575 10.2916765213 4.8680500984 ) + weight 374 21 0.601125598 ( -0.02575 3.2581377029 7.5053834915 ) + weight 375 23 0.0707753748 ( 5.0800437927 -2.0949509144 -2.2087020874 ) + weight 376 21 0.7391816974 ( -4.6026625633 2.928109169 9.3043708801 ) + weight 377 23 0.2608183324 ( 0.5031308532 -2.4249794483 -0.4097145796 ) + weight 378 21 0.9489344358 ( -3.9362373352 2.8745126724 8.2949581146 ) + weight 379 23 0.051065553 ( 1.1695561409 -2.4785759449 -1.4191269875 ) + weight 380 21 0.7520155311 ( -3.3007750511 3.8584470749 10.3562088013 ) + weight 381 51 0.051452022 ( 2.2897634506 -10.8900728226 6.9950232506 ) + weight 382 23 0.196532473 ( 1.805018425 -1.4946414232 0.6421229243 ) + weight 383 21 0.8876138926 ( -1.8014250994 4.4724607468 8.1371088028 ) + weight 384 23 0.1123861521 ( 3.3043682575 -0.8806277514 -1.5769770145 ) + weight 385 21 0.6761295199 ( -1.3572250605 4.4835090637 9.4744329453 ) + weight 386 23 0.3238704205 ( 3.7485682964 -0.8695794344 -0.2396520972 ) + weight 387 21 0.3764711916 ( -1.5492124557 8.0568504333 10.1685829163 ) + weight 388 24 0.2470576614 ( -1.5492124557 1.1495703459 8.727894783 ) + weight 389 23 0.3764711916 ( 3.5565810204 2.7037620544 0.4544979334 ) + weight 390 21 1 ( -5.1198000908 4.1400623322 6.8882460594 ) + weight 391 21 0.9301754832 ( -2.7639248371 5.3386974335 7.5046086311 ) + weight 392 23 0.069824487 ( 2.341868639 -0.0143910628 -2.2094769478 ) + weight 393 20 0.102906324 ( -4.8666000366 11.219625473 3.2355122566 ) + weight 394 21 0.8970936537 ( -4.8666000366 4.1860866547 5.8728461266 ) + weight 395 21 0.7719119787 ( 4.6026625633 2.928109169 9.3043708801 ) + weight 396 22 0.2280880511 ( -0.9303697944 -2.5640478134 -0.4097145796 ) + weight 397 21 1 ( 3.9362373352 2.8745126724 8.2949581146 ) + weight 398 21 0.5990643501 ( 3.3007750511 3.8584470749 10.3562088013 ) + weight 399 22 0.4009356499 ( -2.2322573662 -1.6337099075 0.6421229243 ) + weight 400 21 0.8842225075 ( 1.8014250994 4.4724607468 8.1371088028 ) + weight 401 22 0.1157775521 ( -3.7316071987 -1.0196963549 -1.5769770145 ) + weight 402 21 0.6547270417 ( 1.3572250605 4.4835090637 9.4744329453 ) + weight 403 23 0.0548789017 ( 6.4630184174 -0.8695794344 -0.2396520972 ) + weight 404 22 0.2903940976 ( -4.1758069992 -1.0086480379 -0.2396520972 ) + weight 405 21 0.332770139 ( 1.5492124557 8.0568504333 10.1685829163 ) + weight 406 24 0.2736468017 ( 1.5492124557 1.1495703459 8.727894783 ) + weight 407 23 0.0631841868 ( 6.6550059319 2.7037620544 0.4544979334 ) + weight 408 22 0.3303989172 ( -3.9838199615 2.5646934509 0.4544979334 ) + weight 409 21 1 ( 5.1198000908 4.1400623322 6.8882460594 ) + weight 410 21 0.9300834537 ( 2.7639248371 5.3386974335 7.5046086311 ) + weight 411 22 0.0699165389 ( -2.7691075802 -0.1534596682 -2.2094769478 ) + weight 412 20 0.1013805494 ( 4.8666000366 11.219625473 3.2355122566 ) + weight 413 21 0.8986194134 ( 4.8666000366 4.1860866547 5.8728461266 ) + weight 414 21 0.5997615457 ( 6.6989998817 3.9052724838 8.7423582077 ) + weight 415 22 0.4002384841 ( 1.1659675837 -1.5868844986 -0.9717270732 ) + weight 416 21 0.5451080203 ( 8.2767877579 5.0687122345 5.4984207153 ) + weight 417 26 0.1057546735 ( 2.6862454414 -9.6798763275 2.1372332573 ) + weight 418 22 0.3491372764 ( 2.7437548637 -0.4234448671 -4.2156643867 ) + weight 419 21 0.4586661756 ( 8.9402503967 5.8715248108 6.6592335701 ) + weight 420 26 0.1038354486 ( 3.3497083187 -8.8770637512 3.2980458736 ) + weight 421 22 0.4374984205 ( 3.4072179794 0.3793677092 -3.0548520088 ) + weight 422 21 0.5 ( 7.3315000534 4.7027730942 9.271733284 ) + weight 423 22 0.5 ( 1.7984676361 -0.7893840075 -0.4423519969 ) + weight 424 21 0.3984822035 ( 6.717212677 7.8329229355 8.427195549 ) + weight 425 26 0.2030356228 ( 1.1266708374 -6.9156656265 5.066008091 ) + weight 426 22 0.3984822035 ( 1.1841803789 2.3407659531 -1.2868895531 ) + weight 427 21 0.4073142409 ( 7.4587001801 6.209025383 4.9213585854 ) + weight 428 24 0.0535066128 ( 7.4587001801 -0.6982547045 3.4806699753 ) + weight 429 26 0.305274874 ( 1.8681579828 -8.539563179 1.5601708889 ) + weight 430 22 0.2339043021 ( 1.9256675243 0.7168682814 -4.7927269936 ) + weight 431 26 0.8471531272 ( 12.5416574478 -6.5577421188 0.3419458866 ) + weight 432 27 0.1528468728 ( -2.9744410515 1.8531388044 5.1779007912 ) + weight 433 27 1 ( 3.0416584015 -1.821320653 4.9780259132 ) + weight 434 27 1 ( 10.260307312 0.6809681654 5.6612505913 ) + weight 435 27 1 ( 10.2370090485 -1.2293320894 6.3164758682 ) + weight 436 27 1 ( 13.1780834198 1.8282145262 5.0887756348 ) + weight 437 27 0.8000000119 ( 16.0200710297 1.6692656279 5.5842633247 ) + weight 438 29 0.200000003 ( -0.0930952653 2.5318601131 -0.2228548378 ) + weight 439 27 0.8000000119 ( 14.7296829224 -1.5154963732 8.7642879486 ) + weight 440 29 0.200000003 ( -1.3834834099 -0.6529016495 2.957170248 ) + weight 441 27 0.8000000119 ( 14.6001577377 0.3789156675 8.2367258072 ) + weight 442 29 0.200000003 ( -1.5130090714 1.2415103912 2.4296078682 ) + weight 443 27 0.8000000119 ( 15.822145462 -3.509557724 5.7821383476 ) + weight 444 29 0.200000003 ( -0.2910209 -2.6469633579 -0.0249796379 ) + weight 445 27 0.8000000119 ( 16.4721088409 0.8593052626 5.0787506104 ) + weight 446 29 0.200000003 ( 0.3589415848 1.7218997478 -0.7283673286 ) + weight 447 27 0.8000000119 ( 15.7450723648 1.2292546034 6.8492631912 ) + weight 448 29 0.200000003 ( -0.3680944145 2.0918493271 1.0421452522 ) + weight 449 27 0.8000000119 ( 14.5249347687 1.2920159101 8.4334011078 ) + weight 450 29 0.200000003 ( -1.5882325172 2.1546106339 2.626282692 ) + weight 451 29 0.4070542455 ( 5.0816273689 0.1709345877 4.2100324631 ) + weight 452 30 0.5929456949 ( 1.2635183334 0.468313098 -0.1211783439 ) + weight 453 29 0.4839746654 ( 4.3259549141 1.6827230453 4.110045433 ) + weight 454 38 0.5160253644 ( -0.6275441647 0.0541600026 0.5750962496 ) + weight 455 29 0.3788121641 ( 5.7887434959 0.7864741087 2.4668827057 ) + weight 456 35 0.2423756868 ( -0.3373393714 -0.2110615671 1.9789270163 ) + weight 457 38 0.3788121641 ( 1.3953293562 -0.8420889378 -0.2896093726 ) + weight 458 29 0.5059761405 ( 4.8151803017 2.0418097973 2.6971452236 ) + weight 459 38 0.4940238595 ( 0.4163054228 0.4132469296 -0.4954203367 ) + weight 460 29 0.347406745 ( 4.5010304451 -0.6801147461 5.3347578049 ) + weight 461 30 0.652593255 ( 0.6829214096 -0.3827362955 1.0035467148 ) + weight 462 29 0.2958801687 ( 3.1947779655 -0.0613517985 5.4035077095 ) + weight 463 30 0.7041198611 ( -0.6233310699 0.2360266745 1.0722967386 ) + weight 464 30 0.4914405942 ( 0.4258823693 1.7741270065 3.3497092724 ) + weight 465 31 0.5085594058 ( -0.556268692 -0.5172091722 0.7858490944 ) + weight 466 30 0.4820699394 ( 1.555480957 0.9905404449 2.8935966492 ) + weight 467 31 0.5179300904 ( 0.5733298659 -1.3007956743 0.329736501 ) + weight 468 30 0.4973025024 ( 1.9983100891 2.0059509277 2.0425965786 ) + weight 469 31 0.5026975274 ( 1.0161590576 -0.2853853106 -0.5212634802 ) + weight 470 30 0.5 ( 0.9011078477 2.8638381958 2.436434269 ) + weight 471 31 0.5 ( -0.081043236 0.5725019574 -0.1274258047 ) + weight 472 29 0.2015999556 ( 3.8339543343 1.0561876297 4.4525203705 ) + weight 473 30 0.7984000444 ( 0.0158453193 1.3535660505 0.1213091239 ) + weight 474 31 0.4876291156 ( 1.8732690811 -0.8008366823 1.788173914 ) + weight 475 32 0.5123708844 ( 0.1647424549 -1.0299779177 -0.0254052598 ) + weight 476 31 0.4792023897 ( 2.3079681396 0.3318518102 0.8788865805 ) + weight 477 32 0.5207976103 ( 0.5994415283 0.1027105376 -0.9346926212 ) + weight 478 31 0.4995842576 ( 1.4699172974 0.122515589 2.827786684 ) + weight 479 32 0.5004157424 ( -0.238609314 -0.1066256762 1.0142076015 ) + weight 480 29 0.4201823771 ( 5.3639435768 2.1206595898 1.801632762 ) + weight 481 35 0.5798176527 ( -0.4387514293 1.1231240034 1.1961575747 ) + weight 482 29 0.4792615175 ( 5.9826922417 0.663159132 -0.8933672309 ) + weight 483 35 0.5207384825 ( 1.2677747011 -0.334376514 -0.9795361757 ) + weight 484 29 0.4503417313 ( 2.9747796059 -1.8901128769 4.5785079002 ) + weight 485 42 0.1218775883 ( 2.3283843994 2.4171648026 3.6410861015 ) + weight 486 30 0.4277806878 ( -0.8433294296 -1.5927344561 0.2472967356 ) + weight 487 29 0.4771116972 ( 1.6685295105 -1.271364212 4.6472454071 ) + weight 488 42 0.2373011559 ( 0.9531123042 2.4964613914 3.198138237 ) + weight 489 30 0.2855871022 ( -2.149579525 -0.9739857316 0.3160342872 ) + weight 490 29 0.6421558261 ( 2.1876907349 -1.8393537998 0.1103827879 ) + weight 491 42 0.3578441739 ( 2.8390617371 -0.1063229069 -0.0948802829 ) + weight 492 29 0.0663180426 ( 3.1474423409 -2.7581284046 3.7301204205 ) + weight 493 42 0.223845154 ( 2.9185607433 1.3559621572 3.4720754623 ) + weight 494 43 0.6402391195 ( 1.297232151 1.2666068077 0.3610831797 ) + weight 495 44 0.0695976689 ( -1.0377397537 1.2914401293 -1.8396235704 ) + weight 496 29 0.4919970334 ( 6.1503052711 -0.671441257 -0.145379737 ) + weight 497 35 0.5080029368 ( 1.1012363434 -1.6689770222 -0.2313086838 ) + weight 498 29 0.3513863683 ( 5.2712655067 -0.5716248751 2.028670311 ) + weight 499 35 0.3490789533 ( -0.61921525 -1.5691604614 1.3621940613 ) + weight 500 38 0.1619547904 ( 1.1134536266 -2.2001879215 -0.9063423872 ) + weight 501 30 0.1375798434 ( 1.4531564713 -0.2742463946 -2.3025407791 ) + weight 502 29 0.5 ( 4.2793536186 -1.4587659836 3.9368076324 ) + weight 503 30 0.5 ( 0.4612445831 -1.1613875628 -0.3944033086 ) + weight 504 32 0.5 ( 3.3421039581 -0.8488274813 0.7218825817 ) + weight 505 33 0.5 ( 0.2053165287 -0.8160973787 -0.1092594638 ) + weight 506 32 0.6568899751 ( 2.2878932953 -0.3796006739 1.583070159 ) + weight 507 33 0.3431100249 ( -0.8488941193 -0.3468705416 0.751928091 ) + weight 508 32 0.7460076213 ( 2.6346921921 0.5240009427 0.8576822281 ) + weight 509 33 0.2539923191 ( -0.5020952225 0.5567311049 0.0265401453 ) + weight 510 36 0.5 ( 2.0928714275 -0.787088573 2.395442009 ) + weight 511 37 0.5 ( 0.4112956226 0.7069758177 0.2699961066 ) + weight 512 36 0.5 ( 1.191590786 -0.4158374071 3.2783920765 ) + weight 513 37 0.5 ( -0.4899850786 1.0782269239 1.1529459953 ) + weight 514 35 0.2074988335 ( 4.1960978508 1.5768725872 3.3598520756 ) + weight 515 36 0.7925011516 ( 0.8510862589 0.3679111898 0.9000496864 ) + weight 516 36 0.5 ( 1.7090237141 -1.7702124119 3.3089315891 ) + weight 517 37 0.5 ( 0.0274478719 -0.2761479616 1.1834857464 ) + weight 518 35 1 ( 3.0462133884 0.9595497847 2.3366894722 ) + weight 519 36 0.8959507942 ( 0.6565356255 -1.2903997898 1.7773758173 ) + weight 520 37 0.1040491909 ( -1.0250402689 0.2036646754 -0.3480701149 ) + weight 521 35 0.2160084844 ( 2.9392633438 0.8343752623 4.5466547012 ) + weight 522 36 0.6350401044 ( -0.4057483673 -0.3745862246 2.0868523121 ) + weight 523 37 0.1489514261 ( -2.0873241425 1.1194781065 -0.0385936573 ) + weight 524 35 0.5389071703 ( 1.9143278599 0.7931240797 3.6242077351 ) + weight 525 36 0.4610928297 ( -1.4306836128 -0.4158374071 1.1644053459 ) + weight 526 36 0.50370121 ( 0.7071566582 -2.4041483402 2.0898520947 ) + weight 527 37 0.49629879 ( -0.9744191766 -0.91008389 -0.0355939865 ) + weight 528 36 0.7817896605 ( 1.1481140852 -1.8128845692 1.2487909794 ) + weight 529 37 0.2182103097 ( -0.5334618092 -0.3188201487 -0.8766549826 ) + weight 530 35 0.4311522841 ( 4.0681786537 0.1606233418 1.8867099285 ) + weight 531 36 0.5688476563 ( 0.7231671214 -1.0483381748 -0.573092401 ) + weight 532 35 0.6388587952 ( 2.6311872005 0.2431257665 2.7457211018 ) + weight 533 36 0.361141175 ( -0.7138245106 -0.9658356905 0.2859187126 ) + weight 534 35 0.5118147135 ( 3.4270551205 -0.829362154 1.8284094334 ) + weight 535 36 0.4201770723 ( 0.0820436403 -2.0383236408 -0.6313930154 ) + weight 536 37 0.0680082068 ( -1.5995322466 -0.5442591906 -2.7568390369 ) + weight 537 63 0.4804960489 ( -2.9213833809 2.8258795738 1.8977241516 ) + weight 538 64 0.5195039511 ( -0.588047564 -0.5046357512 0.7182685733 ) + weight 539 63 0.465957731 ( -3.0091021061 3.2149977684 0.5589788556 ) + weight 540 64 0.5340422988 ( -0.6757662296 -0.1155175641 -0.6204766631 ) + weight 541 64 0.5538153648 ( -2.2936551571 1.874404192 -0.2026361227 ) + weight 542 65 0.446184665 ( -0.1671712995 -0.3230467737 -0.9087409377 ) + weight 543 64 0.5162335634 ( -2.4363567829 1.3369954824 1.2078951597 ) + weight 544 65 0.4837664366 ( -0.3098728359 -0.860455513 0.5017904043 ) + weight 545 64 0.5 ( -1.823032856 2.2833793163 1.7142357826 ) + weight 546 65 0.5 ( 0.3034510016 0.0859282538 1.008130908 ) + weight 547 64 0.5 ( -1.673936367 2.8449342251 0.24031353 ) + weight 548 65 0.5 ( 0.4525475204 0.6474831104 -0.4657912552 ) + weight 549 65 0.5 ( -3.5347781181 0.5211555362 0.0948775038 ) + weight 550 66 0.5 ( -0.0295017865 -0.0096685458 -0.15053913 ) + weight 551 65 0.7818934917 ( -2.3798279762 0.9922417402 1.0134284496 ) + weight 552 66 0.2181065679 ( 1.1254482269 0.4614176154 0.7680118084 ) + weight 553 65 0.7930441499 ( -2.2591664791 1.4466814995 -0.1793385297 ) + weight 554 66 0.2069558203 ( 1.2461098433 0.9158573151 -0.424755156 ) + weight 555 60 0.1971554756 ( -3.1909976006 3.9894371033 1.8950116634 ) + weight 556 61 0.690261066 ( -1.2421532869 1.7806715965 1.517881155 ) + weight 557 62 0.1125834435 ( 2.767885685 1.1017738581 0.6415585876 ) + weight 558 60 0.5 ( -1.3233346939 3.0896756649 1.5547190905 ) + weight 559 61 0.5 ( 0.6255095601 0.8809099197 1.177588582 ) + weight 560 63 0.5076596141 ( -1.5867857933 3.3710412979 2.0379889011 ) + weight 561 64 0.4923403859 ( 0.746549964 0.0405263379 0.8585333824 ) + weight 562 63 0.5134094357 ( -1.6809191704 3.7886562347 0.6012696028 ) + weight 563 64 0.4865905643 ( 0.6524164677 0.4581411183 -0.5781859159 ) + weight 564 56 0.5 ( -0.51122576 2.7684140205 1.5330371857 ) + weight 565 57 0.5 ( 0.2276019901 1.0549412966 -0.5511373878 ) + weight 566 52 1 ( -15.5043010712 2.1040418148 7.0040979385 ) + weight 567 50 0.3212496042 ( -7.5528998375 1.381247282 -0.8460896611 ) + weight 568 51 0.6787503362 ( -3.3194613457 -1.2677471638 3.0065481663 ) + weight 569 50 0.2573358119 ( -7.5905752182 0.4257848561 -1.0995396376 ) + weight 570 51 0.7426642179 ( -3.3571367264 -2.2232096195 2.753098011 ) + weight 571 51 1 ( -6.7522363663 -3.3724589348 0.1993106306 ) + weight 572 24 0.0804704204 ( -8.6104621887 4.2860050201 4.921807766 ) + weight 573 50 0.2791217268 ( -7.2533626556 -0.9062407017 -0.8513271213 ) + weight 574 51 0.6404078603 ( -3.0199241638 -3.5552353859 3.0013105869 ) + weight 575 24 0.1006708071 ( -8.1202754974 5.5577201843 5.6395573616 ) + weight 576 50 0.3974681795 ( -6.7631750107 0.3654744923 -0.1335771382 ) + weight 577 51 0.5018610358 ( -2.5297367573 -2.2835199833 3.7190606594 ) + weight 578 51 1 ( -4.9449248314 -3.417734623 0.0450606644 ) + weight 579 51 1 ( -5.302423954 -4.6002335548 0.512560606 ) + weight 580 21 0.2623895109 ( -8.1743001938 8.2897758484 6.2597084045 ) + weight 581 24 0.0705087855 ( -8.1743001938 1.3824957609 4.8190202713 ) + weight 582 51 0.4052641094 ( -2.583761692 -6.4587445259 2.8985230923 ) + weight 583 23 0.2618375123 ( -3.0685067177 2.9366874695 -3.454376936 ) + weight 584 51 1 ( -4.4497113228 -5.5219979286 0.2317981422 ) + weight 585 24 0.6289612055 ( 0 3.3605308533 5.631632328 ) + weight 586 25 0.1855207086 ( -1.357098937 -1.8317072392 -0.1415015757 ) + weight 587 50 0.1855180115 ( 1.3571000099 -1.8317148685 -0.1415021718 ) + weight 588 24 0.2653520405 ( 0 5.9862060547 5.5093574524 ) + weight 589 47 0.2039463222 ( 0 -4.4939656258 0.4555847645 ) + weight 590 25 0.2653495669 ( -1.357098937 0.7939679623 -0.2637764812 ) + weight 591 50 0.2653520405 ( 1.3571000099 0.7939603329 -0.2637770772 ) + weight 592 46 0.150000006 ( 0 -0.2269566059 4.3573498726 ) + weight 593 48 0.8500000238 ( 0 -4.4656119347 -0.3936624527 ) + weight 594 24 0.8235675097 ( 0 4.1987056732 4.8218574524 ) + weight 595 25 0.0882167742 ( -1.357098937 -0.9935324192 -0.9512765408 ) + weight 596 50 0.0882156938 ( 1.3571000099 -0.9935400486 -0.9512771368 ) + weight 597 24 0.4192993045 ( 0 1.734520793 7.0116825104 ) + weight 598 25 0.2903516591 ( -1.357098937 -3.4577174187 1.2385486364 ) + weight 599 50 0.2903490961 ( 1.3571000099 -3.4577248096 1.2385480404 ) + weight 600 48 1 ( 0 -5.7413749695 1.8165999651 ) + weight 601 50 0.6327644587 ( -4.6123247147 1.4814593792 -2.6700270176 ) + weight 602 51 0.3672355711 ( -0.3788864613 -1.1675350666 1.182610631 ) + weight 603 21 0.062998414 ( -1.3854250908 9.0623855591 8.7352457047 ) + weight 604 24 0.4281026125 ( -1.3854250908 2.1551055908 7.2945575714 ) + weight 605 25 0.1365017444 ( -2.742524147 -3.03713274 1.5214235783 ) + weight 606 50 0.3723973036 ( -0.0283250213 -3.037140131 1.5214229822 ) + weight 607 24 0.2114852369 ( -2.7388124466 3.7096567154 6.1604952812 ) + weight 608 50 0.6091372967 ( -1.3817125559 -1.4825890064 0.3873604536 ) + weight 609 51 0.1793774813 ( 2.8517258167 -4.1315836906 4.2399983406 ) + weight 610 24 0.0918184072 ( -4.8694248199 4.5424575806 4.4093575478 ) + weight 611 50 0.7616632581 ( -3.5123250484 -0.6497881413 -1.3637771606 ) + weight 612 51 0.1465183645 ( 0.7211133838 -3.2987828255 2.4888606071 ) + weight 613 47 0.1558059454 ( -2.587887764 -3.8667769432 0.1955346763 ) + weight 614 50 0.8441940546 ( -1.2307876348 1.4211490154 -0.5238271356 ) + weight 615 24 0.1363941282 ( -1.4319250584 6.3986940384 4.4781074524 ) + weight 616 47 0.1038375199 ( -1.4319250584 -4.0814776421 -0.5756652951 ) + weight 617 50 0.7597683668 ( -0.0748249888 1.2064483166 -1.2950271368 ) + weight 618 24 0.4579410255 ( -0.7769999504 4.4697446823 7.2913827896 ) + weight 619 25 0.0841179937 ( -2.1340990067 -0.7224934101 1.5182484388 ) + weight 620 50 0.4579410255 ( 0.5801000595 -0.7225010395 1.5182478428 ) + weight 621 48 1 ( -1.5358998775 -5.3192644119 1.3113377094 ) + weight 622 25 0.6327667832 ( 4.6123261452 1.4814670086 -2.6700265408 ) + weight 623 26 0.3672332466 ( 0.378882885 -1.1676037312 1.182608366 ) + weight 624 21 0.0560914427 ( 1.3854250908 9.0623855591 8.7352457047 ) + weight 625 24 0.4312586784 ( 1.3854250908 2.1551055908 7.2945575714 ) + weight 626 25 0.375143677 ( 0.0283260643 -3.03713274 1.5214235783 ) + weight 627 50 0.1375061721 ( 2.7425251007 -3.037140131 1.5214229822 ) + weight 628 24 0.5243620872 ( 2.7388124466 3.7096567154 6.1604952812 ) + weight 629 25 0.4756379426 ( 1.3817136288 -1.482581377 0.3873610497 ) + weight 630 24 0.1460785866 ( 4.8694248199 4.5424575806 4.4093575478 ) + weight 631 25 0.7615744472 ( 3.5123257637 -0.6497805119 -1.3637765646 ) + weight 632 26 0.0923469812 ( -0.72111696 -3.2988512516 2.4888584614 ) + weight 633 47 0.1558056474 ( 2.587887764 -3.8667769432 0.1955346763 ) + weight 634 25 0.844194293 ( 1.2307887077 1.4211566448 -0.5238265395 ) + weight 635 24 0.136391148 ( 1.4319250584 6.3986940384 4.4781074524 ) + weight 636 47 0.1038374901 ( 1.4319250584 -4.0814776421 -0.5756652951 ) + weight 637 25 0.759771347 ( 0.0748260319 1.206455946 -1.2950265408 ) + weight 638 24 0.4579415023 ( 0.7769999504 4.4697446823 7.2913827896 ) + weight 639 25 0.4579415023 ( -0.5800989866 -0.7224934101 1.5182484388 ) + weight 640 50 0.0841169953 ( 2.1340999603 -0.7225010395 1.5182478428 ) + weight 641 48 1 ( 1.5358998775 -5.3192644119 1.3113377094 ) + weight 642 25 0.3212469816 ( 7.5529007912 1.3812549114 -0.8460890651 ) + weight 643 26 0.6787530184 ( 3.3194577694 -1.2678158283 3.0065457821 ) + weight 644 25 0.2573338151 ( 7.5905761719 0.4257924855 -1.0995390415 ) + weight 645 26 0.7426661849 ( 3.3571333885 -2.2232782841 2.7530958652 ) + weight 646 26 1 ( 6.7522330284 -3.3725273609 0.1993083954 ) + weight 647 21 0.4213606715 ( 8.6104621887 11.1932849884 6.3624958992 ) + weight 648 25 0.1756447554 ( 7.2533636093 -0.9062330723 -0.8513265252 ) + weight 649 26 0.4029945433 ( 3.0199205875 -3.555303812 3.0013084412 ) + weight 650 24 0.1006716043 ( 8.1202754974 5.5577201843 5.6395573616 ) + weight 651 25 0.3974677324 ( 6.7631764412 0.3654821217 -0.1335765421 ) + weight 652 26 0.5018606782 ( 2.529733181 -2.2835886478 3.7190582752 ) + weight 653 26 1 ( 4.9449210167 -3.4178030491 0.0450584292 ) + weight 654 21 0.1540683657 ( 10.8929624557 10.1482868195 3.8737459183 ) + weight 655 26 0.8459316492 ( 5.3024201393 -4.6003017426 0.5125584006 ) + weight 656 21 0.3154204786 ( 8.1743001938 8.2897758484 6.2597084045 ) + weight 657 24 0.0671664178 ( 8.1743001938 1.3824957609 4.8190202713 ) + weight 658 26 0.3039355278 ( 2.5837583542 -6.4588127136 2.8985209465 ) + weight 659 22 0.3134775758 ( 2.6412677765 2.797618866 -3.454376936 ) + weight 660 21 0.1591278017 ( 10.0402498245 9.2265224457 3.5929834843 ) + weight 661 26 0.8408722281 ( 4.4497079849 -5.5220661163 0.231795907 ) + weight 662 27 0.8000000119 ( 15.504283905 2.1041030884 7.0041007996 ) + weight 663 29 0.200000003 ( -0.6088828444 2.9666974545 1.1969827414 ) + weight 664 38 0.5 ( 0.9417665601 2.3623857498 3.1196968555 ) + weight 665 39 0.5 ( -0.7640467882 0.2796829641 0.4568932056 ) + weight 666 38 0.5 ( 1.9410784245 2.8106842041 2.0960612297 ) + weight 667 39 0.5 ( 0.2352650762 0.7279813886 -0.5667425394 ) + weight 668 31 0.4807309508 ( 1.9241571426 1.3061159849 1.8776369095 ) + weight 669 32 0.5192690492 ( 0.2156305462 1.0769747496 0.064057678 ) + weight 670 38 0.4241735041 ( 1.877091527 1.3157997131 3.4772601128 ) + weight 671 39 0.5758265257 ( 0.1712781489 -0.7669031024 0.8144565225 ) + weight 672 38 0.4112786055 ( 2.8082549572 1.7335088253 2.5234260559 ) + weight 673 39 0.5887213945 ( 1.1024416685 -0.3491937816 -0.1393777281 ) + weight 674 39 0.4625679255 ( 1.9046292305 0.0741327479 2.6408572197 ) + weight 675 40 0.5374320745 ( -0.1064162031 -1.0044653416 0.3605245948 ) + weight 676 39 0.4925095141 ( 2.7444911003 0.7288587093 1.5616278648 ) + weight 677 40 0.5074904561 ( 0.7334458828 -0.3497393131 -0.7187047601 ) + weight 678 39 0.4999943078 ( 1.4489982128 1.1488713026 3.0477068424 ) + weight 679 40 0.500005722 ( -0.5620471835 0.0702732354 0.7673742175 ) + weight 680 39 0.5 ( 2.3266167641 1.8330085278 1.9199826717 ) + weight 681 40 0.5 ( 0.3155714869 0.7544105649 -0.3603499532 ) + weight 682 40 0.5 ( 3.040106535 -1.0923893452 1.9624311924 ) + weight 683 41 0.5 ( 0.5019233227 -0.4771701992 0.0334265046 ) + weight 684 40 0.6190677881 ( 1.7891420126 -0.2490551025 2.3137755394 ) + weight 685 41 0.3809322715 ( -0.7490411997 0.3661640286 0.3847707808 ) + weight 686 40 0.6329517961 ( 2.4993488789 0.3045861721 1.4011665583 ) + weight 687 41 0.3670482337 ( -0.038834326 0.9198052883 -0.5278382301 ) + weight 688 35 0.3712126315 ( 3.1543228626 1.879373312 4.2831096649 ) + weight 689 36 0.550209105 ( -0.1906888336 0.6704119444 1.8233070374 ) + weight 690 37 0.0785782039 ( -1.8722647429 2.1644763947 -0.3021389246 ) + weight 691 35 0.6203890443 ( 1.763201952 2.0443735123 2.7175130844 ) + weight 692 36 0.3796109259 ( -1.5818096399 0.8354119062 0.2577106655 ) + weight 693 50 0.0883802846 ( -10.8129873276 2.314589262 -3.0148646832 ) + weight 694 51 0.9116197228 ( -6.5795488358 -0.3344051838 0.8377730846 ) + weight 695 50 0.2916485369 ( -8.4479999542 3.6483314037 -2.4098646641 ) + weight 696 51 0.7083514929 ( -4.2145614624 0.9993368983 1.4427731037 ) + weight 697 47 1 ( 0 2.3202710152 7.8124594688 ) + weight 698 47 1 ( 0 0.8872324824 7.7641220093 ) + weight 699 48 1 ( 0 -3.9435706139 3.2441627979 ) + weight 700 47 1 ( 0 -2.0042128563 6.2143592834 ) + weight 701 47 1 ( 0 -0.8316987157 6.7518596649 ) + weight 702 47 1 ( 0 0.4436880946 8.2173595428 ) + weight 703 48 1 ( 0 -3.3677134514 3.9039373398 ) + weight 704 47 1 ( 0 0.2909762263 4.943584919 ) + weight 705 47 1 ( 0 -0.6840413213 6.7435851097 ) + weight 706 48 1 ( 0 -3.9835963249 2.9953999519 ) + weight 707 48 1 ( 0 -3.4335837364 1.695400238 ) + weight 708 47 1 ( 0 -0.6145184636 3.3419597149 ) + weight 709 50 0.9445517063 ( -2.5498249531 2.7877070904 -1.6387771368 ) + weight 710 51 0.0554482937 ( 1.6836133003 0.1387126297 2.2138605118 ) + weight 711 50 0.7114670873 ( -2.1863875389 2.9564025402 -3.8483772278 ) + weight 712 51 0.2885329127 ( 2.0470509529 0.3074080646 0.00426054 ) + weight 713 47 1 ( -2.8920249939 1.337261796 -0.9684528112 ) + weight 714 47 1 ( -3.4319248199 -1.4992135763 1.3325097561 ) + weight 715 47 1 ( -2.7037250996 -2.2827143669 0.806984663 ) + weight 716 47 1 ( -0.7795625329 1.8288332224 8.0242977142 ) + weight 717 47 0.8999999762 ( -2.9840373993 0.4502016902 6.278734684 ) + weight 718 48 0.1000000015 ( -2.9840373993 -0.4813702703 4.0196752548 ) + weight 719 47 0.8000000119 ( -3.5864248276 0.4557139277 3.9103348255 ) + weight 720 48 0.200000003 ( -3.5864248276 -0.4758580327 1.6512751579 ) + weight 721 47 1 ( -3.0743000507 2.240334034 6.1703224182 ) + weight 722 48 1 ( -0.8532249928 -3.6822543144 3.0003750324 ) + weight 723 47 1 ( -0.8000124693 0.4426867366 7.6177220345 ) + weight 724 47 1 ( -0.7419250011 -1.1249248981 6.4988970757 ) + weight 725 47 1 ( -1.5668749809 -1.0340397358 5.7935848236 ) + weight 726 48 1 ( -1.6758500338 -2.8835902214 2.695400238 ) + weight 727 47 1 ( -1.3132125139 1.8324095011 -3.0736904144 ) + weight 728 47 1 ( -0.7419250011 -2.0124239922 6.0988969803 ) + weight 729 47 1 ( -1.3418750763 -1.8090432882 5.3310847282 ) + weight 730 47 1 ( -1.5668749809 -0.359038651 4.9185848236 ) + weight 731 48 1 ( -0.8532249928 -3.1328616142 3.6610002518 ) + weight 732 48 1 ( -1.5258500576 -2.5582633018 2.9858498573 ) + weight 733 47 1 ( -1.5258500576 -1.17669034 4.4449095726 ) + weight 734 47 1 ( -1.5668749809 -0.0590317845 4.1185846329 ) + weight 735 47 1 ( -1.6758500338 -0.977019608 3.0544598103 ) + weight 736 25 0.9445561171 ( 2.5498261452 2.7877144814 -1.6387765408 ) + weight 737 26 0.0554438978 ( -1.6836168766 0.1386439651 2.213858366 ) + weight 738 25 1 ( 2.1863884926 2.9564099312 -3.8483765125 ) + weight 739 47 1 ( 3.4319248199 -1.4992135763 1.3325097561 ) + weight 740 47 1 ( 2.8920249939 1.337261796 -0.9684528112 ) + weight 741 47 1 ( 2.7037250996 -2.2827143669 0.806984663 ) + weight 742 47 1 ( 0.7795625329 1.8288332224 8.0242977142 ) + weight 743 47 0.8999999762 ( 2.9840373993 0.4502016902 6.278734684 ) + weight 744 48 0.1000000015 ( 2.9840373993 -0.4813702703 4.0196752548 ) + weight 745 47 1 ( 3.0743000507 2.240334034 6.1703224182 ) + weight 746 47 0.8000000119 ( 3.5864248276 0.4557139277 3.9103348255 ) + weight 747 48 0.200000003 ( 3.5864248276 -0.4758580327 1.6512751579 ) + weight 748 48 1 ( 0.8532249928 -3.6822543144 3.0003750324 ) + weight 749 47 1 ( 0.8000124693 0.4426867366 7.6177220345 ) + weight 750 47 1 ( 0.7419250011 -1.1249248981 6.4988970757 ) + weight 751 47 1 ( 1.5668749809 -1.0340397358 5.7935848236 ) + weight 752 48 1 ( 1.6758500338 -2.8835902214 2.695400238 ) + weight 753 47 1 ( 1.3132125139 1.8324095011 -3.0736904144 ) + weight 754 47 1 ( 0.7419250011 -2.0124239922 6.0988969803 ) + weight 755 47 1 ( 1.3418750763 -1.8090432882 5.3310847282 ) + weight 756 47 1 ( 1.5668749809 -0.359038651 4.9185848236 ) + weight 757 48 1 ( 0.8532249928 -3.1328616142 3.6610002518 ) + weight 758 48 1 ( 1.5258500576 -2.5582633018 2.9858498573 ) + weight 759 47 1 ( 1.5258500576 -1.17669034 4.4449095726 ) + weight 760 47 1 ( 1.6758500338 -0.977019608 3.0544598103 ) + weight 761 47 1 ( 1.5668749809 -0.0590317845 4.1185846329 ) + weight 762 25 0.0883786827 ( 10.8129882813 2.3145968914 -3.0148639679 ) + weight 763 26 0.9116213322 ( 6.5795450211 -0.3344738781 0.8377708793 ) + weight 764 25 0.2916448414 ( 8.4480009079 3.6483387947 -2.4098639488 ) + weight 765 26 0.7083551288 ( 4.2145581245 0.9992682934 1.4427708387 ) + weight 766 47 1 ( 0 7.6300435066 5.4676346779 ) + weight 767 47 1 ( 0 8.2345685959 1.537022233 ) + weight 768 47 1 ( 0 5.2705674171 7.8135347366 ) + weight 769 47 1 ( 0 7.2720627785 -2.0379776955 ) + weight 770 47 1 ( -3.1431498528 5.5902867317 5.392660141 ) + weight 771 47 1 ( -3.3329999447 7.2662262917 1.2024096251 ) + weight 772 47 1 ( -1.9900125265 2.6769070625 7.5505223274 ) + weight 773 47 1 ( -3.3467502594 6.1783699989 -2.2641026974 ) + weight 774 47 1 ( 3.1431498528 5.5902867317 5.392660141 ) + weight 775 47 1 ( 3.3329999447 7.2662262917 1.2024096251 ) + weight 776 47 1 ( 1.9900125265 2.6769070625 7.5505223274 ) + weight 777 47 1 ( 3.3467502594 6.1783699989 -2.2641026974 ) + weight 778 12 0.2563629746 ( 33.0398216248 3.9326167107 3.2865693569 ) + weight 779 13 0.3614273369 ( 5.3008437157 -7.6376085281 -1.1414731741 ) + weight 780 14 0.243688643 ( -8.0842981339 -4.1430191994 -2.7326040268 ) + weight 781 15 0.0622054599 ( -11.7274675369 -6.1995387077 1.4633332491 ) + weight 782 17 0.076315634 ( -12.14158535 -3.3198654652 1.5372794867 ) + weight 783 12 0.2469138503 ( 33.4638900757 4.0751185417 -0.9710928798 ) + weight 784 13 0.3727410734 ( 4.388001442 -7.4342656136 3.0362296104 ) + weight 785 14 0.2544984818 ( -5.2937240601 -7.1971740723 -1.6313937902 ) + weight 786 15 0.0715020001 ( -12.284954071 -2.0027599335 0.8276562691 ) + weight 787 17 0.0543446392 ( -13.3087902069 0.7497013807 0.9016023874 ) + weight 788 12 0.461424619 ( 28.4237709045 1.8707973957 3.1209115982 ) + weight 789 13 0.4821410775 ( 2.0102367401 -4.0104074478 -2.4070935249 ) + weight 790 14 0.0564343035 ( -8.1523790359 -2.0404076576 1.8674902916 ) + weight 791 4 0.2059161365 ( 32.97889328 5.3328409195 -2.2511792183 ) + weight 792 5 0.3872070313 ( 4.0783443451 -7.4809956551 2.5308735371 ) + weight 793 6 0.282189697 ( -3.7736308575 -7.0362429619 -1.9334219694 ) + weight 794 7 0.0708162263 ( -11.5240097046 0.0249091741 1.3836282492 ) + weight 795 9 0.0538709164 ( -11.9716377258 3.0223984718 1.4157617092 ) + weight 796 4 0.1954126805 ( 33.2664337158 4.9352502823 2.0017166138 ) + weight 797 5 0.3839006722 ( 4.8968849182 -7.05560112 -1.6496655941 ) + weight 798 6 0.2782916129 ( -6.7500119209 -3.9712131023 -1.660249114 ) + weight 799 7 0.0603468344 ( -10.9543218613 -4.1511259079 0.6325853467 ) + weight 800 9 0.0820481181 ( -10.7954072952 -1.02485919 0.6647187471 ) + weight 801 4 0.4696669579 ( 27.9249668121 2.9757020473 -1.5506597757 ) + weight 802 5 0.5303330421 ( 0.5289005041 -3.2067444324 1.6816196442 ) + weight 803 12 0.4995803833 ( 27.4030590057 1.0917562246 -4.1636161804 ) + weight 804 13 0.5004196167 ( -0.6842263937 -2.0736737251 4.2036581039 ) + weight 805 12 0.2888435721 ( 28.2362918854 -1.8141095638 -3.2144472599 ) + weight 806 13 0.7111564279 ( 1.445081234 0.1874292791 3.576987505 ) + weight 807 12 0.5639333129 ( 25.0300426483 -2.4374024868 -1.934784174 ) + weight 808 13 0.4360666871 ( -0.75131464 1.8001717329 1.3676960468 ) + weight 809 12 0.5 ( 27.3999042511 4.152566433 0.2964366376 ) + weight 810 13 0.5 ( -0.5854756832 -5.4091472626 -0.053748183 ) + weight 811 12 0.5 ( 26.4205570221 2.5024900436 -2.7500724792 ) + weight 812 13 0.5 ( -1.6830064058 -3.1740114689 2.5467689037 ) + weight 813 12 1 ( 23.7825508118 0.7723487616 -3.2343652248 ) + weight 814 12 0.5658426881 ( 25.3213291168 -1.3371442556 1.3829892874 ) + weight 815 13 0.4341573119 ( 0.0350914486 0.2950773239 -1.7013905048 ) + weight 816 12 0.5018610358 ( 25.7993812561 5.5255198479 0.9808458686 ) + weight 817 13 0.4981389642 ( -2.3211855888 -6.1618895531 -1.209510088 ) + weight 818 12 0.5 ( 26.3584022522 5.50238657 -1.3689215183 ) + weight 819 13 0.5 ( -2.5010063648 -6.0760374069 1.1977162361 ) + weight 820 4 0.5 ( 27.2529239655 4.905377388 0.8553846478 ) + weight 821 5 0.5 ( -0.6506701708 -4.5757417679 -0.9065843225 ) + weight 822 4 0.6556488872 ( 23.6908054352 0.9735138416 3.8268201351 ) + weight 823 5 0.3443511724 ( -1.9893512726 0.6062523127 -3.7931990623 ) + weight 824 4 0.5 ( 26.2665348053 2.8492202759 3.6414778233 ) + weight 825 5 0.5 ( -0.4416750371 -2.1772317886 -3.583622694 ) + weight 826 4 0.5747679472 ( 25.4302387238 -0.4784819484 -0.9694106579 ) + weight 827 5 0.4252320528 ( -0.2597645819 0.99386096 1.2064049244 ) + weight 828 4 0.5012171865 ( 25.6147861481 6.2921228409 0.299933821 ) + weight 829 5 0.4987828135 ( -2.7578024864 -5.1776695251 -0.5707840323 ) + weight 830 4 0.5 ( 26.1153335571 5.9945816994 2.6441447735 ) + weight 831 5 0.5 ( -1.9641931057 -5.0143260956 -2.8462855816 ) + weight 832 4 0.4966793656 ( 27.2706890106 1.3099222183 4.8967885971 ) + weight 833 5 0.5033206344 ( 1.2181107998 -1.1426680088 -4.6458654404 ) + weight 834 4 0.2354369462 ( 28.9388275146 -1.539992094 4.135371685 ) + weight 835 5 0.5586854219 ( 3.8317890167 0.7188010216 -3.5558774471 ) + weight 836 6 0.1300537437 ( -4.521273613 1.060931921 4.2490348816 ) + weight 837 9 0.0758239105 ( -4.9383764267 -0.8622139096 -4.8920912743 ) + weight 838 4 0.5420322418 ( 25.1016616821 -1.9977445602 2.1749322414 ) + weight 839 5 0.457967788 ( 0.3583128452 2.6464865208 -1.8250672817 ) + weight 840 12 1 ( 20.2926540375 -1.1805739403 0.2672938406 ) + weight 841 12 1 ( 20.4784469604 -1.0883660316 -1.9001260996 ) + weight 842 12 1 ( 18.1030540466 2.4979526997 1.5719373226 ) + weight 843 12 1 ( 18.9970493317 5.1889996529 1.0115466118 ) + weight 844 4 1 ( 18.0669937134 3.0745797157 -0.894759655 ) + weight 845 4 1 ( 18.8350028992 5.7055282593 0.0235389266 ) + weight 846 4 1 ( 20.3730506897 -0.6535661817 0.0058187065 ) + weight 847 4 1 ( 20.500617981 -0.8279169798 2.1723999977 ) + weight 848 12 1 ( 11.8831167221 0.1869213581 -3.1364681721 ) + weight 849 12 1 ( 16.2461433411 -0.3440243602 -2.4856424332 ) + weight 850 12 1 ( 9.0186033249 5.1412606239 3.4751112461 ) + weight 851 4 1 ( 8.9317502975 5.5914502144 -2.7247984409 ) + weight 852 4 1 ( 11.831788063 -0.0438425355 3.2999060154 ) + weight 853 4 1 ( 16.2279052734 -0.3235298097 2.7190408707 ) + weight 854 12 1 ( 6.0769815445 4.6632561684 -5.441163063 ) + weight 855 12 1 ( 8.9296302795 8.3799762726 -2.1540257931 ) + weight 856 12 1 ( 2.9792709351 6.4228219986 1.6259762049 ) + weight 857 12 1 ( 2.4289197922 3.0714464188 3.7876582146 ) + weight 858 4 1 ( 2.8003621101 6.401137352 -0.9121413231 ) + weight 859 4 1 ( 2.4428694248 3.3300886154 -3.4905781746 ) + weight 860 4 1 ( 8.5685768127 8.090294838 3.2592010498 ) + weight 861 4 1 ( 5.7664699554 3.870998621 5.9697170258 ) + weight 862 11 0.2017851472 ( 23.953754425 5.4816861153 -4.2567720413 ) + weight 863 12 0.7982148528 ( 1.3351318836 4.8304901123 -4.5207910538 ) + weight 864 11 1 ( 21.5682239532 3.6848404408 0.1614092141 ) + weight 865 11 0.1000000015 ( 24.5447998047 7.6976623535 -2.5103619099 ) + weight 866 12 0.9000000358 ( 2.4908194542 6.8120555878 -2.775049448 ) + weight 867 3 0.2987317443 ( 23.7528076172 6.2109322548 4.414083004 ) + weight 868 4 0.7012682557 ( 1.07003057 3.9869499207 4.9358553886 ) + weight 869 3 0.6999999881 ( 21.3794727325 4.9174704552 -0.1830838025 ) + weight 870 4 0.3000000119 ( -1.5424296856 3.3435750008 0.3314196765 ) + weight 871 4 1 ( 2.1863532066 6.2146782875 3.4864151478 ) + weight 872 11 0.6574106216 ( 21.8477420807 0.2163063884 -3.1866276264 ) + weight 873 12 0.3425893784 ( -2.0839955807 0.3067061007 -3.448567152 ) + weight 874 11 0.8000000119 ( 20.2093315125 3.0000197887 -3.6163527966 ) + weight 875 12 0.200000003 ( -2.9306974411 3.4239597321 -3.8774540424 ) + weight 876 3 1 ( 20.0802135468 3.71352911 3.4842710495 ) + weight 877 3 0.6844632626 ( 21.7590427399 1.0700935125 2.4820022583 ) + weight 878 4 0.3155367374 ( -2.1675322056 -0.4726192057 2.9950587749 ) + weight 879 11 1 ( 12.5082921982 4.6858158112 -0.390771687 ) + weight 880 3 1 ( 12.0061321259 5.2245082855 0.769251883 ) + weight 881 2 0.1454662234 ( -9.2759513855 -12.5913352966 -3.9848918915 ) + weight 882 11 0.8545337915 ( 5.3614530563 1.2912409306 -4.2551789284 ) + weight 883 2 1 ( 0.0225959271 -11.5908985138 -6.3940753937 ) + weight 884 11 1 ( 6.0733480453 0.9716901779 3.68196702 ) + weight 885 11 1 ( 5.3426604271 3.4533233643 1.883769989 ) + weight 886 3 1 ( 5.8869261742 1.7861583233 -3.9078969955 ) + weight 887 2 0.1054315343 ( 3.1896224022 -13.4790973663 -6.0149002075 ) + weight 888 3 0.8945685029 ( 5.0583124161 3.992834568 -1.8174667358 ) + weight 889 3 1 ( 5.2553291321 1.4280443192 3.982131958 ) + weight 890 2 0.3000000119 ( -3.6239292622 -10.1202754974 -9.6666002274 ) + weight 891 11 0.6999999881 ( 1.4976956844 6.5122027397 1.0501244068 ) + weight 892 2 0.6000000238 ( 3.6691191196 -10.1202754974 -9.6666002274 ) + weight 893 3 0.3999999762 ( 1.0666370392 6.6969323158 -0.5522003174 ) + weight 894 2 0.3000000119 ( -8.1770324707 -2.5972967148 -3.218075037 ) + weight 895 11 0.6999999881 ( -4.4371743202 -1.0799667835 -4.053375721 ) + weight 896 2 0.5137676597 ( -7.1727237701 -4.0464859009 -8.1888504028 ) + weight 897 11 0.4862323105 ( -3.9055857658 4.0622777939 -3.0083267689 ) + weight 898 20 0.6397548318 ( 0 3.6565637589 -5.418337822 ) + weight 899 21 0.360245198 ( 0 -3.3769750595 -2.7810044289 ) + weight 900 20 0.8339756131 ( 0 0.4829645753 -5.1986751556 ) + weight 901 21 0.1660244167 ( 0 -6.5505743027 -2.5613415241 ) + weight 902 20 0.5734935403 ( 0 -0.8307742476 -6.1539378166 ) + weight 903 21 0.1398577392 ( 0 -7.8643131256 -3.5166044235 ) + weight 904 11 0.1842741519 ( -5.3904371262 4.9802436829 4.0779838562 ) + weight 905 3 0.1023745313 ( -5.7926998138 5.1199798584 -3.6220397949 ) + weight 906 2 0.7162027359 ( -5.2711539268 -2.2043352127 -6.8062500954 ) + weight 907 11 0.2837972641 ( -5.6687164307 2.4045250416 -1.2578134537 ) + weight 908 20 0.6338254213 ( -5.84375 2.6118135452 -4.024600029 ) + weight 909 21 0.3661745489 ( -5.84375 -4.4217252731 -1.3872665167 ) + weight 910 20 0.5014402866 ( -0.9352249503 -1.3096618652 -5.6607999802 ) + weight 911 21 0.0917243659 ( -0.9352249503 -8.3432006836 -3.0234665871 ) + weight 912 11 0.4068352878 ( -4.7542424202 4.5687804222 3.1987123489 ) + weight 913 20 0.6273728013 ( -1.3855500221 3.2577610016 -4.5619125366 ) + weight 914 21 0.2173846215 ( -1.3855500221 -3.7757778168 -1.9245791435 ) + weight 915 11 0.1552425772 ( -9.0240659714 2.7441666126 2.3554522991 ) + weight 916 2 0.6999999881 ( 5.3163461685 -2.2043352127 -6.8062500954 ) + weight 917 3 0.3000000119 ( -5.7952170372 1.9271235466 1.3767755032 ) + weight 918 20 0.5663692951 ( 5.84375 2.6118135452 -4.024600029 ) + weight 919 21 0.3272037506 ( 5.84375 -4.4217252731 -1.3872665167 ) + weight 920 3 0.1064269841 ( -7.990152359 1.6095404625 2.1557557583 ) + weight 921 20 0.4674762785 ( 0.9352249503 -1.3096618652 -5.6607999802 ) + weight 922 21 0.0855116248 ( 0.9352249503 -8.3432006836 -3.0234665871 ) + weight 923 2 0.24382478 ( 0.9578208923 -3.8570480347 -8.7174501419 ) + weight 924 3 0.2031873167 ( -5.1131248474 4.6474642754 -2.808362484 ) + weight 925 20 0.6677618623 ( 1.3855500221 3.2577610016 -4.5619125366 ) + weight 926 21 0.2313794196 ( 1.3855500221 -3.7757778168 -1.9245791435 ) + weight 927 3 0.100858666 ( -9.2499141693 2.4850404263 -2.1136705875 ) + weight 928 2 0.3000000119 ( 8.2222251892 -2.5972967148 -3.218075037 ) + weight 929 3 0.6999999881 ( -4.2994232178 -1.779967308 3.7206242085 ) + weight 930 2 0.200000003 ( 7.2179164886 -4.0464859009 -8.1888504028 ) + weight 931 3 0.8000000119 ( -4.0887227058 3.4716165066 3.2803218365 ) + weight 932 51 0.0677773133 ( -21.3410739899 -12.6467218399 -2.5789518356 ) + weight 933 52 0.9322226644 ( -5.8249878883 -4.2359704971 2.2569978237 ) + weight 934 20 0.1189067513 ( -7.3782248497 8.2387495041 0.384849906 ) + weight 935 21 0.6058146954 ( -7.3782248497 1.2052105665 3.0221834183 ) + weight 936 24 0.0628303811 ( -7.3782248497 -5.7020692825 1.5814950466 ) + weight 937 51 0.1009515449 ( -1.787686348 -13.5433092117 -0.3390018642 ) + weight 938 23 0.1114965528 ( -2.2724313736 -4.1478776932 -6.6919021606 ) + weight 939 20 0.3950642347 ( -6.5456871986 7.5363731384 -6.4710626602 ) + weight 940 21 0.3950642347 ( -6.5456871986 0.5028342605 -3.8337290287 ) + weight 941 24 0.105803296 ( -6.5456871986 -6.4044456482 -5.2744174004 ) + weight 942 51 0.1040681973 ( -0.9551489353 -14.2456855774 -7.194914341 ) + weight 943 20 0.2767947912 ( -8.6624994278 7.6993131638 -2.8558502197 ) + weight 944 21 0.416950345 ( -8.6624994278 0.6657742858 -0.2185165882 ) + weight 945 24 0.1158498451 ( -8.6624994278 -6.2415056229 -1.6592049599 ) + weight 946 51 0.1015091911 ( -3.0719614029 -14.0827455521 -3.5797019005 ) + weight 947 23 0.0888958126 ( -3.5567064285 -4.6873140335 -9.9326019287 ) + weight 948 20 0.4345740378 ( -6.875 5.5680608749 -2.6496002674 ) + weight 949 21 0.4966184199 ( -6.875 -1.4654779434 -0.0122666359 ) + weight 950 24 0.0688075498 ( -6.875 -8.3727579117 -1.4529550076 ) + weight 951 20 0.5 ( 0 7.5307607651 -6.5861001015 ) + weight 952 21 0.5 ( 0 0.4972219169 -3.9487667084 ) + weight 953 20 0.5 ( 0 6.6857004166 -5.14234972 ) + weight 954 21 0.5 ( 0 -0.3478384316 -2.5050163269 ) + weight 955 20 0.5 ( -3.9187500477 6.805562973 -5.5371003151 ) + weight 956 21 0.5 ( -3.9187500477 -0.2279758751 -2.8997664452 ) + weight 957 20 0.4308815897 ( -1.5812499523 9.2118120193 -7.3246006966 ) + weight 958 21 0.4747116566 ( -1.5812499523 2.178273201 -4.6872668266 ) + weight 959 24 0.0944068208 ( -1.5812499523 -4.7290067673 -6.1279554367 ) + weight 960 20 0.5 ( -2.8029251099 7.3282384872 -4.8295502663 ) + weight 961 21 0.5 ( -2.8029251099 0.2946996391 -2.1922163963 ) + weight 962 20 0.5685037374 ( -5.5687499046 4.3993139267 -2.5808503628 ) + weight 963 21 0.4314962626 ( -5.5687499046 -2.6342248917 0.0564831495 ) + weight 964 20 0.5 ( 3.9187500477 6.805562973 -5.5371003151 ) + weight 965 21 0.5 ( 3.9187500477 -0.2279758751 -2.8997664452 ) + weight 966 20 0.4308815598 ( 1.5812499523 9.2118120193 -7.3246006966 ) + weight 967 21 0.4747116566 ( 1.5812499523 2.178273201 -4.6872668266 ) + weight 968 24 0.0944068134 ( 1.5812499523 -4.7290067673 -6.1279554367 ) + weight 969 20 0.5 ( 2.8029251099 7.3282384872 -4.8295502663 ) + weight 970 21 0.5 ( 2.8029251099 0.2946996391 -2.1922163963 ) + weight 971 20 0.5039508343 ( 5.5687499046 4.3993139267 -2.5808503628 ) + weight 972 21 0.3900420666 ( 5.5687499046 -2.6342248917 0.0564831495 ) + weight 973 3 0.1060071066 ( -9.4417304993 -0.1655712575 1.8441540003 ) + weight 974 20 0.1207661703 ( 7.3782248497 8.2387495041 0.384849906 ) + weight 975 21 0.7001775503 ( 7.3782248497 1.2052105665 3.0221834183 ) + weight 976 24 0.0638128966 ( 7.3782248497 -5.7020692825 1.5814950466 ) + weight 977 22 0.1152433231 ( 1.8451923132 -4.2869462967 -6.6919021606 ) + weight 978 20 0.3949199617 ( 6.5456871986 7.5363731384 -6.4710626602 ) + weight 979 21 0.395186156 ( 6.5456871986 0.5028342605 -3.8337290287 ) + weight 980 24 0.1057646647 ( 6.5456871986 -6.4044456482 -5.2744174004 ) + weight 981 26 0.1041292027 ( 0.955145359 -14.2457542419 -7.1949167252 ) + weight 982 20 0.2686091065 ( 8.6624994278 7.6993131638 -2.8558502197 ) + weight 983 21 0.4290876389 ( 8.6624994278 0.6657742858 -0.2185165882 ) + weight 984 24 0.1124238074 ( 8.6624994278 -6.2415056229 -1.6592049599 ) + weight 985 26 0.1015925556 ( 3.0719578266 -14.0828142166 -3.5797040462 ) + weight 986 22 0.088286899 ( 3.1294674873 -4.826382637 -9.9326019287 ) + weight 987 20 0.4266230762 ( 6.875 5.5680608749 -2.6496002674 ) + weight 988 21 0.5058282614 ( 6.875 -1.4654779434 -0.0122666359 ) + weight 989 24 0.067548655 ( 6.875 -8.3727579117 -1.4529550076 ) + weight 990 27 1 ( 5.824971199 -4.235909462 2.2570009232 ) + weight 991 52 1 ( -17.0866374969 -1.1426469088 4.0192975998 ) + weight 992 54 0.7646281719 ( -3.8610150814 -0.5479852557 -0.5159529448 ) + weight 993 67 0.057570219 ( -2.3829722404 3.1826353073 -3.3165719509 ) + weight 994 60 0.1778016686 ( 1.4335156679 -2.9536817074 -2.1153883934 ) + weight 995 52 0.6832698584 ( -14.9613494873 1.4354541302 4.6217603683 ) + weight 996 54 0.3167301714 ( 1.1772814989 1.560696125 -2.0471975803 ) + weight 997 52 0.8033875823 ( -14.904624939 0.6254938841 4.4462480545 ) + weight 998 54 0.1966124475 ( 0.9921308756 0.7526433468 -1.994017601 ) + weight 999 51 0.0563565195 ( -20.3143863678 -6.5835089684 -0.3125394881 ) + weight 1000 52 0.9436435103 ( -4.7983002663 1.8272426128 4.5234103203 ) + weight 1001 52 1 ( -6.0767889023 -2.5572082996 4.5871853828 ) + weight 1002 51 0.0646225363 ( -22.8756351471 -11.2107982635 -5.6109271049 ) + weight 1003 52 0.9353774786 ( -7.3595499992 -2.8000471592 -0.7749772072 ) + weight 1004 52 1 ( -9.4349765778 -0.5189439058 -0.7386773825 ) + weight 1005 51 0.443610549 ( -15.8119115829 -7.7483458519 -2.2668268681 ) + weight 1006 52 0.556389451 ( -0.2958250046 0.6624058485 2.5691227913 ) + weight 1007 51 0.5 ( -15.5509243011 -8.7922325134 -8.6094646454 ) + weight 1008 52 0.5 ( -0.0348377228 -0.3814813197 -3.7735145092 ) + weight 1009 51 0.0700971037 ( -18.5416107178 -8.496846199 -1.0481519699 ) + weight 1010 52 0.9299028516 ( -3.0255246162 -0.0860949904 3.7877976894 ) + weight 1011 51 0.5 ( -15.6336126328 -11.0858097076 -7.2224640846 ) + weight 1012 52 0.5 ( -0.1175260544 -2.6750586033 -2.3865144253 ) + weight 1013 51 0.8932833076 ( -7.4059610367 -9.5094957352 -3.6182017326 ) + weight 1014 52 0.1067166552 ( 8.110124588 -1.0987445116 1.2177479267 ) + weight 1015 51 1 ( -8.0247125626 -7.9282469749 -1.6244519949 ) + weight 1016 51 1 ( -11.7487001419 -8.3534851074 -0.3205893934 ) + weight 1017 51 1 ( -7.4059610367 -8.4094944 -5.8182020187 ) + weight 1018 51 0.8746582866 ( -12.5468740463 -8.9144220352 -3.0657393932 ) + weight 1019 52 0.1253416836 ( 2.969212532 -0.5036708117 1.7702102661 ) + weight 1020 51 0.9074385166 ( -10.7643871307 -7.1964831352 -6.2548646927 ) + weight 1021 52 0.0925614834 ( 4.7517004013 1.2142685652 -1.4189147949 ) + weight 1022 51 0.8426001668 ( -10.8331375122 -8.7777318954 -5.6361145973 ) + weight 1023 52 0.1573998779 ( 4.6829500198 -0.3669807017 -0.800164938 ) + weight 1024 51 0.7721979618 ( -11.6199741364 -9.7301712036 -4.4819016457 ) + weight 1025 52 0.2278020829 ( 3.896112442 -1.3194200993 0.3540480137 ) + weight 1026 20 0.0529855229 ( -7.2898750305 11.1931228638 0.2629622817 ) + weight 1027 21 0.441654712 ( -7.2898750305 4.1595840454 2.9002957344 ) + weight 1028 24 0.0841899365 ( -7.2898750305 -2.7476959229 1.459607482 ) + weight 1029 51 0.3021862507 ( -1.6993367672 -10.5889358521 -0.4608894885 ) + weight 1030 23 0.1189835742 ( -2.1840815544 -1.1935044527 -6.8137893677 ) + weight 1031 21 0.6599999666 ( -10.5187501907 5.1345252991 -2.6935167313 ) + weight 1032 51 0.3400000036 ( -4.928211689 -9.6139945984 -6.0547018051 ) + weight 1033 20 0.2792472839 ( -7.5480623245 11.3684988022 -9.2093877792 ) + weight 1034 21 0.3234107494 ( -7.5480623245 4.3349599838 -6.5720539093 ) + weight 1035 24 0.2419621795 ( -7.5480623245 -2.5723199844 -8.0127420425 ) + weight 1036 51 0.1020626798 ( -1.9575238228 -10.4135599136 -9.9332389832 ) + weight 1037 23 0.0533170924 ( -2.4422688484 -1.0181285143 -16.2861404419 ) + weight 1038 21 0.4054434896 ( -8.4589996338 7.3015213013 0.5679833889 ) + weight 1039 24 0.0701758042 ( -8.4589996338 0.394241184 -0.8727049828 ) + weight 1040 50 0.0698308721 ( -7.1019001007 -4.7980041504 -6.6458396912 ) + weight 1041 51 0.4545497596 ( -2.8684616089 -7.446999073 -2.7932019234 ) + weight 1042 20 0.1663649976 ( 0 13.6869764328 -8.1812257767 ) + weight 1043 21 0.4414319396 ( 0 6.6534376144 -5.5438919067 ) + weight 1044 24 0.3922030628 ( 0 -0.2538425028 -6.98458004 ) + weight 1045 20 0.3243005872 ( 0 11.0100364685 -8.2019634247 ) + weight 1046 21 0.4622890353 ( 0 3.9764976501 -5.5646295547 ) + weight 1047 24 0.2134103775 ( 0 -2.9307823181 -7.005317688 ) + weight 1048 20 0.2323906422 ( 0 11.0339975357 -6.0516252518 ) + weight 1049 21 0.5941882133 ( 0 4.0004587173 -3.4142918587 ) + weight 1050 24 0.1734211594 ( 0 -2.9068212509 -4.8549799919 ) + weight 1051 20 0.2494123876 ( -3.0105624199 13.4310007095 -10.1718883514 ) + weight 1052 21 0.3986799717 ( -3.0105624199 6.3974618912 -7.5345544815 ) + weight 1053 24 0.3519076407 ( -3.0105624199 -0.5098182559 -8.9752426147 ) + weight 1054 20 0.2238887697 ( -0.9624999762 12.8555631638 -8.6308507919 ) + weight 1055 21 0.435683161 ( -0.9624999762 5.8220243454 -5.993516922 ) + weight 1056 24 0.3404280245 ( -0.9624999762 -1.0852557421 -7.4342055321 ) + weight 1057 20 0.311350286 ( -1.0175000429 10.1193141937 -5.7983503342 ) + weight 1058 21 0.5916436911 ( -1.0175000429 3.0857753754 -3.1610167027 ) + weight 1059 24 0.0970060155 ( -1.0175000429 -3.8215045929 -4.6017050743 ) + weight 1060 20 0.1802195758 ( -0.5469875336 14.3477487564 -9.2691249847 ) + weight 1061 21 0.419763118 ( -0.5469875336 7.314209938 -6.6317911148 ) + weight 1062 24 0.4000172615 ( -0.5469875336 0.4069298208 -8.072479248 ) + weight 1063 20 0.1424077898 ( -1.1350374222 13.7795257568 -7.5940375328 ) + weight 1064 21 0.4511080384 ( -1.1350374222 6.7459869385 -4.9567036629 ) + weight 1065 24 0.406484127 ( -1.1350374222 -0.1612931639 -6.3973922729 ) + weight 1066 20 0.2233095318 ( 3.0105624199 13.4310007095 -10.1718883514 ) + weight 1067 21 0.3569551408 ( 3.0105624199 6.3974618912 -7.5345544815 ) + weight 1068 24 0.3150779009 ( 3.0105624199 -0.5098182559 -8.9752426147 ) + weight 1069 26 0.1046574339 ( -2.5799796581 -8.3511266708 -10.8957424164 ) + weight 1070 20 0.2238887846 ( 0.9624999762 12.8555631638 -8.6308507919 ) + weight 1071 21 0.4356832206 ( 0.9624999762 5.8220243454 -5.993516922 ) + weight 1072 24 0.3404280543 ( 0.9624999762 -1.0852557421 -7.4342055321 ) + weight 1073 20 0.311350286 ( 1.0175000429 10.1193141937 -5.7983503342 ) + weight 1074 21 0.5916436911 ( 1.0175000429 3.0857753754 -3.1610167027 ) + weight 1075 24 0.0970060304 ( 1.0175000429 -3.8215045929 -4.6017050743 ) + weight 1076 20 0.1802195758 ( 0.5469875336 14.3477487564 -9.2691249847 ) + weight 1077 21 0.4197631478 ( 0.5469875336 7.314209938 -6.6317911148 ) + weight 1078 24 0.4000172913 ( 0.5469875336 0.4069298208 -8.072479248 ) + weight 1079 20 0.1424078196 ( 1.1350374222 13.7795257568 -7.5940375328 ) + weight 1080 21 0.451108098 ( 1.1350374222 6.7459869385 -4.9567036629 ) + weight 1081 24 0.4064841568 ( 1.1350374222 -0.1612931639 -6.3973922729 ) + weight 1082 21 0.4149694741 ( 7.2898750305 4.1595840454 2.9002957344 ) + weight 1083 24 0.0666067749 ( 7.2898750305 -2.7476959229 1.459607482 ) + weight 1084 26 0.4193356335 ( 1.6993331909 -10.5890045166 -0.4608917236 ) + weight 1085 22 0.0990880728 ( 1.7568427324 -1.332572937 -6.8137893677 ) + weight 1086 21 0.6827453971 ( 10.5187501907 5.1345252991 -2.6935167313 ) + weight 1087 26 0.3172545731 ( 4.9282078743 -9.6140632629 -6.0547041893 ) + weight 1088 20 0.2598383129 ( 7.5480623245 11.3684988022 -9.2093877792 ) + weight 1089 21 0.3009322584 ( 7.5480623245 4.3349599838 -6.5720539093 ) + weight 1090 24 0.2251446694 ( 7.5480623245 -2.5723199844 -8.0127420425 ) + weight 1091 26 0.2140847892 ( 1.9575202465 -10.4136285782 -9.9332418442 ) + weight 1092 24 0.1180321574 ( 8.4589996338 0.394241184 -0.8727049828 ) + weight 1093 25 0.1174490154 ( 7.1019010544 -4.7979969978 -6.6458392143 ) + weight 1094 26 0.7645187974 ( 2.8684580326 -7.4470672607 -2.7932040691 ) + weight 1095 26 0.8932843804 ( 7.4059576988 -9.5095643997 -3.6182038784 ) + weight 1096 27 0.1067156196 ( -8.1101417542 -1.0986834764 1.2177509069 ) + weight 1097 26 1 ( 8.0247087479 -7.9283151627 -1.6244542599 ) + weight 1098 26 0.8398555517 ( 11.7486953735 -8.353553772 -0.3205916286 ) + weight 1099 27 0.1601444781 ( -3.7674033642 0.0573271364 4.5153632164 ) + weight 1100 26 0.8942742944 ( 7.4059576988 -8.4095630646 -5.8182044029 ) + weight 1101 27 0.1057257205 ( -8.1101417542 0.0013178461 -0.9822493792 ) + weight 1102 26 0.8746653199 ( 12.546869278 -8.9144906998 -3.065741539 ) + weight 1103 27 0.1253346652 ( -2.9692292213 -0.5036097765 1.7702132463 ) + weight 1104 26 0.9074409604 ( 10.7643814087 -7.1965513229 -6.2548666 ) + weight 1105 27 0.0925590619 ( -4.7517166138 1.2143296003 -1.4189118147 ) + weight 1106 26 0.8426043987 ( 10.8331317902 -8.77780056 -5.6361169815 ) + weight 1107 27 0.1573956013 ( -4.6829662323 -0.3669196367 -0.8001619577 ) + weight 1108 26 0.7722041011 ( 11.619969368 -9.7302398682 -4.4819040298 ) + weight 1109 27 0.2277958691 ( -3.8961291313 -1.3193589449 0.3540509939 ) + weight 1110 26 0.4436197281 ( 15.8119068146 -7.7484140396 -2.2668290138 ) + weight 1111 27 0.5563802719 ( 0.2958083153 0.6624668837 2.5691258907 ) + weight 1112 26 0.5 ( 15.5509195328 -8.792301178 -8.6094665527 ) + weight 1113 27 0.5 ( 0.0348210335 -0.3814202547 -3.7735116482 ) + weight 1114 27 1 ( 3.0255079269 -0.0860339478 3.7878005505 ) + weight 1115 26 0.5 ( 15.6336078644 -11.0858783722 -7.2224664688 ) + weight 1116 27 0.5 ( 0.1175093651 -2.6749973297 -2.3865115643 ) + weight 1117 27 1 ( 4.798283577 1.8273037672 4.5234131813 ) + weight 1118 27 1 ( 6.076772213 -2.5571470261 4.5871882439 ) + weight 1119 27 1 ( 7.3595333099 -2.7999858856 -0.774974227 ) + weight 1120 27 1 ( 9.4349594116 -0.5188828707 -0.7386744022 ) + weight 1121 27 1 ( 14.9613332748 1.4355152845 4.6217632294 ) + weight 1122 27 1 ( 14.9046087265 0.6255549192 4.4462509155 ) + weight 1123 27 0.8000000119 ( 17.0866203308 -1.1425858736 4.0193004608 ) + weight 1124 29 0.200000003 ( 0.9734535217 -0.2799913287 -1.787817359 ) + weight 1125 29 0.7061453462 ( 3.2464432716 -1.2205908298 -1.8558670282 ) + weight 1126 42 0.0916166157 ( 4.2458744049 -0.269906342 -1.9290235043 ) + weight 1127 35 0.2022380084 ( -0.799002409 -2.2181265354 -3.014701128 ) + weight 1128 52 1 ( -6.6526389122 2.5121285915 2.3073351383 ) + weight 1129 52 1 ( -8.5794372559 2.4464919567 0.3922730684 ) + weight 1130 51 0.8552805185 ( -14.4409503937 -5.9630961418 -2.8180017471 ) + weight 1131 52 0.1447194815 ( 1.0751366615 2.4476554394 2.0179479122 ) + weight 1132 51 0.4274499714 ( -16.9476261139 -4.908346653 -3.3817269802 ) + weight 1133 52 0.5725500584 ( -1.4315390587 3.5024049282 1.4542227983 ) + weight 1134 51 0.4358375371 ( -16.9942989349 -6.2754864693 -5.7808270454 ) + weight 1135 52 0.5641624331 ( -1.4782118797 2.1352651119 -0.9448772669 ) + weight 1136 51 0.4160711765 ( -17.1152000427 -5.2185482979 -4.600464344 ) + weight 1137 52 0.5839288235 ( -1.5991139412 3.1922032833 0.2354854345 ) + weight 1138 51 1 ( -8.6407117844 -3.3577485085 -0.9672020078 ) + weight 1139 51 1 ( -11.4328870773 -4.4769711494 -1.1207019091 ) + weight 1140 51 1 ( -8.7782115936 -2.120246172 -4.9547019005 ) + weight 1141 51 1 ( -7.5791115761 -5.6705708504 -7.3187894821 ) + weight 1142 51 1 ( -12.5766620636 -5.9159703255 -5.5380268097 ) + weight 1143 51 1 ( -7.090461731 -2.2040455341 -4.3488397598 ) + weight 1144 21 0.2071216553 ( -8.7274875641 9.0198850632 3.0605082512 ) + weight 1145 50 0.0757352263 ( -7.3703870773 -3.0796406269 -4.1533145905 ) + weight 1146 51 0.7171431184 ( -3.1369490623 -5.7286353111 -0.3006769717 ) + weight 1147 21 0.3016123176 ( -7.702750206 8.6077737808 1.9429836273 ) + weight 1148 24 0.0663812757 ( -7.702750206 1.7004936934 0.5022951961 ) + weight 1149 50 0.1016175151 ( -6.3456497192 -3.4917519093 -5.2708396912 ) + weight 1150 51 0.5303889513 ( -2.1122117043 -6.1407465935 -1.4182018042 ) + weight 1151 21 0.3238199353 ( -10.1284999847 9.1954612732 -2.2236537933 ) + weight 1152 51 0.6761800647 ( -4.5379619598 -5.5530591011 -5.584839344 ) + weight 1153 51 1 ( -6.2290363312 -2.5541348457 -5.5225143433 ) + weight 1154 21 0.3141192496 ( -10.0468006134 11.6795110703 -1.7254543304 ) + weight 1155 51 0.6858807206 ( -4.4562621117 -3.069009304 -5.0866398811 ) + weight 1156 21 0.483761996 ( -9.7927494049 10.1120376587 -3.147954464 ) + weight 1157 51 0.5162379742 ( -4.20221138 -4.6364827156 -6.5091395378 ) + weight 1158 24 0.2345368713 ( -6.4885997772 3.9747543335 -7.2829551697 ) + weight 1159 50 0.2774702609 ( -5.1314997673 -1.2174913883 -13.0560894012 ) + weight 1160 51 0.4879929125 ( -0.8980613947 -3.8664860725 -9.2034521103 ) + weight 1161 21 0.2748776376 ( 0 12.0645236969 -5.5260162354 ) + weight 1162 24 0.3276728392 ( 0 5.1572437286 -6.9667048454 ) + weight 1163 46 0.1724479198 ( 0 -2.0158445835 -9.5285253525 ) + weight 1164 25 0.1125003695 ( -1.357098937 -0.0349943414 -12.7398386002 ) + weight 1165 50 0.1125011891 ( 1.3571000099 -0.0350019746 -12.7398395538 ) + weight 1166 20 0.1643134952 ( 0 16.8068351746 -10.9376754761 ) + weight 1167 21 0.4178432226 ( 0 9.7732973099 -8.3003416061 ) + weight 1168 24 0.4178432226 ( 0 2.8660173416 -9.7410306931 ) + weight 1169 24 0.2036246806 ( -5.7985754013 6.8579645157 -7.9275555611 ) + weight 1170 50 0.3535286486 ( -4.4414753914 1.6657187939 -13.7006902695 ) + weight 1171 51 0.442846626 ( -0.2080368996 -0.9832757115 -9.8480520248 ) + weight 1172 21 0.223519817 ( -3.3398499489 12.4632740021 -7.8635163307 ) + weight 1173 24 0.2397254258 ( -3.3398499489 5.5559940338 -9.3042049408 ) + weight 1174 46 0.154696703 ( -3.3398499489 -1.6170942783 -11.866024971 ) + weight 1175 25 0.0830514953 ( -4.6969490051 0.3637559712 -15.0773382187 ) + weight 1176 50 0.1990065128 ( -1.982749939 0.3637483418 -15.0773391724 ) + weight 1177 51 0.1000000015 ( 2.2506883144 -2.2852461338 -11.2247018814 ) + weight 1178 20 0.1500628889 ( -2.2811000347 15.908074379 -9.4833498001 ) + weight 1179 21 0.4249685705 ( -2.2811000347 8.8745355606 -6.8460159302 ) + weight 1180 24 0.4249685705 ( -2.2811000347 1.9672554731 -8.2867040634 ) + weight 1181 20 0.1871334761 ( -5.1411004066 15.6605768204 -10.8583498001 ) + weight 1182 21 0.3529328108 ( -5.1411004066 8.627038002 -8.2210168839 ) + weight 1183 24 0.3524519503 ( -5.1411004066 1.7197579145 -9.6617050171 ) + weight 1184 51 0.1074817702 ( 0.4494380951 -6.1214823723 -11.5822019577 ) + weight 1185 21 0.3106785715 ( -0.9336999655 11.2736129761 -6.0618667603 ) + weight 1186 24 0.3323185146 ( -0.9336999655 4.3663330078 -7.5025553703 ) + weight 1187 46 0.1490715742 ( -0.9336999655 -2.8067553043 -10.0643758774 ) + weight 1188 25 0.0877479613 ( -2.2907991409 -0.8259050846 -13.2756891251 ) + weight 1189 50 0.1201833263 ( 0.4234000444 -0.825912714 -13.2756900787 ) + weight 1190 24 0.2036249638 ( 5.7985754013 6.8579645157 -7.9275555611 ) + weight 1191 25 0.353527993 ( 4.4414763451 1.6657264233 -13.7006893158 ) + weight 1192 26 0.4428470731 ( 0.2080333233 -0.9833443165 -9.8480548859 ) + weight 1193 21 0.2483555377 ( 3.3398499489 12.4632740021 -7.8635163307 ) + weight 1194 24 0.2663618028 ( 3.3398499489 5.5559940338 -9.3042049408 ) + weight 1195 46 0.1718853712 ( 3.3398499489 -1.6170942783 -11.866024971 ) + weight 1196 25 0.2211173922 ( 1.9827510118 0.3637559712 -15.0773382187 ) + weight 1197 50 0.0922798589 ( 4.6969499588 0.3637483418 -15.0773391724 ) + weight 1198 20 0.1343669146 ( 2.2811000347 15.908074379 -9.4833498001 ) + weight 1199 21 0.3805185854 ( 2.2811000347 8.8745355606 -6.8460159302 ) + weight 1200 24 0.3805185854 ( 2.2811000347 1.9672554731 -8.2867040634 ) + weight 1201 26 0.1045959145 ( -3.3094420433 -5.8740530014 -10.2072038651 ) + weight 1202 20 0.1649255604 ( 5.1411004066 15.6605768204 -10.8583498001 ) + weight 1203 21 0.3110487759 ( 5.1411004066 8.627038002 -8.2210168839 ) + weight 1204 24 0.3106249571 ( 5.1411004066 1.7197579145 -9.6617050171 ) + weight 1205 26 0.2134006619 ( -0.4494416714 -6.12155056 -11.5822038651 ) + weight 1206 21 0.3106787205 ( 0.9336999655 11.2736129761 -6.0618667603 ) + weight 1207 24 0.3323186636 ( 0.9336999655 4.3663330078 -7.5025553703 ) + weight 1208 46 0.1490716487 ( 0.9336999655 -2.8067553043 -10.0643758774 ) + weight 1209 25 0.1201823652 ( -0.4233989716 -0.8259050846 -13.2756891251 ) + weight 1210 50 0.0877486393 ( 2.2907998562 -0.825912714 -13.2756900787 ) + weight 1211 26 1 ( 7.0904583931 -2.2041141987 -4.3488416672 ) + weight 1212 21 0.1556877494 ( 8.7274875641 9.0198850632 3.0605082512 ) + weight 1213 25 0.0806478783 ( 7.3703885078 -3.0796332359 -4.1533141136 ) + weight 1214 26 0.7636643648 ( 3.1369452477 -5.7287034988 -0.3006792068 ) + weight 1215 21 0.2012292743 ( 7.702750206 8.6077737808 1.9429836273 ) + weight 1216 24 0.075924471 ( 7.702750206 1.7004936934 0.5022951961 ) + weight 1217 25 0.1162227169 ( 6.3456511497 -3.4917445183 -5.2708387375 ) + weight 1218 26 0.6066235304 ( 2.1122078896 -6.1408147812 -1.4182039499 ) + weight 1219 21 0.1647123843 ( 10.1284999847 9.1954612732 -2.2236537933 ) + weight 1220 26 0.835287571 ( 4.537958622 -5.5531272888 -5.5848412514 ) + weight 1221 26 1 ( 6.2290329933 -2.5542032719 -5.5225162506 ) + weight 1222 21 0.1586596668 ( 10.0468006134 11.6795110703 -1.7254543304 ) + weight 1223 26 0.841340363 ( 4.456258297 -3.0690777302 -5.0866417885 ) + weight 1224 21 0.3147997856 ( 9.7927494049 10.1120376587 -3.147954464 ) + weight 1225 25 0.0657253787 ( 8.4356508255 -1.987480402 -10.3617763519 ) + weight 1226 26 0.6194748282 ( 4.2022080421 -4.6365509033 -6.509141922 ) + weight 1227 24 0.2345379889 ( 6.4885997772 3.9747543335 -7.2829551697 ) + weight 1228 25 0.2774687409 ( 5.1315011978 -1.2174837589 -13.0560894012 ) + weight 1229 26 0.4879932702 ( 0.8980578184 -3.8665544987 -9.2034540176 ) + weight 1230 26 1 ( 8.6407079697 -3.3578169346 -0.9672042727 ) + weight 1231 26 1 ( 11.432882309 -4.4770393372 -1.1207040548 ) + weight 1232 26 1 ( 8.7782077789 -2.1203148365 -4.9547038078 ) + weight 1233 26 0.9282349944 ( 7.5791077614 -5.6706390381 -7.3187918663 ) + weight 1234 27 0.0717649981 ( -7.9369916916 2.7402420044 -2.4828369617 ) + weight 1235 26 1 ( 12.5766572952 -5.9160385132 -5.5380291939 ) + weight 1236 26 0.8552837372 ( 14.4409456253 -5.9631643295 -2.8180038929 ) + weight 1237 27 0.1447162926 ( -1.0751533508 2.447716713 2.0179510117 ) + weight 1238 26 0.4274564981 ( 16.9476203918 -4.9084148407 -3.381729126 ) + weight 1239 27 0.5725434422 ( 1.4315223694 3.5024662018 1.4542257786 ) + weight 1240 26 0.4358413815 ( 16.9942932129 -6.275554657 -5.7808289528 ) + weight 1241 27 0.5641586185 ( 1.4781951904 2.1353263855 -0.9448742867 ) + weight 1242 26 0.4160760641 ( 17.115196228 -5.2186164856 -4.6004662514 ) + weight 1243 27 0.5839239359 ( 1.5990972519 3.1922645569 0.2354884148 ) + weight 1244 27 1 ( 6.6526222229 2.5121898651 2.3073379993 ) + weight 1245 27 1 ( 8.5794210434 2.4465532303 0.3922760487 ) + weight 1246 50 0.1157932505 ( -9.8835258484 3.6568763256 -5.9885897636 ) + weight 1247 51 0.8842067719 ( -5.6500868797 1.0078818798 -2.1359519958 ) + weight 1248 50 0.3045143485 ( -6.0404005051 3.6499812603 -5.0398397446 ) + weight 1249 51 0.6954856515 ( -1.806961894 1.0009868145 -1.1872018576 ) + weight 1250 50 0.3076488078 ( -7.3725500107 3.6193015575 -9.2214393616 ) + weight 1251 51 0.6923511624 ( -3.1391115189 0.9703070521 -5.3688020706 ) + weight 1252 50 0.6000000238 ( -5.4680995941 3.805239439 -13.061665535 ) + weight 1253 51 0.400000006 ( -1.2346613407 1.1562449932 -9.2090272903 ) + weight 1254 50 0.6000000238 ( -5.1522374153 4.6804838181 -11.5433645248 ) + weight 1255 51 0.400000006 ( -0.9187990427 2.0314891338 -7.690726757 ) + weight 1256 50 0.6000000238 ( -6.9112248421 3.6745193005 -12.8399896622 ) + weight 1257 51 0.400000006 ( -2.6777863503 1.0255248547 -8.9873514175 ) + weight 1258 24 0.0710144043 ( -8.170249939 8.4572477341 -5.2623920441 ) + weight 1259 50 0.3363700807 ( -6.813149929 3.2650020123 -11.0355272293 ) + weight 1260 51 0.5926155448 ( -2.5797116756 0.6160075665 -7.1828889847 ) + weight 1261 24 0.21481134 ( 0 11.628900528 0.8429574966 ) + weight 1262 46 0.4136288464 ( 0 4.4558134079 -1.718862772 ) + weight 1263 47 0.3079245389 ( 0 1.1487300396 -4.2108154297 ) + weight 1264 48 0.0636352748 ( 0 0.2171580195 -6.4698748589 ) + weight 1265 24 0.3458175957 ( 0 10.4097423553 -3.0067050457 ) + weight 1266 46 0.3458175957 ( 0 3.2366549969 -5.5685253143 ) + weight 1267 25 0.1541830152 ( -1.357098937 5.2175049782 -8.7798395157 ) + weight 1268 50 0.1541817784 ( 1.3571000099 5.2174973488 -8.7798395157 ) + weight 1269 21 0.0567029305 ( 0 18.9532699585 -3.1060166359 ) + weight 1270 24 0.2824631631 ( 0 12.0459899902 -4.5467047691 ) + weight 1271 46 0.2824631631 ( 0 4.8729028702 -7.1085252762 ) + weight 1272 25 0.1891863197 ( -1.357098937 6.8537526131 -10.3198385239 ) + weight 1273 50 0.1891844869 ( 1.3571000099 6.8537449837 -10.3198394775 ) + weight 1274 21 0.0947859734 ( 0 18.0161514282 -5.357404232 ) + weight 1275 24 0.2565671802 ( 0 11.10887146 -6.7980928421 ) + weight 1276 46 0.2565671802 ( 0 3.9357841015 -9.3599128723 ) + weight 1277 25 0.1960403323 ( -1.357098937 5.9166340828 -12.5712270737 ) + weight 1278 50 0.1960392743 ( 1.3571000099 5.9166264534 -12.5712270737 ) + weight 1279 21 0.1081030741 ( 0 16.1907157898 -4.5433421135 ) + weight 1280 24 0.2734754682 ( 0 9.2834348679 -5.9840302467 ) + weight 1281 46 0.2679514885 ( 0 2.1103465557 -8.5458507538 ) + weight 1282 25 0.175235182 ( -1.357098937 4.091196537 -11.7571640015 ) + weight 1283 50 0.1752348393 ( 1.3571000099 4.0911893845 -11.7571649551 ) + weight 1284 21 0.1953482777 ( 0 14.3023824692 -6.8105416298 ) + weight 1285 24 0.2659406066 ( 0 7.3951025009 -8.2512302399 ) + weight 1286 46 0.2151979059 ( 0 0.2220141888 -10.8130502701 ) + weight 1287 25 0.1617564112 ( -1.357098937 2.2028644085 -14.0243644714 ) + weight 1288 50 0.1617567837 ( 1.3571000099 2.2028567791 -14.0243644714 ) + weight 1289 47 1 ( 0 2.2212319374 -3.6333150864 ) + weight 1290 50 0.8509328961 ( -2.0745501518 4.6375207901 -4.5531520844 ) + weight 1291 51 0.1490670592 ( 2.15888834 1.9885261059 -0.7005144954 ) + weight 1292 50 0.6615877151 ( -3.2931752205 3.6311938763 -7.8413896561 ) + weight 1293 51 0.3384123147 ( 0.9402632713 0.9821993709 -3.9887518883 ) + weight 1294 50 0.7316260338 ( -4.8716497421 5.2724957466 -8.9585895538 ) + weight 1295 51 0.268373996 ( -0.6382113695 2.6235013008 -5.1059522629 ) + weight 1296 24 0.0693065748 ( -3.8571250439 11.3172683716 -0.8431047201 ) + weight 1297 46 0.0746436641 ( -3.8571250439 4.1441812515 -3.404925108 ) + weight 1298 50 0.6004034281 ( -2.500025034 6.125023365 -6.6162395477 ) + weight 1299 51 0.2556463778 ( 1.7334133387 3.4760289192 -2.7636017799 ) + weight 1300 24 0.1309292912 ( -5.9093999863 9.0852708817 -5.6865797043 ) + weight 1301 50 0.4126920998 ( -4.5522999763 3.8930251598 -11.4597148895 ) + weight 1302 51 0.4563786387 ( -0.3188616037 1.244030714 -7.6070771217 ) + weight 1303 24 0.2120236903 ( -2.6262500286 10.1484928131 -5.6054549217 ) + weight 1304 46 0.2120236903 ( -2.6262500286 2.9754054546 -8.1672754288 ) + weight 1305 50 0.2879763246 ( -1.2691500187 4.9562482834 -11.3785896301 ) + weight 1306 51 0.2879763246 ( 2.9642882347 2.3072535992 -7.5259518623 ) + weight 1307 24 0.102869682 ( -3.267275095 11.4106140137 -3.6056799889 ) + weight 1308 46 0.102869682 ( -3.267275095 4.2375268936 -6.1675000191 ) + weight 1309 50 0.6012839675 ( -1.9101750851 6.2183690071 -9.3788146973 ) + weight 1310 51 0.1929766387 ( 2.3232631683 3.5693745613 -5.5261769295 ) + weight 1311 24 0.0571199618 ( -2.5456750393 11.2799510956 -1.7368924618 ) + weight 1312 46 0.0584545359 ( -2.5456750393 4.1068639755 -4.2987127304 ) + weight 1313 50 0.8003379703 ( -1.1885750294 6.087706089 -7.5100269318 ) + weight 1314 51 0.0840874538 ( 3.044863224 3.4387116432 -3.6573894024 ) + weight 1315 24 0.3466432691 ( -0.7719249725 11.458688736 -1.5718924999 ) + weight 1316 46 0.3640886843 ( -0.7719249725 4.2856016159 -4.1337127686 ) + weight 1317 47 0.2180555016 ( -0.7719249725 0.978518188 -6.6256651878 ) + weight 1318 48 0.0712125599 ( -0.7719249725 0.0469462164 -8.884724617 ) + weight 1319 21 0.059975449 ( -1.3127000332 18.6825904846 -3.3249788284 ) + weight 1320 24 0.2719159424 ( -1.3127000332 11.775308609 -4.7656674385 ) + weight 1321 46 0.2719159424 ( -1.3127000332 4.602221489 -7.3274874687 ) + weight 1322 25 0.1371879131 ( -2.6697990894 6.5830712318 -10.5388011932 ) + weight 1323 50 0.2590048015 ( 0.0443999469 6.5830636024 -10.5388021469 ) + weight 1324 21 0.0560896993 ( -0.8055125475 16.7786750793 -2.2916042805 ) + weight 1325 24 0.3113728762 ( -0.8055125475 9.8713941574 -3.7322926521 ) + weight 1326 46 0.3113728762 ( -0.8055125475 2.6983058453 -6.2941131592 ) + weight 1327 25 0.1187654585 ( -2.1626114845 4.6791558266 -9.5054264069 ) + weight 1328 50 0.2023991197 ( 0.5515874624 4.679148674 -9.5054273605 ) + weight 1329 24 0.0630461648 ( -2.2981748581 9.7949476242 -1.2968921661 ) + weight 1330 46 0.0630461648 ( -2.2981748581 2.6218593121 -3.8587124348 ) + weight 1331 50 0.8001715541 ( -0.9410749674 4.6027021408 -7.0700268745 ) + weight 1332 51 0.073736161 ( 3.2923636436 1.9537074566 -3.2173891068 ) + weight 1333 24 0.4195119739 ( -0.7581750154 10.3036937714 -1.2831425667 ) + weight 1334 46 0.4206725657 ( -0.7581750154 3.1306064129 -3.8449628353 ) + weight 1335 47 0.1598154306 ( -0.7581750154 -0.1764767766 -6.336915493 ) + weight 1336 21 0.1281623244 ( -1.4293000698 15.1101446152 -4.3985171318 ) + weight 1337 24 0.2779042721 ( -1.4293000698 8.2028646469 -5.839205265 ) + weight 1338 46 0.2525319755 ( -1.4293000698 1.0297763348 -8.4010257721 ) + weight 1339 25 0.1140847057 ( -2.7863988876 3.0106263161 -11.6123390198 ) + weight 1340 50 0.2273167372 ( -0.0722000003 3.0106189251 -11.6123399734 ) + weight 1341 25 1 ( 2.0745511055 4.6375279427 -4.5531516075 ) + weight 1342 25 1 ( 3.2931761742 3.6312012672 -7.8413891792 ) + weight 1343 24 0.0743158236 ( 6.228749752 10.4647407532 -3.1854553223 ) + weight 1344 25 0.456292659 ( 4.8716506958 5.272503376 -8.9585895538 ) + weight 1345 26 0.4693915546 ( 0.6382077932 2.6234328747 -5.1059546471 ) + weight 1346 25 1 ( 2.500026226 6.1250309944 -6.6162385941 ) + weight 1347 24 0.1309287101 ( 5.9093999863 9.0852708817 -5.6865797043 ) + weight 1348 25 0.4126920104 ( 4.5523014069 3.8930325508 -11.4597139359 ) + weight 1349 26 0.4563792944 ( 0.3188580275 1.2439620495 -7.6070790291 ) + weight 1350 25 1 ( 1.910176158 6.2183766365 -9.3788137436 ) + weight 1351 25 1 ( 1.2691510916 4.9562554359 -11.3785886765 ) + weight 1352 25 1 ( 1.1885761023 6.0877137184 -7.5100264549 ) + weight 1353 24 0.3466432691 ( 0.7719249725 11.458688736 -1.5718924999 ) + weight 1354 46 0.3640886843 ( 0.7719249725 4.2856016159 -4.1337127686 ) + weight 1355 47 0.2180555016 ( 0.7719249725 0.978518188 -6.6256651878 ) + weight 1356 48 0.0712125599 ( 0.7719249725 0.0469462164 -8.884724617 ) + weight 1357 21 0.059975341 ( 1.3127000332 18.6825904846 -3.3249788284 ) + weight 1358 24 0.2719154656 ( 1.3127000332 11.775308609 -4.7656674385 ) + weight 1359 46 0.2719154656 ( 1.3127000332 4.602221489 -7.3274874687 ) + weight 1360 25 0.2590071261 ( -0.0443989038 6.5830712318 -10.5388011932 ) + weight 1361 50 0.1371866614 ( 2.6698002815 6.5830636024 -10.5388021469 ) + weight 1362 21 0.0560896583 ( 0.8055125475 16.7786750793 -2.2916042805 ) + weight 1363 24 0.3113726079 ( 0.8055125475 9.8713941574 -3.7322926521 ) + weight 1364 46 0.3113726079 ( 0.8055125475 2.6983058453 -6.2941131592 ) + weight 1365 25 0.2024002373 ( -0.5515864491 4.6791558266 -9.5054264069 ) + weight 1366 50 0.1187648475 ( 2.1626124382 4.679148674 -9.5054273605 ) + weight 1367 25 1 ( 0.9410759807 4.6027092934 -7.0700263977 ) + weight 1368 24 0.4195119739 ( 0.7581750154 10.3036937714 -1.2831425667 ) + weight 1369 46 0.4206725657 ( 0.7581750154 3.1306064129 -3.8449628353 ) + weight 1370 47 0.1598154306 ( 0.7581750154 -0.1764767766 -6.336915493 ) + weight 1371 21 0.1153460816 ( 1.4293000698 15.1101446152 -4.3985171318 ) + weight 1372 24 0.2501138151 ( 1.4293000698 8.2028646469 -5.839205265 ) + weight 1373 46 0.2272787541 ( 1.4293000698 1.0297763348 -8.4010257721 ) + weight 1374 25 0.2045848966 ( 0.0722010434 3.0106263161 -11.6123390198 ) + weight 1375 26 0.0999999866 ( -4.1612420082 0.3615557849 -7.7597045898 ) + weight 1376 50 0.102676332 ( 2.7864000797 3.0106189251 -11.6123399734 ) + weight 1377 25 0.1157909781 ( 9.8835268021 3.6568837166 -5.9885892868 ) + weight 1378 26 0.8842089772 ( 5.6500835419 1.0078132153 -2.1359541416 ) + weight 1379 25 0.6999999881 ( 6.0404014587 3.6499886513 -5.0398387909 ) + weight 1380 26 0.3000000119 ( 1.8069583178 1.0009181499 -1.1872041225 ) + weight 1381 25 0.3076472282 ( 7.3725509644 3.6193089485 -9.2214393616 ) + weight 1382 26 0.6923528314 ( 3.1391077042 0.9702384472 -5.3688044548 ) + weight 1383 24 0.4800000191 ( 6.825199604 8.9974851608 -7.2885303497 ) + weight 1384 25 0.1200000048 ( 5.4681010246 3.80524683 -13.0616645813 ) + weight 1385 26 0.400000006 ( 1.2346577644 1.1561763287 -9.2090301514 ) + weight 1386 24 0.4800000191 ( 6.5093374252 9.8727293015 -5.7702298164 ) + weight 1387 25 0.1200000048 ( 5.1522388458 4.6804909706 -11.5433635712 ) + weight 1388 26 0.400000006 ( 0.9187954664 2.0314204693 -7.6907291412 ) + weight 1389 24 0.4800000191 ( 8.268324852 8.8667650223 -7.0668549538 ) + weight 1390 25 0.1200000048 ( 6.9112257957 3.6745266914 -12.8399887085 ) + weight 1391 26 0.400000006 ( 2.677782774 1.0254561901 -8.9873542786 ) + weight 1392 24 0.071014069 ( 8.170249939 8.4572477341 -5.2623920441 ) + weight 1393 25 0.3363693058 ( 6.8131513596 3.2650094032 -11.0355262756 ) + weight 1394 26 0.5926166773 ( 2.5797080994 0.6159388423 -7.1828913689 ) + weight 1395 47 1 ( 0 4.4533257484 -4.1004776955 ) + weight 1396 47 1 ( 0 4.934568882 -4.7879776955 ) + weight 1397 47 1 ( -2.0978500843 4.5203881264 -3.6376028061 ) + weight 1398 47 1 ( -2.427850008 5.2766232491 -4.2563529015 ) + weight 1399 47 1 ( 2.0978500843 4.5203881264 -3.6376028061 ) + weight 1400 47 1 ( 2.427850008 5.2766232491 -4.2563529015 ) +} diff --git a/viewerwidget.cpp b/viewerwidget.cpp index 7856195..a535333 100644 --- a/viewerwidget.cpp +++ b/viewerwidget.cpp @@ -1,6 +1,9 @@ #include "viewerwidget.h" + +#include #include "mainwindow.h" + ViewerWidget::ViewerWidget(MainWindow *parent): QGLWidget(parent) { @@ -12,6 +15,28 @@ void ViewerWidget::initializeGL() mainWindow->writeLog("Initializing...\n"); if (context()->format().openGLVersionFlags() & QGLFormat::OpenGL_Version_2_1) mainWindow->writeLog("OpenGL 2.1 is available :)\n"); + + // Shader setup + vertexShaderSource = readFile("default.vert"); + fragmentShaderSource = readFile("default.frag"); + const GLchar *vertSrc = vertexShaderSource.data(); + const GLchar *fragSrc = fragmentShaderSource.data(); + vertexShaderID = glCreateShader(GL_VERTEX_SHADER); + fragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER); + glShaderSource(vertexShaderID, 1, &vertSrc, 0); + glShaderSource(fragmentShaderID, 1, &fragSrc, 0); + glCompileShader(vertexShaderID); + glCompileShader(fragmentShaderID); + shaderProgramID=glCreateProgram(); + glAttachShader(shaderProgramID, vertexShaderID); + glAttachShader(shaderProgramID, fragmentShaderID); + + glEnableVertexAttribArray(0); + glBindAttribLocation(shaderprogram, 0, "in_Position"); + + glLinkProgram(); + + // Set up the rendering context, define display lists etc.: glClearColor(0.0, 0.0, 0.0, 0.0); glEnable(GL_DEPTH_TEST); @@ -28,3 +53,8 @@ void ViewerWidget::paintGL() // draw the scene: glClear(GL_COLOR_BUFFER_BIT); } + +QByteArray ViewerWidget::readFile(QString filename) +{ + return QFile(filename).readAll(); +} diff --git a/viewerwidget.h b/viewerwidget.h index 916809f..d6a28cf 100644 --- a/viewerwidget.h +++ b/viewerwidget.h @@ -2,6 +2,8 @@ #define VIEWERWIDGET_H #include +#include +#include class MainWindow; @@ -16,8 +18,14 @@ protected: void paintGL(); private: + QByteArray readFile(QString filename); MainWindow *mainWindow; + QByteArray vertexShaderSource; + QByteArray fragmentShaderSource; + GLuint vertexShaderID; + GLuint fragmentShaderID; + GLuint shaderProgramID; }; #endif // VIEWERWIDGET_H