Create the new LodRegion class that will replace the quadTrees

This commit is contained in:
Leonardo
2021-08-16 12:24:49 +02:00
parent 51078fde5b
commit 911205ce0a
@@ -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){
}
}