various fix
This commit is contained in:
@@ -193,7 +193,10 @@ public class LodNodeData {
|
||||
short depth = (short) dataList.stream().mapToInt(x -> (int) x.depth).max().getAsInt();
|
||||
height = height;
|
||||
depth = depth;
|
||||
color = dataList.get(0).color;
|
||||
int red= dataList.stream().mapToInt(x -> x.color.getRed()).sum()/dataList.size();
|
||||
int green= dataList.stream().mapToInt(x -> x.color.getGreen()).sum()/dataList.size();
|
||||
int blue = dataList.stream().mapToInt(x -> x.color.getBlue()).sum()/dataList.size();
|
||||
color = new Color(red,green,blue);
|
||||
real = dataList.stream().filter(x -> x.real).count() == 4;
|
||||
voidNode = dataList.stream().filter(x -> !x.voidNode).count() == 0;
|
||||
}
|
||||
|
||||
@@ -308,19 +308,13 @@ public class LodQuadTree {
|
||||
int max = distances.stream().mapToInt(Integer::intValue).max().getAsInt();
|
||||
List<LodNodeData> nodeList = new ArrayList<>();
|
||||
if (min > maxDistance || max < minDistance || targetLevel > lodNodeData.level) {
|
||||
System.out.println("test1");
|
||||
System.out.println(lodNodeData);
|
||||
return nodeList;
|
||||
}
|
||||
if (targetLevel == lodNodeData.level || !isNodeFull()) {
|
||||
if (lodNodeData.voidNode) {
|
||||
System.out.println("test2");
|
||||
System.out.println(lodNodeData);
|
||||
nodeList.add(lodNodeData);
|
||||
return nodeList;
|
||||
} else {
|
||||
System.out.println("test3");
|
||||
System.out.println(lodNodeData);
|
||||
nodeList.add(lodNodeData);
|
||||
return nodeList;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,8 @@ public class QuadTreeImage extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
Collection<LodNodeData> lodList = lodQuadTree.getNodeToRender(playerX,playerZ,(byte) 0,10000,0);
|
||||
Collection<LodNodeData> lodList = lodQuadTree.getNodeToRender(playerX,playerZ,(byte) 2,10000,0);
|
||||
//lodList = lodQuadTree.getNodeList(false,false,true);
|
||||
System.out.println(lodList);
|
||||
final List<MyDrawable> myDrawables = new ArrayList<>();
|
||||
for(LodNodeData data : lodList) {
|
||||
@@ -123,7 +124,7 @@ public class QuadTreeImage extends JPanel {
|
||||
data.color, new BasicStroke(1)));
|
||||
}
|
||||
|
||||
myDrawables.add(new MyDrawable(new Rectangle2D.Double(playerX-10,playerZ-10, 20, 20),
|
||||
myDrawables.add(new MyDrawable(new Rectangle2D.Double(playerZ-10,playerX-10, 20, 20),
|
||||
Color.yellow, new BasicStroke(1)));
|
||||
final QuadTreeImage quadTreeImage = new QuadTreeImage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user