├── .gitignore ├── Intel Sample Source Code License.TXT ├── README.md ├── assets ├── fonts │ ├── inconsolata.fnt │ └── inconsolata.png └── shaders │ ├── precompiled_cube.shader │ ├── runtime_cube.shader │ ├── ui.fragment.glsl │ └── ui.vertex.glsl ├── projects ├── android │ ├── AndroidManifest.xml │ ├── ant.properties │ ├── build.xml │ ├── jni │ │ ├── Android.mk │ │ ├── AndroidAppJNI.cpp │ │ └── Application.mk │ ├── local.properties │ ├── proguard-project.txt │ ├── project.properties │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── layout │ │ │ └── main.xml │ │ └── values │ │ │ └── strings.xml │ └── src │ │ └── com │ │ └── intel │ │ └── precompiledshaders │ │ ├── PrecompiledLib.java │ │ ├── PrecompiledMain.java │ │ └── PrecompiledView.java ├── precompiledshader-sample.sublime-project └── precompiledshader-sample.sublime-workspace └── src ├── App.cpp ├── App.h ├── LICENSE ├── fonts.cpp ├── fonts.h ├── glm ├── CMakeLists.txt ├── core │ ├── _detail.hpp │ ├── _fixes.hpp │ ├── _swizzle.hpp │ ├── _swizzle_func.hpp │ ├── _vectorize.hpp │ ├── dummy.cpp │ ├── func_common.hpp │ ├── func_common.inl │ ├── func_exponential.hpp │ ├── func_exponential.inl │ ├── func_geometric.hpp │ ├── func_geometric.inl │ ├── func_integer.hpp │ ├── func_integer.inl │ ├── func_matrix.hpp │ ├── func_matrix.inl │ ├── func_noise.hpp │ ├── func_noise.inl │ ├── func_packing.hpp │ ├── func_packing.inl │ ├── func_trigonometric.hpp │ ├── func_trigonometric.inl │ ├── func_vector_relational.hpp │ ├── func_vector_relational.inl │ ├── hint.hpp │ ├── intrinsic_common.hpp │ ├── intrinsic_common.inl │ ├── intrinsic_exponential.hpp │ ├── intrinsic_exponential.inl │ ├── intrinsic_geometric.hpp │ ├── intrinsic_geometric.inl │ ├── intrinsic_matrix.hpp │ ├── intrinsic_matrix.inl │ ├── intrinsic_trigonometric.hpp │ ├── intrinsic_trigonometric.inl │ ├── intrinsic_vector_relational.hpp │ ├── intrinsic_vector_relational.inl │ ├── setup.hpp │ ├── type.hpp │ ├── type_float.hpp │ ├── type_gentype.hpp │ ├── type_gentype.inl │ ├── type_half.hpp │ ├── type_half.inl │ ├── type_int.hpp │ ├── type_mat.hpp │ ├── type_mat.inl │ ├── type_mat2x2.hpp │ ├── type_mat2x2.inl │ ├── type_mat2x3.hpp │ ├── type_mat2x3.inl │ ├── type_mat2x4.hpp │ ├── type_mat2x4.inl │ ├── type_mat3x2.hpp │ ├── type_mat3x2.inl │ ├── type_mat3x3.hpp │ ├── type_mat3x3.inl │ ├── type_mat3x4.hpp │ ├── type_mat3x4.inl │ ├── type_mat4x2.hpp │ ├── type_mat4x2.inl │ ├── type_mat4x3.hpp │ ├── type_mat4x3.inl │ ├── type_mat4x4.hpp │ ├── type_mat4x4.inl │ ├── type_size.hpp │ ├── type_vec.hpp │ ├── type_vec.inl │ ├── type_vec1.hpp │ ├── type_vec1.inl │ ├── type_vec2.hpp │ ├── type_vec2.inl │ ├── type_vec3.hpp │ ├── type_vec3.inl │ ├── type_vec4.hpp │ └── type_vec4.inl ├── ext.hpp ├── glm.hpp ├── gtc │ ├── constants.hpp │ ├── constants.inl │ ├── epsilon.hpp │ ├── epsilon.inl │ ├── half_float.hpp │ ├── half_float.inl │ ├── matrix_access.hpp │ ├── matrix_access.inl │ ├── matrix_integer.hpp │ ├── matrix_inverse.hpp │ ├── matrix_inverse.inl │ ├── matrix_transform.hpp │ ├── matrix_transform.inl │ ├── noise.hpp │ ├── noise.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── random.hpp │ ├── random.inl │ ├── reciprocal.hpp │ ├── reciprocal.inl │ ├── swizzle.hpp │ ├── swizzle.inl │ ├── type_precision.hpp │ ├── type_precision.inl │ ├── type_ptr.hpp │ ├── type_ptr.inl │ ├── ulp.hpp │ └── ulp.inl ├── gtx │ ├── associated_min_max.hpp │ ├── associated_min_max.inl │ ├── bit.hpp │ ├── bit.inl │ ├── closest_point.hpp │ ├── closest_point.inl │ ├── color_cast.hpp │ ├── color_cast.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── color_space_YCoCg.hpp │ ├── color_space_YCoCg.inl │ ├── compatibility.hpp │ ├── compatibility.inl │ ├── component_wise.hpp │ ├── component_wise.inl │ ├── constants.hpp │ ├── epsilon.hpp │ ├── euler_angles.hpp │ ├── euler_angles.inl │ ├── extend.hpp │ ├── extend.inl │ ├── extented_min_max.hpp │ ├── extented_min_max.inl │ ├── fast_exponential.hpp │ ├── fast_exponential.inl │ ├── fast_square_root.hpp │ ├── fast_square_root.inl │ ├── fast_trigonometry.hpp │ ├── fast_trigonometry.inl │ ├── gradient_paint.hpp │ ├── gradient_paint.inl │ ├── handed_coordinate_space.hpp │ ├── handed_coordinate_space.inl │ ├── inertia.hpp │ ├── inertia.inl │ ├── int_10_10_10_2.hpp │ ├── int_10_10_10_2.inl │ ├── integer.hpp │ ├── integer.inl │ ├── intersect.hpp │ ├── intersect.inl │ ├── log_base.hpp │ ├── log_base.inl │ ├── matrix_cross_product.hpp │ ├── matrix_cross_product.inl │ ├── matrix_interpolation.hpp │ ├── matrix_interpolation.inl │ ├── matrix_major_storage.hpp │ ├── matrix_major_storage.inl │ ├── matrix_operation.hpp │ ├── matrix_operation.inl │ ├── matrix_query.hpp │ ├── matrix_query.inl │ ├── mixed_product.hpp │ ├── mixed_product.inl │ ├── multiple.hpp │ ├── multiple.inl │ ├── noise.hpp │ ├── norm.hpp │ ├── norm.inl │ ├── normal.hpp │ ├── normal.inl │ ├── normalize_dot.hpp │ ├── normalize_dot.inl │ ├── number_precision.hpp │ ├── number_precision.inl │ ├── ocl_type.hpp │ ├── ocl_type.inl │ ├── optimum_pow.hpp │ ├── optimum_pow.inl │ ├── orthonormalize.hpp │ ├── orthonormalize.inl │ ├── perpendicular.hpp │ ├── perpendicular.inl │ ├── polar_coordinates.hpp │ ├── polar_coordinates.inl │ ├── projection.hpp │ ├── projection.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── random.hpp │ ├── raw_data.hpp │ ├── raw_data.inl │ ├── reciprocal.hpp │ ├── rotate_vector.hpp │ ├── rotate_vector.inl │ ├── simd_mat4.hpp │ ├── simd_mat4.inl │ ├── simd_vec4.hpp │ ├── simd_vec4.inl │ ├── spline.hpp │ ├── spline.inl │ ├── std_based_type.hpp │ ├── std_based_type.inl │ ├── string_cast.hpp │ ├── string_cast.inl │ ├── transform.hpp │ ├── transform.inl │ ├── transform2.hpp │ ├── transform2.inl │ ├── ulp.hpp │ ├── unsigned_int.hpp │ ├── unsigned_int.inl │ ├── vec1.hpp │ ├── vec1.inl │ ├── vector_access.hpp │ ├── vector_access.inl │ ├── vector_angle.hpp │ ├── vector_angle.inl │ ├── vector_query.hpp │ ├── vector_query.inl │ ├── verbose_operator.hpp │ ├── verbose_operator.inl │ ├── wrap.hpp │ └── wrap.inl └── virtrev │ └── xstream.hpp ├── model.cpp ├── model.h ├── opengl.h ├── shader.cpp ├── shader.h ├── stb_image.cpp ├── stb_image.h ├── system.h ├── system_android.cpp ├── texture.cpp ├── texture.h ├── timer.cpp └── timer.h /.gitignore: -------------------------------------------------------------------------------- 1 | # no .DS_Store files 2 | .DS_Store 3 | # no .o files 4 | *.o 5 | # no .a files 6 | *.a 7 | # ignore all files in the projects/android/bin/ directory 8 | projects/android/bin/ 9 | # ignore all files in the projects/android/gen/ directory 10 | projects/android/gen/ 11 | # ignore all files in the projects/android/libs/ directory 12 | projects/android/libs/ 13 | # ignore all files in the projects/android/obj/ directory 14 | projects/android/obj/ 15 | -------------------------------------------------------------------------------- /Intel Sample Source Code License.TXT: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Intel Corporation - Android Sample Application 2 | 3 | Note: “Media Elements” are the images, clip art, animations, sounds, music, shapes, video clips, 2D Images, 2D and 3D Mesh’s and mesh data, animation and animation data, and Textures included in the software. This license does not grant you any rights in the Media Elements and you may not reproduce, prepare derivative works, distribute, publicly display, or publicly perform the Media Elements. 4 | 5 | Note: The source code sample is provided under the BSD license. See the license folder within the sample source directory for additional details. 6 | 7 | === ABOUT === 8 | Programmatically compiling all shaders the first time an application is run and saving the binaries for reuse can significantly reduce load times for games in subsequent runs. The OpenGL* ES 3.0 sample code introduced here demonstrates a simple implementation of this capability. 9 | 10 | === INSTALLATION === 11 | Navigate to PrecompiledShaders\projects\android with a device connected, or the emulator running. 12 | Run the following: 13 | android update project –p . 14 | ndk-build 15 | ant debug 16 | ant installd 17 | -------------------------------------------------------------------------------- /assets/fonts/inconsolata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cristianohh/PrecompiledShaders/d91f0159bfb4a4a8d786dc0873f5c48353702c5c/assets/fonts/inconsolata.png -------------------------------------------------------------------------------- /assets/shaders/precompiled_cube.shader: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #ifdef FRAGMENT 30 | precision mediump float; 31 | #endif 32 | 33 | 34 | varying vec4 v_Col; 35 | varying vec3 v_normal; 36 | 37 | 38 | uniform mat4 u_view_proj_matrix; 39 | uniform mat4 u_world_matrix; 40 | 41 | #ifdef VERTEX 42 | 43 | attribute vec3 a_position; 44 | attribute vec3 a_normal; 45 | attribute vec4 a_color; 46 | 47 | void main() 48 | { 49 | 50 | v_Col = a_color; 51 | 52 | // Transform normal to view space 53 | v_normal = ( u_world_matrix * vec4(a_normal, 0.0) ).xyz; 54 | 55 | // Convert position into screen space 56 | gl_Position = u_view_proj_matrix * u_world_matrix * vec4(a_position, 1.0); 57 | 58 | } 59 | #endif 60 | 61 | 62 | #ifdef FRAGMENT 63 | 64 | vec3 direction_to_light = vec3(0.0, 0.0, 1.0); 65 | vec3 direction_to_eye = vec3(0.0, 0.0, 1.0); 66 | 67 | void main() 68 | { 69 | float diffuseFactor = dot(v_normal, direction_to_light); 70 | float specularFactor = pow(dot(reflect(direction_to_eye, v_normal), direction_to_light), 128.0); 71 | 72 | gl_FragColor = (diffuseFactor + specularFactor) * vec4(0.0 + v_Col.x, 0.4863 + v_Col.y, 0.5725 + v_Col.z, 1.0); 73 | } 74 | 75 | #endif -------------------------------------------------------------------------------- /assets/shaders/runtime_cube.shader: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #ifdef FRAGMENT 30 | precision mediump float; 31 | #endif 32 | 33 | 34 | varying vec4 v_Col; 35 | varying vec3 v_normal; 36 | 37 | 38 | uniform mat4 u_view_proj_matrix; 39 | uniform mat4 u_world_matrix; 40 | 41 | #ifdef VERTEX 42 | 43 | attribute vec3 a_position; 44 | attribute vec3 a_normal; 45 | attribute vec4 a_color; 46 | 47 | void main() 48 | { 49 | 50 | v_Col = a_color; 51 | 52 | // Transform normal to view space 53 | v_normal = ( u_world_matrix * vec4(a_normal, 0.0) ).xyz; 54 | 55 | // Convert position into screen space 56 | gl_Position = u_view_proj_matrix * u_world_matrix * vec4(a_position, 1.0); 57 | 58 | } 59 | #endif 60 | 61 | 62 | #ifdef FRAGMENT 63 | 64 | vec3 direction_to_light = vec3(0.0, 0.0, 1.0); 65 | vec3 direction_to_eye = vec3(0.0, 0.0, 1.0); 66 | 67 | void main() 68 | { 69 | float diffuseFactor = dot(v_normal, direction_to_light); 70 | float specularFactor = pow(dot(reflect(direction_to_eye, v_normal), direction_to_light), 16.0); 71 | gl_FragColor = (diffuseFactor + specularFactor) * vec4(0.902 + v_Col.x, 0.6902 + v_Col.y, 0.0706 + v_Col.z, 1.0); 72 | } 73 | 74 | #endif -------------------------------------------------------------------------------- /assets/shaders/ui.fragment.glsl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | precision highp float; 30 | 31 | uniform sampler2D s_texture; 32 | uniform vec4 u_color; 33 | 34 | varying vec2 v_tex_coord; 35 | 36 | void main() 37 | { 38 | gl_FragColor = u_color * texture2D( s_texture, vec2(v_tex_coord.x, v_tex_coord.y) ); 39 | } 40 | -------------------------------------------------------------------------------- /assets/shaders/ui.vertex.glsl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | uniform mat4 u_world; 30 | 31 | attribute vec4 a_position; 32 | attribute vec2 a_tex_coord; 33 | 34 | varying vec2 v_tex_coord; 35 | 36 | void main() 37 | { 38 | v_tex_coord = a_tex_coord; 39 | gl_Position = u_world * a_position; 40 | } 41 | -------------------------------------------------------------------------------- /projects/android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 25 | 26 | -------------------------------------------------------------------------------- /projects/android/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /projects/android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | TOP_PATH := $(call my-dir)/.. 2 | 3 | LOCAL_PATH := $(TOP_PATH) 4 | 5 | include $(CLEAR_VARS) 6 | 7 | MY_LOCAL_C_INCLUDES := $(TOP_PATH)/../../src 8 | LOCAL_C_INCLUDES := $(MY_LOCAL_C_INCLUDES) 9 | LOCAL_C_INCLUDES += $(TOP_PATH)/../../../.. 10 | 11 | # automatically compile all .cpp and .c files 12 | LOCAL_SRC_FILES := $(wildcard jni/*.cpp) 13 | LOCAL_SRC_FILES += $(wildcard jni/*.c) 14 | LOCAL_SRC_FILES += $(wildcard $(MY_LOCAL_C_INCLUDES)/*.cpp) 15 | LOCAL_MODULE := precompiledapp 16 | LOCAL_CFLAGS := -DANDROID 17 | LOCAL_LDLIBS := -llog -landroid -lGLESv3 18 | 19 | include $(BUILD_SHARED_LIBRARY) 20 | -------------------------------------------------------------------------------- /projects/android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi armeabi-v7a x86 2 | APP_STL := gnustl_static 3 | 4 | -------------------------------------------------------------------------------- /projects/android/local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=C:\\Development\\adt-bundle-windows-x86_64-20130522\\adt-bundle-windows-x86_64-20130522\\sdk 11 | -------------------------------------------------------------------------------- /projects/android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /projects/android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-18 15 | -------------------------------------------------------------------------------- /projects/android/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cristianohh/PrecompiledShaders/d91f0159bfb4a4a8d786dc0873f5c48353702c5c/projects/android/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /projects/android/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cristianohh/PrecompiledShaders/d91f0159bfb4a4a8d786dc0873f5c48353702c5c/projects/android/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /projects/android/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cristianohh/PrecompiledShaders/d91f0159bfb4a4a8d786dc0873f5c48353702c5c/projects/android/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /projects/android/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cristianohh/PrecompiledShaders/d91f0159bfb4a4a8d786dc0873f5c48353702c5c/projects/android/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /projects/android/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cristianohh/PrecompiledShaders/d91f0159bfb4a4a8d786dc0873f5c48353702c5c/projects/android/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /projects/android/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /projects/android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Precompiled Samples 4 | 5 | -------------------------------------------------------------------------------- /projects/android/src/com/intel/precompiledshaders/PrecompiledLib.java: -------------------------------------------------------------------------------- 1 | package com.intel.precompiledshaders; 2 | 3 | import android.content.res.AssetManager; 4 | 5 | public class PrecompiledLib 6 | { 7 | 8 | // This is static so it will be called at startup (without creating an instance of this class) 9 | static 10 | { 11 | System.loadLibrary( "precompiledapp" ); 12 | } 13 | 14 | // Define native functions that can be called from Java code 15 | public static native void init( int width, int height ); 16 | public static native void step( float fElapsedTime ); 17 | public static native void createAssetManager( AssetManager assetManager ); 18 | } 19 | -------------------------------------------------------------------------------- /projects/android/src/com/intel/precompiledshaders/PrecompiledMain.java: -------------------------------------------------------------------------------- 1 | package com.intel.precompiledshaders; 2 | 3 | import android.app.Activity; 4 | import android.content.res.AssetManager; 5 | import android.os.Bundle; 6 | import android.util.Log; 7 | import android.view.View; 8 | 9 | 10 | public class PrecompiledMain extends Activity 11 | { 12 | static AssetManager sAssetManager; 13 | PrecompiledView mView; 14 | 15 | // On applications creation 16 | @Override protected void onCreate( Bundle savedInstanceState ) 17 | { 18 | super.onCreate( savedInstanceState ); 19 | 20 | // Pass the asset manager to the native code 21 | sAssetManager = getAssets(); 22 | PrecompiledLib.createAssetManager( sAssetManager ); 23 | 24 | // Set the layout 25 | setContentView( R.layout.main ); 26 | 27 | // Create our view for OpenGL rendering 28 | mView = ( PrecompiledView )findViewById( R.id.precompiled_view ); 29 | } 30 | 31 | @Override protected void onPause() 32 | { 33 | super.onPause(); 34 | mView.onPause(); 35 | } 36 | 37 | @Override protected void onResume() 38 | { 39 | super.onResume(); 40 | mView.onResume(); 41 | } 42 | } -------------------------------------------------------------------------------- /projects/android/src/com/intel/precompiledshaders/PrecompiledView.java: -------------------------------------------------------------------------------- 1 | package com.intel.precompiledshaders; 2 | 3 | import android.content.Context; 4 | import android.opengl.GLSurfaceView; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.view.MotionEvent; 8 | import javax.microedition.khronos.egl.EGLConfig; 9 | import javax.microedition.khronos.opengles.GL10; 10 | import android.os.SystemClock; 11 | 12 | class PrecompiledView extends GLSurfaceView 13 | { 14 | private PrecompiledRenderer m_pRenderer; 15 | 16 | public PrecompiledView( Context context ) 17 | { 18 | super( context ); 19 | init(); 20 | } 21 | 22 | public PrecompiledView( Context context, AttributeSet attrs ) 23 | { 24 | super( context, attrs ); 25 | init(); 26 | } 27 | 28 | public void init() 29 | { 30 | // Create an OpenGL ES 2.0 context 31 | setEGLContextClientVersion( 3 ); 32 | 33 | // Set the renderer associated with this view 34 | m_pRenderer = new PrecompiledRenderer(); 35 | setRenderer( m_pRenderer ); 36 | } 37 | 38 | private static class PrecompiledRenderer implements GLSurfaceView.Renderer 39 | { 40 | private long m_nLastTime; 41 | 42 | public void onDrawFrame( GL10 gl ) 43 | { 44 | // calculate elapsed time 45 | if( m_nLastTime == 0 ) 46 | m_nLastTime = SystemClock.elapsedRealtime(); 47 | 48 | long nCurrentTime = SystemClock.elapsedRealtime(); 49 | long nElapsedTime = nCurrentTime - m_nLastTime; 50 | float fElapsedTime = nElapsedTime / 1000.0f; 51 | m_nLastTime = nCurrentTime; 52 | 53 | PrecompiledLib.step( fElapsedTime ); 54 | } 55 | 56 | public void onSurfaceChanged( GL10 gl, int width, int height ) 57 | { 58 | PrecompiledLib.init( width, height ); 59 | } 60 | 61 | public void onSurfaceCreated( GL10 gl, EGLConfig config ) {} 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /projects/precompiledshader-sample.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "tab_size": 4, 3 | "translate_tabs_to_spaces": false, 4 | "indent_to_bracket": true, 5 | "folders": 6 | [ 7 | { 8 | "path": "..", 9 | "file_exclude_patterns": 10 | [ 11 | "*.d", 12 | "*.o", 13 | "*.a", 14 | "*.sublime-workspace" 15 | ], 16 | "folder_exclude_patterns" : 17 | [ 18 | "bin", 19 | "obj", 20 | "libs", 21 | "gen" 22 | ] 23 | } 24 | ], 25 | "build_systems": 26 | [ 27 | { 28 | "name" : "Project", 29 | "cmd": ["make"], 30 | "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", 31 | "working_dir": "${project_path}/android", 32 | "selector": "source.makefile", 33 | 34 | "variants": 35 | [ 36 | { 37 | "name": "Clean", 38 | "cmd": ["make", "clean"] 39 | }, 40 | { 41 | "name": "Run", 42 | "cmd": ["make", "run"] 43 | }, 44 | { 45 | "name": "Kill", 46 | "cmd": ["make", "kill"] 47 | } 48 | ] 49 | }, 50 | { 51 | "name" : "Emulator", 52 | "cmd": ["make", "TARGET_DEVICE=-e"], 53 | "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", 54 | "working_dir": "${project_path}/android", 55 | "selector": "source.makefile", 56 | 57 | "variants": 58 | [ 59 | { 60 | "name": "Clean", 61 | "cmd": ["make", "clean", "TARGET_DEVICE=-e"] 62 | }, 63 | { 64 | "name": "Run", 65 | "cmd": ["make", "run", "TARGET_DEVICE=-e"] 66 | }, 67 | { 68 | "name": "Kill", 69 | "cmd": ["make", "kill", "TARGET_DEVICE=-e"] 70 | } 71 | ] 72 | }, 73 | { 74 | "name" : "Device", 75 | "cmd": ["make", "TARGET_DEVICE=-d"], 76 | "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", 77 | "working_dir": "${project_path}/android", 78 | "selector": "source.makefile", 79 | 80 | "variants": 81 | [ 82 | { 83 | "name": "Clean", 84 | "cmd": ["make", "clean", "TARGET_DEVICE=-d"] 85 | }, 86 | { 87 | "name": "Run", 88 | "cmd": ["make", "run", "TARGET_DEVICE=-d"] 89 | }, 90 | { 91 | "name": "Kill", 92 | "cmd": ["make", "kill", "TARGET_DEVICE=-d"] 93 | } 94 | ] 95 | } 96 | ] 97 | } 98 | -------------------------------------------------------------------------------- /src/App.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #ifndef __DRR_APP_H__ 30 | #define __DRR_APP_H__ 31 | 32 | void app_init( unsigned int width, unsigned int height ); 33 | void app_update( float fElapsedTime ); 34 | void app_render( void ); 35 | 36 | 37 | #endif // __DRR_APP_H__ 38 | -------------------------------------------------------------------------------- /src/LICENSE: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | PNG loading code provided as public domain by Sean Barrett (http://nothings.org/) -------------------------------------------------------------------------------- /src/glm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NAME glm) 2 | 3 | file(GLOB ROOT_SOURCE *.cpp) 4 | file(GLOB ROOT_INLINE *.inl) 5 | file(GLOB ROOT_HEADER *.hpp) 6 | 7 | file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp) 8 | file(GLOB_RECURSE CORE_INLINE ./core/*.inl) 9 | file(GLOB_RECURSE CORE_HEADER ./core/*.hpp) 10 | 11 | file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) 12 | file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) 13 | file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) 14 | 15 | file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) 16 | file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) 17 | file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) 18 | 19 | file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp) 20 | file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl) 21 | file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp) 22 | 23 | source_group("Core Files" FILES ${CORE_SOURCE}) 24 | source_group("Core Files" FILES ${CORE_INLINE}) 25 | source_group("Core Files" FILES ${CORE_HEADER}) 26 | source_group("GTC Files" FILES ${GTC_SOURCE}) 27 | source_group("GTC Files" FILES ${GTC_INLINE}) 28 | source_group("GTC Files" FILES ${GTC_HEADER}) 29 | source_group("GTX Files" FILES ${GTX_SOURCE}) 30 | source_group("GTX Files" FILES ${GTX_INLINE}) 31 | source_group("GTX Files" FILES ${GTX_HEADER}) 32 | source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE}) 33 | source_group("VIRTREV Files" FILES ${VIRTREV_INLINE}) 34 | source_group("VIRTREV Files" FILES ${VIRTREV_HEADER}) 35 | 36 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 37 | 38 | add_executable(${NAME} 39 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 40 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 41 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 42 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 43 | ${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER}) 44 | -------------------------------------------------------------------------------- /src/glm/core/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/_fixes.hpp 25 | /// @date 2011-02-21 / 2011-11-22 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #include 30 | 31 | //! Workaround for compatibility with other libraries 32 | #ifdef max 33 | #undef max 34 | #endif 35 | 36 | //! Workaround for compatibility with other libraries 37 | #ifdef min 38 | #undef min 39 | #endif 40 | 41 | //! Workaround for Android 42 | #ifdef isnan 43 | #undef isnan 44 | #endif 45 | 46 | //! Workaround for Android 47 | #ifdef isinf 48 | #undef isinf 49 | #endif 50 | 51 | //! Workaround for Chrone Native Client 52 | #ifdef log2 53 | #undef log2 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /src/glm/core/dummy.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/dummy.cpp 25 | /// @date 2011-01-19 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /// 28 | /// GLM is a header only library. There is nothing to compile. 29 | /// dummy.cpp exist only a wordaround for CMake file. 30 | /////////////////////////////////////////////////////////////////////////////////// 31 | 32 | #define GLM_MESSAGES 33 | #include "../glm.hpp" 34 | 35 | //#error "GLM is a header only library" 36 | 37 | int main() 38 | { 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/glm/core/hint.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/hint.hpp 25 | /// @date 2008-08-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type 30 | #define glm_core_type 31 | 32 | namespace glm 33 | { 34 | // Use dont_care, nicest and fastest to optimize implementations. 35 | class dont_care {}; 36 | class nicest {}; 37 | class fastest {}; 38 | }//namespace glm 39 | 40 | #endif//glm_core_type 41 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_common.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_common.hpp 25 | /// @date 2009-05-11 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_common 30 | #define glm_detail_intrinsic_common 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | __m128 sse_abs_ps(__m128 x); 42 | 43 | __m128 sse_sgn_ps(__m128 x); 44 | 45 | //floor 46 | __m128 sse_flr_ps(__m128 v); 47 | 48 | //trunc 49 | __m128 sse_trc_ps(__m128 v); 50 | 51 | //round 52 | __m128 sse_nd_ps(__m128 v); 53 | 54 | //roundEven 55 | __m128 sse_rde_ps(__m128 v); 56 | 57 | __m128 sse_rnd_ps(__m128 x); 58 | 59 | __m128 sse_ceil_ps(__m128 v); 60 | 61 | __m128 sse_frc_ps(__m128 x); 62 | 63 | __m128 sse_mod_ps(__m128 x, __m128 y); 64 | 65 | __m128 sse_modf_ps(__m128 x, __m128i & i); 66 | 67 | //GLM_FUNC_QUALIFIER __m128 sse_min_ps(__m128 x, __m128 y) 68 | 69 | //GLM_FUNC_QUALIFIER __m128 sse_max_ps(__m128 x, __m128 y) 70 | 71 | __m128 sse_clp_ps(__m128 v, __m128 minVal, __m128 maxVal); 72 | 73 | __m128 sse_mix_ps(__m128 v1, __m128 v2, __m128 a); 74 | 75 | __m128 sse_stp_ps(__m128 edge, __m128 x); 76 | 77 | __m128 sse_ssp_ps(__m128 edge0, __m128 edge1, __m128 x); 78 | 79 | __m128 sse_nan_ps(__m128 x); 80 | 81 | __m128 sse_inf_ps(__m128 x); 82 | 83 | }//namespace detail 84 | }//namespace glm 85 | 86 | #include "intrinsic_common.inl" 87 | 88 | #endif//GLM_ARCH 89 | #endif//glm_detail_intrinsic_common 90 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_exponential.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_exponential.hpp 25 | /// @date 2009-05-11 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_exponential 30 | #define glm_detail_intrinsic_exponential 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | /* 42 | GLM_FUNC_QUALIFIER __m128 sse_rsqrt_nr_ss(__m128 const x) 43 | { 44 | __m128 recip = _mm_rsqrt_ss( x ); // "estimate" opcode 45 | const static __m128 three = { 3, 3, 3, 3 }; // aligned consts for fast load 46 | const static __m128 half = { 0.5,0.5,0.5,0.5 }; 47 | __m128 halfrecip = _mm_mul_ss( half, recip ); 48 | __m128 threeminus_xrr = _mm_sub_ss( three, _mm_mul_ss( x, _mm_mul_ss ( recip, recip ) ) ); 49 | return _mm_mul_ss( halfrecip, threeminus_xrr ); 50 | } 51 | 52 | GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float * RESTRICT vIn ) 53 | { 54 | __m128 x = _mm_load_ss(&vIn[0]); 55 | __m128 y = _mm_load_ss(&vIn[1]); 56 | __m128 z = _mm_load_ss(&vIn[2]); 57 | 58 | const __m128 l = // compute x*x + y*y + z*z 59 | _mm_add_ss( 60 | _mm_add_ss( _mm_mul_ss(x,x), 61 | _mm_mul_ss(y,y) 62 | ), 63 | _mm_mul_ss( z, z ) 64 | ); 65 | 66 | 67 | const __m128 rsqt = _mm_rsqrt_nr_ss( l ); 68 | _mm_store_ss( &vOut[0] , _mm_mul_ss( rsqt, x ) ); 69 | _mm_store_ss( &vOut[1] , _mm_mul_ss( rsqt, y ) ); 70 | _mm_store_ss( &vOut[2] , _mm_mul_ss( rsqt, z ) ); 71 | 72 | return _mm_mul_ss( l , rsqt ); 73 | } 74 | */ 75 | }//namespace detail 76 | }//namespace glm 77 | 78 | #endif//GLM_ARCH 79 | #endif//glm_detail_intrinsic_exponential 80 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_exponential.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_exponential.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_geometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_geometric.hpp 25 | /// @date 2009-05-08 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_intrinsic_geometric 30 | #define glm_core_intrinsic_geometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | #include "intrinsic_common.hpp" 39 | 40 | namespace glm{ 41 | namespace detail 42 | { 43 | //length 44 | __m128 sse_len_ps(__m128 x); 45 | 46 | //distance 47 | __m128 sse_dst_ps(__m128 p0, __m128 p1); 48 | 49 | //dot 50 | __m128 sse_dot_ps(__m128 v1, __m128 v2); 51 | 52 | // SSE1 53 | __m128 sse_dot_ss(__m128 v1, __m128 v2); 54 | 55 | //cross 56 | __m128 sse_xpd_ps(__m128 v1, __m128 v2); 57 | 58 | //normalize 59 | __m128 sse_nrm_ps(__m128 v); 60 | 61 | //faceforward 62 | __m128 sse_ffd_ps(__m128 N, __m128 I, __m128 Nref); 63 | 64 | //reflect 65 | __m128 sse_rfe_ps(__m128 I, __m128 N); 66 | 67 | //refract 68 | __m128 sse_rfa_ps(__m128 I, __m128 N, __m128 eta); 69 | 70 | }//namespace detail 71 | }//namespace glm 72 | 73 | #include "intrinsic_geometric.inl" 74 | 75 | #endif//GLM_ARCH 76 | #endif//glm_core_intrinsic_geometric 77 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_matrix.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_common.hpp 25 | /// @date 2009-06-05 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_matrix 30 | #define glm_detail_intrinsic_matrix 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | #include "intrinsic_geometric.hpp" 39 | 40 | namespace glm{ 41 | namespace detail 42 | { 43 | void sse_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); 44 | 45 | void sse_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); 46 | 47 | __m128 sse_mul_ps(__m128 m[4], __m128 v); 48 | 49 | __m128 sse_mul_ps(__m128 v, __m128 m[4]); 50 | 51 | void sse_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4]); 52 | 53 | void sse_transpose_ps(__m128 const in[4], __m128 out[4]); 54 | 55 | void sse_inverse_ps(__m128 const in[4], __m128 out[4]); 56 | 57 | void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]); 58 | 59 | __m128 sse_det_ps(__m128 const m[4]); 60 | 61 | __m128 sse_slow_det_ps(__m128 const m[4]); 62 | 63 | }//namespace detail 64 | }//namespace glm 65 | 66 | #include "intrinsic_matrix.inl" 67 | 68 | #endif//GLM_ARCH 69 | #endif//glm_detail_intrinsic_matrix 70 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_trigonometric 30 | #define glm_detail_intrinsic_trigonometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_trigonometric.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_trigonometric 49 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_trigonometric.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /src/glm/core/intrinsic_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_vector_relational.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_vector_relational 30 | #define glm_detail_intrinsic_vector_relational 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_vector_relational.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_vector_relational 49 | -------------------------------------------------------------------------------- /src/glm/core/type_half.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cristianohh/PrecompiledShaders/d91f0159bfb4a4a8d786dc0873f5c48353702c5c/src/glm/core/type_half.inl -------------------------------------------------------------------------------- /src/glm/core/type_mat.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_mat.hpp 25 | /// @date 2010-01-26 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_mat 30 | #define glm_core_type_mat 31 | 32 | #include "type_gentype.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | 38 | }//namespace detail 39 | }//namespace glm 40 | 41 | #endif//glm_core_type_mat 42 | -------------------------------------------------------------------------------- /src/glm/core/type_mat.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_mat.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /src/glm/core/type_size.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_size.hpp 25 | /// @date 2008-10-05 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_size 30 | #define glm_core_type_size 31 | 32 | #include 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | //typedef std::size_t size_t; 38 | typedef int sizeType; 39 | 40 | }//namespace detail 41 | }//namespace glm 42 | 43 | #endif//glm_core_type_size 44 | -------------------------------------------------------------------------------- /src/glm/core/type_vec.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.hpp 25 | /// @date 2010-01-26 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_vec 30 | #define glm_core_type_vec 31 | 32 | #include "type_gentype.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | 38 | }//namespace detail 39 | }//namespace glm 40 | 41 | #endif//glm_core_type_vec 42 | -------------------------------------------------------------------------------- /src/glm/core/type_vec.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /src/glm/gtc/matrix_access.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_matrix_access 24 | /// @file glm/gtc/matrix_access.hpp 25 | /// @date 2005-12-27 / 2011-05-16 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtc_matrix_access GLM_GTC_matrix_access 31 | /// @ingroup gtc 32 | /// 33 | /// Defines functions to access rows or columns of a matrix easily. 34 | /// need to be included to use these functionalities. 35 | /////////////////////////////////////////////////////////////////////////////////// 36 | 37 | #ifndef GLM_GTC_matrix_access 38 | #define GLM_GTC_matrix_access GLM_VERSION 39 | 40 | // Dependency: 41 | #include "../glm.hpp" 42 | 43 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 44 | # pragma message("GLM: GLM_GTC_matrix_access extension included") 45 | #endif 46 | 47 | namespace glm 48 | { 49 | /// @addtogroup gtc_matrix_access 50 | /// @{ 51 | 52 | /// Get a specific row of a matrix. 53 | /// @see gtc_matrix_access 54 | template 55 | typename genType::row_type row( 56 | genType const & m, 57 | int index); 58 | 59 | /// Set a specific row to a matrix. 60 | /// @see gtc_matrix_access 61 | template 62 | genType row( 63 | genType const & m, 64 | int index, 65 | typename genType::row_type const & x); 66 | 67 | /// Get a specific column of a matrix. 68 | /// @see gtc_matrix_access 69 | template 70 | typename genType::col_type column( 71 | genType const & m, 72 | int index); 73 | 74 | /// Set a specific column to a matrix. 75 | /// @see gtc_matrix_access 76 | template 77 | genType column( 78 | genType const & m, 79 | int index, 80 | typename genType::col_type const & x); 81 | 82 | /// @} 83 | }//namespace glm 84 | 85 | #include "matrix_access.inl" 86 | 87 | #endif//GLM_GTC_matrix_access 88 | -------------------------------------------------------------------------------- /src/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_matrix_access 24 | /// @file glm/gtc/matrix_access.inl 25 | /// @date 2005-12-27 / 2011-06-05 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | namespace glm 30 | { 31 | template 32 | GLM_FUNC_QUALIFIER genType row 33 | ( 34 | genType const & m, 35 | int index, 36 | typename genType::row_type const & x 37 | ) 38 | { 39 | genType Result = m; 40 | for(typename genType::size_type i = 0; i < genType::row_size(); ++i) 41 | Result[i][index] = x[i]; 42 | return Result; 43 | } 44 | 45 | template 46 | GLM_FUNC_QUALIFIER typename genType::row_type row 47 | ( 48 | genType const & m, 49 | int index 50 | ) 51 | { 52 | typename genType::row_type Result; 53 | for(typename genType::size_type i = 0; i < genType::row_size(); ++i) 54 | Result[i] = m[i][index]; 55 | return Result; 56 | } 57 | 58 | template 59 | GLM_FUNC_QUALIFIER genType column 60 | ( 61 | genType const & m, 62 | int index, 63 | typename genType::col_type const & x 64 | ) 65 | { 66 | genType Result = m; 67 | Result[index] = x; 68 | return Result; 69 | } 70 | 71 | template 72 | GLM_FUNC_QUALIFIER typename genType::col_type column 73 | ( 74 | genType const & m, 75 | int index 76 | ) 77 | { 78 | return m[index]; 79 | } 80 | }//namespace glm 81 | -------------------------------------------------------------------------------- /src/glm/gtc/matrix_inverse.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_matrix_inverse 24 | /// @file glm/gtc/matrix_inverse.hpp 25 | /// @date 2005-12-21 / 2011-06-05 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse 31 | /// @ingroup gtc 32 | /// 33 | /// Defines additional matrix inverting functions. 34 | /// need to be included to use these functionalities. 35 | /////////////////////////////////////////////////////////////////////////////////// 36 | 37 | #ifndef GLM_GTC_matrix_inverse 38 | #define GLM_GTC_matrix_inverse GLM_VERSION 39 | 40 | // Dependency: 41 | #include "../glm.hpp" 42 | 43 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 44 | # pragma message("GLM: GLM_GTC_matrix_inverse extension included") 45 | #endif 46 | 47 | namespace glm 48 | { 49 | /// @addtogroup gtc_matrix_inverse 50 | /// @{ 51 | 52 | /// Fast matrix inverse for affine matrix. 53 | /// 54 | /// @param m Input matrix to invert. 55 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 56 | /// @see gtc_matrix_inverse 57 | template 58 | genType affineInverse(genType const & m); 59 | 60 | /// Compute the inverse transpose of a matrix. 61 | /// 62 | /// @param m Input matrix to invert transpose. 63 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 64 | /// @see gtc_matrix_inverse 65 | template 66 | GLM_FUNC_QUALIFIER typename genType::value_type inverseTranspose( 67 | genType const & m); 68 | 69 | /// @} 70 | }//namespace glm 71 | 72 | #include "matrix_inverse.inl" 73 | 74 | #endif//GLM_GTC_matrix_inverse 75 | -------------------------------------------------------------------------------- /src/glm/gtc/noise.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_noise 24 | /// @file glm/gtc/noise.hpp 25 | /// @date 2011-04-21 / 2011-09-27 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtc_noise GLM_GTC_noise 31 | /// @ingroup gtc 32 | /// 33 | /// Defines 2D, 3D and 4D procedural noise functions 34 | /// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 35 | /// https://github.com/ashima/webgl-noise 36 | /// Following Stefan Gustavson's paper "Simplex noise demystified": 37 | /// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 38 | /// need to be included to use these functionalities. 39 | /////////////////////////////////////////////////////////////////////////////////// 40 | 41 | #ifndef GLM_GTC_noise 42 | #define GLM_GTC_noise GLM_VERSION 43 | 44 | // Dependency: 45 | #include "../glm.hpp" 46 | 47 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 48 | # pragma message("GLM: GLM_GTC_noise extension included") 49 | #endif 50 | 51 | namespace glm 52 | { 53 | /// @addtogroup gtc_noise 54 | /// @{ 55 | 56 | /// Classic perlin noise. 57 | /// @see gtc_noise 58 | template class vecType> 59 | T perlin( 60 | vecType const & p); 61 | 62 | /// Periodic perlin noise. 63 | /// @see gtc_noise 64 | template class vecType> 65 | T perlin( 66 | vecType const & p, 67 | vecType const & rep); 68 | 69 | /// Simplex noise. 70 | /// @see gtc_noise 71 | template class vecType> 72 | T simplex( 73 | vecType const & p); 74 | 75 | /// @} 76 | }//namespace glm 77 | 78 | #include "noise.inl" 79 | 80 | #endif//GLM_GTC_noise 81 | -------------------------------------------------------------------------------- /src/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_swizzle 24 | /// @file glm/gtc/swizzle.inl 25 | /// @date 2009-06-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | namespace glm 30 | { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_bit 24 | /// @file glm/gtx/bit.hpp 25 | /// @date 2005-12-30 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Find the point on a straight line which is the closet of a point. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_closest_point 39 | #define GLM_GTX_closest_point GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_closest_point extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_closest_point 51 | /// @{ 52 | 53 | /// Find the point on a straight line which is the closet of a point. 54 | /// @see gtx_closest_point 55 | template 56 | detail::tvec3 closestPointOnLine( 57 | detail::tvec3 const & point, 58 | detail::tvec3 const & a, 59 | detail::tvec3 const & b); 60 | 61 | /// @} 62 | }// namespace glm 63 | 64 | #include "closest_point.inl" 65 | 66 | #endif//GLM_GTX_closest_point 67 | -------------------------------------------------------------------------------- /src/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/closest_point.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifndef glm_gtx_closest_point 11 | #define glm_gtx_closest_point 12 | 13 | namespace glm 14 | { 15 | template 16 | GLM_FUNC_QUALIFIER detail::tvec3 closestPointOnLine 17 | ( 18 | detail::tvec3 const & point, 19 | detail::tvec3 const & a, 20 | detail::tvec3 const & b 21 | ) 22 | { 23 | valType LineLength = distance(a, b); 24 | detail::tvec3 Vector = point - a; 25 | detail::tvec3 LineDirection = (b - a) / LineLength; 26 | 27 | // Project Vector to LineDirection to get the distance of point from a 28 | valType Distance = dot(Vector, LineDirection); 29 | 30 | if(Distance <= valType(0)) return a; 31 | if(Distance >= LineLength) return b; 32 | return a + LineDirection * Distance; 33 | } 34 | }//namespace glm 35 | 36 | #endif//glm_gtx_closest_point 37 | -------------------------------------------------------------------------------- /src/glm/gtx/color_space_YCoCg.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-28 5 | // Updated : 2008-10-28 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/color_space_YCoCg.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCg 14 | ( 15 | detail::tvec3 const & rgbColor 16 | ) 17 | { 18 | detail::tvec3 result; 19 | result.x/*Y */ = rgbColor.r / valType(4) + rgbColor.g / valType(2) + rgbColor.b / valType(4); 20 | result.y/*Co*/ = rgbColor.r / valType(2) + rgbColor.g * valType(0) - rgbColor.b / valType(2); 21 | result.z/*Cg*/ = - rgbColor.r / valType(4) + rgbColor.g / valType(2) - rgbColor.b / valType(4); 22 | return result; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCgR 27 | ( 28 | detail::tvec3 const & rgbColor 29 | ) 30 | { 31 | detail::tvec3 result; 32 | result.x/*Y */ = rgbColor.g / valType(2) + (rgbColor.r + rgbColor.b) / valType(4); 33 | result.y/*Co*/ = rgbColor.r - rgbColor.b; 34 | result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / valType(2); 35 | return result; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCg2rgb 40 | ( 41 | detail::tvec3 const & YCoCgColor 42 | ) 43 | { 44 | detail::tvec3 result; 45 | result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z; 46 | result.g = YCoCgColor.x + YCoCgColor.z; 47 | result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z; 48 | return result; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCgR2rgb 53 | ( 54 | detail::tvec3 const & YCoCgRColor 55 | ) 56 | { 57 | detail::tvec3 result; 58 | valType tmp = YCoCgRColor.x - (YCoCgRColor.z / valType(2)); 59 | result.g = YCoCgRColor.z + tmp; 60 | result.b = tmp - (YCoCgRColor.y / valType(2)); 61 | result.r = result.b + YCoCgRColor.y; 62 | return result; 63 | } 64 | }//namespace glm 65 | -------------------------------------------------------------------------------- /src/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-16 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/compatibility.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | // isfinite 13 | template 14 | GLM_FUNC_QUALIFIER bool isfinite( 15 | genType const & x) 16 | { 17 | # if(GLM_COMPILER & GLM_COMPILER_VC) 18 | return _finite(x); 19 | # elif(GLM_COMPILER & GLM_COMPILER_GCC) 20 | # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) 21 | return _isfinite(x) != 0; 22 | # else 23 | return std::isfinite(x) != 0; 24 | # endif 25 | # else 26 | return std::isfinite(x) != 0; 27 | # endif 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER detail::tvec2 isfinite( 32 | detail::tvec2 const & x) 33 | { 34 | return detail::tvec2( 35 | isfinite(x.x), 36 | isfinite(x.y)); 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER detail::tvec3 isfinite( 41 | detail::tvec3 const & x) 42 | { 43 | return detail::tvec3( 44 | isfinite(x.x), 45 | isfinite(x.y), 46 | isfinite(x.z)); 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER detail::tvec4 isfinite( 51 | detail::tvec4 const & x) 52 | { 53 | return detail::tvec4( 54 | isfinite(x.x), 55 | isfinite(x.y), 56 | isfinite(x.z), 57 | isfinite(x.w)); 58 | } 59 | 60 | }//namespace glm 61 | -------------------------------------------------------------------------------- /src/glm/gtx/component_wise.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_component_wise 24 | /// @file glm/gtx/component_wise.hpp 25 | /// @date 2007-05-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_component_wise GLM_GTX_component_wise 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Operations between components of a type 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_component_wise 39 | #define GLM_GTX_component_wise GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_component_wise extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_component_wise 51 | /// @{ 52 | 53 | /// Add all vector components together. 54 | /// @see gtx_component_wise 55 | template 56 | typename genType::value_type compAdd( 57 | genType const & v); 58 | 59 | /// Multiply all vector components together. 60 | /// @see gtx_component_wise 61 | template 62 | typename genType::value_type compMul( 63 | genType const & v); 64 | 65 | /// Find the minimum value between single vector components. 66 | /// @see gtx_component_wise 67 | template 68 | typename genType::value_type compMin( 69 | genType const & v); 70 | 71 | /// Find the maximum value between single vector components. 72 | /// @see gtx_component_wise 73 | template 74 | typename genType::value_type compMax( 75 | genType const & v); 76 | 77 | /// @} 78 | }//namespace glm 79 | 80 | #include "component_wise.inl" 81 | 82 | #endif//GLM_GTX_component_wise 83 | -------------------------------------------------------------------------------- /src/glm/gtx/component_wise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-21 5 | // Updated : 2010-02-12 6 | // Licence : This source is under MIT License 7 | // File : gtx_component_wise.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v) 14 | { 15 | typename genType::value_type result = typename genType::value_type(0); 16 | for(typename genType::size_type i = 0; i < v.length(); ++i) 17 | result += v[i]; 18 | return result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v) 23 | { 24 | typename genType::value_type result = typename genType::value_type(1); 25 | for(typename genType::size_type i = 0; i < v.length(); ++i) 26 | result *= v[i]; 27 | return result; 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v) 32 | { 33 | typename genType::value_type result = typename genType::value_type(v[0]); 34 | for(typename genType::size_type i = 1; i < v.length(); ++i) 35 | result = min(result, v[i]); 36 | return result; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v) 41 | { 42 | typename genType::value_type result = typename genType::value_type(v[0]); 43 | for(typename genType::size_type i = 1; i < v.length(); ++i) 44 | result = max(result, v[i]); 45 | return result; 46 | } 47 | }//namespace glm 48 | -------------------------------------------------------------------------------- /src/glm/gtx/constants.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #ifndef GLM_GTX_constants 25 | #define GLM_GTX_constants GLM_VERSION 26 | 27 | #include "../gtc/constants.hpp" 28 | 29 | #if(defined(GLM_MESSAGES)) 30 | # pragma message("GLM: GLM_GTX_constants extension is deprecated, include GLM_GTC_constants (glm/gtc/constants.hpp) instead") 31 | #endif 32 | 33 | #endif//GLM_GTX_constants 34 | -------------------------------------------------------------------------------- /src/glm/gtx/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_epsilon extension is deprecated, include GLM_GTC_epsilon (glm/gtc/epsilon) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/epsilon.hpp" 30 | -------------------------------------------------------------------------------- /src/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_extend 24 | /// @file glm/gtx/extend.hpp 25 | /// @date 2006-01-07 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_extend GLM_GTX_extend 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Extend a position from a source to a position at a defined length. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_extend 39 | #define GLM_GTX_extend GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_extend extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_extend 51 | /// @{ 52 | 53 | /// Extends of Length the Origin position using the (Source - Origin) direction. 54 | /// @see gtx_extend 55 | template 56 | genType extend( 57 | genType const & Origin, 58 | genType const & Source, 59 | typename genType::value_type const Length); 60 | 61 | /// @} 62 | }//namespace glm 63 | 64 | #include "extend.inl" 65 | 66 | #endif//GLM_GTX_extend 67 | -------------------------------------------------------------------------------- /src/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-07 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/extend.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | genType extend 14 | ( 15 | genType const & Origin, 16 | genType const & Source, 17 | genType const & Distance 18 | ) 19 | { 20 | return Origin + (Source - Origin) * Distance; 21 | } 22 | 23 | template 24 | detail::tvec2 extend 25 | ( 26 | detail::tvec2 const & Origin, 27 | detail::tvec2 const & Source, 28 | valType const & Distance 29 | ) 30 | { 31 | return Origin + (Source - Origin) * Distance; 32 | } 33 | 34 | template 35 | detail::tvec3 extend 36 | ( 37 | detail::tvec3 const & Origin, 38 | detail::tvec3 const & Source, 39 | valType const & Distance 40 | ) 41 | { 42 | return Origin + (Source - Origin) * Distance; 43 | } 44 | 45 | template 46 | detail::tvec4 extend 47 | ( 48 | detail::tvec4 const & Origin, 49 | detail::tvec4 const & Source, 50 | valType const & Distance 51 | ) 52 | { 53 | return Origin + (Source - Origin) * Distance; 54 | } 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /src/glm/gtx/fast_trigonometry.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-08 5 | // Updated : 2011-10-14 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/fast_trigonometry.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | // sin 13 | template 14 | GLM_FUNC_QUALIFIER T fastSin(T const & x) 15 | { 16 | return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040)); 17 | } 18 | 19 | VECTORIZE_VEC(fastSin) 20 | 21 | // cos 22 | template 23 | GLM_FUNC_QUALIFIER T fastCos(T const & x) 24 | { 25 | return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888)); 26 | } 27 | 28 | VECTORIZE_VEC(fastCos) 29 | 30 | // tan 31 | template 32 | GLM_FUNC_QUALIFIER T fastTan(T const & x) 33 | { 34 | 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)); 35 | } 36 | 37 | VECTORIZE_VEC(fastTan) 38 | 39 | // asin 40 | template 41 | GLM_FUNC_QUALIFIER T fastAsin(T const & x) 42 | { 43 | 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)); 44 | } 45 | 46 | VECTORIZE_VEC(fastAsin) 47 | 48 | // acos 49 | template 50 | GLM_FUNC_QUALIFIER T fastAcos(T const & x) 51 | { 52 | return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2) 53 | } 54 | 55 | VECTORIZE_VEC(fastAcos) 56 | 57 | // atan 58 | template 59 | GLM_FUNC_QUALIFIER T fastAtan(T const & y, T const & x) 60 | { 61 | T sgn = sign(y) * sign(x); 62 | return abs(fastAtan(y / x)) * sgn; 63 | } 64 | 65 | VECTORIZE_VEC_VEC(fastAtan) 66 | 67 | template 68 | GLM_FUNC_QUALIFIER T fastAtan(T const & x) 69 | { 70 | 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)); 71 | } 72 | 73 | VECTORIZE_VEC(fastAtan) 74 | 75 | }//namespace glm 76 | -------------------------------------------------------------------------------- /src/glm/gtx/gradient_paint.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_gradient_paint 24 | /// @file glm/gtx/gradient_paint.hpp 25 | /// @date 2009-03-06 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_optimum_pow (dependence) 30 | /// 31 | /// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Functions that return the color of procedural gradient for specific coordinates. 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_gradient_paint 39 | #define GLM_GTX_gradient_paint GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | #include "../gtx/optimum_pow.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_gradient_paint extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_gradient_paint 52 | /// @{ 53 | 54 | /// Return a color from a radial gradient. 55 | /// @see - gtx_gradient_paint 56 | template 57 | valType radialGradient( 58 | detail::tvec2 const & Center, 59 | valType const & Radius, 60 | detail::tvec2 const & Focal, 61 | detail::tvec2 const & Position); 62 | 63 | /// Return a color from a linear gradient. 64 | /// @see - gtx_gradient_paint 65 | template 66 | valType linearGradient( 67 | detail::tvec2 const & Point0, 68 | detail::tvec2 const & Point1, 69 | detail::tvec2 const & Position); 70 | 71 | /// @} 72 | }// namespace glm 73 | 74 | #include "gradient_paint.inl" 75 | 76 | #endif//GLM_GTX_gradient_paint 77 | -------------------------------------------------------------------------------- /src/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2009-03-06 5 | // Updated : 2009-03-09 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/gradient_paint.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | valType radialGradient 14 | ( 15 | detail::tvec2 const & Center, 16 | valType const & Radius, 17 | detail::tvec2 const & Focal, 18 | detail::tvec2 const & Position 19 | ) 20 | { 21 | detail::tvec2 F = Focal - Center; 22 | detail::tvec2 D = Position - Focal; 23 | valType Radius2 = pow2(Radius); 24 | valType Fx2 = pow2(F.x); 25 | valType Fy2 = pow2(F.y); 26 | 27 | valType Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 28 | valType Denominator = Radius2 - (Fx2 + Fy2); 29 | return Numerator / Denominator; 30 | } 31 | 32 | template 33 | valType linearGradient 34 | ( 35 | detail::tvec2 const & Point0, 36 | detail::tvec2 const & Point1, 37 | detail::tvec2 const & Position 38 | ) 39 | { 40 | detail::tvec2 Dist = Point1 - Point0; 41 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /src/glm/gtx/handed_coordinate_space.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_handed_coordinate_space 24 | /// @file glm/gtx/handed_coordinate_space.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space 31 | /// @ingroup gtx 32 | /// 33 | /// @brief To know if a set of three basis vectors defines a right or left-handed coordinate system. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_handed_coordinate_space 39 | #define GLM_GTX_handed_coordinate_space GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_handed_coordinate_space 51 | /// @{ 52 | 53 | //! Return if a trihedron right handed or not. 54 | //! From GLM_GTX_handed_coordinate_space extension. 55 | template 56 | bool rightHanded( 57 | detail::tvec3 const & tangent, 58 | detail::tvec3 const & binormal, 59 | detail::tvec3 const & normal); 60 | 61 | //! Return if a trihedron left handed or not. 62 | //! From GLM_GTX_handed_coordinate_space extension. 63 | template 64 | bool leftHanded( 65 | detail::tvec3 const & tangent, 66 | detail::tvec3 const & binormal, 67 | detail::tvec3 const & normal); 68 | 69 | /// @} 70 | }// namespace glm 71 | 72 | #include "handed_coordinate_space.inl" 73 | 74 | #endif//GLM_GTX_handed_coordinate_space 75 | -------------------------------------------------------------------------------- /src/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/handed_coordinate_space.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER bool rightHanded 14 | ( 15 | detail::tvec3 const & tangent, 16 | detail::tvec3 const & binormal, 17 | detail::tvec3 const & normal 18 | ) 19 | { 20 | return dot(cross(normal, tangent), binormal) > T(0); 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER bool leftHanded 25 | ( 26 | detail::tvec3 const & tangent, 27 | detail::tvec3 const & binormal, 28 | detail::tvec3 const & normal 29 | ) 30 | { 31 | return dot(cross(normal, tangent), binormal) < T(0); 32 | } 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /src/glm/gtx/int_10_10_10_2.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_int_10_10_10_2 24 | /// @file glm/gtx/int_10_10_10_2.hpp 25 | /// @date 2010-07-07 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_raw_data (dependence) 30 | /// 31 | /// @defgroup gtx_int_10_10_10_2 GLM_GTX_int_10_10_10_2 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Pack vector to 1010102 integers. Storage only. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_int_10_10_10_2 40 | #define GLM_GTX_int_10_10_10_2 GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/raw_data.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_int_10_10_10_2 extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_int_10_10_10_2 53 | /// @{ 54 | 55 | //! From GLM_GTX_int_10_10_10_2 extension. 56 | //! Cast a vec4 to an u_10_10_10_2. 57 | dword uint10_10_10_2_cast(glm::vec4 const & v); 58 | 59 | /// @} 60 | }//namespace glm 61 | 62 | #include "int_10_10_10_2.inl" 63 | 64 | #endif//GLM_GTX_int_10_10_10_2 65 | -------------------------------------------------------------------------------- /src/glm/gtx/int_10_10_10_2.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2010-07-07 5 | // Updated : 2010-07-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/int_10_10_10_2.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast 13 | ( 14 | glm::vec4 const & v 15 | ) 16 | { 17 | return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30); 18 | } 19 | }//namespace glm 20 | -------------------------------------------------------------------------------- /src/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_log_base 24 | /// @file glm/gtx/log_base.hpp 25 | /// @date 2008-10-24 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_log_base GLM_GTX_log_base 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Logarithm for any base. base can be a vector or a scalar. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_log_base 39 | #define GLM_GTX_log_base GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_log_base extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_log_base 51 | /// @{ 52 | 53 | //! Logarithm for any base. 54 | //! From GLM_GTX_log_base. 55 | template 56 | genType log( 57 | genType const & x, 58 | genType const & base); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "log_base.inl" 64 | 65 | #endif//GLM_GTX_log_base 66 | -------------------------------------------------------------------------------- /src/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-24 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/log_base.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType log( 14 | genType const & x, 15 | genType const & base) 16 | { 17 | assert(x != genType(0)); 18 | 19 | return glm::log(x) / glm::log(base); 20 | } 21 | 22 | VECTORIZE_VEC_SCA(log) 23 | VECTORIZE_VEC_VEC(log) 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /src/glm/gtx/matrix_cross_product.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_matrix_cross_product 24 | /// @file glm/gtx/matrix_cross_product.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Build cross product matrices 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_matrix_cross_product 40 | #define GLM_GTX_matrix_cross_product GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_matrix_cross_product 52 | /// @{ 53 | 54 | //! Build a cross product matrix. 55 | //! From GLM_GTX_matrix_cross_product extension. 56 | template 57 | detail::tmat3x3 matrixCross3( 58 | detail::tvec3 const & x); 59 | 60 | //! Build a cross product matrix. 61 | //! From GLM_GTX_matrix_cross_product extension. 62 | template 63 | detail::tmat4x4 matrixCross4( 64 | detail::tvec3 const & x); 65 | 66 | /// @} 67 | }//namespace glm 68 | 69 | #include "matrix_cross_product.inl" 70 | 71 | #endif//GLM_GTX_matrix_cross_product 72 | -------------------------------------------------------------------------------- /src/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/matrix_cross_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 matrixCross3 14 | ( 15 | detail::tvec3 const & x 16 | ) 17 | { 18 | detail::tmat3x3 Result(T(0)); 19 | Result[0][1] = x.z; 20 | Result[1][0] = -x.z; 21 | Result[0][2] = -x.y; 22 | Result[2][0] = x.y; 23 | Result[1][2] = x.x; 24 | Result[2][1] = -x.x; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tmat4x4 matrixCross4 30 | ( 31 | detail::tvec3 const & x 32 | ) 33 | { 34 | detail::tmat4x4 Result(T(0)); 35 | Result[0][1] = x.z; 36 | Result[1][0] = -x.z; 37 | Result[0][2] = -x.y; 38 | Result[2][0] = x.y; 39 | Result[1][2] = x.x; 40 | Result[2][1] = -x.x; 41 | return Result; 42 | } 43 | 44 | }//namespace glm 45 | -------------------------------------------------------------------------------- /src/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_mixed_product 24 | /// @file glm/gtx/mixed_product.hpp 25 | /// @date 2007-04-03 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Mixed product of 3 vectors. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_mixed_product 39 | #define GLM_GTX_mixed_product GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_mixed_product 51 | /// @{ 52 | 53 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 54 | template 55 | valType mixedProduct( 56 | detail::tvec3 const & v1, 57 | detail::tvec3 const & v2, 58 | detail::tvec3 const & v3); 59 | 60 | /// @} 61 | }// namespace glm 62 | 63 | #include "mixed_product.inl" 64 | 65 | #endif//GLM_GTX_mixed_product 66 | -------------------------------------------------------------------------------- /src/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-04-03 5 | // Updated : 2008-09-17 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/mixed_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER valType mixedProduct 14 | ( 15 | detail::tvec3 const & v1, 16 | detail::tvec3 const & v2, 17 | detail::tvec3 const & v3 18 | ) 19 | { 20 | return dot(cross(v1, v2), v3); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /src/glm/gtx/multiple.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_multiple 24 | /// @file glm/gtx/multiple.hpp 25 | /// @date 2009-10-26 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_multiple GLM_GTX_multiple 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Find the closest number of a number multiple of other number. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_multiple 40 | #define GLM_GTX_multiple GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_multiple extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_multiple 52 | /// @{ 53 | 54 | //! Higher Multiple number of Source. 55 | //! From GLM_GTX_multiple extension. 56 | template 57 | genType higherMultiple( 58 | genType const & Source, 59 | genType const & Multiple); 60 | 61 | //! Lower Multiple number of Source. 62 | //! From GLM_GTX_multiple extension. 63 | template 64 | genType lowerMultiple( 65 | genType const & Source, 66 | genType const & Multiple); 67 | 68 | /// @} 69 | }//namespace glm 70 | 71 | #include "multiple.inl" 72 | 73 | #endif//GLM_GTX_multiple 74 | -------------------------------------------------------------------------------- /src/glm/gtx/noise.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random (glm/gtc/noise.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/noise.hpp" 30 | -------------------------------------------------------------------------------- /src/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_normal 24 | /// @file glm/gtx/normal.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_normal GLM_GTX_normal 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Compute the normal of a triangle. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_normal 40 | #define GLM_GTX_normal GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_normal extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_normal 52 | /// @{ 53 | 54 | //! Computes triangle normal from triangle points. 55 | //! From GLM_GTX_normal extension. 56 | template 57 | detail::tvec3 triangleNormal( 58 | detail::tvec3 const & p1, 59 | detail::tvec3 const & p2, 60 | detail::tvec3 const & p3); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "normal.inl" 66 | 67 | #endif//GLM_GTX_normal 68 | -------------------------------------------------------------------------------- /src/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2011-06-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/normal.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 triangleNormal 14 | ( 15 | detail::tvec3 const & p1, 16 | detail::tvec3 const & p2, 17 | detail::tvec3 const & p3 18 | ) 19 | { 20 | return normalize(cross(p1 - p2, p1 - p3)); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /src/glm/gtx/normalize_dot.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_normalize_dot 24 | /// @file glm/gtx/normalize_dot.hpp 25 | /// @date 2007-09-28 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_fast_square_root (dependence) 30 | /// 31 | /// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Dot product of vectors that need to be normalize with a single square root. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_normalize_dot 40 | #define GLM_GTX_normalize_dot GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/fast_square_root.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_normalize_dot extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_normalize_dot 53 | /// @{ 54 | 55 | //! Normalize parameters and returns the dot product of x and y. 56 | //! It's faster that dot(normalize(x), normalize(y)). 57 | //! From GLM_GTX_normalize_dot extension. 58 | template 59 | typename genType::value_type normalizeDot( 60 | genType const & x, 61 | genType const & y); 62 | 63 | //! Normalize parameters and returns the dot product of x and y. 64 | //! Faster that dot(fastNormalize(x), fastNormalize(y)). 65 | //! From GLM_GTX_normalize_dot extension. 66 | template 67 | typename genType::value_type fastNormalizeDot( 68 | genType const & x, 69 | genType const & y); 70 | 71 | /// @} 72 | }//namespace glm 73 | 74 | #include "normalize_dot.inl" 75 | 76 | #endif//GLM_GTX_normalize_dot 77 | -------------------------------------------------------------------------------- /src/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | ////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-09-28 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/normalize_dot.inl 8 | ////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType normalizeDot 14 | ( 15 | genType const & x, 16 | genType const & y 17 | ) 18 | { 19 | return 20 | glm::dot(x, y) * 21 | glm::inversesqrt(glm::dot(x, x) * 22 | glm::dot(y, y)); 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER valType normalizeDot 27 | ( 28 | detail::tvec2 const & x, 29 | detail::tvec2 const & y 30 | ) 31 | { 32 | return 33 | glm::dot(x, y) * 34 | glm::inversesqrt(glm::dot(x, x) * 35 | glm::dot(y, y)); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER valType normalizeDot 40 | ( 41 | detail::tvec3 const & x, 42 | detail::tvec3 const & y 43 | ) 44 | { 45 | return 46 | glm::dot(x, y) * 47 | glm::inversesqrt(glm::dot(x, x) * 48 | glm::dot(y, y)); 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER valType normalizeDot 53 | ( 54 | detail::tvec4 const & x, 55 | detail::tvec4 const & y 56 | ) 57 | { 58 | return 59 | glm::dot(x, y) * 60 | glm::inversesqrt(glm::dot(x, x) * 61 | glm::dot(y, y)); 62 | } 63 | 64 | template 65 | GLM_FUNC_QUALIFIER genType fastNormalizeDot 66 | ( 67 | genType const & x, 68 | genType const & y 69 | ) 70 | { 71 | return 72 | glm::dot(x, y) * 73 | fastInverseSqrt(glm::dot(x, x) * 74 | glm::dot(y, y)); 75 | } 76 | 77 | template 78 | GLM_FUNC_QUALIFIER valType fastNormalizeDot 79 | ( 80 | detail::tvec2 const & x, 81 | detail::tvec2 const & y 82 | ) 83 | { 84 | return 85 | glm::dot(x, y) * 86 | fastInverseSqrt(glm::dot(x, x) * 87 | glm::dot(y, y)); 88 | } 89 | 90 | template 91 | GLM_FUNC_QUALIFIER valType fastNormalizeDot 92 | ( 93 | detail::tvec3 const & x, 94 | detail::tvec3 const & y 95 | ) 96 | { 97 | return 98 | glm::dot(x, y) * 99 | fastInverseSqrt(glm::dot(x, x) * 100 | glm::dot(y, y)); 101 | } 102 | 103 | template 104 | GLM_FUNC_QUALIFIER valType fastNormalizeDot 105 | ( 106 | detail::tvec4 const & x, 107 | detail::tvec4 const & y 108 | ) 109 | { 110 | return 111 | glm::dot(x, y) * 112 | fastInverseSqrt(glm::dot(x, x) * 113 | glm::dot(y, y)); 114 | } 115 | }//namespace glm 116 | -------------------------------------------------------------------------------- /src/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-10 5 | // Updated : 2007-05-10 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/number_precision.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/glm/gtx/ocl_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_ocl_type 24 | /// @file glm/gtx/ocl_type.inl 25 | /// @date 2013-03-16 / 2013-03-16 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /src/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-27 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/optimum_pow.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType pow2(const genType& x) 14 | { 15 | return x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow3(const genType& x) 20 | { 21 | return x * x * x; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType pow4(const genType& x) 26 | { 27 | return x * x * x * x; 28 | } 29 | 30 | GLM_FUNC_QUALIFIER bool powOfTwo(int x) 31 | { 32 | return !(x & (x - 1)); 33 | } 34 | 35 | GLM_FUNC_QUALIFIER detail::tvec2 powOfTwo(const detail::tvec2& x) 36 | { 37 | return detail::tvec2( 38 | powOfTwo(x.x), 39 | powOfTwo(x.y)); 40 | } 41 | 42 | GLM_FUNC_QUALIFIER detail::tvec3 powOfTwo(const detail::tvec3& x) 43 | { 44 | return detail::tvec3( 45 | powOfTwo(x.x), 46 | powOfTwo(x.y), 47 | powOfTwo(x.z)); 48 | } 49 | 50 | GLM_FUNC_QUALIFIER detail::tvec4 powOfTwo(const detail::tvec4& x) 51 | { 52 | return detail::tvec4( 53 | powOfTwo(x.x), 54 | powOfTwo(x.y), 55 | powOfTwo(x.z), 56 | powOfTwo(x.w)); 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /src/glm/gtx/orthonormalize.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_orthonormalize 24 | /// @file glm/gtx/orthonormalize.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Orthonormalize matrices. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_orthonormalize 40 | #define GLM_GTX_orthonormalize GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_orthonormalize 52 | /// @{ 53 | 54 | //! Returns the orthonormalized matrix of m. 55 | //! From GLM_GTX_orthonormalize extension. 56 | template 57 | detail::tmat3x3 orthonormalize( 58 | const detail::tmat3x3& m); 59 | 60 | //! Orthonormalizes x according y. 61 | //! From GLM_GTX_orthonormalize extension. 62 | template 63 | detail::tvec3 orthonormalize( 64 | const detail::tvec3& x, 65 | const detail::tvec3& y); 66 | 67 | /// @} 68 | }//namespace glm 69 | 70 | #include "orthonormalize.inl" 71 | 72 | #endif//GLM_GTX_orthonormalize 73 | -------------------------------------------------------------------------------- /src/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/orthonormalize.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 orthonormalize 14 | ( 15 | const detail::tmat3x3& m 16 | ) 17 | { 18 | detail::tmat3x3 r = m; 19 | 20 | r[0] = normalize(r[0]); 21 | 22 | float d0 = dot(r[0], r[1]); 23 | r[1] -= r[0] * d0; 24 | r[1] = normalize(r[1]); 25 | 26 | float d1 = dot(r[1], r[2]); 27 | d0 = dot(r[0], r[2]); 28 | r[2] -= r[0] * d0 + r[1] * d1; 29 | r[2] = normalize(r[2]); 30 | 31 | return r; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tvec3 orthonormalize 36 | ( 37 | const detail::tvec3& x, 38 | const detail::tvec3& y 39 | ) 40 | { 41 | return normalize(x - y * dot(y, x)); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /src/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_perpendicular 24 | /// @file glm/gtx/perpendicular.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_projection (dependence) 30 | /// 31 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Perpendicular of a vector from other one 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_perpendicular 40 | #define GLM_GTX_perpendicular GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/projection.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_perpendicular 53 | /// @{ 54 | 55 | //! Projects x a perpendicular axis of Normal. 56 | //! From GLM_GTX_perpendicular extension. 57 | template 58 | vecType perp( 59 | vecType const & x, 60 | vecType const & Normal); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "perpendicular.inl" 66 | 67 | #endif//GLM_GTX_perpendicular 68 | -------------------------------------------------------------------------------- /src/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/perpendicular.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType perp 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return x - proj(x, Normal); 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /src/glm/gtx/polar_coordinates.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_polar_coordinates 24 | /// @file glm/gtx/polar_coordinates.hpp 25 | /// @date 2007-03-06 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Conversion from Euclidean space to polar space and revert. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_polar_coordinates 39 | #define GLM_GTX_polar_coordinates GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_polar_coordinates extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_polar_coordinates 51 | /// @{ 52 | 53 | /// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 54 | /// 55 | /// @see gtx_polar_coordinates 56 | template 57 | detail::tvec3 polar( 58 | detail::tvec3 const & euclidean); 59 | 60 | /// Convert Polar to Euclidean coordinates. 61 | /// 62 | /// @see gtx_polar_coordinates 63 | template 64 | detail::tvec3 euclidean( 65 | detail::tvec2 const & polar); 66 | 67 | /// @} 68 | }//namespace glm 69 | 70 | #include "polar_coordinates.inl" 71 | 72 | #endif//GLM_GTX_polar_coordinates 73 | -------------------------------------------------------------------------------- /src/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-06 5 | // Updated : 2009-05-01 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/polar_coordinates.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 polar 14 | ( 15 | detail::tvec3 const & euclidean 16 | ) 17 | { 18 | T const Length(length(euclidean)); 19 | detail::tvec3 const tmp(euclidean / Length); 20 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 21 | 22 | #ifdef GLM_FORCE_RADIANS 23 | return detail::tvec3( 24 | atan(xz_dist, tmp.y), // latitude 25 | atan(tmp.x, tmp.z), // longitude 26 | xz_dist); // xz distance 27 | #else 28 | return detail::tvec3( 29 | degrees(atan(xz_dist, tmp.y)), // latitude 30 | degrees(atan(tmp.x, tmp.z)), // longitude 31 | xz_dist); // xz distance 32 | #endif 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER detail::tvec3 euclidean 37 | ( 38 | detail::tvec2 const & polar 39 | ) 40 | { 41 | #ifdef GLM_FORCE_RADIANS 42 | T const latitude(polar.x); 43 | T const longitude(polar.y); 44 | #else 45 | T const latitude(radians(polar.x)); 46 | T const longitude(radians(polar.y)); 47 | #endif 48 | 49 | return detail::tvec3( 50 | cos(latitude) * sin(longitude), 51 | sin(latitude), 52 | cos(latitude) * cos(longitude)); 53 | } 54 | 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /src/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_projection 24 | /// @file glm/gtx/projection.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_projection GLM_GTX_projection 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Projection of a vector to other one 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_projection 39 | #define GLM_GTX_projection GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_projection extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_projection 51 | /// @{ 52 | 53 | //! Projects x on Normal. 54 | //! From GLM_GTX_projection extension. 55 | template 56 | vecType proj( 57 | vecType const & x, 58 | vecType const & Normal); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "projection.inl" 64 | 65 | #endif//GLM_GTX_projection 66 | -------------------------------------------------------------------------------- /src/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/projection.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType proj 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /src/glm/gtx/random.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/random.hpp" 30 | -------------------------------------------------------------------------------- /src/glm/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_raw_data 24 | /// @file glm/gtx/raw_data.hpp 25 | /// @date 2008-11-19 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Projection of a vector to other one 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_raw_data 39 | #define GLM_GTX_raw_data GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | #include "../gtc/type_precision.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_raw_data extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_raw_data 52 | /// @{ 53 | 54 | //! Type for byte numbers. 55 | //! From GLM_GTX_raw_data extension. 56 | typedef uint8 byte; 57 | 58 | //! Type for word numbers. 59 | //! From GLM_GTX_raw_data extension. 60 | typedef uint16 word; 61 | 62 | //! Type for dword numbers. 63 | //! From GLM_GTX_raw_data extension. 64 | typedef uint32 dword; 65 | 66 | //! Type for qword numbers. 67 | //! From GLM_GTX_raw_data extension. 68 | typedef uint64 qword; 69 | 70 | /// @} 71 | }// namespace glm 72 | 73 | #include "raw_data.inl" 74 | 75 | #endif//GLM_GTX_raw_data 76 | -------------------------------------------------------------------------------- /src/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-11-19 5 | // Updated : 2008-11-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/raw_data.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | // Dependency: 10 | // - GLM core 11 | /////////////////////////////////////////////////////////////////////////////////////////////////// 12 | -------------------------------------------------------------------------------- /src/glm/gtx/reciprocal.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_reciprocal extension is deprecated, include GLM_GTC_reciprocal instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /src/glm/gtx/spline.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_spline 24 | /// @file glm/gtx/spline.hpp 25 | /// @date 2007-01-25 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_spline GLM_GTX_spline 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Spline functions 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_spline 39 | #define GLM_GTX_spline GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | #include "../gtx/optimum_pow.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_spline extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_spline 52 | /// @{ 53 | 54 | //! Return a point from a catmull rom curve. 55 | //! From GLM_GTX_spline extension. 56 | template 57 | genType catmullRom( 58 | genType const & v1, 59 | genType const & v2, 60 | genType const & v3, 61 | genType const & v4, 62 | typename genType::value_type const & s); 63 | 64 | //! Return a point from a hermite curve. 65 | //! From GLM_GTX_spline extension. 66 | template 67 | genType hermite( 68 | genType const & v1, 69 | genType const & t1, 70 | genType const & v2, 71 | genType const & t2, 72 | typename genType::value_type const & s); 73 | 74 | //! Return a point from a cubic curve. 75 | //! From GLM_GTX_spline extension. 76 | template 77 | genType cubic( 78 | genType const & v1, 79 | genType const & v2, 80 | genType const & v3, 81 | genType const & v4, 82 | typename genType::value_type const & s); 83 | 84 | /// @} 85 | }//namespace glm 86 | 87 | #include "spline.inl" 88 | 89 | #endif//GLM_GTX_spline 90 | 91 | -------------------------------------------------------------------------------- /src/glm/gtx/spline.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-01-25 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/spline.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm{ 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType catmullRom 14 | ( 15 | genType const & v1, 16 | genType const & v2, 17 | genType const & v3, 18 | genType const & v4, 19 | typename genType::value_type const & s 20 | ) 21 | { 22 | typename genType::value_type s1 = s; 23 | typename genType::value_type s2 = pow2(s); 24 | typename genType::value_type s3 = pow3(s); 25 | 26 | typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s; 27 | typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2); 28 | typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s; 29 | typename genType::value_type f4 = s3 - s2; 30 | 31 | return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2); 32 | 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER genType hermite 37 | ( 38 | genType const & v1, 39 | genType const & t1, 40 | genType const & v2, 41 | genType const & t2, 42 | typename genType::value_type const & s 43 | ) 44 | { 45 | typename genType::value_type s1 = s; 46 | typename genType::value_type s2 = pow2(s); 47 | typename genType::value_type s3 = pow3(s); 48 | 49 | typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1); 50 | typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2; 51 | typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s; 52 | typename genType::value_type f4 = s3 - s2; 53 | 54 | return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; 55 | } 56 | 57 | template 58 | GLM_FUNC_QUALIFIER genType cubic 59 | ( 60 | genType const & v1, 61 | genType const & v2, 62 | genType const & v3, 63 | genType const & v4, 64 | typename genType::value_type const & s 65 | ) 66 | { 67 | return ((v1 * s + v2) * s + v3) * s + v4; 68 | } 69 | 70 | }//namespace glm 71 | -------------------------------------------------------------------------------- /src/glm/gtx/std_based_type.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_std_based_type 24 | /// @file glm/gtx/std_based_type.hpp 25 | /// @date 2008-06-08 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_std_based_type GLM_GTX_std_based_type 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Adds vector types based on STL value types. 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_std_based_type 39 | #define GLM_GTX_std_based_type GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | #include 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_std_based_type extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_std_based_type 52 | /// @{ 53 | 54 | /// Vector type based of two std::size_t components. 55 | /// @see GLM_GTX_std_based_type 56 | typedef detail::tvec2 size2; 57 | 58 | /// Vector type based of three std::size_t components. 59 | /// @see GLM_GTX_std_based_type 60 | typedef detail::tvec3 size3; 61 | 62 | /// Vector type based of four std::size_t components. 63 | /// @see GLM_GTX_std_based_type 64 | typedef detail::tvec4 size4; 65 | 66 | /// Vector type based of two std::size_t components. 67 | /// @see GLM_GTX_std_based_type 68 | typedef detail::tvec2 size2_t; 69 | 70 | /// Vector type based of three std::size_t components. 71 | /// @see GLM_GTX_std_based_type 72 | typedef detail::tvec3 size3_t; 73 | 74 | /// Vector type based of four std::size_t components. 75 | /// @see GLM_GTX_std_based_type 76 | typedef detail::tvec4 size4_t; 77 | 78 | /// @} 79 | }//namespace glm 80 | 81 | #include "std_based_type.inl" 82 | 83 | #endif//GLM_GTX_std_based_type 84 | -------------------------------------------------------------------------------- /src/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-06-08 5 | // Updated : 2008-06-08 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/std_based_type.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/glm/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_string_cast 24 | /// @file glm/gtx/string_cast.hpp 25 | /// @date 2008-04-26 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtc_half_float (dependence) 30 | /// @see gtx_integer (dependence) 31 | /// @see gtx_quaternion (dependence) 32 | /// 33 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 34 | /// @ingroup gtx 35 | /// 36 | /// @brief Setup strings for GLM type values 37 | /// 38 | /// need to be included to use these functionalities. 39 | /////////////////////////////////////////////////////////////////////////////////// 40 | 41 | #ifndef GLM_GTX_string_cast 42 | #define GLM_GTX_string_cast GLM_VERSION 43 | 44 | // Dependency: 45 | #include "../glm.hpp" 46 | #include "../gtc/half_float.hpp" 47 | #include "../gtx/integer.hpp" 48 | #include "../gtx/quaternion.hpp" 49 | #include 50 | 51 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 52 | # pragma message("GLM: GLM_GTX_string_cast extension included") 53 | #endif 54 | 55 | namespace glm 56 | { 57 | /// @addtogroup gtx_string_cast 58 | /// @{ 59 | 60 | /// Create a string from a GLM type value. 61 | /// From GLM_GTX_string_cast extension. 62 | template 63 | std::string to_string(genType const & x); 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "string_cast.inl" 69 | 70 | #endif//GLM_GTX_string_cast 71 | -------------------------------------------------------------------------------- /src/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-04-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/transform.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 14 | T x, T y, T z) 15 | { 16 | return translate( 17 | detail::tmat4x4(1.0f), 18 | detail::tvec3(x, y , z)); 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 23 | detail::tmat4x4 const & m, 24 | T x, T y, T z) 25 | { 26 | return translate( 27 | m, detail::tvec3(x, y , z)); 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 32 | detail::tvec3 const & v) 33 | { 34 | return translate( 35 | detail::tmat4x4(1.0f), v); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 40 | T angle, 41 | T x, T y, T z) 42 | { 43 | return rotate( 44 | detail::tmat4x4(1), angle, detail::tvec3(x, y, z)); 45 | } 46 | 47 | template 48 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 49 | T angle, 50 | detail::tvec3 const & v) 51 | { 52 | return rotate( 53 | detail::tmat4x4(1), angle, v); 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 58 | detail::tmat4x4 const & m, 59 | T angle, 60 | T x, T y, T z) 61 | { 62 | return rotate( 63 | m, angle, detail::tvec3(x, y, z)); 64 | } 65 | 66 | template 67 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale(T x, T y, T z) 68 | { 69 | return scale( 70 | detail::tmat4x4(1), detail::tvec3(x, y, z)); 71 | } 72 | 73 | template 74 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 75 | detail::tmat4x4 const & m, 76 | T x, T y, T z) 77 | { 78 | return scale( 79 | m, detail::tvec3(x, y, z)); 80 | } 81 | 82 | template 83 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 84 | detail::tvec3 const & v) 85 | { 86 | return scale( 87 | detail::tmat4x4(1.0f), v); 88 | } 89 | 90 | }//namespace glm 91 | -------------------------------------------------------------------------------- /src/glm/gtx/ulp.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_ulp extension is deprecated, include GLM_GTC_ulp (glm/gtc/ulp.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/ulp.hpp" 30 | -------------------------------------------------------------------------------- /src/glm/gtx/unsigned_int.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /src/glm/gtx/unsigned_int.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-24 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/unsigned_int.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /src/glm/gtx/vec1.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_vec1 24 | /// @file glm/gtx/vec1.inl 25 | /// @date 2013-03-16 / 2013-03-16 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /src/glm/gtx/vector_access.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_vector_access 24 | /// @file glm/gtx/vector_access.hpp 25 | /// @date 2006-01-16 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_vector_access GLM_GTX_vector_access 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Function to set values to vectors 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_vector_access 39 | #define GLM_GTX_vector_access GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_vector_access extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_vector_access 51 | /// @{ 52 | 53 | //! Set values to a 2 components vector. 54 | //! From GLM_GTX_vector_access extension. 55 | template 56 | void set( 57 | detail::tvec2 & v, 58 | valType const & x, 59 | valType const & y); 60 | 61 | //! Set values to a 3 components vector. 62 | //! From GLM_GTX_vector_access extension. 63 | template 64 | void set( 65 | detail::tvec3 & v, 66 | valType const & x, 67 | valType const & y, 68 | valType const & z); 69 | 70 | //! Set values to a 4 components vector. 71 | //! From GLM_GTX_vector_access extension. 72 | template 73 | void set( 74 | detail::tvec4 & v, 75 | valType const & x, 76 | valType const & y, 77 | valType const & z, 78 | valType const & w); 79 | 80 | /// @} 81 | }//namespace glm 82 | 83 | #include "vector_access.inl" 84 | 85 | #endif//GLM_GTX_vector_access 86 | -------------------------------------------------------------------------------- /src/glm/gtx/vector_access.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-16 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_access.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER void set 14 | ( 15 | detail::tvec2& v, 16 | valType const & x, 17 | valType const & y 18 | ) 19 | { 20 | v.x = x; 21 | v.y = y; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER void set 26 | ( 27 | detail::tvec3& v, 28 | valType const & x, 29 | valType const & y, 30 | valType const & z 31 | ) 32 | { 33 | v.x = x; 34 | v.y = y; 35 | v.z = z; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER void set 40 | ( 41 | detail::tvec4& v, 42 | valType const & x, 43 | valType const & y, 44 | valType const & z, 45 | valType const & w 46 | ) 47 | { 48 | v.x = x; 49 | v.y = y; 50 | v.z = z; 51 | v.w = w; 52 | } 53 | }//namespace glm 54 | -------------------------------------------------------------------------------- /src/glm/gtx/vector_angle.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-09-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_angle.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER typename genType::value_type angle 14 | ( 15 | genType const & x, 16 | genType const & y 17 | ) 18 | { 19 | return degrees(acos(dot(x, y))); 20 | } 21 | 22 | //! \todo epsilon is hard coded to 0.01 23 | template 24 | GLM_FUNC_QUALIFIER valType orientedAngle 25 | ( 26 | detail::tvec2 const & x, 27 | detail::tvec2 const & y 28 | ) 29 | { 30 | #ifdef GLM_FORCE_RADIANS 31 | valType const Angle(acos(dot(x, y))); 32 | #else 33 | valType const Angle(glm::degrees(acos(dot(x, y)))); 34 | #endif 35 | detail::tvec2 const TransformedVector(glm::rotate(x, Angle)); 36 | if(all(epsilonEqual(y, TransformedVector, valType(0.01)))) 37 | return Angle; 38 | else 39 | return -Angle; 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER valType orientedAngle 44 | ( 45 | detail::tvec3 const & x, 46 | detail::tvec3 const & y, 47 | detail::tvec3 const & ref 48 | ) 49 | { 50 | valType const Angle(glm::degrees(glm::acos(glm::dot(x, y)))); 51 | 52 | if(glm::dot(ref, glm::cross(x, y)) < valType(0)) 53 | return -Angle; 54 | else 55 | return Angle; 56 | } 57 | }//namespace glm 58 | -------------------------------------------------------------------------------- /src/glm/gtx/verbose_operator.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-04-20 5 | // Updated : 2008-09-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/verbose_operator.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b) 14 | { 15 | return a + b; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType sub(genType const & a, genType const & b) 20 | { 21 | return a - b; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER detail::tmat2x2 mul 26 | ( 27 | detail::tmat2x2 const & a, 28 | detail::tmat2x2 const & b 29 | ) 30 | { 31 | return a * b; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tmat3x3 mul 36 | ( 37 | detail::tmat3x3 const & a, 38 | detail::tmat3x3 const & b 39 | ) 40 | { 41 | return a * b; 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER detail::tmat4x4 mul 46 | ( 47 | detail::tmat4x4 const & a, 48 | detail::tmat4x4 const & b 49 | ) 50 | { 51 | return a * b; 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER detail::tvec2 mul 56 | ( 57 | detail::tmat2x2 const & m, 58 | detail::tvec2 const & v 59 | ) 60 | { 61 | return m * v; 62 | } 63 | 64 | template 65 | GLM_FUNC_QUALIFIER detail::tvec3 mul 66 | ( 67 | detail::tmat3x3 const & m, 68 | detail::tvec3 const & v) 69 | { 70 | return m * v; 71 | } 72 | 73 | template 74 | GLM_FUNC_QUALIFIER detail::tvec4 mul 75 | ( 76 | detail::tmat4x4 const & m, 77 | detail::tvec4 const & v 78 | ) 79 | { 80 | return m * v; 81 | } 82 | 83 | template 84 | GLM_FUNC_QUALIFIER detail::tvec2 mul 85 | ( 86 | detail::tvec2 const & v, 87 | detail::tmat2x2 const & m 88 | ) 89 | { 90 | return v * m; 91 | } 92 | 93 | template 94 | GLM_FUNC_QUALIFIER detail::tvec3 mul 95 | ( 96 | detail::tvec3 const & v, 97 | detail::tmat3x3 const & m 98 | ) 99 | { 100 | return v * m; 101 | } 102 | 103 | template 104 | GLM_FUNC_QUALIFIER detail::tvec4 mul 105 | ( 106 | detail::tvec4 const & v, 107 | detail::tmat4x4 const & m 108 | ) 109 | { 110 | return v * m; 111 | } 112 | 113 | template 114 | GLM_FUNC_QUALIFIER genType div(genType const & a, genType const & b) 115 | { 116 | return a / b; 117 | } 118 | 119 | template 120 | GLM_FUNC_QUALIFIER genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV const & c) 121 | { 122 | return a * b + c; 123 | } 124 | }//namespace glm 125 | -------------------------------------------------------------------------------- /src/glm/gtx/wrap.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_wrap 24 | /// @file glm/gtx/wrap.hpp 25 | /// @date 2009-11-25 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_wrap GLM_GTX_wrap 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Wrapping mode of texture coordinates. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_wrap 39 | #define GLM_GTX_wrap GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_wrap extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_wrap 51 | /// @{ 52 | 53 | //! Simulate GL_CLAMP OpenGL wrap mode 54 | //! From GLM_GTX_wrap extension. 55 | template 56 | genType clamp(genType const & Texcoord); 57 | 58 | //! Simulate GL_REPEAT OpenGL wrap mode 59 | //! From GLM_GTX_wrap extension. 60 | template 61 | genType repeat(genType const & Texcoord); 62 | 63 | //! Simulate GL_MIRROR_REPEAT OpenGL wrap mode 64 | //! From GLM_GTX_wrap extension. 65 | template 66 | genType mirrorRepeat(genType const & Texcoord); 67 | 68 | /// @} 69 | }// namespace glm 70 | 71 | #include "wrap.inl" 72 | 73 | #endif//GLM_GTX_wrap 74 | -------------------------------------------------------------------------------- /src/opengl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #pragma once 30 | 31 | #ifdef ANDROID 32 | #include 33 | #include 34 | #endif -------------------------------------------------------------------------------- /src/shader.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #ifndef __DRR_SHADER_H__ 30 | #define __DRR_SHADER_H__ 31 | 32 | #include "system.h" 33 | 34 | GLuint compile_shader( GLenum type, const char* shader_data, int shader_size ); 35 | GLuint link_shader( GLuint vertex_shader_handle, GLuint fragment_shader_handle ); 36 | GLuint create_ui_program(const char* vertex_shader_filename, 37 | const char* fragment_shader_filename); 38 | 39 | // Loads, compiles, and links the shader for the given file and returns the program id 40 | GLuint load_shader( const char* shader_file_name ); 41 | 42 | // Precompiled shader methods 43 | void precompile_shader( const char* shader_file_name, const char* BINARY_FILENAME, const char* BINARY_FORMAT_FILENAME ); 44 | GLuint loadProgramBinary( const char* BINARY_FILENAME, GLenum binaryFormat); 45 | 46 | #endif // __DRR_SHADER_H__ -------------------------------------------------------------------------------- /src/stb_image.h: -------------------------------------------------------------------------------- 1 | #ifndef _stb_image_h 2 | #define _stb_image_h 3 | 4 | #define STBI_HEADER_FILE_ONLY 5 | 6 | #include "stb_image.cpp" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/system.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #ifndef __DRR_SYSTEM_H__ 30 | #define __DRR_SYSTEM_H__ 31 | 32 | #include 33 | 34 | extern const char* GLErrMsg[]; 35 | 36 | #define LOG_TAG "PrecompiledApp" 37 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 38 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) 39 | #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) 40 | 41 | #define checkOGLError() {\ 42 | GLuint E;\ 43 | if ( GL_NO_ERROR != (E = glGetError()) )\ 44 | { LOGE("OpenGL Error: error 0x%x = %s", E, GLErrMsg[E-GL_INVALID_ENUM]); }\ 45 | } 46 | 47 | // Read the contents of the give file return the content and the file size 48 | void read_file( const char* FileName, char** Content, unsigned int* Size ); 49 | float rand_f( ); 50 | 51 | #endif // __DRR_SYSTEM_H__ 52 | -------------------------------------------------------------------------------- /src/texture.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #ifndef __TEXTURE_LDR_H__ 30 | #define __TEXTURE_LDR_H__ 31 | 32 | #include "opengl.h" 33 | 34 | GLuint load_texture(const char* filename); 35 | 36 | #endif // header guard 37 | -------------------------------------------------------------------------------- /src/timer.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #include "timer.h" 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | static struct timespec _time_difference(struct timespec a, struct timespec b) 36 | { 37 | struct timespec temp; 38 | temp.tv_sec = a.tv_sec-b.tv_sec; 39 | temp.tv_nsec = a.tv_nsec-b.tv_nsec; 40 | return temp; 41 | } 42 | 43 | struct Timer 44 | { 45 | struct timespec start_time; 46 | struct timespec prev_time; 47 | }; 48 | 49 | Timer* create_timer(void) 50 | { 51 | Timer* timer = (Timer*)calloc(1, sizeof(*timer)); 52 | reset_timer(timer); 53 | return timer; 54 | } 55 | void destroy_timer(Timer* timer) 56 | { 57 | free(timer); 58 | } 59 | void reset_timer(Timer* timer) 60 | { 61 | struct timespec time; 62 | clock_gettime(CLOCK_MONOTONIC, &time); 63 | timer->prev_time = timer->start_time = time; 64 | } 65 | double get_delta_time(Timer* timer) 66 | { 67 | struct timespec time; 68 | struct timespec diff; 69 | clock_gettime(CLOCK_MONOTONIC, &time); 70 | diff = _time_difference(time, timer->prev_time); 71 | timer->prev_time = time; 72 | return diff.tv_sec + diff.tv_nsec*1.0/1000000000; 73 | } 74 | double get_running_time(Timer* timer) 75 | { 76 | struct timespec time; 77 | struct timespec diff; 78 | clock_gettime(CLOCK_MONOTONIC, &time); 79 | diff = _time_difference(time, timer->start_time); 80 | return diff.tv_sec + diff.tv_nsec*1.0/1000000000; 81 | } -------------------------------------------------------------------------------- /src/timer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, Intel Corporation 2 | * 3 | * Redistribution and use in source and binary forms, with or without 4 | * modification, are permitted provided that the following conditions are met: 5 | * 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * - Neither the name of Intel Corporation nor the names of its contributors 12 | * may be used to endorse or promote products derived from this software 13 | * without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | * 27 | */ 28 | 29 | #ifndef __timer_h__ 30 | #define __timer_h__ 31 | 32 | typedef struct Timer Timer; 33 | 34 | Timer* create_timer(void); 35 | void destroy_timer(Timer* timer); 36 | 37 | void reset_timer(Timer* timer); 38 | /** @return The time since the last `get_delta_time` call, in seconds. */ 39 | double get_delta_time(Timer* timer); 40 | /** @return The time since the last `reset_timer` call, in seconds. */ 41 | double get_running_time(Timer* timer); 42 | 43 | #endif /* include guard */ --------------------------------------------------------------------------------