feat: TU0 leafs
This commit is contained in:
1 parent
6315c27226
commit
32b2e4f50e
4 files changed
+1
-80
No files matched your search
@@ -738,45 +738,9 @@ bool Tile::isSolidFace(LevelSource *level, int x, int y, int z, int face)
|
||||
|
||||
Icon *Tile::getTexture(LevelSource *level, int x, int y, int z, int face)
|
||||
{
|
||||
// 4J - addition here to make rendering big blocks of leaves more efficient. Normally leaves never consider themselves as solid, so
|
||||
// blocks of leaves will have all sides of each block completely visible. Changing to consider as solid if this block is surrounded by
|
||||
// other leaves (or solid things). This is paired with another change in Level::isSolidRenderTile/Region::isSolidRenderTile which makes things solid
|
||||
// code-wise (ie for determining visible sides of neighbouring blocks). This change just makes the texture a solid one (tex + 1) which
|
||||
// we already have in the texture map for doing non-fancy graphics. Note: this tile-specific code is here rather than making some new virtual
|
||||
// method in the tiles, for the sake of efficiency - I don't imagine we'll be doing much more of this sort of thing
|
||||
|
||||
int tileId = level->getTile(x, y, z);
|
||||
int tileData = level->getData(x, y, z);
|
||||
|
||||
if( tileId == Tile::leaves_Id )
|
||||
{
|
||||
bool opaque = true;
|
||||
|
||||
int axo[6] = { 1,-1, 0, 0, 0, 0};
|
||||
int ayo[6] = { 0, 0, 1,-1, 0, 0};
|
||||
int azo[6] = { 0, 0, 0, 0, 1,-1};
|
||||
for( int i = 0; (i < 6) && opaque; i++ )
|
||||
{
|
||||
int t = level->getTile(x + axo[i], y + ayo[i] , z + azo[i]);
|
||||
if( ( t != Tile::leaves_Id ) && ( ( Tile::tiles[t] == NULL ) || !Tile::tiles[t]->isSolidRender() ) )
|
||||
{
|
||||
opaque = false;
|
||||
}
|
||||
}
|
||||
|
||||
Icon *icon = NULL;
|
||||
if(opaque)
|
||||
{
|
||||
Tile::leaves->setFancy(false);
|
||||
icon = getTexture(face, tileData);
|
||||
Tile::leaves->setFancy(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = getTexture(face, tileData);
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
return getTexture(face, tileData);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user