foliage debug tooling
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
4d9759c6ec
commit
782b31954e
@ -1594,6 +1594,7 @@ Unhashing ivec hashed keys in chunk caches
|
|||||||
Unit tests for unhash func
|
Unit tests for unhash func
|
||||||
Filter client entity list to terrain
|
Filter client entity list to terrain
|
||||||
Fix server loading full res chunks from disk as strided chunks
|
Fix server loading full res chunks from disk as strided chunks
|
||||||
|
Debugging tooling for foliage manager
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -175,6 +175,11 @@ public class FoliageCell {
|
|||||||
* The number of cells that have alerted this one
|
* The number of cells that have alerted this one
|
||||||
*/
|
*/
|
||||||
int generationAlertCount = 0;
|
int generationAlertCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set to true, FoliageCellManager should debug when evaluating this cell
|
||||||
|
*/
|
||||||
|
boolean tripDebugFlag = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -467,6 +472,35 @@ public class FoliageCell {
|
|||||||
return cachedMinDistance;
|
return cachedMinDistance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return "" +
|
||||||
|
"worldPos: " + worldPos + "\n" +
|
||||||
|
"voxelPos: " + voxelPos + "\n" +
|
||||||
|
"lod: " + lod + "\n" +
|
||||||
|
"modelEntity: " + modelEntity + "\n" +
|
||||||
|
"hasRequested: " + hasRequested + "\n" +
|
||||||
|
"hasGenerated: " + hasGenerated + "\n" +
|
||||||
|
"homogenous: " + homogenous + "\n" +
|
||||||
|
"";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this cell should trip the debug flag on its next evaluation or not
|
||||||
|
* @param trip true to debug on next evaluation, false otherwise
|
||||||
|
*/
|
||||||
|
public void setTripDebug(boolean trip){
|
||||||
|
this.tripDebugFlag = trip;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether this cell should trigger debugging on next evaluation or not
|
||||||
|
* @return true to debug on next evaluation, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getTripDebug(){
|
||||||
|
return tripDebugFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -226,17 +226,20 @@ public class FoliageCellManager {
|
|||||||
*/
|
*/
|
||||||
private boolean recursivelyUpdateCells(WorldOctTreeNode<FoliageCell> node, Vector3i absVoxelPos, Map<WorldOctTreeNode<FoliageCell>,Boolean> evaluationMap, int minLeafLod, int distCache){
|
private boolean recursivelyUpdateCells(WorldOctTreeNode<FoliageCell> node, Vector3i absVoxelPos, Map<WorldOctTreeNode<FoliageCell>,Boolean> evaluationMap, int minLeafLod, int distCache){
|
||||||
boolean updated = false;
|
boolean updated = false;
|
||||||
|
if(node.getData().getTripDebug()){
|
||||||
|
node.getData().setTripDebug(false);
|
||||||
|
}
|
||||||
//breakpoint handling
|
//breakpoint handling
|
||||||
if(this.breakPoints.size() > 0){
|
if(this.breakPoints.size() > 0){
|
||||||
for(Vector3i breakpoint : breakPoints){
|
for(Vector3i breakpoint : breakPoints){
|
||||||
if(GeomUtils.approxMinDistanceAABB(breakpoint, node.getMinBound(), node.getMaxBound()) == 0){
|
if(GeomUtils.approxMinDistanceAABB(breakpoint, node.getMinBound(), node.getMaxBound()) == 0){
|
||||||
System.out.println("Break at " + breakpoint + " " + node.getLevel());
|
LoggerInterface.loggerEngine.WARNING("Break at " + breakpoint + " " + node.getLevel());
|
||||||
System.out.println(" " + node.getMinBound() + " " + node.getMaxBound());
|
LoggerInterface.loggerEngine.WARNING(" " + node.getMinBound() + " " + node.getMaxBound());
|
||||||
System.out.println(" Generated: " + node.getData().hasGenerated());
|
LoggerInterface.loggerEngine.WARNING(" Generated: " + node.getData().hasGenerated());
|
||||||
System.out.println(" Homogenous: " + node.getData().isHomogenous());
|
LoggerInterface.loggerEngine.WARNING(" Homogenous: " + node.getData().isHomogenous());
|
||||||
System.out.println(" Leaf: " + node.isLeaf());
|
LoggerInterface.loggerEngine.WARNING(" Leaf: " + node.isLeaf());
|
||||||
System.out.println(" Cached min dist: " + node.getData().cachedMinDistance);
|
LoggerInterface.loggerEngine.WARNING(" Cached min dist: " + node.getData().cachedMinDistance);
|
||||||
System.out.println(" Actual min dist: " + GeomUtils.approxMinDistanceAABB(breakpoint, node.getMinBound(), node.getMaxBound()));
|
LoggerInterface.loggerEngine.WARNING(" Actual min dist: " + GeomUtils.approxMinDistanceAABB(breakpoint, node.getMinBound(), node.getMaxBound()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import org.joml.Vector3i;
|
|||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
import electrosphere.client.terrain.cache.ChunkData;
|
import electrosphere.client.terrain.cache.ChunkData;
|
||||||
import electrosphere.client.terrain.cells.DrawCell;
|
import electrosphere.client.terrain.cells.DrawCell;
|
||||||
|
import electrosphere.client.terrain.foliage.FoliageCell;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||||
@ -36,7 +37,7 @@ public class ImGuiDrawCell {
|
|||||||
drawCellWindow.setCallback(new ImGuiWindowCallback() {
|
drawCellWindow.setCallback(new ImGuiWindowCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void exec() {
|
public void exec() {
|
||||||
if(ImGui.button("Debug camera position")){
|
if(ImGui.button("Debug DrawCell at camera position")){
|
||||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
DrawCell cell = Globals.clientDrawCellManager.getDrawCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
DrawCell cell = Globals.clientDrawCellManager.getDrawCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||||
LoggerInterface.loggerEngine.WARNING("" + cell);
|
LoggerInterface.loggerEngine.WARNING("" + cell);
|
||||||
@ -62,6 +63,11 @@ public class ImGuiDrawCell {
|
|||||||
LoggerInterface.loggerEngine.WARNING("Chunk not in cache! " + cameraWorldPos);
|
LoggerInterface.loggerEngine.WARNING("Chunk not in cache! " + cameraWorldPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(ImGui.button("Debug FoliageCell at camera position")){
|
||||||
|
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
|
FoliageCell cell = Globals.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||||
|
LoggerInterface.loggerEngine.WARNING("" + cell);
|
||||||
|
}
|
||||||
if(ImGui.button("Request terrain at camera position")){
|
if(ImGui.button("Request terrain at camera position")){
|
||||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Globals.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 1);
|
Globals.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user