- Fixed infinite loop in random functions when using negative radius values using an assert #739
This commit is contained in:
parent
58255c8603
commit
cd58024e40
@ -243,6 +243,8 @@ namespace detail
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER vec<2, T, defaultp> diskRand(T Radius)
|
GLM_FUNC_QUALIFIER vec<2, T, defaultp> diskRand(T Radius)
|
||||||
{
|
{
|
||||||
|
assert(Radius > static_cast<T>(0));
|
||||||
|
|
||||||
vec<2, T, defaultp> Result(T(0));
|
vec<2, T, defaultp> Result(T(0));
|
||||||
T LenRadius(T(0));
|
T LenRadius(T(0));
|
||||||
|
|
||||||
@ -261,6 +263,8 @@ namespace detail
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER vec<3, T, defaultp> ballRand(T Radius)
|
GLM_FUNC_QUALIFIER vec<3, T, defaultp> ballRand(T Radius)
|
||||||
{
|
{
|
||||||
|
assert(Radius > static_cast<T>(0));
|
||||||
|
|
||||||
vec<3, T, defaultp> Result(T(0));
|
vec<3, T, defaultp> Result(T(0));
|
||||||
T LenRadius(T(0));
|
T LenRadius(T(0));
|
||||||
|
|
||||||
@ -279,6 +283,8 @@ namespace detail
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER vec<2, T, defaultp> circularRand(T Radius)
|
GLM_FUNC_QUALIFIER vec<2, T, defaultp> circularRand(T Radius)
|
||||||
{
|
{
|
||||||
|
assert(Radius > static_cast<T>(0));
|
||||||
|
|
||||||
T a = linearRand(T(0), static_cast<T>(6.283185307179586476925286766559));
|
T a = linearRand(T(0), static_cast<T>(6.283185307179586476925286766559));
|
||||||
return vec<2, T, defaultp>(glm::cos(a), glm::sin(a)) * Radius;
|
return vec<2, T, defaultp>(glm::cos(a), glm::sin(a)) * Radius;
|
||||||
}
|
}
|
||||||
@ -286,6 +292,8 @@ namespace detail
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
GLM_FUNC_QUALIFIER vec<3, T, defaultp> sphericalRand(T Radius)
|
GLM_FUNC_QUALIFIER vec<3, T, defaultp> sphericalRand(T Radius)
|
||||||
{
|
{
|
||||||
|
assert(Radius > static_cast<T>(0));
|
||||||
|
|
||||||
T theta = linearRand(T(0), T(6.283185307179586476925286766559f));
|
T theta = linearRand(T(0), T(6.283185307179586476925286766559f));
|
||||||
T phi = std::acos(linearRand(T(-1.0f), T(1.0f)));
|
T phi = std::acos(linearRand(T(-1.0f), T(1.0f)));
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
|
|||||||
- Fixed ICC build errors with constexpr #704
|
- Fixed ICC build errors with constexpr #704
|
||||||
- Fixed defaulted operator= and constructors #791
|
- Fixed defaulted operator= and constructors #791
|
||||||
- Fixed invalid conversion from int scalar with vec4 constructor when using SSE instruction
|
- Fixed invalid conversion from int scalar with vec4 constructor when using SSE instruction
|
||||||
|
- Fixed infinite loop in random functions when using negative radius values using an assert #739
|
||||||
|
|
||||||
### [GLM 0.9.9.0](https://github.com/g-truc/glm/releases/tag/0.9.9.0) - 2018-05-22
|
### [GLM 0.9.9.0](https://github.com/g-truc/glm/releases/tag/0.9.9.0) - 2018-05-22
|
||||||
#### Features:
|
#### Features:
|
||||||
|
Loading…
Reference in New Issue
Block a user