performance work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
545fb1ee8a
commit
9a223159e5
@ -1989,6 +1989,7 @@ Performance improvements
|
|||||||
- Shallow clone on physics cell creation
|
- Shallow clone on physics cell creation
|
||||||
- More vector pool usage
|
- More vector pool usage
|
||||||
- Model anim calculations no longer allocate new matrix4d's
|
- Model anim calculations no longer allocate new matrix4d's
|
||||||
|
- Undo most object pooling
|
||||||
Increase human move speed
|
Increase human move speed
|
||||||
LOD components re-attach physics
|
LOD components re-attach physics
|
||||||
VectorPool->JomlPool
|
VectorPool->JomlPool
|
||||||
|
|||||||
@ -6,8 +6,6 @@ import java.util.List;
|
|||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import electrosphere.mem.JomlPool;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts data structures between formats saved to disk vs formats used in engine
|
* Converts data structures between formats saved to disk vs formats used in engine
|
||||||
*/
|
*/
|
||||||
@ -45,12 +43,12 @@ public class DataFormatUtil {
|
|||||||
*/
|
*/
|
||||||
public static Vector3d getDoubleListAsVector(List<Double> values){
|
public static Vector3d getDoubleListAsVector(List<Double> values){
|
||||||
if(values == null){
|
if(values == null){
|
||||||
return JomlPool.getD();
|
return new Vector3d();
|
||||||
}
|
}
|
||||||
if(values.size() > 0){
|
if(values.size() > 0){
|
||||||
return JomlPool.getD(values.get(0),values.get(1),values.get(2));
|
return new Vector3d(values.get(0),values.get(1),values.get(2));
|
||||||
} else {
|
} else {
|
||||||
return JomlPool.getD();
|
return new Vector3d();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import electrosphere.entity.EntityDataStrings;
|
|||||||
import electrosphere.entity.EntityTags;
|
import electrosphere.entity.EntityTags;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.mem.JomlPool;
|
|
||||||
import electrosphere.renderer.actor.Actor;
|
import electrosphere.renderer.actor.Actor;
|
||||||
import electrosphere.server.datacell.ServerDataCell;
|
import electrosphere.server.datacell.ServerDataCell;
|
||||||
import electrosphere.server.datacell.utils.ServerEntityTagUtils;
|
import electrosphere.server.datacell.utils.ServerEntityTagUtils;
|
||||||
@ -347,7 +346,7 @@ public class AttachUtils {
|
|||||||
Vector3d parentScale
|
Vector3d parentScale
|
||||||
){
|
){
|
||||||
//transform bone space
|
//transform bone space
|
||||||
Vector3d position = JomlPool.getD(offsetVector);
|
Vector3d position = new Vector3d(offsetVector);
|
||||||
position = position.rotate(new Quaterniond(boneRotation));
|
position = position.rotate(new Quaterniond(boneRotation));
|
||||||
position = position.add(bonePosition);
|
position = position.add(bonePosition);
|
||||||
position = position.mul(parentScale);
|
position = position.mul(parentScale);
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import electrosphere.entity.EntityUtils;
|
|||||||
import electrosphere.entity.state.attach.AttachUtils;
|
import electrosphere.entity.state.attach.AttachUtils;
|
||||||
import electrosphere.entity.state.hitbox.HitboxCollectionState.HitboxState.HitboxShapeType;
|
import electrosphere.entity.state.hitbox.HitboxCollectionState.HitboxState.HitboxShapeType;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.mem.JomlPool;
|
|
||||||
import electrosphere.server.datacell.Realm;
|
import electrosphere.server.datacell.Realm;
|
||||||
import electrosphere.server.entity.poseactor.PoseActor;
|
import electrosphere.server.entity.poseactor.PoseActor;
|
||||||
import electrosphere.util.math.SpatialMathUtils;
|
import electrosphere.util.math.SpatialMathUtils;
|
||||||
@ -462,7 +461,7 @@ public class HitboxCollectionState {
|
|||||||
Quaterniond offsetRotation = new Quaterniond();
|
Quaterniond offsetRotation = new Quaterniond();
|
||||||
|
|
||||||
//the bone's transform
|
//the bone's transform
|
||||||
Vector3d bonePositionD = JomlPool.getD();
|
Vector3d bonePositionD = new Vector3d();
|
||||||
if(bonePosition != null){
|
if(bonePosition != null){
|
||||||
bonePositionD.set(bonePosition);
|
bonePositionD.set(bonePosition);
|
||||||
}
|
}
|
||||||
@ -471,7 +470,7 @@ public class HitboxCollectionState {
|
|||||||
//the parent's transform
|
//the parent's transform
|
||||||
Vector3d parentPosition = EntityUtils.getPosition(parent);
|
Vector3d parentPosition = EntityUtils.getPosition(parent);
|
||||||
Quaterniond parentRotation = EntityUtils.getRotation(parent);
|
Quaterniond parentRotation = EntityUtils.getRotation(parent);
|
||||||
Vector3d parentScale = JomlPool.getD();
|
Vector3d parentScale = new Vector3d();
|
||||||
parentScale.set(EntityUtils.getScale(parent));
|
parentScale.set(EntityUtils.getScale(parent));
|
||||||
|
|
||||||
//calculate
|
//calculate
|
||||||
@ -480,11 +479,6 @@ public class HitboxCollectionState {
|
|||||||
|
|
||||||
//actually set value
|
//actually set value
|
||||||
PhysicsEntityUtils.setGeometryOffsetPosition(collisionEngine, geom, hitboxPos, new Quaterniond());
|
PhysicsEntityUtils.setGeometryOffsetPosition(collisionEngine, geom, hitboxPos, new Quaterniond());
|
||||||
|
|
||||||
//free vecs used in computation
|
|
||||||
JomlPool.release(bonePositionD);
|
|
||||||
JomlPool.release(parentScale);
|
|
||||||
JomlPool.release(hitboxPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -73,41 +73,6 @@ public class JomlPool {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a Vector3d from the pool. Allocates if no free one is available.
|
|
||||||
* @param source The source to copy from
|
|
||||||
* @return A Vector3d
|
|
||||||
*/
|
|
||||||
public static Vector3d getD(Vector3d source){
|
|
||||||
Vector3d rVal = null;
|
|
||||||
lock.lock();
|
|
||||||
if(vec3dPool.size() > 0){
|
|
||||||
rVal = vec3dPool.remove(0);
|
|
||||||
} else {
|
|
||||||
rVal = new Vector3d();
|
|
||||||
}
|
|
||||||
rVal.set(source);
|
|
||||||
lock.unlock();
|
|
||||||
return rVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a Vector3d from the pool. Allocates if no free one is available.
|
|
||||||
* @return A Vector3d
|
|
||||||
*/
|
|
||||||
public static Vector3d getD(double x, double y, double z){
|
|
||||||
Vector3d rVal = null;
|
|
||||||
lock.lock();
|
|
||||||
if(vec3dPool.size() > 0){
|
|
||||||
rVal = vec3dPool.remove(0);
|
|
||||||
} else {
|
|
||||||
rVal = new Vector3d();
|
|
||||||
}
|
|
||||||
rVal.set(x,y,z);
|
|
||||||
lock.unlock();
|
|
||||||
return rVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases a Vector3d back into the pool
|
* Releases a Vector3d back into the pool
|
||||||
* @param data The object to release
|
* @param data The object to release
|
||||||
|
|||||||
@ -887,7 +887,7 @@ public class Actor {
|
|||||||
}
|
}
|
||||||
Globals.profiler.beginAggregateCpuSample("Actor.isWithinFrustumBox");
|
Globals.profiler.beginAggregateCpuSample("Actor.isWithinFrustumBox");
|
||||||
Sphered sphere = model.getBoundingSphere();
|
Sphered sphere = model.getBoundingSphere();
|
||||||
Vector3d modelPosition = model.getModelMatrix().getTranslation(JomlPool.getD());
|
Vector3d modelPosition = model.getModelMatrix().getTranslation(new Vector3d());
|
||||||
boolean check = renderPipelineState.getFrustumIntersection().testSphere((float)(sphere.x + modelPosition.x), (float)(sphere.y + modelPosition.y), (float)(sphere.z + modelPosition.z), (float)sphere.r);
|
boolean check = renderPipelineState.getFrustumIntersection().testSphere((float)(sphere.x + modelPosition.x), (float)(sphere.y + modelPosition.y), (float)(sphere.z + modelPosition.z), (float)sphere.r);
|
||||||
JomlPool.release(modelPosition);
|
JomlPool.release(modelPosition);
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user