mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +07:00
math::make_loot_at_XX
This commit is contained in:
@@ -457,6 +457,46 @@ namespace e2d { namespace math
|
|||||||
axis_z);
|
axis_z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// make_loot_at_lh_matrix4
|
||||||
|
//
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
std::enable_if_t<std::is_floating_point<T>::value, mat4<T>>
|
||||||
|
make_loot_at_lh_matrix4(const vec3<T>& eye, const vec3<T>& at, const vec3<T>& up) noexcept {
|
||||||
|
const vec3<T> az = normalized(at - eye);
|
||||||
|
const vec3<T> ax = normalized(math::cross(up, az));
|
||||||
|
const vec3<T> ay = math::cross(az, ax);
|
||||||
|
const T dx = math::dot(ax, eye);
|
||||||
|
const T dy = math::dot(ay, eye);
|
||||||
|
const T dz = math::dot(az, eye);
|
||||||
|
return {
|
||||||
|
ax.x, ay.x, az.x, T(0),
|
||||||
|
ax.y, ay.y, az.y, T(0),
|
||||||
|
ax.z, ay.z, az.z, T(0),
|
||||||
|
-dx, -dy, -dz, T(1)};
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// make_loot_at_rh_matrix4
|
||||||
|
//
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
std::enable_if_t<std::is_floating_point<T>::value, mat4<T>>
|
||||||
|
make_loot_at_rh_matrix4(const vec3<T>& eye, const vec3<T>& at, const vec3<T>& up) noexcept {
|
||||||
|
const vec3<T> az = normalized(eye - at);
|
||||||
|
const vec3<T> ax = normalized(math::cross(up, az));
|
||||||
|
const vec3<T> ay = math::cross(az, ax);
|
||||||
|
const T dx = math::dot(ax, eye);
|
||||||
|
const T dy = math::dot(ay, eye);
|
||||||
|
const T dz = math::dot(az, eye);
|
||||||
|
return {
|
||||||
|
ax.x, ay.x, az.x, T(0),
|
||||||
|
ax.y, ay.y, az.y, T(0),
|
||||||
|
ax.z, ay.z, az.z, T(0),
|
||||||
|
dx, dy, dz, T(1)};
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// make_orthogonal_lh_matrix4
|
// make_orthogonal_lh_matrix4
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -238,7 +238,8 @@ int e2d_main() {
|
|||||||
math::make_rotation_matrix4(make_rad(game_time) * 0.001f, 1.f, 0.f, 0.f) *
|
math::make_rotation_matrix4(make_rad(game_time) * 0.001f, 1.f, 0.f, 0.f) *
|
||||||
math::make_rotation_matrix4(make_rad(game_time) * 0.001f, 0.f, 1.f, 0.f) *
|
math::make_rotation_matrix4(make_rad(game_time) * 0.001f, 0.f, 1.f, 0.f) *
|
||||||
math::make_rotation_matrix4(make_rad(game_time) * 0.001f, 0.f, 0.f, 1.f) *
|
math::make_rotation_matrix4(make_rad(game_time) * 0.001f, 0.f, 0.f, 1.f) *
|
||||||
math::make_translation_matrix4(0.f,0.f,3.f) *
|
math::make_translation_matrix4(0.f, 0.f, 0.f) *
|
||||||
|
math::make_loot_at_lh_matrix4({0.f,0.f,-3.f}, v3f::zero(), v3f::unit_y()) *
|
||||||
projection;
|
projection;
|
||||||
|
|
||||||
material.properties()
|
material.properties()
|
||||||
|
|||||||
Reference in New Issue
Block a user