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


C++ TileSource::getTileAndData方法代码示例

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


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

示例1: render

void CableRenderer::render(const TilePos& pos, Tile* tile, TileTessellator* tess) {
	int x = pos.x, y = pos.y, z = pos.z;
	TileSource* ts = tess->region;
	
	bool insulated = ts->getTileAndData(x, y, z).data == 1;
	
	FullTile frontt = ts->getTileAndData(x + 1, y, z);
	FullTile backt = ts->getTileAndData(x - 1, y, z);
	FullTile leftt = ts->getTileAndData(x, y, z + 1);
	FullTile rightt = ts->getTileAndData(x, y, z - 1);
	FullTile bottomt = ts->getTileAndData(x, y - 1, z);
	FullTile topt = ts->getTileAndData(x, y + 1, z);
	
	bool front = frontt.id == tile->id;
	bool back = backt.id == tile->id;
	bool left = leftt.id == tile->id;
	bool right = rightt.id == tile->id;
	bool bottom = bottomt.id == tile->id;
	bool top = topt.id == tile->id;
	
	tess->useForcedUV = true;
	tess->forcedUV = tile->getTexture(0, 0);
	
	tess->setRenderBounds(0.4, 0.4, 0.4, 0.6, 0.6, 0.6);
	tess->tessellateBlockInWorld(tile, {x, y, z});
	
	if(insulated) {
		tess->setRenderBounds(0.35, 0.35, 0.35, 0.65, 0.65, 0.65);
		tess->tessellateBlockInWorld(tile, {x, y, z});
	}
	
	if(front) {
		tess->setRenderBounds(0.6, 0.4, 0.4, 1, 0.6, 0.6);
		tess->tessellateBlockInWorld(tile, {x, y, z});
	}
	
	if(back) {
		tess->setRenderBounds(0, 0.4, 0.4, 0.4, 0.6, 0.6);
		tess->tessellateBlockInWorld(tile, {x, y, z});
	}
	
	if(left) {
		tess->setRenderBounds(0.4, 0.4, 0.6, 0.6, 0.6, 1);
		tess->tessellateBlockInWorld(tile, {x, y, z});
	}
	
	if(right) {
		if(insulated) {
			if(rightt.data == 1) {
				tess->setRenderBounds(0.35, 0.35, 0, 0.65, 0.65, 0.4);
				tess->tessellateBlockInWorld(tile, {x, y, z});
			} else {
				tess->setRenderBounds(0.35, 0.35, 0.1, 0.65, 0.65, 0.4);
				tess->tessellateBlockInWorld(tile, {x, y, z});
			}
		}
		tess->setRenderBounds(0.4, 0.4, 0, 0.6, 0.6, 0.4);
		tess->tessellateBlockInWorld(tile, {x, y, z});
	}
	
	if(bottom) {
		if(insulated) {
			if(bottomt.data == 1) {
				tess->setRenderBounds(0.35, 0.1, 0.35, 0.65, 0.4, 0.65);
				tess->tessellateBlockInWorld(tile, {x, y, z});
			}
		}
		tess->setRenderBounds(0.4, 0, 0.4, 0.6, 0.4, 0.6);
		tess->tessellateBlockInWorld(tile, {x, y, z});
	}
	
	if(top) {
		if(insulated) {
			tess->setRenderBounds(0.35, 0.6, 0.35, 0.65, 0.9, 0.65);
			tess->tessellateBlockInWorld(tile, {x, y, z});
		}
		tess->setRenderBounds(0.4, 0.6, 0.4, 0.6, 1, 0.6);
		tess->tessellateBlockInWorld(tile, {x, y, z});
	}
	tess->useForcedUV = false;
}
开发者ID:MrTangYafei,项目名称:PocketIndustrialization,代码行数:81,代码来源:CableRenderer.cpp


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