Continue on the full data stuff
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -43,4 +45,9 @@ public class EmptyRenderSource implements LodRenderSource {
|
||||
public void saveRender(IClientLevel level, RenderMetaFile file, OutputStream dataStream) throws IOException {
|
||||
throw new UnsupportedOperationException("EmptyRenderSource should NEVER be saved!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DHChunkPos chunkPos, ChunkSizedData chunkData) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.a7.util.IOUtil;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -15,7 +17,7 @@ public interface LodDataSource {
|
||||
void setLocalVersion(int localVer);
|
||||
byte getDataVersion();
|
||||
|
||||
|
||||
void update(DHChunkPos chunkPos, ChunkSizedData data);
|
||||
|
||||
// Saving related
|
||||
void saveData(ILevel level, DataMetaFile file, OutputStream dataStream) throws IOException;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
@@ -7,6 +8,7 @@ import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.objects.DHRegionPos;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -43,4 +45,5 @@ public interface LodRenderSource {
|
||||
|
||||
void saveRender(IClientLevel level, RenderMetaFile file, OutputStream dataStream) throws IOException;
|
||||
|
||||
void update(DHChunkPos chunkPos, ChunkSizedData chunkData);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import com.seibel.lod.core.a7.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnQuadView;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.IColumnDatatype;
|
||||
import com.seibel.lod.core.a7.datatype.column.render.ColumnRenderBuffer;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.enums.ELodDirection;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.objects.LodDataView;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
@@ -308,4 +310,9 @@ public class ColumnRenderSource implements LodRenderSource, IColumnDatatype {
|
||||
writeData(dos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DHChunkPos chunkPos, ChunkSizedData chunkData) {
|
||||
//TODO Update render data directly
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockDetailWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
|
||||
public class DhChunk
|
||||
{
|
||||
public int CHUNK_BLOCK_SIZE = 16;
|
||||
public int CHUNK_BIOME_SIZE = 4;
|
||||
|
||||
public int blockVerticalSize;
|
||||
public int biomeVerticalSize;
|
||||
|
||||
|
||||
public IBlockDetailWrapper[] blockData;
|
||||
public IBiomeWrapper[] biomeData;
|
||||
|
||||
public int[] blockVerticalData;
|
||||
public int[] biomeVerticalData;
|
||||
|
||||
public int chunkPosX;
|
||||
public int chunkPosZ;
|
||||
public byte generationMode;
|
||||
|
||||
public DhChunk(byte generationMode, int chunkPosX, int chunkPosZ, int blockVerticalSize, int biomeVerticalSize)
|
||||
{
|
||||
this.blockVerticalSize = blockVerticalSize;
|
||||
this.biomeVerticalSize = biomeVerticalSize;
|
||||
this.chunkPosX = chunkPosX;
|
||||
this.chunkPosZ = chunkPosZ;
|
||||
this.generationMode = generationMode;
|
||||
|
||||
this.blockData = new IBlockDetailWrapper[CHUNK_BLOCK_SIZE * CHUNK_BLOCK_SIZE * blockVerticalSize];
|
||||
this.biomeData = new IBiomeWrapper[CHUNK_BLOCK_SIZE * CHUNK_BLOCK_SIZE * biomeVerticalSize];
|
||||
|
||||
this.blockVerticalData = new int[CHUNK_BIOME_SIZE * CHUNK_BIOME_SIZE * blockVerticalSize];
|
||||
this.biomeVerticalData = new int[CHUNK_BIOME_SIZE * CHUNK_BIOME_SIZE * biomeVerticalSize];
|
||||
}
|
||||
|
||||
public void addBlockData(IBlockDetailWrapper block, int verticalData, int relPosX, int relPosZ, int verticalIndex)
|
||||
{
|
||||
int index = CHUNK_BLOCK_SIZE * blockVerticalSize * relPosX + blockVerticalSize *relPosZ + verticalIndex;
|
||||
blockData[index] = block;
|
||||
blockVerticalData[index] = verticalData;
|
||||
}
|
||||
|
||||
public void addBiomeData(IBiomeWrapper biome, int verticalData, int relPosX, int relPosZ, int verticalIndex)
|
||||
{
|
||||
int index = CHUNK_BIOME_SIZE * biomeVerticalSize*relPosX + biomeVerticalSize*relPosZ + verticalIndex;
|
||||
biomeData[index] = biome;
|
||||
biomeVerticalData[index] = verticalData;
|
||||
}
|
||||
|
||||
public long[] getData()
|
||||
{
|
||||
long[] data = new long[3];
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,15 @@ package com.seibel.lod.core.a7.datatype.full;
|
||||
import com.seibel.lod.core.a7.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.FullArrayView;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.util.IdMappingUtil;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -45,8 +48,21 @@ public class FullDataSource extends FullArrayView implements LodDataSource { //
|
||||
return LATEST_VERSION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(DHChunkPos chunkPos, ChunkSizedData data) {
|
||||
if (getDataDetail() == 0) {
|
||||
DhBlockPos2D blockOffset = chunkPos.getMinBlockPos().subtract(sectionPos.getSectionBBoxPos().getCorner());
|
||||
data.shadowCopyTo(this.subView(16, blockOffset.x, blockOffset.z));
|
||||
} else {
|
||||
//TODO;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveData(ILevel level, DataMetaFile file, OutputStream dataStream) throws IOException {
|
||||
//TODO
|
||||
try (DataOutputStream dos = new DataOutputStream(dataStream)) {
|
||||
dos.writeInt(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.render.LodSection;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockDetailWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
|
||||
public class ProtoSection
|
||||
{
|
||||
public int CHUNK_BLOCK_SIZE = LodSection.SUB_REGION_DATA_WIDTH;
|
||||
/**TODO make biome resolution a costant somewhere*/
|
||||
public int CHUNK_BIOME_SIZE = LodSection.SUB_REGION_DATA_WIDTH/4;
|
||||
|
||||
public int blockVerticalSize;
|
||||
public int biomeVerticalSize;
|
||||
|
||||
|
||||
public IBlockDetailWrapper[] blockData;
|
||||
public IBiomeWrapper[] biomeData;
|
||||
|
||||
public int[] blockVerticalData;
|
||||
public int[] biomeVerticalData;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class FullArrayView implements IFullDataView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFullDataView subView(int size, int ox, int oz) {
|
||||
public FullArrayView subView(int size, int ox, int oz) {
|
||||
return new FullArrayView(this, size, ox, oz);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.seibel.lod.core.a7.save.io.render;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.RenderSourceLoader;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.a7.save.io.file.IDataSourceProvider;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -25,11 +23,6 @@ public class RenderFileHandler implements IRenderSourceProvider {
|
||||
this.renderCacheFolder = renderCacheFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<LodRenderSource> createRenderData(RenderSourceLoader renderSourceLoader, DhSectionPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addScannedFile(Collection<File> detectedFiles) {
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.seibel.lod.core.objects;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.util.LevelPosUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
@@ -81,6 +82,10 @@ public class DHChunkPos {
|
||||
return z << 4;
|
||||
}
|
||||
|
||||
public DhBlockPos2D getMinBlockPos() {
|
||||
return new DhBlockPos2D(x<<4, z<<4);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getRegionX()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user