fixed colors

This commit is contained in:
Leonardo
2021-09-17 23:37:16 +02:00
parent 68d279807f
commit 82cf25c341
3 changed files with 52 additions and 16 deletions
@@ -224,6 +224,13 @@ public class LodBufferBuilder
Callable<Boolean> dataToRenderThread = () ->
{
Map<Direction, long[]> adjData = new HashMap<>();
if(LodConfig.CLIENT.worldGenerator.lodQualityMode.get() == LodQualityMode.HEIGHTMAP){
adjData.put(Direction.WEST, new long[1]);
adjData.put(Direction.EAST, new long[1]);
adjData.put(Direction.SOUTH, new long[1]);
adjData.put(Direction.NORTH, new long[1]);
}
//previous setToRender chache
if (setsToRender[xR][zR] == null)
{
@@ -252,7 +259,6 @@ public class LodBufferBuilder
int chunkZdist;
short gameChunkRenderDistance = (short) (renderer.vanillaRenderedChunks.length / 2 - 1);
//long dataPoint;
Map<Direction, long[]> adjData = new HashMap<>();
for (int index = 0; index < posToRender.getNumberOfPos(); index++)
{
@@ -273,11 +279,12 @@ public class LodBufferBuilder
try
{
for (int direction = 0; direction < NUMBER_OF_DIRECTION; direction++)
for (Direction direction : Box.ADJ_DIRECTIONS)
{
xAdj = posX + ADJ_VECTOR[direction][0];
zAdj = posZ + ADJ_VECTOR[direction][1];
xAdj = posX + direction.getNormal().getX();
zAdj = posZ + direction.getNormal().getZ();
chunkXdist = LevelPosUtil.getChunkPos(detailLevel,xAdj) - playerChunkPos.x;
chunkZdist = LevelPosUtil.getChunkPos(detailLevel,zAdj) - playerChunkPos.z;
@@ -286,17 +293,39 @@ public class LodBufferBuilder
if (!renderer.vanillaRenderedChunks[chunkXdist + gameChunkRenderDistance + 1][chunkZdist + gameChunkRenderDistance + 1]
&& posToRender.contains(detailLevel, xAdj, zAdj))
{
adjData.put(Box.ADJ_DIRECTIONS[direction], lodDim.getData(detailLevel, xAdj, zAdj));
if(LodConfig.CLIENT.worldGenerator.lodQualityMode.get() == LodQualityMode.HEIGHTMAP){
adjData.get(direction)[0] = lodDim.getSingleData(detailLevel, xAdj, zAdj);
}else
{
adjData.put(direction, lodDim.getData(detailLevel, xAdj, zAdj));
}
}else{
adjData.put(Box.ADJ_DIRECTIONS[direction], null);
if(LodConfig.CLIENT.worldGenerator.lodQualityMode.get() == LodQualityMode.HEIGHTMAP){
adjData.get(direction)[0] = DataPointUtil.createVoidDataPoint(0);
}else
{
adjData.put(direction, null);
}
}
} else
{
if (posToRender.contains(detailLevel, xAdj, zAdj))
{
adjData.put(Box.ADJ_DIRECTIONS[direction], lodDim.getData(detailLevel, xAdj, zAdj));
if(LodConfig.CLIENT.worldGenerator.lodQualityMode.get() == LodQualityMode.HEIGHTMAP){
adjData.get(direction)[0] = lodDim.getSingleData(detailLevel, xAdj, zAdj);
}else
{
adjData.put(direction, lodDim.getData(detailLevel, xAdj, zAdj));
}
}else{
adjData.put(Box.ADJ_DIRECTIONS[direction], null);
if(LodConfig.CLIENT.worldGenerator.lodQualityMode.get() == LodQualityMode.HEIGHTMAP){
adjData.get(direction)[0] = DataPointUtil.createVoidDataPoint(0);
}else
{
adjData.put(direction, null);
}
}
}
}
@@ -1,6 +1,7 @@
package com.seibel.lod.builders.lodTemplates;
import com.seibel.lod.config.LodConfig;
import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.enums.ShadingMode;
import com.seibel.lod.util.ColorUtil;
import com.seibel.lod.util.DataPointUtil;
@@ -32,10 +33,10 @@ public class Box
Direction.SOUTH};
public static final Direction[] ADJ_DIRECTIONS = new Direction[]{
Direction.WEST,
Direction.EAST,
Direction.NORTH,
Direction.SOUTH};
Direction.WEST,
Direction.SOUTH,
Direction.NORTH};
public static final Map<Direction, int[][]> DIRECTION_VERTEX_MAP = new HashMap()
{{
@@ -118,7 +119,7 @@ public class Box
public int getColor(Direction direction)
{
if (LodConfig.CLIENT.graphics.shadingMode.get() == ShadingMode.DARKEN_SIDES)
if (LodConfig.CLIENT.debugging.debugMode.get() != DebugMode.SHOW_DETAIL)
{
return colorMap.get(direction)[0];
} else
@@ -151,6 +152,11 @@ public class Box
boolean toFinish = false;
for (i = 0; i < dataPoint.length; i++)
{
if (DataPointUtil.isItVoid(dataPoint[i]))
{
continue;
}
height = DataPointUtil.getHeight(dataPoint[i]);
depth = DataPointUtil.getDepth(dataPoint[i]);
@@ -49,6 +49,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
{
int width = 1 << detailLevel;
int color = DataPointUtil.getLightColor(data,lightMap);
// add each LOD for the detail level
generateBoundingBox(
box,
@@ -59,9 +60,8 @@ public class CubicLodTemplate extends AbstractLodTemplate
0,
posZ * width,
bufferCenterBlockPos,
adjData);
int color;
color = DataPointUtil.getLightColor(data,lightMap);
adjData,
color);
//color = DataPointUtil.getColor(data);
@@ -80,7 +80,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
}
private void generateBoundingBox(Box box, int height, int depth, int width, double xOffset, double yOffset, double zOffset, BlockPos bufferCenterBlockPos, Map<Direction, long[]> adjData)
private void generateBoundingBox(Box box, int height, int depth, int width, double xOffset, double yOffset, double zOffset, BlockPos bufferCenterBlockPos, Map<Direction, long[]> adjData, int color)
{
// don't add an LOD if it is empty
if (height == -1 && depth == -1)
@@ -99,6 +99,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
double x = -bufferCenterBlockPos.getX();
double z = -bufferCenterBlockPos.getZ();
box.setAdjData(adjData);
box.setColor(color);
box.set(width, height - depth, width);
box.move((int) (xOffset + x), (int) (yOffset + depth), (int) (zOffset + z));
}