refactor DrawCell ui -> ClientServices ui
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
abcf4761df
commit
5d1aebeaf2
@ -0,0 +1,94 @@
|
||||
package electrosphere.client.ui.menu.debug;
|
||||
|
||||
import org.joml.Vector3i;
|
||||
|
||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||
import electrosphere.client.terrain.cache.ChunkData;
|
||||
import electrosphere.client.terrain.cells.DrawCell;
|
||||
import electrosphere.client.terrain.foliage.FoliageCell;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* Debug ui for draw cells
|
||||
*/
|
||||
public class ImGuiClientServices {
|
||||
|
||||
/**
|
||||
* Window for viewing chunk status on server and client
|
||||
*/
|
||||
protected static ImGuiWindow clientServicesWindow;
|
||||
|
||||
/**
|
||||
* Creates the windows in this file
|
||||
*/
|
||||
protected static void createClientServicesWindows(){
|
||||
ImGuiClientServices.createClientServicesWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
protected static void createClientServicesWindow(){
|
||||
clientServicesWindow = new ImGuiWindow("Draw Cells");
|
||||
clientServicesWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
|
||||
if(ImGui.collapsingHeader("Draw Cells")){
|
||||
if(ImGui.button("Debug DrawCell at camera position")){
|
||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
DrawCell cell = Globals.clientDrawCellManager.getDrawCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||
LoggerInterface.loggerEngine.WARNING("" + cell);
|
||||
|
||||
LoggerInterface.loggerEngine.WARNING("Chunk topology:");
|
||||
ChunkData data = Globals.clientTerrainManager.getChunkDataAtWorldPoint(cameraWorldPos, 1);
|
||||
if(data != null){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
String line = "";
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
int height = 0;
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
if(data.getType(x, y, z) != 0){
|
||||
height = y;
|
||||
}
|
||||
}
|
||||
line = line + String.format("%2d ",height);
|
||||
}
|
||||
LoggerInterface.loggerEngine.WARNING(line);
|
||||
}
|
||||
LoggerInterface.loggerEngine.WARNING("\n");
|
||||
} else {
|
||||
LoggerInterface.loggerEngine.WARNING("Chunk not in cache! " + cameraWorldPos);
|
||||
}
|
||||
}
|
||||
if(ImGui.button("Print debug info for 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("Debug FoliageCell evaluation at camera position")){
|
||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
FoliageCell cell = Globals.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||
cell.setTripDebug(true);
|
||||
}
|
||||
if(ImGui.button("Request terrain at camera position")){
|
||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
Globals.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ImGui.collapsingHeader("Interaction Engine")){
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
clientServicesWindow.setOpen(false);
|
||||
Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(clientServicesWindow);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
package electrosphere.client.ui.menu.debug;
|
||||
|
||||
import org.joml.Vector3i;
|
||||
|
||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||
import electrosphere.client.terrain.cache.ChunkData;
|
||||
import electrosphere.client.terrain.cells.DrawCell;
|
||||
import electrosphere.client.terrain.foliage.FoliageCell;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* Debug ui for draw cells
|
||||
*/
|
||||
public class ImGuiDrawCell {
|
||||
|
||||
/**
|
||||
* Window for viewing chunk status on server and client
|
||||
*/
|
||||
protected static ImGuiWindow drawCellWindow;
|
||||
|
||||
/**
|
||||
* Creates the windows in this file
|
||||
*/
|
||||
protected static void createDrawCellWindows(){
|
||||
ImGuiDrawCell.createDrawCellWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
protected static void createDrawCellWindow(){
|
||||
drawCellWindow = new ImGuiWindow("Draw Cells");
|
||||
drawCellWindow.setCallback(new ImGuiWindowCallback() {
|
||||
@Override
|
||||
public void exec() {
|
||||
if(ImGui.button("Debug DrawCell at camera position")){
|
||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
DrawCell cell = Globals.clientDrawCellManager.getDrawCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||
LoggerInterface.loggerEngine.WARNING("" + cell);
|
||||
|
||||
LoggerInterface.loggerEngine.WARNING("Chunk topology:");
|
||||
ChunkData data = Globals.clientTerrainManager.getChunkDataAtWorldPoint(cameraWorldPos, 1);
|
||||
if(data != null){
|
||||
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
|
||||
String line = "";
|
||||
for(int z = 0; z < ChunkData.CHUNK_DATA_SIZE; z++){
|
||||
int height = 0;
|
||||
for(int y = 0; y < ChunkData.CHUNK_DATA_SIZE; y++){
|
||||
if(data.getType(x, y, z) != 0){
|
||||
height = y;
|
||||
}
|
||||
}
|
||||
line = line + String.format("%2d ",height);
|
||||
}
|
||||
LoggerInterface.loggerEngine.WARNING(line);
|
||||
}
|
||||
LoggerInterface.loggerEngine.WARNING("\n");
|
||||
} else {
|
||||
LoggerInterface.loggerEngine.WARNING("Chunk not in cache! " + cameraWorldPos);
|
||||
}
|
||||
}
|
||||
if(ImGui.button("Print debug info for 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("Debug FoliageCell evaluation at camera position")){
|
||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
FoliageCell cell = Globals.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||
cell.setTripDebug(true);
|
||||
}
|
||||
if(ImGui.button("Request terrain at camera position")){
|
||||
Vector3i cameraWorldPos = Globals.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
Globals.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
drawCellWindow.setOpen(false);
|
||||
Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(drawCellWindow);
|
||||
}
|
||||
|
||||
}
|
||||
@ -53,7 +53,7 @@ public class ImGuiWindowMacros {
|
||||
ImGuiGriddedManager.createGriddedManagerWindows();
|
||||
ImGuiMemory.createMemoryWindows();
|
||||
ImGuiEditorWindows.initEditorWindows();
|
||||
ImGuiDrawCell.createDrawCellWindows();
|
||||
ImGuiClientServices.createClientServicesWindows();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,7 +182,7 @@ public class ImGuiWindowMacros {
|
||||
ImGuiNetworkMonitor.netMonitorWindow.setOpen(true);
|
||||
}
|
||||
if(ImGui.button("Client Draw Cell Utils")){
|
||||
ImGuiDrawCell.drawCellWindow.setOpen(true);
|
||||
ImGuiClientServices.clientServicesWindow.setOpen(true);
|
||||
}
|
||||
//close button
|
||||
if(ImGui.button("Close")){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user