significant framerate improvement

This commit is contained in:
austin 2024-02-25 20:43:13 -05:00
parent fa11fc9bec
commit 260043092d
6 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Sun Feb 25 14:43:29 EST 2024
buildNumber=13
#Sun Feb 25 20:01:36 EST 2024
buildNumber=14

View File

@ -124,6 +124,9 @@ public class CollisionEngine {
case Collidable.TYPE_OBJECT:
receiver.addImpulse(new Impulse(normal, localPosition, worldPos, magnitude, Collidable.TYPE_OBJECT));
break;
case Collidable.TYPE_FOLIAGE_STATIC:
receiver.addImpulse(new Impulse(normal, localPosition, worldPos, magnitude, Collidable.TYPE_OBJECT));
break;
}
break;
case Collidable.TYPE_ITEM:
@ -252,8 +255,9 @@ public class CollisionEngine {
if(
bodyPointerMap.get(b1) != null &&
bodyPointerMap.get(b2) != null &&
!(bodyPointerMap.get(b1).getType() == Collidable.TYPE_TERRAIN &&
bodyPointerMap.get(b2).getType() == Collidable.TYPE_TERRAIN)){
!(bodyPointerMap.get(b1).getType() == Collidable.TYPE_TERRAIN && bodyPointerMap.get(b2).getType() == Collidable.TYPE_TERRAIN) &&
!(bodyPointerMap.get(b1).getType() == Collidable.TYPE_FOLIAGE_STATIC && bodyPointerMap.get(b2).getType() == Collidable.TYPE_FOLIAGE_STATIC)
){
//calculate collisions
int numc = OdeHelper.collide(o1,o2,MAX_CONTACTS,contacts.getGeomBuffer());
//create DContacts based on each collision that occurs

View File

@ -32,6 +32,7 @@ public class Collidable {
public static final String TYPE_ITEM = "item";
public static final String TYPE_FORCE = "force";
public static final String TYPE_OBJECT = "object";
public static final String TYPE_FOLIAGE_STATIC = "foliageStatic";
public Collidable(Entity parent, String type){

View File

@ -378,7 +378,7 @@ public class ProceduralTree {
treeModel.getPhysicsBody().getDimension1(),
treeModel.getPhysicsBody().getDimension2()
);
Collidable collidable = new Collidable(trunkChild, Collidable.TYPE_OBJECT);
Collidable collidable = new Collidable(trunkChild, Collidable.TYPE_FOLIAGE_STATIC);
trunkChild.putData(EntityDataStrings.PHYSICS_COLLISION_BODY, rigidBody);
trunkChild.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_OFFSET, new Vector3f(0,treeModel.getPhysicsBody().getOffsetY(),0));
trunkChild.putData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE, treeModel.getPhysicsBody());

View File

@ -1,6 +1,6 @@
package electrosphere.net.parser.net.raw;
import electrosphere.net.parser.net.message.NetworkMessage;
package electrosphere.net.parser.net.raw;
import electrosphere.net.parser.net.message.NetworkMessage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

View File

@ -49,9 +49,9 @@ public class EnvironmentGenerator {
LoggerInterface.loggerGameLogic.DEBUG("generate forest");
for(int i = 0; i < targetNum; i++){
Vector3d position = new Vector3d(
Globals.serverWorldData.convertWorldToReal(worldPos.x) + rand.nextFloat() * 5,
Globals.serverWorldData.convertWorldToReal(worldPos.x) + rand.nextFloat() * 16,
0,
Globals.serverWorldData.convertWorldToReal(worldPos.z) + rand.nextFloat() * 5
Globals.serverWorldData.convertWorldToReal(worldPos.z) + rand.nextFloat() * 16
);
Entity tree = FoliageUtils.serverSpawnTreeFoliage(realm, position, "oak", rand.nextLong());
}