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


C++ NodeOperation::isViewerOperation方法代码示例

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


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

示例1: setRenderBorder

void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax)
{
	NodeOperation *operation = this->getOutputOperation();

	if (operation->isOutputOperation(true)) {
		/* Basically, setting border need to happen for only operations
		 * which operates in render resolution buffers (like compositor
		 * output nodes).
		 *
		 * In this cases adding border will lead to mapping coordinates
		 * from output buffer space to input buffer spaces when executing
		 * operation.
		 *
		 * But nodes like viewer and file output just shall display or
		 * safe the same exact buffer which goes to their input, no need
		 * in any kind of coordinates mapping.
		 */

		bool operationNeedsBorder = !(operation->isViewerOperation() ||
		                              operation->isPreviewOperation() ||
		                              operation->isFileOutputOperation());

		if (operationNeedsBorder) {
			BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width,
			              ymin * this->m_height, ymax * this->m_height);
		}
	}
}
开发者ID:wchargin,项目名称:blender,代码行数:28,代码来源:COM_ExecutionGroup.cpp

示例2: setViewerBorder

void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float ymax)
{
	NodeOperation *operation = this->getOutputOperation();

	if (operation->isViewerOperation() || operation->isPreviewOperation()) {
		BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width,
		              ymin * this->m_height, ymax * this->m_height);
	}
}
开发者ID:wchargin,项目名称:blender,代码行数:9,代码来源:COM_ExecutionGroup.cpp

示例3: execute

/**
 * this method is called for the top execution groups. containing the compositor node or the preview node or the viewer node)
 */
void ExecutionGroup::execute(ExecutionSystem *graph)
{
	const CompositorContext &context = graph->getContext();
	const bNodeTree *bTree = context.getbNodeTree();
	if (this->m_width == 0 || this->m_height == 0) {return; } /// @note: break out... no pixels to calculate.
	if (bTree->test_break && bTree->test_break(bTree->tbh)) {return; } /// @note: early break out for blur and preview nodes
	if (this->m_numberOfChunks == 0) {return; } /// @note: early break out
	unsigned int chunkNumber;

	this->m_executionStartTime = PIL_check_seconds_timer();

	this->m_chunksFinished = 0;
	this->m_bTree = bTree;
	unsigned int index;
	unsigned int *chunkOrder = (unsigned int *)MEM_mallocN(sizeof(unsigned int) * this->m_numberOfChunks, __func__);

	for (chunkNumber = 0; chunkNumber < this->m_numberOfChunks; chunkNumber++) {
		chunkOrder[chunkNumber] = chunkNumber;
	}
	NodeOperation *operation = this->getOutputOperation();
	float centerX = 0.5;
	float centerY = 0.5;
	OrderOfChunks chunkorder = COM_ORDER_OF_CHUNKS_DEFAULT;

	if (operation->isViewerOperation()) {
		ViewerOperation *viewer = (ViewerOperation *)operation;
		centerX = viewer->getCenterX();
		centerY = viewer->getCenterY();
		chunkorder = viewer->getChunkOrder();
	}

	const int border_width = BLI_rcti_size_x(&this->m_viewerBorder);
	const int border_height = BLI_rcti_size_y(&this->m_viewerBorder);

	switch (chunkorder) {
		case COM_TO_RANDOM:
			for (index = 0; index < 2 * this->m_numberOfChunks; index++) {
				int index1 = rand() % this->m_numberOfChunks;
				int index2 = rand() % this->m_numberOfChunks;
				int s = chunkOrder[index1];
				chunkOrder[index1] = chunkOrder[index2];
				chunkOrder[index2] = s;
			}
			break;
		case COM_TO_CENTER_OUT:
		{
			ChunkOrderHotspot *hotspots[1];
			hotspots[0] = new ChunkOrderHotspot(border_width * centerX, border_height * centerY, 0.0f);
			rcti rect;
			ChunkOrder *chunkOrders = (ChunkOrder *)MEM_mallocN(sizeof(ChunkOrder) * this->m_numberOfChunks, __func__);
			for (index = 0; index < this->m_numberOfChunks; index++) {
				determineChunkRect(&rect, index);
				chunkOrders[index].setChunkNumber(index);
				chunkOrders[index].setX(rect.xmin - this->m_viewerBorder.xmin);
				chunkOrders[index].setY(rect.ymin - this->m_viewerBorder.ymin);
				chunkOrders[index].determineDistance(hotspots, 1);
			}

			std::sort(&chunkOrders[0], &chunkOrders[this->m_numberOfChunks - 1]);
			for (index = 0; index < this->m_numberOfChunks; index++) {
				chunkOrder[index] = chunkOrders[index].getChunkNumber();
			}

			delete hotspots[0];
			MEM_freeN(chunkOrders);
			break;
		}
		case COM_TO_RULE_OF_THIRDS:
		{
			ChunkOrderHotspot *hotspots[9];
			unsigned int tx = border_width / 6;
			unsigned int ty = border_height / 6;
			unsigned int mx = border_width / 2;
			unsigned int my = border_height / 2;
			unsigned int bx = mx + 2 * tx;
			unsigned int by = my + 2 * ty;

			float addition = this->m_numberOfChunks / COM_RULE_OF_THIRDS_DIVIDER;
			hotspots[0] = new ChunkOrderHotspot(mx, my, addition * 0);
			hotspots[1] = new ChunkOrderHotspot(tx, my, addition * 1);
			hotspots[2] = new ChunkOrderHotspot(bx, my, addition * 2);
			hotspots[3] = new ChunkOrderHotspot(bx, by, addition * 3);
			hotspots[4] = new ChunkOrderHotspot(tx, ty, addition * 4);
			hotspots[5] = new ChunkOrderHotspot(bx, ty, addition * 5);
			hotspots[6] = new ChunkOrderHotspot(tx, by, addition * 6);
			hotspots[7] = new ChunkOrderHotspot(mx, ty, addition * 7);
			hotspots[8] = new ChunkOrderHotspot(mx, by, addition * 8);
			rcti rect;
			ChunkOrder *chunkOrders = (ChunkOrder *)MEM_mallocN(sizeof(ChunkOrder) * this->m_numberOfChunks, __func__);
			for (index = 0; index < this->m_numberOfChunks; index++) {
				determineChunkRect(&rect, index);
				chunkOrders[index].setChunkNumber(index);
				chunkOrders[index].setX(rect.xmin - this->m_viewerBorder.xmin);
				chunkOrders[index].setY(rect.ymin - this->m_viewerBorder.ymin);
				chunkOrders[index].determineDistance(hotspots, 9);
			}

//.........这里部分代码省略.........
开发者ID:wchargin,项目名称:blender,代码行数:101,代码来源:COM_ExecutionGroup.cpp


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