lotta work
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-03-28 18:18:06 -04:00
parent 028b957b76
commit c64c72e17c
11 changed files with 65 additions and 13 deletions

View File

@ -1357,6 +1357,10 @@ Fix block mesh ray casting bug due to trimesh overlap
Fix block mesh samplers incorrectly buffering
Fix block mesh gen algorithm merging quads incorrectly
Make HitboxManager threadsafe
Don't simulate extra frames if we're taking too much time
Fluid sim toggle on client side
Lower duplicate physics frame count
Various code cleanup

View File

@ -136,7 +136,7 @@ public class ClientBlockCellManager {
* Updates all cells in the chunk
*/
public void update(){
Globals.profiler.beginCpuSample("ClientDrawCellManager.update");
Globals.profiler.beginCpuSample("ClientBlockCellManager.update");
if(shouldUpdate && Globals.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3i playerWorldPos = Globals.clientWorldData.convertRealToWorldSpace(playerPos);
@ -148,7 +148,7 @@ public class ClientBlockCellManager {
evaluationMap.clear();
//update all full res cells
WorldOctTreeNode<BlockDrawCell> rootNode = this.chunkTree.getRoot();
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - full res cells");
Globals.profiler.beginCpuSample("ClientBlockCellManager.update - full res cells");
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerWorldPos, evaluationMap, BlockChunkData.LOD_LOWEST_RES, distCache);
Globals.profiler.endCpuSample();
if(!updatedLastFrame && !this.initialized){

View File

@ -171,7 +171,7 @@ public class ClientSimulation {
Globals.clientTerrainManager.handleMessages();
this.updateTerrainCellManager();
}
if(Globals.clientFluidManager != null){
if(Globals.clientFluidManager != null && Globals.RUN_FLUIDS){
Globals.clientFluidManager.handleMessages();
this.updateFluidCellManager();
}
@ -200,7 +200,7 @@ public class ClientSimulation {
*/
private void updateFluidCellManager(){
//fluid work
if(Globals.fluidCellManager != null && Globals.clientWorldData != null){
if(Globals.fluidCellManager != null && Globals.clientWorldData != null && Globals.RUN_FLUIDS){
Globals.fluidCellManager.update();
}
}

View File

@ -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.
* This keeps the physics simulation much more stable than it would be otherwise.
*/
public static final int PHYSICS_SIMULATION_RESOLUTION = 5;
public static final int PHYSICS_SIMULATION_RESOLUTION = 2;
/**
* Threshold after which the engine warns about collidable count

View File

@ -335,6 +335,11 @@ public class Main {
int simFrameHardcapCounter = 0;
while(Globals.timekeeper.pullFromAccumulator() && framestep > 0 && simFrameHardcapCounter < Timekeeper.SIM_FRAME_HARDCAP){
//do not simulate extra frames if we're already behind schedule
if(Globals.timekeeper.getMostRecentRawFrametime() > Globals.timekeeper.getSimFrameTime() && simFrameHardcapCounter > 0){
break;
}
//sim frame hard cap counter increment
simFrameHardcapCounter++;
//handle framestep

View File

@ -377,7 +377,7 @@ public class ClientLoading {
//wait for all the terrain data to arrive
WindowUtils.updateLoadingWindow("REQUESTING FLUID CHUNKS FROM SERVER (" + Globals.fluidCellManager.getUnrequestedSize() + ")");
while(blockForInit && Globals.fluidCellManager.containsUnrequestedCell() && Globals.threadManager.shouldKeepRunning()){
while(blockForInit && Globals.fluidCellManager.containsUnrequestedCell() && Globals.threadManager.shouldKeepRunning() && Globals.RUN_FLUIDS){
try {
TimeUnit.MILLISECONDS.sleep(10);
} catch (InterruptedException ex) {

View File

@ -8,6 +8,7 @@ import electrosphere.entity.state.attach.AttachUtils;
import electrosphere.logger.LoggerInterface;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -194,6 +195,14 @@ public class Scene {
return this.entityIdMap.values();
}
/**
* Gets the list of behavior trees attached to the scene
* @return The list of behavior trees attached to the scene
*/
public Collection<BehaviorTree> getBehaviorTrees(){
return Collections.unmodifiableList(this.behaviorTreeList);
}
/**
* Describes the scene in log messages
*/

View File

@ -484,8 +484,8 @@ public class Actor {
Vector3d rVal = new Vector3d();
Model model = Globals.assetManager.fetchModel(modelPath);
if(model != null){
applyAnimationMasks(model);
calculateNodeTransforms(model);
this.applyAnimationMasks(model);
this.calculateNodeTransforms(model);
Bone currentBone = model.getBoneMap().get(boneName);
if(currentBone != null){
Vector4d result = new Matrix4d(currentBone.getFinalTransform()).transform(currentBone.getMOffset().invert().transform(new Vector4d(rVal.x,rVal.y,rVal.z,1)));
@ -495,11 +495,11 @@ public class Actor {
} else {
String message = "Trying to get position of bone that does not exist on model!\n" +
"boneName: " + boneName;
throw new IllegalArgumentException(message);
throw new Error(message);
}
}
if(!Double.isFinite(rVal.x)){
throw new IllegalStateException("Bone position that is not finite!");
throw new Error("Bone position that is not finite!");
}
return rVal;
}
@ -513,8 +513,8 @@ public class Actor {
Quaterniond rVal = new Quaterniond();
Model model = Globals.assetManager.fetchModel(modelPath);
if(model != null){
applyAnimationMasks(model);
calculateNodeTransforms(model);
this.applyAnimationMasks(model);
this.calculateNodeTransforms(model);
Bone currentBone = model.getBoneMap().get(boneName);
if(currentBone != null){
Quaterniond rotation = new Matrix4d(currentBone.getFinalTransform()).getNormalizedRotation(new Quaterniond());

View File

@ -387,6 +387,13 @@ public class Model {
//
//bone rotators (turrets, hair, etc)
Bone target_bone = boneMap.get(n.id);
if(target_bone == null){
String message = "Failed to locate bone!\n";
message = message + "bone id: " + n.id + "\n";
message = message + "bone map size: " + boneMap.size() + "\n";
message = message + "bone map key set: " + boneMap.keySet() + "\n";
throw new Error(message);
}
Matrix4d currentTransform = parentTransform.mul(target_bone.getDeform());
if(boneRotators.containsKey(target_bone.boneID)){
currentTransform.rotate(boneRotators.get(target_bone.boneID).getRotation());

View File

@ -208,6 +208,13 @@ public class PoseModel {
//if this is a bone, calculate the transform for the bone
if(n.is_bone){
Bone target_bone = boneMap.get(n.id);
if(target_bone == null){
String message = "Failed to locate bone!\n";
message = message + "bone id: " + n.id + "\n";
message = message + "bone map size: " + boneMap.size() + "\n";
message = message + "bone map key set: " + boneMap.keySet() + "\n";
throw new Error(message);
}
Matrix4d deformTransform = parentTransform.mul(target_bone.getDeform());
if(boneRotators.containsKey(target_bone.boneID)){
deformTransform.rotate(boneRotators.get(target_bone.boneID).getRotation());

View File

@ -17,8 +17,14 @@ import electrosphere.server.poseactor.PoseActor;
*/
public class MicroSimulation {
/**
* Tracks whether the micro simulation is ready or not
*/
boolean isReady = false;
/**
* Constructor
*/
public MicroSimulation(){
isReady = false;
}
@ -28,7 +34,7 @@ public class MicroSimulation {
* @param dataCell The data cell
*/
public void simulate(ServerDataCell dataCell){
Globals.profiler.beginAggregateCpuSample("MicroSimulation.simulate");
Globals.profiler.beginCpuSample("MicroSimulation.simulate");
if(dataCell.isReady()){
//simulate ai
Globals.aiManager.simulate();
@ -62,18 +68,32 @@ public class MicroSimulation {
Globals.profiler.endCpuSample();
}
/**
* Checks whether the micro simulation is ready or not
* @return true if it is ready, false otherwise
*/
public boolean isReady(){
return isReady;
}
/**
* Sets whether the micro simulation is ready or not
* @param ready true if it is ready, false otherwise
*/
public void setReady(boolean ready){
isReady = ready;
}
/**
* Freezes the micro simulation
*/
public void freeze(){
isReady = false;
}
/**
* Unfreezes the micro simulation
*/
public void unfreeze(){
isReady = true;
}