From e62817b8252974b8a98393275874ee303840bf13 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Fri, 12 May 2017 18:49:50 +0500 Subject: 2017-05-12 --- depedencies/include/glm/gtc/random.inl | 350 +++++++++++++++++++++++++++++++++ 1 file changed, 350 insertions(+) create mode 100644 depedencies/include/glm/gtc/random.inl (limited to 'depedencies/include/glm/gtc/random.inl') diff --git a/depedencies/include/glm/gtc/random.inl b/depedencies/include/glm/gtc/random.inl new file mode 100644 index 0000000..ad5926e --- /dev/null +++ b/depedencies/include/glm/gtc/random.inl @@ -0,0 +1,350 @@ +/// @ref gtc_random +/// @file glm/gtc/random.inl + +#include "../geometric.hpp" +#include "../exponential.hpp" +#include +#include +#include + +namespace glm{ +namespace detail +{ + template class vecType> + struct compute_rand + { + GLM_FUNC_QUALIFIER static vecType call(); + }; + + template + struct compute_rand + { + GLM_FUNC_QUALIFIER static tvec1 call() + { + return tvec1( + std::rand() % std::numeric_limits::max()); + } + }; + + template + struct compute_rand + { + GLM_FUNC_QUALIFIER static tvec2 call() + { + return tvec2( + std::rand() % std::numeric_limits::max(), + std::rand() % std::numeric_limits::max()); + } + }; + + template + struct compute_rand + { + GLM_FUNC_QUALIFIER static tvec3 call() + { + return tvec3( + std::rand() % std::numeric_limits::max(), + std::rand() % std::numeric_limits::max(), + std::rand() % std::numeric_limits::max()); + } + }; + + template + struct compute_rand + { + GLM_FUNC_QUALIFIER static tvec4 call() + { + return tvec4( + std::rand() % std::numeric_limits::max(), + std::rand() % std::numeric_limits::max(), + std::rand() % std::numeric_limits::max(), + std::rand() % std::numeric_limits::max()); + } + }; + + template class vecType> + struct compute_rand + { + GLM_FUNC_QUALIFIER static vecType call() + { + return + (vecType(compute_rand::call()) << static_cast(8)) | + (vecType(compute_rand::call()) << static_cast(0)); + } + }; + + template class vecType> + struct compute_rand + { + GLM_FUNC_QUALIFIER static vecType call() + { + return + (vecType(compute_rand::call()) << static_cast(16)) | + (vecType(compute_rand::call()) << static_cast(0)); + } + }; + + template class vecType> + struct compute_rand + { + GLM_FUNC_QUALIFIER static vecType call() + { + return + (vecType(compute_rand::call()) << static_cast(32)) | + (vecType(compute_rand::call()) << static_cast(0)); + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max); + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (vecType(compute_rand::call() % vecType(Max + static_cast(1) - Min))) + Min; + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (compute_rand::call() % (Max + static_cast(1) - Min)) + Min; + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (vecType(compute_rand::call() % vecType(Max + static_cast(1) - Min))) + Min; + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (compute_rand::call() % (Max + static_cast(1) - Min)) + Min; + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (vecType(compute_rand::call() % vecType(Max + static_cast(1) - Min))) + Min; + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (compute_rand::call() % (Max + static_cast(1) - Min)) + Min; + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (vecType(compute_rand::call() % vecType(Max + static_cast(1) - Min))) + Min; + } + }; + + template class vecType> + struct compute_linearRand + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & Min, vecType const & Max) + { + return (compute_rand::call() % (Max + static_cast(1) - Min)) + Min; + } + }; + + template