本文整理汇总了C++中TileSource::getTile方法的典型用法代码示例。如果您正苦于以下问题:C++ TileSource::getTile方法的具体用法?C++ TileSource::getTile怎么用?C++ TileSource::getTile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileSource
的用法示例。
在下文中一共展示了TileSource::getTile方法的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 front = ts->getTile(x + 1, y, z) == tile->id;
bool back = ts->getTile(x - 1, y, z) == tile->id;
bool left = ts->getTile(x, y, z + 1) == tile->id;
bool right = ts->getTile(x, y, z - 1) == tile->id;
bool bottom = ts->getTile(x, y - 1, z) == tile->id;
bool top = ts->getTile(x, y + 1, z) == 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(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) {
tess->setRenderBounds(0.4, 0.4, 0, 0.6, 0.6, 0.4);
tess->tessellateBlockInWorld(tile, {x, y, z});
}
if(bottom) {
tess->setRenderBounds(0.4, 0, 0.4, 0.6, 0.4, 0.6);
tess->tessellateBlockInWorld(tile, {x, y, z});
}
if(top) {
tess->setRenderBounds(0.4, 0.6, 0.4, 0.6, 1, 0.6);
tess->tessellateBlockInWorld(tile, {x, y, z});
}
tess->useForcedUV = false;
}