当前位置: 首页>>代码示例>>C++>>正文


C++ Reference::Refine方法代码示例

本文整理汇总了C++中Reference::Refine方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::Refine方法的具体用法?C++ Reference::Refine怎么用?C++ Reference::Refine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reference的用法示例。


在下文中一共展示了Reference::Refine方法的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();
}
开发者ID:joohaeng,项目名称:pbrt-v1,代码行数:31,代码来源:area.cpp

示例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);
	}
};
开发者ID:MaartenBerns,项目名称:Renderbaardman,代码行数:13,代码来源:Primitive.cpp

示例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());
}
开发者ID:AI42,项目名称:OM3D,代码行数:25,代码来源:light.cpp


注:本文中的Reference::Refine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。