Пример #1
0
bool Chunk::hasNeighbours( long x, long y, long z )
{
	if( x == 0 || y == 0 || z == 0 ) return true;
	if( x >= CHUNK_WIDTH-1 ||  y >= CHUNK_HEIGHT-1 ||  z >= CHUNK_WIDTH-1 ) return true;
	if( getBlockAt(x - 1, y, z) ) return true;
	if( getBlockAt(x + 1, y, z) ) return true;
	if( getBlockAt(x, y - 1, z) ) return true;
	if( getBlockAt(x, y + 1, z ) ) return true;
	if( getBlockAt(x, y, z - 1) ) return true;
	if( getBlockAt(x, y, z + 1) ) return true;
	return false;
}
Пример #2
0
	inline Block World::getNeighbourOf( const Block& block, Direction d ) {
		return getBlockAt(
			static_cast< vec3 >( block.getXyz() ) + ctVec::direction6[ d ]
		);
	}