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


C++ ProgressBar::end方法代码示例

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


在下文中一共展示了ProgressBar::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generateHierarchyFullParallel

/// <summary>
/// Generates the hierarchy.  http://devblogs.nvidia.com/parallelforall/wp-content/uploads/sites/3/2012/11/karras2012hpg_paper.pdf
/// </summary>
/// <param name="boxes">The boxes.</param>
void BVH::generateHierarchyFullParallel(std::vector<AABBox>& boxes)
{
	ProgressBar progressBar;

#if !_DEBUG
#pragma omp parallel for schedule(dynamic,1)
#endif
	for (int i = 0; i < (boxes.size() - 1); i++)
	{
		//first, find the range this node corresponds to
		//d == -1 means range ends at i, d == +1 means range starts at i
		int d = sign(commonPrefix(boxes, i, i + 1) - commonPrefix(boxes, i, i - 1));

		//find a maximum and minimum value for the range this node covers.  Must be a power of two for easy binary searching
		int min = commonPrefix(boxes, i, i - d);
		int max = 128;

		while (commonPrefix(boxes, i, i + (max * d)) > min)
		{
			max *= 4;
		}

		//use binary serach to find the farthest common prefis that is greater than min
		int l = 0;
		for (int t = max >> 1; t >= 1; t = t >> 1)
		{
			if (commonPrefix(boxes, i, i + (l + t) * d) > min)
			{
				//serach to the right of this value
				l += t;
			}
		}

		//end of range
		int j = i + l * d;
		int first = i;

		if (d < 0)
		{
			first = j;
			j = i;
		}


		// Determine where to split the range.
		int split = findSplit(boxes, first, j);

		Node* rightChild;
		if (split == first)
		{
			rightChild = &m_leafNodes[split];
		}
		else
		{
			rightChild = &m_branchNodes[split];
		}

		Node* leftChild;
		if (split + 1 == j)
		{
			leftChild = &m_leafNodes[split + 1];
		}
		else
		{
			leftChild = &m_branchNodes[split + 1];
		}

//		m_branchNodes[i].m = max;
//		m_branchNodes[i].re = first;
//		m_branchNodes[i].rs = j;
//		m_branchNodes[i].s = split;
		m_branchNodes[i].rightChild = rightChild;
		m_branchNodes[i].leftChild = leftChild;
//		leftChild->parent = &m_branchNodes[i];
//		rightChild->parent = &m_branchNodes[i];

#pragma omp critical
		{
			progressBar.updateProgress(static_cast<int>((static_cast<float>(i) / boxes.size()) * 100));
		}
	}

	progressBar.end();
}
开发者ID:steveschwarcz,项目名称:Path-Tracer-SS,代码行数:88,代码来源:BVH.cpp

示例2: generateHierarchyStackLinear

void BVH::generateHierarchyStackLinear(std::vector<AABBox>& boxes)
{
	std::stack<constructData *> dataStack;
	dataStack.push(new constructData(&m_branchNodes[0], 0, static_cast<int>(boxes.size() - 1)));

	//	constructData *dataStackArray = new constructData[1024];
	//	dataStackArray[0] = constructData(&m_branchNodes[0], 0, static_cast<int>(boxes.size() - 1));
	//	uint32_t stackSize = 1;

	int i = 0;
	ProgressBar progressBar;

	do
	{
		constructData* data = dataStack.top();
		dataStack.pop();

		//		--stackSize;
		//		constructData data = dataStackArray[stackSize];

		// Determine where to split the range.
		int split = findSplit(boxes, data->first, data->last);

		Node* rightChild;
		if (split == data->first)
		{
			rightChild = &m_leafNodes[split];
		}
		else
		{
			rightChild = &m_branchNodes[split];

			//push next node
			dataStack.push(new constructData(rightChild, data->first, split));
			//			dataStackArray[stackSize] = constructData(rightChild, data.first, split);
			//			++stackSize;
		}

		Node* leftChild;
		if (split + 1 == data->last)
		{
			leftChild = &m_leafNodes[split + 1];
		}
		else
		{
			leftChild = &m_branchNodes[split + 1];

			//push next node
			dataStack.push(new constructData(leftChild, split + 1, data->last));
			//			dataStackArray[stackSize] = constructData(leftChild, split + 1, data.last);
			//			++stackSize;
		}

		//		m_branchNodes[i].m = max;
		//		data.node->re = data.last;
		//		data.node->rs = data.first;
		//		data.node->s = split;
		data->node->rightChild = rightChild;
		data->node->leftChild = leftChild;
		//		leftChild->parent = data.node;
		//		rightChild->parent = data.node;

		delete data;

		i++;
		progressBar.updateProgress(static_cast<int>((static_cast<float>(i) / boxes.size()) * 100));
	}
	while (!dataStack.empty());

	progressBar.end();
}
开发者ID:steveschwarcz,项目名称:Path-Tracer-SS,代码行数:71,代码来源:BVH.cpp


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