small render pipeline fix

This commit is contained in:
austin 2024-09-04 20:30:47 -04:00
parent 89f2d9c60a
commit 7606b702d1
5 changed files with 34 additions and 60 deletions

View File

@ -367,15 +367,15 @@
}, },
"collidable" : { "collidable" : {
"type" : "CYLINDER", "type" : "CYLINDER",
"dimension1" : 0.1, "dimension1" : 0.2,
"dimension2" : 0.8, "dimension2" : 1.6,
"dimension3" : 0.1, "dimension3" : 0.2,
"rotX": 0, "rotX": 0,
"rotY": 0, "rotY": 0,
"rotZ": 0, "rotZ": 0,
"rotW": 1, "rotW": 1,
"offsetX" : 0, "offsetX" : 0,
"offsetY" : 0.4, "offsetY" : 0.8,
"offsetZ" : 0, "offsetZ" : 0,
"angularlyStatic" : true "angularlyStatic" : true
}, },

Binary file not shown.

View File

@ -687,6 +687,8 @@ Viewport loading
Fix viewport realm server data cell not being flagged as ready Fix viewport realm server data cell not being flagged as ready
Fix NPEs on property lookups on entities Fix NPEs on property lookups on entities
Unit tests for above Unit tests for above
Fix physics debug rendering pipeline
Update human collidable data
# TODO # TODO

View File

@ -597,6 +597,7 @@ public class Globals {
assetManager.addModelPathToQueue("Models/basic/geometry/unitsphere_grey.fbx"); assetManager.addModelPathToQueue("Models/basic/geometry/unitsphere_grey.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/SmallCube.fbx"); assetManager.addModelPathToQueue("Models/basic/geometry/SmallCube.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcylinder.fbx"); assetManager.addModelPathToQueue("Models/basic/geometry/unitcylinder.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcylinder.glb");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcapsule.glb"); assetManager.addModelPathToQueue("Models/basic/geometry/unitcapsule.glb");
assetManager.addModelPathToQueue("Models/basic/geometry/unitplane.fbx"); assetManager.addModelPathToQueue("Models/basic/geometry/unitplane.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcube.fbx"); assetManager.addModelPathToQueue("Models/basic/geometry/unitcube.fbx");

View File

@ -89,7 +89,6 @@ public class DebugContentPipeline implements RenderPipeline {
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
modelTransformMatrix.identity(); modelTransformMatrix.identity();
modelTransformMatrix.translate(cameraModifiedPosition); modelTransformMatrix.translate(cameraModifiedPosition);
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
modelTransformMatrix.scale(sphereView.getRadius() * 2); modelTransformMatrix.scale(sphereView.getRadius() * 2);
hitboxModel.setModelMatrix(modelTransformMatrix); hitboxModel.setModelMatrix(modelTransformMatrix);
hitboxModel.draw(renderPipelineState,openGLState); hitboxModel.draw(renderPipelineState,openGLState);
@ -123,49 +122,6 @@ public class DebugContentPipeline implements RenderPipeline {
} }
} }
} }
// for(Entity currentHitbox : Globals.clientHitboxManager.getAllHitboxes()){
// if((boolean)currentHitbox.getData(EntityDataStrings.DATA_STRING_DRAW)){
// Model hitboxModel;
// HitboxData data = HitboxUtils.getHitboxData(currentHitbox);
// if(data.isActive()){
// if(data.getType().equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HURT)){
// if((hitboxModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitsphere.fbx")) != null){
// Vector3d position = EntityUtils.getPosition(currentHitbox);
// //calculate camera-modified vector3f
// Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
// modelTransformMatrix.identity();
// modelTransformMatrix.translate(cameraModifiedPosition);
// // modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
// modelTransformMatrix.scale(data.getRadius() * 2);
// hitboxModel.setModelMatrix(modelTransformMatrix);
// hitboxModel.draw(renderPipelineState,openGLState);
// }
// } else if(data.getType().equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HIT)){
// if((hitboxModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitsphere_1.fbx")) != null){
// Vector3d position = EntityUtils.getPosition(currentHitbox);
// //calculate camera-modified vector3f
// Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
// modelTransformMatrix.identity();
// modelTransformMatrix.translate(cameraModifiedPosition);
// // modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
// modelTransformMatrix.scale(data.getRadius() * 2);
// hitboxModel.setModelMatrix(modelTransformMatrix);
// hitboxModel.draw(renderPipelineState,openGLState);
// }
// }
// } else {
// if((hitboxModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitsphere_grey.fbx")) != null){
// Vector3d position = EntityUtils.getPosition(currentHitbox);
// modelTransformMatrix.identity();
// modelTransformMatrix.translate(new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)));
// // modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
// modelTransformMatrix.scale(data.getRadius() * 2);
// hitboxModel.setModelMatrix(modelTransformMatrix);
// hitboxModel.draw(renderPipelineState,openGLState);
// }
// }
// }
// }
} }
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){ if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
Model hitboxModel; Model hitboxModel;
@ -188,7 +144,6 @@ public class DebugContentPipeline implements RenderPipeline {
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
modelTransformMatrix.identity(); modelTransformMatrix.identity();
modelTransformMatrix.translate(cameraModifiedPosition); modelTransformMatrix.translate(cameraModifiedPosition);
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
modelTransformMatrix.scale(sphereView.getRadius() * 2); modelTransformMatrix.scale(sphereView.getRadius() * 2);
hitboxModel.setModelMatrix(modelTransformMatrix); hitboxModel.setModelMatrix(modelTransformMatrix);
hitboxModel.draw(renderPipelineState,openGLState); hitboxModel.draw(renderPipelineState,openGLState);
@ -224,9 +179,6 @@ public class DebugContentPipeline implements RenderPipeline {
} }
} }
//update pipeline state to use mats again
renderPipelineState.setUseMaterial(true);
if(Globals.userSettings.graphicsDebugDrawPhysicsObjects()){ if(Globals.userSettings.graphicsDebugDrawPhysicsObjects()){
Model physicsGraphicsModel; Model physicsGraphicsModel;
for(Collidable collidable : Globals.clientSceneWrapper.getCollisionEngine().getCollidables()){ for(Collidable collidable : Globals.clientSceneWrapper.getCollisionEngine().getCollidables()){
@ -235,21 +187,30 @@ public class DebugContentPipeline implements RenderPipeline {
CollidableTemplate template = (CollidableTemplate)physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE); CollidableTemplate template = (CollidableTemplate)physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE);
switch(template.getType()){ switch(template.getType()){
case "CYLINDER": case "CYLINDER":
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcylinder.fbx")) != null){ if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitcylinder.glb")) != null){
//set color based on collision status, type, etc
Texture texture = Globals.assetManager.fetchTexture("Textures/transparent_blue.png");
if(texture != null){
texture.bind(openGLState);
}
Vector3d position = EntityUtils.getPosition(physicsEntity); Vector3d position = EntityUtils.getPosition(physicsEntity);
//calculate camera-modified vector3f //calculate camera-modified vector3f
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
modelTransformMatrix.identity(); modelTransformMatrix.identity();
modelTransformMatrix.translate(cameraModifiedPosition); modelTransformMatrix.translate(cameraModifiedPosition);
modelTransformMatrix.rotate(EntityUtils.getRotation(physicsEntity)); modelTransformMatrix.rotate(EntityUtils.getRotation(physicsEntity));
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
modelTransformMatrix.scale(template.getDimension1(),template.getDimension2() * 0.5,template.getDimension3()); modelTransformMatrix.scale(template.getDimension1(),template.getDimension2() * 0.5,template.getDimension3());
physicsGraphicsModel.setModelMatrix(modelTransformMatrix); physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
physicsGraphicsModel.draw(renderPipelineState,openGLState); physicsGraphicsModel.draw(renderPipelineState,openGLState);
} }
break; break;
case "CUBE": case "CUBE":
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){ if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitcube.fbx")) != null){
//set color based on collision status, type, etc
Texture texture = Globals.assetManager.fetchTexture("Textures/transparent_blue.png");
if(texture != null){
texture.bind(openGLState);
}
Vector3d position = EntityUtils.getPosition(physicsEntity); Vector3d position = EntityUtils.getPosition(physicsEntity);
// Vector3f scale = EntityUtils.getScale(physicsEntity); // Vector3f scale = EntityUtils.getScale(physicsEntity);
Quaterniond rotation = EntityUtils.getRotation(physicsEntity); Quaterniond rotation = EntityUtils.getRotation(physicsEntity);
@ -258,7 +219,6 @@ public class DebugContentPipeline implements RenderPipeline {
modelTransformMatrix.identity(); modelTransformMatrix.identity();
modelTransformMatrix.translate(cameraModifiedPosition); modelTransformMatrix.translate(cameraModifiedPosition);
modelTransformMatrix.rotate(rotation); modelTransformMatrix.rotate(rotation);
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
modelTransformMatrix.scale(template.getDimension1(),template.getDimension2(),template.getDimension3()); modelTransformMatrix.scale(template.getDimension1(),template.getDimension2(),template.getDimension3());
physicsGraphicsModel.setModelMatrix(modelTransformMatrix); physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
physicsGraphicsModel.draw(renderPipelineState,openGLState); physicsGraphicsModel.draw(renderPipelineState,openGLState);
@ -271,7 +231,12 @@ public class DebugContentPipeline implements RenderPipeline {
Entity physicsEntity = collidable.getParent(); Entity physicsEntity = collidable.getParent();
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){ if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){
if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_PLANE)){ if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_PLANE)){
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitplane.fbx")) != null){ if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitplane.fbx")) != null){
//set color based on collision status, type, etc
Texture texture = Globals.assetManager.fetchTexture("Textures/transparent_blue.png");
if(texture != null){
texture.bind(openGLState);
}
Vector3d position = EntityUtils.getPosition(physicsEntity); Vector3d position = EntityUtils.getPosition(physicsEntity);
Vector3f scale = EntityUtils.getScale(physicsEntity); Vector3f scale = EntityUtils.getScale(physicsEntity);
Quaterniond rotation = EntityUtils.getRotation(physicsEntity); Quaterniond rotation = EntityUtils.getRotation(physicsEntity);
@ -280,13 +245,17 @@ public class DebugContentPipeline implements RenderPipeline {
modelTransformMatrix.identity(); modelTransformMatrix.identity();
modelTransformMatrix.translate(cameraModifiedPosition); modelTransformMatrix.translate(cameraModifiedPosition);
modelTransformMatrix.rotate(rotation); modelTransformMatrix.rotate(rotation);
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
modelTransformMatrix.scale(new Vector3d(scale)); modelTransformMatrix.scale(new Vector3d(scale));
physicsGraphicsModel.setModelMatrix(modelTransformMatrix); physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
physicsGraphicsModel.draw(renderPipelineState,openGLState); physicsGraphicsModel.draw(renderPipelineState,openGLState);
} }
} else if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_CUBE)){ } else if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_CUBE)){
if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/unitcube.fbx")) != null){ if((physicsGraphicsModel = Globals.assetManager.fetchModel("Models/basic/geometry/unitcube.fbx")) != null){
//set color based on collision status, type, etc
Texture texture = Globals.assetManager.fetchTexture("Textures/transparent_blue.png");
if(texture != null){
texture.bind(openGLState);
}
Vector3d position = EntityUtils.getPosition(physicsEntity); Vector3d position = EntityUtils.getPosition(physicsEntity);
Vector3f scale = EntityUtils.getScale(physicsEntity); Vector3f scale = EntityUtils.getScale(physicsEntity);
Quaterniond rotation = EntityUtils.getRotation(physicsEntity); Quaterniond rotation = EntityUtils.getRotation(physicsEntity);
@ -295,7 +264,6 @@ public class DebugContentPipeline implements RenderPipeline {
modelTransformMatrix.identity(); modelTransformMatrix.identity();
modelTransformMatrix.translate(cameraModifiedPosition); modelTransformMatrix.translate(cameraModifiedPosition);
modelTransformMatrix.rotate(rotation); modelTransformMatrix.rotate(rotation);
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
modelTransformMatrix.scale(new Vector3d(scale)); modelTransformMatrix.scale(new Vector3d(scale));
physicsGraphicsModel.setModelMatrix(modelTransformMatrix); physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
physicsGraphicsModel.draw(renderPipelineState,openGLState); physicsGraphicsModel.draw(renderPipelineState,openGLState);
@ -305,6 +273,9 @@ public class DebugContentPipeline implements RenderPipeline {
} }
} }
//update pipeline state to use mats again
renderPipelineState.setUseMaterial(true);
if(Globals.userSettings.graphicsDebugDrawNavmesh()){ if(Globals.userSettings.graphicsDebugDrawNavmesh()){
Model shapeGraphicsModel; Model shapeGraphicsModel;
for(NavMesh mesh : Globals.navMeshManager.getMeshes()){ for(NavMesh mesh : Globals.navMeshManager.getMeshes()){