This commit is contained in:
parent
633257a7ae
commit
586232dd79
@ -1,3 +1,3 @@
|
||||
#maven.buildNumber.plugin properties file
|
||||
#Sun Dec 01 11:40:49 EST 2024
|
||||
buildNumber=448
|
||||
#Sun Dec 01 11:59:35 EST 2024
|
||||
buildNumber=449
|
||||
|
||||
@ -1203,6 +1203,8 @@ Break out solver consts
|
||||
|
||||
(12/01/2024)
|
||||
Move header file generation location
|
||||
Add more debugging tools for fluids
|
||||
Remove conditional update check in fluid sim
|
||||
|
||||
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define DIM 18
|
||||
#define REALLY_SMALL_VALUE 0.00001
|
||||
|
||||
#define DIFFUSION_CONSTANT 0.00001
|
||||
|
||||
@ -43,12 +43,8 @@ void updateMetadata(JNIEnv * env, int numChunks, Chunk ** passedInChunks, Enviro
|
||||
}
|
||||
|
||||
//update total density
|
||||
if(fabs(sum - prevDensity) > UPDATE_THRESHOLD){
|
||||
(*env)->SetBooleanField(env,jObj,updatedId,JNI_TRUE);
|
||||
(*env)->SetFloatField(env,jObj,totalDensityId,sum);
|
||||
} else {
|
||||
(*env)->SetBooleanField(env,jObj,updatedId,JNI_FALSE);
|
||||
}
|
||||
(*env)->SetBooleanField(env,jObj,updatedId,JNI_TRUE);
|
||||
(*env)->SetFloatField(env,jObj,totalDensityId,sum);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,11 @@ import electrosphere.server.terrain.manager.ServerTerrainChunk;
|
||||
* @author satellite
|
||||
*/
|
||||
public class FluidCellManager {
|
||||
|
||||
/**
|
||||
* The number of times to iteratively update per frame
|
||||
*/
|
||||
static final int UPDATE_COUNT = 5;
|
||||
|
||||
|
||||
//the center of this cell manager's array in cell space
|
||||
@ -356,12 +361,14 @@ public class FluidCellManager {
|
||||
Globals.profiler.beginCpuSample("FluidCellManager.update");
|
||||
calculateDeltas();
|
||||
if(update){
|
||||
if(containsUnrequestedCell()){
|
||||
updateUnrequestedCell();
|
||||
} else if(containsUndrawableCell()){
|
||||
makeCellDrawable();
|
||||
} else if(containsUpdateableCell()){
|
||||
updateCellModel();
|
||||
for(int i = 0; i < UPDATE_COUNT; i++){
|
||||
if(containsUnrequestedCell()){
|
||||
updateUnrequestedCell();
|
||||
} else if(containsUndrawableCell()){
|
||||
makeCellDrawable();
|
||||
} else if(containsUpdateableCell()){
|
||||
updateCellModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Globals.profiler.endCpuSample();
|
||||
|
||||
@ -44,6 +44,11 @@ public class ClientFluidManager {
|
||||
//The queue of fluid chunk data to be buffered to gpu
|
||||
static List<FluidChunkGenQueueItem> fluidChunkGenerationQueue = new LinkedList<FluidChunkGenQueueItem>();
|
||||
|
||||
/**
|
||||
* The number of messages parsed this frame
|
||||
*/
|
||||
int messageCount;
|
||||
|
||||
/**
|
||||
* Lock for thread-safeing the manager
|
||||
*/
|
||||
@ -60,6 +65,7 @@ public class ClientFluidManager {
|
||||
public void handleMessages(){
|
||||
lock.lock();
|
||||
List<TerrainMessage> bouncedMessages = new LinkedList<TerrainMessage>();
|
||||
messageCount = messageQueue.size();
|
||||
for(TerrainMessage message : messageQueue){
|
||||
switch(message.getMessageSubtype()){
|
||||
case SENDFLUIDDATA: {
|
||||
@ -211,5 +217,13 @@ public class ClientFluidManager {
|
||||
data.setVoxelWeight(weights);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of messages processed this frame
|
||||
* @return The number of messages
|
||||
*/
|
||||
public int getMessageCount(){
|
||||
return messageCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
package electrosphere.client.ui.menu.debug;
|
||||
|
||||
import electrosphere.client.fluid.cells.FluidCellManager;
|
||||
import electrosphere.client.fluid.manager.ClientFluidManager;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||
import electrosphere.server.fluid.manager.ServerFluidManager;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* Monitors the fluid system on server/client
|
||||
*/
|
||||
public class ImGuiFluidMonitor {
|
||||
|
||||
/**
|
||||
* Window for viewing chunk status on server and client
|
||||
*/
|
||||
protected static ImGuiWindow fluidWindow;
|
||||
|
||||
/**
|
||||
* Creates the windows in this file
|
||||
*/
|
||||
protected static void createFluidDebugWindows(){
|
||||
createFluidDebugWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
protected static void createFluidDebugWindow(){
|
||||
fluidWindow = new ImGuiWindow("Fluids");
|
||||
fluidWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
if(ImGui.collapsingHeader("Server Data")){
|
||||
ServerFluidManager fluidManager = Globals.playerManager.getPlayerRealm(Globals.clientPlayer).getServerWorldData().getServerFluidManager();
|
||||
//audio engine details
|
||||
ImGui.text("Fluids Debug");
|
||||
ImGui.text("State: " + (fluidManager.getSimulate() ? "on" : "off"));
|
||||
if(ImGui.button("Toggle Simulation")){
|
||||
fluidManager.setSimulate(!fluidManager.getSimulate());
|
||||
}
|
||||
ImGui.text("Broadcast Size (This Frame): " + fluidManager.getBroadcastSize());
|
||||
}
|
||||
if(ImGui.collapsingHeader("Client Data")){
|
||||
|
||||
FluidCellManager fluidCellManager = Globals.fluidCellManager;
|
||||
ImGui.text("FluidCellManager Data");
|
||||
ImGui.text("Undrawable size: " + fluidCellManager.getUndrawableSize());
|
||||
ImGui.text("Unrequested size: " + fluidCellManager.getUnrequestedSize());
|
||||
|
||||
ClientFluidManager clientFluidManager = Globals.clientFluidManager;
|
||||
ImGui.text("ClientFluidManager Data");
|
||||
ImGui.text("Message Count (This Frame): " + clientFluidManager.getMessageCount());
|
||||
}
|
||||
}
|
||||
});
|
||||
fluidWindow.setOpen(false);
|
||||
Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(fluidWindow);
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,7 +10,6 @@ import electrosphere.renderer.ui.imgui.ImGuiLinePlot;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiLinePlot.ImGuiLinePlotDataset;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||
import electrosphere.server.fluid.manager.ServerFluidManager;
|
||||
import electrosphere.server.terrain.generation.TestGenerationChunkGenerator;
|
||||
import imgui.ImGui;
|
||||
|
||||
@ -32,9 +31,6 @@ public class ImGuiWindowMacros {
|
||||
private static ImGuiLinePlot globalFrametimePlot;
|
||||
private static Map<String,ImGuiLinePlotDataset> globalFrametimeDatasets;
|
||||
|
||||
//fluid details
|
||||
private static ImGuiWindow fluidWindow;
|
||||
|
||||
/**
|
||||
* Initializes imgui windows
|
||||
*/
|
||||
@ -42,7 +38,7 @@ public class ImGuiWindowMacros {
|
||||
createMainDebugMenu();
|
||||
createFramerateGraph();
|
||||
ImGuiPlayerEntity.createPlayerEntityDebugWindow();
|
||||
createFluidDebugWindow();
|
||||
ImGuiFluidMonitor.createFluidDebugWindows();
|
||||
ImGuiEntityMacros.createClientEntityWindows();
|
||||
ImGuiUIFramework.createUIFrameworkWindows();
|
||||
ImGuiControls.createControlsWindows();
|
||||
@ -108,27 +104,6 @@ public class ImGuiWindowMacros {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create fluid debug menu
|
||||
*/
|
||||
private static void createFluidDebugWindow(){
|
||||
fluidWindow = new ImGuiWindow("Fluids");
|
||||
fluidWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
ServerFluidManager fluidManager = Globals.playerManager.getPlayerRealm(Globals.clientPlayer).getServerWorldData().getServerFluidManager();
|
||||
//audio engine details
|
||||
ImGui.text("Fluids Debug");
|
||||
ImGui.text("State: " + (fluidManager.getSimulate() ? "on" : "off"));
|
||||
if(ImGui.button("Toggle Simulation")){
|
||||
fluidManager.setSimulate(!fluidManager.getSimulate());
|
||||
}
|
||||
}
|
||||
});
|
||||
fluidWindow.setOpen(false);
|
||||
Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(fluidWindow);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inits the main debug menu
|
||||
@ -152,7 +127,7 @@ public class ImGuiWindowMacros {
|
||||
}
|
||||
//show fluids debug
|
||||
if(ImGui.button("Show Fluids Debug Menu")){
|
||||
fluidWindow.setOpen(true);
|
||||
ImGuiFluidMonitor.fluidWindow.setOpen(true);
|
||||
}
|
||||
//client entity debug
|
||||
if(ImGui.button("Client Entity Debug")){
|
||||
|
||||
@ -101,6 +101,12 @@ public class ServerFluidManager {
|
||||
* The update frame-skipping tracking variable
|
||||
*/
|
||||
int updatePhase = 0;
|
||||
|
||||
@Exclude
|
||||
/**
|
||||
* The number of chunks broadcast this frame
|
||||
*/
|
||||
int broadcastSize = 0;
|
||||
|
||||
|
||||
/**
|
||||
@ -297,6 +303,7 @@ public class ServerFluidManager {
|
||||
}
|
||||
|
||||
this.simulationQueue.clear();
|
||||
this.broadcastSize = this.broadcastQueue.size();
|
||||
|
||||
updatePhase++;
|
||||
if(updatePhase > UPDATE_RATE){
|
||||
@ -388,6 +395,13 @@ public class ServerFluidManager {
|
||||
return serverFluidSimulator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of chunks broadcast this frame
|
||||
* @return The number of chunks
|
||||
*/
|
||||
public int getBroadcastSize(){
|
||||
return broadcastSize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user