forked from Kolyah35/minecraft-pe-0.6.1
Massive Java Parity Update - fileshredder
3D/Fancy Clouds have been ported over Sky Rendering is now an option between Java and PE Java Sky/Fog color option is now accurate using the original color ramp instead of PE's slightly lower one Grass Sides are now tinted, and can be toggled in settings Added stars, the sun, and the moon in the daylight cycle Sunset color has been added, appears when the sun is rising or falling, buggy on PE's sky rendering option. Fixed leaves being rendered bright green when foliage tinting was turned off. Enabled Tall Grass generation code Tall Grass is now tinted. Other compile options have to be tested
This commit is contained in:
@@ -19,8 +19,10 @@
|
||||
#include "tileentity/TileEntityRenderer.h"
|
||||
#include "EntityTileRenderer.h"
|
||||
|
||||
TileRenderer::TileRenderer( LevelSource* level /* = NULL */ )
|
||||
: level(level),
|
||||
bool TileRenderer::sideTinting = false;
|
||||
|
||||
TileRenderer::TileRenderer(LevelSource* level /* = NULL */ )
|
||||
: level(level),
|
||||
fixedTexture(-1),
|
||||
xFlipTexture(false),
|
||||
noCulling(false),
|
||||
@@ -58,6 +60,11 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
||||
float c2 = 0.8f;
|
||||
float c3 = 0.6f;
|
||||
|
||||
// added these to get biome color and save it before its overriden - shredder
|
||||
float biomeR = r;
|
||||
float biomeG = g;
|
||||
float biomeB = b;
|
||||
|
||||
|
||||
float r11 = c11 * r;
|
||||
float g11 = c11 * g;
|
||||
@@ -101,6 +108,10 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
||||
if (tt->zz0 > 0) br = centerBrightness;
|
||||
t.color(r2 * br, g2 * br, b2 * br);
|
||||
renderNorth(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 2));
|
||||
if ((tt->getTexture(level, x, y, z, 2) == 3) && sideTinting) { // checking if the texture from terrain.png is the normal grass side texture
|
||||
t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB);
|
||||
renderNorth(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -109,6 +120,10 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
||||
if (tt->zz1 < 1) br = centerBrightness;
|
||||
t.color(r2 * br, g2 * br, b2 * br);
|
||||
renderSouth(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 3));
|
||||
if ((tt->getTexture(level, x, y, z, 3) == 3) && sideTinting){ // checking if the texture from terrain.png is the normal grass side texture
|
||||
t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB);
|
||||
renderSouth(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -117,6 +132,10 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
||||
if (tt->xx0 > 0) br = centerBrightness;
|
||||
t.color(r3 * br, g3 * br, b3 * br);
|
||||
renderWest(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 4));
|
||||
if ((tt->getTexture(level, x, y, z, 4) == 3) && sideTinting) { // checking if the texture from terrain.png is the normal grass side texture
|
||||
t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB);
|
||||
renderWest(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -125,6 +144,10 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, float r
|
||||
if (tt->xx1 < 1) br = centerBrightness;
|
||||
t.color(r3 * br, g3 * br, b3 * br);
|
||||
renderEast(tt, xf, yf, zf, tt->getTexture(level, x, y, z, 5));
|
||||
if ((tt->getTexture(level, x, y, z, 5) == 3) && sideTinting) { // checking if the texture from terrain.png is the normal grass side texture
|
||||
t.color(c2 * br * biomeR, c2 * br * biomeG, c2 * br * biomeB);
|
||||
renderEast(tt, xf, yf, zf, 38); // rendering an extra face over the side of the cube that is a grayscale grass fringe tinted by t.color using biome colors, kinda inefficient
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -148,38 +171,38 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z )
|
||||
return tesselateBlockInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_WATER) {
|
||||
return tesselateWaterInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_CACTUS) {
|
||||
return tesselateCactusInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_CACTUS) {
|
||||
return tesselateCactusInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
||||
return tesselateCrossInWorld(tt, x, y, z);
|
||||
} else if(shape == Tile::SHAPE_STEM) {
|
||||
return tesselateStemInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_ROWS) {
|
||||
return tesselateRowInWorld(tt, x, y, z);
|
||||
return tesselateRowInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_TORCH) {
|
||||
return tesselateTorchInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_FIRE) {
|
||||
return tesselateFireInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_RED_DUST) {
|
||||
// return tesselateDustInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_FIRE) {
|
||||
return tesselateFireInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_RED_DUST) {
|
||||
// return tesselateDustInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_LADDER) {
|
||||
return tesselateLadderInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_DOOR) {
|
||||
return tesselateDoorInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_RAIL) {
|
||||
// return tesselateRailInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_RAIL) {
|
||||
// return tesselateRailInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_STAIRS) {
|
||||
return tesselateStairsInWorld((StairTile*)tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_FENCE) {
|
||||
return tesselateFenceInWorld((FenceTile*)tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_FENCE) {
|
||||
return tesselateFenceInWorld((FenceTile*)tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_FENCE_GATE) {
|
||||
return tesselateFenceGateInWorld((FenceGateTile*) tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_LEVER) {
|
||||
// return tesselateLeverInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_BED) {
|
||||
// return tesselateBedInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_DIODE) {
|
||||
// return tesselateDiodeInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_LEVER) {
|
||||
// return tesselateLeverInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_BED) {
|
||||
// return tesselateBedInWorld(tt, x, y, z);
|
||||
//} else if (shape == Tile::SHAPE_DIODE) {
|
||||
// return tesselateDiodeInWorld(tt, x, y, z);
|
||||
} else if (shape == Tile::SHAPE_IRON_FENCE) {
|
||||
return tesselateThinFenceInWorld((ThinFenceTile*) tt, x, y, z);
|
||||
} else if(shape == Tile::SHAPE_BED) {
|
||||
@@ -232,10 +255,10 @@ bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||
int tex = tt->getTexture(0);
|
||||
|
||||
if (fixedTexture >= 0) tex = fixedTexture;
|
||||
|
||||
|
||||
float br = tt->getBrightness( level, x, y, z );
|
||||
t.color( br, br, br );
|
||||
|
||||
|
||||
int xt = ((tex & 0xf) << 4);
|
||||
int yt = tex & 0xf0;
|
||||
|
||||
@@ -340,82 +363,82 @@ bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||
if ( Tile::fire->canBurn( level, x - 1, y, z ) )
|
||||
{
|
||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
|
||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
}
|
||||
if ( Tile::fire->canBurn( level, x + 1, y, z ) )
|
||||
{
|
||||
t.vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
|
||||
t.vertexUV( ( float )( x + 1.0f - r ), ( float )( y + h + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f - 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f - 0 ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f - r ), ( float )( y + h + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
||||
}
|
||||
if ( Tile::fire->canBurn( level, x, y, z - 1 ) )
|
||||
{
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z +
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z +
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z +
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z +
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
}
|
||||
if ( Tile::fire->canBurn( level, x, y, z + 1 ) )
|
||||
{
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
||||
}
|
||||
if ( Tile::fire->canBurn( level, x, y + 1.0f, z ) )
|
||||
{
|
||||
@@ -440,13 +463,13 @@ bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||
if ( ( ( x + y + z ) & 1 ) == 0 )
|
||||
{
|
||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z +
|
||||
0 ), ( float )( u1 ), ( float )( v0 ) );
|
||||
0 ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z +
|
||||
0 ), ( float )( u1 ), ( float )( v1 ) );
|
||||
0 ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z +
|
||||
1 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
1 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z +
|
||||
1 ), ( float )( u0 ), ( float )( v0 ) );
|
||||
1 ), ( float )( u0 ), ( float )( v0 ) );
|
||||
|
||||
u0 = (xt) / 256.0f;
|
||||
u1 = (xt + 15.99f) / 256.0f;
|
||||
@@ -454,24 +477,24 @@ bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||
v1 = (yt + 15.99f) / 256.0f;
|
||||
|
||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z +
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z +
|
||||
0 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z +
|
||||
0 ), ( float )( u0 ), ( float )( v0 ) );
|
||||
0 ), ( float )( u0 ), ( float )( v0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
||||
h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) );
|
||||
h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
||||
0.0f ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
||||
0.0f ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
||||
h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) );
|
||||
h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) );
|
||||
|
||||
u0 = (xt) / 256.0f;
|
||||
u1 = (xt + 15.99f) / 256.0f;
|
||||
@@ -479,13 +502,13 @@ bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||
v1 = (yt + 15.99f) / 256.0f;
|
||||
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
||||
h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) );
|
||||
h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) );
|
||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
||||
0.0f ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
||||
0.0f ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
0.0f ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) );
|
||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
||||
h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) );
|
||||
h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -958,46 +981,46 @@ float TileRenderer::getWaterHeight( int x, int y, int z, const Material* m )
|
||||
}
|
||||
|
||||
void TileRenderer::renderBlock(Tile* tt, LevelSource* level, int x, int y, int z) {
|
||||
float c10 = 0.5f;
|
||||
float c11 = 1;
|
||||
float c2 = 0.8f;
|
||||
float c3 = 0.6f;
|
||||
float c10 = 0.5f;
|
||||
float c11 = 1;
|
||||
float c2 = 0.8f;
|
||||
float c3 = 0.6f;
|
||||
|
||||
Tesselator& t = Tesselator::instance;
|
||||
t.begin();
|
||||
Tesselator& t = Tesselator::instance;
|
||||
t.begin();
|
||||
|
||||
float center = tt->getBrightness(level, x, y, z);
|
||||
float br = tt->getBrightness(level, x, y - 1, z);
|
||||
if (br < center) br = center;
|
||||
float center = tt->getBrightness(level, x, y, z);
|
||||
float br = tt->getBrightness(level, x, y - 1, z);
|
||||
if (br < center) br = center;
|
||||
|
||||
t.color(c10 * br, c10 * br, c10 * br);
|
||||
renderFaceDown(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(0));
|
||||
t.color(c10 * br, c10 * br, c10 * br);
|
||||
renderFaceDown(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(0));
|
||||
|
||||
br = tt->getBrightness(level, x, y + 1, z);
|
||||
if (br < center) br = center;
|
||||
t.color(c11 * br, c11 * br, c11 * br);
|
||||
renderFaceUp(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(1));
|
||||
br = tt->getBrightness(level, x, y + 1, z);
|
||||
if (br < center) br = center;
|
||||
t.color(c11 * br, c11 * br, c11 * br);
|
||||
renderFaceUp(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(1));
|
||||
|
||||
br = tt->getBrightness(level, x, y, z - 1);
|
||||
if (br < center) br = center;
|
||||
t.color(c2 * br, c2 * br, c2 * br);
|
||||
renderNorth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(2));
|
||||
br = tt->getBrightness(level, x, y, z - 1);
|
||||
if (br < center) br = center;
|
||||
t.color(c2 * br, c2 * br, c2 * br);
|
||||
renderNorth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(2));
|
||||
|
||||
br = tt->getBrightness(level, x, y, z + 1);
|
||||
if (br < center) br = center;
|
||||
t.color(c2 * br, c2 * br, c2 * br);
|
||||
renderSouth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(3));
|
||||
br = tt->getBrightness(level, x, y, z + 1);
|
||||
if (br < center) br = center;
|
||||
t.color(c2 * br, c2 * br, c2 * br);
|
||||
renderSouth(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(3));
|
||||
|
||||
br = tt->getBrightness(level, x - 1, y, z);
|
||||
if (br < center) br = center;
|
||||
t.color(c3 * br, c3 * br, c3 * br);
|
||||
renderWest(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(4));
|
||||
br = tt->getBrightness(level, x - 1, y, z);
|
||||
if (br < center) br = center;
|
||||
t.color(c3 * br, c3 * br, c3 * br);
|
||||
renderWest(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(4));
|
||||
|
||||
br = tt->getBrightness(level, x + 1, y, z);
|
||||
if (br < center) br = center;
|
||||
t.color(c3 * br, c3 * br, c3 * br);
|
||||
renderEast(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(5));
|
||||
t.draw();
|
||||
br = tt->getBrightness(level, x + 1, y, z);
|
||||
if (br < center) br = center;
|
||||
t.color(c3 * br, c3 * br, c3 * br);
|
||||
renderEast(tt, -0.5f, -0.5f, -0.5f, tt->getTexture(5));
|
||||
t.draw();
|
||||
}
|
||||
|
||||
bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX, int pY, int pZ, float pBaseRed, float pBaseGreen, float pBaseBlue )
|
||||
@@ -1197,6 +1220,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
||||
c4g *= ll4;
|
||||
c4b *= ll4;
|
||||
renderNorth(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 2));
|
||||
if (tt->getTexture(level, pX, pY, pZ, 2) == 3 && sideTinting)
|
||||
{
|
||||
c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue;
|
||||
c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue;
|
||||
c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue;
|
||||
c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue;
|
||||
|
||||
renderNorth(tt, (float) pX, (float) pY, (float) pZ, 38);
|
||||
}
|
||||
i = true;
|
||||
}
|
||||
if ((noCulling) || (tt->shouldRenderFace(level, pX, pY, pZ + 1, 3))) {
|
||||
@@ -1250,6 +1282,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
||||
c4g *= ll4;
|
||||
c4b *= ll4;
|
||||
renderSouth(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 3));
|
||||
if (tt->getTexture(level, pX, pY, pZ, 3) == 3 && sideTinting)
|
||||
{
|
||||
c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue;
|
||||
c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue;
|
||||
c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue;
|
||||
c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue;
|
||||
|
||||
renderSouth(tt, (float) pX, (float) pY, (float) pZ, 38);
|
||||
}
|
||||
i = true;
|
||||
}
|
||||
if ((noCulling) || (tt->shouldRenderFace(level, pX - 1, pY, pZ, 4))) {
|
||||
@@ -1302,6 +1343,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
||||
c4g *= ll4;
|
||||
c4b *= ll4;
|
||||
renderWest(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 4));
|
||||
if (tt->getTexture(level, pX, pY, pZ, 4) == 3 && sideTinting)
|
||||
{
|
||||
c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue;
|
||||
c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue;
|
||||
c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue;
|
||||
c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue;
|
||||
|
||||
renderWest(tt, (float) pX, (float) pY, (float) pZ, 38);
|
||||
}
|
||||
i = true;
|
||||
}
|
||||
if ((noCulling) || (tt->shouldRenderFace(level, pX + 1, pY, pZ, 5))) {
|
||||
@@ -1355,6 +1405,15 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
||||
c4b *= ll4;
|
||||
|
||||
renderEast(tt, (float) pX, (float) pY, (float) pZ, tt->getTexture(level, pX, pY, pZ, 5));
|
||||
if (tt->getTexture(level, pX, pY, pZ, 5) == 3 && sideTinting)
|
||||
{
|
||||
c1r *= pBaseRed; c1g *= pBaseGreen; c1b *= pBaseBlue;
|
||||
c2r *= pBaseRed; c2g *= pBaseGreen; c2b *= pBaseBlue;
|
||||
c3r *= pBaseRed; c3g *= pBaseGreen; c3b *= pBaseBlue;
|
||||
c4r *= pBaseRed; c4g *= pBaseGreen; c4b *= pBaseBlue;
|
||||
|
||||
renderEast(tt, (float) pX, (float) pY, (float) pZ, 38);
|
||||
}
|
||||
i = true;
|
||||
}
|
||||
applyAmbienceOcclusion = false;
|
||||
@@ -1362,124 +1421,124 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusion( Tile* tt, int pX,
|
||||
}
|
||||
|
||||
bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z) {
|
||||
int col = tt->getColor(level, x, y, z);
|
||||
float r = ((col >> 16) & 0xff) / 255.0f;
|
||||
float g = ((col >> 8) & 0xff) / 255.0f;
|
||||
float b = ((col) & 0xff) / 255.0f;
|
||||
return tesselateCactusInWorld(tt, x, y, z, r, g, b);
|
||||
int col = tt->getColor(level, x, y, z);
|
||||
float r = ((col >> 16) & 0xff) / 255.0f;
|
||||
float g = ((col >> 8) & 0xff) / 255.0f;
|
||||
float b = ((col) & 0xff) / 255.0f;
|
||||
return tesselateCactusInWorld(tt, x, y, z, r, g, b);
|
||||
}
|
||||
|
||||
bool TileRenderer::tesselateCactusInWorld(Tile* tt, int x, int y, int z, float r, float g, float b) {
|
||||
Tesselator& t = Tesselator::instance;
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
bool changed = false;
|
||||
float c10 = 0.5f;
|
||||
float c11 = 1;
|
||||
float c2 = 0.8f;
|
||||
float c3 = 0.6f;
|
||||
bool changed = false;
|
||||
float c10 = 0.5f;
|
||||
float c11 = 1;
|
||||
float c2 = 0.8f;
|
||||
float c3 = 0.6f;
|
||||
|
||||
float r10 = c10 * r;
|
||||
float r11 = c11 * r;
|
||||
float r2 = c2 * r;
|
||||
float r3 = c3 * r;
|
||||
float r10 = c10 * r;
|
||||
float r11 = c11 * r;
|
||||
float r2 = c2 * r;
|
||||
float r3 = c3 * r;
|
||||
|
||||
float g10 = c10 * g;
|
||||
float g11 = c11 * g;
|
||||
float g2 = c2 * g;
|
||||
float g3 = c3 * g;
|
||||
float g10 = c10 * g;
|
||||
float g11 = c11 * g;
|
||||
float g2 = c2 * g;
|
||||
float g3 = c3 * g;
|
||||
|
||||
float b10 = c10 * b;
|
||||
float b11 = c11 * b;
|
||||
float b2 = c2 * b;
|
||||
float b3 = c3 * b;
|
||||
float b10 = c10 * b;
|
||||
float b11 = c11 * b;
|
||||
float b2 = c2 * b;
|
||||
float b3 = c3 * b;
|
||||
|
||||
float s = 1 / 16.0f;
|
||||
float s = 1 / 16.0f;
|
||||
const float X = (float)x;
|
||||
const float Y = (float)y;
|
||||
const float Z = (float)z;
|
||||
|
||||
float centerBrightness = tt->getBrightness(level, x, y, z);
|
||||
float centerBrightness = tt->getBrightness(level, x, y, z);
|
||||
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y - 1, z, 0)) {
|
||||
float br = tt->getBrightness(level, x, y - 1, z);
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r10 * br, g10 * br, b10 * br);
|
||||
renderFaceDown(tt, X, Y, Z, tt->getTexture(level, x, y, z, 0));
|
||||
changed = true;
|
||||
}
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y - 1, z, 0)) {
|
||||
float br = tt->getBrightness(level, x, y - 1, z);
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r10 * br, g10 * br, b10 * br);
|
||||
renderFaceDown(tt, X, Y, Z, tt->getTexture(level, x, y, z, 0));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y + 1, z, 1)) {
|
||||
float br = tt->getBrightness(level, x, y + 1, z);
|
||||
if (tt->yy1 != 1 && !tt->material->isLiquid()) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r11 * br, g11 * br, b11 * br);
|
||||
renderFaceUp(tt, X, Y, Z, tt->getTexture(level, x, y, z, 1));
|
||||
changed = true;
|
||||
}
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y + 1, z, 1)) {
|
||||
float br = tt->getBrightness(level, x, y + 1, z);
|
||||
if (tt->yy1 != 1 && !tt->material->isLiquid()) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r11 * br, g11 * br, b11 * br);
|
||||
renderFaceUp(tt, X, Y, Z, tt->getTexture(level, x, y, z, 1));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y, z - 1, 2)) {
|
||||
float br = tt->getBrightness(level, x, y, z - 1);
|
||||
if (tt->zz0 > 0) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r2 * br, g2 * br, b2 * br);
|
||||
t.addOffset(0, 0, s);
|
||||
renderNorth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 2));
|
||||
t.addOffset(0, 0, -s);
|
||||
changed = true;
|
||||
}
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y, z - 1, 2)) {
|
||||
float br = tt->getBrightness(level, x, y, z - 1);
|
||||
if (tt->zz0 > 0) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r2 * br, g2 * br, b2 * br);
|
||||
t.addOffset(0, 0, s);
|
||||
renderNorth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 2));
|
||||
t.addOffset(0, 0, -s);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y, z + 1, 3)) {
|
||||
float br = tt->getBrightness(level, x, y, z + 1);
|
||||
if (tt->zz1 < 1) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r2 * br, g2 * br, b2 * br);
|
||||
t.addOffset(0, 0, -s);
|
||||
renderSouth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 3));
|
||||
t.addOffset(0, 0, s);
|
||||
changed = true;
|
||||
}
|
||||
if (noCulling || tt->shouldRenderFace(level, x, y, z + 1, 3)) {
|
||||
float br = tt->getBrightness(level, x, y, z + 1);
|
||||
if (tt->zz1 < 1) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r2 * br, g2 * br, b2 * br);
|
||||
t.addOffset(0, 0, -s);
|
||||
renderSouth(tt, X, Y, Z, tt->getTexture(level, x, y, z, 3));
|
||||
t.addOffset(0, 0, s);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (noCulling || tt->shouldRenderFace(level, x - 1, y, z, 4)) {
|
||||
float br = tt->getBrightness(level, x - 1, y, z);
|
||||
if (tt->xx0 > 0) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r3 * br, g3 * br, b3 * br);
|
||||
t.addOffset(s, 0, 0);
|
||||
renderWest(tt, X, Y, Z, tt->getTexture(level, x, y, z, 4));
|
||||
t.addOffset(-s, 0, 0);
|
||||
changed = true;
|
||||
}
|
||||
if (noCulling || tt->shouldRenderFace(level, x - 1, y, z, 4)) {
|
||||
float br = tt->getBrightness(level, x - 1, y, z);
|
||||
if (tt->xx0 > 0) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r3 * br, g3 * br, b3 * br);
|
||||
t.addOffset(s, 0, 0);
|
||||
renderWest(tt, X, Y, Z, tt->getTexture(level, x, y, z, 4));
|
||||
t.addOffset(-s, 0, 0);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (noCulling || tt->shouldRenderFace(level, x + 1, y, z, 5)) {
|
||||
float br = tt->getBrightness(level, x + 1, y, z);
|
||||
if (tt->xx1 < 1) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r3 * br, g3 * br, b3 * br);
|
||||
t.addOffset(-s, 0, 0);
|
||||
renderEast(tt, X, Y, Z, tt->getTexture(level, x, y, z, 5));
|
||||
t.addOffset(s, 0, 0);
|
||||
changed = true;
|
||||
}
|
||||
if (noCulling || tt->shouldRenderFace(level, x + 1, y, z, 5)) {
|
||||
float br = tt->getBrightness(level, x + 1, y, z);
|
||||
if (tt->xx1 < 1) br = centerBrightness;
|
||||
// if (Tile::lightEmission[tt->id] > br*Level.MAX_BRIGHTNESS) br =
|
||||
// Tile::lightEmission[tt->id]/Level.MAX_BRIGHTNESS;
|
||||
t.color(r3 * br, g3 * br, b3 * br);
|
||||
t.addOffset(-s, 0, 0);
|
||||
renderEast(tt, X, Y, Z, tt->getTexture(level, x, y, z, 5));
|
||||
t.addOffset(s, 0, 0);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool TileRenderer::tesselateFenceInWorld(FenceTile* tt, int x, int y, int z) {
|
||||
bool changed = true;
|
||||
bool changed = true;
|
||||
|
||||
float a = 6 / 16.0f;
|
||||
float b = 10 / 16.0f;
|
||||
tt->setShape(a, 0, a, b, 1, b);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
float a = 6 / 16.0f;
|
||||
float b = 10 / 16.0f;
|
||||
tt->setShape(a, 0, a, b, 1, b);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
|
||||
bool vertical = false;
|
||||
bool horizontal = false;
|
||||
bool vertical = false;
|
||||
bool horizontal = false;
|
||||
|
||||
bool l = tt->connectsTo(level, x - 1, y, z);
|
||||
bool r = tt->connectsTo(level, x + 1, y, z);
|
||||
@@ -1487,42 +1546,42 @@ bool TileRenderer::tesselateFenceInWorld(FenceTile* tt, int x, int y, int z) {
|
||||
bool d = tt->connectsTo(level, x, y, z + 1);
|
||||
|
||||
if (l || r) vertical = true;
|
||||
if (u || d) horizontal = true;
|
||||
if (u || d) horizontal = true;
|
||||
|
||||
if (!vertical && !horizontal) vertical = true;
|
||||
if (!vertical && !horizontal) vertical = true;
|
||||
|
||||
a = 7 / 16.0f;
|
||||
b = 9 / 16.0f;
|
||||
float h0 = 12 / 16.0f;
|
||||
float h1 = 15 / 16.0f;
|
||||
a = 7 / 16.0f;
|
||||
b = 9 / 16.0f;
|
||||
float h0 = 12 / 16.0f;
|
||||
float h1 = 15 / 16.0f;
|
||||
|
||||
float x0 = l ? 0 : a;
|
||||
float x1 = r ? 1 : b;
|
||||
float z0 = u ? 0 : a;
|
||||
float z1 = d ? 1 : b;
|
||||
float x0 = l ? 0 : a;
|
||||
float x1 = r ? 1 : b;
|
||||
float z0 = u ? 0 : a;
|
||||
float z1 = d ? 1 : b;
|
||||
|
||||
if (vertical) {
|
||||
tt->setShape(x0, h0, a, x1, h1, b);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
if (horizontal) {
|
||||
tt->setShape(a, h0, z0, b, h1, z1);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
if (vertical) {
|
||||
tt->setShape(x0, h0, a, x1, h1, b);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
if (horizontal) {
|
||||
tt->setShape(a, h0, z0, b, h1, z1);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
|
||||
h0 = 6 / 16.0f;
|
||||
h1 = 9 / 16.0f;
|
||||
if (vertical) {
|
||||
tt->setShape(x0, h0, a, x1, h1, b);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
if (horizontal) {
|
||||
tt->setShape(a, h0, z0, b, h1, z1);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
h0 = 6 / 16.0f;
|
||||
h1 = 9 / 16.0f;
|
||||
if (vertical) {
|
||||
tt->setShape(x0, h0, a, x1, h1, b);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
if (horizontal) {
|
||||
tt->setShape(a, h0, z0, b, h1, z1);
|
||||
tesselateBlockInWorld(tt, x, y, z);
|
||||
}
|
||||
|
||||
tt->setShape(0, 0, 0, 1, 1, 1);
|
||||
return changed;
|
||||
tt->setShape(0, 0, 0, 1, 1, 1);
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool TileRenderer::tesselateFenceGateInWorld(FenceGateTile* tt, int x, int y, int z) {
|
||||
@@ -2308,7 +2367,7 @@ void TileRenderer::renderEast( Tile* tt, float x, float y, float z, int tex )
|
||||
void TileRenderer::renderTile( Tile* tile, int data )
|
||||
{
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
|
||||
t.color(0xff, 0xff, 0xff); // i disabled this, this is normally enabled in normal mcpe see if this fits OPTION_NORMAL_LIGHTING - shredder
|
||||
int shape = tile->getRenderShape();
|
||||
|
||||
@@ -2324,7 +2383,7 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
||||
t.normal(0.0f, 1.0f, 0.0f);
|
||||
|
||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1, data));
|
||||
|
||||
|
||||
t.normal(0.0f, 0.0f, -1.0f);
|
||||
|
||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2, data));
|
||||
@@ -2403,110 +2462,110 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
||||
t.addOffset(s, 0, 0);
|
||||
t.draw();
|
||||
t.offset(0, 0, 0);//0.5f, 0.5f, 0.5f);
|
||||
} else if (shape == Tile::SHAPE_ROWS) {
|
||||
t.begin();
|
||||
t.normal(0, -1, 0);
|
||||
tesselateRowTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||
} else if (shape == Tile::SHAPE_ROWS) {
|
||||
t.begin();
|
||||
t.normal(0, -1, 0);
|
||||
tesselateRowTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||
//} else if (shape == Tile::SHAPE_TORCH) {
|
||||
//// t.begin();
|
||||
//// t.normal(0, -1, 0);
|
||||
/// tesselateTorch(tile, -0.5f, -0.5f, -0.5f, 0, 0);
|
||||
//// t.end();
|
||||
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
||||
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
||||
//glEnable(GL_RESCALE_NORMAL);
|
||||
} else if (shape == Tile::SHAPE_STAIRS) {
|
||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||
t.begin();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f);
|
||||
if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1);
|
||||
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
||||
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
||||
//glEnable(GL_RESCALE_NORMAL);
|
||||
} else if (shape == Tile::SHAPE_STAIRS) {
|
||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||
t.begin();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f);
|
||||
if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1);
|
||||
|
||||
|
||||
t.normal(0.0f, -1.0f, 0.0f);
|
||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||
t.normal(0.0f, -1.0f, 0.0f);
|
||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||
|
||||
t.normal(0.0f, 1.0f, 0.0f);
|
||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||
t.normal(0.0f, 1.0f, 0.0f);
|
||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||
|
||||
t.normal(0.0f, 0.0f, -1.0f);
|
||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||
t.normal(0.0f, 0.0f, -1.0f);
|
||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||
|
||||
t.normal(0.0f, 0.0f, 1.0f);
|
||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||
t.normal(0.0f, 0.0f, 1.0f);
|
||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||
|
||||
t.normal(-1.0f, 0.0f, 0.0f);
|
||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||
t.normal(-1.0f, 0.0f, 0.0f);
|
||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||
|
||||
t.normal(1.0f, 0.0f, 0.0f);
|
||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||
}
|
||||
t.draw();
|
||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||
t.normal(1.0f, 0.0f, 0.0f);
|
||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||
}
|
||||
else if (shape == Tile::SHAPE_FENCE) {
|
||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||
t.begin();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float w = 2 / 16.0f;
|
||||
if (i == 0) tile->setShape(0.5f - w, 0, 0, 0.5f + w, 1, w * 2);
|
||||
if (i == 1) tile->setShape(0.5f - w, 0, 1 - w * 2, 0.5f + w, 1, 1);
|
||||
w = 1 / 16.0f;
|
||||
if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2);
|
||||
if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2);
|
||||
t.draw();
|
||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||
}
|
||||
else if (shape == Tile::SHAPE_FENCE) {
|
||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||
t.begin();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float w = 2 / 16.0f;
|
||||
if (i == 0) tile->setShape(0.5f - w, 0, 0, 0.5f + w, 1, w * 2);
|
||||
if (i == 1) tile->setShape(0.5f - w, 0, 1 - w * 2, 0.5f + w, 1, 1);
|
||||
w = 1 / 16.0f;
|
||||
if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2);
|
||||
if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2);
|
||||
|
||||
t.normal(0.0f, -1.0f, 0.0f);
|
||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||
t.normal(0.0f, -1.0f, 0.0f);
|
||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||
|
||||
t.normal(0.0f, 1.0f, 0.0f);
|
||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||
t.normal(0.0f, 1.0f, 0.0f);
|
||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||
|
||||
t.normal(0.0f, 0.0f, -1.0f);
|
||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||
t.normal(0.0f, 0.0f, -1.0f);
|
||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||
|
||||
t.normal(0.0f, 0.0f, 1.0f);
|
||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||
t.normal(0.0f, 0.0f, 1.0f);
|
||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||
|
||||
t.normal(-1.0f, 0.0f, 0.0f);
|
||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||
t.normal(-1.0f, 0.0f, 0.0f);
|
||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||
|
||||
t.normal(1.0f, 0.0f, 0.0f);
|
||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||
}
|
||||
t.draw();
|
||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||
tile->setShape(0, 0, 0, 1, 1, 1);
|
||||
} else if (shape == Tile::SHAPE_FENCE_GATE) {
|
||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||
t.begin();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float w = 1 / 16.0f;
|
||||
if (i == 0) tile->setShape(0.5f - w, .3f, 0, 0.5f + w, 1, w * 2);
|
||||
if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1);
|
||||
if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2);
|
||||
|
||||
t.normal(0.0f, -1.0f, 0.0f);
|
||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||
|
||||
t.normal(0.0f, 1.0f, 0.0f);
|
||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||
|
||||
t.normal(0.0f, 0.0f, -1.0f);
|
||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||
|
||||
t.normal(0.0f, 0.0f, 1.0f);
|
||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||
|
||||
t.normal(-1.0f, 0.0f, 0.0f);
|
||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||
|
||||
t.normal(1.0f, 0.0f, 0.0f);
|
||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||
}
|
||||
t.draw();
|
||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||
tile->setShape(0, 0, 0, 1, 1, 1);
|
||||
t.normal(1.0f, 0.0f, 0.0f);
|
||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||
}
|
||||
t.draw();
|
||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||
tile->setShape(0, 0, 0, 1, 1, 1);
|
||||
} else if (shape == Tile::SHAPE_FENCE_GATE) {
|
||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||
t.begin();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float w = 1 / 16.0f;
|
||||
if (i == 0) tile->setShape(0.5f - w, .3f, 0, 0.5f + w, 1, w * 2);
|
||||
if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1);
|
||||
if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2);
|
||||
|
||||
t.normal(0.0f, -1.0f, 0.0f);
|
||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||
|
||||
t.normal(0.0f, 1.0f, 0.0f);
|
||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||
|
||||
t.normal(0.0f, 0.0f, -1.0f);
|
||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||
|
||||
t.normal(0.0f, 0.0f, 1.0f);
|
||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||
|
||||
t.normal(-1.0f, 0.0f, 0.0f);
|
||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||
|
||||
t.normal(1.0f, 0.0f, 0.0f);
|
||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||
}
|
||||
t.draw();
|
||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||
tile->setShape(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user