Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify glm::refract's behaviour #808

Merged
merged 1 commit into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions glm/detail/func_geometric.inl
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,10 @@ 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)
{
assert(eta >= static_cast<T>(-1) && eta <= static_cast<T>(1));

T const dotValue(dot(N, I));
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
vec<L, T, Q> const Result = (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
vec<L, T, Q> const Result =
(k >= static_cast<T>(0)) ? (eta * I - (eta * dotValue + std::sqrt(k)) * N) : vec<L, T, Q>(0);
return Result;
}
};
Expand Down
2 changes: 0 additions & 2 deletions glm/geometric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ namespace glm
/// and the ratio of indices of refraction eta,
/// 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 T Floating-point scalar types.
///
Expand Down