detect snow etc on connected lods; better comments to enable transparency

This commit is contained in:
cola98765
2021-12-25 12:25:48 +01:00
parent c658697ecd
commit 52ea2e96b7
4 changed files with 19 additions and 9 deletions
@@ -77,7 +77,7 @@ public class CubicLodTemplate
float x, float y, float z,
int color, byte skyLightValue, byte blockLightValue)
{
// TODO re-add transparency by replacing the color 255 with "ColorUtil.getAlpha(color)"
// TODO transparency re-add by replacing the color 255 with "ColorUtil.getAlpha(color)"
buffer.position(x, y, z)
.color(ColorUtil.getRed(color), ColorUtil.getGreen(color), ColorUtil.getBlue(color), 255)
.minecraftLightValue(skyLightValue).minecraftLightValue(blockLightValue)
@@ -296,15 +296,21 @@ public class LodBuilder
{
short depth = 0;
IBlockColorWrapper blockColorWrapper;
int colorOfBlock = 0;
if (strictEdge)
{
blockColorWrapper = chunk.getBlockColorWrapper(xAbs, yAbs, zAbs);
colorOfBlock = blockColorWrapper.getColor();
colorOfBlock = chunk.getBlockColorWrapper(xAbs, yAbs, zAbs).getColor();
IBlockShapeWrapper block = chunk.getBlockShapeWrapper(xAbs, yAbs + 1, zAbs);
if (block != null && ((this.config.client().worldGenerator().getBlocksToAvoid().nonFull && block.isNonFull())
|| (this.config.client().worldGenerator().getBlocksToAvoid().noCollision && block.hasNoCollision())))
{
int aboveColorInt = chunk.getBlockColorWrapper(xAbs, yAbs + 1, zAbs).getColor();
if (aboveColorInt != 0)
colorOfBlock = aboveColorInt;
}
}
for (int y = yAbs; y >= 0; y--)
for (int y = yAbs - 1; y >= 0; y--)
{
if (!isLayerValidLodPoint(chunk, xAbs, y, zAbs))
@@ -314,8 +320,7 @@ public class LodBuilder
}
if (strictEdge)
{
blockColorWrapper = chunk.getBlockColorWrapper(xAbs, y, zAbs);
if (colorOfBlock != blockColorWrapper.getColor())
if (colorOfBlock != chunk.getBlockColorWrapper(xAbs, y, zAbs).getColor())
{
depth = (short) (y + 1);
break;
@@ -352,13 +352,18 @@ public class VertexOptimizer
boolean toFinish = false;
int toFinishIndex = 0;
boolean allAbove = true;
// TODO transparency ocean floor fix
//boolean isOpaque = ((colorMap[0] >> 24) & 0xFF) == 255;
for (i = 0; i < dataPoint.length; i++)
{
singleAdjDataPoint = dataPoint[i];
if (DataPointUtil.isVoid(singleAdjDataPoint) || !DataPointUtil.doesItExist(singleAdjDataPoint))
break;
// TODO transparency ocean floor fix
//if (isOpaque && DataPointUtil.getAlpha(singleAdjDataPoint) != 255)
// continue;
height = DataPointUtil.getHeight(singleAdjDataPoint);
depth = DataPointUtil.getDepth(singleAdjDataPoint);
@@ -213,7 +213,7 @@ public class DataPointUtil
public static int getColor(long dataPoint)
{
// TODO re-add transparency by replacing the color 255 with what is in comment
return (int) (((dataPoint >>> COLOR_SHIFT) & COLOR_MASK) | /*((((dataPoint >>> ALPHA_SHIFT) & ALPHA_MASK) << ALPHA_DOWNSIZE_SHIFT) | 0b1111)*/ 255 << 24);
return (int) (((dataPoint >>> COLOR_SHIFT) & COLOR_MASK) | ((((dataPoint >>> ALPHA_SHIFT) & ALPHA_MASK) << ALPHA_DOWNSIZE_SHIFT) | 0b1111) << 24);
}
/** This is used to convert a dataPoint to string (useful for the print function) */