From a81e9e203d2e579326f6a150d48b6cae026105df Mon Sep 17 00:00:00 2001 From: austin Date: Tue, 29 Apr 2025 13:11:54 -0400 Subject: [PATCH] edit block performance fix --- assets/Data/fab/disjointedroom1.block | Bin 0 -> 402 bytes docs/src/progress/renderertodo.md | 2 ++ .../ui/components/FabSelectionPanel.java | 1 + .../gridded/GriddedDataCellManager.java | 24 +++++++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 assets/Data/fab/disjointedroom1.block diff --git a/assets/Data/fab/disjointedroom1.block b/assets/Data/fab/disjointedroom1.block new file mode 100644 index 0000000000000000000000000000000000000000..cec50c81a41cd76f562afa71b3cffec9d8de612c GIT binary patch literal 402 zcmV;D0d4*tiwFP!00000|LxkrPJ=)c1<;8THhzE~@YW4!8c{R5#x!n>i>fQ*f>^f3 zAPZZ<@Q$HL-&uR+r4p*JDQc%VzMsw#>HFywl_Onc^)>4-j3-_PS)O=?X#wg z3%wO2Tm!VbUT7Nkw%qB>-R$^!`ybGoo5t3gtfSd***0A1O~RQ**Z*SvW{lBWKUwrv zkkAEs`}u7?30-vAo6F~Z63z*R%1Z65zCAT#)3AyRvTX6Ow700000 z000000000000000U<6VM<0yP5^ORDuev8P^a&i4Izq@(7oiAxZarBbhCt;kBN$G>k wg&$04O=g physicsQueue = new HashMap(); /** * Constructor @@ -658,6 +663,20 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager public void simulate(){ Globals.profiler.beginCpuSample("GriddedDataCellManager.simulate"); loadedCellsLock.lock(); + + + //regenerate physics where relevant + terrainEditLock.acquireUninterruptibly(); + if(physicsQueue.size() > 0){ + for(Vector3i pos : physicsQueue.values()){ + this.createTerrainPhysicsEntities(pos); + } + physicsQueue.clear(); + } + terrainEditLock.release(); + + + //micro simulation boolean runMicroSim = Globals.microSimulation != null && Globals.microSimulation.isReady(); for(ServerDataCell cell : this.groundDataCells.values()){ if(runMicroSim && this.shouldSimulate(cell)){ @@ -1041,7 +1060,10 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager ServerDataCell cell = groundDataCells.get(this.getServerDataCellKey(worldPosition)); if(cell != null){ //update physics - this.createTerrainPhysicsEntities(worldPosition); + long key = this.getServerDataCellKey(worldPosition); + if(!this.physicsQueue.containsKey(key)){ + this.physicsQueue.put(key,worldPosition); + } //broadcast update cell.broadcastNetworkMessage(TerrainMessage.constructUpdateBlockMessage(