elevation fix
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-12-03 17:59:01 -05:00
parent 1ea758705f
commit 9157180e03
8 changed files with 15 additions and 7 deletions

View File

@ -1231,6 +1231,7 @@ Fix gravity tree not deactivating when body is disabled
Refactoring world menu generators into dedicated class Refactoring world menu generators into dedicated class
Fix single player loading Fix single player loading
Spawn player in center of single player world Spawn player in center of single player world
Elevation fix + use correct voxel generation in SP worlds

View File

@ -182,6 +182,7 @@ public class DrawCell {
toDelete, toDelete,
lod, lod,
atlas, atlas,
this.worldPos,
this.hasPolygons() this.hasPolygons()
); );
ClientEntityUtils.initiallyPositionEntity(modelEntity, this.getRealPos(), new Quaterniond()); ClientEntityUtils.initiallyPositionEntity(modelEntity, this.getRealPos(), new Quaterniond());

View File

@ -5,6 +5,7 @@ import java.util.concurrent.Executors;
import org.joml.Quaterniond; import org.joml.Quaterniond;
import org.joml.Vector3d; import org.joml.Vector3d;
import org.joml.Vector3i;
import electrosphere.client.block.BlockChunkData; import electrosphere.client.block.BlockChunkData;
import electrosphere.client.terrain.cells.ClientDrawCellManager; import electrosphere.client.terrain.cells.ClientDrawCellManager;
@ -48,12 +49,12 @@ public class TerrainChunk {
Entity toDelete, Entity toDelete,
int levelOfDetail, int levelOfDetail,
VoxelTextureAtlas atlas, VoxelTextureAtlas atlas,
Vector3i worldPos,
boolean hasPolygons boolean hasPolygons
){ ){
Globals.profiler.beginAggregateCpuSample("TerrainChunk.clientCreateTerrainChunkEntity"); Globals.profiler.beginAggregateCpuSample("TerrainChunk.clientCreateTerrainChunkEntity");
Entity rVal = EntityCreationUtils.createClientSpatialEntity(); Entity rVal = EntityCreationUtils.createClientSpatialEntity();
if(hasPolygons && chunkData.terrainGrid != null && chunkData.textureGrid != null){ if(hasPolygons && chunkData.terrainGrid != null && chunkData.textureGrid != null){
generationService.submit(() -> { generationService.submit(() -> {
TerrainChunkData data; TerrainChunkData data;
@ -65,7 +66,8 @@ public class TerrainChunk {
EntityCreationUtils.makeEntityDrawablePreexistingModel(rVal, modelPath); EntityCreationUtils.makeEntityDrawablePreexistingModel(rVal, modelPath);
if(levelOfDetail == BlockChunkData.LOD_FULL_RES && data.faceElements.length > 0){ if(levelOfDetail == BlockChunkData.LOD_FULL_RES && data.faceElements.length > 0){
PhysicsEntityUtils.clientAttachTriGeomRigidBody(rVal, data); PhysicsEntityUtils.clientAttachTriGeomRigidBody(rVal, data);
CollisionObjUtils.clientPositionCharacter(rVal, new Vector3d(EntityUtils.getPosition(rVal)), new Quaterniond()); Vector3d finalPos = new Vector3d(EntityUtils.getPosition(rVal));
CollisionObjUtils.clientPositionCharacter(rVal, finalPos, new Quaterniond());
} else { } else {
EntityCreationUtils.bypassShadowPass(rVal); EntityCreationUtils.bypassShadowPass(rVal);
EntityCreationUtils.bypassVolumetics(rVal); EntityCreationUtils.bypassVolumetics(rVal);

View File

@ -141,7 +141,7 @@ public class ServerWorldData {
} else { } else {
//TODO: Allow loading procedurally generated terrain from disk (the chunk generator is always default currently) //TODO: Allow loading procedurally generated terrain from disk (the chunk generator is always default currently)
serverWorldData = FileUtils.loadObjectFromSavePath(sceneOrSaveName, "world.json", ServerWorldData.class); serverWorldData = FileUtils.loadObjectFromSavePath(sceneOrSaveName, "world.json", ServerWorldData.class);
serverTerrainManager = new ServerTerrainManager(serverWorldData, 0, new DefaultChunkGenerator()); serverTerrainManager = new ServerTerrainManager(serverWorldData, 0, new TestGenerationChunkGenerator(serverWorldData, false));
serverTerrainManager.load(sceneOrSaveName); serverTerrainManager.load(sceneOrSaveName);
serverFluidManager = new ServerFluidManager(serverWorldData, serverTerrainManager, 0, new DefaultFluidGenerator()); serverFluidManager = new ServerFluidManager(serverWorldData, serverTerrainManager, 0, new DefaultFluidGenerator());
serverBlockManager = new ServerBlockManager(serverWorldData); serverBlockManager = new ServerBlockManager(serverWorldData);

View File

@ -261,9 +261,10 @@ public class TerrainProtocol implements ServerProtocolTemplate<TerrainMessage> {
toSend = new byte[]{ 0 }; toSend = new byte[]{ 0 };
} }
// System.out.println("(Server) Send terrain at " + worldX + " " + worldY + " " + worldZ); // System.out.println("(Server) Send terrain at " + worldX + " " + worldY + " " + worldZ);
LoggerInterface.loggerNetworking.DEBUG("(Server) Send terrain at " + worldX + " " + worldY + " " + worldZ); LoggerInterface.loggerNetworking.DEBUG("(Server) Send terrain at " + worldX + " " + worldY + " " + worldZ);
connectionHandler.addMessagetoOutgoingQueue(TerrainMessage.constructSendReducedChunkDataMessage(worldX, worldY, worldZ, stride, chunk.getHomogenousValue(), toSend)); connectionHandler.addMessagetoOutgoingQueue(TerrainMessage.constructSendReducedChunkDataMessage(chunk.getWorldX(), chunk.getWorldY(), chunk.getWorldZ(), stride, chunk.getHomogenousValue(), toSend));
}; };
//request chunk //request chunk

View File

@ -376,6 +376,9 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
realZ realZ
) * weight; ) * weight;
} }
if(rVal < 0){
rVal = 0;
}
return rVal; return rVal;
} }

View File

@ -94,9 +94,9 @@ public class ChunkGenerationThread implements Runnable {
@Override @Override
public void run() { public void run() {
ServerTerrainChunk chunk = null;
int i = 0;
try { try {
int i = 0;
ServerTerrainChunk chunk = null;
while(chunk == null && i < MAX_TIME_TO_WAIT && Globals.threadManager.shouldKeepRunning()){ while(chunk == null && i < MAX_TIME_TO_WAIT && Globals.threadManager.shouldKeepRunning()){
if(chunkCache.containsChunk(worldX, worldY, worldZ, stride)){ if(chunkCache.containsChunk(worldX, worldY, worldZ, stride)){
chunk = chunkCache.get(worldX, worldY, worldZ, stride); chunk = chunkCache.get(worldX, worldY, worldZ, stride);

View File

@ -29,7 +29,7 @@ public class ServerTerrainManager {
/** /**
* The number of threads for chunk generation * The number of threads for chunk generation
*/ */
public static final int GENERATION_THREAD_POOL_SIZE = 2; public static final int GENERATION_THREAD_POOL_SIZE = 1;
/** /**
* Full world discrete size * Full world discrete size