debug logging work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-01-19 19:57:36 -05:00
parent 5bab3a23e7
commit 22d87dcb8f
3 changed files with 49 additions and 1 deletions

View File

@ -36,13 +36,14 @@ public class ImGuiFluidMonitor {
public void exec() {
if(ImGui.collapsingHeader("Server Data")){
ServerFluidManager fluidManager = Globals.playerManager.getPlayerRealm(Globals.clientPlayer).getServerWorldData().getServerFluidManager();
//audio engine details
//server 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());
ImGui.text("Active Chunk Count (This Frame): " + fluidManager.getActiveChunkCount());
ImGui.text("Normalization Ratio: " + ServerFluidChunk.getNormalizationRatio());
ImGui.text("Mass: " + ServerFluidChunk.getMassCount());
@ -129,6 +130,19 @@ public class ImGuiFluidMonitor {
System.out.println("\n\n\n");
System.out.println("Divergence");
for(int y = 0; y < 3; y++){
System.out.println("Layer " + y);
for(int x = 0; x < ServerFluidChunk.BUFFER_DIM; x++){
for(int z = 0; z < ServerFluidChunk.BUFFER_DIM; z++){
System.out.print(chunk.getDivergence(x, y, z) + ", ");
}
System.out.println();
}
}
System.out.println("\n\n\n");
System.out.println("Pressure");
for(int y = 0; y < 3; y++){
System.out.println("Layer " + y);

View File

@ -116,6 +116,11 @@ public class ServerFluidChunk {
*/
FloatBuffer pressureCache;
/**
* The divergence cache
*/
FloatBuffer divergenceCache;
/**
* The array of all adjacent weight buffers for the fluid sim
*/
@ -285,6 +290,7 @@ public class ServerFluidChunk {
this.velocityY = this.bVelocityY[CENTER_BUFF].asFloatBuffer();
this.velocityZ = this.bVelocityZ[CENTER_BUFF].asFloatBuffer();
this.bounds = this.bBounds[CENTER_BUFF].asFloatBuffer();
this.divergenceCache = this.bDivergenceCache[CENTER_BUFF].asFloatBuffer();
this.pressureCache = this.bPressureCache[CENTER_BUFF].asFloatBuffer();
}
@ -574,6 +580,17 @@ public class ServerFluidChunk {
return pressureCache.get(this.IX(x,y,z));
}
/**
* Gets the divergence at a point
* @param x The x coordinate
* @param y The y coordinate
* @param z The z coordinate
* @return The divergence
*/
public float getDivergence(int x, int y, int z){
return divergenceCache.get(this.IX(x,y,z));
}
/**
* Gets the inddex into the buffer
* @param x The x position

View File

@ -110,6 +110,12 @@ public class ServerFluidManager {
* The number of chunks broadcast this frame
*/
int broadcastSize = 0;
@Exclude
/**
* The number of chunks active this frame
*/
int activeChunkCount = 0;
/**
@ -319,6 +325,9 @@ public class ServerFluidManager {
this.serverFluidSimulator.simulate(this.simulationQueue,this.broadcastQueue);
}
}
//set active chunk size
this.activeChunkCount = this.simulationQueue.size();
//clear both queues
while(this.simulationQueue.size() > 0){
@ -440,5 +449,13 @@ public class ServerFluidManager {
return broadcastSize;
}
/**
* The number of chunks active this frame
* @return The number of chunks active this frame
*/
public int getActiveChunkCount(){
return this.activeChunkCount;
}
}