2013-09-24 06:08:36 +00:00
|
|
|
/*=============================================================================
|
2015-01-10 10:13:57 +00:00
|
|
|
Copyright (c) 2011-2015 Bolero MURAKAMI
|
2013-09-24 06:08:36 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
|
|
|
#ifndef SPROUT_DARKROOM_RENDERERS_CALCULATE_HPP
|
|
|
|
#define SPROUT_DARKROOM_RENDERERS_CALCULATE_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
2014-04-30 07:30:26 +00:00
|
|
|
#include <sprout/workaround/std/cstddef.hpp>
|
2013-09-24 06:08:36 +00:00
|
|
|
#include <sprout/type_traits/identity.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace darkroom {
|
|
|
|
namespace renderers {
|
2013-12-12 14:29:50 +00:00
|
|
|
//
|
2013-12-31 12:26:22 +00:00
|
|
|
// default_depth
|
2013-12-12 14:29:50 +00:00
|
|
|
//
|
|
|
|
SPROUT_STATIC_CONSTEXPR std::size_t default_depth = 4;
|
|
|
|
|
2013-09-24 06:08:36 +00:00
|
|
|
//
|
|
|
|
// calculate_result
|
|
|
|
//
|
2013-12-12 14:29:50 +00:00
|
|
|
template<typename Color, typename Renderer, typename Camera, typename Objects, typename Lights, typename Ray, typename Refractions = double>
|
2013-09-24 06:08:36 +00:00
|
|
|
struct calculate_result
|
|
|
|
: public sprout::identity<Color>
|
|
|
|
{};
|
2013-12-12 14:29:50 +00:00
|
|
|
template<typename Color, typename Renderer, typename Camera, typename Objects, typename Lights, typename Ray, typename Refractions>
|
|
|
|
struct calculate_result<Color, Renderer const, Camera, Objects, Lights, Ray, Refractions>
|
|
|
|
: public sprout::darkroom::renderers::calculate_result<Color, Renderer, Camera, Objects, Lights, Ray, Refractions>
|
2013-09-24 06:08:36 +00:00
|
|
|
{};
|
2013-12-12 14:29:50 +00:00
|
|
|
template<typename Color, typename Renderer, typename Camera, typename Objects, typename Lights, typename Ray, typename Refractions>
|
|
|
|
struct calculate_result<Color, Renderer volatile, Camera, Objects, Lights, Ray, Refractions>
|
|
|
|
: public sprout::darkroom::renderers::calculate_result<Color, Renderer, Camera, Objects, Lights, Ray, Refractions>
|
2013-09-24 06:08:36 +00:00
|
|
|
{};
|
2013-12-12 14:29:50 +00:00
|
|
|
template<typename Color, typename Renderer, typename Camera, typename Objects, typename Lights, typename Ray, typename Refractions>
|
|
|
|
struct calculate_result<Color, Renderer const volatile, Camera, Objects, Lights, Ray, Refractions>
|
|
|
|
: public sprout::darkroom::renderers::calculate_result<Color, Renderer, Camera, Objects, Lights, Ray, Refractions>
|
2013-09-24 06:08:36 +00:00
|
|
|
{};
|
|
|
|
|
|
|
|
//
|
|
|
|
// calculate
|
|
|
|
//
|
2013-12-12 14:29:50 +00:00
|
|
|
template<typename Color, typename Renderer, typename Camera, typename Objects, typename Lights, typename Ray, typename Refractions>
|
|
|
|
inline SPROUT_CONSTEXPR typename sprout::darkroom::renderers::calculate_result<Color, Renderer, Camera, Objects, Lights, Ray, Refractions>::type
|
|
|
|
calculate(
|
|
|
|
Renderer const& renderer,
|
|
|
|
Camera const& camera, Objects const& objs, Lights const& lights,
|
|
|
|
Ray const& ray, std::size_t depth_max, Refractions const& refracs
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return renderer.template operator()<Color>(camera, objs, lights, ray, depth_max, refracs);
|
|
|
|
}
|
2013-09-24 06:08:36 +00:00
|
|
|
template<typename Color, typename Renderer, typename Camera, typename Objects, typename Lights, typename Ray>
|
|
|
|
inline SPROUT_CONSTEXPR typename sprout::darkroom::renderers::calculate_result<Color, Renderer, Camera, Objects, Lights, Ray>::type
|
|
|
|
calculate(
|
|
|
|
Renderer const& renderer,
|
|
|
|
Camera const& camera, Objects const& objs, Lights const& lights,
|
|
|
|
Ray const& ray, std::size_t depth_max
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return renderer.template operator()<Color>(camera, objs, lights, ray, depth_max);
|
|
|
|
}
|
|
|
|
} // namespace renderers
|
|
|
|
} // namespace darkroom
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DARKROOM_RENDERERS_CALCULATE_HPP
|