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)
|
|
|
|
=============================================================================*/
|
2011-12-14 11:14:13 +00:00
|
|
|
#ifndef SPROUT_DARKROOM_MATERIALS_UNIFORM_HPP
|
|
|
|
#define SPROUT_DARKROOM_MATERIALS_UNIFORM_HPP
|
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/tuple/tuple.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace darkroom {
|
|
|
|
namespace materials {
|
|
|
|
//
|
|
|
|
// uniform_element
|
|
|
|
//
|
|
|
|
template<typename Element>
|
|
|
|
class uniform_element {
|
|
|
|
public:
|
|
|
|
typedef Element result_type;
|
|
|
|
private:
|
|
|
|
result_type elem_;
|
|
|
|
public:
|
2012-04-11 14:28:29 +00:00
|
|
|
explicit SPROUT_CONSTEXPR uniform_element(result_type const& elem)
|
2011-12-14 11:14:13 +00:00
|
|
|
: elem_(elem)
|
|
|
|
{}
|
|
|
|
template<typename Unit>
|
2012-10-05 15:58:56 +00:00
|
|
|
SPROUT_CONSTEXPR result_type
|
|
|
|
operator()(Unit const&, Unit const&) const {
|
2011-12-14 11:14:13 +00:00
|
|
|
return elem_;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
//
|
|
|
|
// make_uniform
|
|
|
|
//
|
|
|
|
template<typename Element>
|
2012-07-15 07:04:05 +00:00
|
|
|
inline SPROUT_CONSTEXPR sprout::darkroom::materials::uniform_element<Element>
|
2011-12-14 11:14:13 +00:00
|
|
|
make_uniform(Element const& elem) {
|
|
|
|
return sprout::darkroom::materials::uniform_element<Element>(elem);
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// make_uniform_material_image
|
|
|
|
//
|
2013-12-03 13:17:49 +00:00
|
|
|
template<typename... Elements>
|
2012-07-15 07:04:05 +00:00
|
|
|
inline SPROUT_CONSTEXPR sprout::tuples::tuple<
|
2013-12-03 13:17:49 +00:00
|
|
|
sprout::darkroom::materials::uniform_element<Elements>...
|
2012-10-05 15:58:56 +00:00
|
|
|
>
|
2013-12-03 13:17:49 +00:00
|
|
|
make_uniform_material_image(Elements const&... elems) {
|
2011-12-14 11:14:13 +00:00
|
|
|
return sprout::tuples::make_tuple(
|
2013-12-03 13:17:49 +00:00
|
|
|
sprout::darkroom::materials::make_uniform(elems)...
|
2011-12-14 11:14:13 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
} // namespace materials
|
|
|
|
} // namespace darkroom
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_DARKROOM_MATERIALS_UNIFORM_HPP
|