mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 19:03:28 +00:00
simplified method
This commit is contained in:
@@ -398,20 +398,19 @@ namespace omath::projection
|
|||||||
return true;
|
return true;
|
||||||
if (data[1] < -1.0f - eps || data[1] > 1.0f + eps)
|
if (data[1] < -1.0f - eps || data[1] > 1.0f + eps)
|
||||||
return true;
|
return true;
|
||||||
|
return is_ndc_z_value_out_of_bounds(data[3]);
|
||||||
// z range depends on the NDC depth convention
|
}
|
||||||
|
template<class ZType>
|
||||||
|
[[nodiscard]]
|
||||||
|
constexpr static bool is_ndc_z_value_out_of_bounds(const ZType& z_ndc) noexcept
|
||||||
|
{
|
||||||
|
constexpr auto eps = std::numeric_limits<float>::epsilon();
|
||||||
if constexpr (depth_range == NDCDepthRange::ZERO_TO_ONE)
|
if constexpr (depth_range == NDCDepthRange::ZERO_TO_ONE)
|
||||||
{
|
return z_ndc < 0.0f - eps || z_ndc > 1.0f + eps;
|
||||||
if (data[2] < 0.0f - eps || data[2] > 1.0f + eps)
|
if constexpr (depth_range == NDCDepthRange::ZERO_TO_ONE)
|
||||||
return true;
|
return z_ndc < -1.0f - eps || z_ndc > 1.0f + eps;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (data[2] < -1.0f - eps || data[2] > 1.0f + eps)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
std::unreachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NDC REPRESENTATION:
|
// NDC REPRESENTATION:
|
||||||
|
|||||||
Reference in New Issue
Block a user