1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

sprout/darkroom/cameras/simple_camera.hpp 視点と回転の設定を実装

This commit is contained in:
bolero-MURAKAMI 2011-12-12 17:23:54 +09:00
parent c86fa430c1
commit 3e028096fd
5 changed files with 191 additions and 17 deletions

View file

@ -114,6 +114,23 @@ namespace sprout {
;
}
//
// cross
//
template<typename Vector1, typename Vector2>
SPROUT_CONSTEXPR inline Vector1 cross(Vector1 const& lhs, Vector2 const& rhs) {
return sprout::tuples::remake_clone<Vector1>(
lhs,
sprout::darkroom::coords::y(lhs) * sprout::darkroom::coords::z(rhs)
- sprout::darkroom::coords::z(lhs) * sprout::darkroom::coords::y(rhs)
,
sprout::darkroom::coords::y(lhs) * sprout::darkroom::coords::x(rhs)
- sprout::darkroom::coords::x(lhs) * sprout::darkroom::coords::y(rhs)
,
sprout::darkroom::coords::x(lhs) * sprout::darkroom::coords::y(rhs)
- sprout::darkroom::coords::y(lhs) * sprout::darkroom::coords::x(rhs)
);
}
//
// normalize
//
namespace detail {
@ -139,6 +156,16 @@ namespace sprout {
);
}
//
// resize
//
template<typename Vector, typename Fac>
SPROUT_CONSTEXPR inline Vector resize(Vector const& lhs, Fac const& rhs) {
return sprout::darkroom::coords::detail::normalize_impl(
lhs,
sprout::darkroom::coords::length(lhs) / rhs
);
}
//
// reflect
//
template<typename Incident, typename Normal>