本文整理汇总了C++中LightSource::get_origin方法的典型用法代码示例。如果您正苦于以下问题:C++ LightSource::get_origin方法的具体用法?C++ LightSource::get_origin怎么用?C++ LightSource::get_origin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LightSource
的用法示例。
在下文中一共展示了LightSource::get_origin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render_direct
//Outputs the color of the object as enlightened by at the point where `ray` hits it.
rt::color Object::render_direct(const Ray & ray, Scene & scene, const LightSource & light_source) {
rt::color basic = compose(light_source.get_color(), color);
Impact imp = get_impact(ray);
Ray to_light(imp.point, light_source.get_origin());
double scalar = -(ray.get_direction() | imp.normale);
if (((light_source.get_origin()-imp.point) | imp.normale) <= 0) {
return rt::color::BLACK;
}
std::list<Object *> others;
Object* interceptor = scene.get_interceptor(to_light, &others);
// In case there has been mixups due to rounding errors and the object catches
// its own ray back to the light when it shouldn't (which is NOT always the case)
// detect it
if (interceptor) {
if (interceptor != this && interceptor->intersects(ray) < (imp.point - light_source.get_origin()).norm())
return rt::color::BLACK;
if (intersects(to_light) >= OWNRAY_EPSILON)
return rt::color::BLACK;
if (others.size() > 1)
return rt::color::BLACK;
}
return rt::color(
static_cast<unsigned char>(scalar*basic.get_red()),
static_cast<unsigned char>(scalar*basic.get_green()),
static_cast<unsigned char>(scalar*basic.get_blue())
);
}