mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add darkroom light_list, parallel_light, ambient_light
fix darkroom whitted_style
This commit is contained in:
parent
6b1efc8a15
commit
dc1e85923b
7 changed files with 285 additions and 33 deletions
48
sprout/darkroom/lights/ambient_light.hpp
Normal file
48
sprout/darkroom/lights/ambient_light.hpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#ifndef SPROUT_DARKROOM_LIGHTS_AMBIENT_LIGHT_HPP
|
||||
#define SPROUT_DARKROOM_LIGHTS_AMBIENT_LIGHT_HPP
|
||||
|
||||
#include <limits>
|
||||
#include <sprout/config.hpp>
|
||||
#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
|
||||
//
|
||||
template<typename Color = sprout::darkroom::colors::rgb_f>
|
||||
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>
|
||||
SPROUT_CONSTEXPR color_type operator()(Intersection const& inter, Objects const&) const {
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue