本文整理汇总了C++中Reference::CanIntersect方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::CanIntersect方法的具体用法?C++ Reference::CanIntersect怎么用?C++ Reference::CanIntersect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reference
的用法示例。
在下文中一共展示了Reference::CanIntersect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Light
// AreaLight Method Definitions
AreaLight::AreaLight(const Transform &light2world,
const Spectrum &le, int ns,
const Reference<Shape> &s)
: Light(light2world, ns) {
Lemit = le;
if (s->CanIntersect())
shape = s;
else {
// Create _ShapeSet_ for _Shape_
Reference<Shape> shapeSet = s;
vector<Reference<Shape> > todo, done;
todo.push_back(shapeSet);
while (todo.size()) {
Reference<Shape> sh = todo.back();
todo.pop_back();
if (sh->CanIntersect())
done.push_back(sh);
else
sh->Refine(todo);
}
if (done.size() == 1) shape = done[0];
else {
if (done.size() > 16)
Warning("Area light geometry turned into %d shapes; "
"may be very inefficient.", (int)done.size());
shape = new ShapeSet(done, s->ObjectToWorld, s->reverseOrientation);
}
}
area = shape->Area();
}
示例2: FullyRefine
void Primitive::FullyRefine(std::vector<Reference<Primitive> > &refined) const {
std::vector<Reference<Primitive> > todo;
todo.push_back(const_cast<Primitive *>(this));
while (todo.size()) {
// Refine last primitive in todo list
Reference<Primitive> prim = todo.back();
todo.pop_back();
if (prim->CanIntersect())
refined.push_back(prim);
else
prim->Refine(todo);
}
};
示例3: while
// ShapeSet Method Definitions
ShapeSet::ShapeSet(const Reference<Shape> &s) {
vector<Reference<Shape> > todo;
todo.push_back(s);
while (todo.size()) {
Reference<Shape> sh = todo.back();
todo.pop_back();
if (sh->CanIntersect())
shapes.push_back(sh);
else
sh->Refine(todo);
}
if (shapes.size() > 64)
Warning("Area light geometry turned into %d shapes; "
"may be very inefficient.", (int)shapes.size());
// Compute total area of shapes in _ShapeSet_ and area CDF
sumArea = 0.f;
for (uint32_t i = 0; i < shapes.size(); ++i) {
float a = shapes[i]->Area();
areas.push_back(a);
sumArea += a;
}
areaDistribution = new Distribution1D(&areas[0], areas.size());
}