├── .gitignore ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── base ├── ApplicationContext.cpp ├── ApplicationContext.h ├── CMakeLists.txt ├── UIOverlay.cpp ├── UIOverlay.h ├── VulkanApplication.cpp ├── VulkanApplication.h ├── VulkanContext.cpp ├── VulkanContext.h ├── VulkanTools.cpp ├── VulkanTools.h ├── compilers │ ├── dxc.cpp │ └── dxc.hpp ├── interfaces │ ├── DeviceResource.cpp │ └── DeviceResource.h ├── loaders │ ├── glTF.cpp │ └── glTF.h ├── platforms │ ├── Android.cpp │ └── Android.h ├── utilities │ ├── ActorManager.cpp │ ├── ActorManager.h │ ├── AssetManager.cpp │ ├── AssetManager.h │ ├── AudioManager.cpp │ ├── AudioManager.h │ ├── Camera.hpp │ ├── CommandLineParser.hpp │ ├── FileWatcher.hpp │ ├── Frustum.hpp │ ├── Initializers.hpp │ ├── Keycodes.hpp │ └── Threadpool.hpp └── wrappers │ ├── Buffer.hpp │ ├── CommandBuffer.hpp │ ├── CommandPool.hpp │ ├── DescriptorPool.hpp │ ├── DescriptorSet.hpp │ ├── DescriptorSetLayout.hpp │ ├── Device.hpp │ ├── Image.hpp │ ├── ImageView.hpp │ ├── Pipeline.hpp │ ├── PipelineLayout.hpp │ ├── Sampler.hpp │ ├── SwapChain.hpp │ └── Texture.hpp ├── data ├── Robot-Medium-license.txt ├── Roboto-Medium.ttf └── shaders │ ├── CMakeLists.txt │ ├── base │ ├── overlay.frag.hlsl │ └── overlay.vert.hlsl │ ├── filtercube.vert.hlsl │ ├── filtercube_irradiance.frag.hlsl │ ├── filtercube_radiance.frag.hlsl │ ├── fullscreen.frag.hlsl │ ├── fullscreen.vert.hlsl │ ├── gltf.frag.hlsl │ ├── gltf.vert.hlsl │ ├── playership.vert.hlsl │ ├── skybox.frag.hlsl │ └── skybox.vert.hlsl ├── external ├── dxc │ └── dxcapi.h ├── glm │ ├── .gitignore │ ├── .travis.yml │ ├── CMakeLists.txt │ ├── cmake │ │ ├── glm.pc.in │ │ ├── glmBuildConfig.cmake.in │ │ └── glmConfig.cmake.in │ ├── 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_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_encoding.hpp │ │ │ ├── color_encoding.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 │ │ │ ├── exterior_product.hpp │ │ │ ├── exterior_product.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_factorisation.hpp │ │ │ ├── matrix_factorisation.inl │ │ │ ├── matrix_interpolation.hpp │ │ │ ├── matrix_interpolation.inl │ │ │ ├── matrix_major_storage.hpp │ │ │ ├── matrix_major_storage.inl │ │ │ ├── matrix_operation.hpp │ │ │ ├── matrix_operation.inl │ │ │ ├── matrix_query.hpp │ │ │ ├── matrix_query.inl │ │ │ ├── matrix_transform_2d.hpp │ │ │ ├── matrix_transform_2d.inl │ │ │ ├── mixed_product.hpp │ │ │ ├── mixed_product.inl │ │ │ ├── norm.hpp │ │ │ ├── norm.inl │ │ │ ├── normal.hpp │ │ │ ├── normal.inl │ │ │ ├── normalize_dot.hpp │ │ │ ├── normalize_dot.inl │ │ │ ├── number_precision.hpp │ │ │ ├── number_precision.inl │ │ │ ├── optimum_pow.hpp │ │ │ ├── optimum_pow.inl │ │ │ ├── orthonormalize.hpp │ │ │ ├── orthonormalize.inl │ │ │ ├── perpendicular.hpp │ │ │ ├── perpendicular.inl │ │ │ ├── polar_coordinates.hpp │ │ │ ├── polar_coordinates.inl │ │ │ ├── projection.hpp │ │ │ ├── projection.inl │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl │ │ │ ├── range.hpp │ │ │ ├── raw_data.hpp │ │ │ ├── raw_data.inl │ │ │ ├── rotate_normalized_axis.hpp │ │ │ ├── rotate_normalized_axis.inl │ │ │ ├── rotate_vector.hpp │ │ │ ├── rotate_vector.inl │ │ │ ├── scalar_multiplication.hpp │ │ │ ├── scalar_relational.hpp │ │ │ ├── scalar_relational.inl │ │ │ ├── spline.hpp │ │ │ ├── spline.inl │ │ │ ├── std_based_type.hpp │ │ │ ├── std_based_type.inl │ │ │ ├── string_cast.hpp │ │ │ ├── string_cast.inl │ │ │ ├── transform.hpp │ │ │ ├── transform.inl │ │ │ ├── transform2.hpp │ │ │ ├── transform2.inl │ │ │ ├── type_aligned.hpp │ │ │ ├── type_aligned.inl │ │ │ ├── type_trait.hpp │ │ │ ├── type_trait.inl │ │ │ ├── vec_swizzle.hpp │ │ │ ├── vector_angle.hpp │ │ │ ├── vector_angle.inl │ │ │ ├── vector_query.hpp │ │ │ ├── vector_query.inl │ │ │ ├── wrap.hpp │ │ │ └── wrap.inl │ │ ├── integer.hpp │ │ ├── mat2x2.hpp │ │ ├── mat2x3.hpp │ │ ├── mat2x4.hpp │ │ ├── mat3x2.hpp │ │ ├── mat3x3.hpp │ │ ├── mat3x4.hpp │ │ ├── mat4x2.hpp │ │ ├── mat4x3.hpp │ │ ├── mat4x4.hpp │ │ ├── matrix.hpp │ │ ├── packing.hpp │ │ ├── simd │ │ │ ├── common.h │ │ │ ├── exponential.h │ │ │ ├── geometric.h │ │ │ ├── integer.h │ │ │ ├── matrix.h │ │ │ ├── packing.h │ │ │ ├── platform.h │ │ │ ├── trigonometric.h │ │ │ └── vector_relational.h │ │ ├── trigonometric.hpp │ │ ├── vec2.hpp │ │ ├── vec3.hpp │ │ ├── vec4.hpp │ │ └── vector_relational.hpp │ ├── manual.md │ └── readme.md ├── imgui │ ├── LICENSE.txt │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_internal.h │ ├── imgui_widgets.cpp │ ├── imstb_rectpack.h │ ├── imstb_textedit.h │ └── imstb_truetype.h ├── ktx │ ├── LICENSE.md │ ├── NOTICE.md │ ├── README.md │ ├── include │ │ ├── ktx.h │ │ └── ktxvulkan.h │ ├── lib │ │ ├── checkheader.c │ │ ├── errstr.c │ │ ├── etcdec.cxx │ │ ├── etcunpack.cxx │ │ ├── filestream.c │ │ ├── filestream.h │ │ ├── gl_format.h │ │ ├── gl_funcptrs.h │ │ ├── gles1_funcptrs.h │ │ ├── gles2_funcptrs.h │ │ ├── gles3_funcptrs.h │ │ ├── glloader.c │ │ ├── hashlist.c │ │ ├── hashtable.c │ │ ├── ktxgl.h │ │ ├── ktxint.h │ │ ├── libktx.gypi │ │ ├── mainpage.md │ │ ├── memstream.c │ │ ├── memstream.h │ │ ├── stream.h │ │ ├── swap.c │ │ ├── texture.c │ │ ├── uthash.h │ │ ├── vk_format.h │ │ ├── vk_funclist.inl │ │ ├── vk_funcs.c │ │ ├── vk_funcs.h │ │ ├── vkloader.c │ │ ├── writer.c │ │ └── writer_v1.c │ └── other_include │ │ └── KHR │ │ └── khrplatform.h ├── tinygltf │ ├── LICENSE │ ├── README.md │ ├── json.hpp │ ├── stb_image.h │ └── tiny_gltf.h ├── tracy │ ├── LICENSE │ ├── TracyClient.cpp │ ├── client │ │ ├── TracyAlloc.cpp │ │ ├── TracyArmCpuTable.hpp │ │ ├── TracyCallstack.cpp │ │ ├── TracyCallstack.h │ │ ├── TracyCallstack.hpp │ │ ├── TracyCpuid.hpp │ │ ├── TracyDebug.hpp │ │ ├── TracyDxt1.cpp │ │ ├── TracyDxt1.hpp │ │ ├── TracyFastVector.hpp │ │ ├── TracyKCore.cpp │ │ ├── TracyKCore.hpp │ │ ├── TracyLock.hpp │ │ ├── TracyOverride.cpp │ │ ├── TracyProfiler.cpp │ │ ├── TracyProfiler.hpp │ │ ├── TracyRingBuffer.hpp │ │ ├── TracyScoped.hpp │ │ ├── TracyStringHelpers.hpp │ │ ├── TracySysPower.cpp │ │ ├── TracySysPower.hpp │ │ ├── TracySysTime.cpp │ │ ├── TracySysTime.hpp │ │ ├── TracySysTrace.cpp │ │ ├── TracySysTrace.hpp │ │ ├── TracyThread.hpp │ │ ├── tracy_SPSCQueue.h │ │ ├── tracy_concurrentqueue.h │ │ ├── tracy_rpmalloc.cpp │ │ └── tracy_rpmalloc.hpp │ ├── common │ │ ├── TracyAlign.hpp │ │ ├── TracyAlloc.hpp │ │ ├── TracyApi.h │ │ ├── TracyColor.hpp │ │ ├── TracyForceInline.hpp │ │ ├── TracyMutex.hpp │ │ ├── TracyProtocol.hpp │ │ ├── TracyQueue.hpp │ │ ├── TracySocket.cpp │ │ ├── TracySocket.hpp │ │ ├── TracyStackFrames.cpp │ │ ├── TracyStackFrames.hpp │ │ ├── TracySystem.cpp │ │ ├── TracySystem.hpp │ │ ├── TracyUwp.hpp │ │ ├── TracyVersion.hpp │ │ ├── TracyYield.hpp │ │ ├── tracy_lz4.cpp │ │ ├── tracy_lz4.hpp │ │ ├── tracy_lz4hc.cpp │ │ └── tracy_lz4hc.hpp │ ├── libbacktrace │ │ ├── LICENSE │ │ ├── alloc.cpp │ │ ├── backtrace.hpp │ │ ├── config.h │ │ ├── dwarf.cpp │ │ ├── elf.cpp │ │ ├── fileline.cpp │ │ ├── filenames.hpp │ │ ├── internal.hpp │ │ ├── macho.cpp │ │ ├── mmapio.cpp │ │ ├── posix.cpp │ │ ├── sort.cpp │ │ └── state.cpp │ └── tracy │ │ ├── Tracy.hpp │ │ ├── TracyC.h │ │ ├── TracyD3D11.hpp │ │ ├── TracyD3D12.hpp │ │ ├── TracyLua.hpp │ │ ├── TracyOpenCL.hpp │ │ ├── TracyOpenGL.hpp │ │ └── TracyVulkan.hpp ├── volk │ ├── CMakeLists.txt │ ├── LICENSE.md │ ├── README.md │ ├── cmake │ │ └── volkConfig.cmake.in │ ├── volk.c │ └── volk.h └── vulkan │ ├── vk_video │ ├── vulkan_video_codec_h264std.h │ ├── vulkan_video_codec_h264std_decode.h │ ├── vulkan_video_codec_h264std_encode.h │ ├── vulkan_video_codec_h265std.h │ ├── vulkan_video_codec_h265std_decode.h │ ├── vulkan_video_codec_h265std_encode.h │ └── vulkan_video_codecs_common.h │ └── vulkan │ ├── vk_platform.h │ ├── vulkan.h │ ├── vulkan_android.h │ ├── vulkan_beta.h │ ├── vulkan_core.h │ ├── vulkan_directfb.h │ ├── vulkan_fuchsia.h │ ├── vulkan_ggp.h │ ├── vulkan_ios.h │ ├── vulkan_macos.h │ ├── vulkan_metal.h │ ├── vulkan_screen.h │ ├── vulkan_vi.h │ ├── vulkan_wayland.h │ ├── vulkan_win32.h │ ├── vulkan_xcb.h │ ├── vulkan_xlib.h │ └── vulkan_xlib_xrandr.h └── src ├── CMakeLists.txt └── main.cpp /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Sascha Willems 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vulkan Template Project 2 | 3 | ## About 4 | 5 | Personal Vulkan Template based on my sample base class, but with several changes, optimizations, etc. 6 | 7 | **Note:** Not guaranteed to work 8 | 9 | Uses 10 | - glm 11 | - ktx 12 | - imgui 13 | - tinygltf 14 | - volk 15 | - dxc 16 | - tracy 17 | - sfml 18 | 19 | Functionality 20 | - dynamic rendering 21 | - hlsl shaders 22 | - hot reload for shaders and assets -------------------------------------------------------------------------------- /base/ApplicationContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | // @todo: do not use, better inject 8 | 9 | #include "ApplicationContext.h" 10 | 11 | ApplicationContext applicationContext{ }; 12 | 13 | AssetManager* ApplicationContext::assetManager{ nullptr }; 14 | -------------------------------------------------------------------------------- /base/ApplicationContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #include "AssetManager.h" 8 | #include "ActorManager.h" 9 | 10 | #pragma once 11 | 12 | class ApplicationContext { 13 | public: 14 | static AssetManager* assetManager; 15 | }; 16 | 17 | extern ApplicationContext applicationContext; -------------------------------------------------------------------------------- /base/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB_RECURSE UTILITIES_SRC "./utilities/*.cpp") 3 | file(GLOB_RECURSE UTILITIES_HEADERS "./utilities/*.hpp" "./utilities/*.h") 4 | 5 | file(GLOB BASE_SRC "*.cpp" "*.hpp" "*.h" "./loaders/*.h" "./loaders/*.cpp" "./compilers/*.hpp" "./compilers/*.cpp" "./interfaces/*.cpp" "./interfaces/*.h" "./platforms/*.cpp" "./wrappers/*.cpp" "./wrappers/*.hpp" "../external/imgui/*.cpp" "../external/volk/volk.c" "../external/tracy/TracyClient.cpp" "./simulation/*.cpp" "./simulation/*.hpp" ${UTILITIES_SRC}) 6 | file(GLOB BASE_HEADERS "*.hpp" "./interfaces/*.h" ${UTILITIES_HEADERS}) 7 | 8 | # libktx 9 | set(KTX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/ktx) 10 | set(KTX_SOURCES 11 | ${KTX_DIR}/lib/texture.c 12 | ${KTX_DIR}/lib/hashlist.c 13 | ${KTX_DIR}/lib/checkheader.c 14 | ${KTX_DIR}/lib/swap.c 15 | ${KTX_DIR}/lib/memstream.c 16 | ${KTX_DIR}/lib/filestream.c 17 | ) 18 | 19 | message(STATUS ${UTILITIES_HEADERS}) 20 | 21 | source_group("ktx" FILES ${KTX_SOURCES}) 22 | source_group("utilities" FILES ${UTILITIES_SRC}) 23 | 24 | # SFML 25 | set(SFML_VERSION "2.6.1") 26 | 27 | FetchContent_Declare( 28 | sfml 29 | GIT_REPOSITORY "https://github.com/SFML/SFML.git" 30 | GIT_TAG "${SFML_VERSION}" 31 | ) 32 | 33 | FetchContent_GetProperties(sfml) 34 | if(NOT sfml_POPULATED) 35 | FetchContent_Populate(sfml) 36 | add_subdirectory(${sfml_SOURCE_DIR} ${sfml_BINARY_DIR}) 37 | endif() 38 | 39 | add_library(base STATIC ${BASE_SRC} ${KTX_SOURCES} ${UTILITIES_SRC}) 40 | if(WIN32) 41 | target_link_libraries(base ${WINLIBS} sfml-audio sfml-system sfml-window) 42 | else(WIN32) 43 | target_link_libraries(base ${XCB_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} sfml-audio sfml-system sfml-window) 44 | endif(WIN32) -------------------------------------------------------------------------------- /base/VulkanContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Vulkan Template 3 | * 4 | * Copyright (C) 2023 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #include "VulkanContext.h" 10 | 11 | VulkanContext vulkanContext{}; 12 | 13 | VkQueue VulkanContext::copyQueue = VK_NULL_HANDLE; 14 | VkQueue VulkanContext::graphicsQueue = VK_NULL_HANDLE; 15 | Device* VulkanContext::device = nullptr; 16 | -------------------------------------------------------------------------------- /base/VulkanContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Vulkan Template 3 | * 4 | * Copyright (C) 2023 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #include "volk.h" 10 | #include "Device.hpp" 11 | 12 | #pragma once 13 | 14 | class VulkanContext { 15 | public: 16 | static VkQueue copyQueue; 17 | static VkQueue graphicsQueue; 18 | static Device* device; 19 | }; 20 | 21 | extern VulkanContext vulkanContext; -------------------------------------------------------------------------------- /base/compilers/dxc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DXC hLSL Compiler abstraction class 3 | * 4 | * Copyright (C) 2023-2024 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include "volk.h" 18 | #include "dxcapi.h" 19 | #include "VulkanContext.h" 20 | 21 | class Dxc { 22 | private: 23 | CComPtr library{ nullptr }; 24 | CComPtr compiler{ nullptr }; 25 | CComPtr utils{ nullptr }; 26 | 27 | std::map shaderStages{ 28 | { ".vert", VK_SHADER_STAGE_VERTEX_BIT }, 29 | { ".frag", VK_SHADER_STAGE_FRAGMENT_BIT } 30 | }; 31 | 32 | std::map targetProfiles{ 33 | { ".vert", L"vs_6_1" }, 34 | { ".frag", L"ps_6_1" } 35 | }; 36 | 37 | std::string fileExtension(const std::string filename); 38 | public: 39 | Dxc(); 40 | VkShaderStageFlagBits getShaderStage(const std::string filename); 41 | VkShaderModule compileShader(const std::string filename); 42 | }; 43 | 44 | extern Dxc* dxcCompiler; -------------------------------------------------------------------------------- /base/interfaces/DeviceResource.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #include "DeviceResource.h" 8 | 9 | DeviceResource::DeviceResource(const std::string name) : name(name) {}; 10 | 11 | void DeviceResource::setDebugName(uint64_t handle, VkObjectType type) { 12 | // @todo: or if validation 13 | if (VulkanContext::device->hasDebugUtils) { 14 | VkDebugUtilsObjectNameInfoEXT objectNameInfo = { 15 | .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, 16 | .objectType = type, 17 | .objectHandle = handle, 18 | .pObjectName = name.c_str() 19 | }; 20 | vkSetDebugUtilsObjectNameEXT(VulkanContext::device->logicalDevice, &objectNameInfo); 21 | } 22 | } -------------------------------------------------------------------------------- /base/interfaces/DeviceResource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include "volk.h" 11 | #include "Device.hpp" 12 | #include "VulkanContext.h" 13 | 14 | class DeviceResource { 15 | public: 16 | std::string name{ "" }; 17 | DeviceResource(const std::string name = ""); 18 | void setDebugName(uint64_t handle, VkObjectType type); 19 | }; -------------------------------------------------------------------------------- /base/platforms/Android.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Android utilities 3 | * 4 | * Copyright (C) 2023 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #include "Android.h" 10 | 11 | #if defined(__ANDROID__) 12 | #include 13 | #include 14 | #include 15 | 16 | android_app* androidApp; 17 | 18 | int32_t vks::android::screenDensity; 19 | 20 | void* libVulkan; 21 | 22 | namespace vks 23 | { 24 | namespace android 25 | { 26 | // Dynamically load Vulkan library and base function pointers 27 | bool loadVulkanLibrary() 28 | { 29 | __android_log_print(ANDROID_LOG_INFO, "vulkanandroid", "Loading libvulkan.so...\n"); 30 | 31 | // Load vulkan library 32 | libVulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); 33 | if (!libVulkan) 34 | { 35 | __android_log_print(ANDROID_LOG_INFO, "vulkanandroid", "Could not load vulkan library : %s!\n", dlerror()); 36 | return false; 37 | } 38 | 39 | return true; 40 | } 41 | 42 | void freeVulkanLibrary() 43 | { 44 | dlclose(libVulkan); 45 | } 46 | 47 | void getDeviceConfig() 48 | { 49 | // Screen density 50 | AConfiguration* config = AConfiguration_new(); 51 | AConfiguration_fromAssetManager(config, androidApp->activity->assetManager); 52 | vks::android::screenDensity = AConfiguration_getDensity(config); 53 | AConfiguration_delete(config); 54 | } 55 | 56 | // Displays a native alert dialog using JNI 57 | void showAlert(const char* message) { 58 | JNIEnv* jni; 59 | androidApp->activity->vm->AttachCurrentThread(&jni, NULL); 60 | 61 | jstring jmessage = jni->NewStringUTF(message); 62 | 63 | jclass clazz = jni->GetObjectClass(androidApp->activity->clazz); 64 | // Signature has to match java implementation (arguments) 65 | jmethodID methodID = jni->GetMethodID(clazz, "showAlert", "(Ljava/lang/String;)V"); 66 | jni->CallVoidMethod(androidApp->activity->clazz, methodID, jmessage); 67 | jni->DeleteLocalRef(jmessage); 68 | 69 | androidApp->activity->vm->DetachCurrentThread(); 70 | return; 71 | } 72 | } 73 | } 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /base/platforms/Android.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Android utilities 3 | * 4 | * Copyright (C) 2023 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #pragma once 10 | 11 | #ifndef VULKANANDROID_H 12 | #define VULKANANDROID_H 13 | 14 | #pragma once 15 | 16 | #ifndef VULKANANDROID_HPP 17 | #define VULKANANDROID_HPP 18 | 19 | #include "volk.h" 20 | 21 | #if defined(__ANDROID__) 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | // Missing from the NDK 30 | namespace std 31 | { 32 | template 33 | std::unique_ptr make_unique(Args&&... args) 34 | { 35 | return std::unique_ptr(new T(std::forward(args)...)); 36 | } 37 | } 38 | 39 | // Global reference to android application object 40 | extern android_app* androidApp; 41 | 42 | #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "vulkanExample", __VA_ARGS__)) 43 | #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "vulkanExample", __VA_ARGS__)) 44 | #define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, "vulkanExample", __VA_ARGS__)) 45 | #define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "vulkanExample", __VA_ARGS__)) 46 | 47 | namespace vks 48 | { 49 | namespace android 50 | { 51 | /* @brief Touch control thresholds from Android NDK samples */ 52 | const int32_t DOUBLE_TAP_TIMEOUT = 300 * 1000000; 53 | const int32_t TAP_TIMEOUT = 180 * 1000000; 54 | const int32_t DOUBLE_TAP_SLOP = 100; 55 | const int32_t TAP_SLOP = 8; 56 | 57 | /** @brief Density of the device screen (in DPI) */ 58 | extern int32_t screenDensity; 59 | 60 | bool loadVulkanLibrary(); 61 | void freeVulkanLibrary(); 62 | void getDeviceConfig(); 63 | void showAlert(const char* message); 64 | } 65 | } 66 | 67 | #endif 68 | 69 | #endif // VULKANANDROID_HPP 70 | 71 | 72 | #endif // VULKANANDROID_H 73 | -------------------------------------------------------------------------------- /base/utilities/ActorManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #include "ActorManager.h" 8 | 9 | Actor* ActorManager::addActor(const std::string name, Actor* actor) { 10 | actors[name] = actor; 11 | return actor; 12 | } 13 | 14 | ActorManager::~ActorManager() { 15 | for (auto& it : actors) { 16 | delete it.second; 17 | } 18 | } 19 | 20 | void Actor::rotate(const glm::vec3 delta) 21 | { 22 | this->rotation += delta; 23 | } 24 | 25 | void Actor::move(const glm::vec3 dir, float deltaT) 26 | { 27 | glm::vec3 camFront; 28 | camFront.x = -cos(glm::radians(rotation.x)) * sin(glm::radians(rotation.y)); 29 | camFront.y = sin(glm::radians(rotation.x)); 30 | camFront.z = cos(glm::radians(rotation.x)) * cos(glm::radians(rotation.y)); 31 | camFront = glm::normalize(camFront); 32 | 33 | const float moveSpeed = 0.005f; 34 | 35 | if (dir.z < 0.0f) { 36 | position += camFront * moveSpeed; 37 | } 38 | if (dir.z > 0.0f) { 39 | position -= camFront * moveSpeed; 40 | } 41 | //if (keys.left) 42 | // position -= glm::normalize(glm::cross(camFront, glm::vec3(0.0f, 1.0f, 0.0f))) * moveSpeed; 43 | //if (keys.right) 44 | // position += glm::normalize(glm::cross(camFront, glm::vec3(0.0f, 1.0f, 0.0f))) * moveSpeed; 45 | } 46 | 47 | void Actor::update(float deltaTime) 48 | { 49 | position = position + constantVelocity * deltaTime; 50 | } 51 | 52 | glm::mat4 Actor::getMatrix() const 53 | { 54 | const glm::mat4 t = glm::translate(glm::mat4(1.0f), position); 55 | glm::mat4 r = glm::rotate(glm::mat4(1.0f), glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); 56 | r = glm::rotate(r, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); 57 | r = glm::rotate(r, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); 58 | const glm::mat4 s = glm::scale(glm::mat4(1.0f), scale); 59 | return t * r * s; 60 | } 61 | 62 | float Actor::getRadius() const 63 | { 64 | glm::vec3 size = (model->dimensions.max - model->dimensions.min) * scale * 1.1f; 65 | float maxsize = std::max(size.x, std::max(size.y, size.z)); 66 | return maxsize / 2.0f; 67 | } 68 | -------------------------------------------------------------------------------- /base/utilities/ActorManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include "glm/glm.hpp" 11 | #include "glTF.h" 12 | 13 | struct ActorCreateInfo { 14 | glm::vec3 position{}; 15 | glm::vec3 rotation{}; 16 | glm::vec3 scale{}; 17 | vkglTF::Model* model{ nullptr }; 18 | std::string tag{ "" }; 19 | glm::vec3 constantVelocity; 20 | }; 21 | 22 | class Actor { 23 | private: 24 | public: 25 | glm::vec3 position{}; 26 | glm::vec3 rotation{}; 27 | glm::vec3 scale{}; 28 | vkglTF::Model* model{ nullptr }; 29 | std::string tag{ "" }; 30 | glm::vec3 constantVelocity{}; 31 | Actor(ActorCreateInfo createInfo) : position(createInfo.position), rotation(createInfo.rotation), scale(createInfo.scale), model(createInfo.model), tag(createInfo.tag), constantVelocity(createInfo.constantVelocity) { }; 32 | void rotate(const glm::vec3 delta); 33 | void move(const glm::vec3 dir, float deltaT); 34 | void update(float deltaTime); 35 | glm::mat4 getMatrix() const; 36 | float getRadius() const; 37 | }; 38 | 39 | class ActorManager { 40 | public: 41 | std::unordered_map actors; 42 | Actor* addActor(const std::string name, Actor* actor); 43 | ~ActorManager(); 44 | }; -------------------------------------------------------------------------------- /base/utilities/AssetManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #include "AssetManager.h" 8 | 9 | AssetManager::~AssetManager() { 10 | for (auto& it : models) { 11 | delete it.second; 12 | } 13 | } 14 | 15 | vkglTF::Model* AssetManager::add(const std::string name, vkglTF::Model* model) { 16 | models[name] = model; 17 | return model; 18 | } 19 | 20 | uint32_t AssetManager::add(const std::string name, vks::Texture2D* texture) 21 | { 22 | textures.push_back(texture); 23 | return static_cast(textures.size() - 1); 24 | } 25 | 26 | uint32_t AssetManager::add(const std::string name, vks::TextureCubeMap* cubemap) 27 | { 28 | textures.push_back(cubemap); 29 | return static_cast(textures.size() - 1); 30 | } 31 | -------------------------------------------------------------------------------- /base/utilities/AssetManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include "glTF.h" 12 | #include "Texture.hpp" 13 | 14 | class AssetManager { 15 | public: 16 | std::unordered_map models{}; 17 | std::vector textures{}; 18 | ~AssetManager(); 19 | vkglTF::Model* add(const std::string name, vkglTF::Model* model); 20 | uint32_t add(const std::string name, vks::Texture2D* texture); 21 | uint32_t add(const std::string name, vks::TextureCubeMap* cubemap); 22 | }; -------------------------------------------------------------------------------- /base/utilities/AudioManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #include "AudioManager.h" 8 | 9 | void AudioManager::AddSoundFile(const std::string name, const std::string filename) 10 | { 11 | auto soundBuffer = new sf::SoundBuffer; 12 | if (soundBuffer->loadFromFile(filename)) { 13 | soundBuffers[name] = soundBuffer; 14 | } else { 15 | std::cout << "Error: Could not load soundfile " << filename << "\n"; 16 | delete soundBuffer; 17 | } 18 | } 19 | 20 | void AudioManager::PlaySnd(const std::string name) 21 | { 22 | sound.setBuffer(*soundBuffers[name]); 23 | sound.play(); 24 | } 25 | 26 | // @todo: cleanup 27 | -------------------------------------------------------------------------------- /base/utilities/AudioManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 by Sascha Willems - www.saschawillems.de 3 | * 4 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // @todo: std::(de)queue? 13 | 14 | #undef PlaySoundA 15 | 16 | class AudioManager { 17 | private: 18 | sf::Sound sound; 19 | public: 20 | std::unordered_map soundBuffers; 21 | void AddSoundFile(const std::string name, const std::string filename); 22 | // Named like this to avoud a WinApi macro (PlaySoundA) 23 | void PlaySnd(const std::string name); 24 | }; -------------------------------------------------------------------------------- /base/wrappers/CommandPool.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Command pool abstraction class 3 | * 4 | * Copyright (C) 2023-2024 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "volk.h" 12 | #include "DeviceResource.h" 13 | #include "VulkanTools.h" 14 | #include "Device.hpp" 15 | 16 | struct CommandPoolCreateInfo { 17 | const std::string name{ "" }; 18 | uint32_t queueFamilyIndex; 19 | VkCommandPoolCreateFlags flags; 20 | }; 21 | 22 | class CommandPool : public DeviceResource { 23 | public: 24 | VkCommandPool handle; 25 | CommandPool(CommandPoolCreateInfo createInfo) : DeviceResource(createInfo.name) { 26 | VkCommandPoolCreateInfo CI = { 27 | .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, 28 | .flags = createInfo.flags, 29 | .queueFamilyIndex = createInfo.queueFamilyIndex, 30 | }; 31 | VK_CHECK_RESULT(vkCreateCommandPool(VulkanContext::device->logicalDevice, &CI, nullptr, &handle)); 32 | setDebugName((uint64_t)handle, VK_OBJECT_TYPE_COMMAND_POOL); 33 | } 34 | ~CommandPool() { 35 | vkDestroyCommandPool(VulkanContext::device->logicalDevice, handle, nullptr); 36 | } 37 | }; -------------------------------------------------------------------------------- /base/wrappers/DescriptorPool.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Descriptor pool abstraction class 3 | * 4 | * Copyright (C) 2023-2024 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include "volk.h" 12 | #include "Initializers.hpp" 13 | #include "VulkanTools.h" 14 | #include "DeviceResource.h" 15 | #include "Device.hpp" 16 | #include "VulkanContext.h" 17 | 18 | struct DescriptorPoolCreateInfo { 19 | const std::string name{ "" }; 20 | uint32_t maxSets; 21 | std::vector poolSizes; 22 | }; 23 | 24 | class DescriptorPool : public DeviceResource { 25 | public: 26 | VkDescriptorPool handle; 27 | 28 | DescriptorPool(DescriptorPoolCreateInfo createInfo) : DeviceResource(createInfo.name) { 29 | assert(createInfo.poolSizes.size() > 0); 30 | assert(createInfo.maxSets > 0); 31 | VkDescriptorPoolCreateInfo CI{}; 32 | CI.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; 33 | CI.poolSizeCount = static_cast(createInfo.poolSizes.size()); 34 | CI.pPoolSizes = createInfo.poolSizes.data(); 35 | CI.maxSets = createInfo.maxSets; 36 | VK_CHECK_RESULT(vkCreateDescriptorPool(VulkanContext::device->logicalDevice, &CI, nullptr, &handle)); 37 | } 38 | 39 | ~DescriptorPool() { 40 | vkDestroyDescriptorPool(VulkanContext::device->logicalDevice, handle, nullptr); 41 | } 42 | }; -------------------------------------------------------------------------------- /base/wrappers/DescriptorSetLayout.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Vulkan descriptor set layout abstraction class 3 | * 4 | * Copyright (C) 2023-2024 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "volk.h" 13 | #include "Initializers.hpp" 14 | #include "VulkanTools.h" 15 | #include "VulkanContext.h" 16 | 17 | struct DescriptorSetLayoutCreateInfo { 18 | bool descriptorIndexing = false; 19 | std::vector bindings; 20 | }; 21 | 22 | class DescriptorSetLayout { 23 | public: 24 | VkDescriptorSetLayout handle = VK_NULL_HANDLE; 25 | 26 | DescriptorSetLayout(DescriptorSetLayoutCreateInfo createInfo) { 27 | VkDescriptorSetLayoutCreateInfo CI = vks::initializers::descriptorSetLayoutCreateInfo(createInfo.bindings.data(), static_cast(createInfo.bindings.size())); 28 | VkDescriptorSetLayoutBindingFlagsCreateInfo setLayoutBindingFlags{}; 29 | setLayoutBindingFlags.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT; 30 | if (createInfo.descriptorIndexing) { 31 | // @todo: Right now only support descriptor index for layout with single binding 32 | assert(createInfo.bindings.size() == 1); 33 | setLayoutBindingFlags.bindingCount = 1; 34 | VkDescriptorBindingFlags descriptorBindingFlags = VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT; 35 | setLayoutBindingFlags.pBindingFlags = &descriptorBindingFlags; 36 | CI.pNext = &setLayoutBindingFlags; 37 | } 38 | VK_CHECK_RESULT(vkCreateDescriptorSetLayout(VulkanContext::device->logicalDevice, &CI, nullptr, &handle)); 39 | } 40 | 41 | ~DescriptorSetLayout() { 42 | vkDestroyDescriptorSetLayout(VulkanContext::device->logicalDevice, handle, nullptr); 43 | } 44 | }; -------------------------------------------------------------------------------- /base/wrappers/ImageView.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Vulkan image view abstraction class 3 | * 4 | * Copyright (C) 2023-2024 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "volk.h" 13 | #include "Initializers.hpp" 14 | #include "VulkanTools.h" 15 | #include "Device.hpp" 16 | #include "Image.hpp" 17 | #include "VulkanContext.h" 18 | 19 | class ImageView { 20 | private: 21 | Image* image = nullptr; 22 | VkImageViewType type; 23 | VkFormat format; 24 | VkImageSubresourceRange range; 25 | VkImageViewType viewTypeFromImage(Image* image) { 26 | switch (image->type) { 27 | case VK_IMAGE_TYPE_1D: 28 | return image->arrayLayers == 1 ? VK_IMAGE_VIEW_TYPE_1D : VK_IMAGE_VIEW_TYPE_1D_ARRAY; 29 | case VK_IMAGE_TYPE_2D: 30 | return image->arrayLayers == 1 ? VK_IMAGE_VIEW_TYPE_2D : VK_IMAGE_VIEW_TYPE_2D_ARRAY; 31 | case VK_IMAGE_TYPE_3D: 32 | return VK_IMAGE_VIEW_TYPE_3D; 33 | default: 34 | return VK_IMAGE_VIEW_TYPE_2D; 35 | // @todo: cubemaps 36 | } 37 | } 38 | public: 39 | VkImageView handle; 40 | 41 | ImageView(Image* image) { 42 | VkImageViewCreateInfo CI{}; 43 | CI.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; 44 | CI.viewType = viewTypeFromImage(image); 45 | CI.format = image->format; 46 | // @todo: from image or argument 47 | CI.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; 48 | CI.subresourceRange.levelCount = image->mipLevels; 49 | CI.subresourceRange.layerCount = image->arrayLayers; 50 | CI.image = image->handle; 51 | VK_CHECK_RESULT(vkCreateImageView(VulkanContext::device->logicalDevice, &CI, nullptr, &handle)); 52 | } 53 | 54 | ~ImageView() { 55 | vkDestroyImageView(VulkanContext::device->logicalDevice, handle, nullptr); 56 | } 57 | 58 | operator VkImageView() const { 59 | return handle; 60 | } 61 | }; -------------------------------------------------------------------------------- /base/wrappers/PipelineLayout.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Vulkan pipeline layout abstraction class 3 | * 4 | * Copyright (C) 2023--2024 by Sascha Willems - www.saschawillems.de 5 | * 6 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "volk.h" 13 | #include "Initializers.hpp" 14 | #include "VulkanTools.h" 15 | #include "Device.hpp" 16 | #include "DescriptorSetLayout.hpp" 17 | 18 | struct PipelineLayoutCreateInfo { 19 | // @todo: Use DescriptorSetLayout 20 | std::vector layouts; 21 | std::vector pushConstantRanges; 22 | }; 23 | 24 | class PipelineLayout { 25 | private: 26 | std::vector layouts; 27 | std::vector pushConstantRanges; 28 | public: 29 | VkPipelineLayout handle = VK_NULL_HANDLE; 30 | 31 | PipelineLayout(PipelineLayoutCreateInfo createInfo) { 32 | layouts = createInfo.layouts; 33 | pushConstantRanges = createInfo.pushConstantRanges; 34 | VkPipelineLayoutCreateInfo CI = vks::initializers::pipelineLayoutCreateInfo(layouts.data(), static_cast(layouts.size())); 35 | CI.pushConstantRangeCount = static_cast(pushConstantRanges.size()); 36 | CI.pPushConstantRanges = pushConstantRanges.data(); 37 | VK_CHECK_RESULT(vkCreatePipelineLayout(VulkanContext::device->logicalDevice, &CI, nullptr, &handle)); 38 | } 39 | 40 | ~PipelineLayout() { 41 | vkDestroyPipelineLayout(VulkanContext::device->logicalDevice, handle, nullptr); 42 | } 43 | 44 | void addPushConstantRange(uint32_t size, uint32_t offset, VkShaderStageFlags stageFlags) { 45 | VkPushConstantRange pushConstantRange{}; 46 | pushConstantRange.stageFlags = stageFlags; 47 | pushConstantRange.offset = offset; 48 | pushConstantRange.size = size; 49 | pushConstantRanges.push_back(pushConstantRange); 50 | } 51 | 52 | VkPushConstantRange getPushConstantRange(uint32_t index) { 53 | assert(index < pushConstantRanges.size()); 54 | return pushConstantRanges[index]; 55 | } 56 | 57 | operator VkPipelineLayout() const { 58 | return handle; 59 | } 60 | }; -------------------------------------------------------------------------------- /data/Robot-Medium-license.txt: -------------------------------------------------------------------------------- 1 | Roboto-Medium.ttf 2 | Apache License 2.0 3 | by Christian Robertson 4 | https://fonts.google.com/specimen/Roboto -------------------------------------------------------------------------------- /data/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaschaWillems/VulkanTemplate/8550b74efde887bd0cf0df33372bcd43046ec96e/data/Roboto-Medium.ttf -------------------------------------------------------------------------------- /data/shaders/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_custom_target(shaders) 2 | file(GLOB_RECURSE SHADER_FILES "*.hlsl" "includes/*.hlsl") 3 | source_group("hlsl" FILES ${SHADER_FILES}) 4 | target_sources(shaders PRIVATE ${SHADER_FILES}) 5 | -------------------------------------------------------------------------------- /data/shaders/base/overlay.frag.hlsl: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Google LLC 2 | 3 | Texture2D fontTexture : register(t0); 4 | SamplerState fontSampler : register(s0); 5 | 6 | struct VSOutput 7 | { 8 | [[vk::location(0)]]float2 UV : TEXCOORD0; 9 | [[vk::location(1)]]float4 Color : COLOR0; 10 | }; 11 | 12 | float4 main(VSOutput input) : SV_TARGET 13 | { 14 | return input.Color * fontTexture.Sample(fontSampler, input.UV); 15 | } -------------------------------------------------------------------------------- /data/shaders/base/overlay.vert.hlsl: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Google LLC 2 | 3 | struct VSInput 4 | { 5 | [[vk::location(0)]]float2 Pos : POSITION0; 6 | [[vk::location(1)]]float2 UV : TEXCOORD0; 7 | [[vk::location(2)]]float4 Color : COLOR0; 8 | }; 9 | 10 | struct VSOutput 11 | { 12 | float4 Pos : SV_POSITION; 13 | [[vk::location(0)]]float2 UV : TEXCOORD0; 14 | [[vk::location(1)]]float4 Color : COLOR0; 15 | }; 16 | 17 | struct PushConstants 18 | { 19 | float2 scale; 20 | float2 translate; 21 | }; 22 | 23 | [[vk::push_constant]] 24 | PushConstants pushConstants; 25 | 26 | VSOutput main(VSInput input) 27 | { 28 | VSOutput output = (VSOutput)0; 29 | output.Pos = float4(input.Pos * pushConstants.scale + pushConstants.translate, 0.0, 1.0); 30 | output.UV = input.UV; 31 | output.Color = input.Color; 32 | return output; 33 | } -------------------------------------------------------------------------------- /data/shaders/filtercube.vert.hlsl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2024, Sascha Willems 2 | * 3 | * SPDX-License-Identifier: MIT 4 | * 5 | */ 6 | 7 | struct VSInput 8 | { 9 | [[vk::location(0)]]float3 pos : POSITION0; 10 | }; 11 | 12 | struct PushConsts 13 | { 14 | float4x4 mvp; 15 | }; 16 | [[vk::push_constant]] PushConsts primitive; 17 | 18 | struct VSOutput 19 | { 20 | float4 pos : SV_POSITION; 21 | [[vk::location(0)]] float3 UVW : TEXCOORD0; 22 | }; 23 | 24 | VSOutput main(VSInput input) 25 | { 26 | VSOutput output = (VSOutput) 0; 27 | output.UVW = input.pos; 28 | output.pos = mul(primitive.mvp, float4(input.pos, 1.0)); 29 | return output; 30 | } -------------------------------------------------------------------------------- /data/shaders/filtercube_irradiance.frag.hlsl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018-2023, Sascha Willems 2 | * 3 | * SPDX-License-Identifier: MIT 4 | * 5 | */ 6 | 7 | // Generates an irradiance cube from an environment map using convolution 8 | 9 | struct VSOutput 10 | { 11 | float4 pos : SV_POSITION; 12 | [[vk::location(0)]] float3 UVW : TEXCOORD0; 13 | }; 14 | 15 | [[vk::binding(0, 0)]] TextureCube textureCubeMap; 16 | [[vk::binding(0, 0)]] SamplerState samplerCubeMap; 17 | 18 | struct PushConsts 19 | { 20 | [[vk::offset(64)]] float deltaPhi; 21 | [[vk::offset(68)]] float deltaTheta; 22 | }; 23 | [[vk::push_constant]] PushConsts consts; 24 | 25 | #define PI 3.1415926535897932384626433832795 26 | 27 | float4 main(VSOutput input) : SV_TARGET 28 | { 29 | float3 N = normalize(input.pos.xyz); 30 | float3 up = float3(0.0, 1.0, 0.0); 31 | float3 right = normalize(cross(up, N)); 32 | up = cross(N, right); 33 | 34 | const float TWO_PI = PI * 2.0; 35 | const float HALF_PI = PI * 0.5; 36 | 37 | float3 color = float3(0.0, 0.0, 0.0); 38 | uint sampleCount = 0u; 39 | for (float phi = 0.0; phi < TWO_PI; phi += consts.deltaPhi) { 40 | for (float theta = 0.0; theta < HALF_PI; theta += consts.deltaTheta) { 41 | float3 tempVec = cos(phi) * right + sin(phi) * up; 42 | float3 sampleVector = cos(theta) * N + sin(theta) * tempVec; 43 | color += textureCubeMap.Sample(samplerCubeMap, input.UVW).rgb * cos(theta) * sin(theta); 44 | sampleCount++; 45 | } 46 | } 47 | return float4(PI * color / float(sampleCount), 1.0); 48 | } 49 | -------------------------------------------------------------------------------- /data/shaders/fullscreen.frag.hlsl: -------------------------------------------------------------------------------- 1 | struct UBO 2 | { 3 | float4x4 projection; 4 | float4x4 view; 5 | float time; 6 | float timer; 7 | }; 8 | 9 | cbuffer ubo : register(b0) { UBO ubo; } 10 | 11 | struct VSOutput 12 | { 13 | float4 Pos : SV_POSITION; 14 | [[vk::location(0)]] float2 inUV : TEXCOORD0; 15 | }; 16 | 17 | float3 greyscale(float3 color, float str) 18 | { 19 | float g = dot(color, float3(0.299, 0.587, 0.114)); 20 | return lerp(color, float3(g.rrr), str); 21 | } 22 | 23 | float4 main(VSOutput input) : SV_TARGET 24 | { 25 | float2 inUV = input.inUV * 2.0 - 1.0; 26 | 27 | float a = ubo.timer * 2.0 * 3.14159265 * 0.5; 28 | float c = cos(a); 29 | float s = sin(a); 30 | float2x2 rm = float2x2( 31 | c, s, 32 | -s, c 33 | ); 34 | inUV = mul(inUV, rm); 35 | 36 | float2 uv = inUV; 37 | uv = float2(atan2(uv.x, uv.y), ubo.time + 0.40/length(uv)); 38 | 39 | float4 color = sin(10.0 * uv.xyxy); 40 | 41 | return float4(greyscale(color.rgb, 1.0), 1.0); 42 | } -------------------------------------------------------------------------------- /data/shaders/fullscreen.vert.hlsl: -------------------------------------------------------------------------------- 1 | struct VSOutput 2 | { 3 | float4 Pos : SV_POSITION; 4 | [[vk::location(0)]] float2 UV : TEXCOORD0; 5 | }; 6 | 7 | VSOutput main(uint VertexIndex : SV_VertexID) 8 | { 9 | VSOutput output = (VSOutput)0; 10 | output.UV = float2((VertexIndex << 1) & 2, VertexIndex & 2); 11 | output.Pos = float4(output.UV * 2.0f + -1.0f, 0.0f, 1.0f); 12 | return output; 13 | } 14 | -------------------------------------------------------------------------------- /data/shaders/gltf.frag.hlsl: -------------------------------------------------------------------------------- 1 | [[vk::binding(0, 1)]] 2 | Texture2D textures[]; 3 | [[vk::binding(0, 1)]] 4 | TextureCube cubemaps[]; 5 | [[vk::binding(0, 1)]] 6 | SamplerState samplerTexture; 7 | 8 | struct UBO 9 | { 10 | float4x4 projection; 11 | float4x4 view; 12 | float time; 13 | float2 resolution; 14 | }; 15 | [[vk::binding(0, 0)]] 16 | ConstantBuffer ubo; 17 | 18 | struct PushConsts 19 | { 20 | float4x4 model; 21 | uint textureIndex; 22 | uint radianceIndex; 23 | uint irradianceIndex; 24 | }; 25 | [[vk::push_constant]] PushConsts pushConsts; 26 | 27 | struct VSOutput 28 | { 29 | float4 pos : SV_POSITION; 30 | [[vk::location(0)]] float2 uv : POSITION0; 31 | [[vk::location(1)]] float3 normal : NORMAL0; 32 | [[vk::location(2)]] float4 color : COLOR0; 33 | [[vk::location(3)]] float3 worldpos : NORMAL1; 34 | }; 35 | 36 | float3 fresnelSchlickRoughness(float cosTheta, float3 F0, float roughness) 37 | { 38 | return F0 + (max((1.0 - roughness).rrr, F0) - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0); 39 | } 40 | 41 | float4 main(VSOutput input) : SV_TARGET 42 | { 43 | float4 albedo = textures[pushConsts.textureIndex].Sample(samplerTexture, input.uv); 44 | //float4 ambient = cubemaps[pushConsts.irradianceIndex].Sample(samplerTexture, input.normal); 45 | 46 | float3 V = normalize(-input.worldpos); 47 | float3 N = normalize(input.normal); 48 | 49 | float3 F0 = (0.04).rrr; 50 | float roughness = 0.5; 51 | 52 | float3 kS = fresnelSchlickRoughness(max(dot(N, V), 0.0), F0, roughness); 53 | float3 kD = 1.0 - kS; 54 | float3 irradiance = cubemaps[pushConsts.irradianceIndex].Sample(samplerTexture, input.normal).rgb; 55 | //float3 ambient = (0.5f).rrr; 56 | //float3 diffuse = irradiance * albedo.rgb; 57 | 58 | float3 lightPos = float3(0.0, 0.0, 0.0); 59 | float3 lightDir = normalize(lightPos - input.worldpos); 60 | float3 diffuse = max(dot(N, lightDir), 0.0); 61 | 62 | float ao = 2.5; 63 | float3 ambient = max(kD * diffuse, 0.1) * ao; 64 | 65 | return float4((ambient + diffuse) * albedo.rgb, 1.0); 66 | 67 | } -------------------------------------------------------------------------------- /data/shaders/gltf.vert.hlsl: -------------------------------------------------------------------------------- 1 | struct UBO 2 | { 3 | float4x4 projection; 4 | float4x4 view; 5 | float time; 6 | float2 resolution; 7 | }; 8 | 9 | cbuffer ubo : register(b0) { UBO ubo; } 10 | 11 | struct VSInput 12 | { 13 | [[vk::location(0)]]float3 pos : POSITION0; 14 | [[vk::location(1)]]float3 normal : NORMAL0; 15 | [[vk::location(2)]]float2 uv : TEXCOORD0; 16 | [[vk::location(6)]]float4 color : COLOR0; 17 | }; 18 | 19 | struct PushConsts { 20 | float4x4 model; 21 | }; 22 | [[vk::push_constant]] PushConsts primitive; 23 | 24 | struct VSOutput 25 | { 26 | float4 pos : SV_POSITION; 27 | [[vk::location(0)]] float2 uv : TEXCOORD0; 28 | [[vk::location(1)]] float3 normal : NORMAL0; 29 | [[vk::location(2)]] float4 color : COLOR0; 30 | [[vk::location(3)]] float3 worldpos : NORMAL1; 31 | }; 32 | 33 | VSOutput main(VSInput input) 34 | { 35 | VSOutput output = (VSOutput)0; 36 | output.worldpos = mul(primitive.model, float4(input.pos, 1.0)).xyz; 37 | float4x4 modelView = mul(ubo.view, primitive.model); 38 | output.pos = mul(ubo.projection, mul(modelView, float4(input.pos, 1.0))); 39 | output.uv = input.uv; 40 | // Note: Only works with uniform scaling 41 | output.normal = mul(primitive.model, input.normal); 42 | output.color = input.color; 43 | return output; 44 | } 45 | -------------------------------------------------------------------------------- /data/shaders/playership.vert.hlsl: -------------------------------------------------------------------------------- 1 | struct UBO 2 | { 3 | float4x4 projection; 4 | float4x4 view; 5 | float time; 6 | float2 resolution; 7 | }; 8 | 9 | cbuffer ubo : register(b0) { UBO ubo; } 10 | 11 | struct VSInput 12 | { 13 | [[vk::location(0)]]float3 pos : POSITION0; 14 | [[vk::location(1)]]float3 normal : NORMAL0; 15 | [[vk::location(2)]]float2 uv : TEXCOORD0; 16 | [[vk::location(6)]]float4 color : COLOR0; 17 | }; 18 | 19 | struct PushConsts { 20 | float4x4 model; 21 | }; 22 | [[vk::push_constant]] PushConsts primitive; 23 | 24 | struct VSOutput 25 | { 26 | float4 pos : SV_POSITION; 27 | [[vk::location(0)]] float2 uv : TEXCOORD0; 28 | [[vk::location(1)]] float3 normal : NORMAL0; 29 | [[vk::location(2)]] float4 color : COLOR0; 30 | [[vk::location(3)]] float3 localpos : NORMAL1; 31 | }; 32 | 33 | VSOutput main(VSInput input) 34 | { 35 | VSOutput output = (VSOutput)0; 36 | float3 pos = input.pos; 37 | float3 npos = normalize(pos); 38 | pos.z = -pos.z; 39 | float s = (pos.x + 1.0) / 2.0; 40 | pos.z *= 1.0 + abs(sin(ubo.time - s));// * 0.25; 41 | pos.x *= 0.25 + abs(sin(ubo.time - s)); 42 | output.localpos = pos; 43 | //output.localpos = input.pos; 44 | float4x4 modelView = mul(ubo.view, primitive.model); 45 | output.pos = mul(ubo.projection, mul(primitive.model, float4(input.pos, 1.0))); 46 | output.uv = input.uv; 47 | output.normal = input.normal; 48 | output.color = input.color; 49 | output.color.rgb = normalize(pos); 50 | return output; 51 | } 52 | -------------------------------------------------------------------------------- /data/shaders/skybox.frag.hlsl: -------------------------------------------------------------------------------- 1 | [[vk::binding(0, 1)]] 2 | TextureCube textures[]; 3 | [[vk::binding(0, 1)]] 4 | SamplerState samplerCubeMap; 5 | 6 | struct PushConsts 7 | { 8 | float4x4 model; 9 | uint textureIndex; 10 | }; 11 | [[vk::push_constant]] PushConsts pushConsts; 12 | 13 | float4 main([[vk::location(0)]] float3 inUVW : TEXCOORD0) : SV_TARGET 14 | { 15 | float4 color = textures[pushConsts.textureIndex].Sample(samplerCubeMap, inUVW); 16 | return color; 17 | } -------------------------------------------------------------------------------- /data/shaders/skybox.vert.hlsl: -------------------------------------------------------------------------------- 1 | struct UBO 2 | { 3 | float4x4 projection; 4 | float4x4 model; 5 | }; 6 | [[vk::binding(0, 0)]] 7 | ConstantBuffer ubo : register(b0); 8 | 9 | struct VSOutput 10 | { 11 | float4 Pos : SV_POSITION; 12 | [[vk::location(0)]] float3 UVW : TEXCOORD0; 13 | }; 14 | 15 | VSOutput main([[vk::location(0)]] float3 Pos : POSITION0) 16 | { 17 | VSOutput output = (VSOutput)0; 18 | output.UVW = Pos; 19 | // Convert cubemap coordinates into Vulkan coordinate space 20 | output.UVW.xy *= 1.0; 21 | // Remove translation from view matrix 22 | float4x4 viewMat = ubo.model; 23 | viewMat[0][3] = 0.0; 24 | viewMat[1][3] = 0.0; 25 | viewMat[2][3] = 0.0; 26 | output.Pos = mul(ubo.projection, mul(viewMat, float4(Pos.xyz, 1.0))); 27 | return output; 28 | } 29 | -------------------------------------------------------------------------------- /external/glm/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | 30 | # CMake 31 | CMakeCache.txt 32 | CMakeFiles 33 | cmake_install.cmake 34 | install_manifest.txt 35 | *.cmake 36 | # ^ May need to add future .cmake files as exceptions 37 | 38 | # Test logs 39 | Testing/* 40 | 41 | # Test input 42 | test/gtc/*.dds 43 | 44 | # Project Files 45 | Makefile 46 | *.cbp 47 | *.user 48 | 49 | # Misc. 50 | *.log 51 | 52 | # local build(s) 53 | build* 54 | 55 | /.vs 56 | /CMakeSettings.json 57 | -------------------------------------------------------------------------------- /external/glm/cmake/glm.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | includedir=${prefix}/include 3 | 4 | Name: GLM 5 | Description: OpenGL Mathematics 6 | Version: @GLM_VERSION@ 7 | Cflags: -I${includedir} 8 | -------------------------------------------------------------------------------- /external/glm/cmake/glmBuildConfig.cmake.in: -------------------------------------------------------------------------------- 1 | set(GLM_VERSION "@GLM_VERSION@") 2 | set(GLM_INCLUDE_DIRS "@CMAKE_CURRENT_SOURCE_DIR@") 3 | 4 | if (NOT CMAKE_VERSION VERSION_LESS "3.0") 5 | include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake") 6 | endif() 7 | -------------------------------------------------------------------------------- /external/glm/cmake/glmConfig.cmake.in: -------------------------------------------------------------------------------- 1 | set(GLM_VERSION "@GLM_VERSION@") 2 | 3 | @PACKAGE_INIT@ 4 | 5 | set_and_check(GLM_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") 6 | 7 | if (NOT CMAKE_VERSION VERSION_LESS "3.0") 8 | include("${CMAKE_CURRENT_LIST_DIR}/glmTargets.cmake") 9 | endif() 10 | -------------------------------------------------------------------------------- /external/glm/glm/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/common.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_common.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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<4, float, P, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, P> const & v) 15 | { 16 | vec<4, float, P> result(uninitialize); 17 | result.data = _mm_sqrt_ps(v.data); 18 | return result; 19 | } 20 | }; 21 | 22 | template<> 23 | struct compute_sqrt<4, float, aligned_lowp, true> 24 | { 25 | GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const & v) 26 | { 27 | vec<4, float, aligned_lowp> 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 | -------------------------------------------------------------------------------- /external/glm/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<4, uint32, P, vec, true, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, P> const& v, uint32 Mask, uint32 Shift) 15 | { 16 | __m128i const set0 = v.data; 17 | 18 | __m128i const set1 = _mm_set1_epi32(static_cast(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<4, uint32, P, vec, true, true> 34 | { 35 | GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, P> const& v, uint32 Mask, uint32 Shift) 36 | { 37 | __m128i const set0 = v.data; 38 | 39 | __m128i const set1 = _mm_set1_epi32(static_cast(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 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaschaWillems/VulkanTemplate/8550b74efde887bd0cf0df33372bcd43046ec96e/external/glm/glm/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | template struct vec; 36 | template struct mat; 37 | 38 | namespace detail 39 | { 40 | template 41 | struct is_aligned 42 | { 43 | static const bool value = false; 44 | }; 45 | 46 | # if GLM_HAS_ALIGNED_TYPE 47 | template<> 48 | struct is_aligned 49 | { 50 | static const bool value = true; 51 | }; 52 | 53 | template<> 54 | struct is_aligned 55 | { 56 | static const bool value = true; 57 | }; 58 | 59 | template<> 60 | struct is_aligned 61 | { 62 | static const bool value = true; 63 | }; 64 | # endif 65 | }//namespace detail 66 | }//namespace glm 67 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /external/glm/glm/exponential.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/exponential.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_exponential.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/geometric.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/geometric.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_geometric.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/gtc/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_epsilon 2 | /// @file glm/gtc/epsilon.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_quaternion (dependence) 6 | /// 7 | /// @defgroup gtc_epsilon GLM_GTC_epsilon 8 | /// @ingroup gtc 9 | /// 10 | /// @brief Comparison functions for a user defined epsilon 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 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTC_epsilon extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtc_epsilon 27 | /// @{ 28 | 29 | /// Returns the component-wise comparison of |x - y| < epsilon. 30 | /// True if this expression is satisfied. 31 | /// 32 | /// @see gtc_epsilon 33 | template class vecType> 34 | GLM_FUNC_DECL vecType epsilonEqual( 35 | vecType const& x, 36 | vecType const& y, 37 | T const & epsilon); 38 | 39 | /// Returns the component-wise comparison of |x - y| < epsilon. 40 | /// True if this expression is satisfied. 41 | /// 42 | /// @see gtc_epsilon 43 | template 44 | GLM_FUNC_DECL bool epsilonEqual( 45 | genType const & x, 46 | genType const & y, 47 | genType const & epsilon); 48 | 49 | /// Returns the component-wise comparison of |x - y| < epsilon. 50 | /// True if this expression is not satisfied. 51 | /// 52 | /// @see gtc_epsilon 53 | template 54 | GLM_FUNC_DECL typename genType::boolType epsilonNotEqual( 55 | genType const & x, 56 | genType const & y, 57 | typename genType::value_type const & epsilon); 58 | 59 | /// Returns the component-wise comparison of |x - y| >= epsilon. 60 | /// True if this expression is not satisfied. 61 | /// 62 | /// @see gtc_epsilon 63 | template 64 | GLM_FUNC_DECL bool epsilonNotEqual( 65 | genType const & x, 66 | genType const & y, 67 | genType const & epsilon); 68 | 69 | /// @} 70 | }//namespace glm 71 | 72 | #include "epsilon.inl" 73 | -------------------------------------------------------------------------------- /external/glm/glm/gtc/functions.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_functions 2 | /// @file glm/gtc/functions.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_quaternion (dependence) 6 | /// 7 | /// @defgroup gtc_functions GLM_GTC_functions 8 | /// @ingroup gtc 9 | /// 10 | /// @brief List of useful common functions. 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 "../detail/type_vec2.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTC_functions extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtc_functions 28 | /// @{ 29 | 30 | /// 1D gauss function 31 | /// 32 | /// @see gtc_epsilon 33 | template 34 | GLM_FUNC_DECL T gauss( 35 | T x, 36 | T ExpectedValue, 37 | T StandardDeviation); 38 | 39 | /// 2D gauss function 40 | /// 41 | /// @see gtc_epsilon 42 | template 43 | GLM_FUNC_DECL T gauss( 44 | vec<2, T, P> const& Coord, 45 | vec<2, T, P> const& ExpectedValue, 46 | vec<2, T, P> const& StandardDeviation); 47 | 48 | /// @} 49 | }//namespace glm 50 | 51 | #include "functions.inl" 52 | 53 | -------------------------------------------------------------------------------- /external/glm/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 | vec<2, T, P> const& Coord, 23 | vec<2, T, P> const& ExpectedValue, 24 | vec<2, T, P> const& StandardDeviation 25 | ) 26 | { 27 | vec<2, T, P> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 28 | return exp(-(Squared.x + Squared.y)); 29 | } 30 | }//namespace glm 31 | 32 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /external/glm/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<2, uint> float_distance(vecType<2, T> const & x, vecType<2, T> const & y); 59 | 60 | /// @} 61 | }// namespace glm 62 | 63 | #include "ulp.inl" 64 | -------------------------------------------------------------------------------- /external/glm/glm/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_closest_point extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_closest_point 29 | /// @{ 30 | 31 | /// Find the point on a straight line which is the closet of a point. 32 | /// @see gtx_closest_point 33 | template 34 | GLM_FUNC_DECL vec<3, T, P> closestPointOnLine( 35 | vec<3, T, P> const & point, 36 | vec<3, T, P> const & a, 37 | vec<3, T, P> const & b); 38 | 39 | /// 2d lines work as well 40 | template 41 | GLM_FUNC_DECL vec<2, T, P> closestPointOnLine( 42 | vec<2, T, P> const & point, 43 | vec<2, T, P> const & a, 44 | vec<2, T, P> const & b); 45 | 46 | /// @} 47 | }// namespace glm 48 | 49 | #include "closest_point.inl" 50 | -------------------------------------------------------------------------------- /external/glm/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 vec<3, T, P> closestPointOnLine 8 | ( 9 | vec<3, T, P> const & point, 10 | vec<3, T, P> const & a, 11 | vec<3, T, P> const & b 12 | ) 13 | { 14 | T LineLength = distance(a, b); 15 | vec<3, T, P> Vector = point - a; 16 | vec<3, T, P> 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 vec<2, T, P> closestPointOnLine 28 | ( 29 | vec<2, T, P> const & point, 30 | vec<2, T, P> const & a, 31 | vec<2, T, P> const & b 32 | ) 33 | { 34 | T LineLength = distance(a, b); 35 | vec<2, T, P> Vector = point - a; 36 | vec<2, T, P> 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 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/color_encoding.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_encoding 2 | /// @file glm/gtx/color_encoding.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_color_encoding (dependence) 6 | /// 7 | /// @defgroup gtx_color_encoding GLM_GTX_color_encoding 8 | /// @ingroup gtx 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 "../vec3.hpp" 20 | #include 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_color_encoding extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_encoding 29 | /// @{ 30 | 31 | /// Convert a linear sRGB color to D65 YUV. 32 | template 33 | GLM_FUNC_DECL vec<3, T, P> convertLinearSRGBToD65XYZ(vec<3, T, P> const& ColorLinearSRGB); 34 | 35 | /// Convert a linear sRGB color to D50 YUV. 36 | template 37 | GLM_FUNC_DECL vec<3, T, P> convertLinearSRGBToD50XYZ(vec<3, T, P> const& ColorLinearSRGB); 38 | 39 | /// Convert a D65 YUV color to linear sRGB. 40 | template 41 | GLM_FUNC_DECL vec<3, T, P> convertD65XYZToLinearSRGB(vec<3, T, P> const& ColorD65XYZ); 42 | 43 | /// Convert a D65 YUV color to D50 YUV. 44 | template 45 | GLM_FUNC_DECL vec<3, T, P> convertD65XYZToD50XYZ(vec<3, T, P> const& ColorD65XYZ); 46 | 47 | /// @} 48 | } //namespace glm 49 | 50 | #include "color_encoding.inl" 51 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/color_encoding.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_encoding 2 | /// @file glm/gtx/color_encoding.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, P> convertLinearSRGBToD65XYZ(vec<3, T, P> const& ColorLinearSRGB) 8 | { 9 | vec<3, T, P> const M(0.490f, 0.17697f, 0.2f); 10 | vec<3, T, P> const N(0.31f, 0.8124f, 0.01063f); 11 | vec<3, T, P> 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 vec<3, T, P> convertLinearSRGBToD50XYZ(vec<3, T, P> const& ColorLinearSRGB) 18 | { 19 | vec<3, T, P> const M(0.436030342570117f, 0.222438466210245f, 0.013897440074263f); 20 | vec<3, T, P> const N(0.385101860087134f, 0.716942745571917f, 0.097076381494207f); 21 | vec<3, T, P> const O(0.143067806654203f, 0.060618777416563f, 0.713926257896652f); 22 | 23 | return M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER vec<3, T, P> convertD65XYZToLinearSRGB(vec<3, T, P> const& ColorD65XYZ) 28 | { 29 | vec<3, T, P> const M(0.41847f, -0.091169f, 0.0009209f); 30 | vec<3, T, P> const N(-0.15866f, 0.25243f, 0.015708f); 31 | vec<3, T, P> const O(0.0009209f, -0.0025498f, 0.1786f); 32 | 33 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER vec<3, T, P> convertD65XYZToD50XYZ(vec<3, T, P> const& ColorD65XYZ) 38 | { 39 | vec<3, T, P> const M(+1.047844353856414f, +0.029549007606644f, -0.009250984365223f); 40 | vec<3, T, P> const N(+0.022898981050086f, +0.990508028941971f, +0.015072338237051f); 41 | vec<3, T, P> const O(-0.050206647741605f, -0.017074711360960f, +0.751717835079977f); 42 | 43 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 44 | } 45 | 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_color_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_color_space extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_space 29 | /// @{ 30 | 31 | /// Converts a color from HSV color space to its color in RGB color space. 32 | /// @see gtx_color_space 33 | template 34 | GLM_FUNC_DECL vec<3, T, P> rgbColor( 35 | vec<3, T, P> const & hsvValue); 36 | 37 | /// Converts a color from RGB color space to its color in HSV color space. 38 | /// @see gtx_color_space 39 | template 40 | GLM_FUNC_DECL vec<3, T, P> hsvColor( 41 | vec<3, T, P> const & rgbValue); 42 | 43 | /// Build a saturation matrix. 44 | /// @see gtx_color_space 45 | template 46 | GLM_FUNC_DECL mat<4, 4, T, defaultp> saturation( 47 | T const s); 48 | 49 | /// Modify the saturation of a color. 50 | /// @see gtx_color_space 51 | template 52 | GLM_FUNC_DECL vec<3, T, P> saturation( 53 | T const s, 54 | vec<3, T, P> const & color); 55 | 56 | /// Modify the saturation of a color. 57 | /// @see gtx_color_space 58 | template 59 | GLM_FUNC_DECL vec<4, T, P> saturation( 60 | T const s, 61 | vec<4, T, P> const & color); 62 | 63 | /// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals. 64 | /// @see gtx_color_space 65 | template 66 | GLM_FUNC_DECL T luminosity( 67 | vec<3, T, P> const & color); 68 | 69 | /// @} 70 | }//namespace glm 71 | 72 | #include "color_space.inl" 73 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_color_space_YCoCg is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_color_space_YCoCg extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_space_YCoCg 29 | /// @{ 30 | 31 | /// Convert a color from RGB color space to YCoCg color space. 32 | /// @see gtx_color_space_YCoCg 33 | template 34 | GLM_FUNC_DECL vec<3, T, P> rgb2YCoCg( 35 | vec<3, T, P> const & rgbColor); 36 | 37 | /// Convert a color from YCoCg color space to RGB color space. 38 | /// @see gtx_color_space_YCoCg 39 | template 40 | GLM_FUNC_DECL vec<3, T, P> YCoCg2rgb( 41 | vec<3, T, P> const & YCoCgColor); 42 | 43 | /// Convert a color from RGB color space to YCoCgR color space. 44 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 45 | /// @see gtx_color_space_YCoCg 46 | template 47 | GLM_FUNC_DECL vec<3, T, P> rgb2YCoCgR( 48 | vec<3, T, P> const & rgbColor); 49 | 50 | /// Convert a color from YCoCgR color space to RGB color space. 51 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 52 | /// @see gtx_color_space_YCoCg 53 | template 54 | GLM_FUNC_DECL vec<3, T, P> YCoCgR2rgb( 55 | vec<3, T, P> const & YCoCgColor); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "color_space_YCoCg.inl" 61 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_common 2 | /// @file glm/gtx/common.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_common GLM_GTX_common 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Provide functions to increase the compatibility with Cg and HLSL languages 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies: 16 | #include "../vec2.hpp" 17 | #include "../vec3.hpp" 18 | #include "../vec4.hpp" 19 | #include "../gtc/vec1.hpp" 20 | 21 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_common is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_common extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_common 32 | /// @{ 33 | 34 | /// Returns true if x is a denormalized number 35 | /// Numbers whose absolute value is too small to be represented in the normal format are represented in an alternate, denormalized format. 36 | /// This format is less precise but can represent values closer to zero. 37 | /// 38 | /// @tparam genType Floating-point scalar or vector types. 39 | /// 40 | /// @see GLSL isnan man page 41 | /// @see GLSL 4.20.8 specification, section 8.3 Common Functions 42 | template 43 | GLM_FUNC_DECL typename genType::bool_type isdenormal(genType const & x); 44 | 45 | /// Similar to 'mod' but with a different rounding and integer support. 46 | /// Returns 'x - y * trunc(x/y)' instead of 'x - y * floor(x/y)' 47 | /// 48 | /// @see GLSL mod vs HLSL fmod 49 | /// @see GLSL mod man page 50 | template class vecType> 51 | GLM_FUNC_DECL vecType fmod(vecType const & v); 52 | 53 | /// @} 54 | }//namespace glm 55 | 56 | #include "common.inl" 57 | -------------------------------------------------------------------------------- /external/glm/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 vec<1, bool, P> isfinite( 29 | vec<1, T, P> const & x) 30 | { 31 | return vec<1, bool, P>( 32 | isfinite(x.x)); 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER vec<2, bool, P> isfinite( 37 | vec<2, T, P> const & x) 38 | { 39 | return vec<2, bool, P>( 40 | isfinite(x.x), 41 | isfinite(x.y)); 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER vec<3, bool, P> isfinite( 46 | vec<3, T, P> const & x) 47 | { 48 | return vec<3, bool, P>( 49 | isfinite(x.x), 50 | isfinite(x.y), 51 | isfinite(x.z)); 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER vec<4, bool, P> isfinite( 56 | vec<4, T, P> const & x) 57 | { 58 | return vec<4, bool, P>( 59 | isfinite(x.x), 60 | isfinite(x.y), 61 | isfinite(x.z), 62 | isfinite(x.w)); 63 | } 64 | 65 | }//namespace glm 66 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_extend extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_extend 29 | /// @{ 30 | 31 | /// Extends of Length the Origin position using the (Source - Origin) direction. 32 | /// @see gtx_extend 33 | template 34 | GLM_FUNC_DECL genType extend( 35 | genType const & Origin, 36 | genType const & Source, 37 | typename genType::value_type const Length); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "extend.inl" 43 | -------------------------------------------------------------------------------- /external/glm/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 vec<2, T, P> extend 19 | ( 20 | vec<2, T, P> const & Origin, 21 | vec<2, T, P> const & Source, 22 | T const & Distance 23 | ) 24 | { 25 | return Origin + (Source - Origin) * Distance; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER vec<3, T, P> extend 30 | ( 31 | vec<3, T, P> const & Origin, 32 | vec<3, T, P> const & Source, 33 | T const & Distance 34 | ) 35 | { 36 | return Origin + (Source - Origin) * Distance; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER vec<4, T, P> extend 41 | ( 42 | vec<4, T, P> const & Origin, 43 | vec<4, T, P> const & Source, 44 | T const & Distance 45 | ) 46 | { 47 | return Origin + (Source - Origin) * Distance; 48 | } 49 | }//namespace glm 50 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/exterior_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_exterior_product 2 | /// @file glm/gtx/exterior_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_exterior_product (dependence) 6 | /// 7 | /// @defgroup gtx_exterior_product GLM_GTX_exterior_product 8 | /// @ingroup gtx 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 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_exterior_product extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_exterior_product 27 | /// @{ 28 | 29 | /// Returns the cross product of x and y. 30 | /// 31 | /// @tparam valType Floating-point scalar types. 32 | /// 33 | /// @see Exterior product 34 | template 35 | GLM_FUNC_DECL T cross(vec<2, T, P> const& v, vec<2, T, P> const& u); 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | #include "exterior_product.inl" 41 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/exterior_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_geometric.inl 3 | 4 | #include 5 | 6 | namespace glm { 7 | namespace detail 8 | { 9 | template 10 | struct compute_cross_vec2 11 | { 12 | GLM_FUNC_QUALIFIER static T call(vec<2, T, P> const& v, vec<2, T, P> const& u) 13 | { 14 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); 15 | 16 | return v.x * u.y - u.x * v.y; 17 | } 18 | }; 19 | }//namespace detail 20 | 21 | template 22 | GLM_FUNC_QUALIFIER T cross(vec<2, T, P> const & x, vec<2, T, P> const & y) 23 | { 24 | return detail::compute_cross_vec2::value>::call(x, y); 25 | } 26 | }//namespace glm 27 | 28 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_gradient_paint extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_gradient_paint 30 | /// @{ 31 | 32 | /// Return a color from a radial gradient. 33 | /// @see - gtx_gradient_paint 34 | template 35 | GLM_FUNC_DECL T radialGradient( 36 | vec<2, T, P> const & Center, 37 | T const & Radius, 38 | vec<2, T, P> const & Focal, 39 | vec<2, T, P> const & Position); 40 | 41 | /// Return a color from a linear gradient. 42 | /// @see - gtx_gradient_paint 43 | template 44 | GLM_FUNC_DECL T linearGradient( 45 | vec<2, T, P> const & Point0, 46 | vec<2, T, P> const & Point1, 47 | vec<2, T, P> const & Position); 48 | 49 | /// @} 50 | }// namespace glm 51 | 52 | #include "gradient_paint.inl" 53 | -------------------------------------------------------------------------------- /external/glm/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 | vec<2, T, P> const & Center, 10 | T const & Radius, 11 | vec<2, T, P> const & Focal, 12 | vec<2, T, P> const & Position 13 | ) 14 | { 15 | vec<2, T, P> F = Focal - Center; 16 | vec<2, T, P> 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 | vec<2, T, P> const & Point0, 30 | vec<2, T, P> const & Point1, 31 | vec<2, T, P> const & Position 32 | ) 33 | { 34 | vec<2, T, P> 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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_handed_coordinate_space 29 | /// @{ 30 | 31 | //! Return if a trihedron right handed or not. 32 | //! From GLM_GTX_handed_coordinate_space extension. 33 | template 34 | GLM_FUNC_DECL bool rightHanded( 35 | vec<3, T, P> const & tangent, 36 | vec<3, T, P> const & binormal, 37 | vec<3, T, P> const & normal); 38 | 39 | //! Return if a trihedron left handed or not. 40 | //! From GLM_GTX_handed_coordinate_space extension. 41 | template 42 | GLM_FUNC_DECL bool leftHanded( 43 | vec<3, T, P> const & tangent, 44 | vec<3, T, P> const & binormal, 45 | vec<3, T, P> const & normal); 46 | 47 | /// @} 48 | }// namespace glm 49 | 50 | #include "handed_coordinate_space.inl" 51 | -------------------------------------------------------------------------------- /external/glm/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 | vec<3, T, P> const & tangent, 10 | vec<3, T, P> const & binormal, 11 | vec<3, T, P> 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 | vec<3, T, P> const & tangent, 21 | vec<3, T, P> const & binormal, 22 | vec<3, T, P> const & normal 23 | ) 24 | { 25 | return dot(cross(normal, tangent), binormal) < T(0); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/intersect.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaschaWillems/VulkanTemplate/8550b74efde887bd0cf0df33372bcd43046ec96e/external/glm/glm/gtx/intersect.hpp -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_log_base extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_log_base 29 | /// @{ 30 | 31 | /// Logarithm for any base. 32 | /// From GLM_GTX_log_base. 33 | template 34 | GLM_FUNC_DECL genType log( 35 | genType const & x, 36 | genType const & base); 37 | 38 | /// Logarithm for any base. 39 | /// From GLM_GTX_log_base. 40 | template class vecType> 41 | GLM_FUNC_DECL vecType sign( 42 | vecType const& x, 43 | vecType const& base); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "log_base.inl" 49 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_cross_product 30 | /// @{ 31 | 32 | //! Build a cross product matrix. 33 | //! From GLM_GTX_matrix_cross_product extension. 34 | template 35 | GLM_FUNC_DECL mat<3, 3, T, P> matrixCross3( 36 | vec<3, T, P> const & x); 37 | 38 | //! Build a cross product matrix. 39 | //! From GLM_GTX_matrix_cross_product extension. 40 | template 41 | GLM_FUNC_DECL mat<4, 4, T, P> matrixCross4( 42 | vec<3, T, P> const & x); 43 | 44 | /// @} 45 | }//namespace glm 46 | 47 | #include "matrix_cross_product.inl" 48 | -------------------------------------------------------------------------------- /external/glm/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 mat<3, 3, T, P> matrixCross3 8 | ( 9 | vec<3, T, P> const & x 10 | ) 11 | { 12 | mat<3, 3, T, P> 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 mat<4, 4, T, P> matrixCross4 24 | ( 25 | vec<3, T, P> const & x 26 | ) 27 | { 28 | mat<4, 4, T, P> 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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 24 | # error "GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 25 | #endif 26 | 27 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTX_matrix_decompose extension included") 29 | #endif 30 | 31 | namespace glm 32 | { 33 | /// @addtogroup gtx_matrix_decompose 34 | /// @{ 35 | 36 | /// Decomposes a model matrix to translations, rotation and scale components 37 | /// @see gtx_matrix_decompose 38 | template 39 | GLM_FUNC_DECL bool decompose( 40 | mat<4, 4, T, P> const& modelMatrix, 41 | vec<3, T, P> & scale, tquat & orientation, vec<3, T, P> & translation, vec<3, T, P> & skew, vec<4, T, P> & perspective); 42 | 43 | /// @} 44 | }//namespace glm 45 | 46 | #include "matrix_decompose.inl" 47 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/matrix_factorisation.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaschaWillems/VulkanTemplate/8550b74efde887bd0cf0df33372bcd43046ec96e/external/glm/glm/gtx/matrix_factorisation.inl -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_matrix_interpolation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_interpolation extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_interpolation 30 | /// @{ 31 | 32 | /// Get the axis and angle of the rotation from a matrix. 33 | /// From GLM_GTX_matrix_interpolation extension. 34 | template 35 | GLM_FUNC_DECL void axisAngle( 36 | mat<4, 4, T, P> const& mat, 37 | vec<3, T, P> & axis, 38 | T & angle); 39 | 40 | /// Build a matrix from axis and angle. 41 | /// From GLM_GTX_matrix_interpolation extension. 42 | template 43 | GLM_FUNC_DECL mat<4, 4, T, P> axisAngleMatrix( 44 | vec<3, T, P> const & axis, 45 | T const angle); 46 | 47 | /// Extracts the rotation part of a matrix. 48 | /// From GLM_GTX_matrix_interpolation extension. 49 | template 50 | GLM_FUNC_DECL mat<4, 4, T, P> extractMatrixRotation( 51 | mat<4, 4, T, P> const& mat); 52 | 53 | /// Build a interpolation of 4 * 4 matrixes. 54 | /// From GLM_GTX_matrix_interpolation extension. 55 | /// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results. 56 | template 57 | GLM_FUNC_DECL mat<4, 4, T, P> interpolate( 58 | mat<4, 4, T, P> const& m1, 59 | mat<4, 4, T, P> const& m2, 60 | T const delta); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "matrix_interpolation.inl" 66 | -------------------------------------------------------------------------------- /external/glm/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 mat<3, 3, T, P> translate( 12 | mat<3, 3, T, P> const& m, 13 | vec<2, T, P> const & v) 14 | { 15 | mat<3, 3, T, P> 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 mat<3, 3, T, P> rotate( 23 | mat<3, 3, T, P> 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 | mat<3, 3, T, P> 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 mat<3, 3, T, P> scale( 39 | mat<3, 3, T, P> const& m, 40 | vec<2, T, P> const & v) 41 | { 42 | mat<3, 3, T, P> 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 mat<3, 3, T, P> shearX( 51 | mat<3, 3, T, P> const& m, 52 | T y) 53 | { 54 | mat<3, 3, T, P> Result(1); 55 | Result[0][1] = y; 56 | return m * Result; 57 | } 58 | 59 | template 60 | GLM_FUNC_QUALIFIER mat<3, 3, T, P> shearY( 61 | mat<3, 3, T, P> const& m, 62 | T x) 63 | { 64 | mat<3, 3, T, P> Result(1); 65 | Result[1][0] = x; 66 | return m * Result; 67 | } 68 | 69 | }//namespace glm 70 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_mixed_product 29 | /// @{ 30 | 31 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 32 | template 33 | GLM_FUNC_DECL T mixedProduct( 34 | vec<3, T, P> const & v1, 35 | vec<3, T, P> const & v2, 36 | vec<3, T, P> const & v3); 37 | 38 | /// @} 39 | }// namespace glm 40 | 41 | #include "mixed_product.inl" 42 | -------------------------------------------------------------------------------- /external/glm/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 | vec<3, T, P> const & v1, 10 | vec<3, T, P> const & v2, 11 | vec<3, T, P> const & v3 12 | ) 13 | { 14 | return dot(cross(v1, v2), v3); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_normal extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normal 30 | /// @{ 31 | 32 | //! Computes triangle normal from triangle points. 33 | //! From GLM_GTX_normal extension. 34 | template 35 | GLM_FUNC_DECL vec<3, T, P> triangleNormal( 36 | vec<3, T, P> const & p1, 37 | vec<3, T, P> const & p2, 38 | vec<3, T, P> const & p3); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "normal.inl" 44 | -------------------------------------------------------------------------------- /external/glm/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 vec<3, T, P> triangleNormal 8 | ( 9 | vec<3, T, P> const & p1, 10 | vec<3, T, P> const & p2, 11 | vec<3, T, P> const & p3 12 | ) 13 | { 14 | return normalize(cross(p1 - p2, p1 - p3)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_normalize_dot is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_normalize_dot extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normalize_dot 30 | /// @{ 31 | 32 | /// Normalize parameters and returns the dot product of x and y. 33 | /// It's faster that dot(normalize(x), normalize(y)). 34 | /// 35 | /// @see gtx_normalize_dot extension. 36 | template class vecType> 37 | GLM_FUNC_DECL T normalizeDot(vecType const & x, vecType const & y); 38 | 39 | /// Normalize parameters and returns the dot product of x and y. 40 | /// Faster that dot(fastNormalize(x), fastNormalize(y)). 41 | /// 42 | /// @see gtx_normalize_dot extension. 43 | template class vecType> 44 | GLM_FUNC_DECL T fastNormalizeDot(vecType const & x, vecType const & y); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "normalize_dot.inl" 50 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_optimum_pow is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_optimum_pow extension included") 24 | #endif 25 | 26 | namespace glm{ 27 | namespace gtx 28 | { 29 | /// @addtogroup gtx_optimum_pow 30 | /// @{ 31 | 32 | /// Returns x raised to the power of 2. 33 | /// 34 | /// @see gtx_optimum_pow 35 | template 36 | GLM_FUNC_DECL genType pow2(genType const & x); 37 | 38 | /// Returns x raised to the power of 3. 39 | /// 40 | /// @see gtx_optimum_pow 41 | template 42 | GLM_FUNC_DECL genType pow3(genType const & x); 43 | 44 | /// Returns x raised to the power of 4. 45 | /// 46 | /// @see gtx_optimum_pow 47 | template 48 | GLM_FUNC_DECL genType pow4(genType const & x); 49 | 50 | /// @} 51 | }//namespace gtx 52 | }//namespace glm 53 | 54 | #include "optimum_pow.inl" 55 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_orthonormalize 32 | /// @{ 33 | 34 | /// Returns the orthonormalized matrix of m. 35 | /// 36 | /// @see gtx_orthonormalize 37 | template 38 | GLM_FUNC_DECL mat<3, 3, T, P> orthonormalize(mat<3, 3, T, P> const & m); 39 | 40 | /// Orthonormalizes x according y. 41 | /// 42 | /// @see gtx_orthonormalize 43 | template 44 | GLM_FUNC_DECL vec<3, T, P> orthonormalize(vec<3, T, P> const & x, vec<3, T, P> const & y); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "orthonormalize.inl" 50 | -------------------------------------------------------------------------------- /external/glm/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 mat<3, 3, T, P> orthonormalize(mat<3, 3, T, P> const & m) 8 | { 9 | mat<3, 3, T, P> 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 vec<3, T, P> orthonormalize(vec<3, T, P> const & x, vec<3, T, P> const & y) 27 | { 28 | return normalize(x - y * dot(y, x)); 29 | } 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_perpendicular 31 | /// @{ 32 | 33 | //! Projects x a perpendicular axis of Normal. 34 | //! From GLM_GTX_perpendicular extension. 35 | template 36 | GLM_FUNC_DECL vecType perp( 37 | vecType const & x, 38 | vecType const & Normal); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "perpendicular.inl" 44 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_polar_coordinates is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_polar_coordinates extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_polar_coordinates 29 | /// @{ 30 | 31 | /// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 32 | /// 33 | /// @see gtx_polar_coordinates 34 | template 35 | GLM_FUNC_DECL vec<3, T, P> polar( 36 | vec<3, T, P> const & euclidean); 37 | 38 | /// Convert Polar to Euclidean coordinates. 39 | /// 40 | /// @see gtx_polar_coordinates 41 | template 42 | GLM_FUNC_DECL vec<3, T, P> euclidean( 43 | vec<2, T, P> const & polar); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "polar_coordinates.inl" 49 | -------------------------------------------------------------------------------- /external/glm/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 vec<3, T, P> polar 8 | ( 9 | vec<3, T, P> const & euclidean 10 | ) 11 | { 12 | T const Length(length(euclidean)); 13 | vec<3, T, P> const tmp(euclidean / Length); 14 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 15 | 16 | return vec<3, T, P>( 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 vec<3, T, P> euclidean 24 | ( 25 | vec<2, T, P> const & polar 26 | ) 27 | { 28 | T const latitude(polar.x); 29 | T const longitude(polar.y); 30 | 31 | return vec<3, T, P>( 32 | cos(latitude) * sin(longitude), 33 | sin(latitude), 34 | cos(latitude) * cos(longitude)); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_projection extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_projection 29 | /// @{ 30 | 31 | /// Projects x on Normal. 32 | /// 33 | /// @see gtx_projection 34 | template 35 | GLM_FUNC_DECL vecType proj(vecType const & x, vecType const & Normal); 36 | 37 | /// @} 38 | }//namespace glm 39 | 40 | #include "projection.inl" 41 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_raw_data extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_raw_data 30 | /// @{ 31 | 32 | //! Type for byte numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint8 byte; 35 | 36 | //! Type for word numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint16 word; 39 | 40 | //! Type for dword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint32 dword; 43 | 44 | //! Type for qword numbers. 45 | //! From GLM_GTX_raw_data extension. 46 | typedef detail::uint64 qword; 47 | 48 | /// @} 49 | }// namespace glm 50 | 51 | #include "raw_data.inl" 52 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.inl 3 | -------------------------------------------------------------------------------- /external/glm/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 mat<4, 4, T, P> rotateNormalizedAxis 8 | ( 9 | mat<4, 4, T, P> const& m, 10 | T const & angle, 11 | vec<3, T, P> const & v 12 | ) 13 | { 14 | T const a = angle; 15 | T const c = cos(a); 16 | T const s = sin(a); 17 | 18 | vec<3, T, P> const axis(v); 19 | 20 | vec<3, T, P> const temp((static_cast(1) - c) * axis); 21 | 22 | mat<4, 4, T, P> 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 | mat<4, 4, T, P> 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 | vec<3, T, P> const & v 49 | ) 50 | { 51 | vec<3, T, P> 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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_extend extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_scalar_relational 29 | /// @{ 30 | 31 | 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "scalar_relational.inl" 37 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_spline is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_spline extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_spline 30 | /// @{ 31 | 32 | /// Return a point from a catmull rom curve. 33 | /// @see gtx_spline extension. 34 | template 35 | GLM_FUNC_DECL genType catmullRom( 36 | genType const & v1, 37 | genType const & v2, 38 | genType const & v3, 39 | genType const & v4, 40 | typename genType::value_type const & s); 41 | 42 | /// Return a point from a hermite curve. 43 | /// @see gtx_spline extension. 44 | template 45 | GLM_FUNC_DECL genType hermite( 46 | genType const & v1, 47 | genType const & t1, 48 | genType const & v2, 49 | genType const & t2, 50 | typename genType::value_type const & s); 51 | 52 | /// Return a point from a cubic curve. 53 | /// @see gtx_spline extension. 54 | template 55 | GLM_FUNC_DECL genType cubic( 56 | genType const & v1, 57 | genType const & v2, 58 | genType const & v3, 59 | genType const & v4, 60 | typename genType::value_type const & s); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "spline.inl" 66 | -------------------------------------------------------------------------------- /external/glm/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 s2 = pow2(s); 17 | typename genType::value_type s3 = pow3(s); 18 | 19 | typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s; 20 | typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2); 21 | typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s; 22 | typename genType::value_type f4 = s3 - s2; 23 | 24 | return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2); 25 | 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER genType hermite 30 | ( 31 | genType const & v1, 32 | genType const & t1, 33 | genType const & v2, 34 | genType const & t2, 35 | typename genType::value_type const & s 36 | ) 37 | { 38 | typename genType::value_type s2 = pow2(s); 39 | typename genType::value_type s3 = pow3(s); 40 | 41 | typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1); 42 | typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2; 43 | typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s; 44 | typename genType::value_type f4 = s3 - s2; 45 | 46 | return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER genType cubic 51 | ( 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 | return ((v1 * s + v2) * s + v3) * s + v4; 60 | } 61 | }//namespace glm 62 | -------------------------------------------------------------------------------- /external/glm/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 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_std_based_type is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_std_based_type extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_std_based_type 30 | /// @{ 31 | 32 | /// Vector type based of one std::size_t component. 33 | /// @see GLM_GTX_std_based_type 34 | typedef vec<1, std::size_t, defaultp> size1; 35 | 36 | /// Vector type based of two std::size_t components. 37 | /// @see GLM_GTX_std_based_type 38 | typedef vec<2, std::size_t, defaultp> size2; 39 | 40 | /// Vector type based of three std::size_t components. 41 | /// @see GLM_GTX_std_based_type 42 | typedef vec<3, std::size_t, defaultp> size3; 43 | 44 | /// Vector type based of four std::size_t components. 45 | /// @see GLM_GTX_std_based_type 46 | typedef vec<4, std::size_t, defaultp> size4; 47 | 48 | /// Vector type based of one std::size_t component. 49 | /// @see GLM_GTX_std_based_type 50 | typedef vec<1, std::size_t, defaultp> size1_t; 51 | 52 | /// Vector type based of two std::size_t components. 53 | /// @see GLM_GTX_std_based_type 54 | typedef vec<2, std::size_t, defaultp> size2_t; 55 | 56 | /// Vector type based of three std::size_t components. 57 | /// @see GLM_GTX_std_based_type 58 | typedef vec<3, std::size_t, defaultp> size3_t; 59 | 60 | /// Vector type based of four std::size_t components. 61 | /// @see GLM_GTX_std_based_type 62 | typedef vec<4, std::size_t, defaultp> size4_t; 63 | 64 | /// @} 65 | }//namespace glm 66 | 67 | #include "std_based_type.inl" 68 | -------------------------------------------------------------------------------- /external/glm/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 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_string_cast 2 | /// @file glm/gtx/string_cast.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_integer (dependence) 6 | /// @see gtx_quaternion (dependence) 7 | /// 8 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 9 | /// @ingroup gtx 10 | /// 11 | /// @brief Setup strings for GLM type values 12 | /// 13 | /// need to be included to use these functionalities. 14 | /// This extension is not supported with CUDA 15 | 16 | #pragma once 17 | 18 | // Dependency: 19 | #include "../glm.hpp" 20 | #include "../gtc/type_precision.hpp" 21 | #include "../gtc/quaternion.hpp" 22 | #include "../gtx/dual_quaternion.hpp" 23 | #include 24 | #include 25 | 26 | #ifndef GLM_ENABLE_EXPERIMENTAL 27 | # error "GLM: GLM_GTX_string_cast is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 28 | #endif 29 | 30 | #if(GLM_COMPILER & GLM_COMPILER_CUDA) 31 | # error "GLM_GTX_string_cast is not supported on CUDA compiler" 32 | #endif 33 | 34 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 35 | # pragma message("GLM: GLM_GTX_string_cast extension included") 36 | #endif 37 | 38 | namespace glm 39 | { 40 | /// @addtogroup gtx_string_cast 41 | /// @{ 42 | 43 | /// Create a string from a GLM vector or matrix typed variable. 44 | /// @see gtx_string_cast extension. 45 | template 46 | GLM_FUNC_DECL std::string to_string(genType const& x); 47 | 48 | /// @} 49 | }//namespace glm 50 | 51 | #include "string_cast.inl" 52 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/transform.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | /// @file glm/gtx/transform.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_matrix_transform (dependence) 6 | /// @see gtx_transform 7 | /// @see gtx_transform2 8 | /// 9 | /// @defgroup gtx_transform GLM_GTX_transform 10 | /// @ingroup gtx 11 | /// 12 | /// @brief Add transformation matrices 13 | /// 14 | /// need to be included to use these functionalities. 15 | 16 | #pragma once 17 | 18 | // Dependency: 19 | #include "../glm.hpp" 20 | #include "../gtc/matrix_transform.hpp" 21 | 22 | #ifndef GLM_ENABLE_EXPERIMENTAL 23 | # error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 24 | #endif 25 | 26 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 27 | # pragma message("GLM: GLM_GTX_transform extension included") 28 | #endif 29 | 30 | namespace glm 31 | { 32 | /// @addtogroup gtx_transform 33 | /// @{ 34 | 35 | /// Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars. 36 | /// @see gtc_matrix_transform 37 | /// @see gtx_transform 38 | template 39 | GLM_FUNC_DECL mat<4, 4, T, P> translate( 40 | vec<3, T, P> const & v); 41 | 42 | /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians. 43 | /// @see gtc_matrix_transform 44 | /// @see gtx_transform 45 | template 46 | GLM_FUNC_DECL mat<4, 4, T, P> rotate( 47 | T angle, 48 | vec<3, T, P> const & v); 49 | 50 | /// Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components. 51 | /// @see gtc_matrix_transform 52 | /// @see gtx_transform 53 | template 54 | GLM_FUNC_DECL mat<4, 4, T, P> scale( 55 | vec<3, T, P> const & v); 56 | 57 | /// @} 58 | }// namespace glm 59 | 60 | #include "transform.inl" 61 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | /// @file glm/gtx/transform.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<4, 4, T, P> translate(vec<3, T, P> const & v) 8 | { 9 | return translate(mat<4, 4, T, P>(static_cast(1)), v); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER mat<4, 4, T, P> rotate(T angle, vec<3, T, P> const & v) 14 | { 15 | return rotate(mat<4, 4, T, P>(static_cast(1)), angle, v); 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER mat<4, 4, T, P> scale(vec<3, T, P> const & v) 20 | { 21 | return scale(mat<4, 4, T, P>(static_cast(1)), v); 22 | } 23 | 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/type_aligned.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_type_aligned 2 | /// @file glm/gtc/type_aligned.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/type_trait.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaschaWillems/VulkanTemplate/8550b74efde887bd0cf0df33372bcd43046ec96e/external/glm/glm/gtx/type_trait.inl -------------------------------------------------------------------------------- /external/glm/glm/gtx/vector_angle.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_angle 2 | /// @file glm/gtx/vector_angle.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_quaternion (dependence) 6 | /// @see gtx_epsilon (dependence) 7 | /// 8 | /// @defgroup gtx_vector_angle GLM_GTX_vector_angle 9 | /// @ingroup gtx 10 | /// 11 | /// @brief Compute angle between vectors 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 "../gtx/quaternion.hpp" 21 | #include "../gtx/rotate_vector.hpp" 22 | 23 | #ifndef GLM_ENABLE_EXPERIMENTAL 24 | # error "GLM: GLM_GTX_vector_angle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 25 | #endif 26 | 27 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTX_vector_angle extension included") 29 | #endif 30 | 31 | namespace glm 32 | { 33 | /// @addtogroup gtx_vector_angle 34 | /// @{ 35 | 36 | //! Returns the absolute angle between two vectors. 37 | //! Parameters need to be normalized. 38 | /// @see gtx_vector_angle extension. 39 | template 40 | GLM_FUNC_DECL typename vecType::value_type angle( 41 | vecType const & x, 42 | vecType const & y); 43 | 44 | //! Returns the oriented angle between two 2d vectors. 45 | //! Parameters need to be normalized. 46 | /// @see gtx_vector_angle extension. 47 | template 48 | GLM_FUNC_DECL T orientedAngle( 49 | vec<2, T, P> const & x, 50 | vec<2, T, P> const & y); 51 | 52 | //! Returns the oriented angle between two 3d vectors based from a reference axis. 53 | //! Parameters need to be normalized. 54 | /// @see gtx_vector_angle extension. 55 | template 56 | GLM_FUNC_DECL T orientedAngle( 57 | vec<3, T, P> const & x, 58 | vec<3, T, P> const & y, 59 | vec<3, T, P> const & ref); 60 | 61 | /// @} 62 | }// namespace glm 63 | 64 | #include "vector_angle.inl" 65 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/vector_angle.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_angle 2 | /// @file glm/gtx/vector_angle.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType angle 8 | ( 9 | genType const & x, 10 | genType const & y 11 | ) 12 | { 13 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); 14 | return acos(clamp(dot(x, y), genType(-1), genType(1))); 15 | } 16 | 17 | template class vecType> 18 | GLM_FUNC_QUALIFIER T angle 19 | ( 20 | vecType const& x, 21 | vecType const& y 22 | ) 23 | { 24 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); 25 | return acos(clamp(dot(x, y), T(-1), T(1))); 26 | } 27 | 28 | //! \todo epsilon is hard coded to 0.01 29 | template 30 | GLM_FUNC_QUALIFIER T orientedAngle 31 | ( 32 | vec<2, T, P> const & x, 33 | vec<2, T, P> const & y 34 | ) 35 | { 36 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); 37 | T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); 38 | 39 | if(all(epsilonEqual(y, glm::rotate(x, Angle), T(0.0001)))) 40 | return Angle; 41 | else 42 | return -Angle; 43 | } 44 | 45 | template 46 | GLM_FUNC_QUALIFIER T orientedAngle 47 | ( 48 | vec<3, T, P> const & x, 49 | vec<3, T, P> const & y, 50 | vec<3, T, P> const & ref 51 | ) 52 | { 53 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); 54 | 55 | T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); 56 | return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0)); 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/wrap.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_wrap 2 | /// @file glm/gtx/wrap.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_wrap GLM_GTX_wrap 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Wrapping mode of texture coordinates. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/vec1.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_wrap is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_wrap extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_wrap 30 | /// @{ 31 | 32 | /// Simulate GL_CLAMP OpenGL wrap mode 33 | /// @see gtx_wrap extension. 34 | template 35 | GLM_FUNC_DECL genType clamp(genType const& Texcoord); 36 | 37 | /// Simulate GL_REPEAT OpenGL wrap mode 38 | /// @see gtx_wrap extension. 39 | template 40 | GLM_FUNC_DECL genType repeat(genType const& Texcoord); 41 | 42 | /// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode 43 | /// @see gtx_wrap extension. 44 | template 45 | GLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord); 46 | 47 | /// Simulate GL_MIRROR_REPEAT OpenGL wrap mode 48 | /// @see gtx_wrap extension. 49 | template 50 | GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord); 51 | 52 | /// @} 53 | }// namespace glm 54 | 55 | #include "wrap.inl" 56 | -------------------------------------------------------------------------------- /external/glm/glm/gtx/wrap.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_wrap 2 | /// @file glm/gtx/wrap.inl 3 | 4 | namespace glm 5 | { 6 | template class vecType> 7 | GLM_FUNC_QUALIFIER vecType clamp(vecType const& Texcoord) 8 | { 9 | return glm::clamp(Texcoord, vecType(0), vecType(1)); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType clamp(genType const & Texcoord) 14 | { 15 | return clamp(vec<1, genType, defaultp>(Texcoord)).x; 16 | } 17 | 18 | template class vecType> 19 | GLM_FUNC_QUALIFIER vecType repeat(vecType const& Texcoord) 20 | { 21 | return glm::fract(Texcoord); 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType repeat(genType const & Texcoord) 26 | { 27 | return repeat(vec<1, genType, defaultp>(Texcoord)).x; 28 | } 29 | 30 | template class vecType> 31 | GLM_FUNC_QUALIFIER vecType mirrorClamp(vecType const& Texcoord) 32 | { 33 | return glm::fract(glm::abs(Texcoord)); 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER genType mirrorClamp(genType const & Texcoord) 38 | { 39 | return mirrorClamp(vec<1, genType, defaultp>(Texcoord)).x; 40 | } 41 | 42 | template class vecType> 43 | GLM_FUNC_QUALIFIER vecType mirrorRepeat(vecType const& Texcoord) 44 | { 45 | vecType const Abs = glm::abs(Texcoord); 46 | vecType const Clamp = glm::mod(glm::floor(Abs), vecType(2)); 47 | vecType const Floor = glm::floor(Abs); 48 | vecType const Rest = Abs - Floor; 49 | vecType const Mirror = Clamp + Rest; 50 | return mix(Rest, vecType(1) - Rest, glm::greaterThanEqual(Mirror, vecType(1))); 51 | } 52 | 53 | template 54 | GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const& Texcoord) 55 | { 56 | return mirrorRepeat(vec<1, genType, defaultp>(Texcoord)).x; 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /external/glm/glm/integer.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/integer.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_integer.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/mat2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat2x3.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 2 columns of 3 components matrix of low precision floating-point numbers. 13 | /// There is no guarantee on the actual precision. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<2, 3, float, lowp> lowp_mat2x3; 18 | 19 | /// 2 columns of 3 components matrix of medium precision floating-point numbers. 20 | /// There is no guarantee on the actual precision. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<2, 3, float, mediump> mediump_mat2x3; 25 | 26 | /// 2 columns of 3 components matrix of high precision floating-point numbers. 27 | /// There is no guarantee on the actual precision. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<2, 3, float, highp> highp_mat2x3; 32 | 33 | }//namespace glm 34 | 35 | -------------------------------------------------------------------------------- /external/glm/glm/mat2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat2x4.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 2 columns of 4 components matrix of low precision floating-point numbers. 13 | /// There is no guarantee on the actual precision. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<2, 4, float, lowp> lowp_mat2x4; 18 | 19 | /// 2 columns of 4 components matrix of medium precision floating-point numbers. 20 | /// There is no guarantee on the actual precision. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<2, 4, float, mediump> mediump_mat2x4; 25 | 26 | /// 2 columns of 4 components matrix of high precision floating-point numbers. 27 | /// There is no guarantee on the actual precision. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<2, 4, float, highp> highp_mat2x4; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /external/glm/glm/mat3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat3x2.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 3 columns of 2 components matrix of low precision floating-point numbers. 13 | /// There is no guarantee on the actual precision. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<3, 2, float, lowp> lowp_mat3x2; 18 | 19 | /// 3 columns of 2 components matrix of medium precision floating-point numbers. 20 | /// There is no guarantee on the actual precision. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<3, 2, float, mediump> mediump_mat3x2; 25 | 26 | /// 3 columns of 2 components matrix of high precision floating-point numbers. 27 | /// There is no guarantee on the actual precision. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<3, 2, float, highp> highp_mat3x2; 32 | 33 | }//namespace 34 | -------------------------------------------------------------------------------- /external/glm/glm/mat3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat3x4.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 3 columns of 4 components matrix of low precision floating-point numbers. 13 | /// There is no guarantee on the actual precision. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<3, 4, float, lowp> lowp_mat3x4; 18 | 19 | /// 3 columns of 4 components matrix of medium precision floating-point numbers. 20 | /// There is no guarantee on the actual precision. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<3, 4, float, mediump> mediump_mat3x4; 25 | 26 | /// 3 columns of 4 components matrix of high precision floating-point numbers. 27 | /// There is no guarantee on the actual precision. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<3, 4, float, highp> highp_mat3x4; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /external/glm/glm/mat4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat4x2.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 4 columns of 2 components matrix of low precision floating-point numbers. 13 | /// There is no guarantee on the actual precision. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<4, 2, float, lowp> lowp_mat4x2; 18 | 19 | /// 4 columns of 2 components matrix of medium precision floating-point numbers. 20 | /// There is no guarantee on the actual precision. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<4, 2, float, mediump> mediump_mat4x2; 25 | 26 | /// 4 columns of 2 components matrix of high precision floating-point numbers. 27 | /// There is no guarantee on the actual precision. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<4, 2, float, highp> highp_mat4x2; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /external/glm/glm/mat4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat4x3.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 4 columns of 3 components matrix of low precision floating-point numbers. 13 | /// There is no guarantee on the actual precision. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<4, 3, float, lowp> lowp_mat4x3; 18 | 19 | /// 4 columns of 3 components matrix of medium precision floating-point numbers. 20 | /// There is no guarantee on the actual precision. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<4, 3, float, mediump> mediump_mat4x3; 25 | 26 | /// 4 columns of 3 components matrix of high precision floating-point numbers. 27 | /// There is no guarantee on the actual precision. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<4, 3, float, highp> highp_mat4x3; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /external/glm/glm/matrix.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/matrix.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_matrix.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/packing.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/packing.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_packing.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/simd/exponential.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/experimental.h 3 | 4 | #pragma once 5 | 6 | #include "platform.h" 7 | 8 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_sqrt_lowp(glm_vec4 x) 11 | { 12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x); 13 | } 14 | 15 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sqrt_lowp(glm_vec4 x) 16 | { 17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x); 18 | } 19 | 20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 21 | -------------------------------------------------------------------------------- /external/glm/glm/simd/packing.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/packing.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /external/glm/glm/simd/trigonometric.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/trigonometric.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | -------------------------------------------------------------------------------- /external/glm/glm/simd/vector_relational.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/vector_relational.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /external/glm/glm/trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/trigonometric.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_trigonometric.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec2.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec3.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec4.hpp" 9 | -------------------------------------------------------------------------------- /external/glm/glm/vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vector_relational.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/func_vector_relational.hpp" 9 | -------------------------------------------------------------------------------- /external/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2018 Omar Cornut 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 | -------------------------------------------------------------------------------- /external/ktx/NOTICE.md: -------------------------------------------------------------------------------- 1 | LICENSE.md -------------------------------------------------------------------------------- /external/ktx/lib/filestream.h: -------------------------------------------------------------------------------- 1 | /* -*- tab-width: 4; -*- */ 2 | /* vi: set sw=2 ts=4 expandtab: */ 3 | 4 | /* 5 | * ©2010-2018 The khronos Group, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /* 21 | * Author: Maksim Kolesin from original code 22 | * by Mark Callow and Georg Kolling 23 | */ 24 | 25 | #ifndef FILESTREAM_H 26 | #define FILESTREAM_H 27 | 28 | #include "ktx.h" 29 | #include "stream.h" 30 | 31 | /* 32 | * ktxFileInit: Initialize a ktxStream to a ktxFileStream with a FILE object 33 | */ 34 | KTX_error_code ktxFileStream_construct(ktxStream* str, FILE* file, 35 | ktx_bool_t closeFileOnDestruct); 36 | 37 | void ktxFileStream_destruct(ktxStream* str); 38 | 39 | #endif /* FILESTREAM_H */ 40 | -------------------------------------------------------------------------------- /external/ktx/lib/memstream.h: -------------------------------------------------------------------------------- 1 | /* -*- tab-width: 4; -*- */ 2 | /* vi: set sw=2 ts=4 expandtab: */ 3 | 4 | /* 5 | * Copyright (c) 2010-2018 The Khronos Group Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /** 21 | * @internal 22 | * @file 23 | * @~English 24 | * 25 | * @brief Interface of ktxStream for memory. 26 | * 27 | * @author Maksim Kolesin 28 | * @author Georg Kolling, Imagination Technology 29 | * @author Mark Callow, HI Corporation 30 | */ 31 | 32 | #ifndef MEMSTREAM_H 33 | #define MEMSTREAM_H 34 | 35 | #include "ktx.h" 36 | #include "stream.h" 37 | 38 | /* 39 | * Initialize a ktxStream to a ktxMemStream with internally 40 | * allocated memory. Can be read or written. 41 | */ 42 | KTX_error_code ktxMemStream_construct(ktxStream* str, 43 | ktx_bool_t freeOnDestruct); 44 | /* 45 | * Initialize a ktxStream to a read-only ktxMemStream reading 46 | * from an array of bytes. 47 | */ 48 | KTX_error_code ktxMemStream_construct_ro(ktxStream* str, 49 | const ktx_uint8_t* pBytes, 50 | const ktx_size_t size); 51 | void ktxMemStream_destruct(ktxStream* str); 52 | 53 | KTX_error_code ktxMemStream_getdata(ktxStream* str, ktx_uint8_t** ppBytes); 54 | 55 | #endif /* MEMSTREAM_H */ 56 | -------------------------------------------------------------------------------- /external/ktx/lib/swap.c: -------------------------------------------------------------------------------- 1 | /* -*- tab-width: 4; -*- */ 2 | /* vi: set sw=2 ts=4 expandtab: */ 3 | 4 | /* $Id: d858975c68f39438233f78cbf217f70fc5ddd316 $ */ 5 | 6 | /* 7 | * Copyright (c) 2010 The Khronos Group Inc. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include "KHR/khrplatform.h" 23 | 24 | /* 25 | * SwapEndian16: Swaps endianness in an array of 16-bit values 26 | */ 27 | void 28 | _ktxSwapEndian16(khronos_uint16_t* pData16, int count) 29 | { 30 | int i; 31 | for (i = 0; i < count; ++i) 32 | { 33 | khronos_uint16_t x = *pData16; 34 | *pData16++ = (x << 8) | (x >> 8); 35 | } 36 | } 37 | 38 | /* 39 | * SwapEndian32: Swaps endianness in an array of 32-bit values 40 | */ 41 | void 42 | _ktxSwapEndian32(khronos_uint32_t* pData32, int count) 43 | { 44 | int i; 45 | for (i = 0; i < count; ++i) 46 | { 47 | khronos_uint32_t x = *pData32; 48 | *pData32++ = (x << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | (x >> 24); 49 | } 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /external/ktx/lib/vk_funclist.inl: -------------------------------------------------------------------------------- 1 | /* -*- tab-width: 4; -*- */ 2 | /* vi: set sw=2 ts=4 expandtab textwidth=70: */ 3 | 4 | /* 5 | * ©2017 Mark Callow. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /** 21 | * @internal 22 | * @file vk_funclist.h 23 | * @~English 24 | * 25 | * @brief List of Vulkan functions used by libktx. 26 | */ 27 | 28 | VK_FUNCTION(vkAllocateCommandBuffers) 29 | VK_FUNCTION(vkAllocateMemory) 30 | VK_FUNCTION(vkBeginCommandBuffer) 31 | VK_FUNCTION(vkBindBufferMemory) 32 | VK_FUNCTION(vkBindImageMemory) 33 | VK_FUNCTION(vkCmdBlitImage) 34 | VK_FUNCTION(vkCmdCopyBufferToImage) 35 | VK_FUNCTION(vkCmdPipelineBarrier) 36 | VK_FUNCTION(vkCreateBuffer) 37 | VK_FUNCTION(vkCreateFence) 38 | VK_FUNCTION(vkCreateImage) 39 | VK_FUNCTION(vkDestroyBuffer) 40 | VK_FUNCTION(vkDestroyFence) 41 | VK_FUNCTION(vkDestroyImage) 42 | VK_FUNCTION(vkEndCommandBuffer) 43 | VK_FUNCTION(vkFreeCommandBuffers) 44 | VK_FUNCTION(vkFreeMemory) 45 | VK_FUNCTION(vkGetBufferMemoryRequirements) 46 | VK_FUNCTION(vkGetImageMemoryRequirements) 47 | VK_FUNCTION(vkGetImageSubresourceLayout) 48 | VK_FUNCTION(vkGetPhysicalDeviceImageFormatProperties) 49 | VK_FUNCTION(vkGetPhysicalDeviceFormatProperties) 50 | VK_FUNCTION(vkGetPhysicalDeviceMemoryProperties) 51 | VK_FUNCTION(vkMapMemory) 52 | VK_FUNCTION(vkQueueSubmit) 53 | VK_FUNCTION(vkQueueWaitIdle) 54 | VK_FUNCTION(vkUnmapMemory) 55 | VK_FUNCTION(vkWaitForFences) 56 | -------------------------------------------------------------------------------- /external/tinygltf/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Syoyo Fujita, Aurélien Chatelain and many contributors 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 | -------------------------------------------------------------------------------- /external/tracy/LICENSE: -------------------------------------------------------------------------------- 1 | Tracy Profiler (https://github.com/wolfpld/tracy) is licensed under the 2 | 3-clause BSD license. 3 | 4 | Copyright (c) 2017-2024, Bartosz Taudul 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of the nor the 15 | names of its contributors may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /external/tracy/TracyClient.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Tracy profiler 3 | // ---------------- 4 | // 5 | // For fast integration, compile and 6 | // link with this source file (and none 7 | // other) in your executable (or in the 8 | // main DLL / shared object on multi-DLL 9 | // projects). 10 | // 11 | 12 | // Define TRACY_ENABLE to enable profiler. 13 | 14 | #include "common/TracySystem.cpp" 15 | 16 | #ifdef TRACY_ENABLE 17 | 18 | #ifdef _MSC_VER 19 | # pragma warning(push, 0) 20 | #endif 21 | 22 | #include "common/tracy_lz4.cpp" 23 | #include "client/TracyProfiler.cpp" 24 | #include "client/TracyCallstack.cpp" 25 | #include "client/TracySysPower.cpp" 26 | #include "client/TracySysTime.cpp" 27 | #include "client/TracySysTrace.cpp" 28 | #include "common/TracySocket.cpp" 29 | #include "client/tracy_rpmalloc.cpp" 30 | #include "client/TracyDxt1.cpp" 31 | #include "client/TracyAlloc.cpp" 32 | #include "client/TracyOverride.cpp" 33 | #include "client/TracyKCore.cpp" 34 | 35 | #if defined(TRACY_HAS_CALLSTACK) 36 | # if TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 3 || TRACY_HAS_CALLSTACK == 4 || TRACY_HAS_CALLSTACK == 6 37 | # include "libbacktrace/alloc.cpp" 38 | # include "libbacktrace/dwarf.cpp" 39 | # include "libbacktrace/fileline.cpp" 40 | # include "libbacktrace/mmapio.cpp" 41 | # include "libbacktrace/posix.cpp" 42 | # include "libbacktrace/sort.cpp" 43 | # include "libbacktrace/state.cpp" 44 | # if TRACY_HAS_CALLSTACK == 4 45 | # include "libbacktrace/macho.cpp" 46 | # else 47 | # include "libbacktrace/elf.cpp" 48 | # endif 49 | # include "common/TracyStackFrames.cpp" 50 | # endif 51 | #endif 52 | 53 | #ifdef _MSC_VER 54 | # pragma comment(lib, "ws2_32.lib") 55 | # pragma comment(lib, "dbghelp.lib") 56 | # pragma comment(lib, "advapi32.lib") 57 | # pragma comment(lib, "user32.lib") 58 | # pragma warning(pop) 59 | #endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /external/tracy/client/TracyAlloc.cpp: -------------------------------------------------------------------------------- 1 | #include "../common/TracyAlloc.hpp" 2 | 3 | #ifdef TRACY_USE_RPMALLOC 4 | 5 | #include 6 | 7 | #include "../common/TracyForceInline.hpp" 8 | #include "../common/TracyYield.hpp" 9 | 10 | namespace tracy 11 | { 12 | 13 | extern thread_local bool RpThreadInitDone; 14 | extern std::atomic RpInitDone; 15 | extern std::atomic RpInitLock; 16 | 17 | tracy_no_inline static void InitRpmallocPlumbing() 18 | { 19 | const auto done = RpInitDone.load( std::memory_order_acquire ); 20 | if( !done ) 21 | { 22 | int expected = 0; 23 | while( !RpInitLock.compare_exchange_weak( expected, 1, std::memory_order_release, std::memory_order_relaxed ) ) { expected = 0; YieldThread(); } 24 | const auto done = RpInitDone.load( std::memory_order_acquire ); 25 | if( !done ) 26 | { 27 | rpmalloc_initialize(); 28 | RpInitDone.store( 1, std::memory_order_release ); 29 | } 30 | RpInitLock.store( 0, std::memory_order_release ); 31 | } 32 | rpmalloc_thread_initialize(); 33 | RpThreadInitDone = true; 34 | } 35 | 36 | TRACY_API void InitRpmalloc() 37 | { 38 | if( !RpThreadInitDone ) InitRpmallocPlumbing(); 39 | } 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /external/tracy/client/TracyCallstack.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYCALLSTACK_H__ 2 | #define __TRACYCALLSTACK_H__ 3 | 4 | #ifndef TRACY_NO_CALLSTACK 5 | 6 | # if !defined _WIN32 7 | # include 8 | # endif 9 | 10 | # if defined _WIN32 11 | # include "../common/TracyUwp.hpp" 12 | # ifndef TRACY_UWP 13 | # define TRACY_HAS_CALLSTACK 1 14 | # endif 15 | # elif defined __ANDROID__ 16 | # if !defined __arm__ || __ANDROID_API__ >= 21 17 | # define TRACY_HAS_CALLSTACK 2 18 | # else 19 | # define TRACY_HAS_CALLSTACK 5 20 | # endif 21 | # elif defined __linux 22 | # if defined _GNU_SOURCE && defined __GLIBC__ 23 | # define TRACY_HAS_CALLSTACK 3 24 | # else 25 | # define TRACY_HAS_CALLSTACK 2 26 | # endif 27 | # elif defined __APPLE__ 28 | # define TRACY_HAS_CALLSTACK 4 29 | # elif defined BSD 30 | # define TRACY_HAS_CALLSTACK 6 31 | # endif 32 | 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /external/tracy/client/TracyCpuid.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYCPUID_HPP__ 2 | #define __TRACYCPUID_HPP__ 3 | 4 | // Prior to GCC 11 the cpuid.h header did not have any include guards and thus 5 | // including it more than once would cause a compiler error due to symbol 6 | // redefinitions. In order to support older GCC versions, we have to wrap this 7 | // include between custom include guards to prevent this issue. 8 | // See also https://github.com/wolfpld/tracy/issues/452 9 | 10 | #include 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /external/tracy/client/TracyDebug.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYPRINT_HPP__ 2 | #define __TRACYPRINT_HPP__ 3 | 4 | #ifdef TRACY_VERBOSE 5 | # include 6 | # define TracyDebug(...) fprintf( stderr, __VA_ARGS__ ); 7 | #else 8 | # define TracyDebug(...) 9 | #endif 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /external/tracy/client/TracyDxt1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYDXT1_HPP__ 2 | #define __TRACYDXT1_HPP__ 3 | 4 | namespace tracy 5 | { 6 | 7 | void CompressImageDxt1( const char* src, char* dst, int w, int h ); 8 | 9 | } 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /external/tracy/client/TracyKCore.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYKCORE_HPP__ 2 | #define __TRACYKCORE_HPP__ 3 | 4 | #ifdef __linux__ 5 | 6 | #include 7 | 8 | #include "TracyFastVector.hpp" 9 | 10 | namespace tracy 11 | { 12 | 13 | class KCore 14 | { 15 | struct Offset 16 | { 17 | uint64_t start; 18 | uint64_t size; 19 | uint64_t offset; 20 | }; 21 | 22 | public: 23 | KCore(); 24 | ~KCore(); 25 | 26 | void* Retrieve( uint64_t addr, uint64_t size ) const; 27 | 28 | private: 29 | int m_fd; 30 | FastVector m_offsets; 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /external/tracy/client/TracyOverride.cpp: -------------------------------------------------------------------------------- 1 | #ifdef TRACY_ENABLE 2 | # ifdef __linux__ 3 | # include "TracyDebug.hpp" 4 | # ifdef TRACY_VERBOSE 5 | # include 6 | # include 7 | # endif 8 | 9 | extern "C" int dlclose( void* hnd ) 10 | { 11 | #ifdef TRACY_VERBOSE 12 | struct link_map* lm; 13 | if( dlinfo( hnd, RTLD_DI_LINKMAP, &lm ) == 0 ) 14 | { 15 | TracyDebug( "Overriding dlclose for %s\n", lm->l_name ); 16 | } 17 | else 18 | { 19 | TracyDebug( "Overriding dlclose for unknown object (%s)\n", dlerror() ); 20 | } 21 | #endif 22 | return 0; 23 | } 24 | 25 | # endif 26 | #endif 27 | -------------------------------------------------------------------------------- /external/tracy/client/TracyStringHelpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSTRINGHELPERS_HPP__ 2 | #define __TRACYSTRINGHELPERS_HPP__ 3 | 4 | #include 5 | #include 6 | 7 | #include "../common/TracyAlloc.hpp" 8 | #include "../common/TracyForceInline.hpp" 9 | 10 | namespace tracy 11 | { 12 | 13 | static tracy_force_inline char* CopyString( const char* src, size_t sz ) 14 | { 15 | auto dst = (char*)tracy_malloc( sz + 1 ); 16 | memcpy( dst, src, sz ); 17 | dst[sz] = '\0'; 18 | return dst; 19 | } 20 | 21 | static tracy_force_inline char* CopyString( const char* src ) 22 | { 23 | return CopyString( src, strlen( src ) ); 24 | } 25 | 26 | static tracy_force_inline char* CopyStringFast( const char* src, size_t sz ) 27 | { 28 | auto dst = (char*)tracy_malloc_fast( sz + 1 ); 29 | memcpy( dst, src, sz ); 30 | dst[sz] = '\0'; 31 | return dst; 32 | } 33 | 34 | static tracy_force_inline char* CopyStringFast( const char* src ) 35 | { 36 | return CopyStringFast( src, strlen( src ) ); 37 | } 38 | 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /external/tracy/client/TracySysPower.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSYSPOWER_HPP__ 2 | #define __TRACYSYSPOWER_HPP__ 3 | 4 | #if defined __linux__ 5 | # define TRACY_HAS_SYSPOWER 6 | #endif 7 | 8 | #ifdef TRACY_HAS_SYSPOWER 9 | 10 | #include 11 | #include 12 | 13 | #include "TracyFastVector.hpp" 14 | 15 | namespace tracy 16 | { 17 | 18 | class SysPower 19 | { 20 | struct Domain 21 | { 22 | uint64_t value; 23 | uint64_t overflow; 24 | FILE* handle; 25 | const char* name; 26 | }; 27 | 28 | public: 29 | SysPower(); 30 | ~SysPower(); 31 | 32 | void Tick(); 33 | 34 | private: 35 | void ScanDirectory( const char* path, int parent ); 36 | 37 | FastVector m_domains; 38 | uint64_t m_lastTime; 39 | }; 40 | 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /external/tracy/client/TracySysTime.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSYSTIME_HPP__ 2 | #define __TRACYSYSTIME_HPP__ 3 | 4 | #if defined _WIN32 || defined __linux__ || defined __APPLE__ 5 | # define TRACY_HAS_SYSTIME 6 | #else 7 | # include 8 | #endif 9 | 10 | #ifdef BSD 11 | # define TRACY_HAS_SYSTIME 12 | #endif 13 | 14 | #ifdef TRACY_HAS_SYSTIME 15 | 16 | #include 17 | 18 | namespace tracy 19 | { 20 | 21 | class SysTime 22 | { 23 | public: 24 | SysTime(); 25 | float Get(); 26 | 27 | void ReadTimes(); 28 | 29 | private: 30 | uint64_t idle, used; 31 | }; 32 | 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /external/tracy/client/TracySysTrace.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSYSTRACE_HPP__ 2 | #define __TRACYSYSTRACE_HPP__ 3 | 4 | #if !defined TRACY_NO_SYSTEM_TRACING && ( defined _WIN32 || defined __linux__ ) 5 | # include "../common/TracyUwp.hpp" 6 | # ifndef TRACY_UWP 7 | # define TRACY_HAS_SYSTEM_TRACING 8 | # endif 9 | #endif 10 | 11 | #ifdef TRACY_HAS_SYSTEM_TRACING 12 | 13 | #include 14 | 15 | namespace tracy 16 | { 17 | 18 | bool SysTraceStart( int64_t& samplingPeriod ); 19 | void SysTraceStop(); 20 | void SysTraceWorker( void* ptr ); 21 | 22 | void SysTraceGetExternalName( uint64_t thread, const char*& threadName, const char*& name ); 23 | 24 | } 25 | 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /external/tracy/client/TracyThread.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYTHREAD_HPP__ 2 | #define __TRACYTHREAD_HPP__ 3 | 4 | #if defined _WIN32 5 | # include 6 | #else 7 | # include 8 | #endif 9 | 10 | #ifdef TRACY_MANUAL_LIFETIME 11 | # include "tracy_rpmalloc.hpp" 12 | #endif 13 | 14 | namespace tracy 15 | { 16 | 17 | #ifdef TRACY_MANUAL_LIFETIME 18 | extern thread_local bool RpThreadInitDone; 19 | #endif 20 | 21 | class ThreadExitHandler 22 | { 23 | public: 24 | ~ThreadExitHandler() 25 | { 26 | #ifdef TRACY_MANUAL_LIFETIME 27 | rpmalloc_thread_finalize( 1 ); 28 | RpThreadInitDone = false; 29 | #endif 30 | } 31 | }; 32 | 33 | #if defined _WIN32 34 | 35 | class Thread 36 | { 37 | public: 38 | Thread( void(*func)( void* ptr ), void* ptr ) 39 | : m_func( func ) 40 | , m_ptr( ptr ) 41 | , m_hnd( CreateThread( nullptr, 0, Launch, this, 0, nullptr ) ) 42 | {} 43 | 44 | ~Thread() 45 | { 46 | WaitForSingleObject( m_hnd, INFINITE ); 47 | CloseHandle( m_hnd ); 48 | } 49 | 50 | HANDLE Handle() const { return m_hnd; } 51 | 52 | private: 53 | static DWORD WINAPI Launch( void* ptr ) { ((Thread*)ptr)->m_func( ((Thread*)ptr)->m_ptr ); return 0; } 54 | 55 | void(*m_func)( void* ptr ); 56 | void* m_ptr; 57 | HANDLE m_hnd; 58 | }; 59 | 60 | #else 61 | 62 | class Thread 63 | { 64 | public: 65 | Thread( void(*func)( void* ptr ), void* ptr ) 66 | : m_func( func ) 67 | , m_ptr( ptr ) 68 | { 69 | pthread_create( &m_thread, nullptr, Launch, this ); 70 | } 71 | 72 | ~Thread() 73 | { 74 | pthread_join( m_thread, nullptr ); 75 | } 76 | 77 | pthread_t Handle() const { return m_thread; } 78 | 79 | private: 80 | static void* Launch( void* ptr ) { ((Thread*)ptr)->m_func( ((Thread*)ptr)->m_ptr ); return nullptr; } 81 | void(*m_func)( void* ptr ); 82 | void* m_ptr; 83 | pthread_t m_thread; 84 | }; 85 | 86 | #endif 87 | 88 | } 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /external/tracy/common/TracyAlign.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYALIGN_HPP__ 2 | #define __TRACYALIGN_HPP__ 3 | 4 | #include 5 | 6 | #include "TracyForceInline.hpp" 7 | 8 | namespace tracy 9 | { 10 | 11 | template 12 | tracy_force_inline T MemRead( const void* ptr ) 13 | { 14 | T val; 15 | memcpy( &val, ptr, sizeof( T ) ); 16 | return val; 17 | } 18 | 19 | template 20 | tracy_force_inline void MemWrite( void* ptr, T val ) 21 | { 22 | memcpy( ptr, &val, sizeof( T ) ); 23 | } 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /external/tracy/common/TracyAlloc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYALLOC_HPP__ 2 | #define __TRACYALLOC_HPP__ 3 | 4 | #include 5 | 6 | #if defined TRACY_ENABLE && !defined __EMSCRIPTEN__ 7 | # include "TracyApi.h" 8 | # include "TracyForceInline.hpp" 9 | # include "../client/tracy_rpmalloc.hpp" 10 | # define TRACY_USE_RPMALLOC 11 | #endif 12 | 13 | namespace tracy 14 | { 15 | 16 | #ifdef TRACY_USE_RPMALLOC 17 | TRACY_API void InitRpmalloc(); 18 | #else 19 | static inline void InitRpmalloc() {} 20 | #endif 21 | 22 | static inline void* tracy_malloc( size_t size ) 23 | { 24 | #ifdef TRACY_USE_RPMALLOC 25 | InitRpmalloc(); 26 | return rpmalloc( size ); 27 | #else 28 | return malloc( size ); 29 | #endif 30 | } 31 | 32 | static inline void* tracy_malloc_fast( size_t size ) 33 | { 34 | #ifdef TRACY_USE_RPMALLOC 35 | return rpmalloc( size ); 36 | #else 37 | return malloc( size ); 38 | #endif 39 | } 40 | 41 | static inline void tracy_free( void* ptr ) 42 | { 43 | #ifdef TRACY_USE_RPMALLOC 44 | InitRpmalloc(); 45 | rpfree( ptr ); 46 | #else 47 | free( ptr ); 48 | #endif 49 | } 50 | 51 | static inline void tracy_free_fast( void* ptr ) 52 | { 53 | #ifdef TRACY_USE_RPMALLOC 54 | rpfree( ptr ); 55 | #else 56 | free( ptr ); 57 | #endif 58 | } 59 | 60 | static inline void* tracy_realloc( void* ptr, size_t size ) 61 | { 62 | #ifdef TRACY_USE_RPMALLOC 63 | InitRpmalloc(); 64 | return rprealloc( ptr, size ); 65 | #else 66 | return realloc( ptr, size ); 67 | #endif 68 | } 69 | 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /external/tracy/common/TracyApi.h: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYAPI_H__ 2 | #define __TRACYAPI_H__ 3 | 4 | #if defined _WIN32 5 | # if defined TRACY_EXPORTS 6 | # define TRACY_API __declspec(dllexport) 7 | # elif defined TRACY_IMPORTS 8 | # define TRACY_API __declspec(dllimport) 9 | # else 10 | # define TRACY_API 11 | # endif 12 | #else 13 | # define TRACY_API __attribute__((visibility("default"))) 14 | #endif 15 | 16 | #endif // __TRACYAPI_H__ 17 | -------------------------------------------------------------------------------- /external/tracy/common/TracyForceInline.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYFORCEINLINE_HPP__ 2 | #define __TRACYFORCEINLINE_HPP__ 3 | 4 | #if defined(__GNUC__) 5 | # define tracy_force_inline __attribute__((always_inline)) inline 6 | #elif defined(_MSC_VER) 7 | # define tracy_force_inline __forceinline 8 | #else 9 | # define tracy_force_inline inline 10 | #endif 11 | 12 | #if defined(__GNUC__) 13 | # define tracy_no_inline __attribute__((noinline)) 14 | #elif defined(_MSC_VER) 15 | # define tracy_no_inline __declspec(noinline) 16 | #else 17 | # define tracy_no_inline 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /external/tracy/common/TracyMutex.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYMUTEX_HPP__ 2 | #define __TRACYMUTEX_HPP__ 3 | 4 | #if defined _MSC_VER 5 | 6 | # include 7 | 8 | namespace tracy 9 | { 10 | using TracyMutex = std::shared_mutex; 11 | } 12 | 13 | #else 14 | 15 | #include 16 | 17 | namespace tracy 18 | { 19 | using TracyMutex = std::mutex; 20 | } 21 | 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /external/tracy/common/TracyStackFrames.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSTACKFRAMES_HPP__ 2 | #define __TRACYSTACKFRAMES_HPP__ 3 | 4 | #include 5 | 6 | namespace tracy 7 | { 8 | 9 | struct StringMatch 10 | { 11 | const char* str; 12 | size_t len; 13 | }; 14 | 15 | extern const char** s_tracyStackFrames; 16 | extern const StringMatch* s_tracySkipSubframes; 17 | 18 | static constexpr int s_tracySkipSubframesMinLen = 7; 19 | 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /external/tracy/common/TracySystem.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYSYSTEM_HPP__ 2 | #define __TRACYSYSTEM_HPP__ 3 | 4 | #include 5 | 6 | #include "TracyApi.h" 7 | 8 | namespace tracy 9 | { 10 | 11 | namespace detail 12 | { 13 | TRACY_API uint32_t GetThreadHandleImpl(); 14 | } 15 | 16 | #ifdef TRACY_ENABLE 17 | TRACY_API uint32_t GetThreadHandle(); 18 | #else 19 | static inline uint32_t GetThreadHandle() 20 | { 21 | return detail::GetThreadHandleImpl(); 22 | } 23 | #endif 24 | 25 | TRACY_API void SetThreadName( const char* name ); 26 | TRACY_API const char* GetThreadName( uint32_t id ); 27 | 28 | TRACY_API const char* GetEnvVar( const char* name ); 29 | 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /external/tracy/common/TracyUwp.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYUWP_HPP__ 2 | #define __TRACYUWP_HPP__ 3 | 4 | #ifdef _WIN32 5 | # include 6 | # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 7 | # define TRACY_UWP 8 | # endif 9 | #endif 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /external/tracy/common/TracyVersion.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYVERSION_HPP__ 2 | #define __TRACYVERSION_HPP__ 3 | 4 | namespace tracy 5 | { 6 | namespace Version 7 | { 8 | enum { Major = 0 }; 9 | enum { Minor = 11 }; 10 | enum { Patch = 0 }; 11 | } 12 | } 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /external/tracy/common/TracyYield.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __TRACYYIELD_HPP__ 2 | #define __TRACYYIELD_HPP__ 3 | 4 | #if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2) 5 | # include 6 | #else 7 | # include 8 | #endif 9 | 10 | #include "TracyForceInline.hpp" 11 | 12 | namespace tracy 13 | { 14 | 15 | static tracy_force_inline void YieldThread() 16 | { 17 | #if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2) 18 | _mm_pause(); 19 | #elif defined __aarch64__ 20 | asm volatile( "isb" : : ); 21 | #else 22 | std::this_thread::yield(); 23 | #endif 24 | } 25 | 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /external/tracy/libbacktrace/LICENSE: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012-2016 Free Software Foundation, Inc. 2 | 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions are 5 | # met: 6 | 7 | # (1) Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | 10 | # (2) Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in 12 | # the documentation and/or other materials provided with the 13 | # distribution. 14 | 15 | # (3) The name of the author may not be used to 16 | # endorse or promote products derived from this software without 17 | # specific prior written permission. 18 | 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 23 | # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 28 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /external/tracy/libbacktrace/config.h: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined(__linux__) && !defined(__GLIBC__) && !defined(__WORDSIZE) 3 | // include __WORDSIZE headers for musl 4 | # include 5 | #endif 6 | #if __WORDSIZE == 64 7 | # define BACKTRACE_ELF_SIZE 64 8 | #else 9 | # define BACKTRACE_ELF_SIZE 32 10 | #endif 11 | 12 | #define HAVE_DLFCN_H 1 13 | #define HAVE_FCNTL 1 14 | #define HAVE_INTTYPES_H 1 15 | #define HAVE_LSTAT 1 16 | #define HAVE_READLINK 1 17 | #define HAVE_DL_ITERATE_PHDR 1 18 | #define HAVE_ATOMIC_FUNCTIONS 1 19 | #define HAVE_DECL_STRNLEN 1 20 | 21 | #ifdef __APPLE__ 22 | # define HAVE_MACH_O_DYLD_H 1 23 | #elif defined BSD 24 | # define HAVE_KERN_PROC 1 25 | # define HAVE_KERN_PROC_ARGS 1 26 | #endif 27 | -------------------------------------------------------------------------------- /external/tracy/libbacktrace/filenames.hpp: -------------------------------------------------------------------------------- 1 | /* btest.c -- Filename header for libbacktrace library 2 | Copyright (C) 2012-2018 Free Software Foundation, Inc. 3 | Written by Ian Lance Taylor, Google. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | (1) Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | (2) Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the 15 | distribution. 16 | 17 | (3) The name of the author may not be used to 18 | endorse or promote products derived from this software without 19 | specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. */ 32 | 33 | #ifndef GCC_VERSION 34 | # define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) 35 | #endif 36 | 37 | #if (GCC_VERSION < 2007) 38 | # define __attribute__(x) 39 | #endif 40 | 41 | #ifndef ATTRIBUTE_UNUSED 42 | # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 43 | #endif 44 | 45 | #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 46 | # define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') 47 | # define HAS_DRIVE_SPEC(f) ((f)[0] != '\0' && (f)[1] == ':') 48 | # define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC(f)) 49 | #else 50 | # define IS_DIR_SEPARATOR(c) ((c) == '/') 51 | # define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) 52 | #endif 53 | -------------------------------------------------------------------------------- /external/volk/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2023 Arseny Kapoulkine 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /external/volk/cmake/volkConfig.cmake.in: -------------------------------------------------------------------------------- 1 | get_filename_component(volk_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 2 | 3 | if(NOT TARGET volk::volk) 4 | include("${volk_CMAKE_DIR}/volkTargets.cmake") 5 | endif() 6 | 7 | # Mirror the default behaviour of the respective option. 8 | if(NOT DEFINED VOLK_PULL_IN_VULKAN) 9 | set(VOLK_PULL_IN_VULKAN ON) 10 | endif() 11 | 12 | if(VOLK_PULL_IN_VULKAN) 13 | find_package(Vulkan QUIET) 14 | if(TARGET Vulkan::Vulkan) 15 | add_dependencies(volk::volk Vulkan::Vulkan) 16 | add_dependencies(volk::volk_headers Vulkan::Vulkan) 17 | elseif(DEFINED ENV{VULKAN_SDK}) 18 | target_include_directories(volk::volk INTERFACE "$ENV{VULKAN_SDK}/include") 19 | target_include_directories(volk::volk_headers INTERFACE "$ENV{VULKAN_SDK}/include") 20 | endif() 21 | endif() 22 | -------------------------------------------------------------------------------- /external/vulkan/vk_video/vulkan_video_codecs_common.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VIDEO_CODECS_COMMON_H_ 2 | #define VULKAN_VIDEO_CODECS_COMMON_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define vulkan_video_codecs_common 1 23 | #define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ 24 | ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) 25 | 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_H_ 2 | #define VULKAN_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | #include "vk_platform.h" 11 | #include "vulkan_core.h" 12 | 13 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 14 | #include "vulkan_android.h" 15 | #endif 16 | 17 | #ifdef VK_USE_PLATFORM_FUCHSIA 18 | #include 19 | #include "vulkan_fuchsia.h" 20 | #endif 21 | 22 | #ifdef VK_USE_PLATFORM_IOS_MVK 23 | #include "vulkan_ios.h" 24 | #endif 25 | 26 | 27 | #ifdef VK_USE_PLATFORM_MACOS_MVK 28 | #include "vulkan_macos.h" 29 | #endif 30 | 31 | #ifdef VK_USE_PLATFORM_METAL_EXT 32 | #include "vulkan_metal.h" 33 | #endif 34 | 35 | #ifdef VK_USE_PLATFORM_VI_NN 36 | #include "vulkan_vi.h" 37 | #endif 38 | 39 | 40 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 41 | #include "vulkan_wayland.h" 42 | #endif 43 | 44 | 45 | #ifdef VK_USE_PLATFORM_WIN32_KHR 46 | #include 47 | #include "vulkan_win32.h" 48 | #endif 49 | 50 | 51 | #ifdef VK_USE_PLATFORM_XCB_KHR 52 | #include 53 | #include "vulkan_xcb.h" 54 | #endif 55 | 56 | 57 | #ifdef VK_USE_PLATFORM_XLIB_KHR 58 | #include 59 | #include "vulkan_xlib.h" 60 | #endif 61 | 62 | 63 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT 64 | #include 65 | #include "vulkan_directfb.h" 66 | #endif 67 | 68 | 69 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 70 | #include 71 | #include 72 | #include "vulkan_xlib_xrandr.h" 73 | #endif 74 | 75 | 76 | #ifdef VK_USE_PLATFORM_GGP 77 | #include 78 | #include "vulkan_ggp.h" 79 | #endif 80 | 81 | 82 | #ifdef VK_USE_PLATFORM_SCREEN_QNX 83 | #include 84 | #include "vulkan_screen.h" 85 | #endif 86 | 87 | #ifdef VK_ENABLE_BETA_EXTENSIONS 88 | #include "vulkan_beta.h" 89 | #endif 90 | 91 | #endif // VULKAN_H_ 92 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_directfb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_DIRECTFB_H_ 2 | #define VULKAN_DIRECTFB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_directfb_surface 1 23 | #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1 24 | #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface" 25 | typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; 26 | typedef struct VkDirectFBSurfaceCreateInfoEXT { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkDirectFBSurfaceCreateFlagsEXT flags; 30 | IDirectFB* dfb; 31 | IDirectFBSurface* surface; 32 | } VkDirectFBSurfaceCreateInfoEXT; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateDirectFBSurfaceEXT)(VkInstance instance, const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, IDirectFB* dfb); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT( 39 | VkInstance instance, 40 | const VkDirectFBSurfaceCreateInfoEXT* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | IDirectFB* dfb); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_ggp.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_GGP_H_ 2 | #define VULKAN_GGP_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_GGP_stream_descriptor_surface 1 23 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 24 | #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface" 25 | typedef VkFlags VkStreamDescriptorSurfaceCreateFlagsGGP; 26 | typedef struct VkStreamDescriptorSurfaceCreateInfoGGP { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkStreamDescriptorSurfaceCreateFlagsGGP flags; 30 | GgpStreamDescriptor streamDescriptor; 31 | } VkStreamDescriptorSurfaceCreateInfoGGP; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateStreamDescriptorSurfaceGGP)(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP( 37 | VkInstance instance, 38 | const VkStreamDescriptorSurfaceCreateInfoGGP* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | 44 | #define VK_GGP_frame_token 1 45 | #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1 46 | #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token" 47 | typedef struct VkPresentFrameTokenGGP { 48 | VkStructureType sType; 49 | const void* pNext; 50 | GgpFrameToken frameToken; 51 | } VkPresentFrameTokenGGP; 52 | 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_ios.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_IOS_H_ 2 | #define VULKAN_IOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_MVK_ios_surface 1 23 | #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 24 | #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" 25 | typedef VkFlags VkIOSSurfaceCreateFlagsMVK; 26 | typedef struct VkIOSSurfaceCreateInfoMVK { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkIOSSurfaceCreateFlagsMVK flags; 30 | const void* pView; 31 | } VkIOSSurfaceCreateInfoMVK; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( 37 | VkInstance instance, 38 | const VkIOSSurfaceCreateInfoMVK* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_macos.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_MACOS_H_ 2 | #define VULKAN_MACOS_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_MVK_macos_surface 1 23 | #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 24 | #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" 25 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 26 | typedef struct VkMacOSSurfaceCreateInfoMVK { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkMacOSSurfaceCreateFlagsMVK flags; 30 | const void* pView; 31 | } VkMacOSSurfaceCreateInfoMVK; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( 37 | VkInstance instance, 38 | const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_screen.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_SCREEN_H_ 2 | #define VULKAN_SCREEN_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_QNX_screen_surface 1 23 | #define VK_QNX_SCREEN_SURFACE_SPEC_VERSION 1 24 | #define VK_QNX_SCREEN_SURFACE_EXTENSION_NAME "VK_QNX_screen_surface" 25 | typedef VkFlags VkScreenSurfaceCreateFlagsQNX; 26 | typedef struct VkScreenSurfaceCreateInfoQNX { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkScreenSurfaceCreateFlagsQNX flags; 30 | struct _screen_context* context; 31 | struct _screen_window* window; 32 | } VkScreenSurfaceCreateInfoQNX; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateScreenSurfaceQNX)(VkInstance instance, const VkScreenSurfaceCreateInfoQNX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct _screen_window* window); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateScreenSurfaceQNX( 39 | VkInstance instance, 40 | const VkScreenSurfaceCreateInfoQNX* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceScreenPresentationSupportQNX( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | struct _screen_window* window); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_NN_vi_surface 1 23 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 24 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 25 | typedef VkFlags VkViSurfaceCreateFlagsNN; 26 | typedef struct VkViSurfaceCreateInfoNN { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkViSurfaceCreateFlagsNN flags; 30 | void* window; 31 | } VkViSurfaceCreateInfoNN; 32 | 33 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 34 | 35 | #ifndef VK_NO_PROTOTYPES 36 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 37 | VkInstance instance, 38 | const VkViSurfaceCreateInfoNN* pCreateInfo, 39 | const VkAllocationCallbacks* pAllocator, 40 | VkSurfaceKHR* pSurface); 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_wayland.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_WAYLAND_H_ 2 | #define VULKAN_WAYLAND_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_wayland_surface 1 23 | #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" 25 | typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; 26 | typedef struct VkWaylandSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkWaylandSurfaceCreateFlagsKHR flags; 30 | struct wl_display* display; 31 | struct wl_surface* surface; 32 | } VkWaylandSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( 39 | VkInstance instance, 40 | const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | struct wl_display* display); 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_xcb.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XCB_H_ 2 | #define VULKAN_XCB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_xcb_surface 1 23 | #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" 25 | typedef VkFlags VkXcbSurfaceCreateFlagsKHR; 26 | typedef struct VkXcbSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkXcbSurfaceCreateFlagsKHR flags; 30 | xcb_connection_t* connection; 31 | xcb_window_t window; 32 | } VkXcbSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( 39 | VkInstance instance, 40 | const VkXcbSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | xcb_connection_t* connection, 48 | xcb_visualid_t visual_id); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_xlib.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_H_ 2 | #define VULKAN_XLIB_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_KHR_xlib_surface 1 23 | #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 24 | #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" 25 | typedef VkFlags VkXlibSurfaceCreateFlagsKHR; 26 | typedef struct VkXlibSurfaceCreateInfoKHR { 27 | VkStructureType sType; 28 | const void* pNext; 29 | VkXlibSurfaceCreateFlagsKHR flags; 30 | Display* dpy; 31 | Window window; 32 | } VkXlibSurfaceCreateInfoKHR; 33 | 34 | typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 35 | typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); 36 | 37 | #ifndef VK_NO_PROTOTYPES 38 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( 39 | VkInstance instance, 40 | const VkXlibSurfaceCreateInfoKHR* pCreateInfo, 41 | const VkAllocationCallbacks* pAllocator, 42 | VkSurfaceKHR* pSurface); 43 | 44 | VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( 45 | VkPhysicalDevice physicalDevice, 46 | uint32_t queueFamilyIndex, 47 | Display* dpy, 48 | VisualID visualID); 49 | #endif 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /external/vulkan/vulkan/vulkan_xlib_xrandr.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_XLIB_XRANDR_H_ 2 | #define VULKAN_XLIB_XRANDR_H_ 1 3 | 4 | /* 5 | ** Copyright 2015-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | /* 11 | ** This header is generated from the Khronos Vulkan XML API Registry. 12 | ** 13 | */ 14 | 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | #define VK_EXT_acquire_xlib_display 1 23 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 24 | #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" 25 | typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); 26 | typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); 27 | 28 | #ifndef VK_NO_PROTOTYPES 29 | VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( 30 | VkPhysicalDevice physicalDevice, 31 | Display* dpy, 32 | VkDisplayKHR display); 33 | 34 | VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( 35 | VkPhysicalDevice physicalDevice, 36 | Display* dpy, 37 | RROutput rrOutput, 38 | VkDisplayKHR* pDisplay); 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(PROJECT_NAME "VulkanTemplate") 2 | file(GLOB HEADERS "*.h" "*.hpp") 3 | file(GLOB SOURCE "*.cpp" ${BASE_HEADERS} ${HEADERS}) 4 | if(WIN32) 5 | add_executable(${PROJECT_NAME} WIN32 ${MAIN_CPP} ${SOURCE}) 6 | target_link_libraries(${PROJECT_NAME} base ${Vulkan_LIBRARY} ${WINLIBS}) 7 | else(WIN32) 8 | add_executable(${PROJECT_NAME} ${MAIN_CPP} ${SOURCE}) 9 | target_link_libraries(${PROJECT_NAME} base) 10 | endif(WIN32) 11 | if(RESOURCE_INSTALL_DIR) 12 | install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) 13 | endif() --------------------------------------------------------------------------------