├── .gitattributes ├── .gitignore ├── LICENSE ├── NormalMapGeneratorTool.sln ├── NormalMapGeneratorTool ├── Nora.ico ├── NormalMapGeneratorTool.vcxproj ├── NormalMapGeneratorTool.vcxproj.filters ├── Resource.rc ├── Resources │ ├── 3D Models │ │ ├── Complex │ │ │ ├── Suzanne.fbx │ │ │ └── Utah Teapot.fbx │ │ └── Primitives │ │ │ ├── Cube.fbx │ │ │ ├── Cylinder.fbx │ │ │ ├── Plane.fbx │ │ │ ├── Sphere.fbx │ │ │ └── Torus.fbx │ ├── Brushes │ │ ├── Grunge │ │ │ ├── Crumble 1.png │ │ │ ├── Crumble 2.png │ │ │ ├── Crumble 3.png │ │ │ ├── Dirt Sploch 1.png │ │ │ ├── Dirt Sploch 2.png │ │ │ ├── Dirt Sploch 3.png │ │ │ └── Dirt Sploch 4.png │ │ └── Patterns │ │ │ ├── Chain 1.png │ │ │ ├── Chain 2.png │ │ │ ├── Chain 3.png │ │ │ ├── Chain 4.png │ │ │ └── Floral 1.png │ ├── Fonts │ │ └── Roboto-Medium.ttf │ ├── Preference │ │ └── preference.npref │ ├── Shaders │ │ ├── brushPreview.fs │ │ ├── frameBuffer.fs │ │ ├── gridLines.fs │ │ ├── gridLines.vs │ │ ├── modelAttribsDisplay.fs │ │ ├── modelAttribsDisplay.gs │ │ ├── modelAttribsDisplay.vs │ │ ├── modelView.fs │ │ ├── modelView.vs │ │ ├── modelViewPBR.fs │ │ ├── normalPanel.fs │ │ ├── normalPanel.vs │ │ └── windowChrome.fs │ ├── Textures │ │ ├── Cubemaps │ │ │ └── Sahara Desert Cubemap │ │ │ │ ├── sahara_bk.tga │ │ │ │ ├── sahara_dn.tga │ │ │ │ ├── sahara_ft.tga │ │ │ │ ├── sahara_lf.tga │ │ │ │ ├── sahara_rt.tga │ │ │ │ └── sahara_up.tga │ │ ├── Matcaps │ │ │ ├── chrome.png │ │ │ ├── copper.png │ │ │ ├── orange flame.png │ │ │ ├── organic1.png │ │ │ ├── organic3.png │ │ │ ├── organic4.png │ │ │ ├── outline1.png │ │ │ ├── outline2.png │ │ │ ├── plastic1.png │ │ │ ├── plastic2.png │ │ │ ├── plastic3.png │ │ │ ├── platinum.png │ │ │ ├── red metal.png │ │ │ ├── skin1.png │ │ │ ├── skin2.png │ │ │ └── view space normal.png │ │ ├── Normal Maps │ │ │ └── sample normal 1.png │ │ ├── UI │ │ │ ├── clearView.png │ │ │ ├── closeIcon.png │ │ │ ├── icon.png │ │ │ ├── maxWinIcon.png │ │ │ ├── maximizePreview.png │ │ │ ├── minWinIcon.png │ │ │ ├── resetLocation.png │ │ │ ├── toTrayIcon.png │ │ │ └── toggleFullscreen.png │ │ ├── wall diffuse.png │ │ ├── wall height.png │ │ └── wall specular.png │ └── Themes │ │ ├── Blue Ice.nort │ │ ├── Green Mint.nort │ │ ├── Orange Juice.nort │ │ └── Ultra Violet.nort ├── assimp.dll ├── glew32.dll ├── imgui.ini ├── resource.h └── src │ ├── BrushData.h │ ├── Camera.cpp │ ├── Camera.h │ ├── ColourData.h │ ├── DrawingPanel.cpp │ ├── DrawingPanel.h │ ├── FileExplorer.cpp │ ├── FileExplorer.h │ ├── FrameBufferSystem.cpp │ ├── FrameBufferSystem.h │ ├── GLutil.h │ ├── ImGui │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_impl_glfw.cpp │ ├── imgui_impl_glfw.h │ ├── imgui_impl_opengl2.cpp │ ├── imgui_impl_opengl2.h │ └── imgui_internal.h │ ├── LayerManager.cpp │ ├── LayerManager.h │ ├── MainApp.cpp │ ├── MeshLoadingSystem.h │ ├── ModalWindow.cpp │ ├── ModalWindow.h │ ├── ModelObject.cpp │ ├── ModelObject.h │ ├── NoraFileHandler.h │ ├── PreferencesHandler.h │ ├── ShaderProgram.cpp │ ├── ShaderProgram.h │ ├── Stb │ ├── stb_image.cpp │ ├── stb_image.h │ ├── stb_image_write.cpp │ ├── stb_image_write.h │ ├── stb_rect_pack.h │ ├── stb_textedit.h │ └── stb_truetype.h │ ├── TextureData.cpp │ ├── TextureData.h │ ├── TextureLoader.cpp │ ├── TextureLoader.h │ ├── ThemeManager.h │ ├── Transform.cpp │ ├── Transform.h │ ├── UndoRedoSystem.cpp │ ├── UndoRedoSystem.h │ ├── ViewBasedUtilities.h │ ├── WindowSystem.cpp │ ├── WindowSystem.h │ └── WindowTransformUtility.h ├── README.md ├── includes ├── GL │ ├── eglew.h │ ├── glew.h │ ├── glxew.h │ └── wglew.h ├── GLFW │ ├── glfw3.h │ └── glfw3native.h ├── 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 │ │ ├── simd_mat4.hpp │ │ ├── simd_mat4.inl │ │ ├── simd_quat.hpp │ │ ├── simd_quat.inl │ │ ├── simd_vec4.hpp │ │ ├── simd_vec4.inl │ │ ├── spline.hpp │ │ ├── spline.inl │ │ ├── std_based_type.hpp │ │ ├── std_based_type.inl │ │ ├── string_cast.hpp │ │ ├── string_cast.inl │ │ ├── transform.hpp │ │ ├── transform.inl │ │ ├── transform2.hpp │ │ ├── transform2.inl │ │ ├── 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 │ ├── out │ │ └── build │ │ │ └── x64-Debug │ │ │ ├── .cmake │ │ │ └── api │ │ │ │ └── v1 │ │ │ │ ├── query │ │ │ │ └── client-MicrosoftVS │ │ │ │ │ └── query.json │ │ │ │ └── reply │ │ │ │ ├── cache-v2-b5e31f532f0c70390b46.json │ │ │ │ ├── cmakeFiles-v1-405cda9d1b422854459a.json │ │ │ │ ├── codemodel-v2-2d93f4aed29f2d8af3ee.json │ │ │ │ ├── index-2019-12-02T18-16-48-0485.json │ │ │ │ └── target-glm_dummy-Debug-f4b9aecddba413021201.json │ │ │ ├── CMakeCache.txt │ │ │ ├── CMakeFiles │ │ │ ├── 3.14.19050301-MSVC_2 │ │ │ │ ├── CMakeCCompiler.cmake │ │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ │ ├── CMakeRCCompiler.cmake │ │ │ │ ├── CMakeSystem.cmake │ │ │ │ ├── CompilerIdC │ │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ │ └── CMakeCCompilerId.exe │ │ │ │ └── CompilerIdCXX │ │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ │ └── CMakeCXXCompilerId.exe │ │ │ ├── ShowIncludes │ │ │ │ ├── foo.h │ │ │ │ └── main.c │ │ │ ├── TargetDirectories.txt │ │ │ ├── cmake.check_cache │ │ │ ├── feature_tests.bin │ │ │ ├── feature_tests.c │ │ │ └── feature_tests.cxx │ │ │ ├── VSInheritEnvironments.txt │ │ │ ├── build.ninja │ │ │ ├── cmake_install.cmake │ │ │ └── rules.ninja │ ├── 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 └── assimp │ ├── Compiler │ ├── poppack1.h │ ├── pstdint.h │ └── pushpack1.h │ ├── DefaultLogger.hpp │ ├── Exporter.hpp │ ├── IOStream.hpp │ ├── IOSystem.hpp │ ├── Importer.hpp │ ├── LogStream.hpp │ ├── Logger.hpp │ ├── NullLogger.hpp │ ├── ProgressHandler.hpp │ ├── ai_assert.h │ ├── anim.h │ ├── camera.h │ ├── cexport.h │ ├── cfileio.h │ ├── cimport.h │ ├── color4.h │ ├── color4.inl │ ├── config.h │ ├── defs.h │ ├── importerdesc.h │ ├── light.h │ ├── material.h │ ├── material.inl │ ├── matrix3x3.h │ ├── matrix3x3.inl │ ├── matrix4x4.h │ ├── matrix4x4.inl │ ├── mesh.h │ ├── metadata.h │ ├── postprocess.h │ ├── quaternion.h │ ├── quaternion.inl │ ├── scene.h │ ├── texture.h │ ├── types.h │ ├── vector2.h │ ├── vector2.inl │ ├── vector3.h │ ├── vector3.inl │ └── version.h └── lib ├── assimp.lib ├── glew32.lib ├── glew32s.lib └── glfw3.lib /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Joseph Kalathil 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30413.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NormalMapGeneratorTool", "NormalMapGeneratorTool\NormalMapGeneratorTool.vcxproj", "{E2997AA2-68B2-4AB3-AEB4-ABB8A10720FF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E2997AA2-68B2-4AB3-AEB4-ABB8A10720FF}.Debug|x86.ActiveCfg = Debug|Win32 15 | {E2997AA2-68B2-4AB3-AEB4-ABB8A10720FF}.Debug|x86.Build.0 = Debug|Win32 16 | {E2997AA2-68B2-4AB3-AEB4-ABB8A10720FF}.Release|x86.ActiveCfg = Release|Win32 17 | {E2997AA2-68B2-4AB3-AEB4-ABB8A10720FF}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {FF4D2697-E328-445E-92D8-4C4BEAD1CB46} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Nora.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Nora.ico -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resource.rc -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/3D Models/Complex/Suzanne.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/3D Models/Complex/Suzanne.fbx -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/3D Models/Complex/Utah Teapot.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/3D Models/Complex/Utah Teapot.fbx -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/3D Models/Primitives/Cube.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/3D Models/Primitives/Cube.fbx -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/3D Models/Primitives/Cylinder.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/3D Models/Primitives/Cylinder.fbx -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/3D Models/Primitives/Plane.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/3D Models/Primitives/Plane.fbx -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/3D Models/Primitives/Sphere.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/3D Models/Primitives/Sphere.fbx -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/3D Models/Primitives/Torus.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/3D Models/Primitives/Torus.fbx -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Grunge/Crumble 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Grunge/Crumble 1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Grunge/Crumble 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Grunge/Crumble 2.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Grunge/Crumble 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Grunge/Crumble 3.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 2.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 3.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Grunge/Dirt Sploch 4.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 2.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 3.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Patterns/Chain 4.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Brushes/Patterns/Floral 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Brushes/Patterns/Floral 1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Preference/preference.npref: -------------------------------------------------------------------------------- 1 | 4096,4096,20,C:\NoraOutput.tga,Default -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/brushPreview.fs: -------------------------------------------------------------------------------- 1 | #version 140 2 | in vec2 textureUV; 3 | out vec4 color; 4 | 5 | uniform sampler2D _BrushTexture; 6 | uniform float _BrushOffset; 7 | uniform float _BrushStrength; 8 | uniform vec3 _BrushColour; 9 | uniform int _UseTexture; 10 | 11 | void main() 12 | { 13 | if(_UseTexture == 0) 14 | { 15 | float val = texture(_BrushTexture, textureUV).r; 16 | 17 | float rim = step(sin(textureUV.x * 3.141), 0.15); 18 | rim += step(sin(textureUV.y * 3.141), 0.15); 19 | 20 | if(rim > 0) 21 | { 22 | color = vec4(1.0 -_BrushColour,0.4); 23 | } 24 | else 25 | { 26 | val = pow(val, _BrushOffset * 0.1); 27 | color = vec4(val * _BrushColour, (rim > 0 ? rim : val) * _BrushStrength); 28 | } 29 | } 30 | else 31 | { 32 | float dist = distance(vec2(0.5, 0.5), textureUV); 33 | float t = 1.0 - clamp( dist * 2, 0.0, 1.0); 34 | t = clamp(t * _BrushOffset, 0.0, 1.0); 35 | vec3 col2 = vec3(1,0,1); 36 | color = vec4(_BrushColour, t * _BrushStrength); 37 | color = mix(color, vec4(1.0 - color.rgb, 0.2), step(dist,0.5) - step(dist,0.45)); 38 | } 39 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/frameBuffer.fs: -------------------------------------------------------------------------------- 1 | #version 140 2 | in vec2 textureUV; 3 | in vec3 worldPos; 4 | out vec4 color; 5 | uniform sampler2D textureOne; 6 | 7 | void main() 8 | { 9 | color = texture(textureOne, textureUV); 10 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/gridLines.fs: -------------------------------------------------------------------------------- 1 | #version 140 2 | out vec4 FragColor; 3 | 4 | in vec3 FragPos; 5 | in vec2 TexCoords; 6 | in float Depth; 7 | 8 | uniform float _CameraZoom; 9 | 10 | void main() 11 | { 12 | vec2 coord = TexCoords * 100; 13 | vec2 grid = abs(fract(coord - 0.5) - 0.5) / fwidth(coord * 10); 14 | float line = 1.0 - min(grid.x, grid.y); 15 | FragColor = vec4(line, line, line, (1.0 - (Depth * 0.02)) * line); 16 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/gridLines.vs: -------------------------------------------------------------------------------- 1 | #version 140 2 | in vec3 aPos; 3 | in vec3 aNormal; 4 | in vec2 aTexCoords; 5 | in vec3 aTangent; 6 | in vec3 aBitangent; 7 | 8 | out vec3 FragPos; 9 | out vec3 Normal; 10 | out vec2 TexCoords; 11 | out float Depth; 12 | 13 | uniform mat4 model; 14 | uniform mat4 view; 15 | uniform mat4 projection; 16 | 17 | void main() 18 | { 19 | FragPos = vec3(model * vec4(aPos, 1.0)); 20 | Normal = mat3(transpose(inverse(model))) * aNormal; 21 | TexCoords = aTexCoords; 22 | gl_Position = projection * view * vec4(FragPos, 1.0); 23 | Depth = gl_Position.z; 24 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/modelAttribsDisplay.fs: -------------------------------------------------------------------------------- 1 | #version 150 2 | out vec4 FragColor; 3 | 4 | in vec3 AttribColour; 5 | 6 | void main() 7 | { 8 | FragColor = vec4(AttribColour.rgb, 1.0); 9 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/modelAttribsDisplay.gs: -------------------------------------------------------------------------------- 1 | #version 150 2 | layout (triangles) in; 3 | layout (line_strip, max_vertices = 2) out; 4 | 5 | in vec3 FragPos[]; 6 | in vec3 Normal[]; 7 | in mat3 TBN[]; 8 | 9 | out vec3 AttribColour; 10 | 11 | uniform bool _ShowNormals; 12 | uniform float _NormalsLength; 13 | 14 | void main() 15 | { 16 | vec3 a = vec3(gl_in[0].gl_Position) - vec3(gl_in[1].gl_Position); 17 | vec3 b = vec3(gl_in[2].gl_Position) - vec3(gl_in[1].gl_Position); 18 | 19 | vec4 midPoint = (gl_in[0].gl_Position + gl_in[1].gl_Position + gl_in[2].gl_Position)/3.0; 20 | vec3 avgNormal = normalize(cross(a, b)) * ((_ShowNormals)? 1.0 : 0.0); 21 | 22 | AttribColour = vec3(0,1,0); 23 | 24 | gl_Position = midPoint; 25 | EmitVertex(); 26 | gl_Position = midPoint + vec4(avgNormal, 0.0) * _NormalsLength; 27 | EmitVertex(); 28 | EndPrimitive(); 29 | 30 | /*AttribColour = vec3(0,1,0); 31 | gl_Position = midPoint; 32 | EmitVertex(); 33 | gl_Position = midPoint + vec4(TBN[0][0],0.0) * _NormalsLength; 34 | EmitVertex(); 35 | EndPrimitive();*/ 36 | 37 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/modelAttribsDisplay.vs: -------------------------------------------------------------------------------- 1 | #version 150 2 | in vec3 aPos; 3 | in vec3 aNormal; 4 | in vec2 aTexCoords; 5 | in vec3 aTangent; 6 | in vec3 aBitangent; 7 | 8 | out vec3 FragPos; 9 | out vec3 Normal; 10 | out mat3 TBN; 11 | 12 | uniform mat4 model; 13 | uniform mat4 view; 14 | uniform mat4 projection; 15 | 16 | void main() 17 | { 18 | vec3 _aPos = aPos + aNormal * 0.01; 19 | FragPos = (model * vec4(_aPos, 1.0)).xyz; 20 | Normal = (model * view * vec4(aNormal,0.0)).xyz; 21 | 22 | vec3 T = (model * vec4(aTangent,0.0)).xyz; 23 | vec3 N = (model * vec4(aNormal, 0.0)).xyz; 24 | T = normalize(T - dot(T, N) * N); 25 | vec3 B = (model * vec4(aBitangent, 0.0)).xyz; 26 | 27 | TBN = mat3(T, B, N); 28 | 29 | gl_Position = projection * view * vec4(FragPos, 1.0); 30 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/modelView.vs: -------------------------------------------------------------------------------- 1 | #version 150 2 | in vec3 aPos; 3 | in vec3 aNormal; 4 | in vec2 aTexCoords; 5 | in vec3 aTangent; 6 | in vec3 aBitangent; 7 | 8 | out vec3 FragPos; 9 | out vec3 Normal; 10 | out vec2 TexCoords; 11 | out mat3 TBN; 12 | 13 | uniform mat4 model; 14 | uniform mat4 view; 15 | uniform mat4 projection; 16 | 17 | void main() 18 | { 19 | FragPos = (model * vec4(aPos, 1.0)).xyz; 20 | Normal = (model * view * vec4(aNormal,0.0)).xyz; 21 | TexCoords = aTexCoords; 22 | 23 | vec3 T = (model * vec4(aTangent,0.0)).xyz; 24 | vec3 N = (model * vec4(aNormal, 0.0)).xyz; 25 | T = normalize(T - dot(T, N) * N); 26 | vec3 B = (model * vec4(aBitangent, 0.0)).xyz;//cross(N, T); 27 | 28 | TBN = mat3(T, B, N); 29 | 30 | gl_Position = projection * view * vec4(FragPos, 1.0); 31 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/normalPanel.vs: -------------------------------------------------------------------------------- 1 | #version 140 2 | in vec2 vertexPosition; 3 | in vec2 texCoords; 4 | out vec2 textureUV; 5 | out vec3 worldPos; 6 | uniform mat4 model; 7 | void main() 8 | { 9 | gl_Position = model * vec4(vertexPosition.xy,0,1.0); 10 | worldPos = gl_Position.xyz; 11 | textureUV = texCoords; 12 | gl_Position.z = 0; 13 | gl_Position.w = 1.0; 14 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Shaders/windowChrome.fs: -------------------------------------------------------------------------------- 1 | #version 140 2 | in vec2 textureUV; 3 | in vec3 worldPos; 4 | out vec4 color; 5 | uniform sampler2D textureOne; 6 | uniform vec3 _chromeColour; 7 | 8 | void main() 9 | { 10 | vec4 texCol = texture(textureOne, textureUV); 11 | color = texCol + vec4(_chromeColour.rgb, 1.0); 12 | } -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_bk.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_bk.tga -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_dn.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_dn.tga -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_ft.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_ft.tga -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_lf.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_lf.tga -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_rt.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_rt.tga -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_up.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Cubemaps/Sahara Desert Cubemap/sahara_up.tga -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/chrome.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/copper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/copper.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/orange flame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/orange flame.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/organic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/organic1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/organic3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/organic3.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/organic4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/organic4.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/outline1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/outline1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/outline2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/outline2.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/plastic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/plastic1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/plastic2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/plastic2.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/plastic3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/plastic3.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/platinum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/platinum.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/red metal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/red metal.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/skin1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/skin1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/skin2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/skin2.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Matcaps/view space normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Matcaps/view space normal.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/Normal Maps/sample normal 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/Normal Maps/sample normal 1.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/clearView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/clearView.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/closeIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/closeIcon.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/icon.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/maxWinIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/maxWinIcon.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/maximizePreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/maximizePreview.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/minWinIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/minWinIcon.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/resetLocation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/resetLocation.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/toTrayIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/toTrayIcon.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/UI/toggleFullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/UI/toggleFullscreen.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/wall diffuse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/wall diffuse.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/wall height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/wall height.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Textures/wall specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/Resources/Textures/wall specular.png -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Themes/Blue Ice.nort: -------------------------------------------------------------------------------- 1 | # Nora theme file :- Blue Ice 2 | # Author :- Joseph Kalathil 3 | # This is a comment, You have 12 colours to play with 4 | 5 | PrimaryColour : (0.2, 0.5, 0.6, 1.1); 6 | TitleColour : (0.2, 0.4, 0.5, 1.1); 7 | SecondaryColour : (0.2, 0.3, 0.4, 1.1); 8 | AccentColour1 : (0.1, 0.2, 0.3, 1.1); 9 | AccentColour2 : (1.0, 1.0, 1.0, 1.1); 10 | AccentColour3 : (0.9, 0.9, 0.9, 1.1); 11 | ActiveColour1 : (0.93, 0.93, 0.93, 0.80); 12 | DisabledColour1 : (0.6, 0.6, 0.6, 1.00); 13 | ActiveColour2 : (0.6, 0.6, 0.8, 1.00); 14 | DisabledColour2 : (0.6, 0.6, 0.6, 0.78); 15 | Sate1Colour : (0.10, 0.10, 0.80, 0.46); 16 | Sate2Colour : (0.8, 0.8, 0.8, 0.97); 17 | Sate3Colour : (0.0, 0.0, 0.0, 0.2); -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Themes/Green Mint.nort: -------------------------------------------------------------------------------- 1 | # Nora theme file :- Blue Ice 2 | # Author :- Joseph Kalathil 3 | # This is a comment, You have 12 colours to play with 4 | 5 | PrimaryColour : (0.15, 0.15, 0.15, 1.1); 6 | TitleColour : (0.13, 0.13, 0.13, 1.1); 7 | SecondaryColour : (0.55, 0.75, 0.25, 1.1); 8 | AccentColour1 : (0.25, 0.25, 0.25, 1.1); 9 | AccentColour2 : (0.85, 1.0, 0.85, 1.1); 10 | AccentColour3 : (0.9, 0.9, 0.9, 1.1); 11 | ActiveColour1 : (0.93, 0.93, 0.93, 0.80); 12 | DisabledColour1 : (0.6, 0.6, 0.6, 1.00); 13 | ActiveColour2 : (0.6, 0.6, 0.6, 1.00); 14 | DisabledColour2 : (0.6, 0.6, 0.6, 0.78); 15 | Sate1Colour : (0.80, 0.80, 0.80, 0.46); 16 | Sate2Colour : (0.8, 0.8, 0.8, 0.67); 17 | Sate3Colour : (0.0, 0.0, 0.0, 0.6); -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Themes/Orange Juice.nort: -------------------------------------------------------------------------------- 1 | # Nora theme file :- Orange Juice 2 | # Author :- Joseph Kalathil 3 | # This is a comment, You have 12 colours to play with 4 | 5 | PrimaryColour : (0.85, 0.5, 0.3, 1.1); 6 | TitleColour : (0.85, 0.5, 0.25, 1.1); 7 | SecondaryColour : (0.65, 0.25, 0.25, 1.1); 8 | AccentColour1 : (0.2, 0.1, 0.1, 1.1); 9 | AccentColour2 : (0.97, 0.83, 0.43, 1.1); 10 | AccentColour3 : (0.9, 0.9, 0.9, 1.1); 11 | ActiveColour1 : (0.93, 0.93, 0.93, 0.80); 12 | DisabledColour1 : (0.6, 0.6, 0.6, 1.00); 13 | ActiveColour2 : (0.6, 0.6, 0.6, 1.00); 14 | DisabledColour2 : (0.6, 0.6, 0.6, 0.78); 15 | Sate1Colour : (0.80, 0.80, 0.80, 0.46); 16 | Sate2Colour : (0.8, 0.8, 0.8, 0.67); 17 | Sate3Colour : (0.0, 0.0, 0.0, 0.6); -------------------------------------------------------------------------------- /NormalMapGeneratorTool/Resources/Themes/Ultra Violet.nort: -------------------------------------------------------------------------------- 1 | # Nora theme file :- Ultra Violet 2 | # Author :- Joseph Kalathil 3 | # This is a comment, You have 12 colours to play with 4 | 5 | PrimaryColour : (0.15, 0.0, 0.2, 1.1); 6 | TitleColour : (0.18, 0.0, 0.22, 1.1); 7 | SecondaryColour : (0.45, 0.1, 0.5, 1.1); 8 | AccentColour1 : (0.1, 0.0, 0.1, 1.1); 9 | AccentColour2 : (0.8, 0.7, 1.0, 1.1); 10 | AccentColour3 : (0.9, 0.9, 0.9, 1.1); 11 | ActiveColour1 : (0.93, 0.93, 0.93, 0.80); 12 | DisabledColour1 : (0.6, 0.6, 0.6, 1.00); 13 | ActiveColour2 : (0.6, 0.6, 0.6, 1.00); 14 | DisabledColour2 : (0.6, 0.6, 0.6, 0.78); 15 | Sate1Colour : (0.80, 0.80, 0.80, 0.46); 16 | Sate2Colour : (0.8, 0.8, 0.8, 0.67); 17 | Sate3Colour : (0.0, 0.0, 0.0, 0.6); -------------------------------------------------------------------------------- /NormalMapGeneratorTool/assimp.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/assimp.dll -------------------------------------------------------------------------------- /NormalMapGeneratorTool/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/NormalMapGeneratorTool/glew32.dll -------------------------------------------------------------------------------- /NormalMapGeneratorTool/imgui.ini: -------------------------------------------------------------------------------- 1 | [Window][Debug##Default] 2 | Pos=600,200 3 | Size=400,400 4 | Collapsed=0 5 | 6 | [Window][ImGui Demo] 7 | Pos=53,435 8 | Size=1289,895 9 | Collapsed=0 10 | 11 | [Window][Operators] 12 | Pos=60,60 13 | Size=468,103 14 | Collapsed=0 15 | 16 | [Window][Hierarchy Panel] 17 | Pos=0,0 18 | Size=250,1054 19 | Collapsed=0 20 | 21 | [Window][Settings] 22 | Pos=0,42 23 | Size=280,723 24 | Collapsed=0 25 | 26 | [Window][##Settings] 27 | Pos=0,0 28 | Size=250,1054 29 | Collapsed=0 30 | 31 | [Window][File Settings] 32 | Pos=0,100 33 | Size=300,300 34 | Collapsed=0 35 | 36 | [Window][Lol] 37 | Pos=50,50 38 | Size=300,400 39 | Collapsed=0 40 | 41 | [Window][Style Editor] 42 | Pos=569,163 43 | Size=371,244 44 | Collapsed=0 45 | 46 | [Window][Example: Custom rendering] 47 | Pos=585,195 48 | Size=645,610 49 | Collapsed=0 50 | 51 | [Window][Example: Console] 52 | Pos=511,78 53 | Size=520,600 54 | Collapsed=0 55 | 56 | [Window][Bottom_Bar] 57 | Pos=0,765 58 | Size=1600,50 59 | Collapsed=0 60 | 61 | [Window][Side_Bar] 62 | Pos=1595,42 63 | Size=32,733 64 | Collapsed=0 65 | 66 | [Window][Preview_Bar] 67 | Pos=1300,42 68 | Size=300,723 69 | Collapsed=0 70 | 71 | [Window][Example: Layout] 72 | Pos=60,60 73 | Size=500,440 74 | Collapsed=0 75 | 76 | [Window][Same title as another window##1] 77 | Pos=100,100 78 | Size=395,70 79 | Collapsed=0 80 | 81 | [Window][Same title as another window##2] 82 | Pos=617,453 83 | Size=395,70 84 | Collapsed=0 85 | 86 | [Window][###AnimatedTitle] 87 | Pos=276,313 88 | Size=226,54 89 | Collapsed=0 90 | 91 | [Window][About Dear ImGui] 92 | Pos=60,60 93 | Size=538,98 94 | Collapsed=0 95 | 96 | [Window][Example: Log] 97 | Pos=60,60 98 | Size=500,400 99 | Collapsed=0 100 | 101 | [Window][ImGui Metrics] 102 | Pos=63,61 103 | Size=406,224 104 | Collapsed=0 105 | 106 | [Window][Layer_Panel] 107 | Pos=1300,42 108 | Size=300,723 109 | Collapsed=0 110 | 111 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Resource.rc 4 | // 5 | #define IDI_ICON1 103 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NO_MFC 1 12 | #define _APS_NEXT_RESOURCE_VALUE 104 13 | #define _APS_NEXT_COMMAND_VALUE 40001 14 | #define _APS_NEXT_CONTROL_VALUE 1001 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/BrushData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "TextureData.h" 3 | struct BrushData 4 | { 5 | float brushScale = 25.0f; 6 | float brushOffset = 0.25f; 7 | float brushStrength = 1.0f; 8 | float brushMinHeight = 0.0f; 9 | float brushMaxHeight = 1.0f; 10 | float brushRate = 0.0f; 11 | bool heightMapPositiveDir = false; 12 | TextureData textureData; 13 | 14 | bool operator!= (const BrushData &bD) 15 | { 16 | if (brushScale != bD.brushScale || brushOffset != bD.brushOffset || 17 | brushStrength != bD.brushStrength || brushMinHeight != bD.brushMinHeight || 18 | brushMaxHeight != bD.brushMaxHeight || brushRate != bD.brushRate || 19 | heightMapPositiveDir != bD.heightMapPositiveDir || &textureData != &bD.textureData) 20 | { 21 | return true; 22 | } 23 | return false; 24 | } 25 | 26 | bool hasBrushTexture()const noexcept 27 | { 28 | return textureData.getTextureData() != nullptr; 29 | } 30 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/Camera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "Transform.h" 5 | 6 | class Camera 7 | { 8 | public: 9 | Camera(); 10 | ~Camera(); 11 | void init(const glm::vec2& screenDimensions)noexcept; 12 | void init(float dimensionX, float dimensionY) noexcept; 13 | void setScale(float newScale)noexcept; 14 | const float& getScale()const noexcept; 15 | const glm::mat4& getOrthoMatrix()const noexcept; 16 | bool isObjectInCameraView(const glm::vec2 & position, const glm::vec2& dimensions)const noexcept; 17 | void setScreenRatio(const glm::vec2& screenDimension) noexcept; 18 | const glm::vec2 convertScreenPointToWorldPoint(const glm::vec2& screenPosition, const glm::vec2& screenDimensions) noexcept; 19 | private: 20 | glm::vec2 screenDimensions; 21 | bool needsUpdate; 22 | Transform* transform; 23 | Transform previousTransformData; 24 | glm::mat4 orthographicMatrix; 25 | glm::mat4 viewMatrix; 26 | float scale; 27 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ColourData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | struct ColourData 4 | { 5 | private: 6 | glm::vec4 colour; 7 | public: 8 | //Default white 9 | ColourData() noexcept 10 | { 11 | colour = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f); 12 | } 13 | //Takes input in 32 bit space 14 | ColourData(float r, float g, float b, float a) 15 | { 16 | colour = glm::vec4(r, g, b, a); 17 | } 18 | void setColour_8_Bit(const glm::vec4& colour) 19 | { 20 | const int r = glm::clamp(static_cast(colour.r), 0, 255); 21 | const int g = glm::clamp(static_cast(colour.g), 0, 255); 22 | const int b = glm::clamp(static_cast(colour.b), 0, 255); 23 | const int a = glm::clamp(static_cast(colour.a), 0, 255); 24 | this->colour = glm::vec4(r, g, b, a); 25 | } 26 | void setColour_8_Bit(unsigned char r, unsigned char g, unsigned char b, unsigned char a) 27 | { 28 | const float _r = r / 255.0f; 29 | const float _g = g / 255.0f; 30 | const float _b = b / 255.0f; 31 | const float _a = a / 255.0f; 32 | this->colour = glm::vec4(_r, _g, _b, _a); 33 | } 34 | void setColour_32_bit(const glm::vec4& colour)noexcept 35 | { 36 | this->colour = colour; 37 | } 38 | void setColour_32_bit(float r, float g, float b, float a) 39 | { 40 | this->colour = glm::vec4(r, g, b, a); 41 | } 42 | const glm::vec4 getColour_32_Bit() const noexcept 43 | { 44 | return colour; 45 | } 46 | const glm::vec4 getColour_8_Bit() const 47 | { 48 | const unsigned char rV = static_cast(colour.r * 255.0f); 49 | const unsigned char gV = static_cast(colour.g * 255.0f); 50 | const unsigned char bV = static_cast(colour.b * 255.0f); 51 | const unsigned char aV = static_cast(colour.a * 255.0f); 52 | return glm::vec4(rV, gV, bV, aV); 53 | } 54 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/DrawingPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Transform.h" 3 | #include 4 | class DrawingPanel 5 | { 6 | public: 7 | DrawingPanel(); 8 | ~DrawingPanel(); 9 | //Initialize drawing panel with certain resolution 10 | void init(float width, float height) noexcept; 11 | Transform* getTransform() noexcept; 12 | //Set which texture is linked to this drawing panel 13 | void setTextureID(unsigned int textureID, bool deleteAndReplace = true) noexcept; 14 | //Get the texture linked to this drawing panel 15 | unsigned int getTextureID()const noexcept; 16 | bool isPointInPanel(float xpos, float ypos)noexcept; 17 | glm::vec4 getPanelWorldDimension()const noexcept; 18 | void draw(int additionalTextureId = -1)noexcept; 19 | private: 20 | Transform transform; 21 | float width, height; 22 | unsigned int vaoID; 23 | unsigned int vboID; 24 | unsigned int textureID; 25 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/FileExplorer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | enum class FileType 6 | { 7 | IMAGE, TEXT, MODEL, NORA, NONE 8 | }; 9 | 10 | class FileExplorer 11 | { 12 | public: 13 | virtual void display() = 0; 14 | bool doesPathExist(const std::string& path)const noexcept; 15 | std::string getFileExtension(const std::string & path)const; 16 | std::vector getAllFilesInDirectory(const std::string& path, bool withEntirePath, const std::string& fileExt = "", bool includeExtensionInOutput = true)const; 17 | unsigned long getFileSize(const std::string path)const; 18 | }; 19 | 20 | class FileOpenDialog : public FileExplorer 21 | { 22 | public: 23 | static FileOpenDialog* instance; 24 | bool isDirty = true; 25 | bool shouldDisplay = false; 26 | std::string path = "C:\\"; 27 | static void init(); 28 | static void shutDown(); 29 | void display() override; 30 | void displayDialog( FileType filter = FileType::NONE) noexcept; 31 | void displayDialog( FileType filter, std::function func) noexcept; 32 | private: 33 | std::vector paths; 34 | std::vector roots; 35 | std::function functionToCall = nullptr; 36 | FileType fileFilter = FileType::NONE; 37 | bool pathTypeCheck(std::vector endTypes, std::string& _path); 38 | }; 39 | 40 | class FileSaveDialog : public FileExplorer 41 | { 42 | public: 43 | static FileSaveDialog* instance; 44 | bool isDirty = true; 45 | bool shouldDisplay = false; 46 | std::string path = "C:\\"; 47 | static void init(); 48 | static void shutDown(); 49 | void display() override; 50 | void displayDialog(FileType filter, std::function func) noexcept; 51 | private: 52 | std::vector paths; 53 | std::vector roots; 54 | std::function functionToCall = nullptr; 55 | FileType fileFilter = FileType::NONE; 56 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/FrameBufferSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | class FrameBufferSystem 4 | { 5 | private: 6 | unsigned int framebuffer = 0; 7 | unsigned int textureColorbuffer = 0; 8 | unsigned int textureDepthBuffer = 0; 9 | static unsigned int currentlyBoundFBO; 10 | public: 11 | FrameBufferSystem(); 12 | //Initialize frame buffer with certain resolution 13 | void init(const glm::ivec2& windowRes, const glm::ivec2& maxBufferResolution); 14 | //Initialize frame buffer with certain resolution 15 | void init(int windowWidth, int windowHeight, int maxBufferWidth, int maxBufferHeight); 16 | //Make the this the new bound frame buffer 17 | void bindFrameBuffer() const noexcept; 18 | //Bind the colour buffer texture which is linked with the framebuffer 19 | void bindColourTexture() noexcept; 20 | //Get colour buffer texture 21 | unsigned int getColourTexture()const noexcept; 22 | //Bind the depth buffer texture which is linked with the framebuffer 23 | void bindDepthTexture() noexcept; 24 | //Get depth buffer texture 25 | unsigned int getDepthTexture()const noexcept; 26 | //Change resolution of existing frame buffer 27 | void updateTextureDimensions(int windowWidth, int windowHeight) noexcept; 28 | //Change resolution of existing frame buffer 29 | void updateTextureDimensions(const glm::ivec2 &windowRes) noexcept; 30 | //Get the frame buffer id 31 | unsigned int getFrameBufferId() const; 32 | //Get the FBO that is current bound 33 | static unsigned int getCurrentlyBoundFBO() noexcept; 34 | static void blit(const FrameBufferSystem& source, const FrameBufferSystem& destination, 35 | const glm::ivec2& srcStartCoord, const glm::ivec2& srcEndCoord, const glm::ivec2& destStartCoord, 36 | const glm::ivec2& destEndCoord)noexcept; 37 | static void blit(const FrameBufferSystem& source, const FrameBufferSystem& destination, const glm::ivec2 screenRes)noexcept; 38 | static void bindDefaultFrameBuffer() noexcept; 39 | ~FrameBufferSystem(); 40 | }; 41 | 42 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ImGui/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // ImGui Platform Binding for: GLFW 2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..) 3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Clipboard support. 7 | // [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. 9 | 10 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 11 | // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). 12 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 13 | // https://github.com/ocornut/imgui 14 | 15 | // About GLSL version: 16 | // The 'glsl_version' initialization parameter defaults to "#version 150" if NULL. 17 | // Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure! 18 | 19 | struct GLFWwindow; 20 | 21 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 22 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); 23 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); 24 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); 25 | 26 | // GLFW callbacks (installed by default if you enable 'install_callbacks' during initialization) 27 | // Provided here if you want to chain callbacks. 28 | // You can also handle inputs yourself and use those as a reference. 29 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 30 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 31 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 32 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 33 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ImGui/imgui_impl_opengl2.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline) 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** 8 | // **Prefer using the code in imgui_impl_opengl3.cpp** 9 | // This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read. 10 | // If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more 11 | // complicated, will require your code to reset every single OpenGL attributes to their initial state, and might 12 | // confuse your GPU driver. 13 | // The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API. 14 | 15 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); 16 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); 17 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame(); 18 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data); 19 | 20 | // Called by Init/NewFrame/Shutdown 21 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateFontsTexture(); 22 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyFontsTexture(); 23 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects(); 24 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects(); 25 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/LayerManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "FrameBufferSystem.h" 6 | #include "TextureLoader.h" 7 | #include "ImGui\imgui.h" 8 | 9 | struct LayerInfoData; 10 | enum class LayerType { HEIGHT_MAP = 0, NORMAL_MAP }; 11 | enum class NormalBlendMethod { REORIENTED_NORMAL_BLENDING = 0, UNREAL_NORMAL_BLENDING, PARTIAL_DERIVATIVE_NORMAL_BLENDING }; 12 | 13 | struct LayerInfo 14 | { 15 | unsigned int inputTextureId = 0; 16 | unsigned int outputTextureId = 0; 17 | char* layerName = nullptr; 18 | bool isActive; 19 | float strength; 20 | LayerType layerType = LayerType::HEIGHT_MAP; 21 | NormalBlendMethod normalBlendMethod = NormalBlendMethod::REORIENTED_NORMAL_BLENDING; 22 | FrameBufferSystem fbs; 23 | glm::vec2 resolution; 24 | ImageFormat imageFormat = ImageFormat::UNCOMPRESSED_RAW; 25 | std::string imagePath; 26 | }; 27 | 28 | class LayerManager 29 | { 30 | private: 31 | std::vector layers; 32 | glm::vec2 windowRes; 33 | glm::vec2 maxBufferResolution; 34 | public: 35 | LayerManager() {} 36 | ~LayerManager(); 37 | int getLayerCount()const; 38 | void init(const glm::vec2 & windowRes, const glm::vec2& maxBufferResolution); 39 | void initWithLayerInfoData(const std::vector>& layerInfoData); 40 | void updateLayerTexture(int index, unsigned int textureId); 41 | void addLayer(int texId, LayerType layerType = LayerType::HEIGHT_MAP, const std::string& layerName = "", const std::string& imagePath = ""); 42 | void setLayerActiveState(int index, bool isActive); 43 | NormalBlendMethod getNormalBlendMethod(int index)const; 44 | bool isLayerActive(int index)const; 45 | void updateFramebufferTextureDimensions(const glm::vec2 resolution); 46 | float getLayerStrength(int index)const; 47 | LayerType getLayerType(int index)const; 48 | void bindFrameBuffer(int index); 49 | std::string getImagePath(int index)const; 50 | unsigned int getColourTexture(int index)const; 51 | unsigned int getInputTexId(int index)const; 52 | char* getLayerName(int index)const; 53 | void draw(); 54 | }; 55 | 56 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ModalWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "ModalWindow.h" 2 | 3 | 4 | ModalWindow::ModalWindow() 5 | { 6 | } 7 | void ModalWindow::setTitleFont(ImFont* titleFont) 8 | { 9 | this->titleFont = titleFont; 10 | } 11 | void ModalWindow::setModalDialog(const std::string & title, const std::string & content) 12 | { 13 | this->title = title; 14 | this->content = content; 15 | shouldShow = true; 16 | } 17 | void ModalWindow::display() 18 | { 19 | if (!shouldShow) 20 | return; 21 | ImGui::SetNextWindowSize(ImVec2(400, 200)); 22 | ImGui::OpenPopup("Popup"); 23 | if (ImGui::BeginPopupModal("Popup", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove)) 24 | { 25 | ImGui::PushFont(titleFont); 26 | float xval = ImGui::GetContentRegionAvailWidth()*0.5f - ImGui::CalcTextSize(title.c_str()).x*0.5f; 27 | ImGui::Indent(xval); 28 | ImGui::Text(title.c_str()); 29 | ImGui::PopFont(); 30 | ImGui::Spacing(); 31 | ImGui::Spacing(); 32 | ImGui::Indent(-xval); 33 | ImGui::Separator(); 34 | ImGui::Spacing(); 35 | ImGui::Spacing(); 36 | xval = ImGui::GetContentRegionAvailWidth()*0.5f - ImGui::CalcTextSize(content.c_str()).x*0.5f; 37 | 38 | ImGui::TextWrapped(content.c_str()); 39 | ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); 40 | ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0, 0, 0, 0)); 41 | ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0, 0, 0, 0)); 42 | if (ImGui::Button("##Gap", ImVec2(ImGui::GetContentRegionAvailWidth(), ImGui::GetContentRegionAvail().y - 40))); 43 | ImGui::PopStyleColor(); 44 | ImGui::PopStyleColor(); 45 | ImGui::PopStyleColor(); 46 | if (ImGui::Button("Close", ImVec2(ImGui::GetContentRegionAvailWidth(), 30))) 47 | { 48 | shouldShow = false; 49 | ImGui::CloseCurrentPopup(); 50 | } 51 | ImGui::EndPopup(); 52 | } 53 | } 54 | 55 | ModalWindow::~ModalWindow() 56 | { 57 | } 58 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ModalWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "ImGui\imgui.h" 4 | class ModalWindow 5 | { 6 | private: 7 | std::string title = ""; 8 | std::string content = ""; 9 | ImFont* titleFont = NULL; 10 | bool shouldShow = false; 11 | public: 12 | ModalWindow(); 13 | void setTitleFont(ImFont* menuBarLargerText); 14 | void setModalDialog(const std::string& title, const std::string& content); 15 | void display(); 16 | ~ModalWindow(); 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ModelObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ShaderProgram.h" 3 | class ModelObject 4 | { 5 | private: 6 | bool usesElementBuffer = false; 7 | unsigned int vertexDataCount = 0; 8 | unsigned int indicesCount = 0; 9 | unsigned int VBO = 0, VAO = 0, EBO = 0; 10 | public: 11 | ModelObject(); 12 | ModelObject(float vertexData[], int count); 13 | ModelObject(float vertexData[], int vertexDataCount, unsigned int indices[], int indicesCount); 14 | ~ModelObject(); 15 | 16 | //Provide new data to existing model 17 | void updateMeshData(float vertexData[], int vertexDataCount, unsigned int indices[], int indicesCount); 18 | void draw() const; 19 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/PreferencesHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | struct PreferenceInfo 6 | { 7 | int maxWidthRes, maxHeightRes; 8 | int maxUndoCount; 9 | std::string defaultExportPath; 10 | std::string defaultTheme; 11 | }; 12 | 13 | class PreferencesHandler 14 | { 15 | private: 16 | static std::string m_filePath; 17 | public: 18 | 19 | static void init(const std::string& filePath) 20 | { 21 | m_filePath = filePath; 22 | } 23 | 24 | static void savePreferences(int maxResWidth, int maxResHeight, int maxUndoSteps, const std::string& defaultPath, const std::string& defaultTheme) 25 | { 26 | std::ofstream file; 27 | file.open(m_filePath, std::ios::out | std::ios::trunc); 28 | 29 | if (file.is_open()) 30 | { 31 | file << maxResWidth << "," << maxResHeight << "," << maxUndoSteps << "," << defaultPath << "," << defaultTheme; 32 | file.close(); 33 | } 34 | } 35 | 36 | static void savePreferences(const PreferenceInfo& info) 37 | { 38 | savePreferences(info.maxWidthRes, info.maxHeightRes, info.maxUndoCount, info.defaultExportPath, info.defaultTheme); 39 | } 40 | 41 | static void setDefaults() 42 | { 43 | savePreferences(4096, 4096, 20, "C:\\NoraOutput.tga", "Default"); 44 | } 45 | 46 | static PreferenceInfo readPreferences() 47 | { 48 | std::ifstream file; 49 | file.open(m_filePath); 50 | 51 | std::string finalStr = ""; 52 | if (file.is_open()) 53 | { 54 | std::string line; 55 | while (getline(file, line)) 56 | { 57 | finalStr += line; 58 | } 59 | file.close(); 60 | } 61 | 62 | int indexOfFirstComma = finalStr.find(','); 63 | int indexOfSecondComma = finalStr.find(',', indexOfFirstComma + 1); 64 | int indexOfThirdComma = finalStr.find(',', indexOfSecondComma + 1); 65 | int indexOfFourthComma = finalStr.find(',', indexOfThirdComma + 1); 66 | std::string str1 = finalStr.substr(0, indexOfFirstComma); 67 | std::string str2 = finalStr.substr(indexOfFirstComma + 1, indexOfSecondComma - (indexOfFirstComma + 1)); 68 | std::string str3 = finalStr.substr(indexOfSecondComma + 1, indexOfThirdComma - (indexOfSecondComma + 1)); 69 | std::string str4 = finalStr.substr(indexOfThirdComma + 1, indexOfFourthComma - (indexOfThirdComma + 1)); 70 | std::string str5 = finalStr.substr(indexOfFourthComma + 1); 71 | 72 | PreferenceInfo info; 73 | info.maxWidthRes = std::stoi(str1); 74 | info.maxHeightRes = std::stoi(str2); 75 | info.maxUndoCount = std::stoi(str3); 76 | info.defaultExportPath = str4; 77 | info.defaultTheme = str5; 78 | 79 | return info; 80 | } 81 | }; 82 | std::string PreferencesHandler::m_filePath = ""; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ShaderProgram.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | class ShaderProgram 5 | { 6 | public: 7 | ShaderProgram(); 8 | ~ShaderProgram(); 9 | //Compiler vertex shader and fragment shader 10 | void compileShaders(const std::string& vertexShaderPath, const std::string& fragmentShaderPath); 11 | void compileShaders(const std::string& vertexShaderPath, const std::string& fragmentShaderPath, const std::string& geometryShaderPath); 12 | //Link shaders and create program 13 | void linkShaders(); 14 | void addAttribute(const std::string& attributeName); 15 | void use(); 16 | void unuse(); 17 | int getUniformLocation(const std::string& uniformName)const; 18 | static void applyShaderUniformMatrix(int uniformId, const glm::mat4& matrixValue); 19 | static void applyShaderVector3(int uniformId, const glm::vec3& value); 20 | static void applyShaderFloat(int uniformId, float value); 21 | static void applyShaderInt(int uniformId, int value); 22 | static void applyShaderBool(int uniformId, bool value); 23 | private: 24 | unsigned int programID, vertexShaderID, fragmentShaderID, geometryShaderID; 25 | void compileShader(const std::string& filePath, unsigned int ID); 26 | int attributeCount; 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/Stb/stb_image.cpp: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_IMPLEMENTATION 2 | #include "stb_image.h" -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/Stb/stb_image_write.cpp: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_WRITE_IMPLEMENTATION 2 | #include "stb_image_write.h" -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/TextureData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "ColourData.h" 5 | /*Holds raw data about a texture 6 | Resolution data, Channel count and access to individual pixels are provided 7 | */ 8 | class TextureData 9 | { 10 | private: 11 | unsigned char* data = nullptr; 12 | int width = 0; 13 | int height = 0; 14 | int componentCount = 0; 15 | unsigned int texId = 0; 16 | bool requiresUpdate = false; 17 | public: 18 | TextureData(); 19 | void setTextureDataNonAlloc(unsigned char* data, int width, int height, int componentCount); 20 | void setTextureData(unsigned char* data, int width, int height, int componentCount); 21 | unsigned char* const getTextureData()const; 22 | glm::ivec2 getRes()const noexcept; 23 | int getComponentCount()const noexcept; 24 | void setTexId(unsigned int texId); 25 | unsigned int getTexId()const; 26 | void setTexelColor(int r, int g, int b, int a, int x, int y); 27 | void setTexelColor(ColourData& colourData, int x, int y); 28 | void setTexelRangeWithColour(int beginIndex, int endIndex, ColourData& colourData); 29 | void updateTexture(); 30 | void updateTextureData(unsigned char* data); 31 | ColourData getTexelColor(int x, int y)const noexcept; 32 | ColourData getTexColorAsUV(float x, float y)const noexcept; 33 | //Set the texture as dirty so that it can be updated 34 | void setTextureDirty()noexcept; 35 | void clearRawData(); 36 | 37 | ~TextureData(); 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/TextureLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "TextureData.h" 3 | #include "GLutil.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | enum class ImageFormat { PNG = 100, JPEG, BMP, TGA, UNCOMPRESSED_RAW }; 9 | 10 | class TextureManager 11 | { 12 | public: 13 | TextureManager() = delete; 14 | TextureManager(const TextureManager&) = delete; 15 | static void getRawImageDataFromFile(const std::string& path, std::vector& data, int &width, int &height, bool flipImage); 16 | static void getTextureDataFromFile(const std::string & path, TextureData & textureData); 17 | static glm::ivec2 getImageDimensions(const std::string& path); 18 | static unsigned int createTextureFromFile(const std::string& path, bool linearColourSpace = false, TextureFilterType textureFilterType = TextureFilterType::LINEAR)noexcept; 19 | static unsigned int createCubemapFromFile(const std::vector& paths); 20 | static unsigned int createTextureFromData(const TextureData & textureData, TextureFilterType textureFilterType = TextureFilterType::LINEAR); 21 | static GLenum getTextureFormatFromData(const TextureData & textureData)noexcept; 22 | static GLenum getTextureFormatFromData(int componentCount)noexcept; 23 | static void saveImage(const std::string& path, const glm::ivec2& imageRes, ImageFormat imageFormat, char * data); 24 | static unsigned int createTextureFromColour(const ColourData& colour, TextureFilterType textureFilterType); 25 | }; 26 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/Transform.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | class Transform 4 | { 5 | public: 6 | Transform(const glm::vec2& position, float rotation, const glm::vec2& scale) noexcept; 7 | Transform() noexcept; 8 | Transform(const Transform& copy) noexcept; 9 | const glm::mat4& getMatrix()const; 10 | virtual void start(); 11 | virtual void update(); 12 | void setPosition(const glm::vec2& position); 13 | void setPosition(float xCoord, float yCoord); 14 | void translate(float x, float y); 15 | void setX(float xValue); 16 | void setY(float yValue); 17 | void setRotation(float rotation); 18 | void rotate(float rotation); 19 | void setScale(const glm::vec2& scale); 20 | const glm::vec2& getPosition()const noexcept; 21 | float getRotation()const noexcept; 22 | const glm::vec2& getScale()const noexcept; 23 | bool operator==(const Transform& transform)const noexcept; 24 | bool operator!=(const Transform& transform)const noexcept; 25 | private: 26 | glm::mat4 modelMatrix = glm::mat4(1.0); 27 | glm::vec2 scale = glm::vec2(1.0f, 1.0f); 28 | glm::vec2 position = glm::vec2(0.0f, 0.0f); 29 | float rotation = 0.0f; 30 | bool needsUpdate = true; 31 | void setModelMatrix(); 32 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/UndoRedoSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | class UndoRedoSystem 4 | { 5 | private: 6 | unsigned char* data = nullptr; 7 | unsigned int maxAllocatedMemoryInBytes = 512 * 512 * 4 * 20; //Ex: Can store 20 512 x 512 images of 4 component count (RGBA) 8 | unsigned int bytesPerSection = 512 * 512 * 4; 9 | int currentSection = 0; 10 | int maxSectionsFilled = 0; 11 | public: 12 | UndoRedoSystem(); 13 | UndoRedoSystem(unsigned int maxMemoryToAllocate, unsigned int bytesPerSection); 14 | UndoRedoSystem(const glm::ivec2& sampleImageRes, unsigned int componentCount, unsigned int numberOfUndoSteps); 15 | UndoRedoSystem(const UndoRedoSystem& undoRedo); 16 | void updateAllocation(const glm::ivec2& sampleImageRes, unsigned int componentCount, unsigned int numberOfUndoSteps); 17 | const unsigned int getMaxUndoSteps(); 18 | const unsigned int getCurrentSectionPosition(); 19 | unsigned int getMaxSectionsFilled(); 20 | void record(unsigned char* data); 21 | unsigned char* retrieve(bool grabPrevious = true); 22 | void clear(); 23 | ~UndoRedoSystem(); 24 | }; -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/ViewBasedUtilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | struct PreviewStateUtility 4 | { 5 | public: 6 | float modelPreviewZoomLevel = -5.0f; 7 | float metalness = 0.04f; 8 | float roughness = 0.5f; 9 | int modelViewMode = 3; 10 | bool useMatcap = false; 11 | float lightIntensity = 2.5f; 12 | bool showNormals = false; 13 | bool showGrid = true; 14 | float normDisplayThickness = 4.0f; 15 | float normDisplayLineLength = 0.25f; 16 | glm::vec2 lightLocation = glm::vec2(0.0f, 0.0f); 17 | glm::vec3 diffuseColour = glm::vec3(1, 1, 1); 18 | glm::vec3 lightColour = glm::vec3(1, 1, 1); 19 | }; 20 | struct NormalViewStateUtility 21 | { 22 | public: 23 | float zoomLevel = 1; 24 | int mapDrawViewMode = 1; 25 | float normalMapStrength = 2.0f; 26 | float specularity = 5.0f; 27 | float specularityStrength = 1.0f; 28 | float lightIntensity = 0.5f; 29 | glm::vec3 lightDirection = glm::vec3(90.0f, 90.0f, 220.0f); 30 | bool flipX_Ydir = false; 31 | bool redChannelActive = true; 32 | bool greenChannelActive = true; 33 | bool blueChannelActive = true; 34 | bool methodIndex = false; 35 | glm::vec3 getNormalizedLightDir() { return glm::vec3(lightDirection.x / 180.0f, lightDirection.y / 180.0f, lightDirection.z / 180.0f); } 36 | }; 37 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/WindowSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | class WindowSystem 6 | { 7 | /*Define For Enabling Custom Window Chrome*/ 8 | //#define NORA_CUSTOM_WINDOW_CHROME 9 | private: 10 | const int WINDOW_SIZE_MIN = 640; 11 | 12 | const GLFWvidmode * videoMode = nullptr; 13 | GLFWwindow * window = nullptr; 14 | bool isFullscreen = false; 15 | std::string windowTitle="NIL"; 16 | glm::vec2 windowRes = glm::vec2(1600, 800); 17 | glm::vec2 maxWindowRes = glm::vec2(-1, -1); 18 | public: 19 | WindowSystem(); 20 | void init(const std::string& windowTitle, int windowWidth, int windowHeight); 21 | void setFrameBufferResizeCallback(void(*func)(GLFWwindow*, int, int)); 22 | void setScrollCallback(void(*func)(GLFWwindow*, double, double)); 23 | bool isKeyPressed(int key)const; 24 | bool isKeyReleased(int key)const; 25 | bool isKeyPressedDown(int key)const; 26 | void destroy(); 27 | void close(); 28 | void updateWindow(); 29 | void minimize(); 30 | const GLFWvidmode* getVideoMode(); 31 | const GLFWwindow* getWindow(); 32 | const int getMinWindowSize()const; 33 | void setWindowRes(const glm::ivec2 &res); 34 | void setWindowRes(int windowWidth, int windowHeight); 35 | void setFullscreen(bool isFullscreen); 36 | bool getIfFullscreen()const; 37 | const glm::ivec2 getMaxWindowRes()const; 38 | const glm::ivec2 getWindowRes()const; 39 | glm::ivec2 getWindowPos()const; 40 | glm::ivec2 getCursorPos()const; 41 | void setWindowPos(int x, int y); 42 | float getAspectRatio()const; 43 | bool isWindowClosing()const; 44 | ~WindowSystem(); 45 | }; 46 | 47 | -------------------------------------------------------------------------------- /NormalMapGeneratorTool/src/WindowTransformUtility.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | enum class WindowSide { NONE = -1, LEFT = 0, TOP_LEFT = 1, TOP = 2, TOP_RIGHT = 3, RIGHT = 4, BOTTOM_RIGHT = 5, BOTTOM = 6, BOTTOM_LEFT = 7, CENTER = 8 }; 3 | class WindowTransformUtility 4 | { 5 | public: 6 | static const int BORDER_SIZE = 5; 7 | 8 | static WindowSide getWindowSideBorderAtMouseCoord(const glm::ivec2 &curPos, const glm::ivec2 &winRes) 9 | { 10 | return getWindowSideBorderAtMouseCoord(curPos.x, curPos.y, winRes.x, winRes.y); 11 | } 12 | 13 | static WindowSide getWindowSideBorderAtMouseCoord(int mouseX, int mouseY, int windowWidth, int windowHeight) 14 | { 15 | if (mouseX < BORDER_SIZE) 16 | { 17 | if (mouseY <= BORDER_SIZE) 18 | return WindowSide::TOP_LEFT; 19 | else if (mouseY > windowHeight - BORDER_SIZE) 20 | return WindowSide::BOTTOM_LEFT; 21 | return WindowSide::LEFT; 22 | } 23 | else if (mouseX > windowWidth - BORDER_SIZE) 24 | { 25 | if (mouseY <= BORDER_SIZE) 26 | return WindowSide::TOP_RIGHT; 27 | else if (mouseY > windowHeight - BORDER_SIZE) 28 | return WindowSide::BOTTOM_RIGHT; 29 | return WindowSide::RIGHT; 30 | } 31 | else if (mouseY < BORDER_SIZE) 32 | { 33 | return WindowSide::TOP; 34 | } 35 | else if (mouseY > windowHeight - BORDER_SIZE) 36 | { 37 | return WindowSide::BOTTOM; 38 | } 39 | else 40 | return WindowSide::NONE; 41 | } 42 | 43 | static WindowSide getWindowAreaAtMouseCoord(int mouseX, int mouseY, int windowWidth, int windowHeight) 44 | { 45 | float vpMouseX = mouseX / (float)windowWidth; 46 | float vpMouseY = mouseY / (float)windowHeight; 47 | 48 | const float sideBoundAsPerc = 325.0f / windowWidth; 49 | 50 | if (vpMouseX > sideBoundAsPerc && vpMouseX < 1.0f - sideBoundAsPerc) 51 | { 52 | return WindowSide::CENTER; 53 | } 54 | else 55 | { 56 | if (vpMouseX > 0.0f && vpMouseX <= sideBoundAsPerc) 57 | return WindowSide::LEFT; 58 | else if (vpMouseX >= 1.0f - sideBoundAsPerc && vpMouseX <= 1.0f) 59 | return WindowSide::RIGHT; 60 | } 61 | return WindowSide::NONE; 62 | } 63 | }; -------------------------------------------------------------------------------- /includes/GLM/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/common.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_common.hpp" 7 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/GLM/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/josephbk117/Normal-Map-Generator-Tool/442968d48c3594f8aed8b6df43932577cd4c2873/includes/GLM/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/GLM/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/GLM/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /includes/GLM/exponential.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/exponential.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_exponential.hpp" 7 | -------------------------------------------------------------------------------- /includes/GLM/geometric.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/geometric.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_geometric.hpp" 7 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/GLM/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/GLM/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/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 | -------------------------------------------------------------------------------- /includes/GLM/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_normal GLM_GTX_normal 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Compute the normal of a triangle. 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_normal extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_normal 26 | /// @{ 27 | 28 | //! Computes triangle normal from triangle points. 29 | //! From GLM_GTX_normal extension. 30 | template 31 | GLM_FUNC_DECL tvec3 triangleNormal( 32 | tvec3 const & p1, 33 | tvec3 const & p2, 34 | tvec3 const & p3); 35 | 36 | /// @} 37 | }//namespace glm 38 | 39 | #include "normal.inl" 40 | -------------------------------------------------------------------------------- /includes/GLM/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 triangleNormal 8 | ( 9 | tvec3 const & p1, 10 | tvec3 const & p2, 11 | tvec3 const & p3 12 | ) 13 | { 14 | return normalize(cross(p1 - p2, p1 - p3)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /includes/GLM/gtx/normalize_dot.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_fast_square_root (dependence) 6 | /// 7 | /// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Dot product of vectors that need to be normalize with a single square root. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../gtx/fast_square_root.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_normalize_dot extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_normalize_dot 26 | /// @{ 27 | 28 | /// Normalize parameters and returns the dot product of x and y. 29 | /// It's faster that dot(normalize(x), normalize(y)). 30 | /// 31 | /// @see gtx_normalize_dot extension. 32 | template class vecType> 33 | GLM_FUNC_DECL T normalizeDot(vecType const & x, vecType const & y); 34 | 35 | /// Normalize parameters and returns the dot product of x and y. 36 | /// Faster that dot(fastNormalize(x), fastNormalize(y)). 37 | /// 38 | /// @see gtx_normalize_dot extension. 39 | template class vecType> 40 | GLM_FUNC_DECL T fastNormalizeDot(vecType const & x, vecType const & y); 41 | 42 | /// @} 43 | }//namespace glm 44 | 45 | #include "normalize_dot.inl" 46 | -------------------------------------------------------------------------------- /includes/GLM/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.inl 3 | 4 | namespace glm 5 | { 6 | template class vecType> 7 | GLM_FUNC_QUALIFIER T normalizeDot(vecType const & x, vecType const & y) 8 | { 9 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 10 | } 11 | 12 | template class vecType> 13 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType const & x, vecType const & y) 14 | { 15 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 16 | } 17 | }//namespace glm 18 | -------------------------------------------------------------------------------- /includes/GLM/gtx/number_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | /// @file glm/gtx/number_precision.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_type_precision (dependence) 6 | /// @see gtc_quaternion (dependence) 7 | /// 8 | /// @defgroup gtx_number_precision GLM_GTX_number_precision 9 | /// @ingroup gtx 10 | /// 11 | /// @brief Defined size types. 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../glm.hpp" 19 | #include "../gtc/type_precision.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_number_precision extension included") 23 | #endif 24 | 25 | namespace glm{ 26 | namespace gtx 27 | { 28 | ///////////////////////////// 29 | // Unsigned int vector types 30 | 31 | /// @addtogroup gtx_number_precision 32 | /// @{ 33 | 34 | typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 35 | typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 36 | typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 37 | typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 38 | 39 | ////////////////////// 40 | // Float vector types 41 | 42 | typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) 43 | typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) 44 | 45 | ////////////////////// 46 | // Float matrix types 47 | 48 | typedef f32 f32mat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) 49 | typedef f32 f32mat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) 50 | typedef f64 f64mat1; //!< \brief Double-precision floating-point scalar. (from GLM_GTX_number_precision extension) 51 | typedef f64 f64mat1x1; //!< \brief Double-precision floating-point scalar. (from GLM_GTX_number_precision extension) 52 | 53 | /// @} 54 | }//namespace gtx 55 | }//namespace glm 56 | 57 | #include "number_precision.inl" 58 | -------------------------------------------------------------------------------- /includes/GLM/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | /// @file glm/gtx/number_precision.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /includes/GLM/gtx/optimum_pow.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_optimum_pow GLM_GTX_optimum_pow 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Integer exponentiation of power functions. 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_optimum_pow extension included") 20 | #endif 21 | 22 | namespace glm{ 23 | namespace gtx 24 | { 25 | /// @addtogroup gtx_optimum_pow 26 | /// @{ 27 | 28 | /// Returns x raised to the power of 2. 29 | /// 30 | /// @see gtx_optimum_pow 31 | template 32 | GLM_FUNC_DECL genType pow2(genType const & x); 33 | 34 | /// Returns x raised to the power of 3. 35 | /// 36 | /// @see gtx_optimum_pow 37 | template 38 | GLM_FUNC_DECL genType pow3(genType const & x); 39 | 40 | /// Returns x raised to the power of 4. 41 | /// 42 | /// @see gtx_optimum_pow 43 | template 44 | GLM_FUNC_DECL genType pow4(genType const & x); 45 | 46 | /// @} 47 | }//namespace gtx 48 | }//namespace glm 49 | 50 | #include "optimum_pow.inl" 51 | -------------------------------------------------------------------------------- /includes/GLM/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType pow2(genType const & x) 8 | { 9 | return x * x; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType pow3(genType const & x) 14 | { 15 | return x * x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow4(genType const & x) 20 | { 21 | return (x * x) * (x * x); 22 | } 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /includes/GLM/gtx/orthonormalize.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Orthonormalize matrices. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../vec3.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../geometric.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_orthonormalize 28 | /// @{ 29 | 30 | /// Returns the orthonormalized matrix of m. 31 | /// 32 | /// @see gtx_orthonormalize 33 | template 34 | GLM_FUNC_DECL tmat3x3 orthonormalize(tmat3x3 const & m); 35 | 36 | /// Orthonormalizes x according y. 37 | /// 38 | /// @see gtx_orthonormalize 39 | template 40 | GLM_FUNC_DECL tvec3 orthonormalize(tvec3 const & x, tvec3 const & y); 41 | 42 | /// @} 43 | }//namespace glm 44 | 45 | #include "orthonormalize.inl" 46 | -------------------------------------------------------------------------------- /includes/GLM/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat3x3 orthonormalize(tmat3x3 const & m) 8 | { 9 | tmat3x3 r = m; 10 | 11 | r[0] = normalize(r[0]); 12 | 13 | T d0 = dot(r[0], r[1]); 14 | r[1] -= r[0] * d0; 15 | r[1] = normalize(r[1]); 16 | 17 | T d1 = dot(r[1], r[2]); 18 | d0 = dot(r[0], r[2]); 19 | r[2] -= r[0] * d0 + r[1] * d1; 20 | r[2] = normalize(r[2]); 21 | 22 | return r; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER tvec3 orthonormalize(tvec3 const & x, tvec3 const & y) 27 | { 28 | return normalize(x - y * dot(y, x)); 29 | } 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /includes/GLM/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_projection (dependence) 6 | /// 7 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Perpendicular of a vector from other one 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/projection.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_perpendicular 27 | /// @{ 28 | 29 | //! Projects x a perpendicular axis of Normal. 30 | //! From GLM_GTX_perpendicular extension. 31 | template 32 | GLM_FUNC_DECL vecType perp( 33 | vecType const & x, 34 | vecType const & Normal); 35 | 36 | /// @} 37 | }//namespace glm 38 | 39 | #include "perpendicular.inl" 40 | -------------------------------------------------------------------------------- /includes/GLM/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vecType perp 8 | ( 9 | vecType const & x, 10 | vecType const & Normal 11 | ) 12 | { 13 | return x - proj(x, Normal); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /includes/GLM/gtx/polar_coordinates.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Conversion from Euclidean space to polar space and revert. 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_polar_coordinates extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_polar_coordinates 25 | /// @{ 26 | 27 | /// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 28 | /// 29 | /// @see gtx_polar_coordinates 30 | template 31 | GLM_FUNC_DECL tvec3 polar( 32 | tvec3 const & euclidean); 33 | 34 | /// Convert Polar to Euclidean coordinates. 35 | /// 36 | /// @see gtx_polar_coordinates 37 | template 38 | GLM_FUNC_DECL tvec3 euclidean( 39 | tvec2 const & polar); 40 | 41 | /// @} 42 | }//namespace glm 43 | 44 | #include "polar_coordinates.inl" 45 | -------------------------------------------------------------------------------- /includes/GLM/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 polar 8 | ( 9 | tvec3 const & euclidean 10 | ) 11 | { 12 | T const Length(length(euclidean)); 13 | tvec3 const tmp(euclidean / Length); 14 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 15 | 16 | return tvec3( 17 | asin(tmp.y), // latitude 18 | atan(tmp.x, tmp.z), // longitude 19 | xz_dist); // xz distance 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER tvec3 euclidean 24 | ( 25 | tvec2 const & polar 26 | ) 27 | { 28 | T const latitude(polar.x); 29 | T const longitude(polar.y); 30 | 31 | return tvec3( 32 | cos(latitude) * sin(longitude), 33 | sin(latitude), 34 | cos(latitude) * cos(longitude)); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /includes/GLM/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_projection GLM_GTX_projection 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Projection of a vector to other one 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../geometric.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_projection extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_projection 25 | /// @{ 26 | 27 | /// Projects x on Normal. 28 | /// 29 | /// @see gtx_projection 30 | template 31 | GLM_FUNC_DECL vecType proj(vecType const & x, vecType const & Normal); 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "projection.inl" 37 | -------------------------------------------------------------------------------- /includes/GLM/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vecType proj(vecType const & x, vecType const & Normal) 8 | { 9 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 10 | } 11 | }//namespace glm 12 | -------------------------------------------------------------------------------- /includes/GLM/gtx/range.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_range 2 | /// @file glm/gtx/range.hpp 3 | /// @author Joshua Moerman 4 | /// 5 | /// @defgroup gtx_range GLM_GTX_range 6 | /// @ingroup gtx 7 | /// 8 | /// @brief Defines begin and end for vectors and matrices. Useful for range-based for loop. 9 | /// The range is defined over the elements, not over columns or rows (e.g. mat4 has 16 elements). 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | 18 | #if !GLM_HAS_RANGE_FOR 19 | # error "GLM_GTX_range requires C++11 suppport or 'range for'" 20 | #endif 21 | 22 | #include "../gtc/type_ptr.hpp" 23 | #include "../gtc/vec1.hpp" 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_range 28 | /// @{ 29 | 30 | template 31 | inline length_t components(tvec1 const & v) 32 | { 33 | return v.length(); 34 | } 35 | 36 | template 37 | inline length_t components(tvec2 const & v) 38 | { 39 | return v.length(); 40 | } 41 | 42 | template 43 | inline length_t components(tvec3 const & v) 44 | { 45 | return v.length(); 46 | } 47 | 48 | template 49 | inline length_t components(tvec4 const & v) 50 | { 51 | return v.length(); 52 | } 53 | 54 | template 55 | inline length_t components(genType const & m) 56 | { 57 | return m.length() * m[0].length(); 58 | } 59 | 60 | template 61 | inline typename genType::value_type const * begin(genType const & v) 62 | { 63 | return value_ptr(v); 64 | } 65 | 66 | template 67 | inline typename genType::value_type const * end(genType const & v) 68 | { 69 | return begin(v) + components(v); 70 | } 71 | 72 | template 73 | inline typename genType::value_type * begin(genType& v) 74 | { 75 | return value_ptr(v); 76 | } 77 | 78 | template 79 | inline typename genType::value_type * end(genType& v) 80 | { 81 | return begin(v) + components(v); 82 | } 83 | 84 | /// @} 85 | }//namespace glm 86 | -------------------------------------------------------------------------------- /includes/GLM/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Projection of a vector to other one 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | #include "../detail/type_int.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_raw_data extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_raw_data 26 | /// @{ 27 | 28 | //! Type for byte numbers. 29 | //! From GLM_GTX_raw_data extension. 30 | typedef detail::uint8 byte; 31 | 32 | //! Type for word numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint16 word; 35 | 36 | //! Type for dword numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint32 dword; 39 | 40 | //! Type for qword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint64 qword; 43 | 44 | /// @} 45 | }// namespace glm 46 | 47 | #include "raw_data.inl" 48 | -------------------------------------------------------------------------------- /includes/GLM/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.inl 3 | -------------------------------------------------------------------------------- /includes/GLM/gtx/rotate_normalized_axis.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_rotate_normalized_axis 2 | /// @file glm/gtx/rotate_normalized_axis.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_matrix_transform 6 | /// @see gtc_quaternion 7 | /// 8 | /// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis 9 | /// @ingroup gtx 10 | /// 11 | /// @brief Quaternions and matrices rotations around normalized axis. 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../glm.hpp" 19 | #include "../gtc/epsilon.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_rotate_normalized_axis extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_rotate_normalized_axis 29 | /// @{ 30 | 31 | /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. 32 | /// 33 | /// @param m Input matrix multiplied by this rotation matrix. 34 | /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. 35 | /// @param axis Rotation axis, must be normalized. 36 | /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. 37 | /// 38 | /// @see gtx_rotate_normalized_axis 39 | /// @see - rotate(T angle, T x, T y, T z) 40 | /// @see - rotate(tmat4x4 const & m, T angle, T x, T y, T z) 41 | /// @see - rotate(T angle, tvec3 const & v) 42 | template 43 | GLM_FUNC_DECL tmat4x4 rotateNormalizedAxis( 44 | tmat4x4 const & m, 45 | T const & angle, 46 | tvec3 const & axis); 47 | 48 | /// Rotates a quaternion from a vector of 3 components normalized axis and an angle. 49 | /// 50 | /// @param q Source orientation 51 | /// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise. 52 | /// @param axis Normalized axis of the rotation, must be normalized. 53 | /// 54 | /// @see gtx_rotate_normalized_axis 55 | template 56 | GLM_FUNC_DECL tquat rotateNormalizedAxis( 57 | tquat const & q, 58 | T const & angle, 59 | tvec3 const & axis); 60 | 61 | /// @} 62 | }//namespace glm 63 | 64 | #include "rotate_normalized_axis.inl" 65 | -------------------------------------------------------------------------------- /includes/GLM/gtx/rotate_normalized_axis.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_rotate_normalized_axis 2 | /// @file glm/gtx/rotate_normalized_axis.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat4x4 rotateNormalizedAxis 8 | ( 9 | tmat4x4 const & m, 10 | T const & angle, 11 | tvec3 const & v 12 | ) 13 | { 14 | T const a = angle; 15 | T const c = cos(a); 16 | T const s = sin(a); 17 | 18 | tvec3 const axis(v); 19 | 20 | tvec3 const temp((static_cast(1) - c) * axis); 21 | 22 | tmat4x4 Rotate(uninitialize); 23 | Rotate[0][0] = c + temp[0] * axis[0]; 24 | Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2]; 25 | Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1]; 26 | 27 | Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2]; 28 | Rotate[1][1] = c + temp[1] * axis[1]; 29 | Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0]; 30 | 31 | Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1]; 32 | Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0]; 33 | Rotate[2][2] = c + temp[2] * axis[2]; 34 | 35 | tmat4x4 Result(uninitialize); 36 | Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2]; 37 | Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2]; 38 | Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2]; 39 | Result[3] = m[3]; 40 | return Result; 41 | } 42 | 43 | template 44 | GLM_FUNC_QUALIFIER tquat rotateNormalizedAxis 45 | ( 46 | tquat const & q, 47 | T const & angle, 48 | tvec3 const & v 49 | ) 50 | { 51 | tvec3 const Tmp(v); 52 | 53 | T const AngleRad(angle); 54 | T const Sin = sin(AngleRad * T(0.5)); 55 | 56 | return q * tquat(cos(AngleRad * static_cast(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); 57 | //return gtc::quaternion::cross(q, tquat(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin)); 58 | } 59 | }//namespace glm 60 | -------------------------------------------------------------------------------- /includes/GLM/gtx/scalar_multiplication.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx 2 | /// @file glm/gtx/scalar_multiplication.hpp 3 | /// @author Joshua Moerman 4 | /// 5 | /// @brief Enables scalar multiplication for all types 6 | /// 7 | /// Since GLSL is very strict about types, the following (often used) combinations do not work: 8 | /// double * vec4 9 | /// int * vec4 10 | /// vec4 / int 11 | /// So we'll fix that! Of course "float * vec4" should remain the same (hence the enable_if magic) 12 | 13 | #pragma once 14 | 15 | #include "../detail/setup.hpp" 16 | 17 | #if !GLM_HAS_TEMPLATE_ALIASES && !(GLM_COMPILER & GLM_COMPILER_GCC) 18 | # error "GLM_GTX_scalar_multiplication requires C++11 support or alias templates and if not support for GCC" 19 | #endif 20 | 21 | #include "../vec2.hpp" 22 | #include "../vec3.hpp" 23 | #include "../vec4.hpp" 24 | #include "../mat2x2.hpp" 25 | #include 26 | 27 | namespace glm 28 | { 29 | template 30 | using return_type_scalar_multiplication = typename std::enable_if< 31 | !std::is_same::value // T may not be a float 32 | && std::is_arithmetic::value, Vec // But it may be an int or double (no vec3 or mat3, ...) 33 | >::type; 34 | 35 | #define GLM_IMPLEMENT_SCAL_MULT(Vec) \ 36 | template \ 37 | return_type_scalar_multiplication \ 38 | operator*(T const & s, Vec rh){ \ 39 | return rh *= static_cast(s); \ 40 | } \ 41 | \ 42 | template \ 43 | return_type_scalar_multiplication \ 44 | operator*(Vec lh, T const & s){ \ 45 | return lh *= static_cast(s); \ 46 | } \ 47 | \ 48 | template \ 49 | return_type_scalar_multiplication \ 50 | operator/(Vec lh, T const & s){ \ 51 | return lh *= 1.0f / s; \ 52 | } 53 | 54 | GLM_IMPLEMENT_SCAL_MULT(vec2) 55 | GLM_IMPLEMENT_SCAL_MULT(vec3) 56 | GLM_IMPLEMENT_SCAL_MULT(vec4) 57 | 58 | GLM_IMPLEMENT_SCAL_MULT(mat2) 59 | GLM_IMPLEMENT_SCAL_MULT(mat2x3) 60 | GLM_IMPLEMENT_SCAL_MULT(mat2x4) 61 | GLM_IMPLEMENT_SCAL_MULT(mat3x2) 62 | GLM_IMPLEMENT_SCAL_MULT(mat3) 63 | GLM_IMPLEMENT_SCAL_MULT(mat3x4) 64 | GLM_IMPLEMENT_SCAL_MULT(mat4x2) 65 | GLM_IMPLEMENT_SCAL_MULT(mat4x3) 66 | GLM_IMPLEMENT_SCAL_MULT(mat4) 67 | 68 | #undef GLM_IMPLEMENT_SCAL_MULT 69 | } // namespace glm 70 | -------------------------------------------------------------------------------- /includes/GLM/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational 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_scalar_relational 25 | /// @{ 26 | 27 | 28 | 29 | /// @} 30 | }//namespace glm 31 | 32 | #include "scalar_relational.inl" 33 | -------------------------------------------------------------------------------- /includes/GLM/gtx/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool lessThan 8 | ( 9 | T const & x, 10 | T const & y 11 | ) 12 | { 13 | return x < y; 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER bool lessThanEqual 18 | ( 19 | T const & x, 20 | T const & y 21 | ) 22 | { 23 | return x <= y; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER bool greaterThan 28 | ( 29 | T const & x, 30 | T const & y 31 | ) 32 | { 33 | return x > y; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER bool greaterThanEqual 38 | ( 39 | T const & x, 40 | T const & y 41 | ) 42 | { 43 | return x >= y; 44 | } 45 | 46 | template 47 | GLM_FUNC_QUALIFIER bool equal 48 | ( 49 | T const & x, 50 | T const & y 51 | ) 52 | { 53 | return x == y; 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER bool notEqual 58 | ( 59 | T const & x, 60 | T const & y 61 | ) 62 | { 63 | return x != y; 64 | } 65 | 66 | GLM_FUNC_QUALIFIER bool any 67 | ( 68 | bool const & x 69 | ) 70 | { 71 | return x; 72 | } 73 | 74 | GLM_FUNC_QUALIFIER bool all 75 | ( 76 | bool const & x 77 | ) 78 | { 79 | return x; 80 | } 81 | 82 | GLM_FUNC_QUALIFIER bool not_ 83 | ( 84 | bool const & x 85 | ) 86 | { 87 | return !x; 88 | } 89 | }//namespace glm 90 | -------------------------------------------------------------------------------- /includes/GLM/gtx/spline.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_spline 2 | /// @file glm/gtx/spline.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_spline GLM_GTX_spline 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Spline functions 10 | /// 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_spline extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_spline 26 | /// @{ 27 | 28 | /// Return a point from a catmull rom curve. 29 | /// @see gtx_spline extension. 30 | template 31 | GLM_FUNC_DECL genType catmullRom( 32 | genType const & v1, 33 | genType const & v2, 34 | genType const & v3, 35 | genType const & v4, 36 | typename genType::value_type const & s); 37 | 38 | /// Return a point from a hermite curve. 39 | /// @see gtx_spline extension. 40 | template 41 | GLM_FUNC_DECL genType hermite( 42 | genType const & v1, 43 | genType const & t1, 44 | genType const & v2, 45 | genType const & t2, 46 | typename genType::value_type const & s); 47 | 48 | /// Return a point from a cubic curve. 49 | /// @see gtx_spline extension. 50 | template 51 | GLM_FUNC_DECL genType cubic( 52 | genType const & v1, 53 | genType const & v2, 54 | genType const & v3, 55 | genType const & v4, 56 | typename genType::value_type const & s); 57 | 58 | /// @} 59 | }//namespace glm 60 | 61 | #include "spline.inl" 62 | -------------------------------------------------------------------------------- /includes/GLM/gtx/spline.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_spline 2 | /// @file glm/gtx/spline.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType catmullRom 8 | ( 9 | genType const & v1, 10 | genType const & v2, 11 | genType const & v3, 12 | genType const & v4, 13 | typename genType::value_type const & s 14 | ) 15 | { 16 | typename genType::value_type s1 = s; 17 | typename genType::value_type s2 = pow2(s); 18 | typename genType::value_type s3 = pow3(s); 19 | 20 | typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s; 21 | typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2); 22 | typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s; 23 | typename genType::value_type f4 = s3 - s2; 24 | 25 | return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2); 26 | 27 | } 28 | 29 | template 30 | GLM_FUNC_QUALIFIER genType hermite 31 | ( 32 | genType const & v1, 33 | genType const & t1, 34 | genType const & v2, 35 | genType const & t2, 36 | typename genType::value_type const & s 37 | ) 38 | { 39 | typename genType::value_type s1 = s; 40 | typename genType::value_type s2 = pow2(s); 41 | typename genType::value_type s3 = pow3(s); 42 | 43 | typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1); 44 | typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2; 45 | typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s; 46 | typename genType::value_type f4 = s3 - s2; 47 | 48 | return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER genType cubic 53 | ( 54 | genType const & v1, 55 | genType const & v2, 56 | genType const & v3, 57 | genType const & v4, 58 | typename genType::value_type const & s 59 | ) 60 | { 61 | return ((v1 * s + v2) * s + v3) * s + v4; 62 | } 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /includes/GLM/gtx/std_based_type.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_std_based_type GLM_GTX_std_based_type 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Adds vector types based on STL value types. 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_std_based_type extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_std_based_type 26 | /// @{ 27 | 28 | /// Vector type based of one std::size_t component. 29 | /// @see GLM_GTX_std_based_type 30 | typedef tvec1 size1; 31 | 32 | /// Vector type based of two std::size_t components. 33 | /// @see GLM_GTX_std_based_type 34 | typedef tvec2 size2; 35 | 36 | /// Vector type based of three std::size_t components. 37 | /// @see GLM_GTX_std_based_type 38 | typedef tvec3 size3; 39 | 40 | /// Vector type based of four std::size_t components. 41 | /// @see GLM_GTX_std_based_type 42 | typedef tvec4 size4; 43 | 44 | /// Vector type based of one std::size_t component. 45 | /// @see GLM_GTX_std_based_type 46 | typedef tvec1 size1_t; 47 | 48 | /// Vector type based of two std::size_t components. 49 | /// @see GLM_GTX_std_based_type 50 | typedef tvec2 size2_t; 51 | 52 | /// Vector type based of three std::size_t components. 53 | /// @see GLM_GTX_std_based_type 54 | typedef tvec3 size3_t; 55 | 56 | /// Vector type based of four std::size_t components. 57 | /// @see GLM_GTX_std_based_type 58 | typedef tvec4 size4_t; 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "std_based_type.inl" 64 | -------------------------------------------------------------------------------- /includes/GLM/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /includes/GLM/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_string_cast 2 | /// @file glm/gtx/string_cast.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtx_integer (dependence) 7 | /// @see gtx_quaternion (dependence) 8 | /// 9 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 10 | /// @ingroup gtx 11 | /// 12 | /// @brief Setup strings for GLM type values 13 | /// 14 | /// need to be included to use these functionalities. 15 | /// This extension is not supported with CUDA 16 | 17 | #pragma once 18 | 19 | // Dependency: 20 | #include "../glm.hpp" 21 | #include "../gtc/type_precision.hpp" 22 | #include "../gtc/quaternion.hpp" 23 | #include "../gtx/dual_quaternion.hpp" 24 | #include 25 | 26 | #if(GLM_COMPILER & GLM_COMPILER_CUDA) 27 | # error "GLM_GTX_string_cast is not supported on CUDA compiler" 28 | #endif 29 | 30 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 31 | # pragma message("GLM: GLM_GTX_string_cast extension included") 32 | #endif 33 | 34 | namespace glm 35 | { 36 | /// @addtogroup gtx_string_cast 37 | /// @{ 38 | 39 | /// Create a string from a GLM vector or matrix typed variable. 40 | /// @see gtx_string_cast extension. 41 | template