Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d5072ed475 | |||
| ffee2141d4 | |||
| 9f4b6b8709 | |||
| b05f074f4c | |||
| 06a549983b | |||
| 0b96ca8509 | |||
| edd50096d6 |
@@ -0,0 +1,13 @@
|
||||
package com.seibel.lod.core.objects.lod.quadtree;
|
||||
|
||||
import com.seibel.lod.core.util.DetailDistanceUtil;
|
||||
|
||||
public class LodQuadTree
|
||||
{
|
||||
public LodSection[][][] quadTreeStructure;
|
||||
public QuadTreeProperties properties;
|
||||
|
||||
public LodQuadTree()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.seibel.lod.core.objects.lod.quadtree;
|
||||
|
||||
|
||||
/**
|
||||
A lod section rappresent a distinct section in a precise level of the quadtree.
|
||||
The section holds all the lods information as color (computed with the blockBiome object referenced by the ID), size, light...
|
||||
The save and load of a section is handled by the section itself together with a handler class.
|
||||
*/
|
||||
public class LodSection
|
||||
{
|
||||
//level of detail of this section
|
||||
public final int detail;
|
||||
|
||||
//level position of this section
|
||||
public final int sectionPosX;
|
||||
public final int sectionPosZ;
|
||||
|
||||
//horizontal size of this section
|
||||
public final int horizontalSize;
|
||||
//vertical size of this section
|
||||
public final int verticalSize;
|
||||
|
||||
//how many id we save for each lod
|
||||
public final int idPerLod;
|
||||
|
||||
//What generation mode should be used for chunk in this section
|
||||
public final byte generationMode;
|
||||
|
||||
//if present in region file, use pregenerated chunk in lod creation
|
||||
public boolean usePregeneratedChunk;
|
||||
|
||||
//Position data hold information about each level position like generation mode used, number of vertical lods in that area...
|
||||
private byte[] positionData;
|
||||
|
||||
//Position data hold vertical information about each lod, like minY and maxY...
|
||||
private int[] verticalData;
|
||||
|
||||
//Lights data hold lights information about each lod, like skylight and block light values...
|
||||
private byte[] lightsData;
|
||||
|
||||
//BlockBiomeId hold a unique ID for each lod relative to a block-biome couple. This couple is capable of generating color
|
||||
//We could just reference
|
||||
private int[] BlockBiomeId;
|
||||
|
||||
//BlockBiomeFrequency for each lod BlockBiomeId
|
||||
private byte[] BlockBiomeFrequency;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param detail
|
||||
* @param horizontalSize
|
||||
* @param verticalSize
|
||||
* @param levelPosX
|
||||
* @param levelPosZ
|
||||
* @param generationMode
|
||||
* @param avoidPregeneratedChunk
|
||||
* @param idPerLod
|
||||
*/
|
||||
public LodSection(int detail, int horizontalSize, int verticalSize, int levelPosX, int levelPosZ, byte generationMode, boolean avoidPregeneratedChunk, int idPerLod)
|
||||
{
|
||||
this.detail = detail;
|
||||
this.sectionPosX = levelPosX;
|
||||
this.sectionPosZ = levelPosZ;
|
||||
this.horizontalSize = horizontalSize;
|
||||
this.verticalSize = verticalSize;
|
||||
this.generationMode = generationMode;
|
||||
this.usePregeneratedChunk = avoidPregeneratedChunk;
|
||||
this.idPerLod = idPerLod;
|
||||
//Now we should search if there is a file with this values
|
||||
//if so we load it and end the process
|
||||
|
||||
//Otherwise we initialize this section
|
||||
positionData = new byte[horizontalSize*horizontalSize];
|
||||
verticalData = new int[horizontalSize*horizontalSize*verticalSize];
|
||||
lightsData = new byte[horizontalSize*horizontalSize*verticalSize];
|
||||
BlockBiomeId = new int[horizontalSize*horizontalSize*verticalSize*idPerLod];
|
||||
BlockBiomeFrequency = new byte[horizontalSize*horizontalSize*verticalSize*idPerLod];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param otherSection
|
||||
* @param inputStartX
|
||||
* @param inputStartZ
|
||||
* @param inputEndX
|
||||
* @param inputEndZ
|
||||
* @param targetStartX
|
||||
* @param targetStartZ
|
||||
* @param targetEndX
|
||||
* @param targetEndZ
|
||||
*/
|
||||
public void mergeAndAdd(LodSection otherSection,
|
||||
int inputStartX, int inputStartZ, int inputEndX, int inputEndZ,
|
||||
int targetStartX, int targetStartZ, int targetEndX, int targetEndZ)
|
||||
{
|
||||
}
|
||||
|
||||
public short getPositionData(int posX, int posZ)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long[] getData(int posX, int posZ)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
}
|
||||
|
||||
public void tryload()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.seibel.lod.core.objects.lod.quadtree;
|
||||
|
||||
import com.seibel.lod.core.util.DetailDistanceUtil;
|
||||
|
||||
public class QuadTreeMover
|
||||
{
|
||||
public static void move(LodQuadTree lqt, RenderQuadTree rqt, int centerX, int centerZ)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.seibel.lod.core.objects.lod.quadtree;
|
||||
|
||||
import com.seibel.lod.core.util.DetailDistanceUtil;
|
||||
|
||||
public class QuadTreeProperties
|
||||
{
|
||||
public int MAX_NUMBER_OF_DETAIL=23;
|
||||
public int SECTION_SIZE=128;
|
||||
public int[] absoluteDetailCircleSize = new int[MAX_NUMBER_OF_DETAIL];
|
||||
public int[] relativeDetailCircleSize = new int[MAX_NUMBER_OF_DETAIL];
|
||||
public int[] generationModeOfDetail = new int[MAX_NUMBER_OF_DETAIL];
|
||||
|
||||
public LodQuadTree lodQuadTree;
|
||||
public RenderQuadTree renderQuadTree;
|
||||
|
||||
public void update()
|
||||
{
|
||||
for(int detail = 0; detail < MAX_NUMBER_OF_DETAIL; detail++)
|
||||
{
|
||||
//Compute circle distance for this detail in term of blocks
|
||||
absoluteDetailCircleSize[detail] = DetailDistanceUtil.getDrawDistanceFromDetail(detail);
|
||||
//Compute circle distance in terms of number of section
|
||||
relativeDetailCircleSize[detail] = (int) Math.ceil(absoluteDetailCircleSize[detail]/(SECTION_SIZE*2^detail));
|
||||
}
|
||||
updateGridSize();
|
||||
}
|
||||
|
||||
private void updateGridSize()
|
||||
{
|
||||
for(int detail = 0; detail < MAX_NUMBER_OF_DETAIL; detail++)
|
||||
{
|
||||
//Use this value to change to update the size of the matrices
|
||||
//relativeDetailCircleSize[detail];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.seibel.lod.core.objects.lod.quadtree;
|
||||
|
||||
import com.seibel.lod.core.util.DetailDistanceUtil;
|
||||
|
||||
public class RenderQuadTree
|
||||
{
|
||||
//public RenderSection[][][] quadTreeStructure;
|
||||
public QuadTreeProperties properties;
|
||||
|
||||
public RenderQuadTree()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user