├── .gitattributes ├── .gitignore ├── Dependencies ├── GLEW │ ├── LICENSE.txt │ ├── doc │ │ ├── advanced.html │ │ ├── basic.html │ │ ├── build.html │ │ ├── credits.html │ │ ├── github.png │ │ ├── glew.css │ │ ├── glew.html │ │ ├── glew.png │ │ ├── glew.txt │ │ ├── glxew.html │ │ ├── gpl.txt │ │ ├── index.html │ │ ├── install.html │ │ ├── khronos.txt │ │ ├── log.html │ │ ├── mesa.txt │ │ ├── new.png │ │ ├── ogl_sm.jpg │ │ ├── travis.png │ │ └── wglew.html │ └── include │ │ └── GL │ │ ├── eglew.h │ │ ├── glew.h │ │ ├── glxew.h │ │ └── wglew.h └── GLFW │ ├── include │ └── GLFW │ │ ├── glfw3.h │ │ └── glfw3native.h │ └── lib-vc2015 │ └── glfw3.lib ├── OpenGLTutorialYoutube.sln ├── OpenGLTutorialYoutube.vcxproj ├── OpenGLTutorialYoutube.vcxproj.filters ├── README.md ├── res ├── shaders │ └── Basic.shader └── textures │ └── ChernoLogo.png └── src ├── Application.cpp ├── IndexBuffer.cpp ├── IndexBuffer.h ├── Renderer.cpp ├── Renderer.h ├── Shader.cpp ├── Shader.h ├── Texture.cpp ├── Texture.h ├── VertexArray.cpp ├── VertexArray.h ├── VertexBuffer.cpp ├── VertexBuffer.h ├── VertexBufferLayout.h └── vendor ├── glm ├── CMakeLists.txt ├── common.hpp ├── detail │ ├── _features.hpp │ ├── _fixes.hpp │ ├── _noise.hpp │ ├── _swizzle.hpp │ ├── _swizzle_func.hpp │ ├── _vectorize.hpp │ ├── dummy.cpp │ ├── func_common.hpp │ ├── func_common.inl │ ├── func_common_simd.inl │ ├── func_exponential.hpp │ ├── func_exponential.inl │ ├── func_exponential_simd.inl │ ├── func_geometric.hpp │ ├── func_geometric.inl │ ├── func_geometric_simd.inl │ ├── func_integer.hpp │ ├── func_integer.inl │ ├── func_integer_simd.inl │ ├── func_matrix.hpp │ ├── func_matrix.inl │ ├── func_matrix_simd.inl │ ├── func_packing.hpp │ ├── func_packing.inl │ ├── func_packing_simd.inl │ ├── func_trigonometric.hpp │ ├── func_trigonometric.inl │ ├── func_trigonometric_simd.inl │ ├── func_vector_relational.hpp │ ├── func_vector_relational.inl │ ├── func_vector_relational_simd.inl │ ├── glm.cpp │ ├── precision.hpp │ ├── setup.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_mat4x4_simd.inl │ ├── 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 │ └── type_vec4_simd.inl ├── exponential.hpp ├── ext.hpp ├── fwd.hpp ├── geometric.hpp ├── glm.hpp ├── gtc │ ├── bitfield.hpp │ ├── bitfield.inl │ ├── color_encoding.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── constants.hpp │ ├── constants.inl │ ├── epsilon.hpp │ ├── epsilon.inl │ ├── functions.hpp │ ├── functions.inl │ ├── integer.hpp │ ├── integer.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 │ ├── packing.hpp │ ├── packing.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── quaternion_simd.inl │ ├── random.hpp │ ├── random.inl │ ├── reciprocal.hpp │ ├── reciprocal.inl │ ├── round.hpp │ ├── round.inl │ ├── type_aligned.hpp │ ├── type_precision.hpp │ ├── type_precision.inl │ ├── type_ptr.hpp │ ├── type_ptr.inl │ ├── ulp.hpp │ ├── ulp.inl │ ├── vec1.hpp │ └── vec1.inl ├── gtx │ ├── associated_min_max.hpp │ ├── associated_min_max.inl │ ├── bit.hpp │ ├── bit.inl │ ├── closest_point.hpp │ ├── closest_point.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── color_space_YCoCg.hpp │ ├── color_space_YCoCg.inl │ ├── common.hpp │ ├── common.inl │ ├── compatibility.hpp │ ├── compatibility.inl │ ├── component_wise.hpp │ ├── component_wise.inl │ ├── dual_quaternion.hpp │ ├── dual_quaternion.inl │ ├── euler_angles.hpp │ ├── euler_angles.inl │ ├── extend.hpp │ ├── extend.inl │ ├── extended_min_max.hpp │ ├── extended_min_max.inl │ ├── fast_exponential.hpp │ ├── fast_exponential.inl │ ├── fast_square_root.hpp │ ├── fast_square_root.inl │ ├── fast_trigonometry.hpp │ ├── fast_trigonometry.inl │ ├── float_notmalize.inl │ ├── gradient_paint.hpp │ ├── gradient_paint.inl │ ├── handed_coordinate_space.hpp │ ├── handed_coordinate_space.inl │ ├── hash.hpp │ ├── hash.inl │ ├── integer.hpp │ ├── integer.inl │ ├── intersect.hpp │ ├── intersect.inl │ ├── io.hpp │ ├── io.inl │ ├── log_base.hpp │ ├── log_base.inl │ ├── matrix_cross_product.hpp │ ├── matrix_cross_product.inl │ ├── matrix_decompose.hpp │ ├── matrix_decompose.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 │ ├── matrix_transform_2d.hpp │ ├── matrix_transform_2d.inl │ ├── mixed_product.hpp │ ├── mixed_product.inl │ ├── norm.hpp │ ├── norm.inl │ ├── normal.hpp │ ├── normal.inl │ ├── normalize_dot.hpp │ ├── normalize_dot.inl │ ├── number_precision.hpp │ ├── number_precision.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 │ ├── range.hpp │ ├── raw_data.hpp │ ├── raw_data.inl │ ├── rotate_normalized_axis.hpp │ ├── rotate_normalized_axis.inl │ ├── rotate_vector.hpp │ ├── rotate_vector.inl │ ├── scalar_multiplication.hpp │ ├── scalar_relational.hpp │ ├── scalar_relational.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 │ ├── type_aligned.hpp │ ├── type_aligned.inl │ ├── type_trait.hpp │ ├── type_trait.inl │ ├── vector_angle.hpp │ ├── vector_angle.inl │ ├── vector_query.hpp │ ├── vector_query.inl │ ├── wrap.hpp │ └── wrap.inl ├── integer.hpp ├── mat2x2.hpp ├── mat2x3.hpp ├── mat2x4.hpp ├── mat3x2.hpp ├── mat3x3.hpp ├── mat3x4.hpp ├── mat4x2.hpp ├── mat4x3.hpp ├── mat4x4.hpp ├── matrix.hpp ├── packing.hpp ├── simd │ ├── common.h │ ├── exponential.h │ ├── geometric.h │ ├── integer.h │ ├── matrix.h │ ├── packing.h │ ├── platform.h │ ├── trigonometric.h │ └── vector_relational.h ├── trigonometric.hpp ├── vec2.hpp ├── vec3.hpp ├── vec4.hpp └── vector_relational.hpp └── stb_image ├── stb_image.cpp └── stb_image.h /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/Dependencies/GLEW/doc/github.png -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/glew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/Dependencies/GLEW/doc/glew.png -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/glew.txt: -------------------------------------------------------------------------------- 1 | The OpenGL Extension Wrangler Library 2 | Copyright (C) 2008-2016, Nigel Stewart 3 | Copyright (C) 2002-2008, Milan Ikits 4 | Copyright (C) 2002-2008, Marcelo E. Magallon 5 | Copyright (C) 2002, Lev Povalahev 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * The name of the author may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29 | THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/khronos.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 The Khronos Group Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and/or associated documentation files (the 5 | "Materials"), to deal in the Materials without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Materials, and to 8 | permit persons to whom the Materials are furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Materials. 13 | 14 | THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 21 | -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/mesa.txt: -------------------------------------------------------------------------------- 1 | Mesa 3-D graphics library 2 | Version: 7.0 3 | 4 | Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a 7 | copy of this software and associated documentation files (the "Software"), 8 | to deal in the Software without restriction, including without limitation 9 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | and/or sell copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 20 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/Dependencies/GLEW/doc/new.png -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/ogl_sm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/Dependencies/GLEW/doc/ogl_sm.jpg -------------------------------------------------------------------------------- /Dependencies/GLEW/doc/travis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/Dependencies/GLEW/doc/travis.png -------------------------------------------------------------------------------- /Dependencies/GLFW/lib-vc2015/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/Dependencies/GLFW/lib-vc2015/glfw3.lib -------------------------------------------------------------------------------- /OpenGLTutorialYoutube.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2027 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGLTutorialYoutube", "OpenGLTutorialYoutube.vcxproj", "{7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Debug|x64.ActiveCfg = Debug|x64 17 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Debug|x64.Build.0 = Debug|x64 18 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Debug|x86.ActiveCfg = Debug|Win32 19 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Debug|x86.Build.0 = Debug|Win32 20 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Release|x64.ActiveCfg = Release|x64 21 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Release|x64.Build.0 = Release|x64 22 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Release|x86.ActiveCfg = Release|Win32 23 | {7D94EA58-A9F6-42F1-B060-FACDBEE7C5C8}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {578BE5EE-FE1C-4816-8B61-F8760031A189} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenGL Basics 2 | 3 | This repository follows an [OpenGL video series](https://www.youtube.com/watch?v=W3gAzLwfIP0&list=PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2) from 'The Cherno' on Youtube. Take a look at the branches for video specific additions. 4 | 5 | ### Setup 6 | 7 | Clone and open the source code in Visual Studio. Multiple platforms are supported if you are able to run the libraries below. 8 | 9 | ### Contents 10 | 11 | This project is based on [GLFW](http://www.glfw.org/) and [GLEW](http://glew.sourceforge.net/). -------------------------------------------------------------------------------- /res/shaders/Basic.shader: -------------------------------------------------------------------------------- 1 | #shader vertex 2 | #version 330 core 3 | 4 | layout(location = 0) in vec4 position; 5 | layout(location = 1) in vec2 texCoord; 6 | 7 | out vec2 v_TexCoord; 8 | 9 | uniform mat4 u_MVP; 10 | 11 | void main() 12 | { 13 | gl_Position = u_MVP * position; 14 | v_TexCoord = texCoord; 15 | }; 16 | 17 | #shader fragment 18 | #version 330 core 19 | 20 | layout(location = 0) out vec4 color; 21 | 22 | in vec2 v_TexCoord; 23 | 24 | uniform vec4 u_Color; 25 | uniform sampler2D u_Texture; 26 | 27 | void main() 28 | { 29 | vec4 texColor = texture(u_Texture, v_TexCoord); 30 | color = texColor; 31 | }; -------------------------------------------------------------------------------- /res/textures/ChernoLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/res/textures/ChernoLogo.png -------------------------------------------------------------------------------- /src/IndexBuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "IndexBuffer.h" 2 | #include "Renderer.h" 3 | 4 | IndexBuffer::IndexBuffer(const unsigned int* data, unsigned int count) 5 | : m_Count(count) 6 | { 7 | ASSERT(sizeof(unsigned int) == sizeof(GLuint)); 8 | 9 | GLCall(glGenBuffers(1, &m_RendererID)); // Generate a single buffer 10 | GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID)); // Select the buffer to be drawn 11 | GLCall(glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * sizeof(unsigned int), data, GL_STATIC_DRAW)); // Add the data to the buffer 12 | } 13 | 14 | IndexBuffer::~IndexBuffer() 15 | { 16 | GLCall(glDeleteBuffers(1, &m_RendererID)); 17 | } 18 | 19 | void IndexBuffer::Bind() const 20 | { 21 | GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_RendererID)); 22 | } 23 | 24 | void IndexBuffer::Unbind() const 25 | { 26 | GLCall(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); 27 | } 28 | -------------------------------------------------------------------------------- /src/IndexBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class IndexBuffer 4 | { 5 | private: 6 | unsigned int m_RendererID; 7 | unsigned int m_Count; 8 | public: 9 | IndexBuffer(const unsigned int* data, unsigned int count); 10 | ~IndexBuffer(); 11 | 12 | void Bind() const; 13 | void Unbind() const; 14 | 15 | inline unsigned int GetCount() const { return m_Count; } 16 | }; -------------------------------------------------------------------------------- /src/Renderer.cpp: -------------------------------------------------------------------------------- 1 | #include "Renderer.h" 2 | 3 | #include 4 | 5 | void GLClearError() 6 | { 7 | while (glGetError() != GL_NO_ERROR); 8 | } 9 | 10 | bool GLLogCall(const char* function, const char* file, int line) 11 | { 12 | GLenum error = glGetError(); 13 | 14 | if (error) 15 | { 16 | std::cout << "[OpenGL Error] (" << std::hex << error << ") in " << function << " at " << file << " on line " << std::dec << line << std::endl; 17 | return false; 18 | } 19 | 20 | return true; 21 | } 22 | 23 | void Renderer::Clear() const 24 | { 25 | GLCall(glClear(GL_COLOR_BUFFER_BIT)); 26 | } 27 | 28 | void Renderer::Draw(const VertexArray& va, const IndexBuffer& ib, const Shader& shader) const 29 | { 30 | // Bind everything so we can draw 31 | shader.Bind(); 32 | va.Bind(); 33 | ib.Bind(); 34 | 35 | // Draw the current selected buffer 36 | GLCall(glDrawElements(GL_TRIANGLES, ib.GetCount(), GL_UNSIGNED_INT, nullptr)); // nullptr, because the indices are bound to the current buffer: GL_ELEMENT_ARRAY_BUFFER 37 | } -------------------------------------------------------------------------------- /src/Renderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "VertexArray.h" 6 | #include "IndexBuffer.h" 7 | #include "Shader.h" 8 | 9 | #define ASSERT(x) if (!(x)) __debugbreak(); // Break debugging if x returns false 10 | #define GLCall(x) GLClearError(); x; ASSERT(GLLogCall(#x, __FILE__, __LINE__)); // Wrap a function with an error boundary 11 | 12 | /** 13 | Clear all (unrelated) previous errors. 14 | */ 15 | void GLClearError(); 16 | 17 | /** 18 | Check for an error and log the error to the console. 19 | 20 | @param function The function where the error happend 21 | @param file The file where the error happend 22 | @param line The line number where the error happend 23 | @return Whether there was an error 24 | */ 25 | bool GLLogCall(const char* function, const char* file, int line); 26 | 27 | class Renderer 28 | { 29 | public: 30 | void Clear() const; 31 | void Draw(const VertexArray& va, const IndexBuffer& ib, const Shader& shader) const; 32 | }; -------------------------------------------------------------------------------- /src/Shader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "glm/glm.hpp" 7 | 8 | /** 9 | A struct that combines shader sources into a single type. 10 | */ 11 | struct ShaderProgramSource 12 | { 13 | std::string VertexSource; 14 | std::string FragmentSource; 15 | }; 16 | 17 | class Shader 18 | { 19 | private: 20 | std::string m_FilePath; 21 | unsigned int m_RendererID; 22 | std::unordered_map m_UniformLocationCache; 23 | public: 24 | Shader(const std::string& filePath); 25 | ~Shader(); 26 | 27 | void Bind() const; 28 | void Unbind() const; 29 | 30 | // Set uniforms 31 | void SetUniform1i(const std::string& name, int value); 32 | void SetUniform4f(const std::string& name, float v0, float v1, float v2, float v3); 33 | void SetUniformMat4f(const std::string& name, glm::mat4& matrix); 34 | private: 35 | 36 | /** 37 | Parse a single shader file to a shader source. 38 | 39 | @param filePath Path to the shader file 40 | @return ShaderProgramSource The combined shader sources in as ShaderProgramSource 41 | */ 42 | ShaderProgramSource ParseShader(const std::string filePath); 43 | 44 | /** 45 | Links the given shaders into a single shader so that it can be bound. 46 | 47 | @param vertexShader Source of the vertexshader as string 48 | @param fragmentShader Source of the fragmentshader as string 49 | @return unsigned int An identifier for the newly created shader 50 | */ 51 | unsigned int CreateShader(const std::string& vertexShader, const std::string& fragmentShader); 52 | 53 | /** 54 | Compiles a single shader so it can be attached. 55 | 56 | @param type The type of the shader 57 | @param source The source code of the shader as string 58 | @return unsigned int An identifier for the compiled shader 59 | */ 60 | unsigned int CompileShader(unsigned int type, const std::string& source); 61 | 62 | /** 63 | Return the location of the shader based on uniform name 64 | 65 | @param name The name of the uniform 66 | @return The location 67 | */ 68 | unsigned int GetUniformLocation(const std::string& name); 69 | }; -------------------------------------------------------------------------------- /src/Texture.cpp: -------------------------------------------------------------------------------- 1 | #include "Texture.h" 2 | #include 3 | 4 | #include "stb_image\stb_image.h" 5 | 6 | Texture::Texture(const std::string& path) 7 | : m_RendererID(0), m_FilePath(path), m_LocalBuffer(nullptr), m_Width(0), m_Height(0), m_BPP(0) 8 | { 9 | stbi_set_flip_vertically_on_load(1); 10 | m_LocalBuffer = stbi_load(path.c_str(), &m_Width, &m_Height, &m_BPP, 4); 11 | 12 | GLCall(glGenTextures(1, &m_RendererID)); 13 | GLCall(glBindTexture(GL_TEXTURE_2D, m_RendererID)); 14 | 15 | GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); 16 | GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); 17 | GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); 18 | GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); 19 | 20 | GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_Width, m_Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_LocalBuffer)); 21 | GLCall(glBindTexture(GL_TEXTURE_2D, 0)); 22 | 23 | if (m_LocalBuffer) 24 | { 25 | stbi_image_free(m_LocalBuffer); 26 | } 27 | } 28 | 29 | Texture::~Texture() 30 | { 31 | GLCall(glDeleteTextures(1, &m_RendererID)); 32 | } 33 | 34 | void Texture::Bind(unsigned int slot) const 35 | { 36 | GLCall(glActiveTexture(GL_TEXTURE0 + slot)); 37 | GLCall(glBindTexture(GL_TEXTURE_2D, m_RendererID)); 38 | } 39 | 40 | void Texture::Unbind() 41 | { 42 | GLCall(glBindTexture(GL_TEXTURE_2D, 0)); 43 | } 44 | -------------------------------------------------------------------------------- /src/Texture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Renderer.h" 4 | 5 | class Texture 6 | { 7 | private: 8 | unsigned int m_RendererID; 9 | std::string m_FilePath; 10 | unsigned char* m_LocalBuffer; 11 | int m_Width, m_Height, m_BPP; 12 | public: 13 | Texture(const std::string& path); 14 | ~Texture(); 15 | 16 | void Bind(unsigned int slot = 0) const; 17 | void Unbind(); 18 | 19 | inline int GetWidth() const { return m_Width; } 20 | inline int GetHeight() const { return m_Height; } 21 | }; -------------------------------------------------------------------------------- /src/VertexArray.cpp: -------------------------------------------------------------------------------- 1 | #include "VertexArray.h" 2 | #include "VertexBufferLayout.h" 3 | #include "Renderer.h" 4 | 5 | VertexArray::VertexArray() 6 | { 7 | GLCall(glGenVertexArrays(1, &m_RendererID)); 8 | } 9 | 10 | VertexArray::~VertexArray() 11 | { 12 | GLCall(glDeleteVertexArrays(1, &m_RendererID)); 13 | } 14 | 15 | void VertexArray::AddBuffer(const VertexBuffer & vb, const VertexBufferLayout & layout) 16 | { 17 | Bind(); 18 | vb.Bind(); 19 | 20 | const auto& elements = layout.GetElements(); 21 | unsigned int offset = 0; 22 | 23 | for (unsigned int i = 0; i < elements.size(); i++) 24 | { 25 | const auto& element = elements[i]; 26 | GLCall(glEnableVertexAttribArray(i)); 27 | GLCall(glVertexAttribPointer(i, element.count, element.type, element.normalized, layout.GetStride(), (const void*)offset)); 28 | offset += element.count * VertexBufferElement::GetSizeOfType(element.type); 29 | } 30 | } 31 | 32 | void VertexArray::Bind() const 33 | { 34 | GLCall(glBindVertexArray(m_RendererID)); 35 | } 36 | 37 | void VertexArray::Unbind() const 38 | { 39 | GLCall(glBindVertexArray(0)); 40 | } 41 | -------------------------------------------------------------------------------- /src/VertexArray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "VertexBuffer.h" 4 | 5 | class VertexBufferLayout; 6 | 7 | class VertexArray 8 | { 9 | private: 10 | unsigned int m_RendererID; 11 | public: 12 | VertexArray(); 13 | ~VertexArray(); 14 | 15 | void AddBuffer(const VertexBuffer& vb, const VertexBufferLayout& layout); 16 | 17 | void Bind() const; 18 | void Unbind() const; 19 | }; -------------------------------------------------------------------------------- /src/VertexBuffer.cpp: -------------------------------------------------------------------------------- 1 | #include "VertexBuffer.h" 2 | #include "Renderer.h" 3 | 4 | VertexBuffer::VertexBuffer(const void * data, unsigned int size) 5 | { 6 | GLCall(glGenBuffers(1, &m_RendererID)); // Generate a single buffer 7 | GLCall(glBindBuffer(GL_ARRAY_BUFFER, m_RendererID)); // Select the buffer to be drawn 8 | GLCall(glBufferData(GL_ARRAY_BUFFER, size, data, GL_STATIC_DRAW)); // Add the data to the buffer 9 | } 10 | 11 | VertexBuffer::~VertexBuffer() 12 | { 13 | GLCall(glDeleteBuffers(1, &m_RendererID)); 14 | } 15 | 16 | void VertexBuffer::Bind() const 17 | { 18 | GLCall(glBindBuffer(GL_ARRAY_BUFFER, m_RendererID)); 19 | } 20 | 21 | void VertexBuffer::Unbind() const 22 | { 23 | GLCall(glBindBuffer(GL_ARRAY_BUFFER, 0)); 24 | } 25 | -------------------------------------------------------------------------------- /src/VertexBuffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class VertexBuffer 4 | { 5 | private: 6 | unsigned int m_RendererID; 7 | public: 8 | VertexBuffer(const void* data, unsigned int size); 9 | ~VertexBuffer(); 10 | 11 | void Bind() const; 12 | void Unbind() const; 13 | }; -------------------------------------------------------------------------------- /src/VertexBufferLayout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "Renderer.h" 7 | 8 | struct VertexBufferElement 9 | { 10 | unsigned int type; 11 | unsigned int count; 12 | unsigned char normalized; 13 | 14 | static unsigned int GetSizeOfType(unsigned int type) 15 | { 16 | switch (type) 17 | { 18 | case GL_FLOAT: return 4; 19 | case GL_UNSIGNED_INT: return 4; 20 | case GL_UNSIGNED_BYTE: return 1; 21 | } 22 | 23 | ASSERT(false); 24 | return 0; 25 | } 26 | }; 27 | 28 | class VertexBufferLayout 29 | { 30 | private: 31 | std::vector m_Elements; 32 | unsigned int m_Stride; 33 | public: 34 | VertexBufferLayout() 35 | : m_Stride(0) {} 36 | 37 | template 38 | void Push(unsigned int count) 39 | { 40 | static_assert(false); 41 | } 42 | 43 | template<> 44 | void Push(unsigned int count) 45 | { 46 | m_Elements.push_back({ GL_FLOAT, count, GL_FALSE }); 47 | m_Stride += count * VertexBufferElement::GetSizeOfType(GL_FLOAT); 48 | } 49 | 50 | template<> 51 | void Push(unsigned int count) 52 | { 53 | m_Elements.push_back({ GL_UNSIGNED_INT, count, GL_FALSE }); 54 | m_Stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_INT); 55 | } 56 | 57 | template<> 58 | void Push(unsigned int count) 59 | { 60 | m_Elements.push_back({ GL_UNSIGNED_BYTE, count, GL_FALSE }); 61 | m_Stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_BYTE); 62 | } 63 | 64 | inline const std::vector GetElements() const { return m_Elements; } 65 | inline unsigned int GetStride() const { return m_Stride; } 66 | }; -------------------------------------------------------------------------------- /src/vendor/glm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB ROOT_SOURCE *.cpp) 2 | file(GLOB ROOT_INLINE *.inl) 3 | file(GLOB ROOT_HEADER *.hpp) 4 | file(GLOB ROOT_TEXT ../*.txt) 5 | file(GLOB ROOT_MD ../*.md) 6 | file(GLOB ROOT_NAT ../util/glm.natvis) 7 | 8 | file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) 9 | file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) 10 | file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) 11 | 12 | file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) 13 | file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) 14 | file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) 15 | 16 | file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) 17 | file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) 18 | file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) 19 | 20 | file(GLOB_RECURSE SIMD_SOURCE ./simd/*.cpp) 21 | file(GLOB_RECURSE SIMD_INLINE ./simd/*.inl) 22 | file(GLOB_RECURSE SIMD_HEADER ./simd/*.h) 23 | 24 | source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD}) 25 | source_group("Core Files" FILES ${CORE_SOURCE}) 26 | source_group("Core Files" FILES ${CORE_INLINE}) 27 | source_group("Core Files" FILES ${CORE_HEADER}) 28 | source_group("GTC Files" FILES ${GTC_SOURCE}) 29 | source_group("GTC Files" FILES ${GTC_INLINE}) 30 | source_group("GTC Files" FILES ${GTC_HEADER}) 31 | source_group("GTX Files" FILES ${GTX_SOURCE}) 32 | source_group("GTX Files" FILES ${GTX_INLINE}) 33 | source_group("GTX Files" FILES ${GTX_HEADER}) 34 | source_group("SIMD Files" FILES ${SIMD_SOURCE}) 35 | source_group("SIMD Files" FILES ${SIMD_INLINE}) 36 | source_group("SIMD Files" FILES ${SIMD_HEADER}) 37 | 38 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 39 | 40 | if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) 41 | if(GLM_STATIC_LIBRARY_ENABLE) 42 | add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} 43 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 44 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 45 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 46 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 47 | ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) 48 | endif(GLM_STATIC_LIBRARY_ENABLE) 49 | 50 | if(GLM_DYNAMIC_LIBRARY_ENABLE) 51 | add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} 52 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 53 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 54 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 55 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 56 | ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) 57 | endif(GLM_DYNAMIC_LIBRARY_ENABLE) 58 | 59 | else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) 60 | add_executable(glm_dummy ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} 61 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 62 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 63 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 64 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 65 | ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) 66 | 67 | endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) 68 | -------------------------------------------------------------------------------- /src/vendor/glm/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/common.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_common.hpp" 7 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/_fixes.hpp 3 | 4 | #include 5 | 6 | //! Workaround for compatibility with other libraries 7 | #ifdef max 8 | #undef max 9 | #endif 10 | 11 | //! Workaround for compatibility with other libraries 12 | #ifdef min 13 | #undef min 14 | #endif 15 | 16 | //! Workaround for Android 17 | #ifdef isnan 18 | #undef isnan 19 | #endif 20 | 21 | //! Workaround for Android 22 | #ifdef isinf 23 | #undef isinf 24 | #endif 25 | 26 | //! Workaround for Chrone Native Client 27 | #ifdef log2 28 | #undef log2 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt 13 | { 14 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 15 | { 16 | tvec4 result(uninitialize); 17 | result.data = _mm_sqrt_ps(v.data); 18 | return result; 19 | } 20 | }; 21 | 22 | template <> 23 | struct compute_sqrt 24 | { 25 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 26 | { 27 | tvec4 result(uninitialize); 28 | result.data = glm_vec4_sqrt_lowp(v.data); 29 | return result; 30 | } 31 | }; 32 | }//namespace detail 33 | }//namespace glm 34 | 35 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 36 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/func_geometric_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_geometric_simd.inl 3 | 4 | #include "../simd/geometric.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_length 13 | { 14 | GLM_FUNC_QUALIFIER static float call(tvec4 const & v) 15 | { 16 | return _mm_cvtss_f32(glm_vec4_length(v.data)); 17 | } 18 | }; 19 | 20 | template 21 | struct compute_distance 22 | { 23 | GLM_FUNC_QUALIFIER static float call(tvec4 const & p0, tvec4 const & p1) 24 | { 25 | return _mm_cvtss_f32(glm_vec4_distance(p0.data, p1.data)); 26 | } 27 | }; 28 | 29 | template 30 | struct compute_dot 31 | { 32 | GLM_FUNC_QUALIFIER static float call(tvec4 const& x, tvec4 const& y) 33 | { 34 | return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); 35 | } 36 | }; 37 | 38 | template 39 | struct compute_cross 40 | { 41 | GLM_FUNC_QUALIFIER static tvec3 call(tvec3 const & a, tvec3 const & b) 42 | { 43 | __m128 const set0 = _mm_set_ps(0.0f, a.z, a.y, a.x); 44 | __m128 const set1 = _mm_set_ps(0.0f, b.z, b.y, b.x); 45 | __m128 const xpd0 = glm_vec4_cross(set0, set1); 46 | 47 | tvec4 result(uninitialize); 48 | result.data = xpd0; 49 | return tvec3(result); 50 | } 51 | }; 52 | 53 | template 54 | struct compute_normalize 55 | { 56 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 57 | { 58 | tvec4 result(uninitialize); 59 | result.data = glm_vec4_normalize(v.data); 60 | return result; 61 | } 62 | }; 63 | 64 | template 65 | struct compute_faceforward 66 | { 67 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& N, tvec4 const& I, tvec4 const& Nref) 68 | { 69 | tvec4 result(uninitialize); 70 | result.data = glm_vec4_faceforward(N.data, I.data, Nref.data); 71 | return result; 72 | } 73 | }; 74 | 75 | template 76 | struct compute_reflect 77 | { 78 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& I, tvec4 const& N) 79 | { 80 | tvec4 result(uninitialize); 81 | result.data = glm_vec4_reflect(I.data, N.data); 82 | return result; 83 | } 84 | }; 85 | 86 | template 87 | struct compute_refract 88 | { 89 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& I, tvec4 const& N, float eta) 90 | { 91 | tvec4 result(uninitialize); 92 | result.data = glm_vec4_refract(I.data, N.data, _mm_set1_ps(eta)); 93 | return result; 94 | } 95 | }; 96 | }//namespace detail 97 | }//namespace glm 98 | 99 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 100 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/func_integer_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_integer_simd.inl 3 | 4 | #include "../simd/integer.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_bitfieldReverseStep 13 | { 14 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v, uint32 Mask, uint32 Shift) 15 | { 16 | __m128i const set0 = v.data; 17 | 18 | __m128i const set1 = _mm_set1_epi32(Mask); 19 | __m128i const and1 = _mm_and_si128(set0, set1); 20 | __m128i const sft1 = _mm_slli_epi32(and1, Shift); 21 | 22 | __m128i const set2 = _mm_andnot_si128(set0, _mm_set1_epi32(-1)); 23 | __m128i const and2 = _mm_and_si128(set0, set2); 24 | __m128i const sft2 = _mm_srai_epi32(and2, Shift); 25 | 26 | __m128i const or0 = _mm_or_si128(sft1, sft2); 27 | 28 | return or0; 29 | } 30 | }; 31 | 32 | template 33 | struct compute_bitfieldBitCountStep 34 | { 35 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v, uint32 Mask, uint32 Shift) 36 | { 37 | __m128i const set0 = v.data; 38 | 39 | __m128i const set1 = _mm_set1_epi32(Mask); 40 | __m128i const and0 = _mm_and_si128(set0, set1); 41 | __m128i const sft0 = _mm_slli_epi32(set0, Shift); 42 | __m128i const and1 = _mm_and_si128(sft0, set1); 43 | __m128i const add0 = _mm_add_epi32(and0, and1); 44 | 45 | return add0; 46 | } 47 | }; 48 | }//namespace detail 49 | 50 | # if GLM_ARCH & GLM_ARCH_AVX_BIT 51 | template <> 52 | GLM_FUNC_QUALIFIER int bitCount(uint32 x) 53 | { 54 | return _mm_popcnt_u32(x); 55 | } 56 | 57 | # if(GLM_MODEL == GLM_MODEL_64) 58 | template <> 59 | GLM_FUNC_QUALIFIER int bitCount(uint64 x) 60 | { 61 | return static_cast(_mm_popcnt_u64(x)); 62 | } 63 | # endif//GLM_MODEL 64 | # endif//GLM_ARCH 65 | 66 | }//namespace glm 67 | 68 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 69 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/func_matrix_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_matrix_simd.inl 3 | 4 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 5 | 6 | #include "type_mat4x4.hpp" 7 | #include "func_geometric.hpp" 8 | #include "../simd/matrix.h" 9 | 10 | namespace glm{ 11 | namespace detail 12 | { 13 | template 14 | struct compute_matrixCompMult 15 | { 16 | GLM_STATIC_ASSERT(detail::is_aligned

::value, "Specialization requires aligned"); 17 | 18 | GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const & x, tmat4x4 const & y) 19 | { 20 | tmat4x4 result(uninitialize); 21 | glm_mat4_matrixCompMult( 22 | *(glm_vec4 const (*)[4])&x[0].data, 23 | *(glm_vec4 const (*)[4])&y[0].data, 24 | *(glm_vec4(*)[4])&result[0].data); 25 | return result; 26 | } 27 | }; 28 | 29 | template 30 | struct compute_transpose 31 | { 32 | GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const & m) 33 | { 34 | tmat4x4 result(uninitialize); 35 | glm_mat4_transpose( 36 | *(glm_vec4 const (*)[4])&m[0].data, 37 | *(glm_vec4(*)[4])&result[0].data); 38 | return result; 39 | } 40 | }; 41 | 42 | template 43 | struct compute_determinant 44 | { 45 | GLM_FUNC_QUALIFIER static float call(tmat4x4 const& m) 46 | { 47 | return _mm_cvtss_f32(glm_mat4_determinant(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data))); 48 | } 49 | }; 50 | 51 | template 52 | struct compute_inverse 53 | { 54 | GLM_FUNC_QUALIFIER static tmat4x4 call(tmat4x4 const& m) 55 | { 56 | tmat4x4 Result(uninitialize); 57 | glm_mat4_inverse(*reinterpret_cast<__m128 const(*)[4]>(&m[0].data), *reinterpret_cast<__m128(*)[4]>(&Result[0].data)); 58 | return Result; 59 | } 60 | }; 61 | }//namespace detail 62 | 63 | template<> 64 | GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) 65 | { 66 | tmat4x4 m(uninitialize); 67 | glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); 68 | return m; 69 | } 70 | 71 | template<> 72 | GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) 73 | { 74 | tmat4x4 m(uninitialize); 75 | glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); 76 | return m; 77 | } 78 | 79 | template<> 80 | GLM_FUNC_QUALIFIER tmat4x4 outerProduct(tvec4 const & c, tvec4 const & r) 81 | { 82 | tmat4x4 m(uninitialize); 83 | glm_mat4_outerProduct(c.data, r.data, *reinterpret_cast<__m128(*)[4]>(&m[0].data)); 84 | return m; 85 | } 86 | }//namespace glm 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_packing_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wilbo/OpenGLTutorial/fcfa797bd51b688dcbc9995574651ea61550e06b/src/vendor/glm/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /src/vendor/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_vector_relational_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/precision.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm 9 | { 10 | enum precision 11 | { 12 | packed_highp, 13 | packed_mediump, 14 | packed_lowp, 15 | 16 | # if GLM_HAS_ALIGNED_TYPE 17 | aligned_highp, 18 | aligned_mediump, 19 | aligned_lowp, 20 | aligned = aligned_highp, 21 | # endif 22 | 23 | highp = packed_highp, 24 | mediump = packed_mediump, 25 | lowp = packed_lowp, 26 | packed = packed_highp, 27 | 28 | # if GLM_HAS_ALIGNED_TYPE && defined(GLM_FORCE_ALIGNED) 29 | defaultp = aligned_highp 30 | # else 31 | defaultp = highp 32 | # endif 33 | }; 34 | 35 | namespace detail 36 | { 37 | template 38 | struct is_aligned 39 | { 40 | static const bool value = false; 41 | }; 42 | 43 | # if GLM_HAS_ALIGNED_TYPE 44 | template<> 45 | struct is_aligned 46 | { 47 | static const bool value = true; 48 | }; 49 | 50 | template<> 51 | struct is_aligned 52 | { 53 | static const bool value = true; 54 | }; 55 | 56 | template<> 57 | struct is_aligned 58 | { 59 | static const bool value = true; 60 | }; 61 | # endif 62 | }//namespace detail 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/type_float.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_float.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | typedef float float32; 12 | typedef double float64; 13 | }//namespace detail 14 | 15 | typedef float lowp_float_t; 16 | typedef float mediump_float_t; 17 | typedef double highp_float_t; 18 | 19 | /// @addtogroup core_precision 20 | /// @{ 21 | 22 | /// Low precision floating-point numbers. 23 | /// There is no guarantee on the actual precision. 24 | /// 25 | /// @see GLSL 4.20.8 specification, section 4.1.4 Floats 26 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 27 | typedef lowp_float_t lowp_float; 28 | 29 | /// Medium precision floating-point numbers. 30 | /// There is no guarantee on the actual precision. 31 | /// 32 | /// @see GLSL 4.20.8 specification, section 4.1.4 Floats 33 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 34 | typedef mediump_float_t mediump_float; 35 | 36 | /// High precision floating-point numbers. 37 | /// There is no guarantee on the actual precision. 38 | /// 39 | /// @see GLSL 4.20.8 specification, section 4.1.4 Floats 40 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 41 | typedef highp_float_t highp_float; 42 | 43 | #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT)) 44 | typedef mediump_float float_t; 45 | #elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT)) 46 | typedef highp_float float_t; 47 | #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT)) 48 | typedef mediump_float float_t; 49 | #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT)) 50 | typedef lowp_float float_t; 51 | #else 52 | # error "GLM error: multiple default precision requested for floating-point types" 53 | #endif 54 | 55 | typedef float float32; 56 | typedef double float64; 57 | 58 | //////////////////// 59 | // check type sizes 60 | #ifndef GLM_STATIC_ASSERT_NULL 61 | GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform"); 62 | GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform"); 63 | #endif//GLM_STATIC_ASSERT_NULL 64 | 65 | /// @} 66 | 67 | }//namespace glm 68 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_half.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | typedef short hdata; 12 | 13 | GLM_FUNC_DECL float toFloat32(hdata value); 14 | GLM_FUNC_DECL hdata toFloat16(float const & value); 15 | 16 | }//namespace detail 17 | }//namespace glm 18 | 19 | #include "type_half.inl" 20 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat4x4_sse2.inl 3 | 4 | namespace glm 5 | { 6 | 7 | }//namespace glm 8 | -------------------------------------------------------------------------------- /src/vendor/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /src/vendor/glm/exponential.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/exponential.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_exponential.hpp" 7 | -------------------------------------------------------------------------------- /src/vendor/glm/geometric.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/geometric.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_geometric.hpp" 7 | -------------------------------------------------------------------------------- /src/vendor/glm/glm.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/glm.hpp 3 | /// 4 | /// @defgroup core GLM Core 5 | /// 6 | /// @brief The core of GLM, which implements exactly and only the GLSL specification to the degree possible. 7 | /// 8 | /// The GLM core consists of @ref core_types "C++ types that mirror GLSL types" and 9 | /// C++ functions that mirror the GLSL functions. It also includes 10 | /// @ref core_precision "a set of precision-based types" that can be used in the appropriate 11 | /// functions. The C++ types are all based on a basic set of @ref core_template "template types". 12 | /// 13 | /// The best documentation for GLM Core is the current GLSL specification, 14 | /// version 4.2 15 | /// (pdf file). 16 | /// 17 | /// GLM core functionnalities require to be included to be used. 18 | /// 19 | /// @defgroup core_types Types 20 | /// 21 | /// @brief The standard types defined by the specification. 22 | /// 23 | /// These types are all typedefs of more generalized, template types. To see the definition 24 | /// of these template types, go to @ref core_template. 25 | /// 26 | /// @ingroup core 27 | /// 28 | /// @defgroup core_precision Precision types 29 | /// 30 | /// @brief Non-GLSL types that are used to define precision-based types. 31 | /// 32 | /// The GLSL language allows the user to define the precision of a particular variable. 33 | /// In OpenGL's GLSL, these precision qualifiers have no effect; they are there for compatibility 34 | /// with OpenGL ES's precision qualifiers, where they @em do have an effect. 35 | /// 36 | /// C++ has no language equivalent to precision qualifiers. So GLM provides the next-best thing: 37 | /// a number of typedefs of the @ref core_template that use a particular precision. 38 | /// 39 | /// None of these types make any guarantees about the actual precision used. 40 | /// 41 | /// @ingroup core 42 | /// 43 | /// @defgroup core_template Template types 44 | /// 45 | /// @brief The generic template types used as the basis for the core types. 46 | /// 47 | /// These types are all templates used to define the actual @ref core_types. 48 | /// These templetes are implementation details of GLM types and should not be used explicitly. 49 | /// 50 | /// @ingroup core 51 | 52 | #include "detail/_fixes.hpp" 53 | 54 | #pragma once 55 | 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include "fwd.hpp" 62 | 63 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED) 64 | # define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED 65 | # pragma message("GLM: Core library included") 66 | #endif//GLM_MESSAGES 67 | 68 | #include "vec2.hpp" 69 | #include "vec3.hpp" 70 | #include "vec4.hpp" 71 | #include "mat2x2.hpp" 72 | #include "mat2x3.hpp" 73 | #include "mat2x4.hpp" 74 | #include "mat3x2.hpp" 75 | #include "mat3x3.hpp" 76 | #include "mat3x4.hpp" 77 | #include "mat4x2.hpp" 78 | #include "mat4x3.hpp" 79 | #include "mat4x4.hpp" 80 | 81 | #include "trigonometric.hpp" 82 | #include "exponential.hpp" 83 | #include "common.hpp" 84 | #include "packing.hpp" 85 | #include "geometric.hpp" 86 | #include "matrix.hpp" 87 | #include "vector_relational.hpp" 88 | #include "integer.hpp" 89 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/color_encoding.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_color_encoding 2 | /// @file glm/gtc/color_encoding.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 convertLinearSRGBToD65XYZ(tvec3 const& ColorLinearSRGB) 8 | { 9 | tvec3 const M(0.490f, 0.17697f, 0.2f); 10 | tvec3 const N(0.31f, 0.8124f, 0.01063f); 11 | tvec3 const O(0.490f, 0.01f, 0.99f); 12 | 13 | return (M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB) * static_cast(5.650675255693055f); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER tvec3 convertD65XYZToLinearSRGB(tvec3 const& ColorD65XYZ) 18 | { 19 | tvec3 const M(0.41847f, -0.091169f, 0.0009209f); 20 | tvec3 const N(-0.15866f, 0.25243f, 0.015708f); 21 | tvec3 const O(0.0009209f, -0.0025498f, 0.1786f); 22 | 23 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER tvec3 convertLinearSRGBToD50XYZ(tvec3 const& ColorLinearSRGB) 28 | { 29 | tvec3 const M(0.436030342570117f, 0.222438466210245f, 0.013897440074263f); 30 | tvec3 const N(0.385101860087134f, 0.716942745571917f, 0.097076381494207f); 31 | tvec3 const O(0.143067806654203f, 0.060618777416563f, 0.713926257896652f); 32 | 33 | return M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER tvec3 convertD50XYZToLinearSRGB(tvec3 const& ColorD50XYZ) 38 | { 39 | tvec3 const M(); 40 | tvec3 const N(); 41 | tvec3 const O(); 42 | 43 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 44 | } 45 | 46 | template 47 | GLM_FUNC_QUALIFIER tvec3 convertD65XYZToD50XYZ(tvec3 const& ColorD65XYZ) 48 | { 49 | tvec3 const M(+1.047844353856414f, +0.029549007606644f, -0.009250984365223f); 50 | tvec3 const N(+0.022898981050086f, +0.990508028941971f, +0.015072338237051f); 51 | tvec3 const O(-0.050206647741605f, -0.017074711360960f, +0.751717835079977f); 52 | 53 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER tvec3 convertD50XYZToD65XYZ(tvec3 const& ColorD50XYZ) 58 | { 59 | tvec3 const M(); 60 | tvec3 const N(); 61 | tvec3 const O(); 62 | 63 | return M * ColorD50XYZ + N * ColorD50XYZ + O * ColorD50XYZ; 64 | } 65 | }//namespace glm 66 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/color_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_color_space 2 | /// @file glm/gtc/color_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_color_space (dependence) 6 | /// 7 | /// @defgroup gtc_color_space GLM_GTC_color_space 8 | /// @ingroup gtc 9 | /// 10 | /// @brief Allow to perform bit operations on integer values 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/precision.hpp" 19 | #include "../exponential.hpp" 20 | #include "../vec3.hpp" 21 | #include "../vec4.hpp" 22 | #include 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTC_color_space extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtc_color_space 31 | /// @{ 32 | 33 | /// Convert a linear color to sRGB color using a standard gamma correction. 34 | /// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb 35 | template class vecType> 36 | GLM_FUNC_DECL vecType convertLinearToSRGB(vecType const & ColorLinear); 37 | 38 | /// Convert a linear color to sRGB color using a custom gamma correction. 39 | /// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb 40 | template class vecType> 41 | GLM_FUNC_DECL vecType convertLinearToSRGB(vecType const & ColorLinear, T Gamma); 42 | 43 | /// Convert a sRGB color to linear color using a standard gamma correction. 44 | /// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb 45 | template class vecType> 46 | GLM_FUNC_DECL vecType convertSRGBToLinear(vecType const & ColorSRGB); 47 | 48 | /// Convert a sRGB color to linear color using a custom gamma correction. 49 | // IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb 50 | template class vecType> 51 | GLM_FUNC_DECL vecType convertSRGBToLinear(vecType const & ColorSRGB, T Gamma); 52 | 53 | /// @} 54 | } //namespace glm 55 | 56 | #include "color_space.inl" 57 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/color_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_color_space 2 | /// @file glm/gtc/color_space.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | template class vecType> 8 | struct compute_rgbToSrgb 9 | { 10 | GLM_FUNC_QUALIFIER static vecType call(vecType const& ColorRGB, T GammaCorrection) 11 | { 12 | vecType const ClampedColor(clamp(ColorRGB, static_cast(0), static_cast(1))); 13 | 14 | return mix( 15 | pow(ClampedColor, vecType(GammaCorrection)) * static_cast(1.055) - static_cast(0.055), 16 | ClampedColor * static_cast(12.92), 17 | lessThan(ClampedColor, vecType(static_cast(0.0031308)))); 18 | } 19 | }; 20 | 21 | template 22 | struct compute_rgbToSrgb 23 | { 24 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& ColorRGB, T GammaCorrection) 25 | { 26 | return tvec4(compute_rgbToSrgb::call(tvec3(ColorRGB), GammaCorrection), ColorRGB.w); 27 | } 28 | }; 29 | 30 | template class vecType> 31 | struct compute_srgbToRgb 32 | { 33 | GLM_FUNC_QUALIFIER static vecType call(vecType const& ColorSRGB, T Gamma) 34 | { 35 | return mix( 36 | pow((ColorSRGB + static_cast(0.055)) * static_cast(0.94786729857819905213270142180095), vecType(Gamma)), 37 | ColorSRGB * static_cast(0.07739938080495356037151702786378), 38 | lessThanEqual(ColorSRGB, vecType(static_cast(0.04045)))); 39 | } 40 | }; 41 | 42 | template 43 | struct compute_srgbToRgb 44 | { 45 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& ColorSRGB, T Gamma) 46 | { 47 | return tvec4(compute_srgbToRgb::call(tvec3(ColorSRGB), Gamma), ColorSRGB.w); 48 | } 49 | }; 50 | }//namespace detail 51 | 52 | template class vecType> 53 | GLM_FUNC_QUALIFIER vecType convertLinearToSRGB(vecType const& ColorLinear) 54 | { 55 | return detail::compute_rgbToSrgb::call(ColorLinear, static_cast(0.41666)); 56 | } 57 | 58 | template class vecType> 59 | GLM_FUNC_QUALIFIER vecType convertLinearToSRGB(vecType const& ColorLinear, T Gamma) 60 | { 61 | return detail::compute_rgbToSrgb::call(ColorLinear, static_cast(1) / Gamma); 62 | } 63 | 64 | template class vecType> 65 | GLM_FUNC_QUALIFIER vecType convertSRGBToLinear(vecType const& ColorSRGB) 66 | { 67 | return detail::compute_srgbToRgb::call(ColorSRGB, static_cast(2.4)); 68 | } 69 | 70 | template class vecType> 71 | GLM_FUNC_QUALIFIER vecType convertSRGBToLinear(vecType const& ColorSRGB, T Gamma) 72 | { 73 | return detail::compute_srgbToRgb::call(ColorSRGB, Gamma); 74 | } 75 | }//namespace glm 76 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_epsilon 2 | /// @file glm/gtc/epsilon.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtc_quaternion (dependence) 7 | /// 8 | /// @defgroup gtc_epsilon GLM_GTC_epsilon 9 | /// @ingroup gtc 10 | /// 11 | /// @brief Comparison functions for a user defined epsilon values. 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/precision.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTC_epsilon extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtc_epsilon 28 | /// @{ 29 | 30 | /// Returns the component-wise comparison of |x - y| < epsilon. 31 | /// True if this expression is satisfied. 32 | /// 33 | /// @see gtc_epsilon 34 | template class vecType> 35 | GLM_FUNC_DECL vecType epsilonEqual( 36 | vecType const & x, 37 | vecType const & y, 38 | T const & epsilon); 39 | 40 | /// Returns the component-wise comparison of |x - y| < epsilon. 41 | /// True if this expression is satisfied. 42 | /// 43 | /// @see gtc_epsilon 44 | template 45 | GLM_FUNC_DECL bool epsilonEqual( 46 | genType const & x, 47 | genType const & y, 48 | genType const & epsilon); 49 | 50 | /// Returns the component-wise comparison of |x - y| < epsilon. 51 | /// True if this expression is not satisfied. 52 | /// 53 | /// @see gtc_epsilon 54 | template 55 | GLM_FUNC_DECL typename genType::boolType epsilonNotEqual( 56 | genType const & x, 57 | genType const & y, 58 | typename genType::value_type const & epsilon); 59 | 60 | /// Returns the component-wise comparison of |x - y| >= epsilon. 61 | /// True if this expression is not satisfied. 62 | /// 63 | /// @see gtc_epsilon 64 | template 65 | GLM_FUNC_DECL bool epsilonNotEqual( 66 | genType const & x, 67 | genType const & y, 68 | genType const & epsilon); 69 | 70 | /// @} 71 | }//namespace glm 72 | 73 | #include "epsilon.inl" 74 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/epsilon.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_epsilon 2 | /// @file glm/gtc/epsilon.inl 3 | 4 | // Dependency: 5 | #include "quaternion.hpp" 6 | #include "../vector_relational.hpp" 7 | #include "../common.hpp" 8 | #include "../vec2.hpp" 9 | #include "../vec3.hpp" 10 | #include "../vec4.hpp" 11 | 12 | namespace glm 13 | { 14 | template <> 15 | GLM_FUNC_QUALIFIER bool epsilonEqual 16 | ( 17 | float const & x, 18 | float const & y, 19 | float const & epsilon 20 | ) 21 | { 22 | return abs(x - y) < epsilon; 23 | } 24 | 25 | template <> 26 | GLM_FUNC_QUALIFIER bool epsilonEqual 27 | ( 28 | double const & x, 29 | double const & y, 30 | double const & epsilon 31 | ) 32 | { 33 | return abs(x - y) < epsilon; 34 | } 35 | 36 | template <> 37 | GLM_FUNC_QUALIFIER bool epsilonNotEqual 38 | ( 39 | float const & x, 40 | float const & y, 41 | float const & epsilon 42 | ) 43 | { 44 | return abs(x - y) >= epsilon; 45 | } 46 | 47 | template <> 48 | GLM_FUNC_QUALIFIER bool epsilonNotEqual 49 | ( 50 | double const & x, 51 | double const & y, 52 | double const & epsilon 53 | ) 54 | { 55 | return abs(x - y) >= epsilon; 56 | } 57 | 58 | template class vecType> 59 | GLM_FUNC_QUALIFIER vecType epsilonEqual 60 | ( 61 | vecType const & x, 62 | vecType const & y, 63 | T const & epsilon 64 | ) 65 | { 66 | return lessThan(abs(x - y), vecType(epsilon)); 67 | } 68 | 69 | template class vecType> 70 | GLM_FUNC_QUALIFIER vecType epsilonEqual 71 | ( 72 | vecType const & x, 73 | vecType const & y, 74 | vecType const & epsilon 75 | ) 76 | { 77 | return lessThan(abs(x - y), vecType(epsilon)); 78 | } 79 | 80 | template class vecType> 81 | GLM_FUNC_QUALIFIER vecType epsilonNotEqual 82 | ( 83 | vecType const & x, 84 | vecType const & y, 85 | T const & epsilon 86 | ) 87 | { 88 | return greaterThanEqual(abs(x - y), vecType(epsilon)); 89 | } 90 | 91 | template class vecType> 92 | GLM_FUNC_QUALIFIER vecType epsilonNotEqual 93 | ( 94 | vecType const & x, 95 | vecType const & y, 96 | vecType const & epsilon 97 | ) 98 | { 99 | return greaterThanEqual(abs(x - y), vecType(epsilon)); 100 | } 101 | 102 | template 103 | GLM_FUNC_QUALIFIER tvec4 epsilonEqual 104 | ( 105 | tquat const & x, 106 | tquat const & y, 107 | T const & epsilon 108 | ) 109 | { 110 | tvec4 v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 111 | return lessThan(abs(v), tvec4(epsilon)); 112 | } 113 | 114 | template 115 | GLM_FUNC_QUALIFIER tvec4 epsilonNotEqual 116 | ( 117 | tquat const & x, 118 | tquat const & y, 119 | T const & epsilon 120 | ) 121 | { 122 | tvec4 v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 123 | return greaterThanEqual(abs(v), tvec4(epsilon)); 124 | } 125 | }//namespace glm 126 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/functions.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_functions 2 | /// @file glm/gtc/functions.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtc_quaternion (dependence) 7 | /// 8 | /// @defgroup gtc_functions GLM_GTC_functions 9 | /// @ingroup gtc 10 | /// 11 | /// @brief List of useful common functions. 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/precision.hpp" 20 | #include "../detail/type_vec2.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_functions extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtc_functions 29 | /// @{ 30 | 31 | /// 1D gauss function 32 | /// 33 | /// @see gtc_epsilon 34 | template 35 | GLM_FUNC_DECL T gauss( 36 | T x, 37 | T ExpectedValue, 38 | T StandardDeviation); 39 | 40 | /// 2D gauss function 41 | /// 42 | /// @see gtc_epsilon 43 | template 44 | GLM_FUNC_DECL T gauss( 45 | tvec2 const& Coord, 46 | tvec2 const& ExpectedValue, 47 | tvec2 const& StandardDeviation); 48 | 49 | /// @} 50 | }//namespace glm 51 | 52 | #include "functions.inl" 53 | 54 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_functions 2 | /// @file glm/gtc/functions.inl 3 | 4 | #include "../detail/func_exponential.hpp" 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER T gauss 10 | ( 11 | T x, 12 | T ExpectedValue, 13 | T StandardDeviation 14 | ) 15 | { 16 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER T gauss 21 | ( 22 | tvec2 const& Coord, 23 | tvec2 const& ExpectedValue, 24 | tvec2 const& StandardDeviation 25 | ) 26 | { 27 | tvec2 const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 28 | return exp(-(Squared.x + Squared.y)); 29 | } 30 | }//namespace glm 31 | 32 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/integer.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_integer 2 | /// @file glm/gtc/integer.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | template class vecType, bool Aligned> 8 | struct compute_log2 9 | { 10 | GLM_FUNC_QUALIFIER static vecType call(vecType const & vec) 11 | { 12 | //Equivalent to return findMSB(vec); but save one function call in ASM with VC 13 | //return findMSB(vec); 14 | return vecType(detail::compute_findMSB_vec::call(vec)); 15 | } 16 | }; 17 | 18 | # if GLM_HAS_BITSCAN_WINDOWS 19 | template 20 | struct compute_log2 21 | { 22 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & vec) 23 | { 24 | tvec4 Result(glm::uninitialize); 25 | 26 | _BitScanReverse(reinterpret_cast(&Result.x), vec.x); 27 | _BitScanReverse(reinterpret_cast(&Result.y), vec.y); 28 | _BitScanReverse(reinterpret_cast(&Result.z), vec.z); 29 | _BitScanReverse(reinterpret_cast(&Result.w), vec.w); 30 | 31 | return Result; 32 | } 33 | }; 34 | # endif//GLM_HAS_BITSCAN_WINDOWS 35 | }//namespace detail 36 | template 37 | GLM_FUNC_QUALIFIER int iround(genType x) 38 | { 39 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'iround' only accept floating-point inputs"); 40 | assert(static_cast(0.0) <= x); 41 | 42 | return static_cast(x + static_cast(0.5)); 43 | } 44 | 45 | template class vecType> 46 | GLM_FUNC_QUALIFIER vecType iround(vecType const& x) 47 | { 48 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'iround' only accept floating-point inputs"); 49 | assert(all(lessThanEqual(vecType(0), x))); 50 | 51 | return vecType(x + static_cast(0.5)); 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER uint uround(genType x) 56 | { 57 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'uround' only accept floating-point inputs"); 58 | assert(static_cast(0.0) <= x); 59 | 60 | return static_cast(x + static_cast(0.5)); 61 | } 62 | 63 | template class vecType> 64 | GLM_FUNC_QUALIFIER vecType uround(vecType const& x) 65 | { 66 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'uround' only accept floating-point inputs"); 67 | assert(all(lessThanEqual(vecType(0), x))); 68 | 69 | return vecType(x + static_cast(0.5)); 70 | } 71 | }//namespace glm 72 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/matrix_access.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_access GLM_GTC_matrix_access 7 | /// @ingroup gtc 8 | /// 9 | /// Defines functions to access rows or columns of a matrix easily. 10 | /// need to be included to use these functionalities. 11 | 12 | #pragma once 13 | 14 | // Dependency: 15 | #include "../detail/setup.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_GTC_matrix_access extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup gtc_matrix_access 24 | /// @{ 25 | 26 | /// Get a specific row of a matrix. 27 | /// @see gtc_matrix_access 28 | template 29 | GLM_FUNC_DECL typename genType::row_type row( 30 | genType const & m, 31 | length_t index); 32 | 33 | /// Set a specific row to a matrix. 34 | /// @see gtc_matrix_access 35 | template 36 | GLM_FUNC_DECL genType row( 37 | genType const & m, 38 | length_t index, 39 | typename genType::row_type const & x); 40 | 41 | /// Get a specific column of a matrix. 42 | /// @see gtc_matrix_access 43 | template 44 | GLM_FUNC_DECL typename genType::col_type column( 45 | genType const & m, 46 | length_t index); 47 | 48 | /// Set a specific column to a matrix. 49 | /// @see gtc_matrix_access 50 | template 51 | GLM_FUNC_DECL genType column( 52 | genType const & m, 53 | length_t index, 54 | typename genType::col_type const & x); 55 | 56 | /// @} 57 | }//namespace glm 58 | 59 | #include "matrix_access.inl" 60 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType row 8 | ( 9 | genType const & m, 10 | length_t index, 11 | typename genType::row_type const & x 12 | ) 13 | { 14 | assert(index >= 0 && index < m[0].length()); 15 | 16 | genType Result = m; 17 | for(length_t i = 0; i < m.length(); ++i) 18 | Result[i][index] = x[i]; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER typename genType::row_type row 24 | ( 25 | genType const & m, 26 | length_t index 27 | ) 28 | { 29 | assert(index >= 0 && index < m[0].length()); 30 | 31 | typename genType::row_type Result; 32 | for(length_t i = 0; i < m.length(); ++i) 33 | Result[i] = m[i][index]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER genType column 39 | ( 40 | genType const & m, 41 | length_t index, 42 | typename genType::col_type const & x 43 | ) 44 | { 45 | assert(index >= 0 && index < m.length()); 46 | 47 | genType Result = m; 48 | Result[index] = x; 49 | return Result; 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER typename genType::col_type column 54 | ( 55 | genType const & m, 56 | length_t index 57 | ) 58 | { 59 | assert(index >= 0 && index < m.length()); 60 | 61 | return m[index]; 62 | } 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/matrix_inverse.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_inverse 2 | /// @file glm/gtc/matrix_inverse.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse 7 | /// @ingroup gtc 8 | /// 9 | /// Defines additional matrix inverting functions. 10 | /// need to be included to use these functionalities. 11 | 12 | #pragma once 13 | 14 | // Dependencies 15 | #include "../detail/setup.hpp" 16 | #include "../matrix.hpp" 17 | #include "../mat2x2.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../mat4x4.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTC_matrix_inverse extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtc_matrix_inverse 28 | /// @{ 29 | 30 | /// Fast matrix inverse for affine matrix. 31 | /// 32 | /// @param m Input matrix to invert. 33 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 34 | /// @see gtc_matrix_inverse 35 | template 36 | GLM_FUNC_DECL genType affineInverse(genType const & m); 37 | 38 | /// Compute the inverse transpose of a matrix. 39 | /// 40 | /// @param m Input matrix to invert transpose. 41 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 42 | /// @see gtc_matrix_inverse 43 | template 44 | GLM_FUNC_DECL genType inverseTranspose(genType const & m); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "matrix_inverse.inl" 50 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/noise.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_noise 2 | /// @file glm/gtc/noise.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_noise GLM_GTC_noise 7 | /// @ingroup gtc 8 | /// 9 | /// Defines 2D, 3D and 4D procedural noise functions 10 | /// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 11 | /// https://github.com/ashima/webgl-noise 12 | /// Following Stefan Gustavson's paper "Simplex noise demystified": 13 | /// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 14 | /// need to be included to use these functionalities. 15 | 16 | #pragma once 17 | 18 | // Dependencies 19 | #include "../detail/setup.hpp" 20 | #include "../detail/precision.hpp" 21 | #include "../detail/_noise.hpp" 22 | #include "../geometric.hpp" 23 | #include "../common.hpp" 24 | #include "../vector_relational.hpp" 25 | #include "../vec2.hpp" 26 | #include "../vec3.hpp" 27 | #include "../vec4.hpp" 28 | 29 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 30 | # pragma message("GLM: GLM_GTC_noise extension included") 31 | #endif 32 | 33 | namespace glm 34 | { 35 | /// @addtogroup gtc_noise 36 | /// @{ 37 | 38 | /// Classic perlin noise. 39 | /// @see gtc_noise 40 | template class vecType> 41 | GLM_FUNC_DECL T perlin( 42 | vecType const & p); 43 | 44 | /// Periodic perlin noise. 45 | /// @see gtc_noise 46 | template class vecType> 47 | GLM_FUNC_DECL T perlin( 48 | vecType const & p, 49 | vecType const & rep); 50 | 51 | /// Simplex noise. 52 | /// @see gtc_noise 53 | template class vecType> 54 | GLM_FUNC_DECL T simplex( 55 | vecType const & p); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "noise.inl" 61 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/random.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_random 2 | /// @file glm/gtc/random.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtx_random (extended) 7 | /// 8 | /// @defgroup gtc_random GLM_GTC_random 9 | /// @ingroup gtc 10 | /// 11 | /// @brief Generate random number from various distribution methods. 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../vec2.hpp" 19 | #include "../vec3.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTC_random extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtc_random 28 | /// @{ 29 | 30 | /// Generate random numbers in the interval [Min, Max], according a linear distribution 31 | /// 32 | /// @param Min 33 | /// @param Max 34 | /// @tparam genType Value type. Currently supported: float or double scalars. 35 | /// @see gtc_random 36 | template 37 | GLM_FUNC_DECL genTYpe linearRand( 38 | genTYpe Min, 39 | genTYpe Max); 40 | 41 | /// Generate random numbers in the interval [Min, Max], according a linear distribution 42 | /// 43 | /// @param Min 44 | /// @param Max 45 | /// @tparam T Value type. Currently supported: float or double. 46 | /// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible 47 | /// @see gtc_random 48 | template class vecType> 49 | GLM_FUNC_DECL vecType linearRand( 50 | vecType const & Min, 51 | vecType const & Max); 52 | 53 | /// Generate random numbers in the interval [Min, Max], according a gaussian distribution 54 | /// 55 | /// @param Mean 56 | /// @param Deviation 57 | /// @see gtc_random 58 | template 59 | GLM_FUNC_DECL genType gaussRand( 60 | genType Mean, 61 | genType Deviation); 62 | 63 | /// Generate a random 2D vector which coordinates are regulary distributed on a circle of a given radius 64 | /// 65 | /// @param Radius 66 | /// @see gtc_random 67 | template 68 | GLM_FUNC_DECL tvec2 circularRand( 69 | T Radius); 70 | 71 | /// Generate a random 3D vector which coordinates are regulary distributed on a sphere of a given radius 72 | /// 73 | /// @param Radius 74 | /// @see gtc_random 75 | template 76 | GLM_FUNC_DECL tvec3 sphericalRand( 77 | T Radius); 78 | 79 | /// Generate a random 2D vector which coordinates are regulary distributed within the area of a disk of a given radius 80 | /// 81 | /// @param Radius 82 | /// @see gtc_random 83 | template 84 | GLM_FUNC_DECL tvec2 diskRand( 85 | T Radius); 86 | 87 | /// Generate a random 3D vector which coordinates are regulary distributed within the volume of a ball of a given radius 88 | /// 89 | /// @param Radius 90 | /// @see gtc_random 91 | template 92 | GLM_FUNC_DECL tvec3 ballRand( 93 | T Radius); 94 | 95 | /// @} 96 | }//namespace glm 97 | 98 | #include "random.inl" 99 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/ulp.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_ulp 2 | /// @file glm/gtc/ulp.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_ulp GLM_GTC_ulp 7 | /// @ingroup gtc 8 | /// 9 | /// @brief Allow the measurement of the accuracy of a function against a reference 10 | /// implementation. This extension works on floating-point data and provide results 11 | /// in ULP. 12 | /// need to be included to use these features. 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/precision.hpp" 19 | #include "../detail/type_int.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTC_ulp extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtc_ulp 28 | /// @{ 29 | 30 | /// Return the next ULP value(s) after the input value(s). 31 | /// @see gtc_ulp 32 | template 33 | GLM_FUNC_DECL genType next_float(genType const & x); 34 | 35 | /// Return the previous ULP value(s) before the input value(s). 36 | /// @see gtc_ulp 37 | template 38 | GLM_FUNC_DECL genType prev_float(genType const & x); 39 | 40 | /// Return the value(s) ULP distance after the input value(s). 41 | /// @see gtc_ulp 42 | template 43 | GLM_FUNC_DECL genType next_float(genType const & x, uint const & Distance); 44 | 45 | /// Return the value(s) ULP distance before the input value(s). 46 | /// @see gtc_ulp 47 | template 48 | GLM_FUNC_DECL genType prev_float(genType const & x, uint const & Distance); 49 | 50 | /// Return the distance in the number of ULP between 2 scalars. 51 | /// @see gtc_ulp 52 | template 53 | GLM_FUNC_DECL uint float_distance(T const & x, T const & y); 54 | 55 | /// Return the distance in the number of ULP between 2 vectors. 56 | /// @see gtc_ulp 57 | template class vecType> 58 | GLM_FUNC_DECL vecType float_distance(vecType const & x, vecType const & y); 59 | 60 | /// @} 61 | }// namespace glm 62 | 63 | #include "ulp.inl" 64 | -------------------------------------------------------------------------------- /src/vendor/glm/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/bit.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_bit 2 | /// @file glm/gtx/bit.inl 3 | 4 | namespace glm 5 | { 6 | /////////////////// 7 | // highestBitValue 8 | 9 | template 10 | GLM_FUNC_QUALIFIER genIUType highestBitValue(genIUType Value) 11 | { 12 | genIUType tmp = Value; 13 | genIUType result = genIUType(0); 14 | while(tmp) 15 | { 16 | result = (tmp & (~tmp + 1)); // grab lowest bit 17 | tmp &= ~result; // clear lowest bit 18 | } 19 | return result; 20 | } 21 | 22 | template class vecType> 23 | GLM_FUNC_QUALIFIER vecType highestBitValue(vecType const & v) 24 | { 25 | return detail::functor1::call(highestBitValue, v); 26 | } 27 | 28 | /////////////////// 29 | // lowestBitValue 30 | 31 | template 32 | GLM_FUNC_QUALIFIER genIUType lowestBitValue(genIUType Value) 33 | { 34 | return (Value & (~Value + 1)); 35 | } 36 | 37 | template class vecType> 38 | GLM_FUNC_QUALIFIER vecType lowestBitValue(vecType const & v) 39 | { 40 | return detail::functor1::call(lowestBitValue, v); 41 | } 42 | 43 | /////////////////// 44 | // powerOfTwoAbove 45 | 46 | template 47 | GLM_FUNC_QUALIFIER genType powerOfTwoAbove(genType value) 48 | { 49 | return isPowerOfTwo(value) ? value : highestBitValue(value) << 1; 50 | } 51 | 52 | template class vecType> 53 | GLM_FUNC_QUALIFIER vecType powerOfTwoAbove(vecType const & v) 54 | { 55 | return detail::functor1::call(powerOfTwoAbove, v); 56 | } 57 | 58 | /////////////////// 59 | // powerOfTwoBelow 60 | 61 | template 62 | GLM_FUNC_QUALIFIER genType powerOfTwoBelow(genType value) 63 | { 64 | return isPowerOfTwo(value) ? value : highestBitValue(value); 65 | } 66 | 67 | template class vecType> 68 | GLM_FUNC_QUALIFIER vecType powerOfTwoBelow(vecType const & v) 69 | { 70 | return detail::functor1::call(powerOfTwoBelow, v); 71 | } 72 | 73 | ///////////////////// 74 | // powerOfTwoNearest 75 | 76 | template 77 | GLM_FUNC_QUALIFIER genType powerOfTwoNearest(genType value) 78 | { 79 | if(isPowerOfTwo(value)) 80 | return value; 81 | 82 | genType const prev = highestBitValue(value); 83 | genType const next = prev << 1; 84 | return (next - value) < (value - prev) ? next : prev; 85 | } 86 | 87 | template class vecType> 88 | GLM_FUNC_QUALIFIER vecType powerOfTwoNearest(vecType const & v) 89 | { 90 | return detail::functor1::call(powerOfTwoNearest, v); 91 | } 92 | 93 | }//namespace glm 94 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Find the point on a straight line which is the closet of a point. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_closest_point extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_closest_point 25 | /// @{ 26 | 27 | /// Find the point on a straight line which is the closet of a point. 28 | /// @see gtx_closest_point 29 | template 30 | GLM_FUNC_DECL tvec3 closestPointOnLine( 31 | tvec3 const & point, 32 | tvec3 const & a, 33 | tvec3 const & b); 34 | 35 | /// 2d lines work as well 36 | template 37 | GLM_FUNC_DECL tvec2 closestPointOnLine( 38 | tvec2 const & point, 39 | tvec2 const & a, 40 | tvec2 const & b); 41 | 42 | /// @} 43 | }// namespace glm 44 | 45 | #include "closest_point.inl" 46 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 closestPointOnLine 8 | ( 9 | tvec3 const & point, 10 | tvec3 const & a, 11 | tvec3 const & b 12 | ) 13 | { 14 | T LineLength = distance(a, b); 15 | tvec3 Vector = point - a; 16 | tvec3 LineDirection = (b - a) / LineLength; 17 | 18 | // Project Vector to LineDirection to get the distance of point from a 19 | T Distance = dot(Vector, LineDirection); 20 | 21 | if(Distance <= T(0)) return a; 22 | if(Distance >= LineLength) return b; 23 | return a + LineDirection * Distance; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER tvec2 closestPointOnLine 28 | ( 29 | tvec2 const & point, 30 | tvec2 const & a, 31 | tvec2 const & b 32 | ) 33 | { 34 | T LineLength = distance(a, b); 35 | tvec2 Vector = point - a; 36 | tvec2 LineDirection = (b - a) / LineLength; 37 | 38 | // Project Vector to LineDirection to get the distance of point from a 39 | T Distance = dot(Vector, LineDirection); 40 | 41 | if(Distance <= T(0)) return a; 42 | if(Distance >= LineLength) return b; 43 | return a + LineDirection * Distance; 44 | } 45 | 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/color_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_space 2 | /// @file glm/gtx/color_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_color_space GLM_GTX_color_space 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Related to RGB to HSV conversions and operations. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_color_space extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_color_space 25 | /// @{ 26 | 27 | /// Converts a color from HSV color space to its color in RGB color space. 28 | /// @see gtx_color_space 29 | template 30 | GLM_FUNC_DECL tvec3 rgbColor( 31 | tvec3 const & hsvValue); 32 | 33 | /// Converts a color from RGB color space to its color in HSV color space. 34 | /// @see gtx_color_space 35 | template 36 | GLM_FUNC_DECL tvec3 hsvColor( 37 | tvec3 const & rgbValue); 38 | 39 | /// Build a saturation matrix. 40 | /// @see gtx_color_space 41 | template 42 | GLM_FUNC_DECL tmat4x4 saturation( 43 | T const s); 44 | 45 | /// Modify the saturation of a color. 46 | /// @see gtx_color_space 47 | template 48 | GLM_FUNC_DECL tvec3 saturation( 49 | T const s, 50 | tvec3 const & color); 51 | 52 | /// Modify the saturation of a color. 53 | /// @see gtx_color_space 54 | template 55 | GLM_FUNC_DECL tvec4 saturation( 56 | T const s, 57 | tvec4 const & color); 58 | 59 | /// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals. 60 | /// @see gtx_color_space 61 | template 62 | GLM_FUNC_DECL T luminosity( 63 | tvec3 const & color); 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "color_space.inl" 69 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/color_space_YCoCg.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_space_YCoCg 2 | /// @file glm/gtx/color_space_YCoCg.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_color_space_YCoCg GLM_GTX_color_space_YCoCg 7 | /// @ingroup gtx 8 | /// 9 | /// @brief RGB to YCoCg conversions and operations 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_color_space_YCoCg extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_color_space_YCoCg 25 | /// @{ 26 | 27 | /// Convert a color from RGB color space to YCoCg color space. 28 | /// @see gtx_color_space_YCoCg 29 | template 30 | GLM_FUNC_DECL tvec3 rgb2YCoCg( 31 | tvec3 const & rgbColor); 32 | 33 | /// Convert a color from YCoCg color space to RGB color space. 34 | /// @see gtx_color_space_YCoCg 35 | template 36 | GLM_FUNC_DECL tvec3 YCoCg2rgb( 37 | tvec3 const & YCoCgColor); 38 | 39 | /// Convert a color from RGB color space to YCoCgR color space. 40 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 41 | /// @see gtx_color_space_YCoCg 42 | template 43 | GLM_FUNC_DECL tvec3 rgb2YCoCgR( 44 | tvec3 const & rgbColor); 45 | 46 | /// Convert a color from YCoCgR color space to RGB color space. 47 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 48 | /// @see gtx_color_space_YCoCg 49 | template 50 | GLM_FUNC_DECL tvec3 YCoCgR2rgb( 51 | tvec3 const & YCoCgColor); 52 | 53 | /// @} 54 | }//namespace glm 55 | 56 | #include "color_space_YCoCg.inl" 57 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/color_space_YCoCg.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_space_YCoCg 2 | /// @file glm/gtx/color_space_YCoCg.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 rgb2YCoCg 8 | ( 9 | tvec3 const & rgbColor 10 | ) 11 | { 12 | tvec3 result; 13 | result.x/*Y */ = rgbColor.r / T(4) + rgbColor.g / T(2) + rgbColor.b / T(4); 14 | result.y/*Co*/ = rgbColor.r / T(2) + rgbColor.g * T(0) - rgbColor.b / T(2); 15 | result.z/*Cg*/ = - rgbColor.r / T(4) + rgbColor.g / T(2) - rgbColor.b / T(4); 16 | return result; 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER tvec3 YCoCg2rgb 21 | ( 22 | tvec3 const & YCoCgColor 23 | ) 24 | { 25 | tvec3 result; 26 | result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z; 27 | result.g = YCoCgColor.x + YCoCgColor.z; 28 | result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z; 29 | return result; 30 | } 31 | 32 | template 33 | class compute_YCoCgR { 34 | public: 35 | static GLM_FUNC_QUALIFIER tvec3 rgb2YCoCgR 36 | ( 37 | tvec3 const & rgbColor 38 | ) 39 | { 40 | tvec3 result; 41 | result.x/*Y */ = rgbColor.g / T(2) + (rgbColor.r + rgbColor.b) / T(4); 42 | result.y/*Co*/ = rgbColor.r - rgbColor.b; 43 | result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / T(2); 44 | return result; 45 | } 46 | 47 | static GLM_FUNC_QUALIFIER tvec3 YCoCgR2rgb 48 | ( 49 | tvec3 const & YCoCgRColor 50 | ) 51 | { 52 | tvec3 result; 53 | T tmp = YCoCgRColor.x - (YCoCgRColor.z / T(2)); 54 | result.g = YCoCgRColor.z + tmp; 55 | result.b = tmp - (YCoCgRColor.y / T(2)); 56 | result.r = result.b + YCoCgRColor.y; 57 | return result; 58 | } 59 | }; 60 | 61 | template 62 | class compute_YCoCgR { 63 | public: 64 | static GLM_FUNC_QUALIFIER tvec3 rgb2YCoCgR 65 | ( 66 | tvec3 const & rgbColor 67 | ) 68 | { 69 | tvec3 result; 70 | result.y/*Co*/ = rgbColor.r - rgbColor.b; 71 | T tmp = rgbColor.b + (result.y >> 1); 72 | result.z/*Cg*/ = rgbColor.g - tmp; 73 | result.x/*Y */ = tmp + (result.z >> 1); 74 | return result; 75 | } 76 | 77 | static GLM_FUNC_QUALIFIER tvec3 YCoCgR2rgb 78 | ( 79 | tvec3 const & YCoCgRColor 80 | ) 81 | { 82 | tvec3 result; 83 | T tmp = YCoCgRColor.x - (YCoCgRColor.z >> 1); 84 | result.g = YCoCgRColor.z + tmp; 85 | result.b = tmp - (YCoCgRColor.y >> 1); 86 | result.r = result.b + YCoCgRColor.y; 87 | return result; 88 | } 89 | }; 90 | 91 | template 92 | GLM_FUNC_QUALIFIER tvec3 rgb2YCoCgR 93 | ( 94 | tvec3 const & rgbColor 95 | ) 96 | { 97 | return compute_YCoCgR::is_integer>::rgb2YCoCgR(rgbColor); 98 | } 99 | 100 | template 101 | GLM_FUNC_QUALIFIER tvec3 YCoCgR2rgb 102 | ( 103 | tvec3 const & YCoCgRColor 104 | ) 105 | { 106 | return compute_YCoCgR::is_integer>::YCoCgR2rgb(YCoCgRColor); 107 | } 108 | }//namespace glm 109 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_common 2 | /// @file glm/gtx/common.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// 7 | /// @defgroup gtx_common GLM_GTX_common 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Provide functions to increase the compatibility with Cg and HLSL languages 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependencies: 17 | #include "../vec2.hpp" 18 | #include "../vec3.hpp" 19 | #include "../vec4.hpp" 20 | #include "../gtc/vec1.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_common extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_common 29 | /// @{ 30 | 31 | /// Returns true if x is a denormalized number 32 | /// Numbers whose absolute value is too small to be represented in the normal format are represented in an alternate, denormalized format. 33 | /// This format is less precise but can represent values closer to zero. 34 | /// 35 | /// @tparam genType Floating-point scalar or vector types. 36 | /// 37 | /// @see GLSL isnan man page 38 | /// @see GLSL 4.20.8 specification, section 8.3 Common Functions 39 | template 40 | GLM_FUNC_DECL typename genType::bool_type isdenormal(genType const & x); 41 | 42 | /// Similar to 'mod' but with a different rounding and integer support. 43 | /// Returns 'x - y * trunc(x/y)' instead of 'x - y * floor(x/y)' 44 | /// 45 | /// @see GLSL mod vs HLSL fmod 46 | /// @see GLSL mod man page 47 | template class vecType> 48 | GLM_FUNC_DECL vecType fmod(vecType const & v); 49 | 50 | /// @} 51 | }//namespace glm 52 | 53 | #include "common.inl" 54 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_compatibility 2 | /// @file glm/gtx/compatibility.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | // isfinite 9 | template 10 | GLM_FUNC_QUALIFIER bool isfinite( 11 | genType const & x) 12 | { 13 | # if GLM_HAS_CXX11_STL 14 | return std::isfinite(x) != 0; 15 | # elif GLM_COMPILER & GLM_COMPILER_VC 16 | return _finite(x); 17 | # elif GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID 18 | return _isfinite(x) != 0; 19 | # else 20 | if (std::numeric_limits::is_integer || std::denorm_absent == std::numeric_limits::has_denorm) 21 | return std::numeric_limits::min() <= x && std::numeric_limits::max() >= x; 22 | else 23 | return -std::numeric_limits::max() <= x && std::numeric_limits::max() >= x; 24 | # endif 25 | } 26 | 27 | template 28 | GLM_FUNC_QUALIFIER tvec1 isfinite( 29 | tvec1 const & x) 30 | { 31 | return tvec1( 32 | isfinite(x.x)); 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER tvec2 isfinite( 37 | tvec2 const & x) 38 | { 39 | return tvec2( 40 | isfinite(x.x), 41 | isfinite(x.y)); 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER tvec3 isfinite( 46 | tvec3 const & x) 47 | { 48 | return tvec3( 49 | isfinite(x.x), 50 | isfinite(x.y), 51 | isfinite(x.z)); 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER tvec4 isfinite( 56 | tvec4 const & x) 57 | { 58 | return tvec4( 59 | isfinite(x.x), 60 | isfinite(x.y), 61 | isfinite(x.z), 62 | isfinite(x.w)); 63 | } 64 | 65 | }//namespace glm 66 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/component_wise.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_component_wise 2 | /// @file glm/gtx/component_wise.hpp 3 | /// @date 2007-05-21 / 2011-06-07 4 | /// @author Christophe Riccio 5 | /// 6 | /// @see core (dependence) 7 | /// 8 | /// @defgroup gtx_component_wise GLM_GTX_component_wise 9 | /// @ingroup gtx 10 | /// 11 | /// @brief Operations between components of a type 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/precision.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_component_wise extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_component_wise 28 | /// @{ 29 | 30 | /// Convert an integer vector to a normalized float vector. 31 | /// If the parameter value type is already a floating precision type, the value is passed through. 32 | /// @see gtx_component_wise 33 | template class vecType> 34 | GLM_FUNC_DECL vecType compNormalize(vecType const & v); 35 | 36 | /// Convert a normalized float vector to an integer vector. 37 | /// If the parameter value type is already a floating precision type, the value is passed through. 38 | /// @see gtx_component_wise 39 | template class vecType> 40 | GLM_FUNC_DECL vecType compScale(vecType const & v); 41 | 42 | /// Add all vector components together. 43 | /// @see gtx_component_wise 44 | template 45 | GLM_FUNC_DECL typename genType::value_type compAdd(genType const & v); 46 | 47 | /// Multiply all vector components together. 48 | /// @see gtx_component_wise 49 | template 50 | GLM_FUNC_DECL typename genType::value_type compMul(genType const & v); 51 | 52 | /// Find the minimum value between single vector components. 53 | /// @see gtx_component_wise 54 | template 55 | GLM_FUNC_DECL typename genType::value_type compMin(genType const & v); 56 | 57 | /// Find the maximum value between single vector components. 58 | /// @see gtx_component_wise 59 | template 60 | GLM_FUNC_DECL typename genType::value_type compMax(genType const & v); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "component_wise.inl" 66 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_extend GLM_GTX_extend 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Extend a position from a source to a position at a defined length. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_extend extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_extend 25 | /// @{ 26 | 27 | /// Extends of Length the Origin position using the (Source - Origin) direction. 28 | /// @see gtx_extend 29 | template 30 | GLM_FUNC_DECL genType extend( 31 | genType const & Origin, 32 | genType const & Source, 33 | typename genType::value_type const Length); 34 | 35 | /// @} 36 | }//namespace glm 37 | 38 | #include "extend.inl" 39 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType extend 8 | ( 9 | genType const & Origin, 10 | genType const & Source, 11 | genType const & Distance 12 | ) 13 | { 14 | return Origin + (Source - Origin) * Distance; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER tvec2 extend 19 | ( 20 | tvec2 const & Origin, 21 | tvec2 const & Source, 22 | T const & Distance 23 | ) 24 | { 25 | return Origin + (Source - Origin) * Distance; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER tvec3 extend 30 | ( 31 | tvec3 const & Origin, 32 | tvec3 const & Source, 33 | T const & Distance 34 | ) 35 | { 36 | return Origin + (Source - Origin) * Distance; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER tvec4 extend 41 | ( 42 | tvec4 const & Origin, 43 | tvec4 const & Source, 44 | T const & Distance 45 | ) 46 | { 47 | return Origin + (Source - Origin) * Distance; 48 | } 49 | }//namespace glm 50 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/extended_min_max.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extended_min_max 2 | /// @file glm/gtx/extended_min_max.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T min( 8 | T const & x, 9 | T const & y, 10 | T const & z) 11 | { 12 | return glm::min(glm::min(x, y), z); 13 | } 14 | 15 | template class C> 16 | GLM_FUNC_QUALIFIER C min 17 | ( 18 | C const & x, 19 | typename C::T const & y, 20 | typename C::T const & z 21 | ) 22 | { 23 | return glm::min(glm::min(x, y), z); 24 | } 25 | 26 | template class C> 27 | GLM_FUNC_QUALIFIER C min 28 | ( 29 | C const & x, 30 | C const & y, 31 | C const & z 32 | ) 33 | { 34 | return glm::min(glm::min(x, y), z); 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER T min 39 | ( 40 | T const & x, 41 | T const & y, 42 | T const & z, 43 | T const & w 44 | ) 45 | { 46 | return glm::min(glm::min(x, y), glm::min(z, w)); 47 | } 48 | 49 | template class C> 50 | GLM_FUNC_QUALIFIER C min 51 | ( 52 | C const & x, 53 | typename C::T const & y, 54 | typename C::T const & z, 55 | typename C::T const & w 56 | ) 57 | { 58 | return glm::min(glm::min(x, y), glm::min(z, w)); 59 | } 60 | 61 | template class C> 62 | GLM_FUNC_QUALIFIER C min 63 | ( 64 | C const & x, 65 | C const & y, 66 | C const & z, 67 | C const & w 68 | ) 69 | { 70 | return glm::min(glm::min(x, y), glm::min(z, w)); 71 | } 72 | 73 | template 74 | GLM_FUNC_QUALIFIER T max( 75 | T const & x, 76 | T const & y, 77 | T const & z) 78 | { 79 | return glm::max(glm::max(x, y), z); 80 | } 81 | 82 | template class C> 83 | GLM_FUNC_QUALIFIER C max 84 | ( 85 | C const & x, 86 | typename C::T const & y, 87 | typename C::T const & z 88 | ) 89 | { 90 | return glm::max(glm::max(x, y), z); 91 | } 92 | 93 | template class C> 94 | GLM_FUNC_QUALIFIER C max 95 | ( 96 | C const & x, 97 | C const & y, 98 | C const & z 99 | ) 100 | { 101 | return glm::max(glm::max(x, y), z); 102 | } 103 | 104 | template 105 | GLM_FUNC_QUALIFIER T max 106 | ( 107 | T const & x, 108 | T const & y, 109 | T const & z, 110 | T const & w 111 | ) 112 | { 113 | return glm::max(glm::max(x, y), glm::max(z, w)); 114 | } 115 | 116 | template class C> 117 | GLM_FUNC_QUALIFIER C max 118 | ( 119 | C const & x, 120 | typename C::T const & y, 121 | typename C::T const & z, 122 | typename C::T const & w 123 | ) 124 | { 125 | return glm::max(glm::max(x, y), glm::max(z, w)); 126 | } 127 | 128 | template class C> 129 | GLM_FUNC_QUALIFIER C max 130 | ( 131 | C const & x, 132 | C const & y, 133 | C const & z, 134 | C const & w 135 | ) 136 | { 137 | return glm::max(glm::max(x, y), glm::max(z, w)); 138 | } 139 | 140 | }//namespace glm 141 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/fast_square_root.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_fast_square_root 2 | /// @file glm/gtx/fast_square_root.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_fast_square_root GLM_GTX_fast_square_root 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Fast but less accurate implementations of square root based functions. 10 | /// - Sqrt optimisation based on Newton's method, 11 | /// www.gamedev.net/community/forums/topic.asp?topic id=139956 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../common.hpp" 19 | #include "../exponential.hpp" 20 | #include "../geometric.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_fast_square_root extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_fast_square_root 29 | /// @{ 30 | 31 | /// Faster than the common sqrt function but less accurate. 32 | /// 33 | /// @see gtx_fast_square_root extension. 34 | template 35 | GLM_FUNC_DECL genType fastSqrt(genType x); 36 | 37 | /// Faster than the common sqrt function but less accurate. 38 | /// 39 | /// @see gtx_fast_square_root extension. 40 | template class vecType> 41 | GLM_FUNC_DECL vecType fastSqrt(vecType const & x); 42 | 43 | /// Faster than the common inversesqrt function but less accurate. 44 | /// 45 | /// @see gtx_fast_square_root extension. 46 | template 47 | GLM_FUNC_DECL genType fastInverseSqrt(genType x); 48 | 49 | /// Faster than the common inversesqrt function but less accurate. 50 | /// 51 | /// @see gtx_fast_square_root extension. 52 | template class vecType> 53 | GLM_FUNC_DECL vecType fastInverseSqrt(vecType const & x); 54 | 55 | /// Faster than the common length function but less accurate. 56 | /// 57 | /// @see gtx_fast_square_root extension. 58 | template 59 | GLM_FUNC_DECL genType fastLength(genType x); 60 | 61 | /// Faster than the common length function but less accurate. 62 | /// 63 | /// @see gtx_fast_square_root extension. 64 | template class vecType> 65 | GLM_FUNC_DECL T fastLength(vecType const & x); 66 | 67 | /// Faster than the common distance function but less accurate. 68 | /// 69 | /// @see gtx_fast_square_root extension. 70 | template 71 | GLM_FUNC_DECL genType fastDistance(genType x, genType y); 72 | 73 | /// Faster than the common distance function but less accurate. 74 | /// 75 | /// @see gtx_fast_square_root extension. 76 | template class vecType> 77 | GLM_FUNC_DECL T fastDistance(vecType const & x, vecType const & y); 78 | 79 | /// Faster than the common normalize function but less accurate. 80 | /// 81 | /// @see gtx_fast_square_root extension. 82 | template 83 | GLM_FUNC_DECL genType fastNormalize(genType const & x); 84 | 85 | /// @} 86 | }// namespace glm 87 | 88 | #include "fast_square_root.inl" 89 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/fast_square_root.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_fast_square_root 2 | /// @file glm/gtx/fast_square_root.inl 3 | 4 | namespace glm 5 | { 6 | // fastSqrt 7 | template 8 | GLM_FUNC_QUALIFIER genType fastSqrt(genType x) 9 | { 10 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastSqrt' only accept floating-point input"); 11 | 12 | return genType(1) / fastInverseSqrt(x); 13 | } 14 | 15 | template class vecType> 16 | GLM_FUNC_QUALIFIER vecType fastSqrt(vecType const & x) 17 | { 18 | return detail::functor1::call(fastSqrt, x); 19 | } 20 | 21 | // fastInversesqrt 22 | template 23 | GLM_FUNC_QUALIFIER genType fastInverseSqrt(genType x) 24 | { 25 | # ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6 26 | tvec1 tmp(detail::compute_inversesqrt::value>::call(tvec1(x))); 27 | return tmp.x; 28 | # else 29 | return detail::compute_inversesqrt::value>::call(tvec1(x)).x; 30 | # endif 31 | } 32 | 33 | template class vecType> 34 | GLM_FUNC_QUALIFIER vecType fastInverseSqrt(vecType const & x) 35 | { 36 | return detail::compute_inversesqrt::value>::call(x); 37 | } 38 | 39 | // fastLength 40 | template 41 | GLM_FUNC_QUALIFIER genType fastLength(genType x) 42 | { 43 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastLength' only accept floating-point inputs"); 44 | 45 | return abs(x); 46 | } 47 | 48 | template class vecType> 49 | GLM_FUNC_QUALIFIER T fastLength(vecType const & x) 50 | { 51 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'fastLength' only accept floating-point inputs"); 52 | 53 | return fastSqrt(dot(x, x)); 54 | } 55 | 56 | // fastDistance 57 | template 58 | GLM_FUNC_QUALIFIER genType fastDistance(genType x, genType y) 59 | { 60 | return fastLength(y - x); 61 | } 62 | 63 | template class vecType> 64 | GLM_FUNC_QUALIFIER T fastDistance(vecType const & x, vecType const & y) 65 | { 66 | return fastLength(y - x); 67 | } 68 | 69 | // fastNormalize 70 | template 71 | GLM_FUNC_QUALIFIER genType fastNormalize(genType x) 72 | { 73 | return x > genType(0) ? genType(1) : -genType(1); 74 | } 75 | 76 | template class vecType> 77 | GLM_FUNC_QUALIFIER vecType fastNormalize(vecType const & x) 78 | { 79 | return x * fastInverseSqrt(dot(x, x)); 80 | } 81 | }//namespace glm 82 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/fast_trigonometry.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_fast_trigonometry 2 | /// @file glm/gtx/fast_trigonometry.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_fast_trigonometry GLM_GTX_fast_trigonometry 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Fast but less accurate implementations of trigonometric functions. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../gtc/constants.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_fast_trigonometry extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_fast_trigonometry 25 | /// @{ 26 | 27 | /// Wrap an angle to [0 2pi[ 28 | /// From GLM_GTX_fast_trigonometry extension. 29 | template 30 | GLM_FUNC_DECL T wrapAngle(T angle); 31 | 32 | /// Faster than the common sin function but less accurate. 33 | /// From GLM_GTX_fast_trigonometry extension. 34 | template 35 | GLM_FUNC_DECL T fastSin(T angle); 36 | 37 | /// Faster than the common cos function but less accurate. 38 | /// From GLM_GTX_fast_trigonometry extension. 39 | template 40 | GLM_FUNC_DECL T fastCos(T angle); 41 | 42 | /// Faster than the common tan function but less accurate. 43 | /// Defined between -2pi and 2pi. 44 | /// From GLM_GTX_fast_trigonometry extension. 45 | template 46 | GLM_FUNC_DECL T fastTan(T angle); 47 | 48 | /// Faster than the common asin function but less accurate. 49 | /// Defined between -2pi and 2pi. 50 | /// From GLM_GTX_fast_trigonometry extension. 51 | template 52 | GLM_FUNC_DECL T fastAsin(T angle); 53 | 54 | /// Faster than the common acos function but less accurate. 55 | /// Defined between -2pi and 2pi. 56 | /// From GLM_GTX_fast_trigonometry extension. 57 | template 58 | GLM_FUNC_DECL T fastAcos(T angle); 59 | 60 | /// Faster than the common atan function but less accurate. 61 | /// Defined between -2pi and 2pi. 62 | /// From GLM_GTX_fast_trigonometry extension. 63 | template 64 | GLM_FUNC_DECL T fastAtan(T y, T x); 65 | 66 | /// Faster than the common atan function but less accurate. 67 | /// Defined between -2pi and 2pi. 68 | /// From GLM_GTX_fast_trigonometry extension. 69 | template 70 | GLM_FUNC_DECL T fastAtan(T angle); 71 | 72 | /// @} 73 | }//namespace glm 74 | 75 | #include "fast_trigonometry.inl" 76 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | /// @file glm/gtx/float_normalize.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | template class vecType> 9 | GLM_FUNC_QUALIFIER vecType floatNormalize(vecType const & v) 10 | { 11 | return vecType(v) / static_cast(std::numeric_limits::max()); 12 | } 13 | 14 | }//namespace glm 15 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/gradient_paint.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_optimum_pow (dependence) 6 | /// 7 | /// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Functions that return the color of procedural gradient for specific coordinates. 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtx/optimum_pow.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_gradient_paint extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_gradient_paint 26 | /// @{ 27 | 28 | /// Return a color from a radial gradient. 29 | /// @see - gtx_gradient_paint 30 | template 31 | GLM_FUNC_DECL T radialGradient( 32 | tvec2 const & Center, 33 | T const & Radius, 34 | tvec2 const & Focal, 35 | tvec2 const & Position); 36 | 37 | /// Return a color from a linear gradient. 38 | /// @see - gtx_gradient_paint 39 | template 40 | GLM_FUNC_DECL T linearGradient( 41 | tvec2 const & Point0, 42 | tvec2 const & Point1, 43 | tvec2 const & Position); 44 | 45 | /// @} 46 | }// namespace glm 47 | 48 | #include "gradient_paint.inl" 49 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T radialGradient 8 | ( 9 | tvec2 const & Center, 10 | T const & Radius, 11 | tvec2 const & Focal, 12 | tvec2 const & Position 13 | ) 14 | { 15 | tvec2 F = Focal - Center; 16 | tvec2 D = Position - Focal; 17 | T Radius2 = pow2(Radius); 18 | T Fx2 = pow2(F.x); 19 | T Fy2 = pow2(F.y); 20 | 21 | T 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)); 22 | T Denominator = Radius2 - (Fx2 + Fy2); 23 | return Numerator / Denominator; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER T linearGradient 28 | ( 29 | tvec2 const & Point0, 30 | tvec2 const & Point1, 31 | tvec2 const & Position 32 | ) 33 | { 34 | tvec2 Dist = Point1 - Point0; 35 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 36 | } 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/handed_coordinate_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space 7 | /// @ingroup gtx 8 | /// 9 | /// @brief To know if a set of three basis vectors defines a right or left-handed coordinate system. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_handed_coordinate_space 25 | /// @{ 26 | 27 | //! Return if a trihedron right handed or not. 28 | //! From GLM_GTX_handed_coordinate_space extension. 29 | template 30 | GLM_FUNC_DECL bool rightHanded( 31 | tvec3 const & tangent, 32 | tvec3 const & binormal, 33 | tvec3 const & normal); 34 | 35 | //! Return if a trihedron left handed or not. 36 | //! From GLM_GTX_handed_coordinate_space extension. 37 | template 38 | GLM_FUNC_DECL bool leftHanded( 39 | tvec3 const & tangent, 40 | tvec3 const & binormal, 41 | tvec3 const & normal); 42 | 43 | /// @} 44 | }// namespace glm 45 | 46 | #include "handed_coordinate_space.inl" 47 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool rightHanded 8 | ( 9 | tvec3 const & tangent, 10 | tvec3 const & binormal, 11 | tvec3 const & normal 12 | ) 13 | { 14 | return dot(cross(normal, tangent), binormal) > T(0); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER bool leftHanded 19 | ( 20 | tvec3 const & tangent, 21 | tvec3 const & binormal, 22 | tvec3 const & normal 23 | ) 24 | { 25 | return dot(cross(normal, tangent), binormal) < T(0); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/integer.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_integer 2 | /// @file glm/gtx/integer.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_integer GLM_GTX_integer 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Add support for integer for core functions 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/integer.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_integer extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_integer 26 | /// @{ 27 | 28 | //! Returns x raised to the y power. 29 | //! From GLM_GTX_integer extension. 30 | GLM_FUNC_DECL int pow(int x, int y); 31 | 32 | //! Returns the positive square root of x. 33 | //! From GLM_GTX_integer extension. 34 | GLM_FUNC_DECL int sqrt(int x); 35 | 36 | //! Returns the floor log2 of x. 37 | //! From GLM_GTX_integer extension. 38 | GLM_FUNC_DECL unsigned int floor_log2(unsigned int x); 39 | 40 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 41 | //! From GLM_GTX_integer extension. 42 | GLM_FUNC_DECL int mod(int x, int y); 43 | 44 | //! Return the factorial value of a number (!12 max, integer only) 45 | //! From GLM_GTX_integer extension. 46 | template 47 | GLM_FUNC_DECL genType factorial(genType const & x); 48 | 49 | //! 32bit signed integer. 50 | //! From GLM_GTX_integer extension. 51 | typedef signed int sint; 52 | 53 | //! Returns x raised to the y power. 54 | //! From GLM_GTX_integer extension. 55 | GLM_FUNC_DECL uint pow(uint x, uint y); 56 | 57 | //! Returns the positive square root of x. 58 | //! From GLM_GTX_integer extension. 59 | GLM_FUNC_DECL uint sqrt(uint x); 60 | 61 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 62 | //! From GLM_GTX_integer extension. 63 | GLM_FUNC_DECL uint mod(uint x, uint y); 64 | 65 | //! Returns the number of leading zeros. 66 | //! From GLM_GTX_integer extension. 67 | GLM_FUNC_DECL uint nlz(uint x); 68 | 69 | /// @} 70 | }//namespace glm 71 | 72 | #include "integer.inl" 73 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_log_base GLM_GTX_log_base 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Logarithm for any base. base can be a vector or a scalar. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_log_base extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_log_base 25 | /// @{ 26 | 27 | /// Logarithm for any base. 28 | /// From GLM_GTX_log_base. 29 | template 30 | GLM_FUNC_DECL genType log( 31 | genType const & x, 32 | genType const & base); 33 | 34 | /// Logarithm for any base. 35 | /// From GLM_GTX_log_base. 36 | template class vecType> 37 | GLM_FUNC_DECL vecType sign( 38 | vecType const & x, 39 | vecType const & base); 40 | 41 | /// @} 42 | }//namespace glm 43 | 44 | #include "log_base.inl" 45 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType log(genType const & x, genType const & base) 8 | { 9 | assert(x != genType(0)); 10 | return glm::log(x) / glm::log(base); 11 | } 12 | 13 | template class vecType> 14 | GLM_FUNC_QUALIFIER vecType log(vecType const & x, vecType const & base) 15 | { 16 | return glm::log(x) / glm::log(base); 17 | } 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_cross_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Build cross product matrices 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_matrix_cross_product 26 | /// @{ 27 | 28 | //! Build a cross product matrix. 29 | //! From GLM_GTX_matrix_cross_product extension. 30 | template 31 | GLM_FUNC_DECL tmat3x3 matrixCross3( 32 | tvec3 const & x); 33 | 34 | //! Build a cross product matrix. 35 | //! From GLM_GTX_matrix_cross_product extension. 36 | template 37 | GLM_FUNC_DECL tmat4x4 matrixCross4( 38 | tvec3 const & x); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "matrix_cross_product.inl" 44 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat3x3 matrixCross3 8 | ( 9 | tvec3 const & x 10 | ) 11 | { 12 | tmat3x3 Result(T(0)); 13 | Result[0][1] = x.z; 14 | Result[1][0] = -x.z; 15 | Result[0][2] = -x.y; 16 | Result[2][0] = x.y; 17 | Result[1][2] = x.x; 18 | Result[2][1] = -x.x; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER tmat4x4 matrixCross4 24 | ( 25 | tvec3 const & x 26 | ) 27 | { 28 | tmat4x4 Result(T(0)); 29 | Result[0][1] = x.z; 30 | Result[1][0] = -x.z; 31 | Result[0][2] = -x.y; 32 | Result[2][0] = x.y; 33 | Result[1][2] = x.x; 34 | Result[2][1] = -x.x; 35 | return Result; 36 | } 37 | 38 | }//namespace glm 39 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_decompose.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_decompose 2 | /// @file glm/gtx/matrix_decompose.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Decomposes a model matrix to translations, rotation and scale components 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../mat4x4.hpp" 17 | #include "../vec3.hpp" 18 | #include "../vec4.hpp" 19 | #include "../geometric.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | #include "../gtc/matrix_transform.hpp" 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_decompose extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_decompose 30 | /// @{ 31 | 32 | /// Decomposes a model matrix to translations, rotation and scale components 33 | /// @see gtx_matrix_decompose 34 | template 35 | GLM_FUNC_DECL bool decompose( 36 | tmat4x4 const & modelMatrix, 37 | tvec3 & scale, tquat & orientation, tvec3 & translation, tvec3 & skew, tvec4 & perspective); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "matrix_decompose.inl" 43 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_interpolation.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_interpolation 2 | /// @file glm/gtx/matrix_interpolation.hpp 3 | /// @author Ghenadii Ursachi (the.asteroth@gmail.com) 4 | /// 5 | /// @see core (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_interpolation GLM_GTX_matrix_interpolation 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Allows to directly interpolate two exiciting matrices. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_matrix_interpolation extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_matrix_interpolation 26 | /// @{ 27 | 28 | /// Get the axis and angle of the rotation from a matrix. 29 | /// From GLM_GTX_matrix_interpolation extension. 30 | template 31 | GLM_FUNC_DECL void axisAngle( 32 | tmat4x4 const & mat, 33 | tvec3 & axis, 34 | T & angle); 35 | 36 | /// Build a matrix from axis and angle. 37 | /// From GLM_GTX_matrix_interpolation extension. 38 | template 39 | GLM_FUNC_DECL tmat4x4 axisAngleMatrix( 40 | tvec3 const & axis, 41 | T const angle); 42 | 43 | /// Extracts the rotation part of a matrix. 44 | /// From GLM_GTX_matrix_interpolation extension. 45 | template 46 | GLM_FUNC_DECL tmat4x4 extractMatrixRotation( 47 | tmat4x4 const & mat); 48 | 49 | /// Build a interpolation of 4 * 4 matrixes. 50 | /// From GLM_GTX_matrix_interpolation extension. 51 | /// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results. 52 | template 53 | GLM_FUNC_DECL tmat4x4 interpolate( 54 | tmat4x4 const & m1, 55 | tmat4x4 const & m2, 56 | T const delta); 57 | 58 | /// @} 59 | }//namespace glm 60 | 61 | #include "matrix_interpolation.inl" 62 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_operation.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_operation 2 | /// @file glm/gtx/matrix_operation.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_matrix_operation GLM_GTX_matrix_operation 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Build diagonal matrices from vectors. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_matrix_operation extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_matrix_operation 25 | /// @{ 26 | 27 | //! Build a diagonal matrix. 28 | //! From GLM_GTX_matrix_operation extension. 29 | template 30 | GLM_FUNC_DECL tmat2x2 diagonal2x2( 31 | tvec2 const & v); 32 | 33 | //! Build a diagonal matrix. 34 | //! From GLM_GTX_matrix_operation extension. 35 | template 36 | GLM_FUNC_DECL tmat2x3 diagonal2x3( 37 | tvec2 const & v); 38 | 39 | //! Build a diagonal matrix. 40 | //! From GLM_GTX_matrix_operation extension. 41 | template 42 | GLM_FUNC_DECL tmat2x4 diagonal2x4( 43 | tvec2 const & v); 44 | 45 | //! Build a diagonal matrix. 46 | //! From GLM_GTX_matrix_operation extension. 47 | template 48 | GLM_FUNC_DECL tmat3x2 diagonal3x2( 49 | tvec2 const & v); 50 | 51 | //! Build a diagonal matrix. 52 | //! From GLM_GTX_matrix_operation extension. 53 | template 54 | GLM_FUNC_DECL tmat3x3 diagonal3x3( 55 | tvec3 const & v); 56 | 57 | //! Build a diagonal matrix. 58 | //! From GLM_GTX_matrix_operation extension. 59 | template 60 | GLM_FUNC_DECL tmat3x4 diagonal3x4( 61 | tvec3 const & v); 62 | 63 | //! Build a diagonal matrix. 64 | //! From GLM_GTX_matrix_operation extension. 65 | template 66 | GLM_FUNC_DECL tmat4x2 diagonal4x2( 67 | tvec2 const & v); 68 | 69 | //! Build a diagonal matrix. 70 | //! From GLM_GTX_matrix_operation extension. 71 | template 72 | GLM_FUNC_DECL tmat4x3 diagonal4x3( 73 | tvec3 const & v); 74 | 75 | //! Build a diagonal matrix. 76 | //! From GLM_GTX_matrix_operation extension. 77 | template 78 | GLM_FUNC_DECL tmat4x4 diagonal4x4( 79 | tvec4 const & v); 80 | 81 | /// @} 82 | }//namespace glm 83 | 84 | #include "matrix_operation.inl" 85 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_operation.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_operation 2 | /// @file glm/gtx/matrix_operation.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat2x2 diagonal2x2 8 | ( 9 | tvec2 const & v 10 | ) 11 | { 12 | tmat2x2 Result(static_cast(1)); 13 | Result[0][0] = v[0]; 14 | Result[1][1] = v[1]; 15 | return Result; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER tmat2x3 diagonal2x3 20 | ( 21 | tvec2 const & v 22 | ) 23 | { 24 | tmat2x3 Result(static_cast(1)); 25 | Result[0][0] = v[0]; 26 | Result[1][1] = v[1]; 27 | return Result; 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER tmat2x4 diagonal2x4 32 | ( 33 | tvec2 const & v 34 | ) 35 | { 36 | tmat2x4 Result(static_cast(1)); 37 | Result[0][0] = v[0]; 38 | Result[1][1] = v[1]; 39 | return Result; 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER tmat3x2 diagonal3x2 44 | ( 45 | tvec2 const & v 46 | ) 47 | { 48 | tmat3x2 Result(static_cast(1)); 49 | Result[0][0] = v[0]; 50 | Result[1][1] = v[1]; 51 | return Result; 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER tmat3x3 diagonal3x3 56 | ( 57 | tvec3 const & v 58 | ) 59 | { 60 | tmat3x3 Result(static_cast(1)); 61 | Result[0][0] = v[0]; 62 | Result[1][1] = v[1]; 63 | Result[2][2] = v[2]; 64 | return Result; 65 | } 66 | 67 | template 68 | GLM_FUNC_QUALIFIER tmat3x4 diagonal3x4 69 | ( 70 | tvec3 const & v 71 | ) 72 | { 73 | tmat3x4 Result(static_cast(1)); 74 | Result[0][0] = v[0]; 75 | Result[1][1] = v[1]; 76 | Result[2][2] = v[2]; 77 | return Result; 78 | } 79 | 80 | template 81 | GLM_FUNC_QUALIFIER tmat4x4 diagonal4x4 82 | ( 83 | tvec4 const & v 84 | ) 85 | { 86 | tmat4x4 Result(static_cast(1)); 87 | Result[0][0] = v[0]; 88 | Result[1][1] = v[1]; 89 | Result[2][2] = v[2]; 90 | Result[3][3] = v[3]; 91 | return Result; 92 | } 93 | 94 | template 95 | GLM_FUNC_QUALIFIER tmat4x3 diagonal4x3 96 | ( 97 | tvec3 const & v 98 | ) 99 | { 100 | tmat4x3 Result(static_cast(1)); 101 | Result[0][0] = v[0]; 102 | Result[1][1] = v[1]; 103 | Result[2][2] = v[2]; 104 | return Result; 105 | } 106 | 107 | template 108 | GLM_FUNC_QUALIFIER tmat4x2 diagonal4x2 109 | ( 110 | tvec2 const & v 111 | ) 112 | { 113 | tmat4x2 Result(static_cast(1)); 114 | Result[0][0] = v[0]; 115 | Result[1][1] = v[1]; 116 | return Result; 117 | } 118 | }//namespace glm 119 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_query.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_query 2 | /// @file glm/gtx/matrix_query.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_vector_query (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_query GLM_GTX_matrix_query 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Query to evaluate matrix properties 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/vector_query.hpp" 19 | #include 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_matrix_query extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_matrix_query 28 | /// @{ 29 | 30 | /// Return whether a matrix a null matrix. 31 | /// From GLM_GTX_matrix_query extension. 32 | template 33 | GLM_FUNC_DECL bool isNull(tmat2x2 const & m, T const & epsilon); 34 | 35 | /// Return whether a matrix a null matrix. 36 | /// From GLM_GTX_matrix_query extension. 37 | template 38 | GLM_FUNC_DECL bool isNull(tmat3x3 const & m, T const & epsilon); 39 | 40 | /// Return whether a matrix is a null matrix. 41 | /// From GLM_GTX_matrix_query extension. 42 | template 43 | GLM_FUNC_DECL bool isNull(tmat4x4 const & m, T const & epsilon); 44 | 45 | /// Return whether a matrix is an identity matrix. 46 | /// From GLM_GTX_matrix_query extension. 47 | template class matType> 48 | GLM_FUNC_DECL bool isIdentity(matType const & m, T const & epsilon); 49 | 50 | /// Return whether a matrix is a normalized matrix. 51 | /// From GLM_GTX_matrix_query extension. 52 | template 53 | GLM_FUNC_DECL bool isNormalized(tmat2x2 const & m, T const & epsilon); 54 | 55 | /// Return whether a matrix is a normalized matrix. 56 | /// From GLM_GTX_matrix_query extension. 57 | template 58 | GLM_FUNC_DECL bool isNormalized(tmat3x3 const & m, T const & epsilon); 59 | 60 | /// Return whether a matrix is a normalized matrix. 61 | /// From GLM_GTX_matrix_query extension. 62 | template 63 | GLM_FUNC_DECL bool isNormalized(tmat4x4 const & m, T const & epsilon); 64 | 65 | /// Return whether a matrix is an orthonormalized matrix. 66 | /// From GLM_GTX_matrix_query extension. 67 | template class matType> 68 | GLM_FUNC_DECL bool isOrthogonal(matType const & m, T const & epsilon); 69 | 70 | /// @} 71 | }//namespace glm 72 | 73 | #include "matrix_query.inl" 74 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_transform_2d.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_transform_2d 2 | /// @file glm/gtx/matrix_transform_2d.hpp 3 | /// @author Miguel Ángel Pérez Martínez 4 | /// 5 | /// @see core (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Defines functions that generate common 2d transformation matrices. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../mat3x3.hpp" 18 | #include "../vec2.hpp" 19 | 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_matrix_transform_2d 28 | /// @{ 29 | 30 | /// Builds a translation 3 * 3 matrix created from a vector of 2 components. 31 | /// 32 | /// @param m Input matrix multiplied by this translation matrix. 33 | /// @param v Coordinates of a translation vector. 34 | template 35 | GLM_FUNC_QUALIFIER tmat3x3 translate( 36 | tmat3x3 const & m, 37 | tvec2 const & v); 38 | 39 | /// Builds a rotation 3 * 3 matrix created from an angle. 40 | /// 41 | /// @param m Input matrix multiplied by this translation matrix. 42 | /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise. 43 | template 44 | GLM_FUNC_QUALIFIER tmat3x3 rotate( 45 | tmat3x3 const & m, 46 | T angle); 47 | 48 | /// Builds a scale 3 * 3 matrix created from a vector of 2 components. 49 | /// 50 | /// @param m Input matrix multiplied by this translation matrix. 51 | /// @param v Coordinates of a scale vector. 52 | template 53 | GLM_FUNC_QUALIFIER tmat3x3 scale( 54 | tmat3x3 const & m, 55 | tvec2 const & v); 56 | 57 | /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. 58 | /// 59 | /// @param m Input matrix multiplied by this translation matrix. 60 | /// @param y Shear factor. 61 | template 62 | GLM_FUNC_QUALIFIER tmat3x3 shearX( 63 | tmat3x3 const & m, 64 | T y); 65 | 66 | /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. 67 | /// 68 | /// @param m Input matrix multiplied by this translation matrix. 69 | /// @param x Shear factor. 70 | template 71 | GLM_FUNC_QUALIFIER tmat3x3 shearY( 72 | tmat3x3 const & m, 73 | T x); 74 | 75 | /// @} 76 | }//namespace glm 77 | 78 | #include "matrix_transform_2d.inl" 79 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/matrix_transform_2d.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_transform_2d 2 | /// @file glm/gtc/matrix_transform_2d.inl 3 | /// @author Miguel Ángel Pérez Martínez 4 | 5 | #include "../trigonometric.hpp" 6 | 7 | namespace glm 8 | { 9 | 10 | template 11 | GLM_FUNC_QUALIFIER tmat3x3 translate( 12 | tmat3x3 const & m, 13 | tvec2 const & v) 14 | { 15 | tmat3x3 Result(m); 16 | Result[2] = m[0] * v[0] + m[1] * v[1] + m[2]; 17 | return Result; 18 | } 19 | 20 | 21 | template 22 | GLM_FUNC_QUALIFIER tmat3x3 rotate( 23 | tmat3x3 const & m, 24 | T angle) 25 | { 26 | T const a = angle; 27 | T const c = cos(a); 28 | T const s = sin(a); 29 | 30 | tmat3x3 Result(uninitialize); 31 | Result[0] = m[0] * c + m[1] * s; 32 | Result[1] = m[0] * -s + m[1] * c; 33 | Result[2] = m[2]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER tmat3x3 scale( 39 | tmat3x3 const & m, 40 | tvec2 const & v) 41 | { 42 | tmat3x3 Result(uninitialize); 43 | Result[0] = m[0] * v[0]; 44 | Result[1] = m[1] * v[1]; 45 | Result[2] = m[2]; 46 | return Result; 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER tmat3x3 shearX( 51 | tmat3x3 const & m, 52 | T y) 53 | { 54 | tmat3x3 Result(1); 55 | Result[0][1] = y; 56 | return m * Result; 57 | } 58 | 59 | template 60 | GLM_FUNC_QUALIFIER tmat3x3 shearY( 61 | tmat3x3 const & m, 62 | T x) 63 | { 64 | tmat3x3 Result(1); 65 | Result[1][0] = x; 66 | return m * Result; 67 | } 68 | 69 | }//namespace glm 70 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Mixed product of 3 vectors. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_mixed_product 25 | /// @{ 26 | 27 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 28 | template 29 | GLM_FUNC_DECL T mixedProduct( 30 | tvec3 const & v1, 31 | tvec3 const & v2, 32 | tvec3 const & v3); 33 | 34 | /// @} 35 | }// namespace glm 36 | 37 | #include "mixed_product.inl" 38 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T mixedProduct 8 | ( 9 | tvec3 const & v1, 10 | tvec3 const & v2, 11 | tvec3 const & v3 12 | ) 13 | { 14 | return dot(cross(v1, v2), v3); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/norm.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_norm 2 | /// @file glm/gtx/norm.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_quaternion (dependence) 6 | /// 7 | /// @defgroup gtx_norm GLM_GTX_norm 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Various ways to compute vector norms. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../detail/func_geometric.hpp" 18 | #include "../gtx/quaternion.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_norm extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_norm 27 | /// @{ 28 | 29 | /// Returns the squared length of x. 30 | /// From GLM_GTX_norm extension. 31 | template class vecType> 32 | GLM_FUNC_DECL T length2( 33 | vecType const & x); 34 | 35 | /// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1). 36 | /// From GLM_GTX_norm extension. 37 | template class vecType> 38 | GLM_FUNC_DECL T distance2( 39 | vecType const & p0, 40 | vecType const & p1); 41 | 42 | //! Returns the L1 norm between x and y. 43 | //! From GLM_GTX_norm extension. 44 | template 45 | GLM_FUNC_DECL T l1Norm( 46 | tvec3 const & x, 47 | tvec3 const & y); 48 | 49 | //! Returns the L1 norm of v. 50 | //! From GLM_GTX_norm extension. 51 | template 52 | GLM_FUNC_DECL T l1Norm( 53 | tvec3 const & v); 54 | 55 | //! Returns the L2 norm between x and y. 56 | //! From GLM_GTX_norm extension. 57 | template 58 | GLM_FUNC_DECL T l2Norm( 59 | tvec3 const & x, 60 | tvec3 const & y); 61 | 62 | //! Returns the L2 norm of v. 63 | //! From GLM_GTX_norm extension. 64 | template 65 | GLM_FUNC_DECL T l2Norm( 66 | tvec3 const & x); 67 | 68 | //! Returns the L norm between x and y. 69 | //! From GLM_GTX_norm extension. 70 | template 71 | GLM_FUNC_DECL T lxNorm( 72 | tvec3 const & x, 73 | tvec3 const & y, 74 | unsigned int Depth); 75 | 76 | //! Returns the L norm of v. 77 | //! From GLM_GTX_norm extension. 78 | template 79 | GLM_FUNC_DECL T lxNorm( 80 | tvec3 const & x, 81 | unsigned int Depth); 82 | 83 | /// @} 84 | }//namespace glm 85 | 86 | #include "norm.inl" 87 | -------------------------------------------------------------------------------- /src/vendor/glm/gtx/norm.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_norm 2 | /// @file glm/gtx/norm.inl 3 | 4 | #include "../detail/precision.hpp" 5 | 6 | namespace glm{ 7 | namespace detail 8 | { 9 | template