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


C++ WorldPtr::getHeight方法代码示例

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


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

示例1: initRenderingContext

void AbstractGLDisplayHelper::initRenderingContext(WorldPtr world)
{
	int height = world->getHeight();
	int width = world->getWidth();
	int depth = world->getDepth();
	int pixelResolution = world->getPixelResolution();
	_renderContext = std::make_shared<OpenGLRenderContext>(width, height, depth, pixelResolution);
}
开发者ID:AmitMarcus,项目名称:DecomposeForPacking,代码行数:8,代码来源:AbstractGLDisplayHelper.cpp

示例2:

void GL2DDisplayHelper::paintSingleSolution(WorldPtr world, PartLocationListPtr parts)
{
	for (tuple<PartOrientationPtr, Point>& partLocation : *parts)
	{
		PartOrientationPtr currentOrientation = std::get<0>(partLocation);
		Point anchorPartPoint = std::get<1>(partLocation);

		RGB_COLOR orientationColor = _colorManager->getColor(*currentOrientation);
		float r = std::get<0>(orientationColor);
		float g = std::get<1>(orientationColor);
		float b = std::get<2>(orientationColor);
		float a;
		r /= 255.0;
		g /= 255.0;
		b /= 255.0;
		a = 1.0f;

		for (Point& relativePartCoordinate : *(currentOrientation->getPointList()))
		{
			Point point = anchorPartPoint + relativePartCoordinate;

			// Paint a square for each unmasked pixel in the world
			float v1x = point.getX();
			float v1y = world->getHeight() - point.getY() - 1; // OpenGL Y axis is inverted
			float v2x = v1x + SQUARE_SIZE;
			float v2y = v1y;
			float v3x = v1x;
			float v3y = v1y + SQUARE_SIZE;
			float v4x = v1x + SQUARE_SIZE;
			float v4y = v1y + SQUARE_SIZE;

			_renderContext->write2DTriangle(v1x, v1y, v2x, v2y, v3x, v3y, r, g, b, a);
			_renderContext->write2DTriangle(v2x, v2y, v3x, v3y, v4x, v4y, r, g, b, a);

			if (currentOrientation->isContainsPointAbovePoint(relativePartCoordinate))
				_renderContext->writeLine(v1x, v1y, v2x, v2y);
			else
				_renderContext->writeBoldLine(v1x, v1y, v2x, v2y);

			if (currentOrientation->isContainsPointRightOfPoint(relativePartCoordinate))
				_renderContext->writeLine(v2x, v2y, v4x, v4y);
			else
				_renderContext->writeBoldLine(v2x, v2y, v4x, v4y);

			if (currentOrientation->isContainsPointBelowPoint(relativePartCoordinate))
				_renderContext->writeLine(v3x, v3y, v4x, v4y);
			else
				_renderContext->writeBoldLine(v3x, v3y, v4x, v4y);

			if (currentOrientation->isContainsPointLeftPoint(relativePartCoordinate))
				_renderContext->writeLine(v3x, v3y, v1x, v1y);
			else
				_renderContext->writeBoldLine(v3x, v3y, v1x, v1y);
		}
	}
}
开发者ID:AmitMarcus,项目名称:DecomposeForPacking,代码行数:56,代码来源:GL2DDisplayHelper.cpp


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