本文整理汇总了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;
}