edit block performance fix
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
1ded83c968
commit
a81e9e203d
BIN
assets/Data/fab/disjointedroom1.block
Normal file
BIN
assets/Data/fab/disjointedroom1.block
Normal file
Binary file not shown.
@ -1583,6 +1583,8 @@ Grid alignment actually aligns entity to grid
|
||||
Fix door tree physics
|
||||
BlockFab metadata
|
||||
Structure editing tab in editor view
|
||||
Reduce physics generation calls on GriddedDataCellManager
|
||||
Fab selection doesn't overflow anymore
|
||||
|
||||
|
||||
|
||||
|
||||
@ -132,6 +132,7 @@ public class FabSelectionPanel {
|
||||
newButton.setMarginTop(MARGIN_EACH_SIDE);
|
||||
//label
|
||||
Label fabLabel = Label.createLabel(fabFile.getName());
|
||||
fabLabel.setMaxWidth(FAB_BUTTON_WIDTH);
|
||||
//icon/model
|
||||
ImagePanel texturePanel = ImagePanel.createImagePanel(AssetDataStrings.TEXTURE_DEFAULT);
|
||||
texturePanel.setWidth(FAB_BUTTON_TEXTURE_DIM);
|
||||
|
||||
@ -151,6 +151,11 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
||||
* Number of data cells cleaned up in the most recent frame
|
||||
*/
|
||||
int numCleaned = 0;
|
||||
|
||||
/**
|
||||
* Queue of cells that need to have their physics regenerated (ie on block edits)
|
||||
*/
|
||||
Map<Long,Vector3i> physicsQueue = new HashMap<Long,Vector3i>();
|
||||
|
||||
/**
|
||||
* 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(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user