debug rendering of server physics objects
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-28 16:19:52 -04:00
parent d12353b2cf
commit 9309263036
5 changed files with 51 additions and 14 deletions

View File

@ -2027,6 +2027,7 @@ Improvement to building placement math in TownLayout
Scaffold character job data Scaffold character job data
Moving data packages around Moving data packages around
Fix client LOD tree re-enabling physics positioning Fix client LOD tree re-enabling physics positioning
Debug rendering of server physics objects

View File

@ -50,8 +50,11 @@ public class ImGuiRenderer {
if(ImGui.button("Draw Server Hitboxes")){ if(ImGui.button("Draw Server Hitboxes")){
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawCollisionSpheresServer(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresServer()); Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawCollisionSpheresServer(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresServer());
} }
if(ImGui.button("Draw Physics Objects")){ if(ImGui.button("Draw Physics Objects (client)")){
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjects(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjects()); Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjectsClient(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjectsClient());
}
if(ImGui.button("Draw Physics Objects (server)")){
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjectsServer(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjectsServer());
} }
if(ImGui.button("Draw Grid Alignment Data")){ if(ImGui.button("Draw Grid Alignment Data")){
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawGridAlignment(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawGridAlignment()); Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawGridAlignment(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawGridAlignment());

View File

@ -277,14 +277,24 @@ public class MenuGeneratorsInGame {
scrollable.addChild(toggleServerCollisionSpheresButton); scrollable.addChild(toggleServerCollisionSpheresButton);
//label (toggle draw physics objects) //label (toggle draw physics objects)
Button togglePhysicsObjectsButton = Button.createButton("Toggle draw physics objects", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){ Button togglePhysicsObjectsClientButton = Button.createButton("Toggle draw physics objects (client)", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
// Main.running = false; // Main.running = false;
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjects(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjects()); Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjectsClient(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjectsClient());
return false; return false;
}}); }});
togglePhysicsObjectsButton.setMarginTop(BUTTON_MARGIN); togglePhysicsObjectsClientButton.setMarginTop(BUTTON_MARGIN);
togglePhysicsObjectsButton.setMarginLeft(BUTTON_MARGIN); togglePhysicsObjectsClientButton.setMarginLeft(BUTTON_MARGIN);
scrollable.addChild(togglePhysicsObjectsButton); scrollable.addChild(togglePhysicsObjectsClientButton);
//label (toggle draw physics objects)
Button togglePhysicsObjectsServerButton = Button.createButton("Toggle draw physics objects (server)", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
// Main.running = false;
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjectsServer(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjectsServer());
return false;
}});
togglePhysicsObjectsServerButton.setMarginTop(BUTTON_MARGIN);
togglePhysicsObjectsServerButton.setMarginLeft(BUTTON_MARGIN);
scrollable.addChild(togglePhysicsObjectsServerButton);
//toggle draw grid alignment data //toggle draw grid alignment data
Button toggleDrawGridAlignmentDataButton = Button.createButton("Toggle draw grid alignment data", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){ Button toggleDrawGridAlignmentDataButton = Button.createButton("Toggle draw grid alignment data", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){

View File

@ -48,7 +48,8 @@ public class UserSettings {
//debug visuals //debug visuals
boolean graphicsDebugDrawCollisionSpheresClient; boolean graphicsDebugDrawCollisionSpheresClient;
boolean graphicsDebugDrawCollisionSpheresServer; boolean graphicsDebugDrawCollisionSpheresServer;
boolean graphicsDebugDrawPhysicsObjects; boolean graphicsDebugDrawPhysicsObjectsClient;
boolean graphicsDebugDrawPhysicsObjectsServer;
boolean graphicsDebugDrawMovementVectors; boolean graphicsDebugDrawMovementVectors;
boolean graphicsDebugDrawNavmesh; boolean graphicsDebugDrawNavmesh;
boolean graphicsDebugDrawGridAlignment; boolean graphicsDebugDrawGridAlignment;
@ -101,8 +102,12 @@ public class UserSettings {
return graphicsDebugDrawCollisionSpheresServer; return graphicsDebugDrawCollisionSpheresServer;
} }
public boolean graphicsDebugDrawPhysicsObjects() { public boolean graphicsDebugDrawPhysicsObjectsClient() {
return graphicsDebugDrawPhysicsObjects; return graphicsDebugDrawPhysicsObjectsClient;
}
public boolean graphicsDebugDrawPhysicsObjectsServer() {
return graphicsDebugDrawPhysicsObjectsServer;
} }
public boolean graphicsDebugDrawMovementVectors() { public boolean graphicsDebugDrawMovementVectors() {
@ -154,8 +159,12 @@ public class UserSettings {
this.graphicsDebugDrawCollisionSpheresServer = draw; this.graphicsDebugDrawCollisionSpheresServer = draw;
} }
public void setGraphicsDebugDrawPhysicsObjects(boolean draw){ public void setGraphicsDebugDrawPhysicsObjectsClient(boolean draw){
this.graphicsDebugDrawPhysicsObjects = draw; this.graphicsDebugDrawPhysicsObjectsClient = draw;
}
public void setGraphicsDebugDrawPhysicsObjectsServer(boolean draw){
this.graphicsDebugDrawPhysicsObjectsServer = draw;
} }
public void setGraphicsDebugDrawMovementVectors(boolean draw){ public void setGraphicsDebugDrawMovementVectors(boolean draw){
@ -282,7 +291,8 @@ public class UserSettings {
rVal.graphicsDebugDrawCollisionSpheresClient = false; rVal.graphicsDebugDrawCollisionSpheresClient = false;
rVal.graphicsDebugDrawCollisionSpheresServer = false; rVal.graphicsDebugDrawCollisionSpheresServer = false;
rVal.graphicsDebugDrawMovementVectors = false; rVal.graphicsDebugDrawMovementVectors = false;
rVal.graphicsDebugDrawPhysicsObjects = false; rVal.graphicsDebugDrawPhysicsObjectsClient = false;
rVal.graphicsDebugDrawPhysicsObjectsServer = false;
rVal.graphicsDebugDrawNavmesh = false; rVal.graphicsDebugDrawNavmesh = false;
rVal.graphicsPerformanceLODChunkRadius = 5; rVal.graphicsPerformanceLODChunkRadius = 5;
rVal.graphicsFOV = 90.0f; rVal.graphicsFOV = 90.0f;

View File

@ -101,7 +101,8 @@ public class DebugContentPipeline implements RenderPipeline {
} }
} }
if(Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjects()){ //render client physics objects
if(Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjectsClient()){
CollisionEngine engine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); CollisionEngine engine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
for(Collidable collidable : engine.getCollidables()){ for(Collidable collidable : engine.getCollidables()){
Entity physicsEntity = collidable.getParent(); Entity physicsEntity = collidable.getParent();
@ -112,6 +113,18 @@ public class DebugContentPipeline implements RenderPipeline {
} }
} }
//render server physics objects
if(Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjectsServer()){
CollisionEngine engine = Globals.serverState.realmManager.first().getCollisionEngine();
for(Collidable collidable : engine.getCollidables()){
Entity physicsEntity = collidable.getParent();
if(physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE) != null){
CollidableTemplate template = (CollidableTemplate)physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE);
DebugContentPipeline.renderCollidable(openGLState, renderPipelineState, modelTransformMatrix, physicsEntity, template);
}
}
}
//render interaction engine collidables //render interaction engine collidables
if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawInteractionCollidables()){ if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawInteractionCollidables()){
CollisionEngine engine = Globals.clientState.clientSceneWrapper.getInteractionEngine(); CollisionEngine engine = Globals.clientState.clientSceneWrapper.getInteractionEngine();