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
Fix single player loading
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,
lod,
atlas,
this.worldPos,
this.hasPolygons()
);
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.Vector3d;
import org.joml.Vector3i;
import electrosphere.client.block.BlockChunkData;
import electrosphere.client.terrain.cells.ClientDrawCellManager;
@ -48,12 +49,12 @@ public class TerrainChunk {
Entity toDelete,
int levelOfDetail,
VoxelTextureAtlas atlas,
Vector3i worldPos,
boolean hasPolygons
){
Globals.profiler.beginAggregateCpuSample("TerrainChunk.clientCreateTerrainChunkEntity");
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
if(hasPolygons && chunkData.terrainGrid != null && chunkData.textureGrid != null){
generationService.submit(() -> {
TerrainChunkData data;
@ -65,7 +66,8 @@ public class TerrainChunk {
EntityCreationUtils.makeEntityDrawablePreexistingModel(rVal, modelPath);
if(levelOfDetail == BlockChunkData.LOD_FULL_RES && data.faceElements.length > 0){
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 {
EntityCreationUtils.bypassShadowPass(rVal);
EntityCreationUtils.bypassVolumetics(rVal);

View File

@ -141,7 +141,7 @@ public class ServerWorldData {
} else {
//TODO: Allow loading procedurally generated terrain from disk (the chunk generator is always default currently)
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);
serverFluidManager = new ServerFluidManager(serverWorldData, serverTerrainManager, 0, new DefaultFluidGenerator());
serverBlockManager = new ServerBlockManager(serverWorldData);

View File

@ -261,9 +261,10 @@ public class TerrainProtocol implements ServerProtocolTemplate<TerrainMessage> {
toSend = new byte[]{ 0 };
}
// System.out.println("(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

View File

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

View File

@ -94,9 +94,9 @@ public class ChunkGenerationThread implements Runnable {
@Override
public void run() {
ServerTerrainChunk chunk = null;
int i = 0;
try {
int i = 0;
ServerTerrainChunk chunk = null;
while(chunk == null && i < MAX_TIME_TO_WAIT && Globals.threadManager.shouldKeepRunning()){
if(chunkCache.containsChunk(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
*/
public static final int GENERATION_THREAD_POOL_SIZE = 2;
public static final int GENERATION_THREAD_POOL_SIZE = 1;
/**
* Full world discrete size