diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java index ded0da39a..6d53e09ba 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/FullDataToRenderDataTransformer.java @@ -378,253 +378,4 @@ public class FullDataToRenderDataTransformer } - -// /** creates a vertical DataPoint */ -// private void writeVerticalData(long[] data, int dataOffset, int maxVerticalData, -// IChunkWrapper chunk, LodBuilderConfig config, int chunkSubPosX, int chunkSubPosZ) -// { -// -// int totalVerticalData = (chunk.getHeight()); -// long[] dataToMerge = new long[totalVerticalData]; -// -// boolean hasCeiling = MC.getWrappedClientWorld().getDimensionType().hasCeiling(); -// boolean hasSkyLight = MC.getWrappedClientWorld().getDimensionType().hasSkyLight(); -// byte generation = config.distanceGenerationMode.complexity; -// int count = 0; -// // FIXME: This yAbs is just messy! -// int x = chunk.getMinX() + chunkSubPosX; -// int z = chunk.getMinZ() + chunkSubPosZ; -// int y = chunk.getMaxY(x, z); -// -// boolean topBlock = true; -// if (y < chunk.getMinBuildHeight()) -// dataToMerge[0] = DataPointUtil.createVoidDataPoint(generation); -// int maxConnectedLods = Config.Client.Graphics.Quality.verticalQuality.get().maxVerticalData[0]; -// while (y >= chunk.getMinBuildHeight()) { -// int height = determineHeightPointFrom(chunk, config, x, y, z); -// // If the lod is at the default height, it must be void data -// if (height < chunk.getMinBuildHeight()) { -// if (topBlock) dataToMerge[0] = DataPointUtil.createVoidDataPoint(generation); -// break; -// } -// y = height - 1; -// // We search light on above air block -// int depth = determineBottomPointFrom(chunk, config, x, y, z, -// count < maxConnectedLods && (!hasCeiling || !topBlock)); -// if (hasCeiling && topBlock) -// y = depth; -// int light = getLightValue(chunk, x, y, z, hasCeiling, hasSkyLight, topBlock); -// int color = generateLodColor(chunk, config, x, y, z); -// int lightBlock = light & 0b1111; -// int lightSky = (light >> 4) & 0b1111; -// dataToMerge[count] = DataPointUtil.createDataPoint(height-chunk.getMinBuildHeight(), depth-chunk.getMinBuildHeight(), -// color, lightSky, lightBlock, generation); -// topBlock = false; -// y = depth - 1; -// count++; -// } -// long[] result = DataPointUtil.mergeMultiData(dataToMerge, totalVerticalData, maxVerticalData); -// if (result.length != maxVerticalData) throw new ArrayIndexOutOfBoundsException(); -// System.arraycopy(result, 0, data, dataOffset, maxVerticalData); -// } -// -// public static final EDhDirection[] DIRECTIONS = new EDhDirection[] { -// EDhDirection.UP, -// EDhDirection.DOWN, -// EDhDirection.WEST, -// EDhDirection.EAST, -// EDhDirection.NORTH, -// EDhDirection.SOUTH }; -// -// private boolean hasCliffFace(IChunkWrapper chunk, int x, int y, int z) { -// for (EDhDirection dir : DIRECTIONS) { -// IBlockDetailWrapper block = chunk.getBlockDetailAtFace(x, y, z, dir); -// if (block == null || !block.hasFaceCullingFor(EDhDirection.OPPOSITE_DIRECTIONS[dir.ordinal()])) -// return true; -// } -// return false; -// } -// -// /** -// * Find the lowest valid point from the bottom. -// * Used when creating a vertical LOD. -// */ -// private int determineBottomPointFrom(IChunkWrapper chunk, LodBuilderConfig builderConfig, int xAbs, int yAbs, int zAbs, boolean strictEdge) -// { -// int depth = chunk.getMinBuildHeight(); -// IBlockDetailWrapper currentBlockDetail = null; -// if (strictEdge) -// { -// IBlockDetailWrapper blockAbove = chunk.getBlockDetail(xAbs, yAbs + 1, zAbs); -// if (blockAbove != null && Config.Client.WorldGenerator.tintWithAvoidedBlocks.get() && !blockAbove.shouldRender(Config.Client.WorldGenerator.blocksToAvoid.get())) -// { // The above block is skipped. Lets use its skipped color for current block -// currentBlockDetail = blockAbove; -// } -// if (currentBlockDetail == null) currentBlockDetail = chunk.getBlockDetail(xAbs, yAbs, zAbs); -// } -// -// for (int y = yAbs - 1; y >= chunk.getMinBuildHeight(); y--) -// { -// IBlockDetailWrapper nextBlock = chunk.getBlockDetail(xAbs, y, zAbs); -// if (isLayerValidLodPoint(nextBlock)) { -// if (!strictEdge) continue; -// if (currentBlockDetail.equals(nextBlock)) continue; -// if (!hasCliffFace(chunk, xAbs, y, zAbs)) continue; -// } -// depth = (y + 1); -// break; -// } -// return depth; -// } -// -// /** Find the highest valid point from the Top */ -// private int determineHeightPointFrom(IChunkWrapper chunk, LodBuilderConfig config, int xAbs, int yAbs, int zAbs) -// { -// //TODO find a way to skip bottom of the world -// int height = chunk.getMinBuildHeight()-1; -// for (int y = yAbs; y >= chunk.getMinBuildHeight(); y--) -// { -// if (isLayerValidLodPoint(chunk, xAbs, y, zAbs)) -// { -// height = (y + 1); -// break; -// } -// } -// return height; -// } -// -// -// -// // =====================// -// // constructor helpers // -// // =====================// -// -// /** -// * Generate the color for the given chunk using biome water color, foliage -// * color, and grass color. -// */ -// private int generateLodColor(IChunkWrapper chunk, LodBuilderConfig builderConfig, int x, int y, int z) -// { -// int colorInt; -// if (builderConfig.useBiomeColors) -// { -// // I have no idea why I need to bit shift to the right, but -// // if I don't the biomes don't show up correctly. -// colorInt = chunk.getBiome(x, y, z).getColorForBiome(x, z); -// } -// else -// { -// // if we are skipping non-full and non-solid blocks that means we ignore -// // snow, flowers, etc. Get the above block so we can still get the color -// // of the snow, flower, etc. that may be above this block -// colorInt = 0; -// if (chunk.blockPosInsideChunk(x, y+1, z)) { -// IBlockDetailWrapper blockAbove = chunk.getBlockDetail(x, y+1, z); -// if (blockAbove != null && Config.Client.WorldGenerator.tintWithAvoidedBlocks.get() && !blockAbove.shouldRender(Config.Client.WorldGenerator.blocksToAvoid.get())) -// { // The above block is skipped. Lets use its skipped color for current block -// colorInt = blockAbove.getAndResolveFaceColor(null, chunk, new DHBlockPos(x, y+1, z)); -// } -// } -// -// // override this block's color if there was a block above this -// // and we were avoiding non-full/non-solid blocks -// if (colorInt == 0) { -// IBlockDetailWrapper detail = chunk.getBlockDetail(x, y, z); -// colorInt = detail.getAndResolveFaceColor(null, chunk, new DHBlockPos(x, y, z)); -// } -// } -// -// return colorInt; -// } -// -// /** Gets the light value for the given block position */ -// private int getLightValue(IChunkWrapper chunk, int x, int y, int z, boolean hasCeiling, boolean hasSkyLight, boolean topBlock) -// { -// int skyLight; -// int blockLight; -// -// int blockBrightness = chunk.getEmittedBrightness(x, y, z); -// // get the air block above or below this block -// if (hasCeiling && topBlock) -// y--; -// else -// y++; -// -// blockLight = chunk.getBlockLight(x, y, z); -// skyLight = hasSkyLight ? chunk.getSkyLight(x, y, z) : 0; -// -// if (blockLight == -1 || skyLight == -1) -// { -// -// ILevelWrapper world = MC.getWrappedServerWorld(); -// -// if (world != null) -// { -// // server world sky light (always accurate) -// blockLight = world.getBlockLight(x, y, z); -// -// if (topBlock && !hasCeiling && hasSkyLight) -// skyLight = DEFAULT_MAX_LIGHT; -// else -// skyLight = hasSkyLight ? world.getSkyLight(x, y, z) : 0; -// -// if (!topBlock && skyLight == 15) -// { -// // we are on predicted terrain, and we don't know what the light here is, -// // lets just take a guess -// skyLight = 12; -// } -// } -// else -// { -// world = MC.getWrappedClientWorld(); -// if (world == null) -// { -// blockLight = 0; -// skyLight = 12; -// } -// else -// { -// // client world sky light (almost never accurate) -// blockLight = world.getBlockLight(x, y, z); -// // estimate what the lighting should be -// if (hasSkyLight || !hasCeiling) -// { -// if (topBlock) -// skyLight = DEFAULT_MAX_LIGHT; -// else -// { -// if (hasSkyLight) -// skyLight = world.getSkyLight(x, y, z); -// //else -// // skyLight = 0; -// if (!chunk.isLightCorrect() && (skyLight == 0 || skyLight == 15)) -// { -// // we don't know what the light here is, -// // lets just take a guess -// skyLight = 12; -// } -// } -// } -// } -// } -// } -// -// blockLight = LodUtil.clamp(0, Math.max(blockLight, blockBrightness), DEFAULT_MAX_LIGHT); -// return blockLight + (skyLight << 4); -// } -// -// /** Is the block at the given blockPos a valid LOD point? */ -// private boolean isLayerValidLodPoint(IBlockDetailWrapper blockDetail) -// { -// EBlocksToAvoid avoid = Config.Client.WorldGenerator.blocksToAvoid.get(); -// return blockDetail != null && blockDetail.shouldRender(avoid); -// } -// -// /** Is the block at the given blockPos a valid LOD point? */ -// private boolean isLayerValidLodPoint(IChunkWrapper chunk, int x, int y, int z) { -// EBlocksToAvoid avoid = Config.Client.WorldGenerator.blocksToAvoid.get(); -// IBlockDetailWrapper block = chunk.getBlockDetail(x, y, z); -// return block != null && block.shouldRender(avoid); -// } }