1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

workaround for no c++11 numeric_limits

This commit is contained in:
bolero-MURAKAMI 2013-08-07 00:15:09 +09:00
parent ce16e24637
commit 7a1974742a
110 changed files with 727 additions and 436 deletions

View file

@ -2,8 +2,8 @@
#define SPROUT_DARKROOM_COLORS_RGB_HPP
#include <cstdint>
#include <limits>
#include <sprout/config.hpp>
#include <sprout/limits.hpp>
#include <sprout/tuple/tuple.hpp>
#include <sprout/tuple/functions.hpp>
#include <sprout/utility/forward.hpp>
@ -121,17 +121,17 @@ namespace sprout {
rgb_f_to_rgb(RGB_F const& col) {
typedef typename sprout::darkroom::access::unit<RGB>::type unit_type;
return sprout::tuples::make<RGB>(
sprout::darkroom::colors::r(col) < 0 ? std::numeric_limits<unit_type>::min()
: sprout::darkroom::colors::r(col) > 1 ? std::numeric_limits<unit_type>::max()
: sprout::darkroom::colors::r(col) * std::numeric_limits<unit_type>::max()
sprout::darkroom::colors::r(col) < 0 ? sprout::numeric_limits<unit_type>::min()
: sprout::darkroom::colors::r(col) > 1 ? sprout::numeric_limits<unit_type>::max()
: sprout::darkroom::colors::r(col) * sprout::numeric_limits<unit_type>::max()
,
sprout::darkroom::colors::g(col) < 0 ? std::numeric_limits<unit_type>::min()
: sprout::darkroom::colors::g(col) > 1 ? std::numeric_limits<unit_type>::max()
: sprout::darkroom::colors::g(col) * std::numeric_limits<unit_type>::max()
sprout::darkroom::colors::g(col) < 0 ? sprout::numeric_limits<unit_type>::min()
: sprout::darkroom::colors::g(col) > 1 ? sprout::numeric_limits<unit_type>::max()
: sprout::darkroom::colors::g(col) * sprout::numeric_limits<unit_type>::max()
,
sprout::darkroom::colors::b(col) < 0 ? std::numeric_limits<unit_type>::min()
: sprout::darkroom::colors::b(col) > 1 ? std::numeric_limits<unit_type>::max()
: sprout::darkroom::colors::b(col) * std::numeric_limits<unit_type>::max()
sprout::darkroom::colors::b(col) < 0 ? sprout::numeric_limits<unit_type>::min()
: sprout::darkroom::colors::b(col) > 1 ? sprout::numeric_limits<unit_type>::max()
: sprout::darkroom::colors::b(col) * sprout::numeric_limits<unit_type>::max()
);
}
} // namespace colors

View file

@ -1,8 +1,8 @@
#ifndef SPROUT_DARKROOM_LIGHTS_AMBIENT_LIGHT_HPP
#define SPROUT_DARKROOM_LIGHTS_AMBIENT_LIGHT_HPP
#include <limits>
#include <sprout/config.hpp>
#include <sprout/limits.hpp>
#include <sprout/tuple/tuple.hpp>
#include <sprout/tuple/functions.hpp>
#include <sprout/darkroom/colors/rgb.hpp>

View file

@ -1,8 +1,8 @@
#ifndef SPROUT_DARKROOM_LIGHTS_LIGHT_LIST_HPP
#define SPROUT_DARKROOM_LIGHTS_LIGHT_LIST_HPP
#include <limits>
#include <sprout/config.hpp>
#include <sprout/limits.hpp>
#include <sprout/index_tuple/metafunction.hpp>
#include <sprout/tuple/tuple.hpp>
#include <sprout/darkroom/access/access.hpp>

View file

@ -1,8 +1,8 @@
#ifndef SPROUT_DARKROOM_LIGHTS_PARALLEL_LIGHT_HPP
#define SPROUT_DARKROOM_LIGHTS_PARALLEL_LIGHT_HPP
#include <limits>
#include <sprout/config.hpp>
#include <sprout/limits.hpp>
#include <sprout/darkroom/access/access.hpp>
#include <sprout/darkroom/colors/rgb.hpp>
#include <sprout/darkroom/coords/vector.hpp>
@ -49,9 +49,9 @@ namespace sprout {
inter,
!sprout::darkroom::intersects::does_intersect(light_ray_inter)
|| sprout::darkroom::intersects::distance(light_ray_inter)
< std::numeric_limits<unit_type>::epsilon()
< sprout::numeric_limits<unit_type>::epsilon()
? NS_SSCRISK_CEL_OR_SPROUT::max(
std::numeric_limits<unit_type>::epsilon(),
sprout::numeric_limits<unit_type>::epsilon(),
sprout::darkroom::coords::dot(
dir_,
sprout::darkroom::intersects::normal(inter)
@ -76,7 +76,7 @@ namespace sprout {
sprout::darkroom::coords::add(
sprout::darkroom::coords::scale(
dir_,
std::numeric_limits<unit_type>::epsilon() * 256
sprout::numeric_limits<unit_type>::epsilon() * 256
),
sprout::darkroom::intersects::point_of_intersection(inter)
),

View file

@ -1,8 +1,8 @@
#ifndef SPROUT_DARKROOM_LIGHTS_POINT_LIGHT_HPP
#define SPROUT_DARKROOM_LIGHTS_POINT_LIGHT_HPP
#include <limits>
#include <sprout/config.hpp>
#include <sprout/limits.hpp>
#include <sprout/darkroom/access/access.hpp>
#include <sprout/darkroom/colors/rgb.hpp>
#include <sprout/darkroom/coords/vector.hpp>
@ -55,9 +55,9 @@ namespace sprout {
|| sprout::darkroom::intersects::distance(light_ray_inter)
> sprout::darkroom::coords::length(diff)
|| sprout::darkroom::intersects::distance(light_ray_inter)
< std::numeric_limits<unit_type>::epsilon()
< sprout::numeric_limits<unit_type>::epsilon()
? NS_SSCRISK_CEL_OR_SPROUT::max(
std::numeric_limits<unit_type>::epsilon(),
sprout::numeric_limits<unit_type>::epsilon(),
sprout::darkroom::coords::dot(
direction,
sprout::darkroom::intersects::normal(inter)
@ -80,7 +80,7 @@ namespace sprout {
sprout::darkroom::coords::add(
sprout::darkroom::coords::scale(
direction,
std::numeric_limits<unit_type>::epsilon() * 256
sprout::numeric_limits<unit_type>::epsilon() * 256
),
sprout::darkroom::intersects::point_of_intersection(inter)
),

View file

@ -2,9 +2,9 @@
#define SPROUT_DARKROOM_RENDERERS_WHITTED_STYLE_HPP
#include <cstddef>
#include <limits>
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/limits.hpp>
#include <sprout/tuple/functions.hpp>
#include <sprout/darkroom/access/access.hpp>
#include <sprout/darkroom/colors/rgb.hpp>
@ -45,12 +45,12 @@ namespace sprout {
sprout::darkroom::intersects::point_of_intersection(inter),
sprout::darkroom::coords::scale(
reflect_dir,
std::numeric_limits<typename sprout::darkroom::access::unit<Direction>::type>::epsilon() * 256
sprout::numeric_limits<typename sprout::darkroom::access::unit<Direction>::type>::epsilon() * 256
)
// ???
// sprout::darkroom::coords::scale(
// sprout::darkroom::intersects::normal(inter),
// std::numeric_limits<typename sprout::darkroom::access::unit<Direction>::type>::epsilon() * 256
// sprout::numeric_limits<typename sprout::darkroom::access::unit<Direction>::type>::epsilon() * 256
// )
),
reflect_dir
@ -77,7 +77,7 @@ namespace sprout {
return depth_max > 0
&& sprout::darkroom::intersects::does_intersect(inter)
&& sprout::darkroom::materials::reflection(sprout::darkroom::intersects::material(inter))
> std::numeric_limits<reflection_type>::epsilon()
> sprout::numeric_limits<reflection_type>::epsilon()
? color_1<Color>(
camera, objs, lights,
ray, inter, tracer,