├── .gitignore ├── Breakout ├── Breakout.sln ├── Breakout.vcxproj ├── Breakout.vcxproj.filters ├── BreakoutGame.cpp ├── BreakoutGame.h ├── Mesh.cpp ├── Mesh.h ├── Primitive.cpp ├── Primitive.h ├── Renderer.cpp ├── Renderer.h ├── compile_all_shaders.bat ├── file_utils.cpp ├── file_utils.h ├── main.cpp ├── os_support.cpp ├── os_support.h ├── shaders │ ├── fragFlatColor.frag │ ├── fragFlatColor.frag.spv │ ├── vertColorPassthrough.vert │ └── vertColorPassthrough.vert.spv ├── stdafx.h ├── vkh.cpp └── vkh.h ├── LICENSE ├── README.md └── deps ├── glm ├── CMakeLists.txt ├── common.hpp ├── detail │ ├── _features.hpp │ ├── _fixes.hpp │ ├── _noise.hpp │ ├── _swizzle.hpp │ ├── _swizzle_func.hpp │ ├── _vectorize.hpp │ ├── dummy.cpp │ ├── func_common.hpp │ ├── func_common.inl │ ├── func_common_simd.inl │ ├── func_exponential.hpp │ ├── func_exponential.inl │ ├── func_exponential_simd.inl │ ├── func_geometric.hpp │ ├── func_geometric.inl │ ├── func_geometric_simd.inl │ ├── func_integer.hpp │ ├── func_integer.inl │ ├── func_integer_simd.inl │ ├── func_matrix.hpp │ ├── func_matrix.inl │ ├── func_matrix_simd.inl │ ├── func_packing.hpp │ ├── func_packing.inl │ ├── func_packing_simd.inl │ ├── func_trigonometric.hpp │ ├── func_trigonometric.inl │ ├── func_trigonometric_simd.inl │ ├── func_vector_relational.hpp │ ├── func_vector_relational.inl │ ├── func_vector_relational_simd.inl │ ├── glm.cpp │ ├── precision.hpp │ ├── setup.hpp │ ├── type_float.hpp │ ├── type_gentype.hpp │ ├── type_gentype.inl │ ├── type_half.hpp │ ├── type_half.inl │ ├── type_int.hpp │ ├── type_mat.hpp │ ├── type_mat.inl │ ├── type_mat2x2.hpp │ ├── type_mat2x2.inl │ ├── type_mat2x3.hpp │ ├── type_mat2x3.inl │ ├── type_mat2x4.hpp │ ├── type_mat2x4.inl │ ├── type_mat3x2.hpp │ ├── type_mat3x2.inl │ ├── type_mat3x3.hpp │ ├── type_mat3x3.inl │ ├── type_mat3x4.hpp │ ├── type_mat3x4.inl │ ├── type_mat4x2.hpp │ ├── type_mat4x2.inl │ ├── type_mat4x3.hpp │ ├── type_mat4x3.inl │ ├── type_mat4x4.hpp │ ├── type_mat4x4.inl │ ├── type_mat4x4_simd.inl │ ├── type_vec.hpp │ ├── type_vec.inl │ ├── type_vec1.hpp │ ├── type_vec1.inl │ ├── type_vec2.hpp │ ├── type_vec2.inl │ ├── type_vec3.hpp │ ├── type_vec3.inl │ ├── type_vec4.hpp │ ├── type_vec4.inl │ └── type_vec4_simd.inl ├── exponential.hpp ├── ext.hpp ├── fwd.hpp ├── geometric.hpp ├── glm.hpp ├── gtc │ ├── bitfield.hpp │ ├── bitfield.inl │ ├── color_encoding.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── constants.hpp │ ├── constants.inl │ ├── epsilon.hpp │ ├── epsilon.inl │ ├── functions.hpp │ ├── functions.inl │ ├── integer.hpp │ ├── integer.inl │ ├── matrix_access.hpp │ ├── matrix_access.inl │ ├── matrix_integer.hpp │ ├── matrix_inverse.hpp │ ├── matrix_inverse.inl │ ├── matrix_transform.hpp │ ├── matrix_transform.inl │ ├── noise.hpp │ ├── noise.inl │ ├── packing.hpp │ ├── packing.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── quaternion_simd.inl │ ├── random.hpp │ ├── random.inl │ ├── reciprocal.hpp │ ├── reciprocal.inl │ ├── round.hpp │ ├── round.inl │ ├── type_aligned.hpp │ ├── type_precision.hpp │ ├── type_precision.inl │ ├── type_ptr.hpp │ ├── type_ptr.inl │ ├── ulp.hpp │ ├── ulp.inl │ ├── vec1.hpp │ └── vec1.inl ├── gtx │ ├── associated_min_max.hpp │ ├── associated_min_max.inl │ ├── bit.hpp │ ├── bit.inl │ ├── closest_point.hpp │ ├── closest_point.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── color_space_YCoCg.hpp │ ├── color_space_YCoCg.inl │ ├── common.hpp │ ├── common.inl │ ├── compatibility.hpp │ ├── compatibility.inl │ ├── component_wise.hpp │ ├── component_wise.inl │ ├── dual_quaternion.hpp │ ├── dual_quaternion.inl │ ├── euler_angles.hpp │ ├── euler_angles.inl │ ├── extend.hpp │ ├── extend.inl │ ├── extended_min_max.hpp │ ├── extended_min_max.inl │ ├── fast_exponential.hpp │ ├── fast_exponential.inl │ ├── fast_square_root.hpp │ ├── fast_square_root.inl │ ├── fast_trigonometry.hpp │ ├── fast_trigonometry.inl │ ├── float_notmalize.inl │ ├── gradient_paint.hpp │ ├── gradient_paint.inl │ ├── handed_coordinate_space.hpp │ ├── handed_coordinate_space.inl │ ├── hash.hpp │ ├── hash.inl │ ├── integer.hpp │ ├── integer.inl │ ├── intersect.hpp │ ├── intersect.inl │ ├── io.hpp │ ├── io.inl │ ├── log_base.hpp │ ├── log_base.inl │ ├── matrix_cross_product.hpp │ ├── matrix_cross_product.inl │ ├── matrix_decompose.hpp │ ├── matrix_decompose.inl │ ├── matrix_interpolation.hpp │ ├── matrix_interpolation.inl │ ├── matrix_major_storage.hpp │ ├── matrix_major_storage.inl │ ├── matrix_operation.hpp │ ├── matrix_operation.inl │ ├── matrix_query.hpp │ ├── matrix_query.inl │ ├── matrix_transform_2d.hpp │ ├── matrix_transform_2d.inl │ ├── mixed_product.hpp │ ├── mixed_product.inl │ ├── norm.hpp │ ├── norm.inl │ ├── normal.hpp │ ├── normal.inl │ ├── normalize_dot.hpp │ ├── normalize_dot.inl │ ├── number_precision.hpp │ ├── number_precision.inl │ ├── optimum_pow.hpp │ ├── optimum_pow.inl │ ├── orthonormalize.hpp │ ├── orthonormalize.inl │ ├── perpendicular.hpp │ ├── perpendicular.inl │ ├── polar_coordinates.hpp │ ├── polar_coordinates.inl │ ├── projection.hpp │ ├── projection.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── range.hpp │ ├── raw_data.hpp │ ├── raw_data.inl │ ├── rotate_normalized_axis.hpp │ ├── rotate_normalized_axis.inl │ ├── rotate_vector.hpp │ ├── rotate_vector.inl │ ├── scalar_multiplication.hpp │ ├── scalar_relational.hpp │ ├── scalar_relational.inl │ ├── simd_mat4.hpp │ ├── simd_mat4.inl │ ├── simd_quat.hpp │ ├── simd_quat.inl │ ├── simd_vec4.hpp │ ├── simd_vec4.inl │ ├── spline.hpp │ ├── spline.inl │ ├── std_based_type.hpp │ ├── std_based_type.inl │ ├── string_cast.hpp │ ├── string_cast.inl │ ├── transform.hpp │ ├── transform.inl │ ├── transform2.hpp │ ├── transform2.inl │ ├── type_aligned.hpp │ ├── type_aligned.inl │ ├── type_trait.hpp │ ├── type_trait.inl │ ├── vector_angle.hpp │ ├── vector_angle.inl │ ├── vector_query.hpp │ ├── vector_query.inl │ ├── wrap.hpp │ └── wrap.inl ├── integer.hpp ├── mat2x2.hpp ├── mat2x3.hpp ├── mat2x4.hpp ├── mat3x2.hpp ├── mat3x3.hpp ├── mat3x4.hpp ├── mat4x2.hpp ├── mat4x3.hpp ├── mat4x4.hpp ├── matrix.hpp ├── 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 └── vulkan ├── GLSL.std.450.h ├── spirv.h ├── spirv.hpp ├── vk_icd.h ├── vk_layer.h ├── vk_layer_dispatch_table.h ├── vk_platform.h ├── vk_sdk_platform.h ├── vulkan-1.lib ├── vulkan.h └── vulkan.hpp /Breakout/Breakout.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Breakout", "Breakout.vcxproj", "{17146562-27CD-4E65-9DCF-2358589C10BC}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Debug|x64.ActiveCfg = Debug|x64 17 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Debug|x64.Build.0 = Debug|x64 18 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Debug|x86.ActiveCfg = Debug|Win32 19 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Debug|x86.Build.0 = Debug|Win32 20 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Release|x64.ActiveCfg = Release|x64 21 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Release|x64.Build.0 = Release|x64 22 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Release|x86.ActiveCfg = Release|Win32 23 | {17146562-27CD-4E65-9DCF-2358589C10BC}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /Breakout/Breakout.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {e3488a94-595c-4c51-8077-ce6692d5b383} 18 | 19 | 20 | {66e88ca8-4e50-4870-8ccd-033827649ffb} 21 | 22 | 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files\Vulkan 47 | 48 | 49 | 50 | 51 | shaders 52 | 53 | 54 | shaders 55 | 56 | 57 | Source Files 58 | 59 | 60 | 61 | 62 | Source Files 63 | 64 | 65 | Source Files 66 | 67 | 68 | Source Files 69 | 70 | 71 | Source Files 72 | 73 | 74 | Source Files 75 | 76 | 77 | Header Files 78 | 79 | 80 | Source Files 81 | 82 | 83 | Source Files\Vulkan 84 | 85 | 86 | -------------------------------------------------------------------------------- /Breakout/BreakoutGame.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //only responsible to manipulating primitive data 4 | 5 | namespace Breakout 6 | { 7 | void tick(float deltaTime); 8 | bool isGameOver(); 9 | void newGame(); 10 | void draw(); 11 | } -------------------------------------------------------------------------------- /Breakout/Mesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include 4 | #include 5 | #include "vkh.h" 6 | 7 | struct Vertex 8 | { 9 | glm::vec3 pos; 10 | }; 11 | 12 | VkVertexInputBindingDescription getVertexBindingDescription(); 13 | std::array getVertexAttributeDescriptions(); 14 | 15 | struct Mesh 16 | { 17 | VkBuffer vBuffer; 18 | VkDeviceMemory vBufferMemory; 19 | 20 | VkBuffer indexBuffer; 21 | VkDeviceMemory indexBufferMemory; 22 | 23 | int vertCount; 24 | int indexCount; 25 | }; 26 | 27 | 28 | int GetRectMesh(); 29 | int GetCircleMesh(); 30 | int CreateMesh(const std::vector& verts, const std::vector indices); 31 | Mesh* GetMeshData(int meshHdl); 32 | 33 | 34 | VkPipelineVertexInputStateCreateInfo DefaultVertexInputStateCreateInfo(); -------------------------------------------------------------------------------- /Breakout/Primitive.cpp: -------------------------------------------------------------------------------- 1 | #include "Primitive.h" 2 | 3 | #include "Mesh.h" 4 | #include "vkh.h" 5 | #include "Renderer.h" 6 | #include 7 | 8 | namespace Primitive 9 | { 10 | struct PrimitiveInstance 11 | { 12 | glm::vec3 pos; 13 | glm::vec3 scale; 14 | glm::vec4 col; 15 | int meshId; 16 | }; 17 | 18 | struct PrimitiveGameState 19 | { 20 | std::map primitives; 21 | PrimitiveUniformObject* uniformData; 22 | }; 23 | 24 | static PrimitiveGameState primitiveState; 25 | 26 | 27 | 28 | void destroyPrimitive(int handle) 29 | { 30 | primitiveState.primitives.erase(handle); 31 | } 32 | 33 | void destroyAllPrimitives() 34 | { 35 | primitiveState.primitives.clear(); 36 | } 37 | 38 | void submitPrimitives() 39 | { 40 | size_t uboAlignment = vkh::GContext.gpu.deviceProps.limits.minUniformBufferOffsetAlignment; 41 | size_t dynamicAlignment = (sizeof(PrimitiveUniformObject) / uboAlignment) * uboAlignment + ((sizeof(PrimitiveUniformObject) % uboAlignment) > 0 ? uboAlignment : 0); 42 | 43 | std::vector meshes; 44 | 45 | int idx = 0; 46 | char* uniformChar = (char*)Renderer::mapBufferPtr(MAX_PRIMS); 47 | 48 | for (const auto& prim : primitiveState.primitives) 49 | { 50 | PrimitiveUniformObject puo; 51 | puo.model = Renderer::appRenderData.VIEW_PROJECTION * (glm::translate(prim.second.pos) * glm::scale(prim.second.scale)); 52 | puo.color = prim.second.col; 53 | 54 | memcpy(&uniformChar[idx * dynamicAlignment], &puo, sizeof(PrimitiveUniformObject)); 55 | idx++; 56 | 57 | meshes.push_back(prim.second.meshId); 58 | } 59 | 60 | //comment this out to test keeping the buffer always mapped. 61 | Renderer::unmapBufferPtr(); 62 | 63 | Renderer::draw(primitiveState.uniformData, meshes); 64 | 65 | } 66 | 67 | 68 | int newPrimitive(int meshId) 69 | { 70 | static int next_prim_id = 0; 71 | 72 | PrimitiveInstance p; 73 | p.col = glm::vec4(1, 1, 1, 1); 74 | p.pos = glm::vec3(0, 0, 0); 75 | p.scale = glm::vec3(1, 1, 1); 76 | p.meshId = meshId; 77 | 78 | primitiveState.primitives.emplace(next_prim_id, p); 79 | 80 | next_prim_id++; 81 | return next_prim_id - 1; 82 | } 83 | 84 | void setPrimScale(int hdl, glm::vec3 scale) 85 | { 86 | primitiveState.primitives[hdl].scale = scale; 87 | } 88 | 89 | void setPrimPos(int hdl, glm::vec3 pos) 90 | { 91 | primitiveState.primitives[hdl].pos = pos; 92 | } 93 | 94 | glm::vec3 getPrimPos(int hdl) 95 | { 96 | return primitiveState.primitives[hdl].pos; 97 | } 98 | 99 | glm::vec3 getPrimScale(int hdl) 100 | { 101 | return primitiveState.primitives[hdl].scale; 102 | } 103 | 104 | void setPrimCol(int hdl, glm::vec4 col) 105 | { 106 | primitiveState.primitives[hdl].col = col; 107 | } 108 | } -------------------------------------------------------------------------------- /Breakout/Primitive.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | 5 | namespace Primitive 6 | { 7 | struct PrimitiveUniformObject 8 | { 9 | glm::mat4 model; 10 | glm::vec4 color; 11 | }; 12 | 13 | 14 | struct PrimitiveInstance; 15 | 16 | int newPrimitive(int meshHdl); 17 | void destroyPrimitive(int handle); 18 | 19 | void setPrimScale(int hdl, glm::vec3 scale); 20 | void setPrimPos(int hdl, glm::vec3 pos); 21 | void setPrimCol(int hdl, glm::vec4 col); 22 | 23 | glm::vec3 getPrimPos(int hdl); 24 | glm::vec3 getPrimScale(int hdl); 25 | 26 | void destroyAllPrimitives(); 27 | 28 | void submitPrimitives(); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Breakout/Renderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "vkh.h" 3 | #include 4 | #include "Primitive.h" 5 | #include "stdafx.h" 6 | 7 | namespace Renderer 8 | { 9 | typedef struct 10 | { 11 | //the input layout for all shaders used 12 | VkDescriptorSetLayout descriptorSetLayout; 13 | VkDescriptorSet descriptorSet; 14 | vkh::VkhMaterial blockMaterial; 15 | 16 | VkRenderPass renderPass; //only 1 render pass for this application 17 | std::vector swapChainFramebuffers; 18 | 19 | //Because this application is simple enough, we use a 20 | //single uniform buffer for the whole application 21 | VkBuffer stagingBuffer; 22 | VkDeviceMemory stagingBufferMemory; 23 | 24 | VkBuffer uniformBuffer; 25 | VkDeviceMemory uniformBufferMemory; 26 | 27 | //for performacne testing 28 | VkQueryPool queryPool; 29 | 30 | glm::mat4 VIEW_PROJECTION; 31 | int screenW; 32 | int screenH; 33 | 34 | }AppRenderData; 35 | 36 | extern AppRenderData appRenderData; 37 | 38 | void initializeRendering(HINSTANCE Instance, HWND wndHdl, const char* applicationName); 39 | void handleScreenResize(AppRenderData& rd); 40 | void draw(const Primitive::PrimitiveUniformObject* uniformData, const std::vector primMeshes); 41 | void* mapBufferPtr(int maxPrims); 42 | void unmapBufferPtr(); 43 | } -------------------------------------------------------------------------------- /Breakout/compile_all_shaders.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | del "./shaders/*.spv" 3 | for %%f in (./shaders/*.vert) do glslangValidator -V -o ./shaders/%%f.spv ./shaders/%%f 4 | for %%f in (./shaders/*.frag) do glslangValidator -V -o ./shaders/%%f.spv ./shaders/%%f 5 | -------------------------------------------------------------------------------- /Breakout/file_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "file_utils.h" 2 | #include 3 | #include 4 | #include 5 | 6 | BinaryBuffer* loadBinaryFile(const char* filepath) 7 | { 8 | BinaryBuffer* outBlob = new BinaryBuffer(); // (BinaryBuffer*)malloc(sizeof(BinaryBuffer)); 9 | 10 | std::ifstream file(filepath, std::ios::ate | std::ios::binary); 11 | assert(file.is_open()); 12 | 13 | outBlob->size = (size_t)file.tellg(); 14 | outBlob->data = (char*)malloc(outBlob->size); 15 | 16 | file.seekg(0); 17 | file.read(outBlob->data, outBlob->size); 18 | 19 | file.close(); 20 | 21 | assert(!file.is_open()); 22 | 23 | return outBlob; 24 | } 25 | 26 | void freeBinaryBuffer(BinaryBuffer* buffer) 27 | { 28 | assert(buffer); 29 | assert(buffer->data); 30 | delete[] buffer->data; 31 | delete buffer; 32 | } -------------------------------------------------------------------------------- /Breakout/file_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma once 3 | 4 | struct BinaryBuffer 5 | { 6 | char* data; 7 | size_t size; 8 | }; 9 | 10 | BinaryBuffer* loadBinaryFile(const char* filepath); 11 | void freeBinaryBuffer(BinaryBuffer* buffer); -------------------------------------------------------------------------------- /Breakout/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "stdafx.h" 3 | 4 | #include "os_support.h" 5 | #include "Renderer.h" 6 | #include "BreakoutGame.h" 7 | 8 | void mainLoop(); 9 | 10 | int CALLBACK WinMain(HINSTANCE Instance, HINSTANCE pInstance, LPSTR cmdLine, int showCode) 11 | { 12 | HWND wndHdl = OS::makeWindow(Instance, APP_NAME, SCREEN_W, SCREEN_H); 13 | Renderer::initializeRendering(Instance, wndHdl, APP_NAME); 14 | 15 | Breakout::newGame(); 16 | 17 | mainLoop(); 18 | 19 | return 0; 20 | } 21 | 22 | void mainLoop() 23 | { 24 | bool running = true; 25 | 26 | double lastFrame = OS::getMilliseconds(); 27 | 28 | double fpsAccum = 0.0; 29 | int count = 0; 30 | 31 | while (running) 32 | { 33 | double thisFrameTime = OS::getMilliseconds(); 34 | double deltaTime = (thisFrameTime - lastFrame); 35 | lastFrame = thisFrameTime; 36 | fpsAccum += deltaTime; 37 | 38 | if (count++ == 4999) 39 | { 40 | printf("Frametime (avg of past 5000 frames): %f ms\n", fpsAccum / 5000.0); 41 | count = 0; 42 | fpsAccum = 0; 43 | } 44 | 45 | OS::handleOSEvents(); 46 | 47 | if (OS::getKey(OS::KEY_ESCAPE)) 48 | { 49 | running = false; 50 | } 51 | 52 | if (Breakout::isGameOver()) 53 | { 54 | Breakout::newGame(); 55 | } 56 | 57 | #if STRESS_TEST 58 | Breakout::tick(0.0f); 59 | #else 60 | Breakout::tick(deltaTime); 61 | #endif 62 | 63 | Breakout::draw(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Breakout/os_support.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef WIN32_LEAN_AND_MEAN 4 | #define WIN32_LEAN_AND_MEAN 5 | #endif 6 | 7 | #define NOMINMAX 8 | #include 9 | 10 | #include 11 | 12 | namespace OS 13 | { 14 | enum KeyCode 15 | { 16 | KEY_ESCAPE = 0x01, 17 | KEY_1 = 0x02, 18 | KEY_2 = 0x03, 19 | KEY_3 = 0x04, 20 | KEY_4 = 0x05, 21 | KEY_5 = 0x06, 22 | KEY_6 = 0x07, 23 | KEY_7 = 0x08, 24 | KEY_8 = 0x09, 25 | KEY_9 = 0x0A, 26 | KEY_0 = 0x0B, 27 | KEY_MINUS = 0x0C, 28 | KEY_EQUALS = 0x0D, 29 | KEY_BACKSPACE = 0x0E, 30 | KEY_TAB = 0x0F, 31 | KEY_Q = 0x10, 32 | KEY_W = 0x11, 33 | KEY_E = 0x12, 34 | KEY_R = 0x13, 35 | KEY_T = 0x14, 36 | KEY_Y = 0x15, 37 | KEY_U = 0x16, 38 | KEY_I = 0x17, 39 | KEY_O = 0x18, 40 | KEY_P = 0x19, 41 | KEY_LBRACKET = 0x1A, 42 | KEY_RBRACKET = 0x1B, 43 | KEY_RETURN = 0x1C, 44 | KEY_LCTRL = 0x1D, 45 | KEY_A = 0x1E, 46 | KEY_S = 0x1F, 47 | KEY_D = 0x20, 48 | KEY_F = 0x21, 49 | KEY_G = 0x22, 50 | KEY_H = 0x23, 51 | KEY_J = 0x24, 52 | KEY_K = 0x25, 53 | KEY_L = 0x26, 54 | KEY_SEMICOLON = 0x27, 55 | KEY_GRAVE = 0x29, 56 | KEY_APOSTROPHE = 0x28, 57 | KEY_LSHIFT = 0x2A, 58 | KEY_BACKKSLASH = 0x2B, 59 | KEY_Z = 0x2C, 60 | KEY_X = 0x2D, 61 | KEY_C = 0x2E, 62 | KEY_V = 0x2F, 63 | KEY_B = 0x30, 64 | KEY_N = 0x31, 65 | KEY_M = 0x32, 66 | KEY_COMMA = 0x33, 67 | KEY_PERIOD = 0x34, 68 | KEY_SLASH = 0x35, 69 | KEY_RSHIFT = 0x36, 70 | KEY_SPACE = 0x39, 71 | KEY_CAPS = 0x3A, 72 | KEY_F1 = 0x3B, 73 | KEY_F2 = 0x3C, 74 | KEY_F3 = 0x3D, 75 | KEY_F4 = 0x3E, 76 | KEY_F5 = 0x3F, 77 | KEY_F6 = 0x40, 78 | KEY_F7 = 0x41, 79 | KEY_F8 = 0x42, 80 | KEY_F9 = 0x43, 81 | KEY_F10 = 0x44, 82 | KEY_F11 = 0x57, 83 | KEY_F12 = 0x58, 84 | KEY_UP = 0xC8, 85 | KEY_LEFT = 0xCB, 86 | KEY_RIGHT = 0xCD, 87 | KEY_DOWN = 0xD0 88 | }; 89 | 90 | 91 | 92 | HWND makeWindow(HINSTANCE Instance, const char* title, UINT width, UINT height); 93 | void handleOSEvents(); 94 | 95 | void setResizeCallback(std::function callback); 96 | void pollInput(); 97 | 98 | bool getKey(KeyCode key); 99 | int getMouseDX(); 100 | int getMouseDY(); 101 | int getMouseX(); 102 | int getMouseY(); 103 | 104 | void shutdown(); 105 | 106 | double getMilliseconds(); 107 | int getScreenH(); 108 | int getScreenW(); 109 | } -------------------------------------------------------------------------------- /Breakout/shaders/fragFlatColor.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) out vec4 outColor; 5 | layout(location = 0) in vec3 fragColor; 6 | 7 | void main() 8 | { 9 | outColor = vec4(fragColor, 1.0); 10 | } -------------------------------------------------------------------------------- /Breakout/shaders/fragFlatColor.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khalladay/VkBreakout/a992a8dec1ed8da3105bd817403da251b106080b/Breakout/shaders/fragFlatColor.frag.spv -------------------------------------------------------------------------------- /Breakout/shaders/vertColorPassthrough.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(set = 0, binding = 0) uniform PER_OBJECT 5 | { 6 | mat4 mvp; 7 | vec4 col; 8 | } obj; 9 | 10 | layout(location = 0) in vec3 vertex; 11 | layout(location = 0) out vec4 fragColor; 12 | 13 | out gl_PerVertex 14 | { 15 | vec4 gl_Position; 16 | }; 17 | 18 | void main() 19 | { 20 | gl_Position = obj.mvp * vec4(vertex, 1.0); 21 | fragColor = obj.col; 22 | } 23 | -------------------------------------------------------------------------------- /Breakout/shaders/vertColorPassthrough.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/khalladay/VkBreakout/a992a8dec1ed8da3105bd817403da251b106080b/Breakout/shaders/vertColorPassthrough.vert.spv -------------------------------------------------------------------------------- /Breakout/stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define GLM_FORCE_RADIANS 4 | #define GLM_FORECE_DEPTH_ZERO_TO_ONE 5 | #include 6 | #include 7 | 8 | #define APP_NAME "Vulkan Breakout" 9 | #define SCREEN_W 1280 10 | #define SCREEN_H 720 11 | 12 | #define STRESS_TEST 1 13 | #if STRESS_TEST 14 | #define MAX_PRIMS 5060 15 | #else 16 | #define MAX_PRIMS 500 17 | #endif 18 | 19 | #define ENABLE_VK_TIMESTAMP 0 20 | #define DEVICE_LOCAL_MEMORY 1 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Kyle Halladay 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 | # VkBreakout 2 | 3 | This is a quick (and not terribly fun) breakout game made to try out different parts of the Vulkan API. It's the first thing I've built with Vulkan, so please don't take it as an example of good code or project architecture, because it's awful. 4 | 5 | The project has multiple branches, representing different approaches to passing uniform data to shaders, and allocating memory. The branches marked with the prefix 01- are the branches used in my initial performance tests, presented [on my website](http://kylehalladay.com/blog/tutorial/vulkan/2017/08/13/Vulkan-Uniform-Buffers.html). 6 | 7 | The branches marked with 02 or 03 prefixes were used in the [follow up post](http://kylehalladay.com/blog/tutorial/vulkan/2017/08/30/Vulkan-Uniform-Buffers-pt2.html) 8 | 9 | The performance of the 01- branches are as follows: 10 | 11 | ![Graph](http://i.imgur.com/1TRVFSp.png) 12 | 13 | The performance of the 03- branches are as follows: 14 | 15 | ![Graph](http://i.imgur.com/RDbSSP0.png) 16 | 17 | More information about how this performance data was gathered, the reasoning behind the changes in each branch, and general implementation details can be found on the two linked blog posts. 18 | -------------------------------------------------------------------------------- /deps/glm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB ROOT_SOURCE *.cpp) 2 | file(GLOB ROOT_INLINE *.inl) 3 | file(GLOB ROOT_HEADER *.hpp) 4 | file(GLOB ROOT_TEXT ../*.txt) 5 | file(GLOB ROOT_MD ../*.md) 6 | file(GLOB ROOT_NAT ../util/glm.natvis) 7 | 8 | file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) 9 | file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) 10 | file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) 11 | 12 | file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) 13 | file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) 14 | file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) 15 | 16 | file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) 17 | file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) 18 | file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) 19 | 20 | file(GLOB_RECURSE SIMD_SOURCE ./simd/*.cpp) 21 | file(GLOB_RECURSE SIMD_INLINE ./simd/*.inl) 22 | file(GLOB_RECURSE SIMD_HEADER ./simd/*.h) 23 | 24 | source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD}) 25 | source_group("Core Files" FILES ${CORE_SOURCE}) 26 | source_group("Core Files" FILES ${CORE_INLINE}) 27 | source_group("Core Files" FILES ${CORE_HEADER}) 28 | source_group("GTC Files" FILES ${GTC_SOURCE}) 29 | source_group("GTC Files" FILES ${GTC_INLINE}) 30 | source_group("GTC Files" FILES ${GTC_HEADER}) 31 | source_group("GTX Files" FILES ${GTX_SOURCE}) 32 | source_group("GTX Files" FILES ${GTX_INLINE}) 33 | source_group("GTX Files" FILES ${GTX_HEADER}) 34 | source_group("SIMD Files" FILES ${SIMD_SOURCE}) 35 | source_group("SIMD Files" FILES ${SIMD_INLINE}) 36 | source_group("SIMD Files" FILES ${SIMD_HEADER}) 37 | 38 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 39 | 40 | if(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) 41 | if(GLM_STATIC_LIBRARY_ENABLE) 42 | add_library(glm_static STATIC ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} 43 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 44 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 45 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 46 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 47 | ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) 48 | endif(GLM_STATIC_LIBRARY_ENABLE) 49 | 50 | if(GLM_DYNAMIC_LIBRARY_ENABLE) 51 | add_library(glm_shared SHARED ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} 52 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 53 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 54 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 55 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 56 | ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) 57 | endif(GLM_DYNAMIC_LIBRARY_ENABLE) 58 | 59 | else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) 60 | add_executable(glm_dummy ${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT} 61 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 62 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 63 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 64 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 65 | ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) 66 | 67 | endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) 68 | -------------------------------------------------------------------------------- /deps/glm/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/common.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_common.hpp" 7 | -------------------------------------------------------------------------------- /deps/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 | -------------------------------------------------------------------------------- /deps/glm/detail/_noise.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/_noise.hpp 3 | 4 | #pragma once 5 | 6 | #include "../vec2.hpp" 7 | #include "../vec3.hpp" 8 | #include "../vec4.hpp" 9 | #include "../common.hpp" 10 | 11 | namespace glm{ 12 | namespace detail 13 | { 14 | template 15 | GLM_FUNC_QUALIFIER T mod289(T const & x) 16 | { 17 | return x - floor(x * static_cast(1.0) / static_cast(289.0)) * static_cast(289.0); 18 | } 19 | 20 | template 21 | GLM_FUNC_QUALIFIER T permute(T const & x) 22 | { 23 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x) 28 | { 29 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 30 | } 31 | 32 | template 33 | GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x) 34 | { 35 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x) 40 | { 41 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 42 | } 43 | /* 44 | template class vecType> 45 | GLM_FUNC_QUALIFIER vecType permute(vecType const & x) 46 | { 47 | return mod289(((x * T(34)) + T(1)) * x); 48 | } 49 | */ 50 | template 51 | GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) 52 | { 53 | return T(1.79284291400159) - T(0.85373472095314) * r; 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER tvec2 taylorInvSqrt(tvec2 const & r) 58 | { 59 | return T(1.79284291400159) - T(0.85373472095314) * r; 60 | } 61 | 62 | template 63 | GLM_FUNC_QUALIFIER tvec3 taylorInvSqrt(tvec3 const & r) 64 | { 65 | return T(1.79284291400159) - T(0.85373472095314) * r; 66 | } 67 | 68 | template 69 | GLM_FUNC_QUALIFIER tvec4 taylorInvSqrt(tvec4 const & r) 70 | { 71 | return T(1.79284291400159) - T(0.85373472095314) * r; 72 | } 73 | /* 74 | template class vecType> 75 | GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) 76 | { 77 | return T(1.79284291400159) - T(0.85373472095314) * r; 78 | } 79 | */ 80 | 81 | template 82 | GLM_FUNC_QUALIFIER tvec2 fade(tvec2 const & t) 83 | { 84 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 85 | } 86 | 87 | template 88 | GLM_FUNC_QUALIFIER tvec3 fade(tvec3 const & t) 89 | { 90 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 91 | } 92 | 93 | template 94 | GLM_FUNC_QUALIFIER tvec4 fade(tvec4 const & t) 95 | { 96 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 97 | } 98 | /* 99 | template class vecType> 100 | GLM_FUNC_QUALIFIER vecType fade(vecType const & t) 101 | { 102 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 103 | } 104 | */ 105 | }//namespace detail 106 | }//namespace glm 107 | 108 | -------------------------------------------------------------------------------- /deps/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt 13 | { 14 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 15 | { 16 | tvec4 result(uninitialize); 17 | result.data = _mm_sqrt_ps(v.data); 18 | return result; 19 | } 20 | }; 21 | 22 | template <> 23 | struct compute_sqrt 24 | { 25 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 26 | { 27 | tvec4 result(uninitialize); 28 | result.data = glm_vec4_sqrt_lowp(v.data); 29 | return result; 30 | } 31 | }; 32 | }//namespace detail 33 | }//namespace glm 34 | 35 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 36 | -------------------------------------------------------------------------------- /deps/glm/detail/func_geometric_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_geometric_simd.inl 3 | 4 | #include "../simd/geometric.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_length 13 | { 14 | GLM_FUNC_QUALIFIER static float call(tvec4 const & v) 15 | { 16 | return _mm_cvtss_f32(glm_vec4_length(v.data)); 17 | } 18 | }; 19 | 20 | template 21 | struct compute_distance 22 | { 23 | GLM_FUNC_QUALIFIER static float call(tvec4 const & p0, tvec4 const & p1) 24 | { 25 | return _mm_cvtss_f32(glm_vec4_distance(p0.data, p1.data)); 26 | } 27 | }; 28 | 29 | template 30 | struct compute_dot 31 | { 32 | GLM_FUNC_QUALIFIER static float call(tvec4 const& x, tvec4 const& y) 33 | { 34 | return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); 35 | } 36 | }; 37 | 38 | template 39 | struct compute_cross 40 | { 41 | GLM_FUNC_QUALIFIER static tvec3 call(tvec3 const & a, tvec3 const & b) 42 | { 43 | __m128 const set0 = _mm_set_ps(0.0f, a.z, a.y, a.x); 44 | __m128 const set1 = _mm_set_ps(0.0f, b.z, b.y, b.x); 45 | __m128 const xpd0 = glm_vec4_cross(set0, set1); 46 | 47 | tvec4 result(uninitialize); 48 | result.data = xpd0; 49 | return tvec3(result); 50 | } 51 | }; 52 | 53 | template 54 | struct compute_normalize 55 | { 56 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 57 | { 58 | tvec4 result(uninitialize); 59 | result.data = glm_vec4_normalize(v.data); 60 | return result; 61 | } 62 | }; 63 | 64 | template 65 | struct compute_faceforward 66 | { 67 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& N, tvec4 const& I, tvec4 const& Nref) 68 | { 69 | tvec4 result(uninitialize); 70 | result.data = glm_vec4_faceforward(N.data, I.data, Nref.data); 71 | return result; 72 | } 73 | }; 74 | 75 | template 76 | struct compute_reflect 77 | { 78 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& I, tvec4 const& N) 79 | { 80 | tvec4 result(uninitialize); 81 | result.data = glm_vec4_reflect(I.data, N.data); 82 | return result; 83 | } 84 | }; 85 | 86 | template 87 | struct compute_refract 88 | { 89 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& I, tvec4 const& N, float eta) 90 | { 91 | tvec4 result(uninitialize); 92 | result.data = glm_vec4_refract(I.data, N.data, _mm_set1_ps(eta)); 93 | return result; 94 | } 95 | }; 96 | }//namespace detail 97 | }//namespace glm 98 | 99 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 100 | -------------------------------------------------------------------------------- /deps/glm/detail/func_integer_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_integer_simd.inl 3 | 4 | #include "../simd/integer.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_bitfieldReverseStep 13 | { 14 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v, uint32 Mask, uint32 Shift) 15 | { 16 | __m128i const set0 = v.data; 17 | 18 | __m128i const set1 = _mm_set1_epi32(Mask); 19 | __m128i const and1 = _mm_and_si128(set0, set1); 20 | __m128i const sft1 = _mm_slli_epi32(and1, Shift); 21 | 22 | __m128i const set2 = _mm_andnot_si128(set0, _mm_set1_epi32(-1)); 23 | __m128i const and2 = _mm_and_si128(set0, set2); 24 | __m128i const sft2 = _mm_srai_epi32(and2, Shift); 25 | 26 | __m128i const or0 = _mm_or_si128(sft1, sft2); 27 | 28 | return or0; 29 | } 30 | }; 31 | 32 | template 33 | struct compute_bitfieldBitCountStep 34 | { 35 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v, uint32 Mask, uint32 Shift) 36 | { 37 | __m128i const set0 = v.data; 38 | 39 | __m128i const set1 = _mm_set1_epi32(Mask); 40 | __m128i const and0 = _mm_and_si128(set0, set1); 41 | __m128i const sft0 = _mm_slli_epi32(set0, Shift); 42 | __m128i const and1 = _mm_and_si128(sft0, set1); 43 | __m128i const add0 = _mm_add_epi32(and0, and1); 44 | 45 | return add0; 46 | } 47 | }; 48 | }//namespace detail 49 | 50 | # if GLM_ARCH & GLM_ARCH_AVX_BIT 51 | template <> 52 | GLM_FUNC_QUALIFIER int bitCount(uint32 x) 53 | { 54 | return _mm_popcnt_u32(x); 55 | } 56 | 57 | # if(GLM_MODEL == GLM_MODEL_64) 58 | template <> 59 | GLM_FUNC_QUALIFIER int bitCount(uint64 x) 60 | { 61 | return static_cast(_mm_popcnt_u64(x)); 62 | } 63 | # endif//GLM_MODEL 64 | # endif//GLM_ARCH 65 | 66 | }//namespace glm 67 | 68 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 69 | -------------------------------------------------------------------------------- /deps/glm/detail/func_matrix_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_matrix_simd.inl 3 | 4 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 5 | 6 | #include "type_mat4x4.hpp" 7 | #include "func_geometric.hpp" 8 | #include "../simd/matrix.h" 9 | 10 | namespace glm{ 11 | namespace detail 12 | { 13 | template 14 | struct compute_matrixCompMult 15 | { 16 | GLM_STATIC_ASSERT(detail::is_aligned

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