more debug menus
	
		
			
	
		
	
	
		
	
		
			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
							
								
									263d6680ee
								
							
						
					
					
						commit
						1cc4924c3b
					
				| @ -316,7 +316,7 @@ | ||||
|                             "priorityCategory": "MOVEMENT_MODIFIER", | ||||
|                             "boneGroups" : ["armLeft", "armRight", "handLeft", "handRight"] | ||||
|                         }, | ||||
|                         "mainAudio" : { | ||||
|                         "windUpAudio" : { | ||||
|                             "audioPath" : "Audio/weapons/swordUnsheath1.ogg" | ||||
|                         }, | ||||
|                         "defaults" : [ | ||||
| @ -334,7 +334,7 @@ | ||||
|                             "priorityCategory": "MOVEMENT_MODIFIER", | ||||
|                             "boneGroups" : ["armLeft", "armRight", "handLeft", "handRight"] | ||||
|                         }, | ||||
|                         "mainAudio" : { | ||||
|                         "windUpAudio" : { | ||||
|                             "audioPath" : "Audio/weapons/swordUnsheath1.ogg" | ||||
|                         }, | ||||
|                         "defaults" : [ | ||||
|  | ||||
| @ -6,7 +6,9 @@ import java.util.Set; | ||||
| 
 | ||||
| import org.joml.Quaterniond; | ||||
| import org.joml.Vector3d; | ||||
| import org.ode4j.ode.DBody; | ||||
| 
 | ||||
| import electrosphere.collision.PhysicsEntityUtils; | ||||
| import electrosphere.engine.Globals; | ||||
| import electrosphere.entity.Entity; | ||||
| import electrosphere.entity.EntityUtils; | ||||
| @ -52,6 +54,7 @@ public class ImGuiEntityMacros { | ||||
|     private static boolean showFirstPersonTab = false; //first person tab | ||||
|     private static boolean showLinkedEntitiesTab = false;//show linked entities | ||||
|     private static boolean showServerViewDirTab = false; //show server view dir | ||||
|     private static boolean showPhysicsTab = false; //show physics values | ||||
| 
 | ||||
|     /** | ||||
|      * Creates the windows in this file | ||||
| @ -123,6 +126,9 @@ public class ImGuiEntityMacros { | ||||
|                     if(ServerPlayerViewDirTree.hasTree(detailViewEntity) && ImGui.checkbox("Server View Dir", showServerViewDirTab)){ | ||||
|                         showServerViewDirTab = !showServerViewDirTab; | ||||
|                     } | ||||
|                     if(PhysicsEntityUtils.getDBody(detailViewEntity) != null && ImGui.checkbox("Physics", showPhysicsTab)){ | ||||
|                         showPhysicsTab = !showPhysicsTab; | ||||
|                     } | ||||
|                     ImGui.treePop(); | ||||
|                 } | ||||
|                 ImGui.nextColumn(); | ||||
| @ -131,6 +137,7 @@ public class ImGuiEntityMacros { | ||||
|                 drawFirstPersonView(); | ||||
|                 drawLinkedEntities(); | ||||
|                 drawServerViewDir(); | ||||
|                 drawPhysicsDetails(); | ||||
|             } | ||||
|         }); | ||||
|         clientEntityDetailWindow.setOpen(false); | ||||
| @ -399,6 +406,23 @@ public class ImGuiEntityMacros { | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             if(Globals.clientSceneWrapper.getScene().getEntityFromId(detailViewEntity.getId()) != null){ | ||||
|                 //detailViewEntity is a client entity | ||||
|                 //get server entity | ||||
|                 int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId()); | ||||
|                 Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity); | ||||
|                 if(serverEntity != null && ImGui.button("Server Entity")){ | ||||
|                     showEntity(serverEntity); | ||||
|                 } | ||||
|             } else if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){ | ||||
|                 //detailViewEntity is a server entity | ||||
|                 //get client entity | ||||
|                 int clientId = Globals.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId()); | ||||
|                 Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntityFromId(clientId); | ||||
|                 if(clientEntity != null && ImGui.button("Client Entity")){ | ||||
|                     showEntity(clientEntity); | ||||
|                 } | ||||
|             } | ||||
|             ImGui.unindent(); | ||||
|         } | ||||
|     } | ||||
| @ -418,6 +442,61 @@ public class ImGuiEntityMacros { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Physics details | ||||
|      */ | ||||
|     protected static void drawPhysicsDetails(){ | ||||
|         if(showPhysicsTab && ImGui.collapsingHeader("Physics")){ | ||||
|             ImGui.indent(); | ||||
|             if(PhysicsEntityUtils.getDBody(detailViewEntity) != null){ | ||||
|                 DBody physicsBody = PhysicsEntityUtils.getDBody(detailViewEntity); | ||||
|                 if(physicsBody != null){ | ||||
|                     ImGui.text("Position (Server): " + EntityUtils.getPosition(detailViewEntity)); | ||||
|                     ImGui.text("Rotation (Server): " + EntityUtils.getRotation(detailViewEntity)); | ||||
|                     ImGui.text("Velocity (Server): " + physicsBody.getLinearVel()); | ||||
|                     ImGui.text("Force (Server): " + physicsBody.getForce()); | ||||
|                     ImGui.text("Move Vector (Server): " + CreatureUtils.getFacingVector(detailViewEntity)); | ||||
|                     ImGui.text("Velocity (Server): " + CreatureUtils.getVelocity(detailViewEntity)); | ||||
|                 } | ||||
|                 //synchronized data | ||||
|                 if(Globals.clientSceneWrapper.getScene().getEntityFromId(detailViewEntity.getId()) != null){ | ||||
|                     //detailViewEntity is a client entity | ||||
|                     //get server entity | ||||
|                     int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()); | ||||
|                     Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity); | ||||
|                     DBody serverPhysicsBody = PhysicsEntityUtils.getDBody(serverEntity); | ||||
|                     if(serverPhysicsBody != null){ | ||||
|                         ImGui.newLine(); | ||||
|                         ImGui.text("Linked server entity:"); | ||||
|                         ImGui.text("Position (Server): " + EntityUtils.getPosition(serverEntity)); | ||||
|                         ImGui.text("Rotation (Server): " + EntityUtils.getRotation(serverEntity)); | ||||
|                         ImGui.text("Velocity (Server): " + serverPhysicsBody.getLinearVel()); | ||||
|                         ImGui.text("Force (Server): " + serverPhysicsBody.getForce()); | ||||
|                         ImGui.text("Move Vector (Server): " + CreatureUtils.getFacingVector(serverEntity)); | ||||
|                         ImGui.text("Velocity (Server): " + CreatureUtils.getVelocity(serverEntity)); | ||||
|                     } | ||||
|                 } else if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){ | ||||
|                     //detailViewEntity is a server entity | ||||
|                     //get client entity | ||||
|                     int clientId = Globals.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId()); | ||||
|                     Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntityFromId(clientId); | ||||
|                     DBody clientPhysicsBody = PhysicsEntityUtils.getDBody(clientEntity); | ||||
|                     if(clientPhysicsBody != null){ | ||||
|                         ImGui.newLine(); | ||||
|                         ImGui.text("Linked client entity:"); | ||||
|                         ImGui.text("Position (Server): " + EntityUtils.getPosition(clientEntity)); | ||||
|                         ImGui.text("Rotation (Server): " + EntityUtils.getRotation(clientEntity)); | ||||
|                         ImGui.text("Velocity (Server): " + clientPhysicsBody.getLinearVel()); | ||||
|                         ImGui.text("Force (Server): " + clientPhysicsBody.getForce()); | ||||
|                         ImGui.text("Move Vector (Server): " + CreatureUtils.getFacingVector(clientEntity)); | ||||
|                         ImGui.text("Velocity (Server): " + CreatureUtils.getVelocity(clientEntity)); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             ImGui.unindent(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Gets the displayed name of an entity (ie creature type, foliage type, terrain, etc) | ||||
|      * @param entity | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user