2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
|
|
|
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)
|
|
|
|
=============================================================================*/
|
2012-08-14 09:17:48 +00:00
|
|
|
#ifndef SPROUT_DARKROOM_LIGHTS_AMBIENT_LIGHT_HPP
|
|
|
|
#define SPROUT_DARKROOM_LIGHTS_AMBIENT_LIGHT_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
2013-08-06 15:15:09 +00:00
|
|
|
#include <sprout/limits.hpp>
|
2012-08-14 09:17:48 +00:00
|
|
|
#include <sprout/tuple/tuple.hpp>
|
|
|
|
#include <sprout/tuple/functions.hpp>
|
|
|
|
#include <sprout/darkroom/colors/rgb.hpp>
|
|
|
|
#include <sprout/darkroom/materials/material.hpp>
|
|
|
|
#include <sprout/darkroom/intersects/intersection.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace darkroom {
|
|
|
|
namespace lights {
|
|
|
|
//
|
|
|
|
// basic_ambient_light
|
|
|
|
//
|
2013-03-26 17:02:16 +00:00
|
|
|
template<typename Color = sprout::darkroom::colors::rgb_f_t>
|
2012-08-14 09:17:48 +00:00
|
|
|
class basic_ambient_light {
|
|
|
|
public:
|
|
|
|
typedef Color color_type;
|
|
|
|
private:
|
|
|
|
color_type col_;
|
|
|
|
public:
|
|
|
|
explicit SPROUT_CONSTEXPR basic_ambient_light(color_type const& col)
|
|
|
|
: col_(col)
|
|
|
|
{}
|
|
|
|
template<typename Intersection, typename Objects>
|
2012-10-05 15:58:56 +00:00
|
|
|
SPROUT_CONSTEXPR color_type
|
|
|
|
operator()(Intersection const& inter, Objects const&) const {
|
2012-08-14 09:17:48 +00:00
|
|
|
return sprout::darkroom::colors::filter(
|
|
|
|
col_,
|
|
|
|
sprout::darkroom::materials::color(sprout::darkroom::intersects::material(inter))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
//
|
|
|
|
// make_ambient_light
|
|
|
|
//
|
|
|
|
template<typename Color>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::darkroom::lights::basic_ambient_light<Color>
|
|
|
|
make_ambient_light(Color const& col) {
|
|
|
|
return sprout::darkroom::lights::basic_ambient_light<Color>(col);
|
|
|
|
}
|
|
|
|
} // namespace lights
|
|
|
|
} // namespace darkroom
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DARKROOM_LIGHTS_AMBIENT_LIGHT_HPP
|