#ifndef SPROUT_DARKROOM_LIGHTS_LIGHT_LIST_HPP #define SPROUT_DARKROOM_LIGHTS_LIGHT_LIST_HPP #include #include #include #include #include #include namespace sprout { namespace darkroom { namespace lights { // // light_list // template class light_list { public: typedef sprout::tuples::tuple lights_type; typedef typename sprout::darkroom::access::unit::type::color_type color_type; private: lights_type lights_; private: template SPROUT_CONSTEXPR color_type shade_2(Color const& col) const { return col; } template SPROUT_CONSTEXPR color_type shade_2(Color1 const& col1, Color2 const& col2, Tail const&... tail) const { return shade_2( sprout::darkroom::colors::add(col1, col2), tail... ); } template SPROUT_CONSTEXPR color_type shade_1( Intersection const& inter, Objects const& objs, sprout::index_tuple ) const { return shade_2(sprout::darkroom::access::get(lights_).template operator()(inter, objs)...); } public: explicit SPROUT_CONSTEXPR light_list(Lights const&... lights) : lights_(lights...) {} template SPROUT_CONSTEXPR color_type operator()(Intersection const& inter, Objects const& objs) const { return shade_1(inter, objs, sprout::index_range<0, sizeof...(Lights)>::make()); } }; // // make_light_list // template inline SPROUT_CONSTEXPR sprout::darkroom::lights::light_list make_light_list(Lights const&... lights) { return sprout::darkroom::lights::light_list(lights...); } } // namespace lights } // namespace darkroom } // namespace sprout #endif // #ifndef SPROUT_DARKROOM_LIGHTS_LIGHT_LIST_HPP