move clientScene to clientState
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
3c10d42351
commit
9edae4055c
@ -1804,6 +1804,7 @@ Delete deprecated classes
|
||||
Create ClientState global
|
||||
Properly reset ClientState
|
||||
Move clientWorldData to clientState
|
||||
Move clientScene to clientState
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.client;
|
||||
|
||||
import electrosphere.client.scene.ClientWorldData;
|
||||
import electrosphere.entity.scene.Scene;
|
||||
|
||||
/**
|
||||
* State on the client
|
||||
@ -12,4 +13,9 @@ public class ClientState {
|
||||
*/
|
||||
public ClientWorldData clientWorldData;
|
||||
|
||||
/**
|
||||
* The scene on the client
|
||||
*/
|
||||
public Scene clientScene;
|
||||
|
||||
}
|
||||
|
||||
@ -181,14 +181,14 @@ public class BlockDrawCell {
|
||||
*/
|
||||
public void destroy(){
|
||||
if(modelEntity != null){
|
||||
Globals.clientScene.registerBehaviorTree(new BehaviorTree(){
|
||||
Globals.clientState.clientScene.registerBehaviorTree(new BehaviorTree(){
|
||||
int framesSimulated = 0;
|
||||
public void simulate(float deltaTime) {
|
||||
if(framesSimulated < FRAMES_TO_WAIT_BEFORE_DESTRUCTION){
|
||||
framesSimulated++;
|
||||
} else {
|
||||
ClientEntityUtils.destroyEntity(modelEntity);
|
||||
Globals.clientScene.deregisterBehaviorTree(this);
|
||||
Globals.clientState.clientScene.deregisterBehaviorTree(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -52,7 +52,7 @@ public class CameraEntityUtils {
|
||||
}
|
||||
}
|
||||
};
|
||||
Globals.clientScene.registerBehaviorTree(entityTrackingTree);
|
||||
Globals.clientState.clientScene.registerBehaviorTree(entityTrackingTree);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ public class CameraEntityUtils {
|
||||
|
||||
public static void destroyCameraEntity(Entity e){
|
||||
if(e != null){
|
||||
Globals.clientScene.deregisterEntity(e);
|
||||
Globals.clientState.clientScene.deregisterEntity(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class Crosshair {
|
||||
if(!crosshairActive){
|
||||
Entity target = null;
|
||||
double dist = 100;
|
||||
for(Entity entity : Globals.clientScene.getEntitiesWithTag(EntityTags.TARGETABLE)){
|
||||
for(Entity entity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.TARGETABLE)){
|
||||
Vector3d entityPos = EntityUtils.getPosition(entity);
|
||||
double currentDist = parentPos.distance(entityPos);
|
||||
double currentAngleDiff = new Vector3d(entityPos).sub(parentPos).normalize().dot(new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera)));
|
||||
|
||||
@ -23,7 +23,7 @@ public class InstanceUpdater {
|
||||
Globals.profiler.beginCpuSample("updateInstancedActorPriority");
|
||||
if(Globals.playerCamera != null){
|
||||
Vector3d eyePosition = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
|
||||
Set<Entity> instancedEntities = Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED);
|
||||
Set<Entity> instancedEntities = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED);
|
||||
for(Entity entity : instancedEntities){
|
||||
//set priority equal to distance
|
||||
Vector3d entityPosition = EntityUtils.getPosition(entity);
|
||||
|
||||
@ -47,8 +47,8 @@ public class InstancedEntityUtils {
|
||||
entity.putData(EntityDataStrings.DATA_STRING_SCALE, new Vector3f(1,1,1));
|
||||
entity.putData(EntityDataStrings.DRAW_SOLID_PASS, true);
|
||||
entity.putData(EntityDataStrings.DATA_STRING_DRAW, true);
|
||||
Globals.clientScene.registerEntity(entity);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAW_INSTANCED);
|
||||
Globals.clientState.clientScene.registerEntity(entity);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_INSTANCED);
|
||||
return instancedActor;
|
||||
}
|
||||
|
||||
@ -87,8 +87,8 @@ public class InstancedEntityUtils {
|
||||
entity.putData(EntityDataStrings.DRAW_SOLID_PASS, true);
|
||||
entity.putData(EntityDataStrings.DATA_STRING_DRAW, true);
|
||||
entity.putData(EntityDataStrings.INSTANCED_MODEL_ATTRIBUTE, modelTransformAttribute);
|
||||
Globals.clientScene.registerEntity(entity);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAW_INSTANCED);
|
||||
Globals.clientState.clientScene.registerEntity(entity);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_INSTANCED);
|
||||
return instancedActor;
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ public class FluidCell {
|
||||
*/
|
||||
public void generateDrawableEntity(){
|
||||
if(modelEntity != null){
|
||||
Globals.clientScene.deregisterEntity(modelEntity);
|
||||
Globals.clientState.clientScene.deregisterEntity(modelEntity);
|
||||
}
|
||||
|
||||
FluidChunkData currentChunk = Globals.clientFluidManager.getChunkDataAtWorldPoint(worldPos);
|
||||
|
||||
@ -234,14 +234,14 @@ public class DrawCell {
|
||||
public void destroy(){
|
||||
if(modelEntity != null){
|
||||
Entity target = this.modelEntity;
|
||||
Globals.clientScene.registerBehaviorTree(new BehaviorTree(){
|
||||
Globals.clientState.clientScene.registerBehaviorTree(new BehaviorTree(){
|
||||
int framesSimulated = 0;
|
||||
public void simulate(float deltaTime) {
|
||||
if(framesSimulated < FRAMES_TO_WAIT_BEFORE_DESTRUCTION){
|
||||
framesSimulated++;
|
||||
} else {
|
||||
ClientEntityUtils.destroyEntity(target);
|
||||
Globals.clientScene.deregisterBehaviorTree(this);
|
||||
Globals.clientState.clientScene.deregisterBehaviorTree(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -346,14 +346,14 @@ public class FoliageCell {
|
||||
*/
|
||||
public void destroy(){
|
||||
if(modelEntity != null){
|
||||
Globals.clientScene.registerBehaviorTree(new BehaviorTree(){
|
||||
Globals.clientState.clientScene.registerBehaviorTree(new BehaviorTree(){
|
||||
int framesSimulated = 0;
|
||||
public void simulate(float deltaTime) {
|
||||
if(framesSimulated < FRAMES_TO_WAIT_BEFORE_DESTRUCTION){
|
||||
framesSimulated++;
|
||||
} else {
|
||||
ClientEntityUtils.destroyEntity(modelEntity);
|
||||
Globals.clientScene.deregisterBehaviorTree(this);
|
||||
Globals.clientState.clientScene.deregisterBehaviorTree(this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -257,7 +257,7 @@ public class FoliageModel {
|
||||
EntityUtils.getScale(rVal).set(1,1,1);
|
||||
//add ambient foliage behavior tree
|
||||
AmbientFoliage.attachAmbientFoliageTree(rVal, 1.0f, foliageType.getGrowthModel().getGrowthRate());
|
||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.DRAW_FOLIAGE_PASS);
|
||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.DRAW_FOLIAGE_PASS);
|
||||
|
||||
//apply grass uniforms if present in definition
|
||||
if(foliageType.getGrassData() != null){
|
||||
|
||||
@ -54,7 +54,7 @@ public class ImGuiEntityFoliageTab {
|
||||
|
||||
if(ImGui.sliderFloat3("Color (Tip)", grassColorTip, 0, 1)){
|
||||
grassData.getTipColor().set(grassColorTip[0],grassColorTip[1],grassColorTip[2]);
|
||||
for(Entity foliageEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_FOLIAGE_PASS)){
|
||||
for(Entity foliageEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_FOLIAGE_PASS)){
|
||||
if(TextureInstancedActor.getTextureInstancedActor(foliageEntity) != null){
|
||||
TextureInstancedActor actor = TextureInstancedActor.getTextureInstancedActor(foliageEntity);
|
||||
actor.setUniformOnMesh(FoliageModel.MESH_NAME, FoliageModel.UNIFORM_TIP_COLOR, grassData.getTipColor());
|
||||
@ -64,7 +64,7 @@ public class ImGuiEntityFoliageTab {
|
||||
|
||||
if(ImGui.sliderFloat3("Color (Base)", grassColorBase, 0, 1)){
|
||||
grassData.getBaseColor().set(grassColorBase[0],grassColorBase[1],grassColorBase[2]);
|
||||
for(Entity foliageEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_FOLIAGE_PASS)){
|
||||
for(Entity foliageEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_FOLIAGE_PASS)){
|
||||
if(TextureInstancedActor.getTextureInstancedActor(foliageEntity) != null){
|
||||
TextureInstancedActor actor = TextureInstancedActor.getTextureInstancedActor(foliageEntity);
|
||||
actor.setUniformOnMesh(FoliageModel.MESH_NAME, FoliageModel.UNIFORM_BASE_COLOR, grassData.getBaseColor());
|
||||
|
||||
@ -133,7 +133,7 @@ public class PhysicsEntityUtils {
|
||||
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
||||
|
||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||
} break;
|
||||
case "CUBE": {
|
||||
//
|
||||
@ -197,7 +197,7 @@ public class PhysicsEntityUtils {
|
||||
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
||||
|
||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||
} break;
|
||||
case "CAPSULE": {
|
||||
//
|
||||
@ -263,7 +263,7 @@ public class PhysicsEntityUtils {
|
||||
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
|
||||
|
||||
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
|
||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
|
||||
} break;
|
||||
}
|
||||
//if we successfully attached the body, add a sync tree
|
||||
|
||||
@ -616,7 +616,7 @@ public class ControlCategoryMainGame {
|
||||
!Globals.controlCallback.getKey(GLFW.GLFW_KEY_LEFT_SHIFT)
|
||||
){
|
||||
//if the block cursor is visible, capture this input and instead modify block cursor
|
||||
if(Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
|
||||
if(Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
|
||||
Globals.cursorState.updateCursorSize(scrollEvent);
|
||||
handled = true;
|
||||
}
|
||||
@ -627,7 +627,7 @@ public class ControlCategoryMainGame {
|
||||
Globals.controlCallback.getKey(GLFW.GLFW_KEY_LEFT_SHIFT)
|
||||
){
|
||||
//if the fab cursor is visible, capture this input and instead modify fab cursor
|
||||
if(Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.getFabCursor())){
|
||||
if(Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.getFabCursor())){
|
||||
Globals.cursorState.rotateBlockCursor(scrollEvent);
|
||||
handled = true;
|
||||
}
|
||||
|
||||
@ -338,7 +338,6 @@ public class Globals {
|
||||
public static MainThreadSignalService mainThreadSignalService;
|
||||
|
||||
//client scene management
|
||||
public static Scene clientScene;
|
||||
public static ClientSceneWrapper clientSceneWrapper;
|
||||
public static ClientSimulation clientSimulation;
|
||||
public static ClientSynchronizationManager clientSynchronizationManager;
|
||||
@ -506,8 +505,8 @@ public class Globals {
|
||||
shaderOptionMap = FileUtils.loadObjectFromAssetPath("Shaders/shaderoptions.json", ShaderOptionMap.class);
|
||||
shaderOptionMap.debug();
|
||||
//client scene wrapper
|
||||
clientScene = new Scene();
|
||||
clientSceneWrapper = new ClientSceneWrapper(clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
||||
Globals.clientState.clientScene = new Scene();
|
||||
clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
||||
//temporary hold for skybox colors
|
||||
skyboxColors = new ArrayList<Vector3f>();
|
||||
//load asset manager
|
||||
@ -724,8 +723,8 @@ public class Globals {
|
||||
Globals.firstPersonEntity = null;
|
||||
Globals.clientPlayer = null;
|
||||
Globals.playerManager = new PlayerManager();
|
||||
Globals.clientScene = new Scene();
|
||||
Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
||||
Globals.clientState.clientScene = new Scene();
|
||||
Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
|
||||
Globals.clientState = new ClientState();
|
||||
Globals.clientSynchronizationManager = new ClientSynchronizationManager();
|
||||
Globals.server = null;
|
||||
@ -754,7 +753,6 @@ public class Globals {
|
||||
Globals.elementService = null;
|
||||
Globals.realmManager = null;
|
||||
Globals.clientSceneWrapper = null;
|
||||
Globals.clientScene = null;
|
||||
Globals.clientState = null;
|
||||
Globals.audioEngine = null;
|
||||
Globals.renderingEngine = null;
|
||||
|
||||
@ -277,7 +277,7 @@ public class ClientLoading {
|
||||
DrawableUtils.disableCulling(skybox);
|
||||
EntityUtils.getRotation(skybox).rotateX((float)(-Math.PI/2.0f));
|
||||
EntityUtils.getScale(skybox).mul(600000.0f);
|
||||
Globals.clientScene.registerBehaviorTree(() -> {
|
||||
Globals.clientState.clientScene.registerBehaviorTree(() -> {
|
||||
EntityUtils.getPosition(skybox).set(EntityUtils.getPosition(Globals.playerEntity));
|
||||
});
|
||||
Globals.assetManager.queueOverrideMeshShader("Models/environment/skyboxSphere.fbx", "Sphere", "Shaders/entities/skysphere/skysphere.vs", "Shaders/entities/skysphere/skysphere.fs");
|
||||
|
||||
@ -78,8 +78,8 @@ public class ClientEntityUtils {
|
||||
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(entity);
|
||||
}
|
||||
}
|
||||
if(Globals.clientScene != null){
|
||||
Globals.clientScene.deregisterEntity(entity);
|
||||
if(Globals.clientState.clientScene != null){
|
||||
Globals.clientState.clientScene.deregisterEntity(entity);
|
||||
}
|
||||
HitboxCollectionState.destroyHitboxState(entity,false);
|
||||
ClientInteractionEngine.destroyCollidableTemplate(entity);
|
||||
|
||||
@ -152,9 +152,9 @@ public class EntityCreationUtils {
|
||||
entity.putData(EntityDataStrings.DATA_STRING_SCALE, new Vector3f(1,1,1));
|
||||
entity.putData(EntityDataStrings.DATA_STRING_DRAW, true);
|
||||
entity.putData(EntityDataStrings.DRAW_SOLID_PASS, true);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAWABLE);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAWABLE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -166,9 +166,9 @@ public class EntityCreationUtils {
|
||||
entity.putData(EntityDataStrings.DATA_STRING_ACTOR, ActorUtils.createActorOfLoadingModel(modelPath));
|
||||
entity.putData(EntityDataStrings.DATA_STRING_DRAW, true);
|
||||
entity.putData(EntityDataStrings.DRAW_SOLID_PASS, true);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAWABLE);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAWABLE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -176,7 +176,7 @@ public class EntityCreationUtils {
|
||||
* @param entity The entity
|
||||
*/
|
||||
public static void bypassVolumetics(Entity entity){
|
||||
Globals.clientScene.removeEntityFromTag(entity, EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS);
|
||||
Globals.clientState.clientScene.removeEntityFromTag(entity, EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,7 +184,7 @@ public class EntityCreationUtils {
|
||||
* @param entity The entity
|
||||
*/
|
||||
public static void bypassShadowPass(Entity entity){
|
||||
Globals.clientScene.removeEntityFromTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||
Globals.clientState.clientScene.removeEntityFromTag(entity, EntityTags.DRAW_CAST_SHADOW);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -66,7 +66,7 @@ public class ClientAmbientAudioTree implements BehaviorTree {
|
||||
|
||||
//!!WARNING!! THIS WAS MANUALLY MODIFIED OH GOD
|
||||
parent.putData(EntityDataStrings.CLIENT_AMBIENT_AUDIO_TREE, rVal);
|
||||
Globals.clientScene.registerBehaviorTree(rVal);
|
||||
Globals.clientState.clientScene.registerBehaviorTree(rVal);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ public class FirstPersonTree implements BehaviorTree {
|
||||
|
||||
//!!WARNING!! THIS WAS MANUALLY MODIFIED OH GOD
|
||||
parent.putData(EntityDataStrings.FIRST_PERSON_TREE, rVal);
|
||||
Globals.clientScene.registerBehaviorTree(rVal);
|
||||
Globals.clientState.clientScene.registerBehaviorTree(rVal);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -255,7 +255,7 @@ public class CommonEntityUtils {
|
||||
moveTree.setAnimationSprintWindDown(sprintSystem.getAnimationWindDown().getNameThirdPerson());
|
||||
}
|
||||
moveTree.setSprintTree(sprintTree);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.SPRINTABLE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.SPRINTABLE);
|
||||
}
|
||||
//round out end of move system
|
||||
entity.putData(EntityDataStrings.CLIENT_MOVEMENT_BT, moveTree);
|
||||
@ -263,8 +263,8 @@ public class CommonEntityUtils {
|
||||
entity.putData(EntityDataStrings.DATA_STRING_MAX_NATURAL_VELOCITY, groundMovementSystem.getMaxVelocity());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_ACCELERATION, groundMovementSystem.getAcceleration());
|
||||
entity.putData(EntityDataStrings.DATA_STRING_VELOCITY, 0f);
|
||||
Globals.clientScene.registerBehaviorTree(moveTree);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.MOVEABLE);
|
||||
Globals.clientState.clientScene.registerBehaviorTree(moveTree);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.MOVEABLE);
|
||||
break;
|
||||
//
|
||||
// Jump
|
||||
@ -293,7 +293,7 @@ public class CommonEntityUtils {
|
||||
fallTree.setJumpTree(ClientJumpTree.getClientJumpTree(entity));
|
||||
}
|
||||
entity.putData(EntityDataStrings.FALL_TREE, fallTree);
|
||||
Globals.clientScene.registerBehaviorTree(fallTree);
|
||||
Globals.clientState.clientScene.registerBehaviorTree(fallTree);
|
||||
break;
|
||||
case WalkMovementSystem.WALK_MOVEMENT_SYSTEM: {
|
||||
ClientWalkTree.attachTree(entity, (WalkMovementSystem)movementSystem);
|
||||
@ -357,7 +357,7 @@ public class CommonEntityUtils {
|
||||
case "ATTACKER":
|
||||
ClientAttackTree.attachTree(entity);
|
||||
entity.putData(EntityDataStrings.ATTACK_MOVE_TYPE_ACTIVE, null);
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.ATTACKER);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.ATTACKER);
|
||||
//add all attack moves
|
||||
if(rawType.getAttackMoves() != null && rawType.getAttackMoves().size() > 0){
|
||||
for(AttackMove attackMove : rawType.getAttackMoves()){
|
||||
@ -376,7 +376,7 @@ public class CommonEntityUtils {
|
||||
case "SHOOTER": {
|
||||
ShooterTree shooterTree = new ShooterTree(entity);
|
||||
ShooterTree.setShooterTree(entity, shooterTree);
|
||||
Globals.clientScene.registerBehaviorTree(shooterTree);
|
||||
Globals.clientState.clientScene.registerBehaviorTree(shooterTree);
|
||||
} break;
|
||||
case "GRAVITY": {
|
||||
Collidable collidable = (Collidable)entity.getData(EntityDataStrings.PHYSICS_COLLIDABLE);
|
||||
@ -385,7 +385,7 @@ public class CommonEntityUtils {
|
||||
entity.putData(EntityDataStrings.GRAVITY_ENTITY, true);
|
||||
} break;
|
||||
case "TARGETABLE": {
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.TARGETABLE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.TARGETABLE);
|
||||
} break;
|
||||
case "OUTLINE": {
|
||||
entity.putData(EntityDataStrings.DRAW_OUTLINE, true);
|
||||
@ -420,7 +420,7 @@ public class CommonEntityUtils {
|
||||
rotatorTree.addRotatorNode(hierarchyNode);
|
||||
}
|
||||
entity.putData(EntityDataStrings.CLIENT_ROTATOR_TREE, rotatorTree);
|
||||
Globals.clientScene.registerBehaviorTree(rotatorTree);
|
||||
Globals.clientState.clientScene.registerBehaviorTree(rotatorTree);
|
||||
}
|
||||
//bone groups
|
||||
if(rawType.getBoneGroups() != null){
|
||||
@ -428,7 +428,7 @@ public class CommonEntityUtils {
|
||||
}
|
||||
//grid alignment
|
||||
if(rawType.getGridAlignedData() != null){
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.BLOCK_OCCUPANT);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.BLOCK_OCCUPANT);
|
||||
}
|
||||
//furniture data
|
||||
if(rawType.getFurnitureData() != null){
|
||||
@ -439,7 +439,7 @@ public class CommonEntityUtils {
|
||||
//add health system
|
||||
if(rawType.getHealthSystem() != null){
|
||||
ClientLifeTree.attachTree(entity,rawType.getHealthSystem());
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.LIFE_STATE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.LIFE_STATE);
|
||||
}
|
||||
if(rawType.getInventoryData() != null){
|
||||
if(rawType.getInventoryData().getNaturalSize() != null){
|
||||
@ -744,7 +744,7 @@ public class CommonEntityUtils {
|
||||
|
||||
//grid alignment
|
||||
if(rawType.getGridAlignedData() != null){
|
||||
Globals.clientScene.registerEntityToTag(entity, EntityTags.BLOCK_OCCUPANT);
|
||||
Globals.clientState.clientScene.registerEntityToTag(entity, EntityTags.BLOCK_OCCUPANT);
|
||||
//TODO: must register with all nearby scenes as well because it could possibly occupy other chunks
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +141,7 @@ public class CreatureUtils {
|
||||
CreatureUtils.setCreatureTemplate(rVal, storedTemplate);
|
||||
|
||||
//register to correct tag
|
||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.CREATURE);
|
||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.CREATURE);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ public class BlockChunkEntity {
|
||||
BlockMeshData data;
|
||||
try {
|
||||
data = BlockMeshgen.rasterize(chunkData);
|
||||
if(Globals.clientScene.containsEntity(rVal)){
|
||||
if(Globals.clientState.clientScene.containsEntity(rVal)){
|
||||
String modelPath = Globals.assetManager.queuedAsset(new QueuedModel(() -> {
|
||||
return BlockMeshgen.generateBlockModel(data);
|
||||
}));
|
||||
|
||||
@ -69,7 +69,7 @@ public class TerrainChunk {
|
||||
try {
|
||||
data = TransvoxelModelGeneration.generateTerrainChunkData(chunkData);
|
||||
data.constructBuffers();
|
||||
if(Globals.clientScene.containsEntity(rVal)){
|
||||
if(Globals.clientState.clientScene.containsEntity(rVal)){
|
||||
String modelPath = ClientTerrainManager.queueTerrainGridGeneration(data, atlas, notifyTarget, toDelete);
|
||||
EntityCreationUtils.makeEntityDrawablePreexistingModel(rVal, modelPath);
|
||||
if(levelOfDetail == BlockChunkData.LOD_FULL_RES && data.getFaceElements().length > 0){
|
||||
|
||||
@ -49,12 +49,12 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
||||
Globals.profiler.beginAggregateCpuSample("EntityProtocol.handleEntityMessage");
|
||||
LoggerInterface.loggerNetworking.DEBUG_LOOP("Parse entity message of type " + message.getMessageSubtype());
|
||||
|
||||
if(Globals.clientScene != null && Globals.clientSynchronizationManager.isDeleted(message.getentityID())){
|
||||
if(Globals.clientState.clientScene != null && Globals.clientSynchronizationManager.isDeleted(message.getentityID())){
|
||||
return;
|
||||
}
|
||||
|
||||
//error check
|
||||
if(Globals.clientScene != null && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID()) == null && !idModifyingMessages.contains(message.getMessageSubtype())){
|
||||
if(Globals.clientState.clientScene != null && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID()) == null && !idModifyingMessages.contains(message.getMessageSubtype())){
|
||||
LoggerInterface.loggerNetworking.WARNING("Client received packet for entity that is not in the client scene!");
|
||||
Globals.clientSceneWrapper.dumpTranslationLayerStatus();
|
||||
Globals.clientSceneWrapper.dumpIdData(message.getentityID());
|
||||
|
||||
@ -25,7 +25,7 @@ public class EntityProtocol implements ServerProtocolTemplate<EntityMessage> {
|
||||
@Override
|
||||
public void handleSyncMessage(ServerConnectionHandler connectionHandler, EntityMessage message) {
|
||||
//error check
|
||||
if(Globals.clientScene != null && Globals.clientScene.getEntityFromId(message.getentityID()) != null){
|
||||
if(Globals.clientState.clientScene != null && Globals.clientState.clientScene.getEntityFromId(message.getentityID()) != null){
|
||||
LoggerInterface.loggerNetworking.WARNING("Server received packet for entity that is in client scene wrapper!");
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ public class LightEntityUtils {
|
||||
|
||||
public static Entity createDirectionalLight(Vector3f position, Vector3f ambient, Vector3f diffuse, Vector3f specular){
|
||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.LIGHT);
|
||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.LIGHT);
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_LIGHT_TYPE, EntityDataStrings.DATA_STRING_LIGHT_TYPE_DIRECTIONAL);
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_POSITION, new Vector3d(position.x,position.y,position.z));
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_LIGHT_AMBIENT, ambient);
|
||||
@ -27,7 +27,7 @@ public class LightEntityUtils {
|
||||
|
||||
public static Entity createPointLight(Vector3f position, Vector3f ambient, Vector3f diffuse, Vector3f specular, float constant, float linear, float quadratic){
|
||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||
Globals.clientScene.registerEntityToTag(rVal, EntityTags.LIGHT);
|
||||
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.LIGHT);
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_LIGHT_TYPE, EntityDataStrings.DATA_STRING_LIGHT_TYPE_POINT);
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_POSITION, new Vector3d(position.x,position.y,position.z));
|
||||
rVal.putData(EntityDataStrings.DATA_STRING_LIGHT_AMBIENT, ambient);
|
||||
|
||||
@ -28,7 +28,7 @@ public class FoliagePipeline implements RenderPipeline {
|
||||
|
||||
@Override
|
||||
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
||||
Set<Entity> foliageEntities = Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_FOLIAGE_PASS);
|
||||
Set<Entity> foliageEntities = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_FOLIAGE_PASS);
|
||||
if(foliageEntities != null){
|
||||
for(Entity foliageEntity : foliageEntities){
|
||||
Matrix4d modelMatrix = new Matrix4d();
|
||||
|
||||
@ -57,7 +57,7 @@ public class MainContentNoOITPipeline implements RenderPipeline {
|
||||
//
|
||||
// D R A W A L L E N T I T I E S
|
||||
//
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(
|
||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW)
|
||||
|
||||
@ -72,7 +72,7 @@ public class MainContentPipeline implements RenderPipeline {
|
||||
// D R A W A L L E N T I T I E S
|
||||
//
|
||||
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids non-instanced");
|
||||
Set<Entity> solidsNonInstanced = Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE);
|
||||
Set<Entity> solidsNonInstanced = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE);
|
||||
Vector3d positionVec = new Vector3d();
|
||||
Vector3d scaleVec = new Vector3d();
|
||||
Vector3d cameraCenterVec = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||
@ -98,7 +98,7 @@ public class MainContentPipeline implements RenderPipeline {
|
||||
Globals.renderingEngine.getFoliagePipeline().render(openGLState, renderPipelineState);
|
||||
Globals.profiler.endCpuSample();
|
||||
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids instanced");
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(MainContentPipeline.shouldDrawSolidPass(currentEntity)){
|
||||
//fetch actor
|
||||
@ -162,7 +162,7 @@ public class MainContentPipeline implements RenderPipeline {
|
||||
//
|
||||
|
||||
Globals.profiler.beginCpuSample("MainContentPipeline.render - Transparents non-instanced");
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(MainContentPipeline.shouldDrawTransparentPass(currentEntity)){
|
||||
//fetch actor
|
||||
@ -181,7 +181,7 @@ public class MainContentPipeline implements RenderPipeline {
|
||||
}
|
||||
Globals.profiler.endCpuSample();
|
||||
Globals.profiler.beginCpuSample("MainContentPipeline.render - Transparents instanced");
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(MainContentPipeline.shouldDrawTransparentPass(currentEntity)){
|
||||
//fetch actor
|
||||
|
||||
@ -63,7 +63,7 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
||||
|
||||
openGLState.setActiveShader(renderPipelineState, RenderingEngine.renderNormalsShader);
|
||||
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(shouldDraw(currentEntity)){
|
||||
//fetch actor
|
||||
|
||||
@ -105,7 +105,7 @@ public class ShadowMapPipeline implements RenderPipeline {
|
||||
modelTransformMatrix = new Matrix4d();
|
||||
Vector3d posVec = new Vector3d();
|
||||
Vector3d scaleVec = new Vector3d();
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_CAST_SHADOW)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_CAST_SHADOW)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(
|
||||
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW)!=null
|
||||
|
||||
@ -26,7 +26,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
||||
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
|
||||
Globals.profiler.beginCpuSample("VolumeBufferPipeline.render");
|
||||
|
||||
Set<Entity> depthEntities = Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS);
|
||||
Set<Entity> depthEntities = Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS);
|
||||
|
||||
if(depthEntities != null && depthEntities.size() > 0){
|
||||
Matrix4d modelTransformMatrix = new Matrix4d();
|
||||
@ -69,7 +69,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
||||
//
|
||||
// D R A W A L L E N T I T I E S
|
||||
//
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(
|
||||
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW)!=null
|
||||
@ -90,7 +90,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
||||
//
|
||||
//Draw front faces of all non-volumetrics
|
||||
//
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_SOLIDS_PASS)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(
|
||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW)
|
||||
@ -126,7 +126,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
||||
//
|
||||
// D R A W A L L E N T I T I E S
|
||||
//
|
||||
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS)){
|
||||
for(Entity currentEntity : Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS)){
|
||||
Vector3d position = EntityUtils.getPosition(currentEntity);
|
||||
if(
|
||||
(boolean)currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW)
|
||||
|
||||
@ -17,7 +17,6 @@ public class StateCleanupCheckerExtension implements AfterEachCallback {
|
||||
Object[] objectsToCheck = new Object[]{
|
||||
Globals.realmManager,
|
||||
Globals.clientSceneWrapper,
|
||||
Globals.clientScene,
|
||||
Globals.signalSystem,
|
||||
Globals.threadManager,
|
||||
Globals.renderingEngine,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user