/*============================================================================= Copyright (c) 2011-2013 Bolero MURAKAMI 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_PIXELS_GENERATE_HPP #define SPROUT_DARKROOM_PIXELS_GENERATE_HPP #include #include #include #include #include #include #include #include namespace sprout { namespace darkroom { namespace pixels { // // generate // namespace detail { template< typename Pixels, typename RayTracer, typename Renderer, typename Camera, typename Objects, typename Lights, sprout::index_t... XIndexes > inline SPROUT_CONSTEXPR typename sprout::container_traits::value_type generate_impl_line( RayTracer const& raytracer, Renderer const& renderer, Camera const& camera, Objects const& objs, Lights const& lights, typename sprout::container_traits< typename sprout::container_traits::value_type >::size_type x, typename sprout::container_traits::size_type y, typename sprout::container_traits< typename sprout::container_traits::value_type >::size_type width, typename sprout::container_traits::size_type height, std::size_t depth_max, sprout::index_tuple ) { typedef typename sprout::container_traits::value_type pixel_line_type; typedef typename sprout::container_traits::value_type pixel_type; return sprout::make( sprout::darkroom::colors::rgb_f_to_rgb( raytracer.template operator()( renderer, camera, objs, lights, x + XIndexes, y, width, height, depth_max ) )... ); } template< typename Pixels, typename RayTracer, typename Renderer, typename Camera, typename Objects, typename Lights, sprout::index_t... YIndexes > inline SPROUT_CONSTEXPR Pixels generate_impl( RayTracer const& raytracer, Renderer const& renderer, Camera const& camera, Objects const& objs, Lights const& lights, typename sprout::container_traits< typename sprout::container_traits::value_type >::size_type x , typename sprout::container_traits::size_type y, typename sprout::container_traits< typename sprout::container_traits::value_type >::size_type width , typename sprout::container_traits::size_type height, std::size_t depth_max, sprout::index_tuple ) { return sprout::make( sprout::darkroom::pixels::detail::generate_impl_line( raytracer, renderer, camera, objs, lights, x, y + YIndexes, width, height, depth_max, sprout::container_indexes::value_type>::make() )... ); } } // namespace detail template< typename Pixels, typename RayTracer, typename Renderer, typename Camera, typename Objects, typename Lights > inline SPROUT_CONSTEXPR Pixels generate( RayTracer const& raytracer, Renderer const& renderer, Camera const& camera, Objects const& objs, Lights const& lights, typename sprout::container_traits< typename sprout::container_traits::value_type >::size_type x = 0, typename sprout::container_traits::size_type y = 0, typename sprout::container_traits< typename sprout::container_traits::value_type >::size_type width = sprout::container_traits< typename sprout::container_traits::value_type >::static_size, typename sprout::container_traits::size_type height = sprout::container_traits::static_size, std::size_t depth_max = 8 ) { return sprout::darkroom::pixels::detail::generate_impl( raytracer, renderer, camera, objs, lights, x, y, width, height, depth_max, sprout::container_indexes::make() ); } // // color_pixels // template struct color_pixels { public: typedef sprout::array, Height> type; }; } // namespace pixels } // namespace darkroom } // namespace sprout #endif // #ifndef SPROUT_DARKROOM_PIXELS_GENERATE_HPP