interaction engine debug visualization
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-18 13:04:04 -04:00
parent edec17fc40
commit 7320d3e04f
5 changed files with 37 additions and 5 deletions

View File

@ -10,9 +10,9 @@
"onInteract" : "harvest",
"interactionShape" : {
"type" : "CUBE",
"dimension1" : 0.3,
"dimension2" : 0.3,
"dimension3" : 0.3,
"dimension1" : 0.4,
"dimension2" : 0.4,
"dimension3" : 0.4,
"rotX": 0,
"rotY": 0,
"rotZ": 0,

View File

@ -1872,6 +1872,7 @@ Shuffle entity data package
Rename structure -> virtualstructure
Update hometown storage on characters
Filter test scenes out of level selection
Visualize interaction engine collidables

View File

@ -53,6 +53,9 @@ public class ImGuiRenderer {
if(ImGui.button("Draw Grid Alignment Data")){
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawGridAlignment(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawGridAlignment());
}
if(ImGui.button("Draw Interaction Collidable Data")){
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawInteractionCollidables(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawInteractionCollidables());
}
ImGui.unindent();
}
if(ImGui.collapsingHeader("OpenGL Details")){

View File

@ -52,6 +52,7 @@ public class UserSettings {
boolean graphicsDebugDrawMovementVectors;
boolean graphicsDebugDrawNavmesh;
boolean graphicsDebugDrawGridAlignment;
boolean graphicsDebugDrawInteractionCollidables;
//debug network
boolean netRunNetMonitor;
@ -203,6 +204,21 @@ public class UserSettings {
this.graphicsDebugDrawGridAlignment = graphicsDebugDrawGridAlignment;
}
/**
* Checs if should render the interaction engine collidables
* @return true to render them, false otherwise
*/
public boolean getGraphicsDebugDrawInteractionCollidables() {
return graphicsDebugDrawInteractionCollidables;
}
/**
* Sets whether should render the interaction engine collidables
* @param graphicsDebugDrawInteractionCollidables true to render, false otherwise
*/
public void setGraphicsDebugDrawInteractionCollidables(boolean graphicsDebugDrawInteractionCollidables) {
this.graphicsDebugDrawInteractionCollidables = graphicsDebugDrawInteractionCollidables;
}

View File

@ -105,6 +105,18 @@ public class DebugContentPipeline implements RenderPipeline {
}
}
//render interaction engine collidables
if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawInteractionCollidables()){
CollisionEngine engine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
for(Collidable collidable : engine.getCollidables()){
Entity physicsEntity = collidable.getParent();
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && physicsEntity.getData(EntityDataStrings.INTERACTION_TEMPLATE) != null){
CollidableTemplate template = (CollidableTemplate)physicsEntity.getData(EntityDataStrings.INTERACTION_TEMPLATE);
DebugContentPipeline.renderCollidable(openGLState, renderPipelineState, modelTransformMatrix, physicsEntity, template);
}
}
}
//render current structure data
if(
Globals.clientState.clientLevelEditorData.getCurrentFab() != null &&
@ -231,7 +243,7 @@ public class DebugContentPipeline implements RenderPipeline {
*/
static void renderCollidable(OpenGLState openGLState, RenderPipelineState renderPipelineState, Matrix4d modelTransformMatrix, Entity physicsEntity, CollidableTemplate template){
Model physicsGraphicsModel;
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE) != null){
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){
switch(template.getType()){
case CollidableTemplate.COLLIDABLE_TYPE_CYLINDER: {
if((physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCYLINDER)) != null){
@ -271,7 +283,7 @@ public class DebugContentPipeline implements RenderPipeline {
}
} break;
case CollidableTemplate.COLLIDABLE_TYPE_CAPSULE: {
if((physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCAPSULE)) != null){
if((physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCYLINDER)) != null){
//set color based on collision status, type, etc
Texture texture = Globals.assetManager.fetchTexture(AssetDataStrings.TEXTURE_BLUE_TRANSPARENT);
if(texture != null){