chunk data storage dimension change
This commit is contained in:
parent
1b5d6c1795
commit
4f2fcc62c9
@ -988,6 +988,9 @@ Two layer destruction optimization
|
||||
Non-reallocating list iteration for children in draw cell manager optimization
|
||||
Split leaf/nonleaf tracks for node evaluation optimization
|
||||
|
||||
(11/11/2024)
|
||||
Chunk data now stored/transmitted in 17 dim instead of 16 dim (Thereby cutting down on network/storage cost)
|
||||
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
@ -310,9 +310,9 @@ public class FluidCellManager {
|
||||
private void queueNewCells(){
|
||||
if(Globals.playerEntity != null && Globals.clientWorldData != null){
|
||||
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
|
||||
for(int x = -(int)drawRadius; x < drawRadius; x = x + ChunkData.CHUNK_SIZE){
|
||||
for(int y = -(int)drawRadius; y < drawRadius; y = y + ChunkData.CHUNK_SIZE){
|
||||
for(int z = -(int)drawRadius; z < drawRadius; z = z + ChunkData.CHUNK_SIZE){
|
||||
for(int x = -(int)drawRadius; x < drawRadius; x = x + ChunkData.CHUNK_DATA_SIZE){
|
||||
for(int y = -(int)drawRadius; y < drawRadius; y = y + ChunkData.CHUNK_DATA_SIZE){
|
||||
for(int z = -(int)drawRadius; z < drawRadius; z = z + ChunkData.CHUNK_DATA_SIZE){
|
||||
Vector3d newPos = new Vector3d(playerPos.x + x, playerPos.y + y, playerPos.z + z);
|
||||
Vector3i worldPos = new Vector3i(
|
||||
Globals.clientWorldData.convertRealToChunkSpace(newPos.x),
|
||||
|
||||
@ -128,9 +128,9 @@ public class FoliageChunk {
|
||||
if(data == null){
|
||||
return false;
|
||||
}
|
||||
for(int x = 0; x < ChunkData.CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
List<String> foliageTypesSupported = Globals.gameConfigCurrent.getVoxelData().getTypeFromId(data.getType(new Vector3i(x,y,z))).getAmbientFoliage();
|
||||
if(foliageTypesSupported != null && foliageTypesSupported.size() > 0){
|
||||
return true;
|
||||
@ -167,9 +167,9 @@ public class FoliageChunk {
|
||||
//do creations
|
||||
container.getChildren().forEach(child -> {
|
||||
Vector3d realPos = new Vector3d(
|
||||
worldPos.x * ChunkData.CHUNK_SIZE + child.getMinBound().x,
|
||||
worldPos.y * ChunkData.CHUNK_SIZE + child.getMinBound().y,
|
||||
worldPos.z * ChunkData.CHUNK_SIZE + child.getMinBound().z
|
||||
worldPos.x * ChunkData.CHUNK_DATA_SIZE + child.getMinBound().x,
|
||||
worldPos.y * ChunkData.CHUNK_DATA_SIZE + child.getMinBound().y,
|
||||
worldPos.z * ChunkData.CHUNK_DATA_SIZE + child.getMinBound().z
|
||||
);
|
||||
child.convertToLeaf(new FoliageCell(worldPos, child.getMinBound(), realPos, 5 - child.getLevel()));
|
||||
});
|
||||
|
||||
@ -22,10 +22,10 @@ public class ChunkData {
|
||||
*/
|
||||
public static final int NOT_HOMOGENOUS = -1;
|
||||
|
||||
//The size of a chunk in virtual data
|
||||
public static final int CHUNK_SIZE = ServerTerrainChunk.CHUNK_DIMENSION;
|
||||
//The size of the data passed into marching cubes/transvoxel algorithm to get a fully connected and seamless chunk
|
||||
public static final int CHUNK_DATA_GENERATOR_SIZE = ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE;
|
||||
/**
|
||||
* The size of the chunk data stored on the client
|
||||
*/
|
||||
public static final int CHUNK_DATA_SIZE = ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE;
|
||||
|
||||
//What type of terrain is in this voxel, eg stone vs dirt vs grass, etc
|
||||
int[][][] voxelType;
|
||||
@ -93,9 +93,9 @@ public class ChunkData {
|
||||
public void setVoxelType(int[][][] voxelType){
|
||||
//mark changed cells
|
||||
if(this.voxelType != null){
|
||||
for(int x = 0; x < CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < CHUNK_DATA_SIZE; z++){
|
||||
if(voxelType[x][y][z] != this.voxelType[x][y][z]){
|
||||
String key = getVoxelPositionKey(new Vector3i(x,y,z));
|
||||
if(!modifiedSinceLastGeneration.contains(key)){
|
||||
@ -125,9 +125,9 @@ public class ChunkData {
|
||||
public void setVoxelWeight(float[][][] voxelWeight){
|
||||
//mark changed cells
|
||||
if(this.voxelWeight != null){
|
||||
for(int x = 0; x < CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < CHUNK_DATA_SIZE; z++){
|
||||
if(voxelWeight[x][y][z] != this.voxelWeight[x][y][z]){
|
||||
String key = getVoxelPositionKey(new Vector3i(x,y,z));
|
||||
if(!modifiedSinceLastGeneration.contains(key)){
|
||||
|
||||
@ -801,27 +801,21 @@ public class ClientDrawCellManager {
|
||||
DrawCell cell = node.getData();
|
||||
int lod = this.chunkTree.getMaxLevel() - node.getLevel();
|
||||
int spacingFactor = (int)Math.pow(2,lod);
|
||||
for(int i = 0; i < 2; i++){
|
||||
for(int j = 0; j < 2; j++){
|
||||
for(int k = 0; k < 2; k++){
|
||||
Vector3i posToCheck = new Vector3i(cell.getWorldPos()).add(i*spacingFactor,j*spacingFactor,k*spacingFactor);
|
||||
if(
|
||||
posToCheck.x >= 0 &&
|
||||
posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.y >= 0 &&
|
||||
posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.z >= 0 &&
|
||||
posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, lod)
|
||||
){
|
||||
//client should request chunk data from server for each chunk necessary to create the model
|
||||
LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + posToCheck);
|
||||
if(!Globals.clientTerrainManager.requestChunk(posToCheck.x, posToCheck.y, posToCheck.z, lod)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Vector3i worldPos = node.getMinBound();
|
||||
if(
|
||||
worldPos.x >= 0 &&
|
||||
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
worldPos.y >= 0 &&
|
||||
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
worldPos.z >= 0 &&
|
||||
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)
|
||||
){
|
||||
//client should request chunk data from server for each chunk necessary to create the model
|
||||
LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + worldPos);
|
||||
if(!Globals.clientTerrainManager.requestChunk(worldPos.x, worldPos.y, worldPos.z, lod)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int highResLod = this.chunkTree.getMaxLevel() - (node.getLevel() + 1);
|
||||
int highResSpacingFactor = (int)Math.pow(2,highResLod);
|
||||
@ -883,31 +877,17 @@ public class ClientDrawCellManager {
|
||||
DrawCell cell = node.getData();
|
||||
int lod = this.chunkTree.getMaxLevel() - node.getLevel();
|
||||
int spacingFactor = (int)Math.pow(2,lod);
|
||||
for(int i = 0; i < 2; i++){
|
||||
for(int j = 0; j < 2; j++){
|
||||
for(int k = 0; k < 2; k++){
|
||||
Vector3i posToCheck = new Vector3i(cell.getWorldPos()).add(i*spacingFactor,j*spacingFactor,k*spacingFactor);
|
||||
if(
|
||||
posToCheck.x >= 0 &&
|
||||
posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.y >= 0 &&
|
||||
posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.z >= 0 &&
|
||||
posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, lod)
|
||||
){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vector3i worldPos = cell.getWorldPos();
|
||||
if(!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)){
|
||||
return false;
|
||||
}
|
||||
int highResLod = this.chunkTree.getMaxLevel() - (node.getLevel() + 1);
|
||||
int highResSpacingFactor = (int)Math.pow(2,highResLod);
|
||||
if(highResFaces != null){
|
||||
for(DrawCellFace highResFace : highResFaces){
|
||||
//x & y are in face-space
|
||||
for(int x = 0; x < 3; x++){
|
||||
for(int y = 0; y < 3; y++){
|
||||
for(int x = 0; x < 2; x++){
|
||||
for(int y = 0; y < 2; y++){
|
||||
Vector3i posToCheck = null;
|
||||
//implicitly performing transforms to adapt from face-space to world space
|
||||
switch(highResFace){
|
||||
|
||||
@ -14,6 +14,7 @@ import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.types.terrain.TerrainChunk;
|
||||
import electrosphere.renderer.meshgen.TransvoxelModelGeneration;
|
||||
import electrosphere.renderer.meshgen.TransvoxelModelGeneration.TransvoxelChunkData;
|
||||
import electrosphere.server.terrain.manager.ServerTerrainChunk;
|
||||
import electrosphere.util.ds.octree.WorldOctTree.FloatingChunkTreeNode;
|
||||
import electrosphere.util.math.GeomUtils;
|
||||
|
||||
@ -47,8 +48,8 @@ public class DrawCell {
|
||||
Entity modelEntity;
|
||||
|
||||
//Allocated once instead of continuously, used to generate the visual/physics models
|
||||
float[][][] weights = new float[ChunkData.CHUNK_DATA_GENERATOR_SIZE][ChunkData.CHUNK_DATA_GENERATOR_SIZE][ChunkData.CHUNK_DATA_GENERATOR_SIZE];
|
||||
int[][][] types = new int[ChunkData.CHUNK_DATA_GENERATOR_SIZE][ChunkData.CHUNK_DATA_GENERATOR_SIZE][ChunkData.CHUNK_DATA_GENERATOR_SIZE];
|
||||
float[][][] weights = new float[ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE];
|
||||
int[][][] types = new int[ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE];
|
||||
|
||||
/**
|
||||
* Tracks whether the draw cell has requested its chunk data or not
|
||||
@ -81,11 +82,6 @@ public class DrawCell {
|
||||
*/
|
||||
int failedGenerationAttempts = 0;
|
||||
|
||||
/**
|
||||
* The number of valid fill lookups
|
||||
*/
|
||||
int validLookups = 0;
|
||||
|
||||
/**
|
||||
* Labels an invalid distance cache
|
||||
*/
|
||||
@ -145,7 +141,7 @@ public class DrawCell {
|
||||
}
|
||||
}
|
||||
modelEntity = TerrainChunk.clientCreateTerrainChunkEntity(chunkData, lod, atlas, this.hasPolygons());
|
||||
ClientEntityUtils.initiallyPositionEntity(modelEntity, getRealPos(), new Quaterniond());
|
||||
ClientEntityUtils.initiallyPositionEntity(modelEntity, this.getRealPos(), new Quaterniond());
|
||||
// this.weights = null;
|
||||
// this.types = null;
|
||||
this.setHasGenerated(true);
|
||||
@ -157,9 +153,9 @@ public class DrawCell {
|
||||
*/
|
||||
protected Vector3d getRealPos(){
|
||||
return new Vector3d(
|
||||
worldPos.x * ChunkData.CHUNK_SIZE,
|
||||
worldPos.y * ChunkData.CHUNK_SIZE,
|
||||
worldPos.z * ChunkData.CHUNK_SIZE
|
||||
worldPos.x * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET,
|
||||
worldPos.y * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET,
|
||||
worldPos.z * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET
|
||||
);
|
||||
}
|
||||
|
||||
@ -197,63 +193,33 @@ public class DrawCell {
|
||||
*/
|
||||
private boolean fillInData(int lod){
|
||||
// if(lod == ClientDrawCellManager.FULL_RES_LOD){
|
||||
ChunkData homogenousLookupChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
|
||||
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
|
||||
worldPos.x,
|
||||
worldPos.y,
|
||||
worldPos.z,
|
||||
lod
|
||||
);
|
||||
if(homogenousLookupChunk != null && homogenousLookupChunk.getHomogenousValue() != ChunkData.NOT_HOMOGENOUS){
|
||||
if(currentChunk == null){
|
||||
return false;
|
||||
}
|
||||
if(currentChunk.getHomogenousValue() != ChunkData.NOT_HOMOGENOUS){
|
||||
return true;
|
||||
}
|
||||
// }
|
||||
int spacingFactor = (int)Math.pow(2,lod);
|
||||
int i = 0;
|
||||
for(int x = i / ChunkData.CHUNK_DATA_GENERATOR_SIZE / ChunkData.CHUNK_DATA_GENERATOR_SIZE; x < ChunkData.CHUNK_DATA_GENERATOR_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_GENERATOR_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_GENERATOR_SIZE; z++){
|
||||
if(i < validLookups){
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint(
|
||||
worldPos.x + (x / ChunkData.CHUNK_SIZE) * spacingFactor,
|
||||
worldPos.y + (y / ChunkData.CHUNK_SIZE) * spacingFactor,
|
||||
worldPos.z + (z / ChunkData.CHUNK_SIZE) * spacingFactor,
|
||||
lod
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
weights[x][y][z] = currentChunk.getWeight(
|
||||
x,
|
||||
y,
|
||||
z
|
||||
);
|
||||
if(currentChunk == null){
|
||||
Vector3i posToCheck = new Vector3i(
|
||||
worldPos.x + (x / ChunkData.CHUNK_SIZE) * spacingFactor,
|
||||
worldPos.y + (y / ChunkData.CHUNK_SIZE) * spacingFactor,
|
||||
worldPos.z + (z / ChunkData.CHUNK_SIZE) * spacingFactor
|
||||
);
|
||||
if(
|
||||
posToCheck.x >= 0 &&
|
||||
posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.y >= 0 &&
|
||||
posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() &&
|
||||
posToCheck.z >= 0 &&
|
||||
posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize()
|
||||
){
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
weights[x][y][z] = currentChunk.getWeight(
|
||||
x % ChunkData.CHUNK_SIZE,
|
||||
y % ChunkData.CHUNK_SIZE,
|
||||
z % ChunkData.CHUNK_SIZE
|
||||
);
|
||||
types[x][y][z] = currentChunk.getType(
|
||||
x % ChunkData.CHUNK_SIZE,
|
||||
y % ChunkData.CHUNK_SIZE,
|
||||
z % ChunkData.CHUNK_SIZE
|
||||
);
|
||||
if(currentChunk.getHomogenousValue() == ChunkData.NOT_HOMOGENOUS){
|
||||
this.homogenous = false;
|
||||
}
|
||||
i++;
|
||||
validLookups++;
|
||||
types[x][y][z] = currentChunk.getType(
|
||||
x,
|
||||
y,
|
||||
z
|
||||
);
|
||||
if(currentChunk.getHomogenousValue() == ChunkData.NOT_HOMOGENOUS){
|
||||
this.homogenous = false;
|
||||
}
|
||||
|
||||
|
||||
@ -287,11 +253,11 @@ public class DrawCell {
|
||||
//allocate face array
|
||||
for(int x = 0; x < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; x++){
|
||||
for(int y = 0; y < TransvoxelModelGeneration.FACE_DATA_DIMENSIONS; y++){
|
||||
int worldCoordOffset1 = x / ChunkData.CHUNK_SIZE * higherResSpacing;
|
||||
int worldCoordOffset2 = y / ChunkData.CHUNK_SIZE * higherResSpacing;
|
||||
int worldCoordOffset1 = x / ChunkData.CHUNK_DATA_SIZE * higherResSpacing;
|
||||
int worldCoordOffset2 = y / ChunkData.CHUNK_DATA_SIZE * higherResSpacing;
|
||||
//solve coordinates relative to the face
|
||||
int localCoord1 = x % ChunkData.CHUNK_SIZE;
|
||||
int localCoord2 = y % ChunkData.CHUNK_SIZE;
|
||||
int localCoord1 = x % ChunkData.CHUNK_DATA_SIZE;
|
||||
int localCoord2 = y % ChunkData.CHUNK_DATA_SIZE;
|
||||
|
||||
//implicitly performing transforms to adapt from face-space to world & local space
|
||||
switch(higherLODFace){
|
||||
|
||||
@ -360,9 +360,9 @@ public class DrawCellManager {
|
||||
private void queueNewCells(){
|
||||
if(Globals.playerEntity != null && Globals.clientWorldData != null){
|
||||
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
|
||||
for(int x = -(int)drawFullModelRadius; x < drawFullModelRadius; x = x + ChunkData.CHUNK_SIZE){
|
||||
for(int y = -(int)drawFullModelRadius; y < drawFullModelRadius; y = y + ChunkData.CHUNK_SIZE){
|
||||
for(int z = -(int)drawFullModelRadius; z < drawFullModelRadius; z = z + ChunkData.CHUNK_SIZE){
|
||||
for(int x = -(int)drawFullModelRadius; x < drawFullModelRadius; x = x + ChunkData.CHUNK_DATA_SIZE){
|
||||
for(int y = -(int)drawFullModelRadius; y < drawFullModelRadius; y = y + ChunkData.CHUNK_DATA_SIZE){
|
||||
for(int z = -(int)drawFullModelRadius; z < drawFullModelRadius; z = z + ChunkData.CHUNK_DATA_SIZE){
|
||||
Vector3d newPos = new Vector3d(playerPos.x + x, playerPos.y + y, playerPos.z + z);
|
||||
Vector3i worldPos = new Vector3i(
|
||||
Globals.clientWorldData.convertRealToChunkSpace(newPos.x),
|
||||
|
||||
@ -94,22 +94,22 @@ public class ClientTerrainManager {
|
||||
for(TerrainMessage message : messageQueue){
|
||||
switch(message.getMessageSubtype()){
|
||||
case SENDCHUNKDATA: {
|
||||
int[][][] values = new int[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE];
|
||||
float[][][] weights = new float[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE];
|
||||
int[][][] values = new int[ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE];
|
||||
float[][][] weights = new float[ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE];
|
||||
ByteBuffer buffer = ByteBuffer.wrap(message.getchunkData());
|
||||
FloatBuffer floatBuffer = buffer.asFloatBuffer();
|
||||
for(int x = 0; x < ChunkData.CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
weights[x][y][z] = floatBuffer.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
IntBuffer intView = buffer.asIntBuffer();
|
||||
intView.position(floatBuffer.position());
|
||||
for(int x = 0; x < ChunkData.CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
values[x][y][z] = intView.get();
|
||||
}
|
||||
}
|
||||
@ -123,13 +123,13 @@ public class ClientTerrainManager {
|
||||
);
|
||||
} break;
|
||||
case SENDREDUCEDCHUNKDATA: {
|
||||
int[][][] values = new int[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE];
|
||||
float[][][] weights = new float[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE];
|
||||
int[][][] values = new int[ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE];
|
||||
float[][][] weights = new float[ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE][ChunkData.CHUNK_DATA_SIZE];
|
||||
ByteBuffer buffer = ByteBuffer.wrap(message.getchunkData());
|
||||
FloatBuffer floatBuffer = buffer.asFloatBuffer();
|
||||
for(int x = 0; x < ChunkData.CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
weights[x][y][z] = floatBuffer.get();
|
||||
}
|
||||
}
|
||||
@ -138,9 +138,9 @@ public class ClientTerrainManager {
|
||||
intView.position(floatBuffer.position());
|
||||
int firstType = -1;
|
||||
boolean homogenous = true;
|
||||
for(int x = 0; x < ChunkData.CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
values[x][y][z] = intView.get();
|
||||
if(firstType == -1){
|
||||
firstType = values[x][y][z];
|
||||
|
||||
@ -74,9 +74,9 @@ public class PhysicsDataCell {
|
||||
fillInData();
|
||||
|
||||
Vector3d realPos = new Vector3d(
|
||||
worldPos.x * ServerTerrainChunk.CHUNK_DIMENSION,
|
||||
worldPos.y * ServerTerrainChunk.CHUNK_DIMENSION,
|
||||
worldPos.z * ServerTerrainChunk.CHUNK_DIMENSION
|
||||
worldPos.x * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET,
|
||||
worldPos.y * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET,
|
||||
worldPos.z * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET
|
||||
);
|
||||
physicsEntity = TerrainChunk.serverCreateTerrainChunkEntity(realm, realPos, weights, types);
|
||||
physicsEntity.putData(EntityDataStrings.TERRAIN_IS_TERRAIN, true);
|
||||
@ -104,125 +104,125 @@ public class PhysicsDataCell {
|
||||
//
|
||||
//main chunk
|
||||
ServerTerrainChunk currentChunk = serverTerrainManager.getChunk(worldPos.x, worldPos.y, worldPos.z);
|
||||
for(int x = 0; x < ChunkData.CHUNK_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_SIZE; z++){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
weights[x][y][z] = currentChunk.getWeight(x,y,z);
|
||||
types[x][y][z] = currentChunk.getType(x,y,z);
|
||||
}
|
||||
}
|
||||
}
|
||||
//face X
|
||||
if(worldPos.x + 1 < realm.getServerWorldData().getWorldSizeDiscrete()){
|
||||
currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y, worldPos.z);
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
weights[ChunkData.CHUNK_SIZE][i][j] = currentChunk.getWeight(0, i, j);
|
||||
types[ChunkData.CHUNK_SIZE][i][j] = currentChunk.getType(0, i, j);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
weights[ChunkData.CHUNK_SIZE][i][j] = 0;
|
||||
types[ChunkData.CHUNK_SIZE][i][j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//face Y
|
||||
if(worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete()){
|
||||
currentChunk = serverTerrainManager.getChunk(worldPos.x, worldPos.y + 1, worldPos.z);
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
weights[i][ChunkData.CHUNK_SIZE][j] = currentChunk.getWeight(i, 0, j);
|
||||
types[i][ChunkData.CHUNK_SIZE][j] = currentChunk.getType(i, 0, j);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
weights[i][ChunkData.CHUNK_SIZE][j] = 0;
|
||||
types[i][ChunkData.CHUNK_SIZE][j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//face Z
|
||||
if(worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()){
|
||||
currentChunk = serverTerrainManager.getChunk(worldPos.x, worldPos.y, worldPos.z + 1);
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
weights[i][j][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(i, j, 0);
|
||||
types[i][j][ChunkData.CHUNK_SIZE] = currentChunk.getType(i, j, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
weights[i][j][ChunkData.CHUNK_SIZE] = 0;
|
||||
types[i][j][ChunkData.CHUNK_SIZE] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// //face X
|
||||
// if(worldPos.x + 1 < realm.getServerWorldData().getWorldSizeDiscrete()){
|
||||
// currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y, worldPos.z);
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
// weights[ChunkData.CHUNK_SIZE][i][j] = currentChunk.getWeight(0, i, j);
|
||||
// types[ChunkData.CHUNK_SIZE][i][j] = currentChunk.getType(0, i, j);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
// weights[ChunkData.CHUNK_SIZE][i][j] = 0;
|
||||
// types[ChunkData.CHUNK_SIZE][i][j] = 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //face Y
|
||||
// if(worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete()){
|
||||
// currentChunk = serverTerrainManager.getChunk(worldPos.x, worldPos.y + 1, worldPos.z);
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
// weights[i][ChunkData.CHUNK_SIZE][j] = currentChunk.getWeight(i, 0, j);
|
||||
// types[i][ChunkData.CHUNK_SIZE][j] = currentChunk.getType(i, 0, j);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
// weights[i][ChunkData.CHUNK_SIZE][j] = 0;
|
||||
// types[i][ChunkData.CHUNK_SIZE][j] = 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //face Z
|
||||
// if(worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()){
|
||||
// currentChunk = serverTerrainManager.getChunk(worldPos.x, worldPos.y, worldPos.z + 1);
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
// weights[i][j][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(i, j, 0);
|
||||
// types[i][j][ChunkData.CHUNK_SIZE] = currentChunk.getType(i, j, 0);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// for(int j = 0; j < ChunkData.CHUNK_SIZE; j++){
|
||||
// weights[i][j][ChunkData.CHUNK_SIZE] = 0;
|
||||
// types[i][j][ChunkData.CHUNK_SIZE] = 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//edge X-Y
|
||||
if(
|
||||
worldPos.x + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
){
|
||||
currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y + 1, worldPos.z);
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = currentChunk.getWeight(0, 0, i);
|
||||
types [ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = currentChunk.getType(0, 0, i);
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = 0;
|
||||
types [ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = 0;
|
||||
}
|
||||
}
|
||||
//edge X-Z
|
||||
if(
|
||||
worldPos.x + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
){
|
||||
currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y, worldPos.z + 1);
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
weights[ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(0, i, 0);
|
||||
types [ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = currentChunk.getType(0, i, 0);
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
weights[ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = 0;
|
||||
types [ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = 0;
|
||||
}
|
||||
}
|
||||
//edge Y-Z
|
||||
if(
|
||||
worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
){
|
||||
currentChunk = serverTerrainManager.getChunk(worldPos.x, worldPos.y + 1, worldPos.z + 1);
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
weights[i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(i, 0, 0);
|
||||
types [i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getType(i, 0, 0);
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
weights[i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
types [i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
}
|
||||
}
|
||||
if(
|
||||
worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
){
|
||||
currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y + 1, worldPos.z + 1);
|
||||
weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(0, 0, 0);
|
||||
types[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getType(0, 0, 0);
|
||||
} else {
|
||||
weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
types[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
}
|
||||
// if(
|
||||
// worldPos.x + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
// worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
// ){
|
||||
// currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y + 1, worldPos.z);
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = currentChunk.getWeight(0, 0, i);
|
||||
// types [ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = currentChunk.getType(0, 0, i);
|
||||
// }
|
||||
// } else {
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = 0;
|
||||
// types [ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][i] = 0;
|
||||
// }
|
||||
// }
|
||||
// //edge X-Z
|
||||
// if(
|
||||
// worldPos.x + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
// worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
// ){
|
||||
// currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y, worldPos.z + 1);
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// weights[ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(0, i, 0);
|
||||
// types [ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = currentChunk.getType(0, i, 0);
|
||||
// }
|
||||
// } else {
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// weights[ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = 0;
|
||||
// types [ChunkData.CHUNK_SIZE][i][ChunkData.CHUNK_SIZE] = 0;
|
||||
// }
|
||||
// }
|
||||
// //edge Y-Z
|
||||
// if(
|
||||
// worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
// worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
// ){
|
||||
// currentChunk = serverTerrainManager.getChunk(worldPos.x, worldPos.y + 1, worldPos.z + 1);
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// weights[i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(i, 0, 0);
|
||||
// types [i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getType(i, 0, 0);
|
||||
// }
|
||||
// } else {
|
||||
// for(int i = 0; i < ChunkData.CHUNK_SIZE; i++){
|
||||
// weights[i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
// types [i][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
// }
|
||||
// }
|
||||
// if(
|
||||
// worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
// worldPos.y + 1 < realm.getServerWorldData().getWorldSizeDiscrete() &&
|
||||
// worldPos.z + 1 < realm.getServerWorldData().getWorldSizeDiscrete()
|
||||
// ){
|
||||
// currentChunk = serverTerrainManager.getChunk(worldPos.x + 1, worldPos.y + 1, worldPos.z + 1);
|
||||
// weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getWeight(0, 0, 0);
|
||||
// types[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = currentChunk.getType(0, 0, 0);
|
||||
// } else {
|
||||
// weights[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
// types[ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE][ChunkData.CHUNK_SIZE] = 0;
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -93,8 +93,8 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
|
||||
public ServerTerrainChunk generateChunk(int worldX, int worldY, int worldZ, int stride) {
|
||||
Globals.profiler.beginAggregateCpuSample("TestGenerationChunkGenerator.generateChunk");
|
||||
ServerTerrainChunk rVal = null;
|
||||
float[][][] weights = new float[ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION];;
|
||||
int[][][] values = new int[ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION];
|
||||
float[][][] weights = new float[ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE];;
|
||||
int[][][] values = new int[ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE];
|
||||
|
||||
int firstType = -1;
|
||||
boolean homogenous = true;
|
||||
@ -114,9 +114,9 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
|
||||
int strideValue = (int)Math.pow(2,stride);
|
||||
|
||||
//presolve heightfield
|
||||
float[][] heightfield = new float[ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION];
|
||||
for(int x = 0; x < ServerTerrainChunk.CHUNK_DIMENSION; x++){
|
||||
for(int z = 0; z < ServerTerrainChunk.CHUNK_DIMENSION; z++){
|
||||
float[][] heightfield = new float[ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE];
|
||||
for(int x = 0; x < ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE; x++){
|
||||
for(int z = 0; z < ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE; z++){
|
||||
int finalWorldX = worldX + ((x * strideValue) / ServerTerrainChunk.CHUNK_DIMENSION);
|
||||
int finalWorldZ = worldZ + ((z * strideValue) / ServerTerrainChunk.CHUNK_DIMENSION);
|
||||
int finalChunkX = (x * strideValue) % ServerTerrainChunk.CHUNK_DIMENSION;
|
||||
@ -159,10 +159,10 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
|
||||
// }
|
||||
// });
|
||||
} else {
|
||||
for(int x = 0; x < ServerTerrainChunk.CHUNK_DIMENSION; x++){
|
||||
for(int x = 0; x < ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE; x++){
|
||||
Globals.profiler.beginAggregateCpuSample("TestGenerationChunkGenerator - Generate slice");
|
||||
for(int y = 0; y < ServerTerrainChunk.CHUNK_DIMENSION; y++){
|
||||
for(int z = 0; z < ServerTerrainChunk.CHUNK_DIMENSION; z++){
|
||||
for(int y = 0; y < ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE; y++){
|
||||
for(int z = 0; z < ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE; z++){
|
||||
int finalWorldX = worldX + ((x * strideValue) / ServerTerrainChunk.CHUNK_DIMENSION);
|
||||
int finalWorldY = worldY + ((y * strideValue) / ServerTerrainChunk.CHUNK_DIMENSION);
|
||||
int finalWorldZ = worldZ + ((z * strideValue) / ServerTerrainChunk.CHUNK_DIMENSION);
|
||||
|
||||
@ -22,6 +22,11 @@ public class ServerTerrainChunk {
|
||||
*/
|
||||
public static final int CHUNK_DATA_GENERATOR_SIZE = CHUNK_DIMENSION + 1;
|
||||
|
||||
/**
|
||||
* The units that should be used when placing chunks in the scene
|
||||
*/
|
||||
public static final int CHUNK_PLACEMENT_OFFSET = CHUNK_DATA_GENERATOR_SIZE - 1;
|
||||
|
||||
/**
|
||||
* Gets the x coordinate of the world position of the chunk
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user