From dadda4bdc9894a99061eb94f8ef84b12fb2d03bc Mon Sep 17 00:00:00 2001 From: Leonardo Date: Sat, 18 Sep 2021 17:32:34 +0200 Subject: [PATCH] Disabled the culling until it's fixed --- .../seibel/lod/builders/lodTemplates/Box.java | 30 +++++++++---------- .../lodTemplates/CubicLodTemplate.java | 4 +-- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/seibel/lod/builders/lodTemplates/Box.java b/src/main/java/com/seibel/lod/builders/lodTemplates/Box.java index a42435b10..dccf512b7 100644 --- a/src/main/java/com/seibel/lod/builders/lodTemplates/Box.java +++ b/src/main/java/com/seibel/lod/builders/lodTemplates/Box.java @@ -101,13 +101,11 @@ public class Box public int color; public Map adjHeightAndDepth; public Map culling; - public long[] order; - public Box() { box = new int[2][3]; - order = new long[32]; + //order = new long[32]; colorMap = new HashMap() {{ put(Direction.UP, new int[1]); @@ -165,11 +163,6 @@ public class Box } } - for (int i = 0; i < order.length; i++) - { - order[i] = 0; - } - for (Direction direction : DIRECTIONS) { colorMap.get(direction)[0] = 0; @@ -190,16 +183,20 @@ public class Box public void setUpCulling(int cullingDistance) { - BlockPos playerPos = MinecraftWrapper.INSTANCE.getPlayer().blockPosition(); + Vector3d playerPos = MinecraftWrapper.INSTANCE.getPlayer().position(); for (Direction direction : DIRECTIONS) { if(direction == Direction.DOWN) culling.get(direction)[0] = playerPos.get(direction.getAxis()) > getFacePos(direction) + cullingDistance; else if(direction == Direction.UP) culling.get(direction)[0] = playerPos.get(direction.getAxis()) < getFacePos(direction) - cullingDistance; - else if(direction == Direction.WEST || direction == Direction.NORTH) + else if(direction == Direction.WEST) culling.get(direction)[0] = -playerPos.get(direction.getAxis()) > getFacePos(direction) + cullingDistance; - else if(direction == Direction.WEST || direction == Direction.NORTH) + else if(direction == Direction.NORTH) + culling.get(direction)[0] = -playerPos.get(direction.getAxis()) > getFacePos(direction) + cullingDistance; + else if(direction == Direction.EAST) + culling.get(direction)[0] = -playerPos.get(direction.getAxis()) < getFacePos(direction) - cullingDistance; + else if(direction == Direction.SOUTH) culling.get(direction)[0] = -playerPos.get(direction.getAxis()) < getFacePos(direction) - cullingDistance; } } @@ -217,9 +214,9 @@ public class Box int maxY = getMaxY(); for (Direction direction : ADJ_DIRECTIONS) { - /*if(isCulled(direction)){ - continue; - }*/ + //if(isCulled(direction)){ + // continue; + //} long[] dataPoint = adjData.get(direction); if (dataPoint == null || DataPointUtil.isItVoid(dataPoint[0])) @@ -233,6 +230,7 @@ public class Box //We order the adj list /**TODO remove this if the order is maintained naturally*/ + /* order[0] = 0; for (int i = 0; i < dataPoint.length; i++) { @@ -242,7 +240,7 @@ public class Box j = j - 1; } order[j + 1] = dataPoint[i]; - } + }*/ int i; int faceToDraw = 0; @@ -250,7 +248,7 @@ public class Box boolean toFinish = false; for (i = dataPoint.length - 1; i >= 0; i--) { - long singleDataPoint = order[i]; + long singleDataPoint = dataPoint[i]; height = DataPointUtil.getHeight(singleDataPoint); depth = DataPointUtil.getDepth(singleDataPoint); diff --git a/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java b/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java index 387c903d3..f12173b92 100644 --- a/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java +++ b/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java @@ -108,8 +108,8 @@ public class CubicLodTemplate extends AbstractLodTemplate { for(Direction direction : Box.DIRECTIONS) { - if(box.isCulled(direction)) - continue; + //if(box.isCulled(direction)) + // continue; int adjIndex = 0; while(box.shouldContinue(direction, adjIndex)) {