|
|
|
@@ -19,15 +19,15 @@ package com.seibel.lod.builders.lodTemplates;
|
|
|
|
|
|
|
|
|
|
import java.awt.Color;
|
|
|
|
|
|
|
|
|
|
import com.seibel.lod.enums.LodDetail;
|
|
|
|
|
import com.seibel.lod.enums.ShadingMode;
|
|
|
|
|
import com.seibel.lod.handlers.LodConfig;
|
|
|
|
|
import com.seibel.lod.objects.LevelPos;
|
|
|
|
|
import com.seibel.lod.objects.LodDataPoint;
|
|
|
|
|
import com.seibel.lod.objects.LodDimension;
|
|
|
|
|
import com.seibel.lod.util.LodUtil;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.client.renderer.BufferBuilder;
|
|
|
|
|
import net.minecraft.util.math.AxisAlignedBB;
|
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Builds LODs as rectangular prisms.
|
|
|
|
@@ -37,142 +37,263 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|
|
|
|
*/
|
|
|
|
|
public class CubicLodTemplate extends AbstractLodTemplate
|
|
|
|
|
{
|
|
|
|
|
public CubicLodTemplate()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public CubicLodTemplate()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addLodToBuffer(BufferBuilder buffer,
|
|
|
|
|
LodDimension lodDim, LodDataPoint lod,
|
|
|
|
|
double xOffset, double yOffset, double zOffset,
|
|
|
|
|
boolean debugging, byte detail)
|
|
|
|
|
{
|
|
|
|
|
AxisAlignedBB bbox;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add each LOD for the detail level
|
|
|
|
|
bbox = generateBoundingBox(
|
|
|
|
|
lod.height,
|
|
|
|
|
lod.depth,
|
|
|
|
|
(int) Math.pow(2, detail),
|
|
|
|
|
xOffset,
|
|
|
|
|
yOffset,
|
|
|
|
|
zOffset);
|
|
|
|
|
@Override
|
|
|
|
|
public void addLodToBuffer(BufferBuilder buffer, BlockPos playerBlockPos, LodDataPoint data, LodDataPoint[][] adjData,
|
|
|
|
|
LevelPos levelPos, boolean debugging)
|
|
|
|
|
{
|
|
|
|
|
AxisAlignedBB bbox;
|
|
|
|
|
|
|
|
|
|
Color color = lod.color;
|
|
|
|
|
if (LodConfig.CLIENT.debugMode.get())
|
|
|
|
|
{
|
|
|
|
|
color = LodUtil.DEBUG_DETAIL_LEVEL_COLORS[detail];
|
|
|
|
|
}
|
|
|
|
|
int width = (int) Math.pow(2, levelPos.detailLevel);
|
|
|
|
|
|
|
|
|
|
if (bbox != null)
|
|
|
|
|
{
|
|
|
|
|
addBoundingBoxToBuffer(buffer, bbox, color);
|
|
|
|
|
}
|
|
|
|
|
// add each LOD for the detail level
|
|
|
|
|
bbox = generateBoundingBox(
|
|
|
|
|
data.height,
|
|
|
|
|
data.depth,
|
|
|
|
|
width,
|
|
|
|
|
levelPos.posX * width,
|
|
|
|
|
0,
|
|
|
|
|
levelPos.posZ * width);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Color color = data.color;
|
|
|
|
|
if (LodConfig.CLIENT.debugMode.get())
|
|
|
|
|
{
|
|
|
|
|
color = LodUtil.DEBUG_DETAIL_LEVEL_COLORS[levelPos.detailLevel];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* @Override public void addLodToBuffer(BufferBuilder buffer,
|
|
|
|
|
* LodQuadTreeDimension lodDim, LodQuadTreeNode lod, double xOffset, double
|
|
|
|
|
* yOffset, double zOffset, boolean debugging) { AxisAlignedBB bbox;
|
|
|
|
|
*
|
|
|
|
|
* bbox = generateBoundingBox( lod.getLodDataPoint().height,
|
|
|
|
|
* lod.getLodDataPoint().depth, lod.width, xOffset, yOffset, zOffset);
|
|
|
|
|
*
|
|
|
|
|
* Color color = lod.getLodDataPoint().color;
|
|
|
|
|
*
|
|
|
|
|
* if (bbox != null) { addBoundingBoxToBuffer(buffer, bbox, color); }
|
|
|
|
|
*
|
|
|
|
|
* }
|
|
|
|
|
*/
|
|
|
|
|
if (bbox != null)
|
|
|
|
|
{
|
|
|
|
|
addBoundingBoxToBuffer(buffer, bbox, color, playerBlockPos, adjData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private AxisAlignedBB generateBoundingBox(int height, int depth, int width, double xOffset, double yOffset, double zOffset)
|
|
|
|
|
{
|
|
|
|
|
// don't add an LOD if it is empty
|
|
|
|
|
if (height == -1 && depth == -1)
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (depth == height)
|
|
|
|
|
{
|
|
|
|
|
// if the top and bottom points are at the same height
|
|
|
|
|
// render this LOD as 1 block thick
|
|
|
|
|
height++;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* @Override public void addLodToBuffer(BufferBuilder buffer,
|
|
|
|
|
* LodQuadTreeDimension lodDim, LodQuadTreeNode lod, double xOffset, double
|
|
|
|
|
* yOffset, double zOffset, boolean debugging) { AxisAlignedBB bbox;
|
|
|
|
|
*
|
|
|
|
|
* bbox = generateBoundingBox( lod.getLodDataPoint().height,
|
|
|
|
|
* lod.getLodDataPoint().depth, lod.width, xOffset, yOffset, zOffset);
|
|
|
|
|
*
|
|
|
|
|
* Color color = lod.getLodDataPoint().color;
|
|
|
|
|
*
|
|
|
|
|
* if (bbox != null) { addBoundingBoxToBuffer(buffer, bbox, color); }
|
|
|
|
|
*
|
|
|
|
|
* }
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
return new AxisAlignedBB(0, depth, 0, width, height, width).move(xOffset, yOffset, zOffset);
|
|
|
|
|
}
|
|
|
|
|
private AxisAlignedBB generateBoundingBox(int height, int depth, int width, double xOffset, double yOffset, double zOffset)
|
|
|
|
|
{
|
|
|
|
|
// don't add an LOD if it is empty
|
|
|
|
|
if (height == -1 && depth == -1)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
private void addBoundingBoxToBuffer(BufferBuilder buffer, AxisAlignedBB bb, Color c)
|
|
|
|
|
{
|
|
|
|
|
Color topColor = c;
|
|
|
|
|
Color northSouthColor = c;
|
|
|
|
|
Color eastWestColor = c;
|
|
|
|
|
Color bottomColor = c;
|
|
|
|
|
if (depth == height)
|
|
|
|
|
{
|
|
|
|
|
// if the top and bottom points are at the same height
|
|
|
|
|
// render this LOD as 1 block thick
|
|
|
|
|
height++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// darken the bottom and side colors if requested
|
|
|
|
|
if (LodConfig.CLIENT.shadingMode.get() == ShadingMode.DARKEN_SIDES)
|
|
|
|
|
{
|
|
|
|
|
// the side colors are different because
|
|
|
|
|
// when using fast lighting in Minecraft the north/south
|
|
|
|
|
// and east/west sides are different in a similar way
|
|
|
|
|
int northSouthDarkenAmount = 25;
|
|
|
|
|
int eastWestDarkenAmount = 50;
|
|
|
|
|
int bottomDarkenAmount = 75;
|
|
|
|
|
return new AxisAlignedBB(0, depth, 0, width, height, width).move(xOffset, yOffset, zOffset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
northSouthColor = new Color(Math.max(0, c.getRed() - northSouthDarkenAmount), Math.max(0, c.getGreen() - northSouthDarkenAmount), Math.max(0, c.getBlue() - northSouthDarkenAmount), c.getAlpha());
|
|
|
|
|
eastWestColor = new Color(Math.max(0, c.getRed() - eastWestDarkenAmount), Math.max(0, c.getGreen() - eastWestDarkenAmount), Math.max(0, c.getBlue() - eastWestDarkenAmount), c.getAlpha());
|
|
|
|
|
bottomColor = new Color(Math.max(0, c.getRed() - bottomDarkenAmount), Math.max(0, c.getGreen() - bottomDarkenAmount), Math.max(0, c.getBlue() - bottomDarkenAmount), c.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
private void addBoundingBoxToBuffer(BufferBuilder buffer, AxisAlignedBB bb, Color c, BlockPos playerBlockPos, LodDataPoint[][] adjData)
|
|
|
|
|
{
|
|
|
|
|
Color topColor = c;
|
|
|
|
|
Color northSouthColor = c;
|
|
|
|
|
Color eastWestColor = c;
|
|
|
|
|
Color bottomColor = c;
|
|
|
|
|
|
|
|
|
|
// apply the user specified saturation and brightness
|
|
|
|
|
float saturationMultiplier = LodConfig.CLIENT.saturationMultiplier.get().floatValue();
|
|
|
|
|
float brightnessMultiplier = LodConfig.CLIENT.brightnessMultiplier.get().floatValue();
|
|
|
|
|
// darken the bottom and side colors if requested
|
|
|
|
|
if (LodConfig.CLIENT.shadingMode.get() == ShadingMode.DARKEN_SIDES)
|
|
|
|
|
{
|
|
|
|
|
// the side colors are different because
|
|
|
|
|
// when using fast lighting in Minecraft the north/south
|
|
|
|
|
// and east/west sides are different in a similar way
|
|
|
|
|
int northSouthDarkenAmount = 25;
|
|
|
|
|
int eastWestDarkenAmount = 50;
|
|
|
|
|
int bottomDarkenAmount = 75;
|
|
|
|
|
|
|
|
|
|
topColor = applySaturationAndBrightnessMultipliers(topColor, saturationMultiplier, brightnessMultiplier);
|
|
|
|
|
northSouthColor = applySaturationAndBrightnessMultipliers(northSouthColor, saturationMultiplier, brightnessMultiplier);
|
|
|
|
|
bottomColor = applySaturationAndBrightnessMultipliers(bottomColor, saturationMultiplier, brightnessMultiplier);
|
|
|
|
|
northSouthColor = new Color(Math.max(0, c.getRed() - northSouthDarkenAmount), Math.max(0, c.getGreen() - northSouthDarkenAmount), Math.max(0, c.getBlue() - northSouthDarkenAmount), c.getAlpha());
|
|
|
|
|
eastWestColor = new Color(Math.max(0, c.getRed() - eastWestDarkenAmount), Math.max(0, c.getGreen() - eastWestDarkenAmount), Math.max(0, c.getBlue() - eastWestDarkenAmount), c.getAlpha());
|
|
|
|
|
bottomColor = new Color(Math.max(0, c.getRed() - bottomDarkenAmount), Math.max(0, c.getGreen() - bottomDarkenAmount), Math.max(0, c.getBlue() - bottomDarkenAmount), c.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// top (facing up)
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
// bottom (facing down)
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
// apply the user specified saturation and brightness
|
|
|
|
|
float saturationMultiplier = LodConfig.CLIENT.saturationMultiplier.get().floatValue();
|
|
|
|
|
float brightnessMultiplier = LodConfig.CLIENT.brightnessMultiplier.get().floatValue();
|
|
|
|
|
|
|
|
|
|
// south (facing -Z)
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
// north (facing +Z)
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
topColor = applySaturationAndBrightnessMultipliers(topColor, saturationMultiplier, brightnessMultiplier);
|
|
|
|
|
northSouthColor = applySaturationAndBrightnessMultipliers(northSouthColor, saturationMultiplier, brightnessMultiplier);
|
|
|
|
|
bottomColor = applySaturationAndBrightnessMultipliers(bottomColor, saturationMultiplier, brightnessMultiplier);
|
|
|
|
|
int minY;
|
|
|
|
|
int maxY;
|
|
|
|
|
LodDataPoint data;
|
|
|
|
|
/**TODO make all of this more automatic if possible*/
|
|
|
|
|
if (playerBlockPos.getY() > bb.maxY)
|
|
|
|
|
{
|
|
|
|
|
// top (facing up)
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, topColor.getRed(), topColor.getGreen(), topColor.getBlue(), topColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
if (playerBlockPos.getY() < bb.minY)
|
|
|
|
|
{
|
|
|
|
|
// bottom (facing down)
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, bottomColor.getRed(), bottomColor.getGreen(), bottomColor.getBlue(), bottomColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// west (facing -X)
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
// east (facing +X)
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
if (playerBlockPos.getZ() > bb.minZ)
|
|
|
|
|
{
|
|
|
|
|
// south (facing -Z)
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getBufferMemoryForSingleNode(int detailLevel)
|
|
|
|
|
{
|
|
|
|
|
// (sidesOnACube * pointsInASquare * (positionPoints + colorPoints))) *
|
|
|
|
|
// howManyPointsPerLodChunk
|
|
|
|
|
return (6 * 4 * (3 + 4));
|
|
|
|
|
}
|
|
|
|
|
data = adjData[1][1];
|
|
|
|
|
if (data == null)
|
|
|
|
|
{
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
maxY = data.height;
|
|
|
|
|
if (maxY < bb.maxY)
|
|
|
|
|
{
|
|
|
|
|
minY = (int) Math.max(maxY, bb.minY);
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
minY = data.depth;
|
|
|
|
|
if (minY > bb.minY)
|
|
|
|
|
{
|
|
|
|
|
maxY = (int) Math.min(minY, bb.maxX);
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, maxY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (playerBlockPos.getZ() < bb.maxZ)
|
|
|
|
|
{
|
|
|
|
|
data = adjData[1][0];
|
|
|
|
|
// north (facing +Z)
|
|
|
|
|
if (data == null)
|
|
|
|
|
{
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
maxY = data.height;
|
|
|
|
|
if (maxY < bb.maxY)
|
|
|
|
|
{
|
|
|
|
|
minY = (int) Math.max(maxY, bb.minY);
|
|
|
|
|
addPosAndColor(buffer, bb.minX, minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
minY = data.depth;
|
|
|
|
|
if (minY > bb.minY)
|
|
|
|
|
{
|
|
|
|
|
maxY = (int) Math.min(minY, bb.maxX);
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, maxY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, northSouthColor.getRed(), northSouthColor.getGreen(), northSouthColor.getBlue(), northSouthColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (playerBlockPos.getX() < bb.maxX)
|
|
|
|
|
{
|
|
|
|
|
// west (facing -X)
|
|
|
|
|
data = adjData[0][0];
|
|
|
|
|
if (data == null)
|
|
|
|
|
{
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
maxY = data.height;
|
|
|
|
|
if (maxY < bb.maxY)
|
|
|
|
|
{
|
|
|
|
|
minY = (int) Math.max(maxY, bb.minY);
|
|
|
|
|
addPosAndColor(buffer, bb.minX, minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
minY = data.depth;
|
|
|
|
|
if (minY > bb.minY)
|
|
|
|
|
{
|
|
|
|
|
maxY = (int) Math.min(minY, bb.maxX);
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, bb.minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.minX, maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (playerBlockPos.getX() > bb.minX)
|
|
|
|
|
{
|
|
|
|
|
// east (facing +X)
|
|
|
|
|
data = adjData[0][1];
|
|
|
|
|
if (data == null)
|
|
|
|
|
{
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
maxY = data.height;
|
|
|
|
|
if (maxY < bb.maxY)
|
|
|
|
|
{
|
|
|
|
|
minY = (int) Math.max(maxY, bb.minY);
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
minY = data.depth;
|
|
|
|
|
if (minY > bb.minY)
|
|
|
|
|
{
|
|
|
|
|
maxY = (int) Math.min(minY, bb.maxX);
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, maxY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, maxY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.maxZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
addPosAndColor(buffer, bb.maxX, bb.minY, bb.minZ, eastWestColor.getRed(), eastWestColor.getGreen(), eastWestColor.getBlue(), eastWestColor.getAlpha());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getBufferMemoryForSingleNode(int detailLevel)
|
|
|
|
|
{
|
|
|
|
|
// (sidesOnACube * pointsInASquare * (positionPoints + colorPoints))) *
|
|
|
|
|
// howManyPointsPerLodChunk
|
|
|
|
|
return (6 * 4 * (3 + 4));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|