optimizations
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
da021f889f
commit
50a816adc0
@ -1,3 +1,3 @@
|
|||||||
#maven.buildNumber.plugin properties file
|
#maven.buildNumber.plugin properties file
|
||||||
#Fri Mar 28 12:07:10 EDT 2025
|
#Fri Mar 28 19:50:10 EDT 2025
|
||||||
buildNumber=611
|
buildNumber=612
|
||||||
|
|||||||
@ -1363,6 +1363,8 @@ Lower duplicate physics frame count
|
|||||||
Various code cleanup
|
Various code cleanup
|
||||||
Stop sleeping during high frame time
|
Stop sleeping during high frame time
|
||||||
Actor bone spatial data caching for performance
|
Actor bone spatial data caching for performance
|
||||||
|
Volumetric pipeline optimization
|
||||||
|
Collidable tree simplification
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class CollisionEngine {
|
|||||||
* IE, if this value is 3, every main game engine frame, the physics simulation will run 3 frames.
|
* IE, if this value is 3, every main game engine frame, the physics simulation will run 3 frames.
|
||||||
* This keeps the physics simulation much more stable than it would be otherwise.
|
* This keeps the physics simulation much more stable than it would be otherwise.
|
||||||
*/
|
*/
|
||||||
public static final int PHYSICS_SIMULATION_RESOLUTION = 2;
|
public static final int PHYSICS_SIMULATION_RESOLUTION = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Threshold after which the engine warns about collidable count
|
* Threshold after which the engine warns about collidable count
|
||||||
|
|||||||
@ -1,18 +1,12 @@
|
|||||||
package electrosphere.entity.state.collidable;
|
package electrosphere.entity.state.collidable;
|
||||||
|
|
||||||
import electrosphere.collision.PhysicsUtils;
|
|
||||||
import electrosphere.collision.collidable.Collidable;
|
import electrosphere.collision.collidable.Collidable;
|
||||||
import electrosphere.engine.Globals;
|
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
|
||||||
import electrosphere.entity.btree.BehaviorTree;
|
import electrosphere.entity.btree.BehaviorTree;
|
||||||
import electrosphere.entity.state.gravity.ServerGravityTree;
|
import electrosphere.entity.state.gravity.ServerGravityTree;
|
||||||
import electrosphere.entity.state.movement.fall.ServerFallTree;
|
import electrosphere.entity.state.movement.fall.ServerFallTree;
|
||||||
import electrosphere.server.datacell.Realm;
|
|
||||||
|
|
||||||
import org.joml.Quaterniond;
|
|
||||||
import org.joml.Vector3d;
|
|
||||||
import org.ode4j.ode.DBody;
|
import org.ode4j.ode.DBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,9 +36,6 @@ public class ServerCollidableTree implements BehaviorTree {
|
|||||||
static int incrementer = 0;
|
static int incrementer = 0;
|
||||||
|
|
||||||
public void simulate(float deltaTime){
|
public void simulate(float deltaTime){
|
||||||
Vector3d position = EntityUtils.getPosition(parent);
|
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
|
||||||
Vector3d newPosition = new Vector3d(position);
|
|
||||||
//have we hit a terrain impulse?
|
//have we hit a terrain impulse?
|
||||||
//handle impulses
|
//handle impulses
|
||||||
for(Impulse impulse : collidable.getImpulses()){
|
for(Impulse impulse : collidable.getImpulses()){
|
||||||
@ -57,18 +48,6 @@ public class ServerCollidableTree implements BehaviorTree {
|
|||||||
this.resetGravityFall();
|
this.resetGravityFall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Realm realm = Globals.realmManager.getEntityRealm(parent);
|
|
||||||
//bound to world bounds
|
|
||||||
if(newPosition.x < realm.getServerWorldData().getWorldBoundMin().x){
|
|
||||||
newPosition.x = realm.getServerWorldData().getWorldBoundMin().x;
|
|
||||||
}
|
|
||||||
if(newPosition.y < realm.getServerWorldData().getWorldBoundMin().y){
|
|
||||||
newPosition.y = realm.getServerWorldData().getWorldBoundMin().y;
|
|
||||||
}
|
|
||||||
if(newPosition.z < realm.getServerWorldData().getWorldBoundMin().z){
|
|
||||||
newPosition.z = realm.getServerWorldData().getWorldBoundMin().z;
|
|
||||||
}
|
|
||||||
PhysicsUtils.setRigidBodyTransform(realm.getCollisionEngine(), newPosition, rotation, body);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
//
|
//
|
||||||
// D R A W A L L E N T I T I E S
|
// D R A W A L L E N T I T I E S
|
||||||
//
|
//
|
||||||
|
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids non-instanced");
|
||||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||||
if(shouldDrawSolidPass(currentEntity)){
|
if(shouldDrawSolidPass(currentEntity)){
|
||||||
@ -86,7 +87,11 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
currentActor.draw(renderPipelineState,openGLState);
|
currentActor.draw(renderPipelineState,openGLState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
|
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids Foliage");
|
||||||
Globals.renderingEngine.getFoliagePipeline().render(openGLState, renderPipelineState);
|
Globals.renderingEngine.getFoliagePipeline().render(openGLState, renderPipelineState);
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
|
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids instanced");
|
||||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
||||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||||
if(shouldDrawSolidPass(currentEntity)){
|
if(shouldDrawSolidPass(currentEntity)){
|
||||||
@ -115,6 +120,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
//draw all instanced models
|
//draw all instanced models
|
||||||
Globals.clientInstanceManager.draw(renderPipelineState, openGLState);
|
Globals.clientInstanceManager.draw(renderPipelineState, openGLState);
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
this.firstPersonSubPipeline.render(openGLState, renderPipelineState);
|
this.firstPersonSubPipeline.render(openGLState, renderPipelineState);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -149,7 +155,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
//TLDR OF ABOVE: DO NOT DRAW TRANSPARENT OBJECTS IN OPAQUE PASS
|
//TLDR OF ABOVE: DO NOT DRAW TRANSPARENT OBJECTS IN OPAQUE PASS
|
||||||
//
|
//
|
||||||
|
|
||||||
|
Globals.profiler.beginCpuSample("MainContentPipeline.render - Transparents non-instanced");
|
||||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||||
if(shouldDrawTransparentPass(currentEntity)){
|
if(shouldDrawTransparentPass(currentEntity)){
|
||||||
@ -167,6 +173,8 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
currentActor.draw(renderPipelineState,openGLState);
|
currentActor.draw(renderPipelineState,openGLState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
|
Globals.profiler.beginCpuSample("MainContentPipeline.render - Transparents instanced");
|
||||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
||||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||||
if(shouldDrawTransparentPass(currentEntity)){
|
if(shouldDrawTransparentPass(currentEntity)){
|
||||||
@ -195,6 +203,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
//draw all instanced models
|
//draw all instanced models
|
||||||
Globals.clientInstanceManager.draw(renderPipelineState,openGLState);
|
Globals.clientInstanceManager.draw(renderPipelineState,openGLState);
|
||||||
|
Globals.profiler.endCpuSample();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package electrosphere.renderer.pipelines;
|
package electrosphere.renderer.pipelines;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
@ -23,6 +25,10 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
@Override
|
@Override
|
||||||
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
||||||
Globals.profiler.beginCpuSample("VolumeBufferPipeline.render");
|
Globals.profiler.beginCpuSample("VolumeBufferPipeline.render");
|
||||||
|
|
||||||
|
Set<Entity> depthEntities = Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS);
|
||||||
|
|
||||||
|
if(depthEntities != null && depthEntities.size() > 0){
|
||||||
Matrix4d modelTransformMatrix = new Matrix4d();
|
Matrix4d modelTransformMatrix = new Matrix4d();
|
||||||
|
|
||||||
//set the viewport to shadow map size
|
//set the viewport to shadow map size
|
||||||
@ -150,6 +156,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
openGLState.glBindFramebuffer(GL40.GL_FRAMEBUFFER,0);
|
openGLState.glBindFramebuffer(GL40.GL_FRAMEBUFFER,0);
|
||||||
//resume culling backface
|
//resume culling backface
|
||||||
GL40.glDisable(GL40.GL_CULL_FACE);
|
GL40.glDisable(GL40.GL_CULL_FACE);
|
||||||
|
}
|
||||||
|
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user