From 911205ce0a02e8be99c30379559cb61619640742 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 16 Aug 2021 12:24:49 +0200 Subject: [PATCH] Create the new LodRegion class that will replace the quadTrees --- .../com/seibel/lod/objects/LodRegion.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/java/com/seibel/lod/objects/LodRegion.java diff --git a/src/main/java/com/seibel/lod/objects/LodRegion.java b/src/main/java/com/seibel/lod/objects/LodRegion.java new file mode 100644 index 000000000..a8a412ca5 --- /dev/null +++ b/src/main/java/com/seibel/lod/objects/LodRegion.java @@ -0,0 +1,73 @@ +package com.seibel.lod.objects; + +import com.seibel.lod.util.LodUtil; + +public class LodRegion { + //x coord, + private byte levelOfDetail; + + private short size; + + private short width; + + private int numberOfPoints; + + //For each of the following field the first slot is for the level of detail + private byte[][][][] colors; + + private short[][][] height; + + private short[][][] depth; + + private byte[][][] generationType; + + public LodRegion(byte levelOfDetail){ + size = (short) Math.pow(2, LodUtil.REGION_DETAIL_LEVEL - levelOfDetail); + width = (short) Math.pow(2, levelOfDetail); + colors = new byte[size][size][size][3]; + height = new short[size][size][size]; + depth = new short[size][size]; + generationType = new byte[size][size]; + } + + public boolean addData(int posX, int posZ, byte red, byte green, byte blue, short height, short depth, byte generationType){ + if( (this.generationType[posX][posZ] == null) || (generationType < this.generationType[posX][posZ]) ) { + if (this.generationType[posX][posZ] == null) numberOfPoints++ ; + this.colors[posX][posZ][0] = red; + this.colors[posX][posZ][1] = green; + this.colors[posX][posZ][2] = blue; + this.height[posX][posZ] = height; + this.depth[posX][posZ] = depth; + this.generationType[posX][posZ] = generationType; + return true; //added + }else{ + return false; //not added + } + } + + public short[] getDataAtPos(int posX, int posZ, byte newLevelOfDetail){ + boolean fastConversion = true; + short[] data = new short[5]; //this array will contains all the data: red, green, blue, height, depth + if(fastConversion){ + + }else{ + + } + } + + public short[] cornerMean(short startX, short startZ, short endX, short endZ, byte newLevelOfDetail){ + short[] dataToCompute = new short[5][4]; //this array will contains all the data: red, green, blue, height, depth + if(){ + + } + } + + public short[] fullMean(short startX, short startZ, short endX, short endZ, byte newLevelOfDetail){ + short[] dataToCompute = new short[5][4]; //this array will contains all the data: red, green, blue, height, depth + + } + + public short[] combine(short startX, short startZ, short endX, short endZ, byte newLevelOfDetail){ + + } +}