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


C++ Landscape::push_back方法代码示例

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


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

示例1: _imageToLandscape

Landscape* DynamicModelNoColor::_imageToLandscape(Image* img)
{
	Landscape* land = new Landscape();	

	float begin = 0;
	bool color = img->at(0);
	uint i = 0;
	for (i = 0; i < img->size(); i++)
	{
		if ((bool)img->at(i) != color)
		{
			if (color)
			{
				land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
					(i - begin) / 360. * PI));
			}
			begin = i;
			color = img->at(i);
		}
	}
	if (color)
	{
				land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
					(i - begin) / 360. * PI));
	}

	return land;
}
开发者ID:ettadar,项目名称:Animat,代码行数:28,代码来源:dynamicmodelnocolor.cpp

示例2: _imageToLandscape

Landscape* CCmodel::_imageToLandscape(Image* img)
{
	Landscape* land = new Landscape();
	int lastPixelColor = img->at(0);
	int lastObjBegin = 0;

	uint i = 0;
	for (; i < img->size(); ++i)
	{
		if (img->at(i) == lastPixelColor)
			continue;

		if (img->at(i) != BLACK && lastPixelColor != BLACK)
		{
			lastPixelColor = img->at(i);
			continue;
		}


		LandscapeElem* object = new LandscapeElem(lastPixelColor == BLACK,
			((((lastObjBegin + i - 1) / 2.) - VIEW_ANGLE / 2)  / 360.) * 2 * PI,
			((float)(i - lastObjBegin) / 360.) * 2 * PI);
		land->push_back(object);
		lastObjBegin = i;
		lastPixelColor = img->at(i);
	}

	LandscapeElem* object = new LandscapeElem(lastPixelColor == BLACK,
		((((lastObjBegin + i - 1) / 2.) - VIEW_ANGLE / 2)  / 360.) * 2 * PI,
		((float)(i - lastObjBegin) / 360.) * 2 * PI);
	land->push_back(object);
	return land;
}
开发者ID:ettadar,项目名称:Animat,代码行数:33,代码来源:ccmodel.cpp

示例3: _imageToLandscape

Landscape* DynamicModelColor::_imageToLandscape(Image* img)
{
	Landscape* land = new Landscape();	

	float begin = 0;
	int currColor = img->at(0);
	uint i = 0;
	for (i = 0; i < img->size(); i++)
	{
		if (img->at(i) != currColor)
		{
			if (currColor == RED)
			{
				land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
					(i - begin) / 360. * PI, HUERED, SATRED, VALUERED));
			}
			else if (currColor == BLUE)
			{
				land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
					(i - begin) / 360. * PI, HUEBLUE, SATBLUE, VALUEBLUE));
			}
			else if (currColor == GREEN)
			{
				land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
					(i - begin) / 360. * PI, HUEGREEN, SATGREEN, VALUEGREEN));
			}
			begin = i;
			currColor = img->at(i);
		}
	}
	if (currColor == RED)
	{
		land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
			(i - begin) / 360. * PI, HUERED, SATRED, VALUERED));
	}
	else if (currColor == BLUE)
	{
		land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
			(i - begin) / 360. * PI, HUEBLUE, SATBLUE, VALUEBLUE));
	}
	else if (currColor == GREEN)
	{
		land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
			(i - begin) / 360. * PI, HUEGREEN, SATGREEN, VALUEGREEN));
	}

	return land;
}
开发者ID:ettadar,项目名称:Animat,代码行数:48,代码来源:dynamicmodelcolor.cpp


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