move more entities into clientState
This commit is contained in:
parent
a2b5de8863
commit
0266ba1b90
@ -1808,6 +1808,7 @@ Move clientScene to clientState
|
|||||||
Move clientSceneWrapper to clientState
|
Move clientSceneWrapper to clientState
|
||||||
Move clientConnection to clientState
|
Move clientConnection to clientState
|
||||||
Move playerEntity to clientState
|
Move playerEntity to clientState
|
||||||
|
Move playerCamera to clientState
|
||||||
Move global cursor entities into cursorState
|
Move global cursor entities into cursorState
|
||||||
Move lots of global state to clientState
|
Move lots of global state to clientState
|
||||||
|
|
||||||
|
|||||||
@ -191,14 +191,14 @@ public class AudioEngine {
|
|||||||
* Updates the orientation of the listener based on the global player camera
|
* Updates the orientation of the listener based on the global player camera
|
||||||
*/
|
*/
|
||||||
private void updateListener(){
|
private void updateListener(){
|
||||||
if(Globals.playerCamera != null){
|
if(Globals.clientState.playerCamera != null){
|
||||||
//position
|
//position
|
||||||
Vector3d cameraPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
listener.setPosition(cameraPos);
|
listener.setPosition(cameraPos);
|
||||||
|
|
||||||
//orientation
|
//orientation
|
||||||
Vector3d cameraEye = SpatialMathUtils.getOriginVector().rotate(CameraEntityUtils.getRotationQuat(Globals.playerCamera)).normalize();
|
Vector3d cameraEye = SpatialMathUtils.getOriginVector().rotate(CameraEntityUtils.getRotationQuat(Globals.clientState.playerCamera)).normalize();
|
||||||
Vector3d cameraUp = SpatialMathUtils.getUpVector().rotate(CameraEntityUtils.getRotationQuat(Globals.playerCamera)).normalize();
|
Vector3d cameraUp = SpatialMathUtils.getUpVector().rotate(CameraEntityUtils.getRotationQuat(Globals.clientState.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));
|
listener.setOrientation(new Vector3f((float)cameraEye.x,(float)cameraEye.y,(float)cameraEye.z), new Vector3f((float)cameraUp.x,(float)cameraUp.y,(float)cameraUp.z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,8 +101,8 @@ public class VirtualAudioSourceManager {
|
|||||||
*/
|
*/
|
||||||
public void update(float deltaTime){
|
public void update(float deltaTime){
|
||||||
//update priority of all virtual audio sources based on distance from camera position
|
//update priority of all virtual audio sources based on distance from camera position
|
||||||
if(Globals.playerCamera!=null){
|
if(Globals.clientState.playerCamera!=null){
|
||||||
Vector3d cameraEarPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera)).add(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d cameraEarPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera)).add(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
for(VirtualAudioSource source : virtualSourceQueue){
|
for(VirtualAudioSource source : virtualSourceQueue){
|
||||||
if(source.position!=null){
|
if(source.position!=null){
|
||||||
source.setPriority((int)cameraEarPos.distance(source.position));
|
source.setPriority((int)cameraEarPos.distance(source.position));
|
||||||
|
|||||||
@ -132,6 +132,16 @@ public class ClientState {
|
|||||||
*/
|
*/
|
||||||
public Entity playerEntity;
|
public Entity playerEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the entity for the first person model (view model)
|
||||||
|
*/
|
||||||
|
public Entity firstPersonEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the player camera entity
|
||||||
|
*/
|
||||||
|
public Entity playerCamera;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -116,14 +116,14 @@ public class CameraEntityUtils {
|
|||||||
*/
|
*/
|
||||||
public static void initCamera(){
|
public static void initCamera(){
|
||||||
//destroy if it already exists
|
//destroy if it already exists
|
||||||
if(Globals.playerCamera != null){
|
if(Globals.clientState.playerCamera != null){
|
||||||
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(Globals.playerCamera);
|
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(Globals.clientState.playerCamera);
|
||||||
}
|
}
|
||||||
//create
|
//create
|
||||||
if(Globals.controlHandler.cameraIsThirdPerson()){
|
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity();
|
Globals.clientState.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity();
|
||||||
} else {
|
} else {
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3d(0,0,0), SpatialMathUtils.getOriginVector());
|
Globals.clientState.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3d(0,0,0), SpatialMathUtils.getOriginVector());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class Crosshair {
|
|||||||
|
|
||||||
static final float TARGET_MAX_DIST = 1;
|
static final float TARGET_MAX_DIST = 1;
|
||||||
public static void checkTargetable(){
|
public static void checkTargetable(){
|
||||||
if(crossHairEntity != null && Globals.clientState.playerEntity != null && Globals.playerCamera != null){
|
if(crossHairEntity != null && Globals.clientState.playerEntity != null && Globals.clientState.playerCamera != null){
|
||||||
Vector3d parentPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
Vector3d parentPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
// if(currentTarget == null){
|
// if(currentTarget == null){
|
||||||
if(!crosshairActive){
|
if(!crosshairActive){
|
||||||
@ -40,7 +40,7 @@ public class Crosshair {
|
|||||||
for(Entity entity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.TARGETABLE)){
|
for(Entity entity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.TARGETABLE)){
|
||||||
Vector3d entityPos = EntityUtils.getPosition(entity);
|
Vector3d entityPos = EntityUtils.getPosition(entity);
|
||||||
double currentDist = parentPos.distance(entityPos);
|
double currentDist = parentPos.distance(entityPos);
|
||||||
double currentAngleDiff = new Vector3d(entityPos).sub(parentPos).normalize().dot(new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera)));
|
double currentAngleDiff = new Vector3d(entityPos).sub(parentPos).normalize().dot(new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera)));
|
||||||
if(currentDist + currentAngleDiff < dist && currentDist <= TARGET_MAX_DIST && entity != Globals.clientState.playerEntity){
|
if(currentDist + currentAngleDiff < dist && currentDist <= TARGET_MAX_DIST && entity != Globals.clientState.playerEntity){
|
||||||
target = entity;
|
target = entity;
|
||||||
dist = currentDist + currentAngleDiff;
|
dist = currentDist + currentAngleDiff;
|
||||||
|
|||||||
@ -21,8 +21,8 @@ public class InstanceUpdater {
|
|||||||
*/
|
*/
|
||||||
public static void updateInstancedActorPriority(){
|
public static void updateInstancedActorPriority(){
|
||||||
Globals.profiler.beginCpuSample("updateInstancedActorPriority");
|
Globals.profiler.beginCpuSample("updateInstancedActorPriority");
|
||||||
if(Globals.playerCamera != null){
|
if(Globals.clientState.playerCamera != null){
|
||||||
Vector3d eyePosition = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePosition = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Set<Entity> instancedEntities = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED);
|
Set<Entity> instancedEntities = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED);
|
||||||
for(Entity entity : instancedEntities){
|
for(Entity entity : instancedEntities){
|
||||||
//set priority equal to distance
|
//set priority equal to distance
|
||||||
|
|||||||
@ -28,8 +28,8 @@ public class ButtonInteraction {
|
|||||||
* Handles a button interaction event
|
* Handles a button interaction event
|
||||||
*/
|
*/
|
||||||
public static void handleButtonInteraction(){
|
public static void handleButtonInteraction(){
|
||||||
if(Globals.clientState.playerEntity != null && Globals.playerCamera != null){
|
if(Globals.clientState.playerEntity != null && Globals.clientState.playerCamera != null){
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.clientState.playerCamera;
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)).mul(-1.0);
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)).mul(-1.0);
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
||||||
Entity target = ClientInteractionEngine.rayCast(centerPos, eyePos);
|
Entity target = ClientInteractionEngine.rayCast(centerPos, eyePos);
|
||||||
|
|||||||
@ -229,12 +229,12 @@ public class ClientInteractionEngine {
|
|||||||
* Updates the interaction target label
|
* Updates the interaction target label
|
||||||
*/
|
*/
|
||||||
public static void updateInteractionTargetLabel(){
|
public static void updateInteractionTargetLabel(){
|
||||||
if(Globals.clientState.playerEntity != null && Globals.playerCamera != null){
|
if(Globals.clientState.playerEntity != null && Globals.clientState.playerCamera != null){
|
||||||
//clear block cursor
|
//clear block cursor
|
||||||
Globals.cursorState.hintClearBlockCursor();
|
Globals.cursorState.hintClearBlockCursor();
|
||||||
|
|
||||||
boolean set = false;
|
boolean set = false;
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.clientState.playerCamera;
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
||||||
Entity target = ClientInteractionEngine.rayCast(centerPos, new Vector3d(eyePos).mul(-1));
|
Entity target = ClientInteractionEngine.rayCast(centerPos, new Vector3d(eyePos).mul(-1));
|
||||||
|
|||||||
@ -51,8 +51,8 @@ public class ItemActions {
|
|||||||
* Attempts to perform the primary item action
|
* Attempts to perform the primary item action
|
||||||
*/
|
*/
|
||||||
public static void attemptPrimaryItemAction(){
|
public static void attemptPrimaryItemAction(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -111,8 +111,8 @@ public class ItemActions {
|
|||||||
* Repeats the primary item action
|
* Repeats the primary item action
|
||||||
*/
|
*/
|
||||||
public static void repeatPrimaryItemAction(){
|
public static void repeatPrimaryItemAction(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -136,8 +136,8 @@ public class ItemActions {
|
|||||||
* Releases the primary item action
|
* Releases the primary item action
|
||||||
*/
|
*/
|
||||||
public static void releasePrimaryItemAction(){
|
public static void releasePrimaryItemAction(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -156,7 +156,7 @@ public class ItemActions {
|
|||||||
));
|
));
|
||||||
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
||||||
if(Globals.clientState.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
// Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
// Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.clientState.playerEntity);
|
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.clientState.playerEntity);
|
||||||
if(attackTree != null){
|
if(attackTree != null){
|
||||||
// CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
|
// CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
|
||||||
@ -169,8 +169,8 @@ public class ItemActions {
|
|||||||
* Attempts to perform the secondary item action
|
* Attempts to perform the secondary item action
|
||||||
*/
|
*/
|
||||||
public static void attemptSecondaryItemAction(){
|
public static void attemptSecondaryItemAction(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -221,8 +221,8 @@ public class ItemActions {
|
|||||||
* Repeats the secondary item action
|
* Repeats the secondary item action
|
||||||
*/
|
*/
|
||||||
public static void repeatSecondaryItemAction(){
|
public static void repeatSecondaryItemAction(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -273,8 +273,8 @@ public class ItemActions {
|
|||||||
* Releases the secondary item action
|
* Releases the secondary item action
|
||||||
*/
|
*/
|
||||||
public static void releaseSecondaryItemAction(){
|
public static void releaseSecondaryItemAction(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
|
||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
@Export
|
@Export
|
||||||
public static void applyEdit(){
|
public static void applyEdit(){
|
||||||
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.clientState.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
camera != null
|
camera != null
|
||||||
@ -67,7 +67,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
@Export
|
@Export
|
||||||
public static void spawnWater(){
|
public static void spawnWater(){
|
||||||
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.clientState.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
camera != null &&
|
camera != null &&
|
||||||
@ -103,7 +103,7 @@ public class ScriptClientVoxelUtils {
|
|||||||
@Export
|
@Export
|
||||||
public static void dig(){
|
public static void dig(){
|
||||||
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.clientState.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
camera != null
|
camera != null
|
||||||
|
|||||||
@ -164,8 +164,8 @@ public class ClientSimulation {
|
|||||||
private void updateFirstPersonAttachments(){
|
private void updateFirstPersonAttachments(){
|
||||||
Globals.profiler.beginCpuSample("updateFirstPersonAttachments");
|
Globals.profiler.beginCpuSample("updateFirstPersonAttachments");
|
||||||
//update the facing vector when camera moves in first person
|
//update the facing vector when camera moves in first person
|
||||||
if(!Globals.controlHandler.cameraIsThirdPerson() && Globals.playerCamera != null && Globals.clientState.playerEntity != null){
|
if(!Globals.controlHandler.cameraIsThirdPerson() && Globals.clientState.playerCamera != null && Globals.clientState.playerEntity != null){
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
//flush equipped item state
|
//flush equipped item state
|
||||||
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
|
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
|
||||||
ClientEquipState equipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
|
ClientEquipState equipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
|
||||||
|
|||||||
@ -63,8 +63,8 @@ public class CharacterCustomizer {
|
|||||||
CreatureData selectedRaceType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
CreatureData selectedRaceType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
||||||
|
|
||||||
//spawn camera so renderer doesn't crash (once render pipeline is modularized this shouldn't be necessary)
|
//spawn camera so renderer doesn't crash (once render pipeline is modularized this shouldn't be necessary)
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(0,0.3f,1).normalize());
|
Globals.clientState.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(0,0.3f,1).normalize());
|
||||||
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.playerCamera);
|
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.clientState.playerCamera);
|
||||||
|
|
||||||
//create actor panel
|
//create actor panel
|
||||||
Actor characterActor = ActorUtils.createActorFromModelPath(selectedRaceType.getGraphicsTemplate().getModel().getPath());
|
Actor characterActor = ActorUtils.createActorFromModelPath(selectedRaceType.getGraphicsTemplate().getModel().getPath());
|
||||||
|
|||||||
@ -85,7 +85,7 @@ public class ImGuiPlayerEntity {
|
|||||||
|
|
||||||
|
|
||||||
if(ImGui.button("1st Person Details")){
|
if(ImGui.button("1st Person Details")){
|
||||||
ImGuiEntityMacros.showEntity(Globals.firstPersonEntity);
|
ImGuiEntityMacros.showEntity(Globals.clientState.firstPersonEntity);
|
||||||
}
|
}
|
||||||
ImGui.sameLine();
|
ImGui.sameLine();
|
||||||
|
|
||||||
@ -152,8 +152,8 @@ public class ImGuiPlayerEntity {
|
|||||||
* Draws camera data
|
* Draws camera data
|
||||||
*/
|
*/
|
||||||
private static void drawCameraData(){
|
private static void drawCameraData(){
|
||||||
ImGui.text("Yaw: " + CameraEntityUtils.getCameraYaw(Globals.playerCamera));
|
ImGui.text("Yaw: " + CameraEntityUtils.getCameraYaw(Globals.clientState.playerCamera));
|
||||||
ImGui.text("Pitch: " + CameraEntityUtils.getCameraPitch(Globals.playerCamera));
|
ImGui.text("Pitch: " + CameraEntityUtils.getCameraPitch(Globals.clientState.playerCamera));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class ImGuiClientServices {
|
|||||||
|
|
||||||
if(ImGui.collapsingHeader("Draw Cells")){
|
if(ImGui.collapsingHeader("Draw Cells")){
|
||||||
if(ImGui.button("Debug DrawCell at camera position")){
|
if(ImGui.button("Debug DrawCell at camera position")){
|
||||||
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
DrawCell cell = Globals.clientState.clientDrawCellManager.getDrawCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
DrawCell cell = Globals.clientState.clientDrawCellManager.getDrawCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||||
LoggerInterface.loggerEngine.WARNING("" + cell);
|
LoggerInterface.loggerEngine.WARNING("" + cell);
|
||||||
|
|
||||||
@ -60,17 +60,17 @@ public class ImGuiClientServices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ImGui.button("Print debug info for FoliageCell at camera position")){
|
if(ImGui.button("Print debug info for FoliageCell at camera position")){
|
||||||
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
FoliageCell cell = Globals.clientState.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
FoliageCell cell = Globals.clientState.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||||
LoggerInterface.loggerEngine.WARNING("" + cell);
|
LoggerInterface.loggerEngine.WARNING("" + cell);
|
||||||
}
|
}
|
||||||
if(ImGui.button("Debug FoliageCell evaluation at camera position")){
|
if(ImGui.button("Debug FoliageCell evaluation at camera position")){
|
||||||
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
FoliageCell cell = Globals.clientState.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
FoliageCell cell = Globals.clientState.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
|
||||||
cell.setTripDebug(true);
|
cell.setTripDebug(true);
|
||||||
}
|
}
|
||||||
if(ImGui.button("Request terrain at camera position")){
|
if(ImGui.button("Request terrain at camera position")){
|
||||||
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Globals.clientState.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0);
|
Globals.clientState.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,7 +189,7 @@ public class ImGuiEntityMacros {
|
|||||||
(
|
(
|
||||||
AttachUtils.hasChildren(detailViewEntity) ||
|
AttachUtils.hasChildren(detailViewEntity) ||
|
||||||
AttachUtils.getParent(detailViewEntity) != null ||
|
AttachUtils.getParent(detailViewEntity) != null ||
|
||||||
detailViewEntity == Globals.firstPersonEntity ||
|
detailViewEntity == Globals.clientState.firstPersonEntity ||
|
||||||
detailViewEntity == Globals.clientState.playerEntity ||
|
detailViewEntity == Globals.clientState.playerEntity ||
|
||||||
Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
|
Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
|
||||||
) &&
|
) &&
|
||||||
@ -363,8 +363,8 @@ public class ImGuiEntityMacros {
|
|||||||
// FirstPersonTree firstPersonTree = FirstPersonTree.getTree(detailViewEntity);
|
// FirstPersonTree firstPersonTree = FirstPersonTree.getTree(detailViewEntity);
|
||||||
if(ImGui.button("Visualize facing vectors")){
|
if(ImGui.button("Visualize facing vectors")){
|
||||||
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
||||||
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.firstPersonEntity));
|
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.clientState.firstPersonEntity));
|
||||||
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.firstPersonEntity));
|
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.clientState.firstPersonEntity));
|
||||||
});
|
});
|
||||||
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
||||||
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.clientState.playerEntity));
|
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.clientState.playerEntity));
|
||||||
@ -494,9 +494,9 @@ public class ImGuiEntityMacros {
|
|||||||
if(showLinkedEntitiesTab && ImGui.collapsingHeader("Linked entities")){
|
if(showLinkedEntitiesTab && ImGui.collapsingHeader("Linked entities")){
|
||||||
ImGui.indent();
|
ImGui.indent();
|
||||||
if(detailViewEntity == Globals.clientState.playerEntity && ImGui.button("View Model")){
|
if(detailViewEntity == Globals.clientState.playerEntity && ImGui.button("View Model")){
|
||||||
ImGuiEntityMacros.showEntity(Globals.firstPersonEntity);
|
ImGuiEntityMacros.showEntity(Globals.clientState.firstPersonEntity);
|
||||||
}
|
}
|
||||||
if(detailViewEntity == Globals.firstPersonEntity && ImGui.button("3rd Person Model")){
|
if(detailViewEntity == Globals.clientState.firstPersonEntity && ImGui.button("3rd Person Model")){
|
||||||
ImGuiEntityMacros.showEntity(Globals.clientState.playerEntity);
|
ImGuiEntityMacros.showEntity(Globals.clientState.playerEntity);
|
||||||
}
|
}
|
||||||
if(AttachUtils.getParent(detailViewEntity) != null && ImGui.button("Parent")){
|
if(AttachUtils.getParent(detailViewEntity) != null && ImGui.button("Parent")){
|
||||||
|
|||||||
@ -169,8 +169,8 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
//spawn creature button
|
//spawn creature button
|
||||||
scrollable.addChild(Button.createButton("Spawn " + data.getId(), () -> {
|
scrollable.addChild(Button.createButton("Spawn " + data.getId(), () -> {
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + data.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + data.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
@ -199,8 +199,8 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
//spawn creature button
|
//spawn creature button
|
||||||
scrollable.addChild(Button.createButton("Spawn " + unitDefinition.getId(), () -> {
|
scrollable.addChild(Button.createButton("Spawn " + unitDefinition.getId(), () -> {
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + unitDefinition.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + unitDefinition.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -232,8 +232,8 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
//spawn foliage button
|
//spawn foliage button
|
||||||
scrollable.addChild(Button.createButton("Spawn " + data.getId(), () -> {
|
scrollable.addChild(Button.createButton("Spawn " + data.getId(), () -> {
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + data.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + data.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
@ -261,8 +261,8 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
//spawn foliage button
|
//spawn foliage button
|
||||||
scrollable.addChild(Button.createButton("Spawn " + item.getId(), () -> {
|
scrollable.addChild(Button.createButton("Spawn " + item.getId(), () -> {
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + item.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + item.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
@ -291,8 +291,8 @@ public class MenuGeneratorsLevelEditor {
|
|||||||
//spawn object button
|
//spawn object button
|
||||||
scrollable.addChild(Button.createButton("Spawn " + object.getId(), () -> {
|
scrollable.addChild(Button.createButton("Spawn " + object.getId(), () -> {
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + object.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + object.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
|
||||||
|
|||||||
@ -98,8 +98,8 @@ public class MenuGeneratorsUITesting {
|
|||||||
formEl.addChild(InputMacros.createToggle("Test Toggle", false, null));
|
formEl.addChild(InputMacros.createToggle("Test Toggle", false, null));
|
||||||
|
|
||||||
//actor panel
|
//actor panel
|
||||||
if(Globals.playerCamera == null){
|
if(Globals.clientState.playerCamera == null){
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(-1,0,0));
|
Globals.clientState.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(-1,0,0));
|
||||||
}
|
}
|
||||||
ActorPanel actorPanel = ActorPanel.create(ActorUtils.createActorFromModelPath(AssetDataStrings.UNITCUBE));
|
ActorPanel actorPanel = ActorPanel.create(ActorUtils.createActorFromModelPath(AssetDataStrings.UNITCUBE));
|
||||||
formEl.addChild(actorPanel);
|
formEl.addChild(actorPanel);
|
||||||
|
|||||||
@ -34,8 +34,8 @@ public class ScriptLevelEditorUtils {
|
|||||||
if(Globals.clientState.selectedSpawntype != null){
|
if(Globals.clientState.selectedSpawntype != null){
|
||||||
if(Globals.clientState.selectedSpawntype instanceof CreatureData){
|
if(Globals.clientState.selectedSpawntype instanceof CreatureData){
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -46,8 +46,8 @@ public class ScriptLevelEditorUtils {
|
|||||||
CreatureUtils.serverSpawnBasicCreature(realm, cursorPos, Globals.clientState.selectedSpawntype.getId(), null);
|
CreatureUtils.serverSpawnBasicCreature(realm, cursorPos, Globals.clientState.selectedSpawntype.getId(), null);
|
||||||
} else if(Globals.clientState.selectedSpawntype instanceof Item){
|
} else if(Globals.clientState.selectedSpawntype instanceof Item){
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -58,8 +58,8 @@ public class ScriptLevelEditorUtils {
|
|||||||
ItemUtils.serverSpawnBasicItem(realm, cursorPos, Globals.clientState.selectedSpawntype.getId());
|
ItemUtils.serverSpawnBasicItem(realm, cursorPos, Globals.clientState.selectedSpawntype.getId());
|
||||||
} else if(Globals.clientState.selectedSpawntype instanceof FoliageType){
|
} else if(Globals.clientState.selectedSpawntype instanceof FoliageType){
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -70,8 +70,8 @@ public class ScriptLevelEditorUtils {
|
|||||||
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, Globals.clientState.selectedSpawntype.getId());
|
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, Globals.clientState.selectedSpawntype.getId());
|
||||||
} else {
|
} else {
|
||||||
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
LoggerInterface.loggerEngine.INFO("spawn " + Globals.clientState.selectedSpawntype.getId() + "!");
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
Realm realm = Globals.realmManager.getRealms().iterator().next();
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
@ -89,8 +89,8 @@ public class ScriptLevelEditorUtils {
|
|||||||
*/
|
*/
|
||||||
@Export
|
@Export
|
||||||
public static void inspectEntity(){
|
public static void inspectEntity(){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
|
||||||
Entity target = clientCollisionEngine.rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
Entity target = clientCollisionEngine.rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||||
//show detail view here
|
//show detail view here
|
||||||
|
|||||||
@ -106,7 +106,7 @@ public class CameraHandler {
|
|||||||
public void updateGlobalCamera(){
|
public void updateGlobalCamera(){
|
||||||
Globals.profiler.beginCpuSample("updateGlobalCamera");
|
Globals.profiler.beginCpuSample("updateGlobalCamera");
|
||||||
if(update){
|
if(update){
|
||||||
if(Globals.playerCamera != null){
|
if(Globals.clientState.playerCamera != null){
|
||||||
cameraSpeed = 2.5f * (float)Globals.timekeeper.getMostRecentRawFrametime();
|
cameraSpeed = 2.5f * (float)Globals.timekeeper.getMostRecentRawFrametime();
|
||||||
|
|
||||||
if(Crosshair.getCrosshairActive()){
|
if(Crosshair.getCrosshairActive()){
|
||||||
@ -118,12 +118,12 @@ public class CameraHandler {
|
|||||||
|
|
||||||
yaw = (float)Math.toDegrees(Math.atan2(diffed.z, diffed.x));
|
yaw = (float)Math.toDegrees(Math.atan2(diffed.z, diffed.x));
|
||||||
|
|
||||||
CameraEntityUtils.setCameraPitch(Globals.playerCamera, pitch);
|
CameraEntityUtils.setCameraPitch(Globals.clientState.playerCamera, pitch);
|
||||||
CameraEntityUtils.setCameraYaw(Globals.playerCamera, yaw);
|
CameraEntityUtils.setCameraYaw(Globals.clientState.playerCamera, yaw);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
CameraEntityUtils.setCameraPitch(Globals.playerCamera, pitch);
|
CameraEntityUtils.setCameraPitch(Globals.clientState.playerCamera, pitch);
|
||||||
CameraEntityUtils.setCameraYaw(Globals.playerCamera, yaw);
|
CameraEntityUtils.setCameraYaw(Globals.clientState.playerCamera, yaw);
|
||||||
|
|
||||||
Quaterniond pitchQuat = new Quaterniond().fromAxisAngleDeg(SpatialMathUtils.getLeftVector(), -pitch);
|
Quaterniond pitchQuat = new Quaterniond().fromAxisAngleDeg(SpatialMathUtils.getLeftVector(), -pitch);
|
||||||
Quaterniond yawQuat = new Quaterniond().fromAxisAngleDeg(SpatialMathUtils.getUpVector(), -yaw);
|
Quaterniond yawQuat = new Quaterniond().fromAxisAngleDeg(SpatialMathUtils.getUpVector(), -yaw);
|
||||||
@ -134,16 +134,16 @@ public class CameraHandler {
|
|||||||
}
|
}
|
||||||
if(trackPlayerEntity && Globals.clientState.playerEntity != null){
|
if(trackPlayerEntity && Globals.clientState.playerEntity != null){
|
||||||
Vector3d entityPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
Vector3d entityPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3d(entityPos).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera)));
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera, new Vector3d(entityPos).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.clientState.playerCamera)));
|
||||||
}
|
}
|
||||||
//update view matrix offset
|
//update view matrix offset
|
||||||
float xFactor = (float)Math.cos(yaw / 180.0f * Math.PI);
|
float xFactor = (float)Math.cos(yaw / 180.0f * Math.PI);
|
||||||
float yFactor = (float)Math.sin(yaw / 180.0f * Math.PI);
|
float yFactor = (float)Math.sin(yaw / 180.0f * Math.PI);
|
||||||
Vector3d radialOffset = CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera);
|
Vector3d radialOffset = CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.clientState.playerCamera);
|
||||||
Vector3d trueOffset = new Vector3d(radialOffset).mul(xFactor,1.0f,yFactor);
|
Vector3d trueOffset = new Vector3d(radialOffset).mul(xFactor,1.0f,yFactor);
|
||||||
CameraEntityUtils.setOrbitalCameraRadialOffset(Globals.playerCamera, trueOffset);
|
CameraEntityUtils.setOrbitalCameraRadialOffset(Globals.clientState.playerCamera, trueOffset);
|
||||||
cameraRotationVector.mul(CameraEntityUtils.getOrbitalCameraDistance(Globals.playerCamera));
|
cameraRotationVector.mul(CameraEntityUtils.getOrbitalCameraDistance(Globals.clientState.playerCamera));
|
||||||
CameraEntityUtils.setCameraEye(Globals.playerCamera, cameraRotationVector);
|
CameraEntityUtils.setCameraEye(Globals.clientState.playerCamera, cameraRotationVector);
|
||||||
|
|
||||||
//tell the server that we changed where we're looking, if we're in first person
|
//tell the server that we changed where we're looking, if we're in first person
|
||||||
int perspectiveVal = CameraHandler.CAMERA_PERSPECTIVE_FIRST;
|
int perspectiveVal = CameraHandler.CAMERA_PERSPECTIVE_FIRST;
|
||||||
@ -163,7 +163,7 @@ public class CameraHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//the view matrix
|
//the view matrix
|
||||||
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.playerCamera);
|
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.clientState.playerCamera);
|
||||||
|
|
||||||
//update the cursor on client side
|
//update the cursor on client side
|
||||||
Globals.cursorState.updatePlayerCursor();
|
Globals.cursorState.updatePlayerCursor();
|
||||||
|
|||||||
@ -49,58 +49,58 @@ public class ControlCategoryFreecam {
|
|||||||
){
|
){
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_UP));
|
freeCameraControlList.add(controlMap.get(FREECAM_UP));
|
||||||
controlMap.get(FREECAM_UP).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(FREECAM_UP).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
playerCameraCenterPos.add(0,0.1f,0);
|
playerCameraCenterPos.add(0,0.1f,0);
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera,playerCameraCenterPos);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_DOWN));
|
freeCameraControlList.add(controlMap.get(FREECAM_DOWN));
|
||||||
controlMap.get(FREECAM_DOWN).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(FREECAM_DOWN).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
playerCameraCenterPos.add(0,-0.1f,0);
|
playerCameraCenterPos.add(0,-0.1f,0);
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera,playerCameraCenterPos);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_FORWARD));
|
freeCameraControlList.add(controlMap.get(FREECAM_FORWARD));
|
||||||
ControlMethod freeCamForwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamForwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
playerCameraCenterPos.add(new Vector3d(playerCameraEyePos).normalize().mul(-0.1f));
|
playerCameraCenterPos.add(new Vector3d(playerCameraEyePos).normalize().mul(-0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_FORWARD).setOnClick(freeCamForwardCallback);
|
controlMap.get(FREECAM_FORWARD).setOnClick(freeCamForwardCallback);
|
||||||
controlMap.get(FREECAM_FORWARD).setOnRepeat(freeCamForwardCallback);
|
controlMap.get(FREECAM_FORWARD).setOnRepeat(freeCamForwardCallback);
|
||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_BACKWARD));
|
freeCameraControlList.add(controlMap.get(FREECAM_BACKWARD));
|
||||||
ControlMethod freeCamBackwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamBackwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
playerCameraCenterPos.add(new Vector3d(playerCameraEyePos).normalize().mul(0.1f));
|
playerCameraCenterPos.add(new Vector3d(playerCameraEyePos).normalize().mul(0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_BACKWARD).setOnClick(freeCamBackwardCallback);
|
controlMap.get(FREECAM_BACKWARD).setOnClick(freeCamBackwardCallback);
|
||||||
controlMap.get(FREECAM_BACKWARD).setOnRepeat(freeCamBackwardCallback);
|
controlMap.get(FREECAM_BACKWARD).setOnRepeat(freeCamBackwardCallback);
|
||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_LEFT));
|
freeCameraControlList.add(controlMap.get(FREECAM_LEFT));
|
||||||
ControlMethod freeCamLeftCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamLeftCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
Vector3d modifiedVec = new Vector3d(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(-90 * Math.PI / 180)).normalize();
|
Vector3d modifiedVec = new Vector3d(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(-90 * Math.PI / 180)).normalize();
|
||||||
playerCameraCenterPos.add(new Vector3d(modifiedVec).mul(0.1f));
|
playerCameraCenterPos.add(new Vector3d(modifiedVec).mul(0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_LEFT).setOnClick(freeCamLeftCallback);
|
controlMap.get(FREECAM_LEFT).setOnClick(freeCamLeftCallback);
|
||||||
controlMap.get(FREECAM_LEFT).setOnRepeat(freeCamLeftCallback);
|
controlMap.get(FREECAM_LEFT).setOnRepeat(freeCamLeftCallback);
|
||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_RIGHT));
|
freeCameraControlList.add(controlMap.get(FREECAM_RIGHT));
|
||||||
ControlMethod freeCamRightCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamRightCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
Vector3d modifiedVec = new Vector3d(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(90 * Math.PI / 180)).normalize();
|
Vector3d modifiedVec = new Vector3d(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(90 * Math.PI / 180)).normalize();
|
||||||
playerCameraCenterPos.add(new Vector3d(modifiedVec).mul(0.1f));
|
playerCameraCenterPos.add(new Vector3d(modifiedVec).mul(0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_RIGHT).setOnClick(freeCamRightCallback);
|
controlMap.get(FREECAM_RIGHT).setOnClick(freeCamRightCallback);
|
||||||
controlMap.get(FREECAM_RIGHT).setOnRepeat(freeCamRightCallback);
|
controlMap.get(FREECAM_RIGHT).setOnRepeat(freeCamRightCallback);
|
||||||
|
|||||||
@ -132,18 +132,18 @@ public class ControlCategoryMainGame {
|
|||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
|
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
|
||||||
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
|
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,18 +154,18 @@ public class ControlCategoryMainGame {
|
|||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
|
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
|
||||||
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
|
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
||||||
@ -199,12 +199,12 @@ public class ControlCategoryMainGame {
|
|||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
|
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD);
|
groundTree.start(MovementRelativeFacing.BACKWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
||||||
@ -222,12 +222,12 @@ public class ControlCategoryMainGame {
|
|||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
|
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD);
|
groundTree.start(MovementRelativeFacing.BACKWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -262,7 +262,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
||||||
@ -274,7 +274,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -283,7 +283,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
||||||
@ -311,7 +311,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -320,7 +320,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
||||||
@ -332,7 +332,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -341,7 +341,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
||||||
@ -378,7 +378,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
@ -388,7 +388,7 @@ public class ControlCategoryMainGame {
|
|||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
@ -408,7 +408,7 @@ public class ControlCategoryMainGame {
|
|||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
@ -444,7 +444,7 @@ public class ControlCategoryMainGame {
|
|||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -454,7 +454,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
@ -464,7 +464,7 @@ public class ControlCategoryMainGame {
|
|||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.clientState.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -197,7 +197,7 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public void updatePlayerCursor(){
|
public void updatePlayerCursor(){
|
||||||
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.clientState.playerCamera;
|
||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
camera != null &&
|
camera != null &&
|
||||||
|
|||||||
@ -349,13 +349,6 @@ public class Globals {
|
|||||||
//collision world data
|
//collision world data
|
||||||
public static CollisionWorldData commonWorldData;
|
public static CollisionWorldData commonWorldData;
|
||||||
|
|
||||||
|
|
||||||
//the player camera entity
|
|
||||||
public static Entity playerCamera;
|
|
||||||
|
|
||||||
//the entity for the first person modal (view model)
|
|
||||||
public static Entity firstPersonEntity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The target of the interaction
|
* The target of the interaction
|
||||||
*/
|
*/
|
||||||
@ -653,8 +646,6 @@ public class Globals {
|
|||||||
* Unloads scene
|
* Unloads scene
|
||||||
*/
|
*/
|
||||||
public static void unloadScene(){
|
public static void unloadScene(){
|
||||||
Globals.playerCamera = null;
|
|
||||||
Globals.firstPersonEntity = null;
|
|
||||||
Globals.playerManager = new PlayerManager();
|
Globals.playerManager = new PlayerManager();
|
||||||
Globals.clientState.clientScene = new Scene();
|
Globals.clientState.clientScene = new Scene();
|
||||||
Globals.clientState.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
Globals.clientState.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
||||||
|
|||||||
@ -159,7 +159,7 @@ public class ClientLoading {
|
|||||||
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
||||||
|
|
||||||
//init camera
|
//init camera
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(-1,0,0));
|
Globals.clientState.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(-1,0,0));
|
||||||
Globals.cameraHandler.setTrackPlayerEntity(false);
|
Globals.cameraHandler.setTrackPlayerEntity(false);
|
||||||
Globals.cameraHandler.setUpdate(false);
|
Globals.cameraHandler.setUpdate(false);
|
||||||
//initialize the "real" objects simulation
|
//initialize the "real" objects simulation
|
||||||
|
|||||||
@ -83,8 +83,8 @@ public class ClientEntityUtils {
|
|||||||
}
|
}
|
||||||
HitboxCollectionState.destroyHitboxState(entity,false);
|
HitboxCollectionState.destroyHitboxState(entity,false);
|
||||||
ClientInteractionEngine.destroyCollidableTemplate(entity);
|
ClientInteractionEngine.destroyCollidableTemplate(entity);
|
||||||
if(entity == Globals.clientState.playerEntity && Globals.firstPersonEntity != null){
|
if(entity == Globals.clientState.playerEntity && Globals.clientState.firstPersonEntity != null){
|
||||||
ClientEntityUtils.destroyEntity(Globals.firstPersonEntity);
|
ClientEntityUtils.destroyEntity(Globals.clientState.firstPersonEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -280,7 +280,7 @@ public class StateTransitionUtil {
|
|||||||
//Interrupt animation in first person
|
//Interrupt animation in first person
|
||||||
//
|
//
|
||||||
if(animation != null){
|
if(animation != null){
|
||||||
FirstPersonTree.conditionallyInterruptAnimation(Globals.firstPersonEntity, animation);
|
FirstPersonTree.conditionallyInterruptAnimation(Globals.clientState.firstPersonEntity, animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -622,8 +622,8 @@ public class AttachUtils {
|
|||||||
getChildrenList(parent).remove(toAttach);
|
getChildrenList(parent).remove(toAttach);
|
||||||
}
|
}
|
||||||
//special case handling for view model
|
//special case handling for view model
|
||||||
if(parent == Globals.clientState.playerEntity && getChildrenList(Globals.firstPersonEntity) != null){
|
if(parent == Globals.clientState.playerEntity && getChildrenList(Globals.clientState.firstPersonEntity) != null){
|
||||||
getChildrenList(Globals.firstPersonEntity).remove(toAttach);
|
getChildrenList(Globals.clientState.firstPersonEntity).remove(toAttach);
|
||||||
}
|
}
|
||||||
return bone;
|
return bone;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -566,7 +566,7 @@ public class ClientAttackTree implements BehaviorTree {
|
|||||||
String animName = this.currentMove.getAttackState().getAnimation().getNameThirdPerson();
|
String animName = this.currentMove.getAttackState().getAnimation().getNameThirdPerson();
|
||||||
actor.setFreezeFrames(animName, this.currentMove.getHitstun());
|
actor.setFreezeFrames(animName, this.currentMove.getHitstun());
|
||||||
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
Actor viewmodelActor = EntityUtils.getActor(Globals.firstPersonEntity);
|
Actor viewmodelActor = EntityUtils.getActor(Globals.clientState.firstPersonEntity);
|
||||||
animName = this.currentMove.getAttackState().getAnimation().getNameFirstPerson();
|
animName = this.currentMove.getAttackState().getAnimation().getNameFirstPerson();
|
||||||
viewmodelActor.setFreezeFrames(animName, this.currentMove.getHitstun());
|
viewmodelActor.setFreezeFrames(animName, this.currentMove.getHitstun());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,8 +103,8 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param offset The offset to start the animation at
|
* @param offset The offset to start the animation at
|
||||||
*/
|
*/
|
||||||
public void playAnimation(String animationName, int priority, double offset){
|
public void playAnimation(String animationName, int priority, double offset){
|
||||||
if(Globals.firstPersonEntity != null){
|
if(Globals.clientState.firstPersonEntity != null){
|
||||||
Actor actor = EntityUtils.getActor(Globals.firstPersonEntity);
|
Actor actor = EntityUtils.getActor(Globals.clientState.firstPersonEntity);
|
||||||
if(
|
if(
|
||||||
(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(animationName)) &&
|
(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(animationName)) &&
|
||||||
(Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(animationName) != null)
|
(Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(animationName) != null)
|
||||||
@ -129,8 +129,8 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param offset The offset to start the animation at
|
* @param offset The offset to start the animation at
|
||||||
*/
|
*/
|
||||||
public void playAnimation(TreeDataAnimation animation, double offset){
|
public void playAnimation(TreeDataAnimation animation, double offset){
|
||||||
if(Globals.firstPersonEntity != null){
|
if(Globals.clientState.firstPersonEntity != null){
|
||||||
Actor actor = EntityUtils.getActor(Globals.firstPersonEntity);
|
Actor actor = EntityUtils.getActor(Globals.clientState.firstPersonEntity);
|
||||||
if(
|
if(
|
||||||
(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(animation.getNameFirstPerson())) &&
|
(!actor.isPlayingAnimation() || !actor.isPlayingAnimation(animation.getNameFirstPerson())) &&
|
||||||
(Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(animation.getNameFirstPerson()) != null)
|
(Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(animation.getNameFirstPerson()) != null)
|
||||||
@ -146,8 +146,8 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param animationName the name of the animation
|
* @param animationName the name of the animation
|
||||||
*/
|
*/
|
||||||
public void interruptAnimation(TreeDataAnimation animation){
|
public void interruptAnimation(TreeDataAnimation animation){
|
||||||
if(Globals.firstPersonEntity != null){
|
if(Globals.clientState.firstPersonEntity != null){
|
||||||
Actor actor = EntityUtils.getActor(Globals.firstPersonEntity);
|
Actor actor = EntityUtils.getActor(Globals.clientState.firstPersonEntity);
|
||||||
if(
|
if(
|
||||||
(actor.isPlayingAnimation() || actor.isPlayingAnimation(animation.getNameFirstPerson())) &&
|
(actor.isPlayingAnimation() || actor.isPlayingAnimation(animation.getNameFirstPerson())) &&
|
||||||
(Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(animation.getNameFirstPerson()) != null)
|
(Globals.assetManager.fetchModel(actor.getModelPath()) != null && Globals.assetManager.fetchModel(actor.getModelPath()).getAnimation(animation.getNameFirstPerson()) != null)
|
||||||
@ -164,8 +164,8 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param priority The priority of the animation
|
* @param priority The priority of the animation
|
||||||
*/
|
*/
|
||||||
public static void conditionallyPlayAnimation(Entity entity, String animationName, int priority, double offset){
|
public static void conditionallyPlayAnimation(Entity entity, String animationName, int priority, double offset){
|
||||||
if(entity != null && entity == Globals.clientState.playerEntity && Globals.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
|
if(entity != null && entity == Globals.clientState.playerEntity && Globals.clientState.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.clientState.firstPersonEntity)){
|
||||||
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animationName, priority);
|
FirstPersonTree.getTree(Globals.clientState.firstPersonEntity).playAnimation(animationName, priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,8 +185,8 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param animationName the name of the animation
|
* @param animationName the name of the animation
|
||||||
*/
|
*/
|
||||||
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation animation){
|
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation animation){
|
||||||
if(entity != null && entity == Globals.clientState.playerEntity && Globals.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
|
if(entity != null && entity == Globals.clientState.playerEntity && Globals.clientState.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.clientState.firstPersonEntity)){
|
||||||
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animation);
|
FirstPersonTree.getTree(Globals.clientState.firstPersonEntity).playAnimation(animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param offset The offset to start the animation at
|
* @param offset The offset to start the animation at
|
||||||
*/
|
*/
|
||||||
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation animation, double offset){
|
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation animation, double offset){
|
||||||
if(entity != null && entity == Globals.clientState.playerEntity && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
|
if(entity != null && entity == Globals.clientState.playerEntity && FirstPersonTree.hasTree(Globals.clientState.firstPersonEntity)){
|
||||||
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animation,offset);
|
FirstPersonTree.getTree(Globals.clientState.firstPersonEntity).playAnimation(animation,offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,8 +208,8 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param animation The animation
|
* @param animation The animation
|
||||||
*/
|
*/
|
||||||
public static void conditionallyInterruptAnimation(Entity entity, TreeDataAnimation animation){
|
public static void conditionallyInterruptAnimation(Entity entity, TreeDataAnimation animation){
|
||||||
if(entity != null && entity == Globals.clientState.playerEntity && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
|
if(entity != null && entity == Globals.clientState.playerEntity && FirstPersonTree.hasTree(Globals.clientState.firstPersonEntity)){
|
||||||
FirstPersonTree.getTree(Globals.firstPersonEntity).interruptAnimation(animation);
|
FirstPersonTree.getTree(Globals.clientState.firstPersonEntity).interruptAnimation(animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -100,7 +100,7 @@ public class ClientParticleTree implements BehaviorTree {
|
|||||||
public void simulate(float deltaTime){
|
public void simulate(float deltaTime){
|
||||||
InstancedActor instancedActor = InstancedActor.getInstancedActor(parent);
|
InstancedActor instancedActor = InstancedActor.getInstancedActor(parent);
|
||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Vector3d cameraPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraPos = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
|
|
||||||
//update position
|
//update position
|
||||||
position.add(velocity);
|
position.add(velocity);
|
||||||
|
|||||||
@ -136,7 +136,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
meshMask.queueMesh(modelName, toDraw);
|
meshMask.queueMesh(modelName, toDraw);
|
||||||
}
|
}
|
||||||
//attach to parent bone
|
//attach to parent bone
|
||||||
if(parent != Globals.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent != Globals.clientState.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
parent,
|
parent,
|
||||||
toEquip,
|
toEquip,
|
||||||
@ -146,7 +146,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.firstPersonEntity,
|
Globals.clientState.firstPersonEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
point.getFirstPersonBone(),
|
point.getFirstPersonBone(),
|
||||||
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()),
|
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()),
|
||||||
@ -174,7 +174,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
//actually equip
|
//actually equip
|
||||||
equipMap.put(point.getEquipPointId(),toEquip);
|
equipMap.put(point.getEquipPointId(),toEquip);
|
||||||
if(parent != Globals.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent != Globals.clientState.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
parent,
|
parent,
|
||||||
toEquip,
|
toEquip,
|
||||||
@ -184,7 +184,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.firstPersonEntity,
|
Globals.clientState.firstPersonEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
point.getFirstPersonBone(),
|
point.getFirstPersonBone(),
|
||||||
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()),
|
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()),
|
||||||
@ -410,7 +410,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
||||||
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
||||||
if(AttachUtils.getParent(toEquip) != Globals.clientState.playerEntity){
|
if(AttachUtils.getParent(toEquip) != Globals.clientState.playerEntity){
|
||||||
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip);
|
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.clientState.firstPersonEntity, toEquip);
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.clientState.playerEntity,
|
Globals.clientState.playerEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
@ -426,17 +426,17 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
for(String occupiedPoint : this.getEquippedPoints()){
|
for(String occupiedPoint : this.getEquippedPoints()){
|
||||||
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
||||||
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
||||||
if(AttachUtils.getParent(toEquip) != Globals.firstPersonEntity){
|
if(AttachUtils.getParent(toEquip) != Globals.clientState.firstPersonEntity){
|
||||||
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.clientState.playerEntity, toEquip);
|
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.clientState.playerEntity, toEquip);
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.firstPersonEntity,
|
Globals.clientState.firstPersonEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
point.getFirstPersonBone(),
|
point.getFirstPersonBone(),
|
||||||
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()),
|
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorFirstPerson()),
|
||||||
AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())
|
AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationFirstPerson())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.firstPersonEntity);
|
AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.clientState.firstPersonEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,7 +121,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
meshMask.queueMesh(modelName, toDraw);
|
meshMask.queueMesh(modelName, toDraw);
|
||||||
}
|
}
|
||||||
//attach to parent bone
|
//attach to parent bone
|
||||||
if(parent != Globals.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent != Globals.clientState.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
parent,
|
parent,
|
||||||
toEquip,
|
toEquip,
|
||||||
@ -131,7 +131,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.firstPersonEntity,
|
Globals.clientState.firstPersonEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
targetPoint.getFirstPersonBone(),
|
targetPoint.getFirstPersonBone(),
|
||||||
AttachUtils.getEquipPointVectorOffset(targetPoint.getOffsetVectorFirstPerson()),
|
AttachUtils.getEquipPointVectorOffset(targetPoint.getOffsetVectorFirstPerson()),
|
||||||
@ -158,7 +158,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//actually equip
|
//actually equip
|
||||||
if(parent != Globals.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent != Globals.clientState.firstPersonEntity || Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
parent,
|
parent,
|
||||||
toEquip,
|
toEquip,
|
||||||
@ -168,7 +168,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.firstPersonEntity,
|
Globals.clientState.firstPersonEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
targetPoint.getFirstPersonBone(),
|
targetPoint.getFirstPersonBone(),
|
||||||
AttachUtils.getEquipPointVectorOffset(targetPoint.getOffsetVectorFirstPerson()),
|
AttachUtils.getEquipPointVectorOffset(targetPoint.getOffsetVectorFirstPerson()),
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class AmbientFoliage implements BehaviorTree {
|
|||||||
EntityUtils.getScale(parent).set(growthLevel);
|
EntityUtils.getScale(parent).set(growthLevel);
|
||||||
|
|
||||||
//rotate to face cameras
|
//rotate to face cameras
|
||||||
// Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
// Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera);
|
||||||
// EntityUtils.getRotation(parent).rotateTo(MathUtils.ORIGIN_VECTOR, new Vector3d(cameraEyeVector));
|
// EntityUtils.getRotation(parent).rotateTo(MathUtils.ORIGIN_VECTOR, new Vector3d(cameraEyeVector));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -192,7 +192,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
Globals.clientCharacterID = message.getentityID();
|
Globals.clientCharacterID = message.getentityID();
|
||||||
Globals.clientState.playerEntity = target;
|
Globals.clientState.playerEntity = target;
|
||||||
if(viewModelData != null && viewModelData.getFirstPersonModelPath() != null){
|
if(viewModelData != null && viewModelData.getFirstPersonModelPath() != null){
|
||||||
Globals.firstPersonEntity = CreatureUtils.clientCreateViewModel(
|
Globals.clientState.firstPersonEntity = CreatureUtils.clientCreateViewModel(
|
||||||
creatureTypeRaw,
|
creatureTypeRaw,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|||||||
@ -500,7 +500,7 @@ public class RenderingEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Update light buffer
|
//Update light buffer
|
||||||
lightManager.update(renderPipelineState,openGLState,Globals.playerCamera);
|
lightManager.update(renderPipelineState,openGLState,Globals.clientState.playerCamera);
|
||||||
this.checkError();
|
this.checkError();
|
||||||
|
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ public class RenderingEngine {
|
|||||||
*/
|
*/
|
||||||
private boolean shouldRunPipelines(){
|
private boolean shouldRunPipelines(){
|
||||||
boolean rVal =
|
boolean rVal =
|
||||||
Globals.playerCamera != null
|
Globals.clientState.playerCamera != null
|
||||||
;
|
;
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -380,8 +380,8 @@ public class Mesh {
|
|||||||
openGLState.glBindBufferBase(LightManager.DIRECT_LIGHT_SSBO_BIND_POINT, lightManager.getDirectLightSSBO());
|
openGLState.glBindBufferBase(LightManager.DIRECT_LIGHT_SSBO_BIND_POINT, lightManager.getDirectLightSSBO());
|
||||||
|
|
||||||
//set uniforms required
|
//set uniforms required
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "zNear", CameraEntityUtils.getNearClip(Globals.playerCamera));
|
openGLState.getActiveShader().setUniform(openGLState, "zNear", CameraEntityUtils.getNearClip(Globals.clientState.playerCamera));
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "zFar", CameraEntityUtils.getFarClip(Globals.playerCamera));
|
openGLState.getActiveShader().setUniform(openGLState, "zFar", CameraEntityUtils.getFarClip(Globals.clientState.playerCamera));
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "gridSize", new Vector3i(LightManager.LIGHT_CLUSTER_WIDTH_X,LightManager.LIGHT_CLUSTER_WIDTH_Y,LightManager.LIGHT_CLUSTER_WIDTH_Z));
|
openGLState.getActiveShader().setUniform(openGLState, "gridSize", new Vector3i(LightManager.LIGHT_CLUSTER_WIDTH_X,LightManager.LIGHT_CLUSTER_WIDTH_Y,LightManager.LIGHT_CLUSTER_WIDTH_Z));
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "screenDimensions", openGLState.getViewport());
|
openGLState.getActiveShader().setUniform(openGLState, "screenDimensions", openGLState.getViewport());
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ public class Mesh {
|
|||||||
openGLState.getActiveShader().setUniform(openGLState, "model", parent.getModelMatrix());
|
openGLState.getActiveShader().setUniform(openGLState, "model", parent.getModelMatrix());
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "view", Globals.viewMatrix);
|
openGLState.getActiveShader().setUniform(openGLState, "view", Globals.viewMatrix);
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "projection", Globals.projectionMatrix);
|
openGLState.getActiveShader().setUniform(openGLState, "projection", Globals.projectionMatrix);
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "viewPos", CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
openGLState.getActiveShader().setUniform(openGLState, "viewPos", CameraEntityUtils.getCameraEye(Globals.clientState.playerCamera));
|
||||||
Vector3f worldPos = new Vector3f((float)parent.getWorldPos().x,(float)parent.getWorldPos().y,(float)parent.getWorldPos().z);
|
Vector3f worldPos = new Vector3f((float)parent.getWorldPos().x,(float)parent.getWorldPos().y,(float)parent.getWorldPos().z);
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "modelWorldPos", worldPos);
|
openGLState.getActiveShader().setUniform(openGLState, "modelWorldPos", worldPos);
|
||||||
openGLState.getActiveShader().setUniform(openGLState, "lightSpaceMatrix", Globals.lightDepthMatrix);
|
openGLState.getActiveShader().setUniform(openGLState, "lightSpaceMatrix", Globals.lightDepthMatrix);
|
||||||
|
|||||||
@ -28,10 +28,10 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
|
|||||||
@Override
|
@Override
|
||||||
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
||||||
|
|
||||||
if(Globals.firstPersonEntity != null && !Globals.controlHandler.cameraIsThirdPerson()){
|
if(Globals.clientState.firstPersonEntity != null && !Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
//update logic
|
//update logic
|
||||||
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
||||||
updateFirstPersonModelPosition(Globals.firstPersonEntity);
|
updateFirstPersonModelPosition(Globals.clientState.firstPersonEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
//setup opengl state
|
//setup opengl state
|
||||||
@ -52,27 +52,27 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
|
|||||||
//
|
//
|
||||||
//Draw viewmodel
|
//Draw viewmodel
|
||||||
{
|
{
|
||||||
Vector3d position = EntityUtils.getPosition(Globals.firstPersonEntity);
|
Vector3d position = EntityUtils.getPosition(Globals.clientState.firstPersonEntity);
|
||||||
Actor actor = EntityUtils.getActor(Globals.firstPersonEntity);
|
Actor actor = EntityUtils.getActor(Globals.clientState.firstPersonEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(EntityUtils.getRotation(Globals.firstPersonEntity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(Globals.clientState.firstPersonEntity));
|
||||||
modelTransformMatrix.scale(new Vector3d(EntityUtils.getScale(Globals.firstPersonEntity)));
|
modelTransformMatrix.scale(new Vector3d(EntityUtils.getScale(Globals.clientState.firstPersonEntity)));
|
||||||
actor.applySpatialData(modelTransformMatrix,position);
|
actor.applySpatialData(modelTransformMatrix,position);
|
||||||
//draw
|
//draw
|
||||||
actor.draw(renderPipelineState, openGLState);
|
actor.draw(renderPipelineState, openGLState);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw children of viewmodel
|
//draw children of viewmodel
|
||||||
if(AttachUtils.hasChildren(Globals.firstPersonEntity)){
|
if(AttachUtils.hasChildren(Globals.clientState.firstPersonEntity)){
|
||||||
for(Entity child : AttachUtils.getChildrenList(Globals.firstPersonEntity)){
|
for(Entity child : AttachUtils.getChildrenList(Globals.clientState.firstPersonEntity)){
|
||||||
Vector3d position = EntityUtils.getPosition(child);
|
Vector3d position = EntityUtils.getPosition(child);
|
||||||
Actor actor = EntityUtils.getActor(child);
|
Actor actor = EntityUtils.getActor(child);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -96,13 +96,13 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
|
|||||||
|
|
||||||
FirstPersonTree tree = FirstPersonTree.getTree(target);
|
FirstPersonTree tree = FirstPersonTree.getTree(target);
|
||||||
|
|
||||||
Matrix4d rotationMat = CameraEntityUtils.getRotationMat(Globals.playerCamera);
|
Matrix4d rotationMat = CameraEntityUtils.getRotationMat(Globals.clientState.playerCamera);
|
||||||
EntityUtils.getRotation(Globals.firstPersonEntity).set(CameraEntityUtils.getRotationQuat(Globals.playerCamera));
|
EntityUtils.getRotation(Globals.clientState.firstPersonEntity).set(CameraEntityUtils.getRotationQuat(Globals.clientState.playerCamera));
|
||||||
|
|
||||||
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
Vector4d behindCameraOffsetRaw = rotationMat.transform(new Vector4d(0,tree.getCameraViewDirOffsetY(),tree.getCameraViewDirOffsetZ(),1)); //pushes the model behind the camera
|
Vector4d behindCameraOffsetRaw = rotationMat.transform(new Vector4d(0,tree.getCameraViewDirOffsetY(),tree.getCameraViewDirOffsetZ(),1)); //pushes the model behind the camera
|
||||||
Vector3d behindCameraOffset = new Vector3d(behindCameraOffsetRaw.x,behindCameraOffsetRaw.y,behindCameraOffsetRaw.z);
|
Vector3d behindCameraOffset = new Vector3d(behindCameraOffsetRaw.x,behindCameraOffsetRaw.y,behindCameraOffsetRaw.z);
|
||||||
EntityUtils.getPosition(Globals.firstPersonEntity).set(playerPos).add(0.0f,tree.getHeightFromOrigin(),0.0f).add(behindCameraOffset);
|
EntityUtils.getPosition(Globals.clientState.firstPersonEntity).set(playerPos).add(0.0f,tree.getHeightFromOrigin(),0.0f).add(behindCameraOffset);
|
||||||
|
|
||||||
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
|
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
|
||||||
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
|
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class FoliagePipeline implements RenderPipeline {
|
|||||||
if(foliageEntities != null){
|
if(foliageEntities != null){
|
||||||
for(Entity foliageEntity : foliageEntities){
|
for(Entity foliageEntity : foliageEntities){
|
||||||
Matrix4d modelMatrix = new Matrix4d();
|
Matrix4d modelMatrix = new Matrix4d();
|
||||||
Vector3d cameraCenter = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraCenter = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
Vector3d realPosition = EntityUtils.getPosition(foliageEntity);
|
Vector3d realPosition = EntityUtils.getPosition(foliageEntity);
|
||||||
|
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(realPosition).sub(cameraCenter);
|
Vector3d cameraModifiedPosition = new Vector3d(realPosition).sub(cameraCenter);
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class MainContentNoOITPipeline implements RenderPipeline {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
RenderingEngine.modelTransformMatrix.identity();
|
RenderingEngine.modelTransformMatrix.identity();
|
||||||
RenderingEngine.modelTransformMatrix.translate(cameraModifiedPosition);
|
RenderingEngine.modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
Set<Entity> solidsNonInstanced = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE);
|
Set<Entity> solidsNonInstanced = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE);
|
||||||
Vector3d positionVec = new Vector3d();
|
Vector3d positionVec = new Vector3d();
|
||||||
Vector3d scaleVec = new Vector3d();
|
Vector3d scaleVec = new Vector3d();
|
||||||
Vector3d cameraCenterVec = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraCenterVec = CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera);
|
||||||
for(Entity currentEntity : solidsNonInstanced){
|
for(Entity currentEntity : solidsNonInstanced){
|
||||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||||
if(MainContentPipeline.shouldDrawSolidPass(currentEntity)){
|
if(MainContentPipeline.shouldDrawSolidPass(currentEntity)){
|
||||||
@ -107,7 +107,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
||||||
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
||||||
//calculate model matrix
|
//calculate model matrix
|
||||||
Vector3d cameraModifiedPosition = positionVec.set(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = positionVec.set(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
||||||
// modelTransformMatrix.identity();
|
// modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.identity().translationRotateScale(
|
modelTransformMatrix.identity().translationRotateScale(
|
||||||
@ -168,7 +168,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = positionVec.set(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = positionVec.set(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -190,7 +190,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
||||||
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
||||||
//calculate model matrix
|
//calculate model matrix
|
||||||
Vector3d cameraModifiedPosition = positionVec.set(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = positionVec.set(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
||||||
// modelTransformMatrix.identity();
|
// modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.identity().translationRotateScale(
|
modelTransformMatrix.identity().translationRotateScale(
|
||||||
@ -272,7 +272,7 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
static boolean entityBlacklist(Entity entity){
|
static boolean entityBlacklist(Entity entity){
|
||||||
return
|
return
|
||||||
//don't draw first person view in this pipeline ever
|
//don't draw first person view in this pipeline ever
|
||||||
entity == Globals.firstPersonEntity ||
|
entity == Globals.clientState.firstPersonEntity ||
|
||||||
|
|
||||||
//don't draw third person view if camera is first person
|
//don't draw third person view if camera is first person
|
||||||
(
|
(
|
||||||
@ -287,10 +287,10 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
|
|
||||||
//don't draw items if they're attached to viewmodel
|
//don't draw items if they're attached to viewmodel
|
||||||
(
|
(
|
||||||
Globals.firstPersonEntity != null &&
|
Globals.clientState.firstPersonEntity != null &&
|
||||||
!Globals.controlHandler.cameraIsThirdPerson() &&
|
!Globals.controlHandler.cameraIsThirdPerson() &&
|
||||||
AttachUtils.hasParent(entity) &&
|
AttachUtils.hasParent(entity) &&
|
||||||
AttachUtils.getParent(entity) == Globals.firstPersonEntity
|
AttachUtils.getParent(entity) == Globals.clientState.firstPersonEntity
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -112,7 +112,7 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
|||||||
static boolean entityBlacklist(Entity entity){
|
static boolean entityBlacklist(Entity entity){
|
||||||
return
|
return
|
||||||
//don't draw first person view in this pipeline ever
|
//don't draw first person view in this pipeline ever
|
||||||
entity == Globals.firstPersonEntity ||
|
entity == Globals.clientState.firstPersonEntity ||
|
||||||
|
|
||||||
//don't draw third person view if camera is first person
|
//don't draw third person view if camera is first person
|
||||||
(
|
(
|
||||||
@ -127,10 +127,10 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
|||||||
|
|
||||||
//don't draw items if they're attached to viewmodel
|
//don't draw items if they're attached to viewmodel
|
||||||
(
|
(
|
||||||
Globals.firstPersonEntity != null &&
|
Globals.clientState.firstPersonEntity != null &&
|
||||||
!Globals.controlHandler.cameraIsThirdPerson() &&
|
!Globals.controlHandler.cameraIsThirdPerson() &&
|
||||||
AttachUtils.hasParent(entity) &&
|
AttachUtils.hasParent(entity) &&
|
||||||
AttachUtils.getParent(entity) == Globals.firstPersonEntity
|
AttachUtils.getParent(entity) == Globals.clientState.firstPersonEntity
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,7 +113,7 @@ public class ShadowMapPipeline implements RenderPipeline {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraCenter = scaleVec.set(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraCenter = scaleVec.set(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
Vector3d cameraModifiedPosition = posVec.set(position).sub(cameraCenter);
|
Vector3d cameraModifiedPosition = posVec.set(position).sub(cameraCenter);
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(EntityUtils.getRotation(currentEntity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(currentEntity));
|
||||||
@ -98,7 +98,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
//set projection matrix
|
//set projection matrix
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -134,7 +134,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class DebugBonesPipeline implements RenderPipeline {
|
|||||||
Quaterniond boneRot = MathBones.getBoneWorldRotation(targetEntity, bone.boneID);
|
Quaterniond boneRot = MathBones.getBoneWorldRotation(targetEntity, bone.boneID);
|
||||||
|
|
||||||
//put pos + rot into model
|
//put pos + rot into model
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(bonePos).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(bonePos).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(boneRot);
|
modelTransformMatrix.rotate(boneRot);
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
||||||
@ -109,7 +109,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
||||||
@ -146,7 +146,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
||||||
@ -165,7 +165,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
||||||
@ -201,7 +201,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(EntityUtils.getRotation(physicsEntity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(physicsEntity));
|
||||||
@ -220,7 +220,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(physicsEntity);
|
Quaterniond rotation = EntityUtils.getRotation(physicsEntity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(rotation);
|
modelTransformMatrix.rotate(rotation);
|
||||||
@ -251,7 +251,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
Vector3d position = EntityUtils.getPosition(entity);
|
Vector3d position = EntityUtils.getPosition(entity);
|
||||||
//calculate camera-modified vector3d
|
//calculate camera-modified vector3d
|
||||||
Vector3d cameraModifiedPosition = new Vector3d(position).add(0,gridAlignedData.getHeight() * BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f,0).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).add(0,gridAlignedData.getHeight() * BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f,0).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(EntityUtils.getRotation(entity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(entity));
|
||||||
|
|||||||
@ -236,8 +236,8 @@ public class ActorPanel extends BufferedStandardDrawableContainerElement impleme
|
|||||||
Globals.cameraHandler.updateRadialOffset(new Vector3d(actorPosition));
|
Globals.cameraHandler.updateRadialOffset(new Vector3d(actorPosition));
|
||||||
double radius = actorModel.getBoundingSphere().r;
|
double radius = actorModel.getBoundingSphere().r;
|
||||||
this.cameraRadius = radius + DEFAULT_STANDOFF_DIST;
|
this.cameraRadius = radius + DEFAULT_STANDOFF_DIST;
|
||||||
CameraEntityUtils.setOrbitalCameraDistance(Globals.playerCamera, (float)(this.cameraRadius));
|
CameraEntityUtils.setOrbitalCameraDistance(Globals.clientState.playerCamera, (float)(this.cameraRadius));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3d(0,(float)(this.cameraRadius - DEFAULT_STANDOFF_DIST),0));
|
CameraEntityUtils.setCameraCenter(Globals.clientState.playerCamera, new Vector3d(0,(float)(this.cameraRadius - DEFAULT_STANDOFF_DIST),0));
|
||||||
hasOffsetFromBoundingSphere = true;
|
hasOffsetFromBoundingSphere = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ public class ActorPanel extends BufferedStandardDrawableContainerElement impleme
|
|||||||
*/
|
*/
|
||||||
private void recalculateModelMatrix(){
|
private void recalculateModelMatrix(){
|
||||||
modelMatrix.identity();
|
modelMatrix.identity();
|
||||||
modelMatrix.translate(new Vector3d(actorPosition).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)));
|
modelMatrix.translate(new Vector3d(actorPosition).sub(CameraEntityUtils.getCameraCenter(Globals.clientState.playerCamera)));
|
||||||
modelMatrix.rotate(actorRotation);
|
modelMatrix.rotate(actorRotation);
|
||||||
modelMatrix.scale(new Vector3d(actorScale));
|
modelMatrix.scale(new Vector3d(actorScale));
|
||||||
actor.applySpatialData(modelMatrix,new Vector3d(actorPosition));
|
actor.applySpatialData(modelMatrix,new Vector3d(actorPosition));
|
||||||
@ -453,7 +453,7 @@ public class ActorPanel extends BufferedStandardDrawableContainerElement impleme
|
|||||||
if(this.cameraRadius < MIN_ZOOM){
|
if(this.cameraRadius < MIN_ZOOM){
|
||||||
this.cameraRadius = MIN_ZOOM;
|
this.cameraRadius = MIN_ZOOM;
|
||||||
}
|
}
|
||||||
CameraEntityUtils.setOrbitalCameraDistance(Globals.playerCamera, (float)cameraRadius);
|
CameraEntityUtils.setOrbitalCameraDistance(Globals.clientState.playerCamera, (float)cameraRadius);
|
||||||
propagate = false;
|
propagate = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user