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


C++ MapSector::getVertices方法代码示例

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


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

示例1: processZDoomSlopes


//.........这里部分代码省略.........
		}
	}

	// Vertex height things
	// These only affect the calculation of slopes and shouldn't be stored in
	// the map data proper, so instead of actually changing vertex properties,
	// we store them in a hashmap.
	VertexHeightMap vertex_floor_heights;
	VertexHeightMap vertex_ceiling_heights;
	for (unsigned a = 0; a < map->nThings(); a++)
	{
		MapThing* thing = map->getThing(a);
		if (thing->getType() == 1504 || thing->getType() == 1505)
		{
			// TODO there could be more than one vertex at this point
			MapVertex* vertex = map->vertexAt(thing->xPos(), thing->yPos());
			if (vertex)
			{
				if (thing->getType() == 1504)
					vertex_floor_heights[vertex] = thing->floatProperty("height");
				else if (thing->getType() == 1505)
					vertex_ceiling_heights[vertex] = thing->floatProperty("height");
			}
		}
	}

	// Vertex heights -- only applies for sectors with exactly three vertices.
	// Heights may be set by UDMF properties, or by a vertex height thing
	// placed exactly on the vertex (which takes priority over the prop).
	vector<MapVertex*> vertices;
	for (unsigned a = 0; a < map->nSectors(); a++)
	{
		MapSector* target = map->getSector(a);
		vertices.clear();
		target->getVertices(vertices);
		if (vertices.size() != 3)
			continue;

		applyVertexHeightSlope<FLOOR_PLANE>(target, vertices, vertex_floor_heights);
		applyVertexHeightSlope<CEILING_PLANE>(target, vertices, vertex_ceiling_heights);
	}

	// Plane_Copy
	vector<MapSector*> sectors;
	for (unsigned a = 0; a < map->nLines(); a++)
	{
		MapLine* line = map->getLine(a);
		if (line->getSpecial() != 118)
			continue;

		int tag;
		MapSector* front = line->frontSector();
		MapSector* back = line->backSector();
		if ((tag = line->intProperty("arg0")) && front)
		{
			sectors.clear();
			map->getSectorsByTag(tag, sectors);
			if (sectors.size())
				front->setFloorPlane(sectors[0]->getFloorPlane());
		}
		if ((tag = line->intProperty("arg1")) && front)
		{
			sectors.clear();
			map->getSectorsByTag(tag, sectors);
			if (sectors.size())
				front->setCeilingPlane(sectors[0]->getCeilingPlane());
		}
		if ((tag = line->intProperty("arg2")) && back)
		{
			sectors.clear();
			map->getSectorsByTag(tag, sectors);
			if (sectors.size())
				back->setFloorPlane(sectors[0]->getFloorPlane());
		}
		if ((tag = line->intProperty("arg3")) && back)
		{
			sectors.clear();
			map->getSectorsByTag(tag, sectors);
			if (sectors.size())
				back->setCeilingPlane(sectors[0]->getCeilingPlane());
		}

		// The fifth "share" argument copies from one side of the line to the
		// other
		if (front && back)
		{
			int share = line->intProperty("arg4");

			if ((share & 3) == 1)
				back->setFloorPlane(front->getFloorPlane());
			else if ((share & 3) == 2)
				front->setFloorPlane(back->getFloorPlane());

			if ((share & 12) == 4)
				back->setCeilingPlane(front->getCeilingPlane());
			else if ((share & 12) == 8)
				front->setCeilingPlane(back->getCeilingPlane());
		}
	}
}
开发者ID:Talon1024,项目名称:SLADE,代码行数:101,代码来源:MapSpecials.cpp


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