Clarified refract valid range of the indices of refraction, between -1 and 1 inclusively #806
This commit is contained in:
parent
f56011fb20
commit
76580af80e
@ -114,9 +114,12 @@ namespace detail
|
|||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& I, vec<L, T, Q> const& N, T eta)
|
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& I, vec<L, T, Q> const& N, T eta)
|
||||||
{
|
{
|
||||||
|
assert(eta >= static_cast<T>(-1) && eta <= static_cast<T>(1));
|
||||||
|
|
||||||
T const dotValue(dot(N, I));
|
T const dotValue(dot(N, I));
|
||||||
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
||||||
return (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
vec<L, T, Q> const Result = (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
||||||
|
return Result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}//namespace detail
|
}//namespace detail
|
||||||
|
@ -99,6 +99,8 @@ namespace glm
|
|||||||
/// and the ratio of indices of refraction eta,
|
/// and the ratio of indices of refraction eta,
|
||||||
/// return the refraction vector.
|
/// return the refraction vector.
|
||||||
///
|
///
|
||||||
|
/// @param eta Indice of refraction. Must be a value between -1 and 1 inclusively.
|
||||||
|
///
|
||||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||||
/// @tparam T Floating-point scalar types.
|
/// @tparam T Floating-point scalar types.
|
||||||
///
|
///
|
||||||
|
@ -68,6 +68,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
|
|||||||
- Splitted headers into EXT extensions to improve compilation time #670
|
- Splitted headers into EXT extensions to improve compilation time #670
|
||||||
- Added separated performance tests
|
- Added separated performance tests
|
||||||
- Refactor manual, lists all configuration defines
|
- Refactor manual, lists all configuration defines
|
||||||
|
- Clarified refract valid range of the indices of refraction, between -1 and 1 inclusively #806
|
||||||
|
|
||||||
#### Fixes:
|
#### Fixes:
|
||||||
- Fixed SIMD detection on Clang and GCC
|
- Fixed SIMD detection on Clang and GCC
|
||||||
|
Loading…
x
Reference in New Issue
Block a user