├── VulkanGrassRendering ├── ThirdParty │ ├── glm │ │ └── glm │ │ │ ├── gtx │ │ │ ├── type_trait.inl │ │ │ ├── raw_data.inl │ │ │ ├── type_aligned.inl │ │ │ ├── std_based_type.inl │ │ │ ├── intersect.hpp │ │ │ ├── number_precision.inl │ │ │ ├── matrix_factorisation.inl │ │ │ ├── perpendicular.inl │ │ │ ├── projection.inl │ │ │ ├── mixed_product.inl │ │ │ ├── normal.inl │ │ │ ├── float_notmalize.inl │ │ │ ├── optimum_pow.inl │ │ │ ├── log_base.inl │ │ │ ├── normalize_dot.inl │ │ │ ├── transform.inl │ │ │ ├── handed_coordinate_space.inl │ │ │ ├── exterior_product.inl │ │ │ ├── orthonormalize.inl │ │ │ ├── matrix_cross_product.inl │ │ │ ├── functions.inl │ │ │ ├── polar_coordinates.inl │ │ │ ├── scalar_relational.hpp │ │ │ ├── gradient_paint.inl │ │ │ ├── projection.hpp │ │ │ ├── extend.inl │ │ │ ├── normal.hpp │ │ │ ├── mixed_product.hpp │ │ │ ├── extend.hpp │ │ │ ├── perpendicular.hpp │ │ │ ├── exterior_product.hpp │ │ │ ├── functions.hpp │ │ │ ├── closest_point.inl │ │ │ ├── log_base.hpp │ │ │ ├── raw_data.hpp │ │ │ ├── scalar_relational.inl │ │ │ ├── matrix_cross_product.hpp │ │ │ ├── optimum_pow.hpp │ │ │ ├── orthonormalize.hpp │ │ │ ├── closest_point.hpp │ │ │ ├── polar_coordinates.hpp │ │ │ ├── matrix_decompose.hpp │ │ │ ├── string_cast.hpp │ │ │ ├── vector_angle.inl │ │ │ ├── color_encoding.hpp │ │ │ ├── wrap.hpp │ │ │ ├── gradient_paint.hpp │ │ │ ├── matrix_transform_2d.inl │ │ │ ├── handed_coordinate_space.hpp │ │ │ ├── normalize_dot.hpp │ │ │ ├── compatibility.inl │ │ │ ├── spline.hpp │ │ │ ├── wrap.inl │ │ │ ├── transform.hpp │ │ │ ├── rotate_normalized_axis.inl │ │ │ ├── color_encoding.inl │ │ │ ├── vector_angle.hpp │ │ │ ├── spline.inl │ │ │ ├── color_space_YCoCg.hpp │ │ │ ├── common.hpp │ │ │ ├── color_space.hpp │ │ │ ├── matrix_interpolation.hpp │ │ │ ├── std_based_type.hpp │ │ │ ├── range.hpp │ │ │ ├── vector_query.hpp │ │ │ ├── integer.hpp │ │ │ ├── rotate_normalized_axis.hpp │ │ │ ├── number_precision.hpp │ │ │ ├── scalar_multiplication.hpp │ │ │ ├── norm.hpp │ │ │ ├── component_wise.hpp │ │ │ ├── bit.inl │ │ │ ├── fast_square_root.inl │ │ │ ├── norm.inl │ │ │ ├── fast_trigonometry.hpp │ │ │ ├── matrix_transform_2d.hpp │ │ │ ├── matrix_operation.hpp │ │ │ ├── matrix_operation.inl │ │ │ └── matrix_query.hpp │ │ │ ├── detail │ │ │ ├── func_trigonometric_simd.inl │ │ │ ├── type_vec.inl │ │ │ ├── type_mat.inl │ │ │ ├── type_mat4x4_simd.inl │ │ │ ├── func_packing_simd.inl │ │ │ ├── func_vector_relational_simd.inl │ │ │ ├── type_half.hpp │ │ │ ├── _fixes.hpp │ │ │ ├── compute_vector_relational.hpp │ │ │ ├── func_exponential_simd.inl │ │ │ ├── func_integer_simd.inl │ │ │ ├── _noise.hpp │ │ │ ├── qualifier.hpp │ │ │ ├── type_float.hpp │ │ │ └── func_geometric_simd.inl │ │ │ ├── gtc │ │ │ ├── vec1.inl │ │ │ ├── type_precision.inl │ │ │ ├── matrix_access.inl │ │ │ ├── matrix_access.hpp │ │ │ ├── matrix_inverse.hpp │ │ │ ├── noise.hpp │ │ │ ├── epsilon.hpp │ │ │ ├── ulp.hpp │ │ │ ├── color_space.hpp │ │ │ ├── integer.inl │ │ │ ├── epsilon.inl │ │ │ └── random.hpp │ │ │ ├── vec2.hpp │ │ │ ├── vec3.hpp │ │ │ ├── vec4.hpp │ │ │ ├── simd │ │ │ ├── packing.h │ │ │ ├── vector_relational.h │ │ │ ├── trigonometric.h │ │ │ └── exponential.h │ │ │ ├── mat3x2.hpp │ │ │ ├── mat2x4.hpp │ │ │ ├── mat3x4.hpp │ │ │ ├── mat4x2.hpp │ │ │ ├── mat4x3.hpp │ │ │ ├── mat2x3.hpp │ │ │ ├── CMakeLists.txt │ │ │ └── mat2x2.hpp │ └── glfw-3.2.1.bin.WIN64 │ │ ├── lib-vc2012 │ │ ├── glfw3.dll │ │ ├── glfw3.lib │ │ └── glfw3dll.lib │ │ ├── lib-vc2013 │ │ ├── glfw3.dll │ │ ├── glfw3.lib │ │ └── glfw3dll.lib │ │ ├── lib-vc2015 │ │ ├── glfw3.dll │ │ ├── glfw3.lib │ │ └── glfw3dll.lib │ │ ├── lib-mingw-w64 │ │ ├── glfw3.dll │ │ ├── libglfw3.a │ │ └── libglfw3dll.a │ │ └── COPYING.txt ├── VulkanGrassRendering │ ├── Shaders │ │ ├── comp.spv │ │ ├── grassFrag.spv │ │ ├── grassTesc.spv │ │ ├── grassTese.spv │ │ ├── grassVert.spv │ │ ├── graphicsFrag.spv │ │ ├── graphicsVert.spv │ │ ├── graphics.frag │ │ ├── compile.bat │ │ ├── graphics.vert │ │ ├── grass.frag │ │ ├── grass.vert │ │ ├── grass.tesc │ │ └── grass.tese │ ├── Textures │ │ └── grass.jpg │ ├── main.cpp │ ├── Camera.h │ ├── Image.h │ ├── Model.h │ ├── Scene.h │ ├── Scene.cpp │ ├── Blades.cpp │ ├── Vertex.h │ ├── Model.cpp │ ├── Camera.cpp │ ├── Blades.h │ ├── Utilities.h │ └── Descriptors.h └── VulkanGrassRendering.sln └── README.md /VulkanGrassRendering/ThirdParty/glm/glm/gtx/type_trait.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.inl 3 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VulkanGrassRendering 2 | Vulkan implementation of "Responsive Real-Time Grass Rendering for General 3D Scenes" by Jahrmann and Wimmer 3 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/type_aligned.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_type_aligned 2 | /// @file glm/gtc/type_aligned.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/intersect.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glm/glm/gtx/intersect.hpp -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | /// @file glm/gtx/number_precision.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/comp.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Shaders/comp.spv -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat4x4_sse2.inl 3 | 4 | namespace glm 5 | { 6 | 7 | }//namespace glm 8 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Textures/grass.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Textures/grass.jpg -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec2.hpp" 9 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec3.hpp" 9 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec4.hpp" 9 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grassFrag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Shaders/grassFrag.spv -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grassTesc.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Shaders/grassTesc.spv -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grassTese.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Shaders/grassTese.spv -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grassVert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Shaders/grassVert.spv -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/graphicsFrag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Shaders/graphicsFrag.spv -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/graphicsVert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/VulkanGrassRendering/Shaders/graphicsVert.spv -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/matrix_factorisation.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glm/glm/gtx/matrix_factorisation.inl -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2012/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2012/glfw3.dll -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2012/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2012/glfw3.lib -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2013/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2013/glfw3.dll -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2013/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2013/glfw3.lib -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2015/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2015/glfw3.dll -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2015/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2015/glfw3.lib -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-mingw-w64/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-mingw-w64/glfw3.dll -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2012/glfw3dll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2012/glfw3dll.lib -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2013/glfw3dll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2013/glfw3dll.lib -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2015/glfw3dll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-vc2015/glfw3dll.lib -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/simd/packing.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/packing.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-mingw-w64/libglfw3.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-mingw-w64/libglfw3.a -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-mingw-w64/libglfw3dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moneimne/VulkanGrassRendering/HEAD/VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/lib-mingw-w64/libglfw3dll.a -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/simd/vector_relational.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/vector_relational.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/simd/trigonometric.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/trigonometric.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_packing_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_vector_relational_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType perp(genType const& x, genType const& Normal) 8 | { 9 | return x - proj(x, Normal); 10 | } 11 | }//namespace glm 12 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType proj(genType const& x, genType const& Normal) 8 | { 9 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 10 | } 11 | }//namespace glm 12 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/graphics.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 1) uniform sampler2D texSampler; 5 | 6 | layout(location = 0) in vec3 fragColor; 7 | layout(location = 1) in vec2 fragTexCoord; 8 | 9 | layout(location = 0) out vec4 outColor; 10 | 11 | void main() { 12 | outColor = texture(texSampler, fragTexCoord); 13 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T mixedProduct 8 | ( 9 | vec<3, T, Q> const& v1, 10 | vec<3, T, Q> const& v2, 11 | vec<3, T, Q> const& v3 12 | ) 13 | { 14 | return dot(cross(v1, v2), v3); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> triangleNormal 8 | ( 9 | vec<3, T, Q> const& p1, 10 | vec<3, T, Q> const& p2, 11 | vec<3, T, Q> const& p3 12 | ) 13 | { 14 | return normalize(cross(p1 - p2, p1 - p3)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Renderer.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main() { 9 | Renderer renderer; 10 | 11 | try { 12 | renderer.run(); 13 | } 14 | catch (const std::runtime_error& e) { 15 | std::cerr << e.what() << std::endl; 16 | return EXIT_FAILURE; 17 | } 18 | 19 | return EXIT_SUCCESS; 20 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_half.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | typedef short hdata; 12 | 13 | GLM_FUNC_DECL float toFloat32(hdata value); 14 | GLM_FUNC_DECL hdata toFloat16(float const& value); 15 | 16 | }//namespace detail 17 | }//namespace glm 18 | 19 | #include "type_half.inl" 20 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | /// @file glm/gtx/float_normalize.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v) 10 | { 11 | return vec(v) / static_cast(std::numeric_limits::max()); 12 | } 13 | 14 | }//namespace glm 15 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Camera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Camera { 6 | private: 7 | glm::mat4 viewMatrix; 8 | glm::mat4 projectionMatrix; 9 | 10 | float r, theta, phi; 11 | 12 | public: 13 | Camera(); 14 | Camera(float aspectRatio); 15 | 16 | void updateOrbit(double deltaX, double deltaY, double deltaZ); 17 | 18 | glm::mat4 getViewMatrix(); 19 | glm::mat4 getProjectionMatrix(); 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/simd/exponential.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/experimental.h 3 | 4 | #pragma once 5 | 6 | #include "platform.h" 7 | 8 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_sqrt_lowp(glm_vec4 x) 11 | { 12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x); 13 | } 14 | 15 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sqrt_lowp(glm_vec4 x) 16 | { 17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x); 18 | } 19 | 20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 21 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType pow2(genType const& x) 8 | { 9 | return x * x; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType pow3(genType const& x) 14 | { 15 | return x * x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow4(genType const& x) 20 | { 21 | return (x * x) * (x * x); 22 | } 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/_fixes.hpp 3 | 4 | #include 5 | 6 | //! Workaround for compatibility with other libraries 7 | #ifdef max 8 | #undef max 9 | #endif 10 | 11 | //! Workaround for compatibility with other libraries 12 | #ifdef min 13 | #undef min 14 | #endif 15 | 16 | //! Workaround for Android 17 | #ifdef isnan 18 | #undef isnan 19 | #endif 20 | 21 | //! Workaround for Android 22 | #ifdef isinf 23 | #undef isinf 24 | #endif 25 | 26 | //! Workaround for Chrone Native Client 27 | #ifdef log2 28 | #undef log2 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType log(genType const& x, genType const& base) 8 | { 9 | assert(!detail::compute_equal::call(x, static_cast(0))); 10 | return glm::log(x) / glm::log(base); 11 | } 12 | 13 | template 14 | GLM_FUNC_QUALIFIER vec log(vec const& x, vec const& base) 15 | { 16 | return glm::log(x) / glm::log(base); 17 | } 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T normalizeDot(vec const& x, vec const& y) 8 | { 9 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vec const& x, vec const& y) 14 | { 15 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 16 | } 17 | }//namespace glm 18 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/compile.bat: -------------------------------------------------------------------------------- 1 | %VK_SDK_PATH%\Bin\glslangValidator.exe -V graphics.vert 2 | move vert.spv graphicsVert.spv 3 | %VK_SDK_PATH%\Bin\glslangValidator.exe -V graphics.frag 4 | move frag.spv graphicsFrag.spv 5 | 6 | %VK_SDK_PATH%\Bin\glslangValidator.exe -V grass.vert 7 | move vert.spv grassVert.spv 8 | %VK_SDK_PATH%\Bin\glslangValidator.exe -V grass.frag 9 | move frag.spv grassFrag.spv 10 | %VK_SDK_PATH%\Bin\glslangValidator.exe -V grass.tesc 11 | move tesc.spv grassTesc.spv 12 | %VK_SDK_PATH%\Bin\glslangValidator.exe -V grass.tese 13 | move tese.spv grassTese.spv 14 | 15 | %VK_SDK_PATH%\Bin\glslangValidator.exe -V compute.comp 16 | pause -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/compute_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | #include 5 | #include 6 | 7 | namespace glm{ 8 | namespace detail 9 | { 10 | template ::is_iec559> 11 | struct compute_equal 12 | { 13 | GLM_FUNC_QUALIFIER static bool call(T a, T b) 14 | { 15 | return a == b; 16 | } 17 | }; 18 | 19 | template 20 | struct compute_equal 21 | { 22 | GLM_FUNC_QUALIFIER static bool call(T a, T b) 23 | { 24 | return std::memcmp(&a, &b, sizeof(T)) == 0; 25 | } 26 | }; 27 | }//namespace detail 28 | }//namespace glm 29 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/graphics.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0) uniform MvpBufferObject { 5 | mat4 model; 6 | mat4 view; 7 | mat4 proj; 8 | } mvp; 9 | 10 | layout(location = 0) in vec3 inPosition; 11 | layout(location = 1) in vec3 inColor; 12 | layout(location = 2) in vec2 inTexCoord; 13 | 14 | layout(location = 0) out vec3 fragColor; 15 | layout(location = 1) out vec2 fragTexCoord; 16 | 17 | out gl_PerVertex { 18 | vec4 gl_Position; 19 | }; 20 | 21 | void main() { 22 | gl_Position = mvp.proj * mvp.view * mvp.model * vec4(inPosition, 1.0); 23 | fragColor = inColor; 24 | fragTexCoord = inTexCoord; 25 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | /// @file glm/gtx/transform.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(vec<3, T, Q> const& v) 8 | { 9 | return translate(mat<4, 4, T, Q>(static_cast(1)), v); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(T angle, vec<3, T, Q> const& v) 14 | { 15 | return rotate(mat<4, 4, T, Q>(static_cast(1)), angle, v); 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(vec<3, T, Q> const& v) 20 | { 21 | return scale(mat<4, 4, T, Q>(static_cast(1)), v); 22 | } 23 | 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool rightHanded 8 | ( 9 | vec<3, T, Q> const& tangent, 10 | vec<3, T, Q> const& binormal, 11 | vec<3, T, Q> const& normal 12 | ) 13 | { 14 | return dot(cross(normal, tangent), binormal) > T(0); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER bool leftHanded 19 | ( 20 | vec<3, T, Q> const& tangent, 21 | vec<3, T, Q> const& binormal, 22 | vec<3, T, Q> const& normal 23 | ) 24 | { 25 | return dot(cross(normal, tangent), binormal) < T(0); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/exterior_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_geometric.inl 3 | 4 | #include 5 | 6 | namespace glm { 7 | namespace detail 8 | { 9 | template 10 | struct compute_cross_vec2 11 | { 12 | GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) 13 | { 14 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); 15 | 16 | return v.x * u.y - u.x * v.y; 17 | } 18 | }; 19 | }//namespace detail 20 | 21 | template 22 | GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) 23 | { 24 | return detail::compute_cross_vec2::value>::call(x, y); 25 | } 26 | }//namespace glm 27 | 28 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m) 8 | { 9 | mat<3, 3, T, Q> r = m; 10 | 11 | r[0] = normalize(r[0]); 12 | 13 | T d0 = dot(r[0], r[1]); 14 | r[1] -= r[0] * d0; 15 | r[1] = normalize(r[1]); 16 | 17 | T d1 = dot(r[1], r[2]); 18 | d0 = dot(r[0], r[2]); 19 | r[2] -= r[0] * d0 + r[1] * d1; 20 | r[2] = normalize(r[2]); 21 | 22 | return r; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y) 27 | { 28 | return normalize(x - y * dot(y, x)); 29 | } 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Image { 6 | public: 7 | // Create a Vulkan image 8 | static void createImage(VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory); 9 | 10 | // Handle layout transitions for images 11 | static void transitionImageLayout(VkDevice& logicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue, VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout); 12 | 13 | // Create an image view 14 | static VkImageView createImageView(VkDevice& logicalDevice, VkImage& image, VkFormat format, VkImageAspectFlags aspectFlags); 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grass.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0) uniform MvpBufferObject { 5 | mat4 model; 6 | mat4 view; 7 | mat4 proj; 8 | } mvp; 9 | 10 | layout(location = 0) in vec4 tesePosition; 11 | layout(location = 1) in vec3 teseNormal; 12 | layout(location = 2) in vec2 teseUV; 13 | 14 | layout(location = 0) out vec4 outColor; 15 | 16 | void main() { 17 | vec3 cameraPosition = -transpose(mat3(mvp.view)) * mvp.view[3].xyz; 18 | vec3 view = tesePosition.xyz - cameraPosition; 19 | vec3 normal = teseNormal; 20 | if (dot(view, teseNormal) > 0.0) { 21 | normal = -normal; 22 | } 23 | 24 | vec3 baseColor = vec3(0.0, 0.2, 0.0); 25 | vec3 tipColor = vec3(0.0, 0.6, 0.0); 26 | vec3 color = mix(baseColor, tipColor, teseUV.y); 27 | 28 | outColor = vec4(color, 1.0); 29 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Model.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "Vertex.h" 6 | 7 | const float PLANE_DIM = 15.0f; 8 | 9 | class Model { 10 | private: 11 | std::vector vertices; 12 | VkBuffer vertexBuffer; 13 | VkDeviceMemory vertexBufferMemory; 14 | 15 | std::vector indices; 16 | VkBuffer indexBuffer; 17 | VkDeviceMemory indexBufferMemory; 18 | 19 | glm::mat4 modelMatrix; 20 | 21 | public: 22 | Model(); 23 | 24 | Model(VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue); 25 | 26 | std::vector getVertices(); 27 | 28 | VkBuffer getVertexBuffer(); 29 | 30 | std::vector getIndices(); 31 | 32 | VkBuffer getIndexBuffer(); 33 | 34 | glm::mat4 getModelMatrix(); 35 | 36 | void cleanup(VkDevice& logicalDevice); 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Scene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "Camera.h" 7 | #include "Model.h" 8 | #include "Blades.h" 9 | 10 | using namespace std::chrono; 11 | 12 | struct Time { 13 | float deltaTime = 0.0f; 14 | float totalTime = 0.0f; 15 | }; 16 | 17 | class Scene { 18 | private: 19 | Camera* camera; 20 | Model* model; 21 | Blades* blades; 22 | 23 | high_resolution_clock::time_point startTime = high_resolution_clock::now(); 24 | 25 | public: 26 | Time time; 27 | Scene(); 28 | 29 | Scene(VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue, float aspectRatio); 30 | 31 | Model* getModel(); 32 | 33 | Camera* getCamera(); 34 | 35 | Blades* getBlades(); 36 | 37 | void updateTime(); 38 | 39 | void cleanup(VkDevice& logicalDevice); 40 | }; 41 | 42 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3 8 | ( 9 | vec<3, T, Q> const& x 10 | ) 11 | { 12 | mat<3, 3, T, Q> Result(T(0)); 13 | Result[0][1] = x.z; 14 | Result[1][0] = -x.z; 15 | Result[0][2] = -x.y; 16 | Result[2][0] = x.y; 17 | Result[1][2] = x.x; 18 | Result[2][1] = -x.x; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4 24 | ( 25 | vec<3, T, Q> const& x 26 | ) 27 | { 28 | mat<4, 4, T, Q> 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 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt<4, float, Q, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) 15 | { 16 | vec<4, float, Q> Result; 17 | Result.data = _mm_sqrt_ps(v.data); 18 | return Result; 19 | } 20 | }; 21 | 22 | template<> 23 | struct compute_sqrt<4, float, aligned_lowp, true> 24 | { 25 | GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const& v) 26 | { 27 | vec<4, float, aligned_lowp> Result; 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 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | /// @file glm/gtx/functions.inl 3 | 4 | #include "../exponential.hpp" 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER T gauss 10 | ( 11 | T x, 12 | T ExpectedValue, 13 | T StandardDeviation 14 | ) 15 | { 16 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER T gauss 21 | ( 22 | vec<2, T, Q> const& Coord, 23 | vec<2, T, Q> const& ExpectedValue, 24 | vec<2, T, Q> const& StandardDeviation 25 | ) 26 | { 27 | vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 28 | return exp(-(Squared.x + Squared.y)); 29 | } 30 | }//namespace glm 31 | 32 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> polar 8 | ( 9 | vec<3, T, Q> const& euclidean 10 | ) 11 | { 12 | T const Length(length(euclidean)); 13 | vec<3, T, Q> const tmp(euclidean / Length); 14 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 15 | 16 | return vec<3, T, Q>( 17 | asin(tmp.y), // latitude 18 | atan(tmp.x, tmp.z), // longitude 19 | xz_dist); // xz distance 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER vec<3, T, Q> euclidean 24 | ( 25 | vec<2, T, Q> const& polar 26 | ) 27 | { 28 | T const latitude(polar.x); 29 | T const longitude(polar.y); 30 | 31 | return vec<3, T, Q>( 32 | cos(latitude) * sin(longitude), 33 | sin(latitude), 34 | cos(latitude) * cos(longitude)); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glfw-3.2.1.bin.WIN64/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2016 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_extend extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_scalar_relational 29 | /// @{ 30 | 31 | 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "scalar_relational.inl" 37 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T radialGradient 8 | ( 9 | vec<2, T, Q> const& Center, 10 | T const& Radius, 11 | vec<2, T, Q> const& Focal, 12 | vec<2, T, Q> const& Position 13 | ) 14 | { 15 | vec<2, T, Q> F = Focal - Center; 16 | vec<2, T, Q> D = Position - Focal; 17 | T Radius2 = pow2(Radius); 18 | T Fx2 = pow2(F.x); 19 | T Fy2 = pow2(F.y); 20 | 21 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 22 | T Denominator = Radius2 - (Fx2 + Fy2); 23 | return Numerator / Denominator; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER T linearGradient 28 | ( 29 | vec<2, T, Q> const& Point0, 30 | vec<2, T, Q> const& Point1, 31 | vec<2, T, Q> const& Position 32 | ) 33 | { 34 | vec<2, T, Q> 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 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Scene.cpp: -------------------------------------------------------------------------------- 1 | #include "Scene.h" 2 | 3 | Scene::Scene() { 4 | camera = new Camera(1.0f); 5 | model = new Model(); 6 | blades = new Blades(model, NUM_BLADES); 7 | } 8 | 9 | Scene::Scene(VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue, float aspectRatio) { 10 | camera = new Camera(aspectRatio); 11 | model = new Model(logicalDevice, physicalDevice, commandPool, graphicsQueue); 12 | blades = new Blades(model, NUM_BLADES); 13 | } 14 | 15 | Model* Scene::getModel() { 16 | return model; 17 | } 18 | 19 | Camera* Scene::getCamera() { 20 | return camera; 21 | } 22 | 23 | Blades* Scene::getBlades() { 24 | return blades; 25 | } 26 | 27 | void Scene::updateTime() { 28 | high_resolution_clock::time_point currentTime = high_resolution_clock::now(); 29 | duration nextDeltaTime = duration_cast>(currentTime - startTime); 30 | startTime = currentTime; 31 | 32 | time.deltaTime = nextDeltaTime.count(); 33 | time.totalTime += time.deltaTime;; 34 | } 35 | 36 | void Scene::cleanup(VkDevice& logicalDevice) { 37 | model->cleanup(logicalDevice); 38 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_projection GLM_GTX_projection 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../geometric.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_projection extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_projection 29 | /// @{ 30 | 31 | /// Projects x on Normal. 32 | /// 33 | /// @see gtx_projection 34 | template 35 | GLM_FUNC_DECL genType proj(genType const& x, genType const& Normal); 36 | 37 | /// @} 38 | }//namespace glm 39 | 40 | #include "projection.inl" 41 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType extend 8 | ( 9 | genType const& Origin, 10 | genType const& Source, 11 | genType const& Distance 12 | ) 13 | { 14 | return Origin + (Source - Origin) * Distance; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER vec<2, T, Q> extend 19 | ( 20 | vec<2, T, Q> const& Origin, 21 | vec<2, T, Q> const& Source, 22 | T const& Distance 23 | ) 24 | { 25 | return Origin + (Source - Origin) * Distance; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER vec<3, T, Q> extend 30 | ( 31 | vec<3, T, Q> const& Origin, 32 | vec<3, T, Q> const& Source, 33 | T const& Distance 34 | ) 35 | { 36 | return Origin + (Source - Origin) * Distance; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER vec<4, T, Q> extend 41 | ( 42 | vec<4, T, Q> const& Origin, 43 | vec<4, T, Q> const& Source, 44 | T const& Distance 45 | ) 46 | { 47 | return Origin + (Source - Origin) * Distance; 48 | } 49 | }//namespace glm 50 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grass.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0) uniform MvpBufferObject { 5 | mat4 model; 6 | mat4 view; 7 | mat4 proj; 8 | } mvp; 9 | 10 | layout(location = 0) in vec4 v0; 11 | layout(location = 1) in vec4 v1; 12 | layout(location = 2) in vec4 v2; 13 | layout(location = 3) in vec4 up; 14 | 15 | layout(location = 0) out vec4 vertV1; 16 | layout(location = 1) out vec4 vertV2; 17 | layout(location = 2) out vec3 vertUp; 18 | layout(location = 3) out vec3 vertDirection; 19 | 20 | out gl_PerVertex { 21 | vec4 gl_Position; 22 | }; 23 | 24 | void main() { 25 | vec4 position = mvp.model * vec4(v0.xyz, 1.0); 26 | vertV1 = vec4((mvp.model * vec4(v1.xyz, 1.0)).xyz, v1.w); 27 | vertV2 = vec4((mvp.model * vec4(v2.xyz, 1.0)).xyz, v2.w); 28 | 29 | vertUp = normalize(vertV1.xyz - position.xyz); 30 | 31 | float orientation = v0.w; 32 | float sinTheta = sin(orientation); 33 | float cosTheta = cos(orientation); 34 | vec3 arbitraryVector = normalize(vec3(sinTheta, sinTheta + cosTheta, cosTheta)); 35 | vertDirection = normalize(cross(vertUp, arbitraryVector)); 36 | 37 | gl_Position = position; 38 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_normal GLM_GTX_normal 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Compute the normal of a triangle. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_normal extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normal 30 | /// @{ 31 | 32 | /// Computes triangle normal from triangle points. 33 | /// 34 | /// @see gtx_normal 35 | template 36 | GLM_FUNC_DECL vec<3, T, Q> triangleNormal(vec<3, T, Q> const& p1, vec<3, T, Q> const& p2, vec<3, T, Q> const& p3); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "normal.inl" 42 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Mixed product of 3 vectors. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_mixed_product 29 | /// @{ 30 | 31 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 32 | template 33 | GLM_FUNC_DECL T mixedProduct( 34 | vec<3, T, Q> const& v1, 35 | vec<3, T, Q> const& v2, 36 | vec<3, T, Q> const& v3); 37 | 38 | /// @} 39 | }// namespace glm 40 | 41 | #include "mixed_product.inl" 42 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_extend GLM_GTX_extend 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_extend extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_extend 29 | /// @{ 30 | 31 | /// Extends of Length the Origin position using the (Source - Origin) direction. 32 | /// @see gtx_extend 33 | template 34 | GLM_FUNC_DECL genType extend( 35 | genType const& Origin, 36 | genType const& Source, 37 | typename genType::value_type const Length); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "extend.inl" 43 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_projection (dependence) 6 | /// 7 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Perpendicular of a vector from other one 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/projection.hpp" 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_perpendicular 31 | /// @{ 32 | 33 | //! Projects x a perpendicular axis of Normal. 34 | //! From GLM_GTX_perpendicular extension. 35 | template 36 | GLM_FUNC_DECL genType perp(genType const& x, genType const& Normal); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "perpendicular.inl" 42 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/exterior_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_exterior_product 2 | /// @file glm/gtx/exterior_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_exterior_product (dependence) 6 | /// 7 | /// @defgroup gtx_exterior_product GLM_GTX_exterior_product 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// @brief Allow to perform bit operations on integer values 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_exterior_product extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_exterior_product 27 | /// @{ 28 | 29 | /// Returns the cross product of x and y. 30 | /// 31 | /// @tparam T Floating-point scalar types 32 | /// @tparam Q Value from qualifier enum 33 | /// 34 | /// @see Exterior product 35 | template 36 | GLM_FUNC_DECL T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u); 37 | 38 | /// @} 39 | } //namespace glm 40 | 41 | #include "exterior_product.inl" 42 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/functions.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | /// @file glm/gtx/functions.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_quaternion (dependence) 6 | /// 7 | /// @defgroup gtx_functions GLM_GTX_functions 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// List of useful common functions. 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | #include "../detail/type_vec2.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_functions extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_functions 28 | /// @{ 29 | 30 | /// 1D gauss function 31 | /// 32 | /// @see gtc_epsilon 33 | template 34 | GLM_FUNC_DECL T gauss( 35 | T x, 36 | T ExpectedValue, 37 | T StandardDeviation); 38 | 39 | /// 2D gauss function 40 | /// 41 | /// @see gtc_epsilon 42 | template 43 | GLM_FUNC_DECL T gauss( 44 | vec<2, T, Q> const& Coord, 45 | vec<2, T, Q> const& ExpectedValue, 46 | vec<2, T, Q> const& StandardDeviation); 47 | 48 | /// @} 49 | }//namespace glm 50 | 51 | #include "functions.inl" 52 | 53 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> closestPointOnLine 8 | ( 9 | vec<3, T, Q> const& point, 10 | vec<3, T, Q> const& a, 11 | vec<3, T, Q> const& b 12 | ) 13 | { 14 | T LineLength = distance(a, b); 15 | vec<3, T, Q> Vector = point - a; 16 | vec<3, T, Q> LineDirection = (b - a) / LineLength; 17 | 18 | // Project Vector to LineDirection to get the distance of point from a 19 | T Distance = dot(Vector, LineDirection); 20 | 21 | if(Distance <= T(0)) return a; 22 | if(Distance >= LineLength) return b; 23 | return a + LineDirection * Distance; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER vec<2, T, Q> closestPointOnLine 28 | ( 29 | vec<2, T, Q> const& point, 30 | vec<2, T, Q> const& a, 31 | vec<2, T, Q> const& b 32 | ) 33 | { 34 | T LineLength = distance(a, b); 35 | vec<2, T, Q> Vector = point - a; 36 | vec<2, T, Q> 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 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_log_base GLM_GTX_log_base 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Logarithm for any base. base can be a vector or a scalar. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_log_base extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_log_base 29 | /// @{ 30 | 31 | /// Logarithm for any base. 32 | /// From GLM_GTX_log_base. 33 | template 34 | GLM_FUNC_DECL genType log( 35 | genType const& x, 36 | genType const& base); 37 | 38 | /// Logarithm for any base. 39 | /// From GLM_GTX_log_base. 40 | template 41 | GLM_FUNC_DECL vec sign( 42 | vec const& x, 43 | vec const& base); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "log_base.inl" 49 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VulkanGrassRendering", "VulkanGrassRendering\VulkanGrassRendering.vcxproj", "{05E5B024-DD93-4540-BE59-8FE4B386816E}" 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 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Debug|x64.ActiveCfg = Debug|x64 17 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Debug|x64.Build.0 = Debug|x64 18 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Debug|x86.ActiveCfg = Debug|Win32 19 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Debug|x86.Build.0 = Debug|Win32 20 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Release|x64.ActiveCfg = Release|x64 21 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Release|x64.Build.0 = Release|x64 22 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Release|x86.ActiveCfg = Release|Win32 23 | {05E5B024-DD93-4540-BE59-8FE4B386816E}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType row 8 | ( 9 | genType const& m, 10 | length_t index, 11 | typename genType::row_type const& x 12 | ) 13 | { 14 | assert(index >= 0 && index < m[0].length()); 15 | 16 | genType Result = m; 17 | for(length_t i = 0; i < m.length(); ++i) 18 | Result[i][index] = x[i]; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER typename genType::row_type row 24 | ( 25 | genType const& m, 26 | length_t index 27 | ) 28 | { 29 | assert(index >= 0 && index < m[0].length()); 30 | 31 | typename genType::row_type Result; 32 | for(length_t i = 0; i < m.length(); ++i) 33 | Result[i] = m[i][index]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER genType column 39 | ( 40 | genType const& m, 41 | length_t index, 42 | typename genType::col_type const& x 43 | ) 44 | { 45 | assert(index >= 0 && index < m.length()); 46 | 47 | genType Result = m; 48 | Result[index] = x; 49 | return Result; 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER typename genType::col_type column 54 | ( 55 | genType const& m, 56 | length_t index 57 | ) 58 | { 59 | assert(index >= 0 && index < m.length()); 60 | 61 | return m[index]; 62 | } 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | #include "../detail/type_int.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_raw_data extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_raw_data 30 | /// @{ 31 | 32 | //! Type for byte numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint8 byte; 35 | 36 | //! Type for word numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint16 word; 39 | 40 | //! Type for dword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint32 dword; 43 | 44 | //! Type for qword numbers. 45 | //! From GLM_GTX_raw_data extension. 46 | typedef detail::uint64 qword; 47 | 48 | /// @} 49 | }// namespace glm 50 | 51 | #include "raw_data.inl" 52 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Blades.cpp: -------------------------------------------------------------------------------- 1 | #include "Blades.h" 2 | #include "Utilities.h" 3 | 4 | Blades::Blades() { 5 | } 6 | 7 | float generateRandomFloat() { 8 | return rand() / (float)RAND_MAX; 9 | } 10 | 11 | Blades::Blades(Model *model, int numberOfBlades) { 12 | 13 | for (int i = 0; i < numberOfBlades; i++) { 14 | Blade currentBlade = Blade(); 15 | 16 | glm::vec3 bladeUp(0.0f, 1.0f, 0.0f); 17 | 18 | // Generate positions and direction (v0) 19 | float x = (generateRandomFloat() - 0.5f) * PLANE_DIM; 20 | float y = 0.0f; 21 | float z = (generateRandomFloat() - 0.5f) * PLANE_DIM; 22 | float direction = generateRandomFloat() * TWO_PI; 23 | glm::vec3 bladePosition(x, y, z); 24 | currentBlade.v0 = glm::vec4(bladePosition, direction); 25 | 26 | // Bezier point and height (v1) 27 | float height = MIN_HEIGHT + (generateRandomFloat() * (MAX_HEIGHT - MIN_HEIGHT)); 28 | currentBlade.v1 = glm::vec4(bladePosition + bladeUp * height, height); 29 | 30 | // Physical model guide and width (v2) 31 | float width = MIN_WIDTH + (generateRandomFloat() * (MAX_WIDTH - MIN_WIDTH)); 32 | currentBlade.v2 = glm::vec4(bladePosition + bladeUp * height, width); 33 | 34 | // Up vector and stiffness coefficient (up) 35 | float stiffness = MIN_BEND + (generateRandomFloat() * (MAX_BEND - MIN_BEND)); 36 | currentBlade.up = glm::vec4(bladeUp, stiffness); 37 | 38 | blades.push_back(currentBlade); 39 | } 40 | } 41 | 42 | Blade* Blades::data() { 43 | return blades.data(); 44 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool lessThan 8 | ( 9 | T const& x, 10 | T const& y 11 | ) 12 | { 13 | return x < y; 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER bool lessThanEqual 18 | ( 19 | T const& x, 20 | T const& y 21 | ) 22 | { 23 | return x <= y; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER bool greaterThan 28 | ( 29 | T const& x, 30 | T const& y 31 | ) 32 | { 33 | return x > y; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER bool greaterThanEqual 38 | ( 39 | T const& x, 40 | T const& y 41 | ) 42 | { 43 | return x >= y; 44 | } 45 | 46 | template 47 | GLM_FUNC_QUALIFIER bool equal 48 | ( 49 | T const& x, 50 | T const& y 51 | ) 52 | { 53 | return detail::compute_equal::call(x, y); 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER bool notEqual 58 | ( 59 | T const& x, 60 | T const& y 61 | ) 62 | { 63 | return !detail::compute_equal::call(x, y); 64 | } 65 | 66 | GLM_FUNC_QUALIFIER bool any 67 | ( 68 | bool const& x 69 | ) 70 | { 71 | return x; 72 | } 73 | 74 | GLM_FUNC_QUALIFIER bool all 75 | ( 76 | bool const& x 77 | ) 78 | { 79 | return x; 80 | } 81 | 82 | GLM_FUNC_QUALIFIER bool not_ 83 | ( 84 | bool const& x 85 | ) 86 | { 87 | return !x; 88 | } 89 | }//namespace glm 90 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/matrix_cross_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Build cross product matrices 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_cross_product 30 | /// @{ 31 | 32 | //! Build a cross product matrix. 33 | //! From GLM_GTX_matrix_cross_product extension. 34 | template 35 | GLM_FUNC_DECL mat<3, 3, T, Q> matrixCross3( 36 | vec<3, T, Q> const& x); 37 | 38 | //! Build a cross product matrix. 39 | //! From GLM_GTX_matrix_cross_product extension. 40 | template 41 | GLM_FUNC_DECL mat<4, 4, T, Q> matrixCross4( 42 | vec<3, T, Q> const& x); 43 | 44 | /// @} 45 | }//namespace glm 46 | 47 | #include "matrix_cross_product.inl" 48 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/optimum_pow.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_optimum_pow GLM_GTX_optimum_pow 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Integer exponentiation of power functions. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_optimum_pow is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_optimum_pow extension included") 24 | #endif 25 | 26 | namespace glm{ 27 | namespace gtx 28 | { 29 | /// @addtogroup gtx_optimum_pow 30 | /// @{ 31 | 32 | /// Returns x raised to the power of 2. 33 | /// 34 | /// @see gtx_optimum_pow 35 | template 36 | GLM_FUNC_DECL genType pow2(genType const& x); 37 | 38 | /// Returns x raised to the power of 3. 39 | /// 40 | /// @see gtx_optimum_pow 41 | template 42 | GLM_FUNC_DECL genType pow3(genType const& x); 43 | 44 | /// Returns x raised to the power of 4. 45 | /// 46 | /// @see gtx_optimum_pow 47 | template 48 | GLM_FUNC_DECL genType pow4(genType const& x); 49 | 50 | /// @} 51 | }//namespace gtx 52 | }//namespace glm 53 | 54 | #include "optimum_pow.inl" 55 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/orthonormalize.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Orthonormalize matrices. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../vec3.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../geometric.hpp" 20 | 21 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_orthonormalize 32 | /// @{ 33 | 34 | /// Returns the orthonormalized matrix of m. 35 | /// 36 | /// @see gtx_orthonormalize 37 | template 38 | GLM_FUNC_DECL mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m); 39 | 40 | /// Orthonormalizes x according y. 41 | /// 42 | /// @see gtx_orthonormalize 43 | template 44 | GLM_FUNC_DECL vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "orthonormalize.inl" 50 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Find the point on a straight line which is the closet of a point. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_closest_point extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_closest_point 29 | /// @{ 30 | 31 | /// Find the point on a straight line which is the closet of a point. 32 | /// @see gtx_closest_point 33 | template 34 | GLM_FUNC_DECL vec<3, T, Q> closestPointOnLine( 35 | vec<3, T, Q> const& point, 36 | vec<3, T, Q> const& a, 37 | vec<3, T, Q> const& b); 38 | 39 | /// 2d lines work as well 40 | template 41 | GLM_FUNC_DECL vec<2, T, Q> closestPointOnLine( 42 | vec<2, T, Q> const& point, 43 | vec<2, T, Q> const& a, 44 | vec<2, T, Q> const& b); 45 | 46 | /// @} 47 | }// namespace glm 48 | 49 | #include "closest_point.inl" 50 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/polar_coordinates.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Conversion from Euclidean space to polar space and revert. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_polar_coordinates is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_polar_coordinates extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_polar_coordinates 29 | /// @{ 30 | 31 | /// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 32 | /// 33 | /// @see gtx_polar_coordinates 34 | template 35 | GLM_FUNC_DECL vec<3, T, Q> polar( 36 | vec<3, T, Q> const& euclidean); 37 | 38 | /// Convert Polar to Euclidean coordinates. 39 | /// 40 | /// @see gtx_polar_coordinates 41 | template 42 | GLM_FUNC_DECL vec<3, T, Q> euclidean( 43 | vec<2, T, Q> const& polar); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "polar_coordinates.inl" 49 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/matrix_decompose.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_decompose 2 | /// @file glm/gtx/matrix_decompose.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Decomposes a model matrix to translations, rotation and scale components 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../mat4x4.hpp" 17 | #include "../vec3.hpp" 18 | #include "../vec4.hpp" 19 | #include "../geometric.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | #include "../gtc/matrix_transform.hpp" 22 | 23 | #ifndef GLM_ENABLE_EXPERIMENTAL 24 | # error "GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 25 | #endif 26 | 27 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTX_matrix_decompose extension included") 29 | #endif 30 | 31 | namespace glm 32 | { 33 | /// @addtogroup gtx_matrix_decompose 34 | /// @{ 35 | 36 | /// Decomposes a model matrix to translations, rotation and scale components 37 | /// @see gtx_matrix_decompose 38 | template 39 | GLM_FUNC_DECL bool decompose( 40 | mat<4, 4, T, Q> const& modelMatrix, 41 | vec<3, T, Q> & scale, tquat & orientation, vec<3, T, Q> & translation, vec<3, T, Q> & skew, vec<4, T, Q> & perspective); 42 | 43 | /// @} 44 | }//namespace glm 45 | 46 | #include "matrix_decompose.inl" 47 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_string_cast 2 | /// @file glm/gtx/string_cast.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_integer (dependence) 6 | /// @see gtx_quaternion (dependence) 7 | /// 8 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 9 | /// @ingroup gtx 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Setup strings for GLM type values 14 | /// 15 | /// This extension is not supported with CUDA 16 | 17 | #pragma once 18 | 19 | // Dependency: 20 | #include "../glm.hpp" 21 | #include "../gtc/type_precision.hpp" 22 | #include "../gtc/quaternion.hpp" 23 | #include "../gtx/dual_quaternion.hpp" 24 | #include 25 | #include 26 | 27 | #ifndef GLM_ENABLE_EXPERIMENTAL 28 | # error "GLM: GLM_GTX_string_cast is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 29 | #endif 30 | 31 | #if(GLM_COMPILER & GLM_COMPILER_CUDA) 32 | # error "GLM_GTX_string_cast is not supported on CUDA compiler" 33 | #endif 34 | 35 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 36 | # pragma message("GLM: GLM_GTX_string_cast extension included") 37 | #endif 38 | 39 | namespace glm 40 | { 41 | /// @addtogroup gtx_string_cast 42 | /// @{ 43 | 44 | /// Create a string from a GLM vector or matrix typed variable. 45 | /// @see gtx_string_cast extension. 46 | template 47 | GLM_FUNC_DECL std::string to_string(genType const& x); 48 | 49 | /// @} 50 | }//namespace glm 51 | 52 | #include "string_cast.inl" 53 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/vector_angle.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_angle 2 | /// @file glm/gtx/vector_angle.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType angle 8 | ( 9 | genType const& x, 10 | genType const& y 11 | ) 12 | { 13 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); 14 | return acos(clamp(dot(x, y), genType(-1), genType(1))); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER T angle(vec const& x, vec const& y) 19 | { 20 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); 21 | return acos(clamp(dot(x, y), T(-1), T(1))); 22 | } 23 | 24 | //! \todo epsilon is hard coded to 0.01 25 | template 26 | GLM_FUNC_QUALIFIER T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y) 27 | { 28 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); 29 | T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); 30 | 31 | if(all(epsilonEqual(y, glm::rotate(x, Angle), T(0.0001)))) 32 | return Angle; 33 | else 34 | return -Angle; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref) 39 | { 40 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); 41 | 42 | T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); 43 | return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0)); 44 | } 45 | }//namespace glm 46 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/mat3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat3x2.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 3 columns of 2 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<3, 2, float, lowp> lowp_mat3x2; 18 | 19 | /// 3 columns of 2 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<3, 2, float, mediump> mediump_mat3x2; 25 | 26 | /// 3 columns of 2 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<3, 2, float, highp> highp_mat3x2; 32 | 33 | }//namespace 34 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grass.tesc: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(vertices = 1) out; 5 | 6 | layout(binding = 0) uniform MvpBufferObject { 7 | mat4 model; 8 | mat4 view; 9 | mat4 proj; 10 | } mvp; 11 | 12 | layout(location = 0) in vec4 vertV1[]; 13 | layout(location = 1) in vec4 vertV2[]; 14 | layout(location = 2) in vec3 vertUp[]; 15 | layout(location = 3) in vec3 vertDirection[]; 16 | 17 | layout(location = 0) patch out vec4 tescV1; 18 | layout(location = 1) patch out vec4 tescV2; 19 | layout(location = 2) patch out vec3 tescUp; 20 | layout(location = 3) patch out vec3 tescDirection; 21 | 22 | void main() { 23 | gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; 24 | 25 | tescV1 = vertV1[0]; 26 | tescV2 = vertV2[0]; 27 | tescUp = vertUp[0]; 28 | tescDirection = vertDirection[0]; 29 | 30 | vec3 cameraPosition = -transpose(mat3(mvp.view)) * mvp.view[3].xyz; 31 | const float distance = distance(gl_in[0].gl_Position.xyz, cameraPosition); 32 | const float minTessellationLevel = 3.0; 33 | const float maxTessellationLevel = 5.0; 34 | const float minDistance = 5.0; 35 | const float maxDistance = 15.0; 36 | const float tessellationRange = maxTessellationLevel - minTessellationLevel; 37 | const float distanceRange = 1.0 / (maxDistance - minDistance); 38 | const float level = minTessellationLevel + tessellationRange * (1.0 - clamp((distance - minDistance) * distanceRange, 0.0, 1.0)); 39 | 40 | gl_TessLevelInner[0] = 1.0; 41 | gl_TessLevelInner[1] = level; 42 | gl_TessLevelOuter[0] = level; 43 | gl_TessLevelOuter[1] = 1.0; 44 | gl_TessLevelOuter[2] = level; 45 | gl_TessLevelOuter[3] = 1.0; 46 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/color_encoding.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_encoding 2 | /// @file glm/gtx/color_encoding.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_color_encoding (dependence) 6 | /// 7 | /// @defgroup gtx_color_encoding GLM_GTX_color_encoding 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// @brief Allow to perform bit operations on integer values 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | #include "../vec3.hpp" 20 | #include 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_color_encoding extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_encoding 29 | /// @{ 30 | 31 | /// Convert a linear sRGB color to D65 YUV. 32 | template 33 | GLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB); 34 | 35 | /// Convert a linear sRGB color to D50 YUV. 36 | template 37 | GLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB); 38 | 39 | /// Convert a D65 YUV color to linear sRGB. 40 | template 41 | GLM_FUNC_DECL vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ); 42 | 43 | /// Convert a D65 YUV color to D50 YUV. 44 | template 45 | GLM_FUNC_DECL vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ); 46 | 47 | /// @} 48 | } //namespace glm 49 | 50 | #include "color_encoding.inl" 51 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/wrap.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_wrap 2 | /// @file glm/gtx/wrap.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_wrap GLM_GTX_wrap 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Wrapping mode of texture coordinates. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/vec1.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_wrap is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_wrap extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_wrap 30 | /// @{ 31 | 32 | /// Simulate GL_CLAMP OpenGL wrap mode 33 | /// @see gtx_wrap extension. 34 | template 35 | GLM_FUNC_DECL genType clamp(genType const& Texcoord); 36 | 37 | /// Simulate GL_REPEAT OpenGL wrap mode 38 | /// @see gtx_wrap extension. 39 | template 40 | GLM_FUNC_DECL genType repeat(genType const& Texcoord); 41 | 42 | /// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode 43 | /// @see gtx_wrap extension. 44 | template 45 | GLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord); 46 | 47 | /// Simulate GL_MIRROR_REPEAT OpenGL wrap mode 48 | /// @see gtx_wrap extension. 49 | template 50 | GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord); 51 | 52 | /// @} 53 | }// namespace glm 54 | 55 | #include "wrap.inl" 56 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/mat2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat2x4.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 2 columns of 4 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<2, 4, float, lowp> lowp_mat2x4; 18 | 19 | /// 2 columns of 4 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<2, 4, float, mediump> mediump_mat2x4; 25 | 26 | /// 2 columns of 4 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<2, 4, float, highp> highp_mat2x4; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/mat3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat3x4.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 3 columns of 4 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<3, 4, float, lowp> lowp_mat3x4; 18 | 19 | /// 3 columns of 4 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<3, 4, float, mediump> mediump_mat3x4; 25 | 26 | /// 3 columns of 4 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<3, 4, float, highp> highp_mat3x4; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/mat4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat4x2.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 4 columns of 2 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<4, 2, float, lowp> lowp_mat4x2; 18 | 19 | /// 4 columns of 2 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<4, 2, float, mediump> mediump_mat4x2; 25 | 26 | /// 4 columns of 2 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<4, 2, float, highp> highp_mat4x2; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/mat4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat4x3.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 4 columns of 3 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<4, 3, float, lowp> lowp_mat4x3; 18 | 19 | /// 4 columns of 3 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<4, 3, float, mediump> mediump_mat4x3; 25 | 26 | /// 4 columns of 3 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<4, 3, float, highp> highp_mat4x3; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/mat2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat2x3.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 2 columns of 3 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<2, 3, float, lowp> lowp_mat2x3; 18 | 19 | /// 2 columns of 3 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<2, 3, float, mediump> mediump_mat2x3; 25 | 26 | /// 2 columns of 3 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<2, 3, float, highp> highp_mat2x3; 32 | 33 | }//namespace glm 34 | 35 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Vertex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | struct Vertex { 9 | glm::vec3 pos; 10 | glm::vec3 color; 11 | glm::vec2 texCoord; 12 | 13 | // Get the binding description, which describes the rate to load data from memory 14 | static VkVertexInputBindingDescription getBindingDescription() { 15 | VkVertexInputBindingDescription bindingDescription = {}; 16 | bindingDescription.binding = 0; 17 | bindingDescription.stride = sizeof(Vertex); 18 | bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; 19 | 20 | return bindingDescription; 21 | } 22 | 23 | // Get the attribute descriptions, which describe how to handle vertex input 24 | static std::array getAttributeDescriptions() { 25 | std::array attributeDescriptions = {}; 26 | 27 | // Position 28 | attributeDescriptions[0].binding = 0; 29 | attributeDescriptions[0].location = 0; 30 | attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT; 31 | attributeDescriptions[0].offset = offsetof(Vertex, pos); 32 | 33 | // Color 34 | attributeDescriptions[1].binding = 0; 35 | attributeDescriptions[1].location = 1; 36 | attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT; 37 | attributeDescriptions[1].offset = offsetof(Vertex, color); 38 | 39 | // Texture coordinate 40 | attributeDescriptions[2].binding = 0; 41 | attributeDescriptions[2].location = 2; 42 | attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT; 43 | attributeDescriptions[2].offset = offsetof(Vertex, texCoord); 44 | 45 | return attributeDescriptions; 46 | } 47 | }; -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/matrix_access.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_access GLM_GTC_matrix_access 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Defines functions to access rows or columns of a matrix easily. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../detail/setup.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTC_matrix_access extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtc_matrix_access 25 | /// @{ 26 | 27 | /// Get a specific row of a matrix. 28 | /// @see gtc_matrix_access 29 | template 30 | GLM_FUNC_DECL typename genType::row_type row( 31 | genType const& m, 32 | length_t index); 33 | 34 | /// Set a specific row to a matrix. 35 | /// @see gtc_matrix_access 36 | template 37 | GLM_FUNC_DECL genType row( 38 | genType const& m, 39 | length_t index, 40 | typename genType::row_type const& x); 41 | 42 | /// Get a specific column of a matrix. 43 | /// @see gtc_matrix_access 44 | template 45 | GLM_FUNC_DECL typename genType::col_type column( 46 | genType const& m, 47 | length_t index); 48 | 49 | /// Set a specific column to a matrix. 50 | /// @see gtc_matrix_access 51 | template 52 | GLM_FUNC_DECL genType column( 53 | genType const& m, 54 | length_t index, 55 | typename genType::col_type const& x); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "matrix_access.inl" 61 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/gradient_paint.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_optimum_pow (dependence) 6 | /// 7 | /// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Functions that return the color of procedural gradient for specific coordinates. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/optimum_pow.hpp" 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_gradient_paint extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_gradient_paint 31 | /// @{ 32 | 33 | /// Return a color from a radial gradient. 34 | /// @see - gtx_gradient_paint 35 | template 36 | GLM_FUNC_DECL T radialGradient( 37 | vec<2, T, Q> const& Center, 38 | T const& Radius, 39 | vec<2, T, Q> const& Focal, 40 | vec<2, T, Q> const& Position); 41 | 42 | /// Return a color from a linear gradient. 43 | /// @see - gtx_gradient_paint 44 | template 45 | GLM_FUNC_DECL T linearGradient( 46 | vec<2, T, Q> const& Point0, 47 | vec<2, T, Q> const& Point1, 48 | vec<2, T, Q> const& Position); 49 | 50 | /// @} 51 | }// namespace glm 52 | 53 | #include "gradient_paint.inl" 54 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Model.cpp: -------------------------------------------------------------------------------- 1 | #include "Model.h" 2 | #include "Descriptors.h" 3 | 4 | Model::Model() { 5 | } 6 | 7 | Model::Model(VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue) { 8 | float halfWidth = PLANE_DIM * 0.5f; 9 | vertices = { 10 | { { -halfWidth, 0.0f, halfWidth },{ 1.0f, 0.0f, 0.0f },{ 1.0f, 0.0f } }, 11 | { { halfWidth, 0.0f, halfWidth },{ 0.0f, 1.0f, 0.0f },{ 0.0f, 0.0f } }, 12 | { { halfWidth, 0.0f, -halfWidth },{ 0.0f, 0.0f, 1.0f },{ 0.0f, 1.0f } }, 13 | { { -halfWidth, 0.0f, -halfWidth },{ 1.0f, 1.0f, 1.0f },{ 1.0f, 1.0f } } 14 | }; 15 | 16 | Descriptors::createVertexBuffer(vertices, vertexBuffer, vertexBufferMemory, logicalDevice, physicalDevice, commandPool, graphicsQueue); 17 | 18 | indices = { 19 | 0, 1, 2, 2, 3, 0 20 | }; 21 | 22 | Descriptors::createIndexBuffer(indices, indexBuffer, indexBufferMemory, logicalDevice, physicalDevice, commandPool, graphicsQueue); 23 | 24 | modelMatrix = glm::mat4(1.0f); 25 | } 26 | 27 | std::vector Model::getVertices() { 28 | return vertices; 29 | } 30 | 31 | VkBuffer Model::getVertexBuffer() { 32 | return vertexBuffer; 33 | } 34 | 35 | std::vector Model::getIndices() { 36 | return indices; 37 | } 38 | 39 | VkBuffer Model::getIndexBuffer() { 40 | return indexBuffer; 41 | } 42 | 43 | glm::mat4 Model::getModelMatrix() { 44 | return modelMatrix; 45 | } 46 | 47 | void Model::cleanup(VkDevice& logicalDevice) { 48 | vkDestroyBuffer(logicalDevice, indexBuffer, nullptr); 49 | vkFreeMemory(logicalDevice, indexBufferMemory, nullptr); 50 | 51 | vkDestroyBuffer(logicalDevice, vertexBuffer, nullptr); 52 | vkFreeMemory(logicalDevice, vertexBufferMemory, nullptr); 53 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/matrix_inverse.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_inverse 2 | /// @file glm/gtc/matrix_inverse.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Defines additional matrix inverting functions. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | #include "../matrix.hpp" 18 | #include "../mat2x2.hpp" 19 | #include "../mat3x3.hpp" 20 | #include "../mat4x4.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_matrix_inverse extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtc_matrix_inverse 29 | /// @{ 30 | 31 | /// Fast matrix inverse for affine matrix. 32 | /// 33 | /// @param m Input matrix to invert. 34 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly innacurate. 35 | /// @see gtc_matrix_inverse 36 | template 37 | GLM_FUNC_DECL genType affineInverse(genType const& m); 38 | 39 | /// Compute the inverse transpose of a matrix. 40 | /// 41 | /// @param m Input matrix to invert transpose. 42 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly innacurate. 43 | /// @see gtc_matrix_inverse 44 | template 45 | GLM_FUNC_DECL genType inverseTranspose(genType const& m); 46 | 47 | /// @} 48 | }//namespace glm 49 | 50 | #include "matrix_inverse.inl" 51 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/matrix_transform_2d.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_transform_2d 2 | /// @file glm/gtc/matrix_transform_2d.inl 3 | /// @author Miguel Ángel Pérez Martínez 4 | 5 | #include "../trigonometric.hpp" 6 | 7 | namespace glm 8 | { 9 | 10 | template 11 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate( 12 | mat<3, 3, T, Q> const& m, 13 | vec<2, T, Q> const& v) 14 | { 15 | mat<3, 3, T, Q> Result(m); 16 | Result[2] = m[0] * v[0] + m[1] * v[1] + m[2]; 17 | return Result; 18 | } 19 | 20 | 21 | template 22 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate( 23 | mat<3, 3, T, Q> const& m, 24 | T angle) 25 | { 26 | T const a = angle; 27 | T const c = cos(a); 28 | T const s = sin(a); 29 | 30 | mat<3, 3, T, Q> Result; 31 | Result[0] = m[0] * c + m[1] * s; 32 | Result[1] = m[0] * -s + m[1] * c; 33 | Result[2] = m[2]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale( 39 | mat<3, 3, T, Q> const& m, 40 | vec<2, T, Q> const& v) 41 | { 42 | mat<3, 3, T, Q> Result; 43 | Result[0] = m[0] * v[0]; 44 | Result[1] = m[1] * v[1]; 45 | Result[2] = m[2]; 46 | return Result; 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX( 51 | mat<3, 3, T, Q> const& m, 52 | T y) 53 | { 54 | mat<3, 3, T, Q> Result(1); 55 | Result[0][1] = y; 56 | return m * Result; 57 | } 58 | 59 | template 60 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY( 61 | mat<3, 3, T, Q> const& m, 62 | T x) 63 | { 64 | mat<3, 3, T, Q> Result(1); 65 | Result[1][0] = x; 66 | return m * Result; 67 | } 68 | 69 | }//namespace glm 70 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Shaders/grass.tese: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(quads, equal_spacing, ccw) in; 5 | 6 | layout(binding = 0) uniform MvpBufferObject { 7 | mat4 model; 8 | mat4 view; 9 | mat4 proj; 10 | } mvp; 11 | 12 | layout(location = 0) patch in vec4 tescV1; 13 | layout(location = 1) patch in vec4 tescV2; 14 | layout(location = 2) patch in vec3 tescUp; 15 | layout(location = 3) patch in vec3 tescDirection; 16 | 17 | layout(location = 0) out vec4 tesePosition; 18 | layout(location = 1) out vec3 teseNormal; 19 | layout(location = 2) out vec2 teseUV; 20 | 21 | void main() { 22 | float u = gl_TessCoord.x; 23 | float v = gl_TessCoord.y; 24 | 25 | vec3 widthOffset = tescDirection * tescV2.w; 26 | vec3 halfOffset = widthOffset * 0.5; 27 | 28 | vec3 p0 = gl_in[0].gl_Position.xyz - halfOffset; 29 | vec3 p1 = tescV1.xyz - halfOffset; 30 | vec3 p2 = tescV2.xyz - halfOffset; 31 | 32 | // Find control points on edges of blade 33 | vec3 h1 = p0 + v * (p1 - p0); 34 | vec3 h2 = p1 + v * (p2 - p1); 35 | vec3 i1 = h1 + v * (h2 - h1); 36 | vec3 i2 = i1 + widthOffset; 37 | 38 | vec3 bitangent = tescDirection; 39 | vec3 tangent; 40 | 41 | vec3 h1h2 = h2 - h1; 42 | if (dot(h1h2, h1h2) < 1e-3) { 43 | tangent = tescUp; 44 | } 45 | else { 46 | tangent = normalize(h1h2); 47 | } 48 | 49 | teseUV = vec2(u, v); 50 | teseNormal = normalize(cross(tangent, bitangent)); 51 | 52 | // Determine final vertex position based on desired blade shape 53 | float uOffset = u - 0.5; 54 | vec3 position = mix(i1, i2, u + (-sign(uOffset) * 0.5 * v)); 55 | 56 | gl_Position = mvp.proj * mvp.view * vec4(position, 1.0); 57 | tesePosition = vec4(position, 1.5 * abs(sin(tescV1.w))); 58 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/handed_coordinate_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// To know if a set of three basis vectors defines a right or left-handed coordinate system. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_handed_coordinate_space 29 | /// @{ 30 | 31 | //! Return if a trihedron right handed or not. 32 | //! From GLM_GTX_handed_coordinate_space extension. 33 | template 34 | GLM_FUNC_DECL bool rightHanded( 35 | vec<3, T, Q> const& tangent, 36 | vec<3, T, Q> const& binormal, 37 | vec<3, T, Q> const& normal); 38 | 39 | //! Return if a trihedron left handed or not. 40 | //! From GLM_GTX_handed_coordinate_space extension. 41 | template 42 | GLM_FUNC_DECL bool leftHanded( 43 | vec<3, T, Q> const& tangent, 44 | vec<3, T, Q> const& binormal, 45 | vec<3, T, Q> const& normal); 46 | 47 | /// @} 48 | }// namespace glm 49 | 50 | #include "handed_coordinate_space.inl" 51 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/normalize_dot.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_fast_square_root (dependence) 6 | /// 7 | /// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Dot product of vectors that need to be normalize with a single square root. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../gtx/fast_square_root.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_normalize_dot is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_normalize_dot extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normalize_dot 30 | /// @{ 31 | 32 | /// Normalize parameters and returns the dot product of x and y. 33 | /// It's faster that dot(normalize(x), normalize(y)). 34 | /// 35 | /// @see gtx_normalize_dot extension. 36 | template 37 | GLM_FUNC_DECL T normalizeDot(vec const& x, vec const& y); 38 | 39 | /// Normalize parameters and returns the dot product of x and y. 40 | /// Faster that dot(fastNormalize(x), fastNormalize(y)). 41 | /// 42 | /// @see gtx_normalize_dot extension. 43 | template 44 | GLM_FUNC_DECL T fastNormalizeDot(vec const& x, vec const& y); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "normalize_dot.inl" 50 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Camera.cpp: -------------------------------------------------------------------------------- 1 | #include "Camera.h" 2 | #include 3 | 4 | #define GLM_FORCE_RADIANS 5 | // Use Vulkan depth range of 0.0 to 1.0 instead of OpenGL 6 | #define GLM_FORCE_DEPTH_ZERO_TO_ONE 7 | #include 8 | 9 | Camera::Camera() { 10 | r = 10.0f; 11 | theta = 0.0f; 12 | phi = 0.0f; 13 | viewMatrix = glm::lookAt(glm::vec3(0.0f, 1.0f, 10.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)); 14 | projectionMatrix = glm::perspective(glm::radians(45.0f), 1.0f, 0.1f, 100.0f); 15 | projectionMatrix[1][1] *= -1; // y-coordinate is flipped 16 | } 17 | 18 | Camera::Camera(float aspectRatio) { 19 | r = 10.0f; 20 | theta = 0.0f; 21 | phi = 0.0f; 22 | viewMatrix = glm::lookAt(glm::vec3(0.0f, 1.0f, 10.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); 23 | projectionMatrix = glm::perspective(glm::radians(45.0f), aspectRatio, 0.1f, 100.0f); 24 | projectionMatrix[1][1] *= -1; // y-coordinate is flipped 25 | } 26 | 27 | void Camera::updateOrbit(double deltaX, double deltaY, double deltaZ) { 28 | theta += deltaX; 29 | phi += deltaY; 30 | r = glm::clamp(r - (float)deltaZ, 1.0f, 50.0f); 31 | 32 | float radTheta = glm::radians(theta); 33 | float radPhi = glm::radians(phi); 34 | 35 | glm::mat4 rotation = glm::rotate(glm::mat4(1.0f), radTheta, glm::vec3(0.0f, 1.0f, 0.0f)) * glm::rotate(glm::mat4(1.0f), radPhi, glm::vec3(1.0f, 0.0f, 0.0f)); 36 | glm::mat4 finalTransform = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f)) * rotation * glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 1.0f, r)); 37 | 38 | viewMatrix = glm::inverse(finalTransform); 39 | } 40 | 41 | glm::mat4 Camera::getViewMatrix() { 42 | return viewMatrix; 43 | } 44 | 45 | glm::mat4 Camera::getProjectionMatrix() { 46 | return projectionMatrix; 47 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/noise.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_noise 2 | /// @file glm/gtc/noise.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_noise GLM_GTC_noise 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Defines 2D, 3D and 4D procedural noise functions 12 | /// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 13 | /// https://github.com/ashima/webgl-noise 14 | /// Following Stefan Gustavson's paper "Simplex noise demystified": 15 | /// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 16 | 17 | #pragma once 18 | 19 | // Dependencies 20 | #include "../detail/setup.hpp" 21 | #include "../detail/qualifier.hpp" 22 | #include "../detail/_noise.hpp" 23 | #include "../geometric.hpp" 24 | #include "../common.hpp" 25 | #include "../vector_relational.hpp" 26 | #include "../vec2.hpp" 27 | #include "../vec3.hpp" 28 | #include "../vec4.hpp" 29 | 30 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 31 | # pragma message("GLM: GLM_GTC_noise extension included") 32 | #endif 33 | 34 | namespace glm 35 | { 36 | /// @addtogroup gtc_noise 37 | /// @{ 38 | 39 | /// Classic perlin noise. 40 | /// @see gtc_noise 41 | template 42 | GLM_FUNC_DECL T perlin( 43 | vec const& p); 44 | 45 | /// Periodic perlin noise. 46 | /// @see gtc_noise 47 | template 48 | GLM_FUNC_DECL T perlin( 49 | vec const& p, 50 | vec const& rep); 51 | 52 | /// Simplex noise. 53 | /// @see gtc_noise 54 | template 55 | GLM_FUNC_DECL T simplex( 56 | vec const& p); 57 | 58 | /// @} 59 | }//namespace glm 60 | 61 | #include "noise.inl" 62 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_compatibility 2 | /// @file glm/gtx/compatibility.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | // isfinite 9 | template 10 | GLM_FUNC_QUALIFIER bool isfinite( 11 | genType const& x) 12 | { 13 | # if GLM_HAS_CXX11_STL 14 | return std::isfinite(x) != 0; 15 | # elif GLM_COMPILER & GLM_COMPILER_VC 16 | return _finite(x); 17 | # elif GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID 18 | return _isfinite(x) != 0; 19 | # else 20 | if (std::numeric_limits::is_integer || std::denorm_absent == std::numeric_limits::has_denorm) 21 | return std::numeric_limits::min() <= x && std::numeric_limits::max() >= x; 22 | else 23 | return -std::numeric_limits::max() <= x && std::numeric_limits::max() >= x; 24 | # endif 25 | } 26 | 27 | template 28 | GLM_FUNC_QUALIFIER vec<1, bool, Q> isfinite( 29 | vec<1, T, Q> const& x) 30 | { 31 | return vec<1, bool, Q>( 32 | isfinite(x.x)); 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER vec<2, bool, Q> isfinite( 37 | vec<2, T, Q> const& x) 38 | { 39 | return vec<2, bool, Q>( 40 | isfinite(x.x), 41 | isfinite(x.y)); 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER vec<3, bool, Q> isfinite( 46 | vec<3, T, Q> const& x) 47 | { 48 | return vec<3, bool, Q>( 49 | isfinite(x.x), 50 | isfinite(x.y), 51 | isfinite(x.z)); 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER vec<4, bool, Q> isfinite( 56 | vec<4, T, Q> const& x) 57 | { 58 | return vec<4, bool, Q>( 59 | isfinite(x.x), 60 | isfinite(x.y), 61 | isfinite(x.z), 62 | isfinite(x.w)); 63 | } 64 | 65 | }//namespace glm 66 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/spline.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_spline 2 | /// @file glm/gtx/spline.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_spline GLM_GTX_spline 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Spline functions 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtx/optimum_pow.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_spline is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_spline extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_spline 30 | /// @{ 31 | 32 | /// Return a point from a catmull rom curve. 33 | /// @see gtx_spline extension. 34 | template 35 | GLM_FUNC_DECL genType catmullRom( 36 | genType const& v1, 37 | genType const& v2, 38 | genType const& v3, 39 | genType const& v4, 40 | typename genType::value_type const& s); 41 | 42 | /// Return a point from a hermite curve. 43 | /// @see gtx_spline extension. 44 | template 45 | GLM_FUNC_DECL genType hermite( 46 | genType const& v1, 47 | genType const& t1, 48 | genType const& v2, 49 | genType const& t2, 50 | typename genType::value_type const& s); 51 | 52 | /// Return a point from a cubic curve. 53 | /// @see gtx_spline extension. 54 | template 55 | GLM_FUNC_DECL genType cubic( 56 | genType const& v1, 57 | genType const& v2, 58 | genType const& v3, 59 | genType const& v4, 60 | typename genType::value_type const& s); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "spline.inl" 66 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/wrap.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_wrap 2 | /// @file glm/gtx/wrap.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec clamp(vec const& Texcoord) 8 | { 9 | return glm::clamp(Texcoord, vec(0), vec(1)); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType clamp(genType const& Texcoord) 14 | { 15 | return clamp(vec<1, genType, defaultp>(Texcoord)).x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER vec repeat(vec const& Texcoord) 20 | { 21 | return glm::fract(Texcoord); 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType repeat(genType const& Texcoord) 26 | { 27 | return repeat(vec<1, genType, defaultp>(Texcoord)).x; 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER vec mirrorClamp(vec const& Texcoord) 32 | { 33 | return glm::fract(glm::abs(Texcoord)); 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER genType mirrorClamp(genType const& Texcoord) 38 | { 39 | return mirrorClamp(vec<1, genType, defaultp>(Texcoord)).x; 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER vec mirrorRepeat(vec const& Texcoord) 44 | { 45 | vec const Abs = glm::abs(Texcoord); 46 | vec const Clamp = glm::mod(glm::floor(Abs), vec(2)); 47 | vec const Floor = glm::floor(Abs); 48 | vec const Rest = Abs - Floor; 49 | vec const Mirror = Clamp + Rest; 50 | return mix(Rest, vec(1) - Rest, glm::greaterThanEqual(Mirror, vec(1))); 51 | } 52 | 53 | template 54 | GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const& Texcoord) 55 | { 56 | return mirrorRepeat(vec<1, genType, defaultp>(Texcoord)).x; 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/transform.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | /// @file glm/gtx/transform.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_matrix_transform (dependence) 6 | /// @see gtx_transform 7 | /// @see gtx_transform2 8 | /// 9 | /// @defgroup gtx_transform GLM_GTX_transform 10 | /// @ingroup gtx 11 | /// 12 | /// Include to use the features of this extension. 13 | /// 14 | /// Add transformation matrices 15 | 16 | #pragma once 17 | 18 | // Dependency: 19 | #include "../glm.hpp" 20 | #include "../gtc/matrix_transform.hpp" 21 | 22 | #ifndef GLM_ENABLE_EXPERIMENTAL 23 | # error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 24 | #endif 25 | 26 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 27 | # pragma message("GLM: GLM_GTX_transform extension included") 28 | #endif 29 | 30 | namespace glm 31 | { 32 | /// @addtogroup gtx_transform 33 | /// @{ 34 | 35 | /// Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars. 36 | /// @see gtc_matrix_transform 37 | /// @see gtx_transform 38 | template 39 | GLM_FUNC_DECL mat<4, 4, T, Q> translate( 40 | vec<3, T, Q> const& v); 41 | 42 | /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians. 43 | /// @see gtc_matrix_transform 44 | /// @see gtx_transform 45 | template 46 | GLM_FUNC_DECL mat<4, 4, T, Q> rotate( 47 | T angle, 48 | vec<3, T, Q> const& v); 49 | 50 | /// Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components. 51 | /// @see gtc_matrix_transform 52 | /// @see gtx_transform 53 | template 54 | GLM_FUNC_DECL mat<4, 4, T, Q> scale( 55 | vec<3, T, Q> const& v); 56 | 57 | /// @} 58 | }// namespace glm 59 | 60 | #include "transform.inl" 61 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/rotate_normalized_axis.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_rotate_normalized_axis 2 | /// @file glm/gtx/rotate_normalized_axis.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotateNormalizedAxis 8 | ( 9 | mat<4, 4, T, Q> const& m, 10 | T const& angle, 11 | vec<3, T, Q> const& v 12 | ) 13 | { 14 | T const a = angle; 15 | T const c = cos(a); 16 | T const s = sin(a); 17 | 18 | vec<3, T, Q> const axis(v); 19 | 20 | vec<3, T, Q> const temp((static_cast(1) - c) * axis); 21 | 22 | mat<4, 4, T, Q> Rotate; 23 | Rotate[0][0] = c + temp[0] * axis[0]; 24 | Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2]; 25 | Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1]; 26 | 27 | Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2]; 28 | Rotate[1][1] = c + temp[1] * axis[1]; 29 | Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0]; 30 | 31 | Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1]; 32 | Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0]; 33 | Rotate[2][2] = c + temp[2] * axis[2]; 34 | 35 | mat<4, 4, T, Q> Result; 36 | Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2]; 37 | Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2]; 38 | Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2]; 39 | Result[3] = m[3]; 40 | return Result; 41 | } 42 | 43 | template 44 | GLM_FUNC_QUALIFIER tquat rotateNormalizedAxis 45 | ( 46 | tquat const& q, 47 | T const& angle, 48 | vec<3, T, Q> const& v 49 | ) 50 | { 51 | vec<3, T, Q> const Tmp(v); 52 | 53 | T const AngleRad(angle); 54 | T const Sin = sin(AngleRad * T(0.5)); 55 | 56 | return q * tquat(cos(AngleRad * static_cast(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); 57 | //return gtc::quaternion::cross(q, tquat(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin)); 58 | } 59 | }//namespace glm 60 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/color_encoding.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_encoding 2 | /// @file glm/gtx/color_encoding.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB) 8 | { 9 | vec<3, T, Q> const M(0.490f, 0.17697f, 0.2f); 10 | vec<3, T, Q> const N(0.31f, 0.8124f, 0.01063f); 11 | vec<3, T, Q> const O(0.490f, 0.01f, 0.99f); 12 | 13 | return (M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB) * static_cast(5.650675255693055f); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB) 18 | { 19 | vec<3, T, Q> const M(0.436030342570117f, 0.222438466210245f, 0.013897440074263f); 20 | vec<3, T, Q> const N(0.385101860087134f, 0.716942745571917f, 0.097076381494207f); 21 | vec<3, T, Q> const O(0.143067806654203f, 0.060618777416563f, 0.713926257896652f); 22 | 23 | return M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ) 28 | { 29 | vec<3, T, Q> const M(0.41847f, -0.091169f, 0.0009209f); 30 | vec<3, T, Q> const N(-0.15866f, 0.25243f, 0.015708f); 31 | vec<3, T, Q> const O(0.0009209f, -0.0025498f, 0.1786f); 32 | 33 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ) 38 | { 39 | vec<3, T, Q> const M(+1.047844353856414f, +0.029549007606644f, -0.009250984365223f); 40 | vec<3, T, Q> const N(+0.022898981050086f, +0.990508028941971f, +0.015072338237051f); 41 | vec<3, T, Q> const O(-0.050206647741605f, -0.017074711360960f, +0.751717835079977f); 42 | 43 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 44 | } 45 | 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/func_integer_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_integer_simd.inl 3 | 4 | #include "../simd/integer.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_bitfieldReverseStep<4, uint32, Q, true, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) 15 | { 16 | __m128i const set0 = v.data; 17 | 18 | __m128i const set1 = _mm_set1_epi32(static_cast(Mask)); 19 | __m128i const and1 = _mm_and_si128(set0, set1); 20 | __m128i const sft1 = _mm_slli_epi32(and1, Shift); 21 | 22 | __m128i const set2 = _mm_andnot_si128(set0, _mm_set1_epi32(-1)); 23 | __m128i const and2 = _mm_and_si128(set0, set2); 24 | __m128i const sft2 = _mm_srai_epi32(and2, Shift); 25 | 26 | __m128i const or0 = _mm_or_si128(sft1, sft2); 27 | 28 | return or0; 29 | } 30 | }; 31 | 32 | template 33 | struct compute_bitfieldBitCountStep<4, uint32, Q, true, true> 34 | { 35 | GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) 36 | { 37 | __m128i const set0 = v.data; 38 | 39 | __m128i const set1 = _mm_set1_epi32(static_cast(Mask)); 40 | __m128i const and0 = _mm_and_si128(set0, set1); 41 | __m128i const sft0 = _mm_slli_epi32(set0, Shift); 42 | __m128i const and1 = _mm_and_si128(sft0, set1); 43 | __m128i const add0 = _mm_add_epi32(and0, and1); 44 | 45 | return add0; 46 | } 47 | }; 48 | }//namespace detail 49 | 50 | # if GLM_ARCH & GLM_ARCH_AVX_BIT 51 | template<> 52 | GLM_FUNC_QUALIFIER int bitCount(uint32 x) 53 | { 54 | return _mm_popcnt_u32(x); 55 | } 56 | 57 | # if(GLM_MODEL == GLM_MODEL_64) 58 | template<> 59 | GLM_FUNC_QUALIFIER int bitCount(uint64 x) 60 | { 61 | return static_cast(_mm_popcnt_u64(x)); 62 | } 63 | # endif//GLM_MODEL 64 | # endif//GLM_ARCH 65 | 66 | }//namespace glm 67 | 68 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 69 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/vector_angle.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_angle 2 | /// @file glm/gtx/vector_angle.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_quaternion (dependence) 6 | /// @see gtx_epsilon (dependence) 7 | /// 8 | /// @defgroup gtx_vector_angle GLM_GTX_vector_angle 9 | /// @ingroup gtx 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Compute angle between vectors 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../glm.hpp" 19 | #include "../gtc/epsilon.hpp" 20 | #include "../gtx/quaternion.hpp" 21 | #include "../gtx/rotate_vector.hpp" 22 | 23 | #ifndef GLM_ENABLE_EXPERIMENTAL 24 | # error "GLM: GLM_GTX_vector_angle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 25 | #endif 26 | 27 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTX_vector_angle extension included") 29 | #endif 30 | 31 | namespace glm 32 | { 33 | /// @addtogroup gtx_vector_angle 34 | /// @{ 35 | 36 | //! Returns the absolute angle between two vectors. 37 | //! Parameters need to be normalized. 38 | /// @see gtx_vector_angle extension. 39 | template 40 | GLM_FUNC_DECL T angle(vec const& x, vec const& y); 41 | 42 | //! Returns the oriented angle between two 2d vectors. 43 | //! Parameters need to be normalized. 44 | /// @see gtx_vector_angle extension. 45 | template 46 | GLM_FUNC_DECL T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y); 47 | 48 | //! Returns the oriented angle between two 3d vectors based from a reference axis. 49 | //! Parameters need to be normalized. 50 | /// @see gtx_vector_angle extension. 51 | template 52 | GLM_FUNC_DECL T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref); 53 | 54 | /// @} 55 | }// namespace glm 56 | 57 | #include "vector_angle.inl" 58 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_epsilon 2 | /// @file glm/gtc/epsilon.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_quaternion (dependence) 6 | /// 7 | /// @defgroup gtc_epsilon GLM_GTC_epsilon 8 | /// @ingroup gtc 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Comparison functions for a user defined epsilon values. 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTC_epsilon extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtc_epsilon 27 | /// @{ 28 | 29 | /// Returns the component-wise comparison of |x - y| < epsilon. 30 | /// True if this expression is satisfied. 31 | /// 32 | /// @see gtc_epsilon 33 | template 34 | GLM_FUNC_DECL vec epsilonEqual(vec const& x, vec const& y, T const& epsilon); 35 | 36 | /// Returns the component-wise comparison of |x - y| < epsilon. 37 | /// True if this expression is satisfied. 38 | /// 39 | /// @see gtc_epsilon 40 | template 41 | GLM_FUNC_DECL bool epsilonEqual(genType const& x, genType const& y, genType const& epsilon); 42 | 43 | /// Returns the component-wise comparison of |x - y| < epsilon. 44 | /// True if this expression is not satisfied. 45 | /// 46 | /// @see gtc_epsilon 47 | template 48 | GLM_FUNC_DECL vec epsilonNotEqual(vec const& x, vec const& y, T 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 bool epsilonNotEqual(genType const& x, genType const& y, genType const& epsilon); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "epsilon.inl" 61 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/spline.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_spline 2 | /// @file glm/gtx/spline.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType catmullRom 8 | ( 9 | genType const& v1, 10 | genType const& v2, 11 | genType const& v3, 12 | genType const& v4, 13 | typename genType::value_type const& s 14 | ) 15 | { 16 | typename genType::value_type s2 = pow2(s); 17 | typename genType::value_type s3 = pow3(s); 18 | 19 | typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s; 20 | typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2); 21 | typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s; 22 | typename genType::value_type f4 = s3 - s2; 23 | 24 | return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2); 25 | 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER genType hermite 30 | ( 31 | genType const& v1, 32 | genType const& t1, 33 | genType const& v2, 34 | genType const& t2, 35 | typename genType::value_type const& s 36 | ) 37 | { 38 | typename genType::value_type s2 = pow2(s); 39 | typename genType::value_type s3 = pow3(s); 40 | 41 | typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1); 42 | typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2; 43 | typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s; 44 | typename genType::value_type f4 = s3 - s2; 45 | 46 | return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER genType cubic 51 | ( 52 | genType const& v1, 53 | genType const& v2, 54 | genType const& v3, 55 | genType const& v4, 56 | typename genType::value_type const& s 57 | ) 58 | { 59 | return ((v1 * s + v2) * s + v3) * s + v4; 60 | } 61 | }//namespace glm 62 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/color_space_YCoCg.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_space_YCoCg 2 | /// @file glm/gtx/color_space_YCoCg.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_color_space_YCoCg GLM_GTX_color_space_YCoCg 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// RGB to YCoCg conversions and operations 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_color_space_YCoCg is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_color_space_YCoCg extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_space_YCoCg 29 | /// @{ 30 | 31 | /// Convert a color from RGB color space to YCoCg color space. 32 | /// @see gtx_color_space_YCoCg 33 | template 34 | GLM_FUNC_DECL vec<3, T, Q> rgb2YCoCg( 35 | vec<3, T, Q> const& rgbColor); 36 | 37 | /// Convert a color from YCoCg color space to RGB color space. 38 | /// @see gtx_color_space_YCoCg 39 | template 40 | GLM_FUNC_DECL vec<3, T, Q> YCoCg2rgb( 41 | vec<3, T, Q> const& YCoCgColor); 42 | 43 | /// Convert a color from RGB color space to YCoCgR color space. 44 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 45 | /// @see gtx_color_space_YCoCg 46 | template 47 | GLM_FUNC_DECL vec<3, T, Q> rgb2YCoCgR( 48 | vec<3, T, Q> const& rgbColor); 49 | 50 | /// Convert a color from YCoCgR color space to RGB color space. 51 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 52 | /// @see gtx_color_space_YCoCg 53 | template 54 | GLM_FUNC_DECL vec<3, T, Q> YCoCgR2rgb( 55 | vec<3, T, Q> const& YCoCgColor); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "color_space_YCoCg.inl" 61 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/ulp.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_ulp 2 | /// @file glm/gtc/ulp.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_ulp GLM_GTC_ulp 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Allow the measurement of the accuracy of a function against a reference 12 | /// implementation. This extension works on floating-point data and provide results 13 | /// in ULP. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/qualifier.hpp" 20 | #include "../detail/type_int.hpp" 21 | #include "../detail/compute_vector_relational.hpp" 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTC_ulp extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtc_ulp 30 | /// @{ 31 | 32 | /// Return the next ULP value(s) after the input value(s). 33 | /// @see gtc_ulp 34 | template 35 | GLM_FUNC_DECL genType next_float(genType const& x); 36 | 37 | /// Return the previous ULP value(s) before the input value(s). 38 | /// @see gtc_ulp 39 | template 40 | GLM_FUNC_DECL genType prev_float(genType const& x); 41 | 42 | /// Return the value(s) ULP distance after the input value(s). 43 | /// @see gtc_ulp 44 | template 45 | GLM_FUNC_DECL genType next_float(genType const& x, uint const& Distance); 46 | 47 | /// Return the value(s) ULP distance before the input value(s). 48 | /// @see gtc_ulp 49 | template 50 | GLM_FUNC_DECL genType prev_float(genType const& x, uint const& Distance); 51 | 52 | /// Return the distance in the number of ULP between 2 scalars. 53 | /// @see gtc_ulp 54 | template 55 | GLM_FUNC_DECL uint float_distance(T const& x, T const& y); 56 | 57 | /// Return the distance in the number of ULP between 2 vectors. 58 | /// @see gtc_ulp 59 | template 60 | GLM_FUNC_DECL vec<2, uint, Q> float_distance(vec<2, T, Q> const& x, vec<2, T, Q> const& y); 61 | 62 | /// @} 63 | }// namespace glm 64 | 65 | #include "ulp.inl" 66 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 11 | /// 12 | /// Allow to perform bit operations on integer values 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.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 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 35 | template 36 | GLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear); 37 | 38 | /// Convert a linear color to sRGB color using a custom gamma correction. 39 | /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 40 | template 41 | GLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear, T Gamma); 42 | 43 | /// Convert a sRGB color to linear color using a standard gamma correction. 44 | /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 45 | template 46 | GLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB); 47 | 48 | /// Convert a sRGB color to linear color using a custom gamma correction. 49 | // IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 50 | template 51 | GLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB, T Gamma); 52 | 53 | /// @} 54 | } //namespace glm 55 | 56 | #include "color_space.inl" 57 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_common 2 | /// @file glm/gtx/common.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_common GLM_GTX_common 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @brief Provide functions to increase the compatibility with Cg and HLSL languages 12 | 13 | #pragma once 14 | 15 | // Dependencies: 16 | #include "../vec2.hpp" 17 | #include "../vec3.hpp" 18 | #include "../vec4.hpp" 19 | #include "../gtc/vec1.hpp" 20 | 21 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_common is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_common extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_common 32 | /// @{ 33 | 34 | /// Returns true if x is a denormalized number 35 | /// Numbers whose absolute value is too small to be represented in the normal format are represented in an alternate, denormalized format. 36 | /// This format is less precise but can represent values closer to zero. 37 | /// 38 | /// @tparam genType Floating-point scalar or vector types. 39 | /// 40 | /// @see GLSL isnan man page 41 | /// @see GLSL 4.20.8 specification, section 8.3 Common Functions 42 | template 43 | GLM_FUNC_DECL typename genType::bool_type isdenormal(genType const& x); 44 | 45 | /// Similar to 'mod' but with a different rounding and integer support. 46 | /// Returns 'x - y * trunc(x/y)' instead of 'x - y * floor(x/y)' 47 | /// 48 | /// @see GLSL mod vs HLSL fmod 49 | /// @see GLSL mod man page 50 | template 51 | GLM_FUNC_DECL vec fmod(vec const& v); 52 | 53 | /// @} 54 | }//namespace glm 55 | 56 | #include "common.inl" 57 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/color_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_space 2 | /// @file glm/gtx/color_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_color_space GLM_GTX_color_space 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Related to RGB to HSV conversions and operations. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_color_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_color_space extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_space 29 | /// @{ 30 | 31 | /// Converts a color from HSV color space to its color in RGB color space. 32 | /// @see gtx_color_space 33 | template 34 | GLM_FUNC_DECL vec<3, T, Q> rgbColor( 35 | vec<3, T, Q> const& hsvValue); 36 | 37 | /// Converts a color from RGB color space to its color in HSV color space. 38 | /// @see gtx_color_space 39 | template 40 | GLM_FUNC_DECL vec<3, T, Q> hsvColor( 41 | vec<3, T, Q> const& rgbValue); 42 | 43 | /// Build a saturation matrix. 44 | /// @see gtx_color_space 45 | template 46 | GLM_FUNC_DECL mat<4, 4, T, defaultp> saturation( 47 | T const s); 48 | 49 | /// Modify the saturation of a color. 50 | /// @see gtx_color_space 51 | template 52 | GLM_FUNC_DECL vec<3, T, Q> saturation( 53 | T const s, 54 | vec<3, T, Q> const& color); 55 | 56 | /// Modify the saturation of a color. 57 | /// @see gtx_color_space 58 | template 59 | GLM_FUNC_DECL vec<4, T, Q> saturation( 60 | T const s, 61 | vec<4, T, Q> const& color); 62 | 63 | /// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals. 64 | /// @see gtx_color_space 65 | template 66 | GLM_FUNC_DECL T luminosity( 67 | vec<3, T, Q> const& color); 68 | 69 | /// @} 70 | }//namespace glm 71 | 72 | #include "color_space.inl" 73 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/matrix_interpolation.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_interpolation 2 | /// @file glm/gtx/matrix_interpolation.hpp 3 | /// @author Ghenadii Ursachi (the.asteroth@gmail.com) 4 | /// 5 | /// @see core (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_interpolation GLM_GTX_matrix_interpolation 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Allows to directly interpolate two exiciting matrices. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_matrix_interpolation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_interpolation extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_interpolation 30 | /// @{ 31 | 32 | /// Get the axis and angle of the rotation from a matrix. 33 | /// From GLM_GTX_matrix_interpolation extension. 34 | template 35 | GLM_FUNC_DECL void axisAngle( 36 | mat<4, 4, T, Q> const& mat, 37 | vec<3, T, Q> & axis, 38 | T & angle); 39 | 40 | /// Build a matrix from axis and angle. 41 | /// From GLM_GTX_matrix_interpolation extension. 42 | template 43 | GLM_FUNC_DECL mat<4, 4, T, Q> axisAngleMatrix( 44 | vec<3, T, Q> const& axis, 45 | T const angle); 46 | 47 | /// Extracts the rotation part of a matrix. 48 | /// From GLM_GTX_matrix_interpolation extension. 49 | template 50 | GLM_FUNC_DECL mat<4, 4, T, Q> extractMatrixRotation( 51 | mat<4, 4, T, Q> const& mat); 52 | 53 | /// Build a interpolation of 4 * 4 matrixes. 54 | /// From GLM_GTX_matrix_interpolation extension. 55 | /// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results. 56 | template 57 | GLM_FUNC_DECL mat<4, 4, T, Q> interpolate( 58 | mat<4, 4, T, Q> const& m1, 59 | mat<4, 4, T, Q> const& m2, 60 | T const delta); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "matrix_interpolation.inl" 66 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/std_based_type.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_std_based_type GLM_GTX_std_based_type 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Adds vector types based on STL value types. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_std_based_type is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_std_based_type extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_std_based_type 31 | /// @{ 32 | 33 | /// Vector type based of one std::size_t component. 34 | /// @see GLM_GTX_std_based_type 35 | typedef vec<1, std::size_t, defaultp> size1; 36 | 37 | /// Vector type based of two std::size_t components. 38 | /// @see GLM_GTX_std_based_type 39 | typedef vec<2, std::size_t, defaultp> size2; 40 | 41 | /// Vector type based of three std::size_t components. 42 | /// @see GLM_GTX_std_based_type 43 | typedef vec<3, std::size_t, defaultp> size3; 44 | 45 | /// Vector type based of four std::size_t components. 46 | /// @see GLM_GTX_std_based_type 47 | typedef vec<4, std::size_t, defaultp> size4; 48 | 49 | /// Vector type based of one std::size_t component. 50 | /// @see GLM_GTX_std_based_type 51 | typedef vec<1, std::size_t, defaultp> size1_t; 52 | 53 | /// Vector type based of two std::size_t components. 54 | /// @see GLM_GTX_std_based_type 55 | typedef vec<2, std::size_t, defaultp> size2_t; 56 | 57 | /// Vector type based of three std::size_t components. 58 | /// @see GLM_GTX_std_based_type 59 | typedef vec<3, std::size_t, defaultp> size3_t; 60 | 61 | /// Vector type based of four std::size_t components. 62 | /// @see GLM_GTX_std_based_type 63 | typedef vec<4, std::size_t, defaultp> size4_t; 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "std_based_type.inl" 69 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Blades.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "Model.h" 8 | 9 | const int NUM_BLADES = 1 << 13; 10 | const float MIN_HEIGHT = 1.3f; 11 | const float MAX_HEIGHT = 2.5f; 12 | const float MIN_WIDTH = 0.1f; 13 | const float MAX_WIDTH = 0.14f; 14 | const float MIN_BEND = 7.0f; 15 | const float MAX_BEND = 13.0f; 16 | 17 | struct Blade { 18 | // Position and direction 19 | glm::vec4 v0; 20 | // Bezier point and height 21 | glm::vec4 v1; 22 | // Physical model guide and width 23 | glm::vec4 v2; 24 | // Up vector and stiffness coefficient 25 | glm::vec4 up; 26 | 27 | static VkVertexInputBindingDescription getBindingDescription() { 28 | VkVertexInputBindingDescription bindingDescription = {}; 29 | bindingDescription.binding = 0; 30 | bindingDescription.stride = sizeof(Blade); 31 | bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; 32 | 33 | return bindingDescription; 34 | } 35 | 36 | static std::array getAttributeDescriptions() { 37 | std::array attributeDescriptions = {}; 38 | 39 | // v0 40 | attributeDescriptions[0].binding = 0; 41 | attributeDescriptions[0].location = 0; 42 | attributeDescriptions[0].format = VK_FORMAT_R32G32B32A32_SFLOAT; 43 | attributeDescriptions[0].offset = offsetof(Blade, v0); 44 | 45 | // v1 46 | attributeDescriptions[1].binding = 0; 47 | attributeDescriptions[1].location = 1; 48 | attributeDescriptions[1].format = VK_FORMAT_R32G32B32A32_SFLOAT; 49 | attributeDescriptions[1].offset = offsetof(Blade, v1); 50 | 51 | // v2 52 | attributeDescriptions[2].binding = 0; 53 | attributeDescriptions[2].location = 2; 54 | attributeDescriptions[2].format = VK_FORMAT_R32G32B32A32_SFLOAT; 55 | attributeDescriptions[2].offset = offsetof(Blade, v2); 56 | 57 | // up 58 | attributeDescriptions[3].binding = 0; 59 | attributeDescriptions[3].location = 3; 60 | attributeDescriptions[3].format = VK_FORMAT_R32G32B32A32_SFLOAT; 61 | attributeDescriptions[3].offset = offsetof(Blade, up); 62 | 63 | return attributeDescriptions; 64 | } 65 | }; 66 | 67 | class Blades { 68 | private: 69 | std::vector blades; 70 | 71 | public: 72 | Blades(); 73 | Blades(Model *model, int numberOfBlades); 74 | 75 | Blade* data(); 76 | }; 77 | 78 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/range.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_range 2 | /// @file glm/gtx/range.hpp 3 | /// @author Joshua Moerman 4 | /// 5 | /// @defgroup gtx_range GLM_GTX_range 6 | /// @ingroup gtx 7 | /// 8 | /// Include to use the features of this extension. 9 | /// 10 | /// Defines begin and end for vectors and matrices. Useful for range-based for loop. 11 | /// The range is defined over the elements, not over columns or rows (e.g. mat4 has 16 elements). 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_range is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if !GLM_HAS_RANGE_FOR 23 | # error "GLM_GTX_range requires C++11 suppport or 'range for'" 24 | #endif 25 | 26 | #include "../gtc/type_ptr.hpp" 27 | #include "../gtc/vec1.hpp" 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_range 32 | /// @{ 33 | 34 | template 35 | inline length_t components(vec<1, T, Q> const& v) 36 | { 37 | return v.length(); 38 | } 39 | 40 | template 41 | inline length_t components(vec<2, T, Q> const& v) 42 | { 43 | return v.length(); 44 | } 45 | 46 | template 47 | inline length_t components(vec<3, T, Q> const& v) 48 | { 49 | return v.length(); 50 | } 51 | 52 | template 53 | inline length_t components(vec<4, T, Q> const& v) 54 | { 55 | return v.length(); 56 | } 57 | 58 | template 59 | inline length_t components(genType const& m) 60 | { 61 | return m.length() * m[0].length(); 62 | } 63 | 64 | template 65 | inline typename genType::value_type const * begin(genType const& v) 66 | { 67 | return value_ptr(v); 68 | } 69 | 70 | template 71 | inline typename genType::value_type const * end(genType const& v) 72 | { 73 | return begin(v) + components(v); 74 | } 75 | 76 | template 77 | inline typename genType::value_type * begin(genType& v) 78 | { 79 | return value_ptr(v); 80 | } 81 | 82 | template 83 | inline typename genType::value_type * end(genType& v) 84 | { 85 | return begin(v) + components(v); 86 | } 87 | 88 | /// @} 89 | }//namespace glm 90 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/vector_query.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_query 2 | /// @file glm/gtx/vector_query.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_vector_query GLM_GTX_vector_query 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Query informations of vector types 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include 18 | #include 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_vector_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_vector_query extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_vector_query 31 | /// @{ 32 | 33 | //! Check whether two vectors are collinears. 34 | /// @see gtx_vector_query extensions. 35 | template 36 | GLM_FUNC_DECL bool areCollinear(vec const& v0, vec const& v1, T const& epsilon); 37 | 38 | //! Check whether two vectors are orthogonals. 39 | /// @see gtx_vector_query extensions. 40 | template 41 | GLM_FUNC_DECL bool areOrthogonal(vec const& v0, vec const& v1, T const& epsilon); 42 | 43 | //! Check whether a vector is normalized. 44 | /// @see gtx_vector_query extensions. 45 | template 46 | GLM_FUNC_DECL bool isNormalized(vec const& v, T const& epsilon); 47 | 48 | //! Check whether a vector is null. 49 | /// @see gtx_vector_query extensions. 50 | template 51 | GLM_FUNC_DECL bool isNull(vec const& v, T const& epsilon); 52 | 53 | //! Check whether a each component of a vector is null. 54 | /// @see gtx_vector_query extensions. 55 | template 56 | GLM_FUNC_DECL vec isCompNull(vec const& v, T const& epsilon); 57 | 58 | //! Check whether two vectors are orthonormal. 59 | /// @see gtx_vector_query extensions. 60 | template 61 | GLM_FUNC_DECL bool areOrthonormal(vec const& v0, vec const& v1, T const& epsilon); 62 | 63 | /// @} 64 | }// namespace glm 65 | 66 | #include "vector_query.inl" 67 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 10 | /// 11 | /// Add support for integer for core functions 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/integer.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_integer extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_integer 30 | /// @{ 31 | 32 | //! Returns x raised to the y power. 33 | //! From GLM_GTX_integer extension. 34 | GLM_FUNC_DECL int pow(int x, uint y); 35 | 36 | //! Returns the positive square root of x. 37 | //! From GLM_GTX_integer extension. 38 | GLM_FUNC_DECL int sqrt(int x); 39 | 40 | //! Returns the floor log2 of x. 41 | //! From GLM_GTX_integer extension. 42 | GLM_FUNC_DECL unsigned int floor_log2(unsigned int x); 43 | 44 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 45 | //! From GLM_GTX_integer extension. 46 | GLM_FUNC_DECL int mod(int x, int y); 47 | 48 | //! Return the factorial value of a number (!12 max, integer only) 49 | //! From GLM_GTX_integer extension. 50 | template 51 | GLM_FUNC_DECL genType factorial(genType const& x); 52 | 53 | //! 32bit signed integer. 54 | //! From GLM_GTX_integer extension. 55 | typedef signed int sint; 56 | 57 | //! Returns x raised to the y power. 58 | //! From GLM_GTX_integer extension. 59 | GLM_FUNC_DECL uint pow(uint x, uint y); 60 | 61 | //! Returns the positive square root of x. 62 | //! From GLM_GTX_integer extension. 63 | GLM_FUNC_DECL uint sqrt(uint x); 64 | 65 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 66 | //! From GLM_GTX_integer extension. 67 | GLM_FUNC_DECL uint mod(uint x, uint y); 68 | 69 | //! Returns the number of leading zeros. 70 | //! From GLM_GTX_integer extension. 71 | GLM_FUNC_DECL uint nlz(uint x); 72 | 73 | /// @} 74 | }//namespace glm 75 | 76 | #include "integer.inl" 77 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/rotate_normalized_axis.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_rotate_normalized_axis 2 | /// @file glm/gtx/rotate_normalized_axis.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_matrix_transform 6 | /// @see gtc_quaternion 7 | /// 8 | /// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis 9 | /// @ingroup gtx 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Quaternions and matrices rotations around normalized axis. 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../glm.hpp" 19 | #include "../gtc/epsilon.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | 22 | #ifndef GLM_ENABLE_EXPERIMENTAL 23 | # error "GLM: GLM_GTX_rotate_normalized_axis is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 24 | #endif 25 | 26 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 27 | # pragma message("GLM: GLM_GTX_rotate_normalized_axis extension included") 28 | #endif 29 | 30 | namespace glm 31 | { 32 | /// @addtogroup gtx_rotate_normalized_axis 33 | /// @{ 34 | 35 | /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. 36 | /// 37 | /// @param m Input matrix multiplied by this rotation matrix. 38 | /// @param angle Rotation angle expressed in radians. 39 | /// @param axis Rotation axis, must be normalized. 40 | /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double. 41 | /// 42 | /// @see gtx_rotate_normalized_axis 43 | /// @see - rotate(T angle, T x, T y, T z) 44 | /// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z) 45 | /// @see - rotate(T angle, vec<3, T, Q> const& v) 46 | template 47 | GLM_FUNC_DECL mat<4, 4, T, Q> rotateNormalizedAxis( 48 | mat<4, 4, T, Q> const& m, 49 | T const& angle, 50 | vec<3, T, Q> const& axis); 51 | 52 | /// Rotates a quaternion from a vector of 3 components normalized axis and an angle. 53 | /// 54 | /// @param q Source orientation 55 | /// @param angle Angle expressed in radians. 56 | /// @param axis Normalized axis of the rotation, must be normalized. 57 | /// 58 | /// @see gtx_rotate_normalized_axis 59 | template 60 | GLM_FUNC_DECL tquat rotateNormalizedAxis( 61 | tquat const& q, 62 | T const& angle, 63 | vec<3, T, Q> const& axis); 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "rotate_normalized_axis.inl" 69 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 vec<2, T, Q> permute(vec<2, T, Q> const& x) 28 | { 29 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 30 | } 31 | 32 | template 33 | GLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x) 34 | { 35 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x) 40 | { 41 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r) 46 | { 47 | return T(1.79284291400159) - T(0.85373472095314) * r; 48 | } 49 | 50 | template 51 | GLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r) 52 | { 53 | return T(1.79284291400159) - T(0.85373472095314) * r; 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r) 58 | { 59 | return T(1.79284291400159) - T(0.85373472095314) * r; 60 | } 61 | 62 | template 63 | GLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r) 64 | { 65 | return T(1.79284291400159) - T(0.85373472095314) * r; 66 | } 67 | 68 | template 69 | GLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t) 70 | { 71 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 72 | } 73 | 74 | template 75 | GLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t) 76 | { 77 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 78 | } 79 | 80 | template 81 | GLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t) 82 | { 83 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 84 | } 85 | }//namespace detail 86 | }//namespace glm 87 | 88 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/number_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | /// @file glm/gtx/number_precision.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_type_precision (dependence) 6 | /// @see gtc_quaternion (dependence) 7 | /// 8 | /// @defgroup gtx_number_precision GLM_GTX_number_precision 9 | /// @ingroup gtx 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Defined size types. 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../glm.hpp" 19 | #include "../gtc/type_precision.hpp" 20 | 21 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_number_precision is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_number_precision extension included") 27 | #endif 28 | 29 | namespace glm{ 30 | namespace gtx 31 | { 32 | ///////////////////////////// 33 | // Unsigned int vector types 34 | 35 | /// @addtogroup gtx_number_precision 36 | /// @{ 37 | 38 | typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 39 | typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 40 | typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 41 | typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTX_number_precision extension) 42 | 43 | ////////////////////// 44 | // Float vector types 45 | 46 | typedef f32 f32vec1; //!< \brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension) 47 | typedef f64 f64vec1; //!< \brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension) 48 | 49 | ////////////////////// 50 | // Float matrix types 51 | 52 | typedef f32 f32mat1; //!< \brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension) 53 | typedef f32 f32mat1x1; //!< \brief Single-qualifier floating-point scalar. (from GLM_GTX_number_precision extension) 54 | typedef f64 f64mat1; //!< \brief Double-qualifier floating-point scalar. (from GLM_GTX_number_precision extension) 55 | typedef f64 f64mat1x1; //!< \brief Double-qualifier floating-point scalar. (from GLM_GTX_number_precision extension) 56 | 57 | /// @} 58 | }//namespace gtx 59 | }//namespace glm 60 | 61 | #include "number_precision.inl" 62 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/integer.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_integer 2 | /// @file glm/gtc/integer.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | template 8 | struct compute_log2 9 | { 10 | GLM_FUNC_QUALIFIER static vec call(vec const& v) 11 | { 12 | //Equivalent to return findMSB(vec); but save one function call in ASM with VC 13 | //return findMSB(vec); 14 | return vec(detail::compute_findMSB_vec::call(v)); 15 | } 16 | }; 17 | 18 | # if GLM_HAS_BITSCAN_WINDOWS 19 | template 20 | struct compute_log2<4, int, Q, false, Aligned> 21 | { 22 | GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& v) 23 | { 24 | vec<4, int, Q> Result; 25 | _BitScanReverse(reinterpret_cast(&Result.x), v.x); 26 | _BitScanReverse(reinterpret_cast(&Result.y), v.y); 27 | _BitScanReverse(reinterpret_cast(&Result.z), v.z); 28 | _BitScanReverse(reinterpret_cast(&Result.w), v.w); 29 | return Result; 30 | } 31 | }; 32 | # endif//GLM_HAS_BITSCAN_WINDOWS 33 | }//namespace detail 34 | template 35 | GLM_FUNC_QUALIFIER int iround(genType x) 36 | { 37 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'iround' only accept floating-point inputs"); 38 | assert(static_cast(0.0) <= x); 39 | 40 | return static_cast(x + static_cast(0.5)); 41 | } 42 | 43 | template 44 | GLM_FUNC_QUALIFIER vec iround(vec const& x) 45 | { 46 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'iround' only accept floating-point inputs"); 47 | assert(all(lessThanEqual(vec(0), x))); 48 | 49 | return vec(x + static_cast(0.5)); 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER uint uround(genType x) 54 | { 55 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'uround' only accept floating-point inputs"); 56 | assert(static_cast(0.0) <= x); 57 | 58 | return static_cast(x + static_cast(0.5)); 59 | } 60 | 61 | template 62 | GLM_FUNC_QUALIFIER vec uround(vec const& x) 63 | { 64 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'uround' only accept floating-point inputs"); 65 | assert(all(lessThanEqual(vec(0), x))); 66 | 67 | return vec(x + static_cast(0.5)); 68 | } 69 | }//namespace glm 70 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/scalar_multiplication.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx 2 | /// @file glm/gtx/scalar_multiplication.hpp 3 | /// @author Joshua Moerman 4 | /// 5 | /// Include to use the features of this extension. 6 | /// 7 | /// Enables scalar multiplication for all types 8 | /// 9 | /// Since GLSL is very strict about types, the following (often used) combinations do not work: 10 | /// double * vec4 11 | /// int * vec4 12 | /// vec4 / int 13 | /// So we'll fix that! Of course "float * vec4" should remain the same (hence the enable_if magic) 14 | 15 | #pragma once 16 | 17 | #include "../detail/setup.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_scalar_multiplication is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if !GLM_HAS_TEMPLATE_ALIASES && !(GLM_COMPILER & GLM_COMPILER_GCC) 24 | # error "GLM_GTX_scalar_multiplication requires C++11 support or alias templates and if not support for GCC" 25 | #endif 26 | 27 | #include "../vec2.hpp" 28 | #include "../vec3.hpp" 29 | #include "../vec4.hpp" 30 | #include "../mat2x2.hpp" 31 | #include 32 | 33 | namespace glm 34 | { 35 | template 36 | using return_type_scalar_multiplication = typename std::enable_if< 37 | !std::is_same::value // T may not be a float 38 | && std::is_arithmetic::value, Vec // But it may be an int or double (no vec3 or mat3, ...) 39 | >::type; 40 | 41 | #define GLM_IMPLEMENT_SCAL_MULT(Vec) \ 42 | template \ 43 | return_type_scalar_multiplication \ 44 | operator*(T const& s, Vec rh){ \ 45 | return rh *= static_cast(s); \ 46 | } \ 47 | \ 48 | template \ 49 | return_type_scalar_multiplication \ 50 | operator*(Vec lh, T const& s){ \ 51 | return lh *= static_cast(s); \ 52 | } \ 53 | \ 54 | template \ 55 | return_type_scalar_multiplication \ 56 | operator/(Vec lh, T const& s){ \ 57 | return lh *= 1.0f / s; \ 58 | } 59 | 60 | GLM_IMPLEMENT_SCAL_MULT(vec2) 61 | GLM_IMPLEMENT_SCAL_MULT(vec3) 62 | GLM_IMPLEMENT_SCAL_MULT(vec4) 63 | 64 | GLM_IMPLEMENT_SCAL_MULT(mat2) 65 | GLM_IMPLEMENT_SCAL_MULT(mat2x3) 66 | GLM_IMPLEMENT_SCAL_MULT(mat2x4) 67 | GLM_IMPLEMENT_SCAL_MULT(mat3x2) 68 | GLM_IMPLEMENT_SCAL_MULT(mat3) 69 | GLM_IMPLEMENT_SCAL_MULT(mat3x4) 70 | GLM_IMPLEMENT_SCAL_MULT(mat4x2) 71 | GLM_IMPLEMENT_SCAL_MULT(mat4x3) 72 | GLM_IMPLEMENT_SCAL_MULT(mat4) 73 | 74 | #undef GLM_IMPLEMENT_SCAL_MULT 75 | } // namespace glm 76 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 11 | /// 12 | /// Various ways to compute vector norms. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../geometric.hpp" 18 | #include "../gtx/quaternion.hpp" 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_norm is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_norm extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_norm 31 | /// @{ 32 | 33 | /// Returns the squared length of x. 34 | /// From GLM_GTX_norm extension. 35 | template 36 | GLM_FUNC_DECL T length2(vec const& x); 37 | 38 | /// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1). 39 | /// From GLM_GTX_norm extension. 40 | template 41 | GLM_FUNC_DECL T distance2(vec const& p0, vec const& p1); 42 | 43 | //! Returns the L1 norm between x and y. 44 | //! From GLM_GTX_norm extension. 45 | template 46 | GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y); 47 | 48 | //! Returns the L1 norm of v. 49 | //! From GLM_GTX_norm extension. 50 | template 51 | GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& v); 52 | 53 | //! Returns the L2 norm between x and y. 54 | //! From GLM_GTX_norm extension. 55 | template 56 | GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y); 57 | 58 | //! Returns the L2 norm of v. 59 | //! From GLM_GTX_norm extension. 60 | template 61 | GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x); 62 | 63 | //! Returns the L norm between x and y. 64 | //! From GLM_GTX_norm extension. 65 | template 66 | GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth); 67 | 68 | //! Returns the L norm of v. 69 | //! From GLM_GTX_norm extension. 70 | template 71 | GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, unsigned int Depth); 72 | 73 | /// @} 74 | }//namespace glm 75 | 76 | #include "norm.inl" 77 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/detail/qualifier.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/qualifier.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm 9 | { 10 | /// Qualify GLM types in term of alignment (packed, aligned) and precision in term of ULPs (lowp, mediump, highp) 11 | enum qualifier 12 | { 13 | packed_highp, ///< Typed data is tightly packed in memory and operations are executed with high precision in term of ULPs 14 | packed_mediump, ///< Typed data is tightly packed in memory and operations are executed with medium precision in term of ULPs for higher performance 15 | packed_lowp, ///< Typed data is tightly packed in memory and operations are executed with low precision in term of ULPs to maximize performance 16 | 17 | # if GLM_HAS_ALIGNED_TYPE 18 | aligned_highp, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs 19 | aligned_mediump, ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs for higher performance 20 | aligned_lowp, // ///< Typed data is aligned in memory allowing SIMD optimizations and operations are executed with high precision in term of ULPs to maximize performance 21 | aligned = aligned_highp, ///< By default aligned qualifier is also high precision 22 | # endif 23 | 24 | highp = packed_highp, ///< By default highp qualifier is also packed 25 | mediump = packed_mediump, ///< By default mediump qualifier is also packed 26 | lowp = packed_lowp, ///< By default lowp qualifier is also packed 27 | packed = packed_highp, ///< By default packed qualifier is also high precision 28 | 29 | # if GLM_HAS_ALIGNED_TYPE && defined(GLM_FORCE_ALIGNED) 30 | defaultp = aligned_highp 31 | # else 32 | defaultp = highp 33 | # endif 34 | }; 35 | 36 | template struct vec; 37 | template struct mat; 38 | 39 | namespace detail 40 | { 41 | template 42 | struct is_aligned 43 | { 44 | static const bool value = false; 45 | }; 46 | 47 | # if GLM_HAS_ALIGNED_TYPE 48 | template<> 49 | struct is_aligned 50 | { 51 | static const bool value = true; 52 | }; 53 | 54 | template<> 55 | struct is_aligned 56 | { 57 | static const bool value = true; 58 | }; 59 | 60 | template<> 61 | struct is_aligned 62 | { 63 | static const bool value = true; 64 | }; 65 | # endif 66 | }//namespace detail 67 | }//namespace glm 68 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 12 | /// 13 | /// Operations between components of a type 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/qualifier.hpp" 20 | 21 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_component_wise is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_component_wise extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_component_wise 32 | /// @{ 33 | 34 | /// Convert an integer vector to a normalized float vector. 35 | /// If the parameter value type is already a floating qualifier type, the value is passed through. 36 | /// @see gtx_component_wise 37 | template 38 | GLM_FUNC_DECL vec compNormalize(vec const& v); 39 | 40 | /// Convert a normalized float vector to an integer vector. 41 | /// If the parameter value type is already a floating qualifier type, the value is passed through. 42 | /// @see gtx_component_wise 43 | template 44 | GLM_FUNC_DECL vec compScale(vec const& v); 45 | 46 | /// Add all vector components together. 47 | /// @see gtx_component_wise 48 | template 49 | GLM_FUNC_DECL typename genType::value_type compAdd(genType const& v); 50 | 51 | /// Multiply all vector components together. 52 | /// @see gtx_component_wise 53 | template 54 | GLM_FUNC_DECL typename genType::value_type compMul(genType const& v); 55 | 56 | /// Find the minimum value between single vector components. 57 | /// @see gtx_component_wise 58 | template 59 | GLM_FUNC_DECL typename genType::value_type compMin(genType const& v); 60 | 61 | /// Find the maximum value between single vector components. 62 | /// @see gtx_component_wise 63 | template 64 | GLM_FUNC_DECL typename genType::value_type compMax(genType const& v); 65 | 66 | /// @} 67 | }//namespace glm 68 | 69 | #include "component_wise.inl" 70 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 23 | GLM_FUNC_QUALIFIER vec highestBitValue(vec 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 38 | GLM_FUNC_QUALIFIER vec lowestBitValue(vec 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 53 | GLM_FUNC_QUALIFIER vec powerOfTwoAbove(vec 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 68 | GLM_FUNC_QUALIFIER vec powerOfTwoBelow(vec 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 88 | GLM_FUNC_QUALIFIER vec powerOfTwoNearest(vec const& v) 89 | { 90 | return detail::functor1::call(powerOfTwoNearest, v); 91 | } 92 | 93 | }//namespace glm 94 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 16 | GLM_FUNC_QUALIFIER vec fastSqrt(vec 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 | vec<1, T, Q> tmp(detail::compute_inversesqrt::value>::call(vec<1, genType, lowp>(x))); 27 | return tmp.x; 28 | # else 29 | return detail::compute_inversesqrt<1, genType, lowp, detail::is_aligned::value>::call(vec<1, genType, lowp>(x)).x; 30 | # endif 31 | } 32 | 33 | template 34 | GLM_FUNC_QUALIFIER vec fastInverseSqrt(vec 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 49 | GLM_FUNC_QUALIFIER T fastLength(vec 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 64 | GLM_FUNC_QUALIFIER T fastDistance(vec const& x, vec 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 77 | GLM_FUNC_QUALIFIER vec fastNormalize(vec const& x) 78 | { 79 | return x * fastInverseSqrt(dot(x, x)); 80 | } 81 | }//namespace glm 82 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtx/norm.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_norm 2 | /// @file glm/gtx/norm.inl 3 | 4 | #include "../detail/qualifier.hpp" 5 | 6 | namespace glm{ 7 | namespace detail 8 | { 9 | template 10 | struct compute_length2 11 | { 12 | GLM_FUNC_QUALIFIER static T call(vec const& v) 13 | { 14 | return dot(v, v); 15 | } 16 | }; 17 | }//namespace detail 18 | 19 | template 20 | GLM_FUNC_QUALIFIER genType length2(genType x) 21 | { 22 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length2' accepts only floating-point inputs"); 23 | return x * x; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER T length2(vec const& v) 28 | { 29 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'length2' accepts only floating-point inputs"); 30 | return detail::compute_length2::value>::call(v); 31 | } 32 | 33 | template 34 | GLM_FUNC_QUALIFIER T distance2(T p0, T p1) 35 | { 36 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'distance2' accepts only floating-point inputs"); 37 | return length2(p1 - p0); 38 | } 39 | 40 | template 41 | GLM_FUNC_QUALIFIER T distance2(vec const& p0, vec const& p1) 42 | { 43 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'distance2' accepts only floating-point inputs"); 44 | return length2(p1 - p0); 45 | } 46 | 47 | template 48 | GLM_FUNC_QUALIFIER T l1Norm(vec<3, T, Q> const& a, vec<3, T, Q> const& b) 49 | { 50 | return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z); 51 | } 52 | 53 | template 54 | GLM_FUNC_QUALIFIER T l1Norm(vec<3, T, Q> const& v) 55 | { 56 | return abs(v.x) + abs(v.y) + abs(v.z); 57 | } 58 | 59 | template 60 | GLM_FUNC_QUALIFIER T l2Norm(vec<3, T, Q> const& a, vec<3, T, Q> const& b 61 | ) 62 | { 63 | return length(b - a); 64 | } 65 | 66 | template 67 | GLM_FUNC_QUALIFIER T l2Norm(vec<3, T, Q> const& v) 68 | { 69 | return length(v); 70 | } 71 | 72 | template 73 | GLM_FUNC_QUALIFIER T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth) 74 | { 75 | return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth)); 76 | } 77 | 78 | template 79 | GLM_FUNC_QUALIFIER T lxNorm(vec<3, T, Q> const& v, unsigned int Depth) 80 | { 81 | return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth)); 82 | } 83 | 84 | }//namespace glm 85 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 vec epsilonEqual(vec const& x, vec const& y, T const& epsilon) 38 | { 39 | return lessThan(abs(x - y), vec(epsilon)); 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER vec epsilonEqual(vec const& x, vec const& y, vec const& epsilon) 44 | { 45 | return lessThan(abs(x - y), vec(epsilon)); 46 | } 47 | 48 | template<> 49 | GLM_FUNC_QUALIFIER bool epsilonNotEqual(float const& x, float const& y, float const& epsilon) 50 | { 51 | return abs(x - y) >= epsilon; 52 | } 53 | 54 | template<> 55 | GLM_FUNC_QUALIFIER bool epsilonNotEqual(double const& x, double const& y, double const& epsilon) 56 | { 57 | return abs(x - y) >= epsilon; 58 | } 59 | 60 | template 61 | GLM_FUNC_QUALIFIER vec epsilonNotEqual(vec const& x, vec const& y, T const& epsilon) 62 | { 63 | return greaterThanEqual(abs(x - y), vec(epsilon)); 64 | } 65 | 66 | template 67 | GLM_FUNC_QUALIFIER vec epsilonNotEqual(vec const& x, vec const& y, vec const& epsilon) 68 | { 69 | return greaterThanEqual(abs(x - y), vec(epsilon)); 70 | } 71 | 72 | template 73 | GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonEqual(tquat const& x, tquat const& y, T const& epsilon) 74 | { 75 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 76 | return lessThan(abs(v), vec<4, T, Q>(epsilon)); 77 | } 78 | 79 | template 80 | GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonNotEqual(tquat const& x, tquat const& y, T const& epsilon) 81 | { 82 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 83 | return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon)); 84 | } 85 | }//namespace glm 86 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 10 | /// 11 | /// Fast but less accurate implementations of trigonometric functions. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../gtc/constants.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_fast_trigonometry is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_fast_trigonometry extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_fast_trigonometry 29 | /// @{ 30 | 31 | /// Wrap an angle to [0 2pi[ 32 | /// From GLM_GTX_fast_trigonometry extension. 33 | template 34 | GLM_FUNC_DECL T wrapAngle(T angle); 35 | 36 | /// Faster than the common sin function but less accurate. 37 | /// From GLM_GTX_fast_trigonometry extension. 38 | template 39 | GLM_FUNC_DECL T fastSin(T angle); 40 | 41 | /// Faster than the common cos function but less accurate. 42 | /// From GLM_GTX_fast_trigonometry extension. 43 | template 44 | GLM_FUNC_DECL T fastCos(T angle); 45 | 46 | /// Faster than the common tan function but less accurate. 47 | /// Defined between -2pi and 2pi. 48 | /// From GLM_GTX_fast_trigonometry extension. 49 | template 50 | GLM_FUNC_DECL T fastTan(T angle); 51 | 52 | /// Faster than the common asin function but less accurate. 53 | /// Defined between -2pi and 2pi. 54 | /// From GLM_GTX_fast_trigonometry extension. 55 | template 56 | GLM_FUNC_DECL T fastAsin(T angle); 57 | 58 | /// Faster than the common acos function but less accurate. 59 | /// Defined between -2pi and 2pi. 60 | /// From GLM_GTX_fast_trigonometry extension. 61 | template 62 | GLM_FUNC_DECL T fastAcos(T angle); 63 | 64 | /// Faster than the common atan function but less accurate. 65 | /// Defined between -2pi and 2pi. 66 | /// From GLM_GTX_fast_trigonometry extension. 67 | template 68 | GLM_FUNC_DECL T fastAtan(T y, T x); 69 | 70 | /// Faster than the common atan function but less accurate. 71 | /// Defined between -2pi and 2pi. 72 | /// From GLM_GTX_fast_trigonometry extension. 73 | template 74 | GLM_FUNC_DECL T fastAtan(T angle); 75 | 76 | /// @} 77 | }//namespace glm 78 | 79 | #include "fast_trigonometry.inl" 80 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Utilities.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #define PI 3.1415926535897932384626422832795028841971f 11 | #define TWO_PI 6.2831853071795864769252867665590057683943f 12 | 13 | // Read binary data from shader files 14 | static std::vector readFile(const std::string& filename) { 15 | std::ifstream file(filename, std::ios::ate | std::ios::binary); 16 | 17 | if (!file.is_open()) { 18 | throw std::runtime_error("Failed to open file"); 19 | } 20 | 21 | size_t fileSize = (size_t)file.tellg(); 22 | std::vector buffer(fileSize); 23 | 24 | file.seekg(0); 25 | file.read(buffer.data(), fileSize); 26 | 27 | file.close(); 28 | return buffer; 29 | } 30 | 31 | static uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties, VkPhysicalDevice physicalDevice) { 32 | VkPhysicalDeviceMemoryProperties memProperties; 33 | vkGetPhysicalDeviceMemoryProperties(physicalDevice, &memProperties); 34 | 35 | for (uint32_t i = 0; i < memProperties.memoryTypeCount; i++) { 36 | if (typeFilter & (1 << i) && (memProperties.memoryTypes[i].propertyFlags & properties) == properties) { 37 | return i; 38 | } 39 | } 40 | 41 | throw std::runtime_error("Failed to find suitable memory type"); 42 | } 43 | 44 | // Allow us to begin single time commands 45 | static VkCommandBuffer beginSingleTimeCommands(VkCommandPool& commandPool, VkDevice& logicalDevice) { 46 | VkCommandBufferAllocateInfo allocInfo = {}; 47 | allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; 48 | allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; 49 | allocInfo.commandPool = commandPool; 50 | allocInfo.commandBufferCount = 1; 51 | 52 | VkCommandBuffer commandBuffer; 53 | vkAllocateCommandBuffers(logicalDevice, &allocInfo, &commandBuffer); 54 | 55 | VkCommandBufferBeginInfo beginInfo = {}; 56 | beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; 57 | beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; 58 | 59 | vkBeginCommandBuffer(commandBuffer, &beginInfo); 60 | 61 | return commandBuffer; 62 | } 63 | 64 | // Allow us to end single time commands 65 | static void endSingleTimeCommands(VkCommandPool& commandPool, VkCommandBuffer& commandBuffer, VkQueue& graphicsQueue, VkDevice logicalDevice) { 66 | vkEndCommandBuffer(commandBuffer); 67 | 68 | VkSubmitInfo submitInfo = {}; 69 | submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; 70 | submitInfo.commandBufferCount = 1; 71 | submitInfo.pCommandBuffers = &commandBuffer; 72 | 73 | vkQueueSubmit(graphicsQueue, 1, &submitInfo, VK_NULL_HANDLE); 74 | vkQueueWaitIdle(graphicsQueue); 75 | 76 | vkFreeCommandBuffers(logicalDevice, commandPool, 1, &commandBuffer); 77 | } -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 11 | /// 12 | /// Defines functions that generate common 2d transformation matrices. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../mat3x3.hpp" 18 | #include "../vec2.hpp" 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_matrix_transform_2d is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_matrix_transform_2d 31 | /// @{ 32 | 33 | /// Builds a translation 3 * 3 matrix created from a vector of 2 components. 34 | /// 35 | /// @param m Input matrix multiplied by this translation matrix. 36 | /// @param v Coordinates of a translation vector. 37 | template 38 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate( 39 | mat<3, 3, T, Q> const& m, 40 | vec<2, T, Q> const& v); 41 | 42 | /// Builds a rotation 3 * 3 matrix created from an angle. 43 | /// 44 | /// @param m Input matrix multiplied by this translation matrix. 45 | /// @param angle Rotation angle expressed in radians. 46 | template 47 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate( 48 | mat<3, 3, T, Q> const& m, 49 | T angle); 50 | 51 | /// Builds a scale 3 * 3 matrix created from a vector of 2 components. 52 | /// 53 | /// @param m Input matrix multiplied by this translation matrix. 54 | /// @param v Coordinates of a scale vector. 55 | template 56 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale( 57 | mat<3, 3, T, Q> const& m, 58 | vec<2, T, Q> const& v); 59 | 60 | /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. 61 | /// 62 | /// @param m Input matrix multiplied by this translation matrix. 63 | /// @param y Shear factor. 64 | template 65 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX( 66 | mat<3, 3, T, Q> const& m, 67 | T y); 68 | 69 | /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. 70 | /// 71 | /// @param m Input matrix multiplied by this translation matrix. 72 | /// @param x Shear factor. 73 | template 74 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY( 75 | mat<3, 3, T, Q> const& m, 76 | T x); 77 | 78 | /// @} 79 | }//namespace glm 80 | 81 | #include "matrix_transform_2d.inl" 82 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 10 | /// 11 | /// Build diagonal matrices from vectors. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_matrix_operation is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_matrix_operation extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_matrix_operation 29 | /// @{ 30 | 31 | //! Build a diagonal matrix. 32 | //! From GLM_GTX_matrix_operation extension. 33 | template 34 | GLM_FUNC_DECL mat<2, 2, T, Q> diagonal2x2( 35 | vec<2, T, Q> const& v); 36 | 37 | //! Build a diagonal matrix. 38 | //! From GLM_GTX_matrix_operation extension. 39 | template 40 | GLM_FUNC_DECL mat<2, 3, T, Q> diagonal2x3( 41 | vec<2, T, Q> const& v); 42 | 43 | //! Build a diagonal matrix. 44 | //! From GLM_GTX_matrix_operation extension. 45 | template 46 | GLM_FUNC_DECL mat<2, 4, T, Q> diagonal2x4( 47 | vec<2, T, Q> const& v); 48 | 49 | //! Build a diagonal matrix. 50 | //! From GLM_GTX_matrix_operation extension. 51 | template 52 | GLM_FUNC_DECL mat<3, 2, T, Q> diagonal3x2( 53 | vec<2, T, Q> const& v); 54 | 55 | //! Build a diagonal matrix. 56 | //! From GLM_GTX_matrix_operation extension. 57 | template 58 | GLM_FUNC_DECL mat<3, 3, T, Q> diagonal3x3( 59 | vec<3, T, Q> const& v); 60 | 61 | //! Build a diagonal matrix. 62 | //! From GLM_GTX_matrix_operation extension. 63 | template 64 | GLM_FUNC_DECL mat<3, 4, T, Q> diagonal3x4( 65 | vec<3, T, Q> const& v); 66 | 67 | //! Build a diagonal matrix. 68 | //! From GLM_GTX_matrix_operation extension. 69 | template 70 | GLM_FUNC_DECL mat<4, 2, T, Q> diagonal4x2( 71 | vec<2, T, Q> const& v); 72 | 73 | //! Build a diagonal matrix. 74 | //! From GLM_GTX_matrix_operation extension. 75 | template 76 | GLM_FUNC_DECL mat<4, 3, T, Q> diagonal4x3( 77 | vec<3, T, Q> const& v); 78 | 79 | //! Build a diagonal matrix. 80 | //! From GLM_GTX_matrix_operation extension. 81 | template 82 | GLM_FUNC_DECL mat<4, 4, T, Q> diagonal4x4( 83 | vec<4, T, Q> const& v); 84 | 85 | /// @} 86 | }//namespace glm 87 | 88 | #include "matrix_operation.inl" 89 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/gtc/random.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_random 2 | /// @file glm/gtc/random.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_random (extended) 6 | /// 7 | /// @defgroup gtc_random GLM_GTC_random 8 | /// @ingroup gtc 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Generate random number from various distribution methods. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../vec2.hpp" 18 | #include "../vec3.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTC_random extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtc_random 27 | /// @{ 28 | 29 | /// Generate random numbers in the interval [Min, Max], according a linear distribution 30 | /// 31 | /// @param Min Minimum value included in the sampling 32 | /// @param Max Maximum value included in the sampling 33 | /// @tparam genType Value type. Currently supported: float or double scalars. 34 | /// @see gtc_random 35 | template 36 | GLM_FUNC_DECL genType linearRand(genType Min, genType Max); 37 | 38 | /// Generate random numbers in the interval [Min, Max], according a linear distribution 39 | /// 40 | /// @param Min Minimum value included in the sampling 41 | /// @param Max Maximum value included in the sampling 42 | /// @tparam T Value type. Currently supported: float or double. 43 | /// 44 | /// @see gtc_random 45 | template 46 | GLM_FUNC_DECL vec linearRand(vec const& Min, vec const& Max); 47 | 48 | /// Generate random numbers in the interval [Min, Max], according a gaussian distribution 49 | /// 50 | /// @see gtc_random 51 | template 52 | GLM_FUNC_DECL genType gaussRand(genType Mean, genType Deviation); 53 | 54 | /// Generate a random 2D vector which coordinates are regulary distributed on a circle of a given radius 55 | /// 56 | /// @see gtc_random 57 | template 58 | GLM_FUNC_DECL vec<2, T, defaultp> circularRand(T Radius); 59 | 60 | /// Generate a random 3D vector which coordinates are regulary distributed on a sphere of a given radius 61 | /// 62 | /// @see gtc_random 63 | template 64 | GLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(T Radius); 65 | 66 | /// Generate a random 2D vector which coordinates are regulary distributed within the area of a disk of a given radius 67 | /// 68 | /// @see gtc_random 69 | template 70 | GLM_FUNC_DECL vec<2, T, defaultp> diskRand(T Radius); 71 | 72 | /// Generate a random 3D vector which coordinates are regulary distributed within the volume of a ball of a given radius 73 | /// 74 | /// @see gtc_random 75 | template 76 | GLM_FUNC_DECL vec<3, T, defaultp> ballRand(T Radius); 77 | 78 | /// @} 79 | }//namespace glm 80 | 81 | #include "random.inl" 82 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 mat<2, 2, T, Q> diagonal2x2 8 | ( 9 | vec<2, T, Q> const& v 10 | ) 11 | { 12 | mat<2, 2, T, Q> 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 mat<2, 3, T, Q> diagonal2x3 20 | ( 21 | vec<2, T, Q> const& v 22 | ) 23 | { 24 | mat<2, 3, T, Q> 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 mat<2, 4, T, Q> diagonal2x4 32 | ( 33 | vec<2, T, Q> const& v 34 | ) 35 | { 36 | mat<2, 4, T, Q> 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 mat<3, 2, T, Q> diagonal3x2 44 | ( 45 | vec<2, T, Q> const& v 46 | ) 47 | { 48 | mat<3, 2, T, Q> 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 mat<3, 3, T, Q> diagonal3x3 56 | ( 57 | vec<3, T, Q> const& v 58 | ) 59 | { 60 | mat<3, 3, T, Q> 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 mat<3, 4, T, Q> diagonal3x4 69 | ( 70 | vec<3, T, Q> const& v 71 | ) 72 | { 73 | mat<3, 4, T, Q> 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 mat<4, 4, T, Q> diagonal4x4 82 | ( 83 | vec<4, T, Q> const& v 84 | ) 85 | { 86 | mat<4, 4, T, Q> 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 mat<4, 3, T, Q> diagonal4x3 96 | ( 97 | vec<3, T, Q> const& v 98 | ) 99 | { 100 | mat<4, 3, T, Q> 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 mat<4, 2, T, Q> diagonal4x2 109 | ( 110 | vec<2, T, Q> const& v 111 | ) 112 | { 113 | mat<4, 2, T, Q> Result(static_cast(1)); 114 | Result[0][0] = v[0]; 115 | Result[1][1] = v[1]; 116 | return Result; 117 | } 118 | }//namespace glm 119 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 qualifier floating-point numbers. 23 | /// There is no guarantee on the actual qualifier. 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 qualifier floating-point numbers. 30 | /// There is no guarantee on the actual qualifier. 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 qualifier floating-point numbers. 37 | /// There is no guarantee on the actual qualifier. 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 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | -------------------------------------------------------------------------------- /VulkanGrassRendering/VulkanGrassRendering/Descriptors.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Vertex.h" 4 | #include "Blades.h" 5 | 6 | #include 7 | #include 8 | 9 | class Descriptors { 10 | public: 11 | VkBuffer mvpBuffer; 12 | VkDeviceMemory mvpBufferMemory; 13 | 14 | VkImage textureImage; 15 | VkDeviceMemory textureImageMemory; 16 | VkImageView textureImageView; 17 | VkSampler textureSampler; 18 | 19 | VkBuffer bladesBuffer; 20 | VkDeviceMemory bladesBufferMemory; 21 | VkBuffer culledBladesBuffer; 22 | VkDeviceMemory culledBladesBufferMemory; 23 | VkBuffer timeBuffer; 24 | VkDeviceMemory timeBufferMemory; 25 | VkBuffer numBladesBuffer; 26 | VkDeviceMemory numBladesBufferMemory; 27 | 28 | static void createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer& buffer, VkDeviceMemory& bufferMemory, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice); 29 | 30 | static void copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size, VkCommandPool& commandPool, VkDevice& logicalDevice, VkQueue& graphicsQueue); 31 | 32 | static void createVertexBuffer(std::vector& vertices, VkBuffer& vertexBuffer, VkDeviceMemory& vertexBufferMemory, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue); 33 | 34 | static void createIndexBuffer(std::vector& indices, VkBuffer& indexBuffer, VkDeviceMemory& indexBufferMemory, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue); 35 | 36 | void createBladesBuffer(Blades* blades, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& computeQueue); 37 | 38 | void createCulledBladesBuffer(VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& computeQueue); 39 | 40 | void createUniformBuffer(VkDeviceSize bufferSize, VkBuffer& buffer, VkDeviceMemory& bufferufferMemory, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice); 41 | 42 | void createMvpBuffer(VkDeviceSize bufferSize, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice); 43 | 44 | void createTimeBuffer(VkDeviceSize bufferSize, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice); 45 | 46 | void createNumBladesBuffer(VkDeviceSize bufferSize, VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice); 47 | 48 | // Copy buffer data to image 49 | void copyBufferToImage(VkDevice& logicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue, VkBuffer& buffer, VkImage& image, uint32_t width, uint32_t height); 50 | 51 | // Create a texture image 52 | void createTextureImage(VkDevice& logicalDevice, VkPhysicalDevice& physicalDevice, VkCommandPool& commandPool, VkQueue& graphicsQueue); 53 | 54 | // Create an image view for the texture image 55 | void createTextureImageView(VkDevice& logicalDevice); 56 | 57 | // Create a sampler for the texture 58 | void createTextureSampler(VkDevice& logicalDevice); 59 | }; -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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<4, float, Q, true> 13 | { 14 | GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& v) 15 | { 16 | return _mm_cvtss_f32(glm_vec4_length(v.data)); 17 | } 18 | }; 19 | 20 | template 21 | struct compute_distance<4, float, Q, true> 22 | { 23 | GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& p0, vec<4, float, Q> const& p1) 24 | { 25 | return _mm_cvtss_f32(glm_vec4_distance(p0.data, p1.data)); 26 | } 27 | }; 28 | 29 | template 30 | struct compute_dot, float, true> 31 | { 32 | GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& x, vec<4, float, Q> 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 vec<3, float, Q> call(vec<3, float, Q> const& a, vec<3, float, Q> 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 | vec<4, float, Q> Result; 48 | Result.data = xpd0; 49 | return vec<3, float, Q>(Result); 50 | } 51 | }; 52 | 53 | template 54 | struct compute_normalize<4, float, Q, true> 55 | { 56 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) 57 | { 58 | vec<4, float, Q> Result; 59 | Result.data = glm_vec4_normalize(v.data); 60 | return Result; 61 | } 62 | }; 63 | 64 | template 65 | struct compute_faceforward<4, float, Q, true> 66 | { 67 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& N, vec<4, float, Q> const& I, vec<4, float, Q> const& Nref) 68 | { 69 | vec<4, float, Q> Result; 70 | Result.data = glm_vec4_faceforward(N.data, I.data, Nref.data); 71 | return Result; 72 | } 73 | }; 74 | 75 | template 76 | struct compute_reflect<4, float, Q, true> 77 | { 78 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N) 79 | { 80 | vec<4, float, Q> Result; 81 | Result.data = glm_vec4_reflect(I.data, N.data); 82 | return Result; 83 | } 84 | }; 85 | 86 | template 87 | struct compute_refract<4, float, Q, true> 88 | { 89 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N, float eta) 90 | { 91 | vec<4, float, Q> Result; 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 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/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 | /// Include to use the features of this extension. 11 | /// 12 | /// Query to evaluate matrix properties 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/vector_query.hpp" 19 | #include 20 | 21 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_matrix_query is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_matrix_query extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_matrix_query 32 | /// @{ 33 | 34 | /// Return whether a matrix a null matrix. 35 | /// From GLM_GTX_matrix_query extension. 36 | template 37 | GLM_FUNC_DECL bool isNull(mat<2, 2, T, Q> const& m, T const& epsilon); 38 | 39 | /// Return whether a matrix a null matrix. 40 | /// From GLM_GTX_matrix_query extension. 41 | template 42 | GLM_FUNC_DECL bool isNull(mat<3, 3, T, Q> const& m, T const& epsilon); 43 | 44 | /// Return whether a matrix is a null matrix. 45 | /// From GLM_GTX_matrix_query extension. 46 | template 47 | GLM_FUNC_DECL bool isNull(mat<4, 4, T, Q> const& m, T const& epsilon); 48 | 49 | /// Return whether a matrix is an identity matrix. 50 | /// From GLM_GTX_matrix_query extension. 51 | template class matType> 52 | GLM_FUNC_DECL bool isIdentity(matType const& m, T const& epsilon); 53 | 54 | /// Return whether a matrix is a normalized matrix. 55 | /// From GLM_GTX_matrix_query extension. 56 | template 57 | GLM_FUNC_DECL bool isNormalized(mat<2, 2, T, Q> const& m, T const& epsilon); 58 | 59 | /// Return whether a matrix is a normalized matrix. 60 | /// From GLM_GTX_matrix_query extension. 61 | template 62 | GLM_FUNC_DECL bool isNormalized(mat<3, 3, T, Q> const& m, T const& epsilon); 63 | 64 | /// Return whether a matrix is a normalized matrix. 65 | /// From GLM_GTX_matrix_query extension. 66 | template 67 | GLM_FUNC_DECL bool isNormalized(mat<4, 4, T, Q> const& m, T const& epsilon); 68 | 69 | /// Return whether a matrix is an orthonormalized matrix. 70 | /// From GLM_GTX_matrix_query extension. 71 | template class matType> 72 | GLM_FUNC_DECL bool isOrthogonal(matType const& m, T const& epsilon); 73 | 74 | /// @} 75 | }//namespace glm 76 | 77 | #include "matrix_query.inl" 78 | -------------------------------------------------------------------------------- /VulkanGrassRendering/ThirdParty/glm/glm/mat2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat2x2.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 2 columns of 2 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<2, 2, float, lowp> lowp_mat2; 18 | 19 | /// 2 columns of 2 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<2, 2, float, mediump> mediump_mat2; 25 | 26 | /// 2 columns of 2 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<2, 2, float, highp> highp_mat2; 32 | 33 | /// 2 columns of 2 components matrix of low qualifier floating-point numbers. 34 | /// There is no guarantee on the actual qualifier. 35 | /// 36 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 37 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 38 | typedef mat<2, 2, float, lowp> lowp_mat2x2; 39 | 40 | /// 2 columns of 2 components matrix of medium qualifier floating-point numbers. 41 | /// There is no guarantee on the actual qualifier. 42 | /// 43 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 44 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 45 | typedef mat<2, 2, float, mediump> mediump_mat2x2; 46 | 47 | /// 2 columns of 2 components matrix of high qualifier floating-point numbers. 48 | /// There is no guarantee on the actual qualifier. 49 | /// 50 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 51 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 52 | typedef mat<2, 2, float, highp> highp_mat2x2; 53 | 54 | }//namespace glm 55 | --------------------------------------------------------------------------------