/// @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