fix + docs + refactor mathutils
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
13d8878425
commit
4d6278d21f
@ -2,8 +2,8 @@
|
||||
"gameplayGenerateWorld" : false,
|
||||
"gameplayPhysicsCellRadius" : 2,
|
||||
|
||||
"displayWidth" : 2560,
|
||||
"displayHeight" : 1600,
|
||||
"displayWidth" : 1920,
|
||||
"displayHeight" : 1080,
|
||||
"displayFullscreen" : false,
|
||||
|
||||
"graphicsFOV" : 100.0,
|
||||
@ -15,8 +15,8 @@
|
||||
"graphicsPerformanceOIT" : true,
|
||||
"graphicsViewRange" : 20000.0,
|
||||
|
||||
"renderResolutionX": 2560,
|
||||
"renderResolutionY": 1600,
|
||||
"renderResolutionX": 1920,
|
||||
"renderResolutionY": 1080,
|
||||
|
||||
"graphicsDebugDrawCollisionSpheresClient" : false,
|
||||
"graphicsDebugDrawCollisionSpheresServer" : false,
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#maven.buildNumber.plugin properties file
|
||||
#Mon Oct 21 09:58:24 EDT 2024
|
||||
buildNumber=363
|
||||
#Mon Oct 28 16:07:42 EDT 2024
|
||||
buildNumber=364
|
||||
|
||||
11
docs/src/architecture/generation/voxelgenideas.md
Normal file
11
docs/src/architecture/generation/voxelgenideas.md
Normal file
@ -0,0 +1,11 @@
|
||||
@page voxelgenideas
|
||||
|
||||
techniques to consider:
|
||||
|
||||
adding different types of noise
|
||||
gradients of different types of noise
|
||||
fractal brownian noise
|
||||
sines pulling from sines
|
||||
noise functions pulling from sines
|
||||
applying 2d values to the surface (top) of a 3d noise map
|
||||
subtracting true 3d noise from a 2d heightmap to account for cave entrances
|
||||
@ -3,4 +3,5 @@
|
||||
[TOC]
|
||||
- @subpage biomeselection
|
||||
- @subpage biomegenerationproblems
|
||||
- @subpage terraingenerationprocess
|
||||
- @subpage terraingenerationprocess
|
||||
- @subpage voxelgenideas
|
||||
@ -906,6 +906,14 @@ Chemistry system collision engine instance on server and client
|
||||
(10/24/2024)
|
||||
CraftingPanel implementation
|
||||
|
||||
(10/27/2024)
|
||||
World gen docs + ideas
|
||||
Update default resolution in config
|
||||
|
||||
(10/28/2024)
|
||||
Fix main menu ui test
|
||||
Refactor math utils to spatial math utils to make room for more fundamental utils
|
||||
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
@ -3,7 +3,7 @@ package electrosphere.audio;
|
||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
@ -197,8 +197,8 @@ public class AudioEngine {
|
||||
listener.setPosition(cameraPos);
|
||||
|
||||
//orientation
|
||||
Vector3d cameraEye = MathUtils.getOriginVector().rotate(CameraEntityUtils.getRotationQuat(Globals.playerCamera)).normalize();
|
||||
Vector3d cameraUp = MathUtils.getUpVector().rotate(CameraEntityUtils.getRotationQuat(Globals.playerCamera)).normalize();
|
||||
Vector3d cameraEye = SpatialMathUtils.getOriginVector().rotate(CameraEntityUtils.getRotationQuat(Globals.playerCamera)).normalize();
|
||||
Vector3d cameraUp = SpatialMathUtils.getUpVector().rotate(CameraEntityUtils.getRotationQuat(Globals.playerCamera)).normalize();
|
||||
listener.setOrientation(new Vector3f((float)cameraEye.x,(float)cameraEye.y,(float)cameraEye.z), new Vector3f((float)cameraUp.x,(float)cameraUp.y,(float)cameraUp.z));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import org.joml.Vector3f;
|
||||
import org.lwjgl.openal.AL11;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
import static org.lwjgl.openal.AL10.*;
|
||||
|
||||
@ -18,7 +18,7 @@ public class AudioListener {
|
||||
Vector3d position = new Vector3d();
|
||||
|
||||
//eye vector for listener
|
||||
Vector3f eye = MathUtils.getOriginVectorf();
|
||||
Vector3f eye = SpatialMathUtils.getOriginVectorf();
|
||||
|
||||
//up vector for listener
|
||||
Vector3f up = new Vector3f(0,1,0);
|
||||
|
||||
@ -8,7 +8,7 @@ import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||
import electrosphere.game.data.common.CommonEntityType;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
import org.joml.Matrix4d;
|
||||
import org.joml.Matrix4f;
|
||||
@ -70,7 +70,7 @@ public class CameraEntityUtils {
|
||||
*/
|
||||
public static Entity spawnPlayerEntityTrackingCameraEntity(){
|
||||
Vector3f center = new Vector3f(0,0,0);
|
||||
Vector3f eye = MathUtils.getOriginVectorf();
|
||||
Vector3f eye = SpatialMathUtils.getOriginVectorf();
|
||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_ORBIT);
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
||||
@ -125,7 +125,7 @@ public class CameraEntityUtils {
|
||||
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity();
|
||||
} else {
|
||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3f(0,0,0), MathUtils.getOriginVectorf());
|
||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3f(0,0,0), SpatialMathUtils.getOriginVectorf());
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ public class CameraEntityUtils {
|
||||
* @return The quaternion
|
||||
*/
|
||||
public static Quaternionf getPitchQuat(double pitch){
|
||||
Quaternionf pitchQuat = new Quaternionf().fromAxisAngleDeg(MathUtils.getLeftVectorf(), -(float)pitch);
|
||||
Quaternionf pitchQuat = new Quaternionf().fromAxisAngleDeg(SpatialMathUtils.getLeftVectorf(), -(float)pitch);
|
||||
return pitchQuat;
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ public class CameraEntityUtils {
|
||||
* @return The quaternion
|
||||
*/
|
||||
public static Quaternionf getYawQuat(double yaw){
|
||||
Quaternionf yawQuat = new Quaternionf().fromAxisAngleDeg(MathUtils.getUpVectorf(), -(float)yaw);
|
||||
Quaternionf yawQuat = new Quaternionf().fromAxisAngleDeg(SpatialMathUtils.getUpVectorf(), -(float)yaw);
|
||||
return yawQuat;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ public class CameraEntityUtils {
|
||||
public static Matrix4f getCameraViewMatrix(Entity camera){
|
||||
Vector3f cameraCenter = new Vector3f(0,0,0);//getViewMatrixCenterOffset(camera);
|
||||
Vector3f cameraEye = new Vector3f(cameraCenter).add(getCameraEye(camera));
|
||||
Vector3f cameraUp = MathUtils.getUpVectorf();
|
||||
Vector3f cameraUp = SpatialMathUtils.getUpVectorf();
|
||||
//!!before you make the same mistake I made, cameraEye is NOT NECESSARILY normalized/unit vector
|
||||
//the orbital distance and offset are included in this vector
|
||||
//TODO: refactor this to some other matrix of transforms or something??
|
||||
@ -318,7 +318,7 @@ public class CameraEntityUtils {
|
||||
Quaternionf quatRaw = CameraEntityUtils.getYawQuat(yaw).mul(CameraEntityUtils.getPitchQuat(pitch)).mul(new Quaternionf().rotateY((float)Math.PI));
|
||||
Quaterniond quatd = new Quaterniond(quatRaw).normalize();
|
||||
Matrix4d rotationMat = new Matrix4d().rotate(quatd);
|
||||
Vector4d rotationVecRaw = MathUtils.getOriginVector4();
|
||||
Vector4d rotationVecRaw = SpatialMathUtils.getOriginVector4();
|
||||
rotationVecRaw = rotationMat.transform(rotationVecRaw);
|
||||
return new Vector3d(rotationVecRaw.x,0,rotationVecRaw.z);
|
||||
}
|
||||
@ -334,7 +334,7 @@ public class CameraEntityUtils {
|
||||
Quaternionf quatRaw = CameraEntityUtils.getYawQuat(yaw).mul(CameraEntityUtils.getPitchQuat(pitch)).mul(new Quaternionf().rotateY((float)Math.PI));
|
||||
Quaterniond quatd = new Quaterniond(quatRaw).normalize();
|
||||
Matrix4d rotationMat = new Matrix4d().rotate(quatd);
|
||||
Vector4d rotationVecRaw = MathUtils.getOriginVector4();
|
||||
Vector4d rotationVecRaw = SpatialMathUtils.getOriginVector4();
|
||||
rotationVecRaw = rotationMat.transform(rotationVecRaw);
|
||||
return new Vector3d(rotationVecRaw.x,0,rotationVecRaw.z);
|
||||
}
|
||||
@ -347,10 +347,10 @@ public class CameraEntityUtils {
|
||||
public static Vector3d getFacingVec(Quaterniond rotation){
|
||||
//quaternion is multiplied by pi because we want to point away from the eye of the camera, NOT towards it
|
||||
Matrix4d rotationMat = new Matrix4d().rotate(rotation);
|
||||
Vector4d rotationVecRaw = MathUtils.getOriginVector4();
|
||||
Vector4d rotationVecRaw = SpatialMathUtils.getOriginVector4();
|
||||
rotationVecRaw = rotationMat.transform(rotationVecRaw);
|
||||
if(rotationVecRaw.length() < 0.001){
|
||||
rotationVecRaw.set(MathUtils.getOriginVector4());
|
||||
rotationVecRaw.set(SpatialMathUtils.getOriginVector4());
|
||||
}
|
||||
return new Vector3d(rotationVecRaw.x,0,rotationVecRaw.z);
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityCreationUtils;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* Debug tools for visualizing things in the game engine
|
||||
@ -43,7 +43,7 @@ public class DebugVisualizerUtils {
|
||||
*/
|
||||
public static Entity clientSpawnVectorVisualizer(Vector3d point1, Vector3d point2){
|
||||
Vector3d position = point1;
|
||||
Quaterniond rotation = MathUtils.calculateRotationFromPointToPoint(point1, point2);
|
||||
Quaterniond rotation = SpatialMathUtils.calculateRotationFromPointToPoint(point1, point2);
|
||||
Vector3d scale = new Vector3d(point1.distance(point2));
|
||||
return clientSpawnVectorVisualizer(position, rotation, scale);
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.net.parser.net.message.EntityMessage;
|
||||
import electrosphere.renderer.ui.events.MouseEvent;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* Handler for camera-related events and controls
|
||||
@ -109,13 +109,13 @@ public class CameraHandler {
|
||||
// CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3f((float)charPos.x,(float)charPos.y,(float)charPos.z));
|
||||
// }
|
||||
|
||||
Quaternionf pitchQuat = new Quaternionf().fromAxisAngleDeg(MathUtils.getLeftVectorf(), -pitch);
|
||||
Quaternionf yawQuat = new Quaternionf().fromAxisAngleDeg(MathUtils.getUpVectorf(), -yaw);
|
||||
Quaternionf pitchQuat = new Quaternionf().fromAxisAngleDeg(SpatialMathUtils.getLeftVectorf(), -pitch);
|
||||
Quaternionf yawQuat = new Quaternionf().fromAxisAngleDeg(SpatialMathUtils.getUpVectorf(), -yaw);
|
||||
// float yawRad = yaw / 180.0f * (float)Math.PI;
|
||||
// float pitchRad = pitch / 180.0f * (float)Math.PI;
|
||||
// float rollRad = 0.0f;
|
||||
// pitchQuat.mul(yawQuat);
|
||||
cameraRotationVector = pitchQuat.transform(MathUtils.getOriginVectorf());
|
||||
cameraRotationVector = pitchQuat.transform(SpatialMathUtils.getOriginVectorf());
|
||||
cameraRotationVector = yawQuat.transform(cameraRotationVector);
|
||||
cameraRotationVector.normalize();
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import electrosphere.entity.btree.BehaviorTree;
|
||||
import electrosphere.entity.state.equip.ClientEquipState;
|
||||
import electrosphere.game.data.particle.ParticleData;
|
||||
import electrosphere.game.data.particle.ParticleEmitter;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* A component that causes the entity to emit particles
|
||||
@ -81,10 +81,10 @@ public class ClientParticleEmitterComponent implements BehaviorTree {
|
||||
Quaterniond rot = new Quaterniond();
|
||||
Vector3d cross = null;
|
||||
Vector3d normalizedVelocity = new Vector3d(initialVelocity).normalize();
|
||||
if(Math.abs(normalizedVelocity.dot(MathUtils.getOriginVector())) < 0.8){
|
||||
cross = MathUtils.getOriginVector().cross(normalizedVelocity);
|
||||
if(Math.abs(normalizedVelocity.dot(SpatialMathUtils.getOriginVector())) < 0.8){
|
||||
cross = SpatialMathUtils.getOriginVector().cross(normalizedVelocity);
|
||||
} else {
|
||||
cross = MathUtils.getUpVector().cross(normalizedVelocity);
|
||||
cross = SpatialMathUtils.getUpVector().cross(normalizedVelocity);
|
||||
}
|
||||
rot.rotateAxis(Math.PI * 2 * particleRand.nextFloat(), normalizedVelocity);
|
||||
rot.rotateAxis((particleRand.nextFloat() * this.particleEmitter.getSpread()) / 180.0 * Math.PI, cross);
|
||||
|
||||
@ -26,7 +26,7 @@ import electrosphere.entity.state.hitbox.HitboxCollectionState.HitboxState.Hitbo
|
||||
import electrosphere.game.data.collidable.HitboxData;
|
||||
import electrosphere.game.data.utils.DataFormatUtil;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* The state of the collection of all hitboxes on this entity
|
||||
@ -405,7 +405,7 @@ public class HitboxCollectionState {
|
||||
//the second quaternion is a rotation along the x axis. This is used to put the hitbox rotation into ode's space
|
||||
//ode is Z-axis-up
|
||||
if(previousWorldPos.distance(worldPosition) > 0.0){
|
||||
worldRotation = MathUtils.calculateRotationFromPointToPoint(previousWorldPos,worldPosition).mul(new Quaterniond(0,0.707,0,0.707));
|
||||
worldRotation = SpatialMathUtils.calculateRotationFromPointToPoint(previousWorldPos,worldPosition).mul(new Quaterniond(0,0.707,0,0.707));
|
||||
}
|
||||
|
||||
//create new capsule
|
||||
|
||||
@ -21,7 +21,7 @@ import electrosphere.net.synchronization.annotation.SynchronizableEnum;
|
||||
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
||||
import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums;
|
||||
import electrosphere.renderer.anim.Animation;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@ -226,14 +226,14 @@ public class ClientEditorMovementTree implements BehaviorTree {
|
||||
movementVector.rotateY((float)(-135 * Math.PI / 180)).normalize();
|
||||
break;
|
||||
case UP: {
|
||||
movementVector = MathUtils.getUpVector();
|
||||
movementVector = SpatialMathUtils.getUpVector();
|
||||
} break;
|
||||
case DOWN: {
|
||||
movementVector = MathUtils.getUpVector().mul(-1);
|
||||
movementVector = SpatialMathUtils.getUpVector().mul(-1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(MathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||
|
||||
//parse attached network messages
|
||||
|
||||
@ -29,7 +29,7 @@ import electrosphere.renderer.anim.Animation;
|
||||
import electrosphere.script.utils.AccessTransforms;
|
||||
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
||||
import electrosphere.server.utils.ServerScriptUtils;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@ -194,14 +194,14 @@ public class ServerEditorMovementTree implements BehaviorTree {
|
||||
movementVector.rotateY((float)(-135 * Math.PI / 180)).normalize();
|
||||
break;
|
||||
case UP: {
|
||||
movementVector = MathUtils.getUpVector();
|
||||
movementVector = SpatialMathUtils.getUpVector();
|
||||
} break;
|
||||
case DOWN: {
|
||||
movementVector = MathUtils.getUpVector().mul(-1);
|
||||
movementVector = SpatialMathUtils.getUpVector().mul(-1);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(MathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||
//TODO: optimize away and document (I know for the moment if this exception isn't here it will bite me in the ass later)
|
||||
if(facingVector.length() == 0){
|
||||
|
||||
@ -29,7 +29,7 @@ import electrosphere.net.synchronization.annotation.SynchronizableEnum;
|
||||
import electrosphere.net.synchronization.annotation.SynchronizedBehaviorTree;
|
||||
import electrosphere.net.synchronization.enums.BehaviorTreeIdEnums;
|
||||
import electrosphere.renderer.anim.Animation;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
import electrosphere.renderer.actor.Actor;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@ -239,7 +239,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(MathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||
|
||||
//parse attached network messages
|
||||
|
||||
@ -33,7 +33,7 @@ import electrosphere.script.utils.AccessTransforms;
|
||||
import electrosphere.server.datacell.utils.DataCellSearchUtils;
|
||||
import electrosphere.server.poseactor.PoseActor;
|
||||
import electrosphere.server.utils.ServerScriptUtils;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@ -207,7 +207,7 @@ public class ServerGroundMovementTree implements BehaviorTree {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(MathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond movementQuaternion = new Quaterniond().rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||
//TODO: optimize away and document (I know for the moment if this exception isn't here it will bite me in the ass later)
|
||||
if(facingVector.length() == 0){
|
||||
|
||||
@ -15,7 +15,7 @@ import electrosphere.entity.state.physicssync.ServerPhysicsSyncTree;
|
||||
import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import electrosphere.server.datacell.Realm;
|
||||
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
public class ServerAlwaysUprightTree implements BehaviorTree {
|
||||
|
||||
@ -48,7 +48,7 @@ public class ServerAlwaysUprightTree implements BehaviorTree {
|
||||
//calculate rotation based on facing vector
|
||||
if(CreatureUtils.getFacingVector(parent) != null){
|
||||
Vector3d facingVector = CreatureUtils.getFacingVector(parent);
|
||||
sourceRotation = new Quaterniond().rotationTo(MathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
sourceRotation = new Quaterniond().rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize();
|
||||
}
|
||||
|
||||
EntityUtils.getPosition(parent).set(position);
|
||||
|
||||
@ -85,7 +85,7 @@ import electrosphere.server.datacell.Realm;
|
||||
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
||||
import electrosphere.server.datacell.utils.ServerEntityTagUtils;
|
||||
import electrosphere.server.poseactor.PoseActor;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* Utilities for creating all entity types
|
||||
@ -220,7 +220,7 @@ public class CommonEntityUtils {
|
||||
}
|
||||
//round out end of move system
|
||||
entity.putData(EntityDataStrings.CLIENT_MOVEMENT_BT, moveTree);
|
||||
CreatureUtils.setFacingVector(entity, MathUtils.getOriginVector());
|
||||
CreatureUtils.setFacingVector(entity, SpatialMathUtils.getOriginVector());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_MAX_NATURAL_VELOCITY, groundMovementSystem.getMaxVelocity());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_ACCELERATION, groundMovementSystem.getAcceleration());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_VELOCITY, 0f);
|
||||
@ -340,7 +340,7 @@ public class CommonEntityUtils {
|
||||
} break;
|
||||
case "UNIT_CONTROLS": {
|
||||
ClientAlwaysUprightTree.attachTree(entity);
|
||||
CreatureUtils.setFacingVector(entity, MathUtils.getOriginVector());
|
||||
CreatureUtils.setFacingVector(entity, SpatialMathUtils.getOriginVector());
|
||||
} break;
|
||||
case "TERRAIN_COLLISION": {
|
||||
CollisionObjUtils.getCollidable(entity).overrideType(Collidable.TYPE_TERRAIN);
|
||||
@ -515,7 +515,7 @@ public class CommonEntityUtils {
|
||||
}
|
||||
//round out end of move system
|
||||
entity.putData(EntityDataStrings.SERVER_MOVEMENT_BT, moveTree);
|
||||
CreatureUtils.setFacingVector(entity, MathUtils.getOriginVector());
|
||||
CreatureUtils.setFacingVector(entity, SpatialMathUtils.getOriginVector());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_MAX_NATURAL_VELOCITY, groundMovementSystem.getMaxVelocity());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_ACCELERATION, groundMovementSystem.getAcceleration());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_VELOCITY, 0f);
|
||||
@ -634,7 +634,7 @@ public class CommonEntityUtils {
|
||||
} break;
|
||||
case "UNIT_CONTROLS": {
|
||||
ServerAlwaysUprightTree.attachTree(entity);
|
||||
CreatureUtils.setFacingVector(entity, MathUtils.getOriginVector());
|
||||
CreatureUtils.setFacingVector(entity, SpatialMathUtils.getOriginVector());
|
||||
} break;
|
||||
case "TERRAIN_COLLISION": {
|
||||
CollisionObjUtils.getCollidable(entity).overrideType(Collidable.TYPE_TERRAIN);
|
||||
|
||||
@ -19,7 +19,7 @@ import electrosphere.game.data.collidable.HitboxData;
|
||||
import electrosphere.game.data.projectile.ProjectileType;
|
||||
import electrosphere.server.datacell.Realm;
|
||||
import electrosphere.server.datacell.utils.ServerBehaviorTreeUtils;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
public class ProjectileUtils {
|
||||
|
||||
@ -39,7 +39,7 @@ public class ProjectileUtils {
|
||||
Globals.assetManager.addModelPathToQueue(model);
|
||||
ProjectileTree tree = new ProjectileTree(rVal,maxLife,new Vector3d(initialVector),velocity);
|
||||
EntityUtils.getPosition(rVal).set(initialPosition);
|
||||
EntityUtils.getRotation(rVal).rotationTo(MathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
EntityUtils.getRotation(rVal).rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
Globals.clientSceneWrapper.getScene().registerBehaviorTree(tree);
|
||||
return rVal;
|
||||
}
|
||||
@ -60,7 +60,7 @@ public class ProjectileUtils {
|
||||
ProjectileTree tree = new ProjectileTree(rVal,maxLife,new Vector3d(initialVector),velocity);
|
||||
EntityUtils.getPosition(rVal).set(initialPosition);
|
||||
// EntityUtils.getRotation(currentEntity).rotationTo(MathUtils.ORIGIN_VECTORF, new Vector3f((float)facingAngle.x,(float)facingAngle.y,(float)facingAngle.z)).mul(parentActor.getBoneRotation(targetBone)).normalize();
|
||||
EntityUtils.getRotation(rVal).rotationTo(MathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
EntityUtils.getRotation(rVal).rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
// ParticleTree particleTree = new ParticleTree(rVal, maxLife, destination, velocity, acceleration, true);
|
||||
// rVal.putData(EntityDataStrings.PARTICLE_TREE, particleTree);
|
||||
// rVal.putData(EntityDataStrings.IS_PARTICLE, true);
|
||||
@ -82,7 +82,7 @@ public class ProjectileUtils {
|
||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||
EntityCreationUtils.makeEntityDrawable(rVal, rawType.getModelPath());
|
||||
//initial coordinates
|
||||
EntityUtils.getRotation(rVal).rotationTo(MathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
EntityUtils.getRotation(rVal).rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
EntityUtils.getPosition(rVal).set(initialPosition);
|
||||
//projectile behavior tree
|
||||
ProjectileTree tree = new ProjectileTree(rVal,rawType.getMaxLife(),initialVector,rawType.getVelocity(), rawType.getDamage());
|
||||
@ -117,7 +117,7 @@ public class ProjectileUtils {
|
||||
ProjectileType rawType = Globals.gameConfigCurrent.getProjectileMap().getType(projectileType);
|
||||
Entity rVal = EntityCreationUtils.createServerEntity(realm, initialPosition);
|
||||
//initial coordinates
|
||||
EntityUtils.getRotation(rVal).rotationTo(MathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
EntityUtils.getRotation(rVal).rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
|
||||
EntityUtils.getPosition(rVal).set(initialPosition);
|
||||
//projectile behavior tree
|
||||
ProjectileTree tree = new ProjectileTree(rVal,rawType.getMaxLife(),initialVector,rawType.getVelocity(), rawType.getDamage());
|
||||
|
||||
@ -16,7 +16,7 @@ import electrosphere.renderer.OpenGLState;
|
||||
import electrosphere.renderer.RenderPipelineState;
|
||||
import electrosphere.renderer.RenderingEngine;
|
||||
import electrosphere.renderer.actor.Actor;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* Shadow map pipeline
|
||||
@ -76,7 +76,7 @@ public class ShadowMapPipeline implements RenderPipeline {
|
||||
Matrix4f lightView = new Matrix4f().setLookAt(
|
||||
new Vector3f(eyeX, eyeY, eyeZ),
|
||||
new Vector3f( 0.0f, 0.0f, 0.0f),
|
||||
MathUtils.getUpVectorf()
|
||||
SpatialMathUtils.getUpVectorf()
|
||||
);
|
||||
Globals.lightDepthMatrix = lightProjection.mul(lightView);
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ import electrosphere.engine.Main;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.script.translation.JSServerUtils;
|
||||
import electrosphere.util.FileUtils;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* Interface for executing scripts in the game engine
|
||||
@ -91,7 +91,7 @@ public class ScriptEngine {
|
||||
//The classes that will be provided to the scripting engine
|
||||
//https://stackoverflow.com/a/65942034
|
||||
static final Object[][] staticClasses = new Object[][]{
|
||||
{"mathUtils",MathUtils.class},
|
||||
{"mathUtils",SpatialMathUtils.class},
|
||||
{"simulation",Main.class},
|
||||
{"tutorialUtils",TutorialMenus.class},
|
||||
{"serverUtils",JSServerUtils.class},
|
||||
|
||||
@ -10,7 +10,7 @@ import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import electrosphere.server.ai.blackboard.Blackboard;
|
||||
import electrosphere.server.ai.nodes.AITreeNode;
|
||||
import electrosphere.server.ai.nodes.actions.combat.MeleeTargetingNode;
|
||||
import electrosphere.util.math.MathUtils;
|
||||
import electrosphere.util.math.SpatialMathUtils;
|
||||
|
||||
/**
|
||||
* Faces the target
|
||||
@ -29,7 +29,7 @@ public class FaceTargetNode implements AITreeNode {
|
||||
Entity target = MeleeTargetingNode.getTarget(blackboard);
|
||||
Vector3d parentPos = EntityUtils.getPosition(entity);
|
||||
Vector3d targetPos = EntityUtils.getPosition(target);
|
||||
Quaterniond rotation = MathUtils.calculateRotationFromPointToPoint(parentPos, targetPos);
|
||||
Quaterniond rotation = SpatialMathUtils.calculateRotationFromPointToPoint(parentPos, targetPos);
|
||||
EntityUtils.getRotation(entity).set(rotation);
|
||||
CreatureUtils.setFacingVector(entity, CameraEntityUtils.getFacingVec(rotation));
|
||||
return AITreeNodeResult.SUCCESS;
|
||||
|
||||
@ -45,11 +45,11 @@ public class MathBones {
|
||||
|
||||
Vector3d facingAngle = CreatureUtils.getFacingVector(actorEntity);
|
||||
if(facingAngle == null){
|
||||
facingAngle = MathUtils.getOriginVector();
|
||||
facingAngle = SpatialMathUtils.getOriginVector();
|
||||
}
|
||||
//calculate rotation of model
|
||||
return new Quaterniond()
|
||||
.rotationTo(MathUtils.getOriginVector(), new Vector3d(facingAngle.x,facingAngle.y,facingAngle.z))
|
||||
.rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(facingAngle.x,facingAngle.y,facingAngle.z))
|
||||
.mul(localRot)
|
||||
.normalize();
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import electrosphere.logger.LoggerInterface;
|
||||
/**
|
||||
* Utility functions for doing math
|
||||
*/
|
||||
public class MathUtils {
|
||||
public class SpatialMathUtils {
|
||||
|
||||
|
||||
/**
|
||||
@ -90,7 +90,7 @@ public class MathUtils {
|
||||
* @return The up rotation
|
||||
*/
|
||||
public static Quaterniond getUpRotation(){
|
||||
return MathUtils.calculateRotationFromPointToPoint(MathUtils.getOriginVector(), MathUtils.getUpVector());
|
||||
return SpatialMathUtils.calculateRotationFromPointToPoint(SpatialMathUtils.getOriginVector(), SpatialMathUtils.getUpVector());
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 30 KiB |
Loading…
Reference in New Issue
Block a user