fold
parent
a066d8f6e4
commit
26c1953bc0
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
|
||||
set(BLT_GRAPHICS_VERSION 0.12.3)
|
||||
set(BLT_GRAPHICS_VERSION 0.12.4)
|
||||
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
|
||||
|
||||
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})
|
||||
|
|
|
@ -21,15 +21,46 @@
|
|||
|
||||
#include <blt/math/vectors.h>
|
||||
#include <blt/math/matrix.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace blt::gfx
|
||||
{
|
||||
|
||||
template<typename... Args>
|
||||
inline const bool not_float_v = (std::is_arithmetic_v<Args> && ...) && (!std::is_same_v<float, Args> && ...);
|
||||
|
||||
blt::vec3 calculateRay3D(float mx, float my, float width, float height, const blt::mat4x4& view, const blt::mat4x4& proj);
|
||||
|
||||
blt::vec3 calculateRay3D(float width, float height, const blt::mat4x4& view, const blt::mat4x4& proj);
|
||||
|
||||
blt::vec3 calculateRay2D(float mx, float my, float width, float height, const blt::vec3 scale, const blt::mat4x4& view, const blt::mat4x4& proj);
|
||||
|
||||
blt::vec3 calculateRay2D(float width, float height, const blt::vec3 scale, const blt::mat4x4& view, const blt::mat4x4& proj);
|
||||
|
||||
template<typename T, typename G, std::enable_if_t<not_float_v<T, G>, bool> = true>
|
||||
inline blt::vec3 calculateRay2D(T width, G height, const blt::vec3& scale, const blt::mat4x4& view, const blt::mat4x4& proj)
|
||||
{
|
||||
return calculateRay2D(static_cast<float>(width), static_cast<float>(height), scale, view, proj);
|
||||
}
|
||||
|
||||
template<typename T, typename G, typename V, typename N, std::enable_if_t<not_float_v<T, G, V, N>, bool> = true>
|
||||
inline blt::vec3 calculateRay2D(T mx, G my, V width, N height, const blt::vec3& scale, const blt::mat4x4& view, const blt::mat4x4& proj)
|
||||
{
|
||||
return calculateRay2D(static_cast<float>(mx), static_cast<float>(my),
|
||||
static_cast<float>(width), static_cast<float>(height), scale, view, proj);
|
||||
}
|
||||
|
||||
template<typename T, typename G, std::enable_if_t<not_float_v<T, G>, bool> = true>
|
||||
inline blt::vec3 calculateRay3D(T width, G height, const blt::mat4x4& view, const blt::mat4x4& proj)
|
||||
{
|
||||
return calculateRay3D(static_cast<float>(width), static_cast<float>(height), view, proj);
|
||||
}
|
||||
|
||||
template<typename T, typename G, typename V, typename N, std::enable_if_t<not_float_v<T, G, V, N>, bool> = true>
|
||||
inline blt::vec3 calculateRay3D(T mx, G my, V width, N height, const blt::mat4x4& view, const blt::mat4x4& proj)
|
||||
{
|
||||
return calculateRay3D(static_cast<float>(mx), static_cast<float>(my), static_cast<float>(width), static_cast<float>(height), view, proj);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
blt::vec3 toWorldCoords(const blt::vec4& eyeCoords, const blt::mat4x4& view);
|
||||
|
@ -43,7 +74,7 @@ namespace blt::gfx
|
|||
return blt::vec2(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif //BLT_GRAPHICS_RAYCAST_H
|
||||
|
|
Loading…
Reference in New Issue