client state
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-15 11:53:51 -04:00
parent df3a9ec460
commit 3c10d42351
28 changed files with 171 additions and 147 deletions

View File

@ -1801,6 +1801,9 @@ Fix reloading client world repeatedly
AI manager thread safeing AI manager thread safeing
AI manager better error handling AI manager better error handling
Delete deprecated classes Delete deprecated classes
Create ClientState global
Properly reset ClientState
Move clientWorldData to clientState

View File

@ -0,0 +1,15 @@
package electrosphere.client;
import electrosphere.client.scene.ClientWorldData;
/**
* State on the client
*/
public class ClientState {
/**
* Data on the currently loaded world
*/
public ClientWorldData clientWorldData;
}

View File

@ -28,9 +28,9 @@ public class ClientBlockSelection {
boolean encountered = false; boolean encountered = false;
for(int x = 0; x < Globals.clientWorldData.getWorldDiscreteSize(); x++){ for(int x = 0; x < Globals.clientState.clientWorldData.getWorldDiscreteSize(); x++){
for(int y = 0; y < Globals.clientWorldData.getWorldDiscreteSize(); y++){ for(int y = 0; y < Globals.clientState.clientWorldData.getWorldDiscreteSize(); y++){
for(int z = 0; z < Globals.clientWorldData.getWorldDiscreteSize(); z++){ for(int z = 0; z < Globals.clientState.clientWorldData.getWorldDiscreteSize(); z++){
chunkPos = new Vector3i(x,y,z); chunkPos = new Vector3i(x,y,z);
BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(chunkPos, 0); BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(chunkPos, 0);
@ -57,8 +57,8 @@ public class ClientBlockSelection {
} }
} }
Vector3d localMin = Globals.clientWorldData.convertBlockToRealSpace(chunkPos, minVoxelPos); Vector3d localMin = Globals.clientState.clientWorldData.convertBlockToRealSpace(chunkPos, minVoxelPos);
Vector3d localMax = Globals.clientWorldData.convertBlockToRealSpace(chunkPos, maxVoxelPos); Vector3d localMax = Globals.clientState.clientWorldData.convertBlockToRealSpace(chunkPos, maxVoxelPos);
if(!encountered){ if(!encountered){
encountered = true; encountered = true;
@ -90,13 +90,13 @@ public class ClientBlockSelection {
*/ */
public static BlockFab convertSelectionToFab(){ public static BlockFab convertSelectionToFab(){
AreaSelection selection = Globals.cursorState.getAreaSelection(); AreaSelection selection = Globals.cursorState.getAreaSelection();
Vector3i startChunk = Globals.clientWorldData.convertRealToWorldSpace(selection.getRectStart()); Vector3i startChunk = Globals.clientState.clientWorldData.convertRealToWorldSpace(selection.getRectStart());
Vector3i endChunk = Globals.clientWorldData.convertRealToWorldSpace(selection.getRectEnd()); Vector3i endChunk = Globals.clientState.clientWorldData.convertRealToWorldSpace(selection.getRectEnd());
if(!startChunk.equals(endChunk)){ if(!startChunk.equals(endChunk)){
throw new Error("Unsupported case! Selected are coverts multiple chunks.. " + startChunk + " " + endChunk); throw new Error("Unsupported case! Selected are coverts multiple chunks.. " + startChunk + " " + endChunk);
} }
Vector3i blockStart = Globals.clientWorldData.convertRealToBlockSpace(selection.getRectStart()); Vector3i blockStart = Globals.clientState.clientWorldData.convertRealToBlockSpace(selection.getRectStart());
Vector3i blockEnd = Globals.clientWorldData.convertRealToBlockSpace(selection.getRectEnd()); Vector3i blockEnd = Globals.clientState.clientWorldData.convertRealToBlockSpace(selection.getRectEnd());
BlockChunkData chunk = Globals.clientBlockManager.getChunkDataAtWorldPoint(startChunk, 0); BlockChunkData chunk = Globals.clientBlockManager.getChunkDataAtWorldPoint(startChunk, 0);
if(chunk == null){ if(chunk == null){

View File

@ -139,7 +139,7 @@ public class ClientBlockCellManager {
Globals.profiler.beginCpuSample("ClientBlockCellManager.update"); Globals.profiler.beginCpuSample("ClientBlockCellManager.update");
if(shouldUpdate && Globals.playerEntity != null){ if(shouldUpdate && Globals.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity); Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3i playerWorldPos = Globals.clientWorldData.convertRealToWorldSpace(playerPos); Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos); int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
this.lastPlayerPos.set(playerWorldPos); this.lastPlayerPos.set(playerWorldPos);
//the sets to iterate through //the sets to iterate through
@ -657,8 +657,8 @@ public class ClientBlockCellManager {
*/ */
public boolean isFullLOD(Vector3i worldPos){ public boolean isFullLOD(Vector3i worldPos){
Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity); Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d chunkMin = Globals.clientWorldData.convertWorldToRealSpace(worldPos); Vector3d chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
Vector3d chunkMax = Globals.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1)); Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST; return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
} }
@ -706,11 +706,11 @@ public class ClientBlockCellManager {
Vector3i worldPos = node.getMinBound(); Vector3i worldPos = node.getMinBound();
if( if(
worldPos.x >= 0 && worldPos.x >= 0 &&
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.y >= 0 && worldPos.y >= 0 &&
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod) !Globals.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)
){ ){
//client should request chunk data from server for each chunk necessary to create the model //client should request chunk data from server for each chunk necessary to create the model

View File

@ -83,8 +83,8 @@ public class FluidCellManager {
* @param discreteY The initial discrete position Y coordinate * @param discreteY The initial discrete position Y coordinate
*/ */
public FluidCellManager(ClientTerrainManager clientTerrainManager, int discreteX, int discreteY, int discreteZ){ public FluidCellManager(ClientTerrainManager clientTerrainManager, int discreteX, int discreteY, int discreteZ){
if(Globals.clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
worldBoundDiscreteMax = (int)(Globals.clientWorldData.getWorldBoundMin().x / ServerTerrainChunk.CHUNK_DIMENSION * 1.0f); worldBoundDiscreteMax = (int)(Globals.clientState.clientWorldData.getWorldBoundMin().x / ServerTerrainChunk.CHUNK_DIMENSION * 1.0f);
} }
cells = new HashSet<FluidCell>(); cells = new HashSet<FluidCell>();
hasNotRequested = new HashSet<String>(); hasNotRequested = new HashSet<String>();
@ -130,11 +130,11 @@ public class FluidCellManager {
if( if(
worldPos.x >= 0 && worldPos.x >= 0 &&
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.y >= 0 && worldPos.y >= 0 &&
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize()
){ ){
// if(!hasRequested.contains(targetKey)){ // if(!hasRequested.contains(targetKey)){
//client should request chunk data from server //client should request chunk data from server
@ -160,11 +160,11 @@ public class FluidCellManager {
Vector3i worldPos = getVectorFromKey(targetKey); Vector3i worldPos = getVectorFromKey(targetKey);
if( if(
worldPos.x >= 0 && worldPos.x >= 0 &&
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.y >= 0 && worldPos.y >= 0 &&
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize()
){ ){
if(containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z)){ if(containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z)){
FluidCell cell = FluidCell.generateFluidCell( FluidCell cell = FluidCell.generateFluidCell(
@ -194,11 +194,11 @@ public class FluidCellManager {
Vector3i worldPos = this.getVectorFromKey(targetKey); Vector3i worldPos = this.getVectorFromKey(targetKey);
if( if(
worldPos.x >= 0 && worldPos.x >= 0 &&
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.y >= 0 && worldPos.y >= 0 &&
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize()
){ ){
// if(Math.abs(drawRadius + 1 - targetX) < physicsRadius && Math.abs(drawRadius + 1 - targetY) < physicsRadius){ // if(Math.abs(drawRadius + 1 - targetX) < physicsRadius && Math.abs(drawRadius + 1 - targetY) < physicsRadius){
// needsPhysics[targetX][targetY] = true; // needsPhysics[targetX][targetY] = true;
@ -315,30 +315,30 @@ public class FluidCellManager {
* Queues new cells that are in bounds but not currently accounted for * Queues new cells that are in bounds but not currently accounted for
*/ */
private void queueNewCells(){ private void queueNewCells(){
if(Globals.playerEntity != null && Globals.clientWorldData != null){ if(Globals.playerEntity != null && Globals.clientState.clientWorldData != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity); Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
for(int x = -(int)drawRadius; x < drawRadius; x = x + ChunkData.CHUNK_DATA_SIZE){ for(int x = -(int)drawRadius; x < drawRadius; x = x + ChunkData.CHUNK_DATA_SIZE){
for(int y = -(int)drawRadius; y < drawRadius; y = y + ChunkData.CHUNK_DATA_SIZE){ for(int y = -(int)drawRadius; y < drawRadius; y = y + ChunkData.CHUNK_DATA_SIZE){
for(int z = -(int)drawRadius; z < drawRadius; z = z + ChunkData.CHUNK_DATA_SIZE){ for(int z = -(int)drawRadius; z < drawRadius; z = z + ChunkData.CHUNK_DATA_SIZE){
Vector3d newPos = new Vector3d(playerPos.x + x, playerPos.y + y, playerPos.z + z); Vector3d newPos = new Vector3d(playerPos.x + x, playerPos.y + y, playerPos.z + z);
Vector3i worldPos = new Vector3i( Vector3i worldPos = new Vector3i(
Globals.clientWorldData.convertRealToChunkSpace(newPos.x), Globals.clientState.clientWorldData.convertRealToChunkSpace(newPos.x),
Globals.clientWorldData.convertRealToChunkSpace(newPos.y), Globals.clientState.clientWorldData.convertRealToChunkSpace(newPos.y),
Globals.clientWorldData.convertRealToChunkSpace(newPos.z) Globals.clientState.clientWorldData.convertRealToChunkSpace(newPos.z)
); );
Vector3d chunkRealSpace = new Vector3d( Vector3d chunkRealSpace = new Vector3d(
Globals.clientWorldData.convertChunkToRealSpace(worldPos.x), Globals.clientState.clientWorldData.convertChunkToRealSpace(worldPos.x),
Globals.clientWorldData.convertChunkToRealSpace(worldPos.y), Globals.clientState.clientWorldData.convertChunkToRealSpace(worldPos.y),
Globals.clientWorldData.convertChunkToRealSpace(worldPos.z) Globals.clientState.clientWorldData.convertChunkToRealSpace(worldPos.z)
); );
if( if(
playerPos.distance(chunkRealSpace) < drawRadius && playerPos.distance(chunkRealSpace) < drawRadius &&
worldPos.x >= 0 && worldPos.x >= 0 &&
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.y >= 0 && worldPos.y >= 0 &&
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize()
){ ){
String key = getCellKey( String key = getCellKey(
worldPos.x, worldPos.x,

View File

@ -277,9 +277,9 @@ public class ClientInteractionEngine {
collisionPosition.x >= 0 && collisionPosition.y >= 0 && collisionPosition.z >= 0 collisionPosition.x >= 0 && collisionPosition.y >= 0 && collisionPosition.z >= 0
){ ){
//grab block at point //grab block at point
BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientWorldData.convertRealToWorldSpace(collisionPosition), 0); BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
if(blockChunkData != null){ if(blockChunkData != null){
Vector3i blockPos = Globals.clientWorldData.convertRealToBlockSpace(new Vector3d(collisionPosition).add(new Vector3d(eyePos).mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f))); Vector3i blockPos = Globals.clientState.clientWorldData.convertRealToBlockSpace(new Vector3d(collisionPosition).add(new Vector3d(eyePos).mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f)));
if(!blockChunkData.isEmpty(blockPos.x, blockPos.y, blockPos.z)){ if(!blockChunkData.isEmpty(blockPos.x, blockPos.y, blockPos.z)){
short type = blockChunkData.getType(blockPos.x, blockPos.y, blockPos.z); short type = blockChunkData.getType(blockPos.x, blockPos.y, blockPos.z);
String text = Globals.gameConfigCurrent.getBlockData().getTypeFromId(type).getName(); String text = Globals.gameConfigCurrent.getBlockData().getTypeFromId(type).getName();
@ -291,9 +291,9 @@ public class ClientInteractionEngine {
} }
//if we didn't find a block type, try terrain //if we didn't find a block type, try terrain
if(!set){ if(!set){
ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientWorldData.convertRealToWorldSpace(collisionPosition), 0); ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
if(chunkData != null){ if(chunkData != null){
int voxelType = chunkData.getType(Globals.clientWorldData.convertRealToVoxelSpace(new Vector3d(collisionPosition).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f)))); int voxelType = chunkData.getType(Globals.clientState.clientWorldData.convertRealToVoxelSpace(new Vector3d(collisionPosition).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f))));
if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){ if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){
String text = Globals.gameConfigCurrent.getVoxelData().getTypeFromId(voxelType).getName(); String text = Globals.gameConfigCurrent.getVoxelData().getTypeFromId(voxelType).getName();
InteractionTargetMenu.setInteractionTargetString(text); InteractionTargetMenu.setInteractionTargetString(text);

View File

@ -151,7 +151,7 @@ public class AreaSelection {
currVoxelPos.y % BlockChunkData.CHUNK_DATA_WIDTH, currVoxelPos.y % BlockChunkData.CHUNK_DATA_WIDTH,
currVoxelPos.z % BlockChunkData.CHUNK_DATA_WIDTH currVoxelPos.z % BlockChunkData.CHUNK_DATA_WIDTH
); );
if(!Globals.clientWorldData.chunkInBounds(currChunkPos)){ if(!Globals.clientState.clientWorldData.chunkInBounds(currChunkPos)){
switch(increment % 6){ switch(increment % 6){
case 0: { case 0: {
if(expandPositiveX){ if(expandPositiveX){
@ -324,13 +324,13 @@ public class AreaSelection {
} }
} }
Vector3d startPos = new Vector3d(Globals.clientWorldData.convertBlockToRealSpace(chunkPos, blockPos)) Vector3d startPos = new Vector3d(Globals.clientState.clientWorldData.convertBlockToRealSpace(chunkPos, blockPos))
.add( .add(
startOffset.x * BlockChunkData.BLOCK_SIZE_MULTIPLIER, startOffset.x * BlockChunkData.BLOCK_SIZE_MULTIPLIER,
startOffset.y * BlockChunkData.BLOCK_SIZE_MULTIPLIER, startOffset.y * BlockChunkData.BLOCK_SIZE_MULTIPLIER,
startOffset.z * BlockChunkData.BLOCK_SIZE_MULTIPLIER startOffset.z * BlockChunkData.BLOCK_SIZE_MULTIPLIER
); );
Vector3d endPos = new Vector3d(Globals.clientWorldData.convertBlockToRealSpace(chunkPos, blockPos)) Vector3d endPos = new Vector3d(Globals.clientState.clientWorldData.convertBlockToRealSpace(chunkPos, blockPos))
.add( .add(
endOffset.x * BlockChunkData.BLOCK_SIZE_MULTIPLIER, endOffset.x * BlockChunkData.BLOCK_SIZE_MULTIPLIER,
endOffset.y * BlockChunkData.BLOCK_SIZE_MULTIPLIER, endOffset.y * BlockChunkData.BLOCK_SIZE_MULTIPLIER,

View File

@ -21,8 +21,8 @@ public class ScriptClientAreaUtils {
public static void selectAreaRectangular(){ public static void selectAreaRectangular(){
// Vector3d blockCursorPos = Globals.cursorState.getBlockCursorPos(); // Vector3d blockCursorPos = Globals.cursorState.getBlockCursorPos();
Vector3d cursorPos = new Vector3d(EntityUtils.getPosition(Globals.playerCursor)); Vector3d cursorPos = new Vector3d(EntityUtils.getPosition(Globals.playerCursor));
Vector3i chunkPos = Globals.clientWorldData.convertRealToWorldSpace(cursorPos); Vector3i chunkPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(cursorPos);
Vector3i blockPos = Globals.clientWorldData.convertRealToBlockSpace(cursorPos); Vector3i blockPos = Globals.clientState.clientWorldData.convertRealToBlockSpace(cursorPos);
AreaSelection selection = AreaSelection.selectRectangularBlockCavity(chunkPos, blockPos, AreaSelection.DEFAULT_SELECTION_RADIUS); AreaSelection selection = AreaSelection.selectRectangularBlockCavity(chunkPos, blockPos, AreaSelection.DEFAULT_SELECTION_RADIUS);
Globals.cursorState.selectRectangularArea(selection); Globals.cursorState.selectRectangularArea(selection);
CursorState.makeAreaVisible(); CursorState.makeAreaVisible();

View File

@ -144,8 +144,8 @@ public class ScriptClientVoxelUtils {
if(Globals.cursorState.getSelectedFabPath() != null){ if(Globals.cursorState.getSelectedFabPath() != null){
String fabPath = Globals.cursorState.getSelectedFabPath(); String fabPath = Globals.cursorState.getSelectedFabPath();
Vector3d fabCursorPos = EntityUtils.getPosition(CursorState.getFabCursor()); Vector3d fabCursorPos = EntityUtils.getPosition(CursorState.getFabCursor());
Vector3i chunkPos = Globals.clientWorldData.convertRealToWorldSpace(fabCursorPos); Vector3i chunkPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(fabCursorPos);
Vector3i voxelPos = Globals.clientWorldData.convertRealToBlockSpace(fabCursorPos); Vector3i voxelPos = Globals.clientState.clientWorldData.convertRealToBlockSpace(fabCursorPos);
int rotation = Globals.cursorState.getFabCursorRotation(); int rotation = Globals.cursorState.getFabCursorRotation();
Globals.clientConnection.queueOutgoingMessage(TerrainMessage.constructRequestPlaceFabMessage( Globals.clientConnection.queueOutgoingMessage(TerrainMessage.constructRequestPlaceFabMessage(
chunkPos.x, chunkPos.y, chunkPos.z, chunkPos.x, chunkPos.y, chunkPos.z,

View File

@ -195,7 +195,7 @@ public class ClientSimulation {
/// ///
/// C L I E N T C E L L M A N A G E R /// C L I E N T C E L L M A N A G E R
/// ///
if(Globals.clientDrawCellManager != null && Globals.clientWorldData != null){ if(Globals.clientDrawCellManager != null && Globals.clientState.clientWorldData != null){
//Cell manager do your things //Cell manager do your things
Globals.clientDrawCellManager.update(); Globals.clientDrawCellManager.update();
} }
@ -206,7 +206,7 @@ public class ClientSimulation {
*/ */
private void updateFluidCellManager(){ private void updateFluidCellManager(){
//fluid work //fluid work
if(Globals.fluidCellManager != null && Globals.clientWorldData != null && Globals.RUN_FLUIDS){ if(Globals.fluidCellManager != null && Globals.clientState.clientWorldData != null && Globals.RUN_FLUIDS){
Globals.fluidCellManager.update(); Globals.fluidCellManager.update();
} }
} }
@ -215,7 +215,7 @@ public class ClientSimulation {
* Updates the block cell manager * Updates the block cell manager
*/ */
private void updateBlockCellManager(){ private void updateBlockCellManager(){
if(Globals.clientBlockCellManager != null && Globals.clientWorldData != null){ if(Globals.clientBlockCellManager != null && Globals.clientState.clientWorldData != null){
Globals.clientBlockCellManager.update(); Globals.clientBlockCellManager.update();
} }
} }

View File

@ -174,7 +174,7 @@ public class ClientDrawCellManager {
Globals.profiler.beginCpuSample("ClientDrawCellManager.update"); Globals.profiler.beginCpuSample("ClientDrawCellManager.update");
if(shouldUpdate && Globals.playerEntity != null){ if(shouldUpdate && Globals.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity); Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3i playerWorldPos = Globals.clientWorldData.convertRealToWorldSpace(playerPos); Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos); int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
if(this.bustDistCache){ if(this.bustDistCache){
this.bustDistCache = false; this.bustDistCache = false;
@ -804,8 +804,8 @@ public class ClientDrawCellManager {
*/ */
public boolean isFullLOD(Vector3i worldPos){ public boolean isFullLOD(Vector3i worldPos){
Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity); Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d chunkMin = Globals.clientWorldData.convertWorldToRealSpace(worldPos); Vector3d chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
Vector3d chunkMax = Globals.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1)); Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST; return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
} }
@ -843,11 +843,11 @@ public class ClientDrawCellManager {
Vector3i worldPos = node.getMinBound(); Vector3i worldPos = node.getMinBound();
if( if(
worldPos.x >= 0 && worldPos.x >= 0 &&
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.y >= 0 && worldPos.y >= 0 &&
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod) !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)
){ ){
//client should request chunk data from server for each chunk necessary to create the model //client should request chunk data from server for each chunk necessary to create the model
@ -887,11 +887,11 @@ public class ClientDrawCellManager {
} }
if( if(
posToCheck.x >= 0 && posToCheck.x >= 0 &&
posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() && posToCheck.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
posToCheck.y >= 0 && posToCheck.y >= 0 &&
posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() && posToCheck.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
posToCheck.z >= 0 && posToCheck.z >= 0 &&
posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() && posToCheck.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod) !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod)
){ ){
LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + posToCheck); LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + posToCheck);
@ -951,11 +951,11 @@ public class ClientDrawCellManager {
} }
if( if(
posToCheck.x >= 0 && posToCheck.x >= 0 &&
posToCheck.x < Globals.clientWorldData.getWorldDiscreteSize() && posToCheck.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
posToCheck.y >= 0 && posToCheck.y >= 0 &&
posToCheck.y < Globals.clientWorldData.getWorldDiscreteSize() && posToCheck.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
posToCheck.z >= 0 && posToCheck.z >= 0 &&
posToCheck.z < Globals.clientWorldData.getWorldDiscreteSize() && posToCheck.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod) !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod)
){ ){
return false; return false;

View File

@ -16,9 +16,9 @@ public class BlockEditing {
* @param metadata The metadata of the block * @param metadata The metadata of the block
*/ */
public static void editBlock(short type, short metadata){ public static void editBlock(short type, short metadata){
Vector3i cornerVoxel = Globals.clientWorldData.convertRealToBlockSpace(Globals.cursorState.getBlockCursorPos()); Vector3i cornerVoxel = Globals.clientState.clientWorldData.convertRealToBlockSpace(Globals.cursorState.getBlockCursorPos());
int blockSize = Globals.cursorState.getBlockSize(); int blockSize = Globals.cursorState.getBlockSize();
Vector3i chunkPos = Globals.clientWorldData.convertRealToWorldSpace(Globals.cursorState.getBlockCursorPos()); Vector3i chunkPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(Globals.cursorState.getBlockCursorPos());
ScriptClientVoxelUtils.clientRequestEditBlock(chunkPos, cornerVoxel, type, metadata, blockSize); ScriptClientVoxelUtils.clientRequestEditBlock(chunkPos, cornerVoxel, type, metadata, blockSize);
} }
@ -26,9 +26,9 @@ public class BlockEditing {
* Destroy blocks * Destroy blocks
*/ */
public static void destroyBlock(){ public static void destroyBlock(){
Vector3i cornerVoxel = Globals.clientWorldData.convertRealToBlockSpace(Globals.cursorState.getBlockCursorPos()); Vector3i cornerVoxel = Globals.clientState.clientWorldData.convertRealToBlockSpace(Globals.cursorState.getBlockCursorPos());
int blockSize = Globals.cursorState.getBlockSize(); int blockSize = Globals.cursorState.getBlockSize();
Vector3i chunkPos = Globals.clientWorldData.convertRealToWorldSpace(Globals.cursorState.getBlockCursorPos()); Vector3i chunkPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(Globals.cursorState.getBlockCursorPos());
ScriptClientVoxelUtils.clientRequestEditBlock(chunkPos, cornerVoxel, (short)0, (short)0, blockSize); ScriptClientVoxelUtils.clientRequestEditBlock(chunkPos, cornerVoxel, (short)0, (short)0, blockSize);
} }

View File

@ -199,8 +199,8 @@ public class FoliageCell {
){ ){
FoliageCell rVal = new FoliageCell(); FoliageCell rVal = new FoliageCell();
rVal.lod = lod; rVal.lod = lod;
rVal.worldPos = Globals.clientWorldData.convertAbsoluteVoxelToWorldSpace(voxelAbsPos); rVal.worldPos = Globals.clientState.clientWorldData.convertAbsoluteVoxelToWorldSpace(voxelAbsPos);
rVal.voxelPos = Globals.clientWorldData.convertAbsoluteVoxelToRelativeVoxelSpace(voxelAbsPos); rVal.voxelPos = Globals.clientState.clientWorldData.convertAbsoluteVoxelToRelativeVoxelSpace(voxelAbsPos);
return rVal; return rVal;
} }
@ -213,8 +213,8 @@ public class FoliageCell {
){ ){
FoliageCell rVal = new FoliageCell(); FoliageCell rVal = new FoliageCell();
rVal.lod = lod; rVal.lod = lod;
rVal.worldPos = Globals.clientWorldData.convertAbsoluteVoxelToWorldSpace(voxelAbsPos); rVal.worldPos = Globals.clientState.clientWorldData.convertAbsoluteVoxelToWorldSpace(voxelAbsPos);
rVal.voxelPos = Globals.clientWorldData.convertAbsoluteVoxelToRelativeVoxelSpace(voxelAbsPos); rVal.voxelPos = Globals.clientState.clientWorldData.convertAbsoluteVoxelToRelativeVoxelSpace(voxelAbsPos);
rVal.hasGenerated = true; rVal.hasGenerated = true;
rVal.homogenous = true; rVal.homogenous = true;
return rVal; return rVal;

View File

@ -196,7 +196,7 @@ public class FoliageCellManager {
Globals.profiler.beginCpuSample("FoliageCellManager.update"); Globals.profiler.beginCpuSample("FoliageCellManager.update");
if(shouldUpdate && Globals.playerEntity != null && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager()){ if(shouldUpdate && Globals.playerEntity != null && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager()){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity); Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3i absVoxelPos = Globals.clientWorldData.convertRealToAbsoluteVoxelSpace(playerPos); Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(playerPos);
int distCache = this.getDistCache(this.lastPlayerPos, absVoxelPos); int distCache = this.getDistCache(this.lastPlayerPos, absVoxelPos);
if(bustDistCache || absVoxelPos.distance(this.lastPlayerPos) > TELEPORT_DISTANCE){ if(bustDistCache || absVoxelPos.distance(this.lastPlayerPos) > TELEPORT_DISTANCE){
distCache = BUST_META_CELLS; distCache = BUST_META_CELLS;
@ -743,8 +743,8 @@ public class FoliageCellManager {
*/ */
public boolean isFullLOD(Vector3i worldPos){ public boolean isFullLOD(Vector3i worldPos){
Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity); Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d chunkMin = Globals.clientWorldData.convertWorldToRealSpace(worldPos); Vector3d chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
Vector3d chunkMax = Globals.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1)); Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST; return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
} }
@ -768,9 +768,9 @@ public class FoliageCellManager {
* @param voxelZ The voxel z position * @param voxelZ The voxel z position
*/ */
public void markUpdateable(int worldX, int worldY, int worldZ, int voxelX, int voxelY, int voxelZ){ public void markUpdateable(int worldX, int worldY, int worldZ, int voxelX, int voxelY, int voxelZ){
int absVoxelX = Globals.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(voxelX,worldX); int absVoxelX = Globals.clientState.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(voxelX,worldX);
int absVoxelY = Globals.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(voxelY,worldY); int absVoxelY = Globals.clientState.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(voxelY,worldY);
int absVoxelZ = Globals.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(voxelZ,worldZ); int absVoxelZ = Globals.clientState.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(voxelZ,worldZ);
FoliageCell foliageCell = this.getFoliageCell(absVoxelX, absVoxelY, absVoxelZ); FoliageCell foliageCell = this.getFoliageCell(absVoxelX, absVoxelY, absVoxelZ);
foliageCell.ejectChunkData(); foliageCell.ejectChunkData();
foliageCell.setHasGenerated(false); foliageCell.setHasGenerated(false);
@ -787,9 +787,9 @@ public class FoliageCellManager {
for(int x = 0; x < ServerTerrainChunk.CHUNK_DIMENSION; x++){ for(int x = 0; x < ServerTerrainChunk.CHUNK_DIMENSION; x++){
for(int y = 0; y < ServerTerrainChunk.CHUNK_DIMENSION; y++){ for(int y = 0; y < ServerTerrainChunk.CHUNK_DIMENSION; y++){
for(int z = 0; z < ServerTerrainChunk.CHUNK_DIMENSION; z++){ for(int z = 0; z < ServerTerrainChunk.CHUNK_DIMENSION; z++){
int absVoxelX = Globals.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(x,worldX); int absVoxelX = Globals.clientState.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(x,worldX);
int absVoxelY = Globals.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(y,worldY); int absVoxelY = Globals.clientState.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(y,worldY);
int absVoxelZ = Globals.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(z,worldZ); int absVoxelZ = Globals.clientState.clientWorldData.convertRelativeVoxelToAbsoluteVoxelSpace(z,worldZ);
FoliageCell foliageCell = this.getFoliageCell(absVoxelX, absVoxelY, absVoxelZ); FoliageCell foliageCell = this.getFoliageCell(absVoxelX, absVoxelY, absVoxelZ);
foliageCell.ejectChunkData(); foliageCell.ejectChunkData();
foliageCell.setHasGenerated(false); foliageCell.setHasGenerated(false);
@ -806,14 +806,14 @@ public class FoliageCellManager {
*/ */
private boolean requestChunks(WorldOctTree.WorldOctTreeNode<FoliageCell> node){ private boolean requestChunks(WorldOctTree.WorldOctTreeNode<FoliageCell> node){
//min bound is in absolute voxel coordinates, need to convert to world coordinates //min bound is in absolute voxel coordinates, need to convert to world coordinates
Vector3i worldPos = Globals.clientWorldData.convertAbsoluteVoxelToWorldSpace(node.getMinBound()); Vector3i worldPos = Globals.clientState.clientWorldData.convertAbsoluteVoxelToWorldSpace(node.getMinBound());
if( if(
worldPos.x >= 0 && worldPos.x >= 0 &&
worldPos.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.y >= 0 && worldPos.y >= 0 &&
worldPos.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientWorldData.getWorldDiscreteSize() && worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE) !Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)
){ ){
//client should request chunk data from server for each chunk necessary to create the model //client should request chunk data from server for each chunk necessary to create the model

View File

@ -35,8 +35,8 @@ public class ClientVoxelSampler {
*/ */
public static int getVoxelType(Vector3d realPos){ public static int getVoxelType(Vector3d realPos){
int voxelId = 0; int voxelId = 0;
Vector3i chunkSpacePos = Globals.clientWorldData.convertRealToWorldSpace(realPos); Vector3i chunkSpacePos = Globals.clientState.clientWorldData.convertRealToWorldSpace(realPos);
Vector3i voxelSpacePos = Globals.clientWorldData.convertRealToVoxelSpace(realPos); Vector3i voxelSpacePos = Globals.clientState.clientWorldData.convertRealToVoxelSpace(realPos);
if(Globals.clientTerrainManager.containsChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE)){ if(Globals.clientTerrainManager.containsChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE)){
ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE); ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE);
voxelId = chunkData.getType(voxelSpacePos); voxelId = chunkData.getType(voxelSpacePos);

View File

@ -45,7 +45,7 @@ public class ImGuiChunkMonitor {
} }
if(ImGui.button("Break at chunk")){ if(ImGui.button("Break at chunk")){
if(Globals.foliageCellManager != null){ if(Globals.foliageCellManager != null){
Vector3i absVoxelPos = Globals.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.playerEntity)); Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.playerEntity));
Globals.foliageCellManager.addBreakPoint(absVoxelPos); Globals.foliageCellManager.addBreakPoint(absVoxelPos);
} }
} }

View File

@ -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.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
DrawCell cell = Globals.clientDrawCellManager.getDrawCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z); DrawCell cell = Globals.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.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
FoliageCell cell = Globals.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z); FoliageCell cell = Globals.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.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
FoliageCell cell = Globals.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z); FoliageCell cell = Globals.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.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Globals.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0); Globals.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0);
} }
} }

View File

@ -1,7 +1,7 @@
package electrosphere.collision; package electrosphere.collision;
import electrosphere.client.scene.ClientWorldData;
import electrosphere.client.terrain.manager.ClientTerrainManager; import electrosphere.client.terrain.manager.ClientTerrainManager;
import electrosphere.engine.Globals;
import electrosphere.server.datacell.ServerWorldData; import electrosphere.server.datacell.ServerWorldData;
import electrosphere.server.physics.terrain.manager.ServerTerrainManager; import electrosphere.server.physics.terrain.manager.ServerTerrainManager;
@ -11,7 +11,6 @@ public class CollisionWorldData {
ClientWorldData clientWorldData;
ClientTerrainManager clientTerrainManager; ClientTerrainManager clientTerrainManager;
@ -19,58 +18,58 @@ public class CollisionWorldData {
ServerWorldData serverWorldData; ServerWorldData serverWorldData;
ServerTerrainManager serverTerrainManager; ServerTerrainManager serverTerrainManager;
public CollisionWorldData(){
}
public CollisionWorldData(ServerWorldData serverWorldData){ public CollisionWorldData(ServerWorldData serverWorldData){
this.serverWorldData = serverWorldData; this.serverWorldData = serverWorldData;
} }
public CollisionWorldData(ClientWorldData clientWorldData){
this.clientWorldData = clientWorldData;
}
public Vector3f getWorldBoundMin(){ public Vector3f getWorldBoundMin(){
if(clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
return clientWorldData.getWorldBoundMin(); return Globals.clientState.clientWorldData.getWorldBoundMin();
} else { } else {
return serverWorldData.getWorldBoundMin(); return serverWorldData.getWorldBoundMin();
} }
} }
public Vector3f getWorldBoundMax(){ public Vector3f getWorldBoundMax(){
if(clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
return clientWorldData.getWorldBoundMax(); return Globals.clientState.clientWorldData.getWorldBoundMax();
} else { } else {
return serverWorldData.getWorldBoundMax(); return serverWorldData.getWorldBoundMax();
} }
} }
public int convertRealToWorld(double real){ public int convertRealToWorld(double real){
if(clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
return clientWorldData.convertRealToChunkSpace(real); return Globals.clientState.clientWorldData.convertRealToChunkSpace(real);
} else { } else {
return ServerWorldData.convertRealToChunkSpace(real); return ServerWorldData.convertRealToChunkSpace(real);
} }
} }
public double convertWorldToReal(int world){ public double convertWorldToReal(int world){
if(clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
return clientWorldData.convertChunkToRealSpace(world); return Globals.clientState.clientWorldData.convertChunkToRealSpace(world);
} else { } else {
return ServerWorldData.convertChunkToRealSpace(world); return ServerWorldData.convertChunkToRealSpace(world);
} }
} }
public int getDynamicInterpolationRatio(){ public int getDynamicInterpolationRatio(){
if(clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
return clientWorldData.getWorldDiscreteSize(); return Globals.clientState.clientWorldData.getWorldDiscreteSize();
} else { } else {
return serverWorldData.getDynamicInterpolationRatio(); return serverWorldData.getDynamicInterpolationRatio();
} }
} }
public int getWorldDiscreteSize(){ public int getWorldDiscreteSize(){
if(clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
return clientWorldData.getWorldDiscreteSize(); return Globals.clientState.clientWorldData.getWorldDiscreteSize();
} else { } else {
return serverWorldData.getWorldSizeDiscrete(); return serverWorldData.getWorldSizeDiscrete();
} }

View File

@ -12,6 +12,7 @@ import electrosphere.audio.VirtualAudioSourceManager;
import electrosphere.audio.collision.HitboxAudioService; import electrosphere.audio.collision.HitboxAudioService;
import electrosphere.audio.movement.MovementAudioService; import electrosphere.audio.movement.MovementAudioService;
import electrosphere.auth.AuthenticationManager; import electrosphere.auth.AuthenticationManager;
import electrosphere.client.ClientState;
import electrosphere.client.block.ClientBlockManager; import electrosphere.client.block.ClientBlockManager;
import electrosphere.client.block.cells.BlockTextureAtlas; import electrosphere.client.block.cells.BlockTextureAtlas;
import electrosphere.client.block.cells.ClientBlockCellManager; import electrosphere.client.block.cells.ClientBlockCellManager;
@ -23,7 +24,6 @@ import electrosphere.client.fluid.manager.ClientFluidManager;
import electrosphere.client.player.ClientPlayerData; import electrosphere.client.player.ClientPlayerData;
import electrosphere.client.scene.ClientLevelEditorData; import electrosphere.client.scene.ClientLevelEditorData;
import electrosphere.client.scene.ClientSceneWrapper; import electrosphere.client.scene.ClientSceneWrapper;
import electrosphere.client.scene.ClientWorldData;
import electrosphere.client.sim.ClientSimulation; import electrosphere.client.sim.ClientSimulation;
import electrosphere.client.terrain.cells.ClientDrawCellManager; import electrosphere.client.terrain.cells.ClientDrawCellManager;
import electrosphere.client.terrain.cells.VoxelTextureAtlas; import electrosphere.client.terrain.cells.VoxelTextureAtlas;
@ -351,7 +351,6 @@ public class Globals {
public static FoliageCellManager foliageCellManager; public static FoliageCellManager foliageCellManager;
//client world data //client world data
public static ClientWorldData clientWorldData;
public static ClientCharacterManager clientCharacterManager = new ClientCharacterManager(); public static ClientCharacterManager clientCharacterManager = new ClientCharacterManager();
//client gridded manager //client gridded manager
@ -431,6 +430,10 @@ public class Globals {
public static Object dragSourceInventory = null; public static Object dragSourceInventory = null;
public static Entity targetContainer = null; public static Entity targetContainer = null;
/**
* State for the client
*/
public static ClientState clientState = new ClientState();
@ -490,6 +493,10 @@ public class Globals {
RENDER_FLAG_RENDER_WHITE_BACKGROUND = false; RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
RENDER_FLAG_RENDER_UI = true; RENDER_FLAG_RENDER_UI = true;
RENDER_FLAG_RENDER_UI_BOUNDS = false; RENDER_FLAG_RENDER_UI_BOUNDS = false;
//client state
Globals.clientState = new ClientState();
//load in default texture map //load in default texture map
textureMapDefault = TextureMap.construct("Textures/default_texture_map.json"); textureMapDefault = TextureMap.construct("Textures/default_texture_map.json");
//load model pretransforms //load model pretransforms
@ -719,7 +726,7 @@ public class Globals {
Globals.playerManager = new PlayerManager(); Globals.playerManager = new PlayerManager();
Globals.clientScene = new Scene(); Globals.clientScene = new Scene();
Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine()); Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
Globals.clientWorldData = null; Globals.clientState = new ClientState();
Globals.clientSynchronizationManager = new ClientSynchronizationManager(); Globals.clientSynchronizationManager = new ClientSynchronizationManager();
Globals.server = null; Globals.server = null;
Globals.serverSynchronizationManager = new ServerSynchronizationManager(); Globals.serverSynchronizationManager = new ServerSynchronizationManager();
@ -748,7 +755,7 @@ public class Globals {
Globals.realmManager = null; Globals.realmManager = null;
Globals.clientSceneWrapper = null; Globals.clientSceneWrapper = null;
Globals.clientScene = null; Globals.clientScene = null;
Globals.clientWorldData = null; Globals.clientState = null;
Globals.audioEngine = null; Globals.audioEngine = null;
Globals.renderingEngine = null; Globals.renderingEngine = null;
Globals.threadManager = null; Globals.threadManager = null;

View File

@ -320,7 +320,7 @@ public class ClientLoading {
static void initDrawCellManager(boolean blockForInit){ static void initDrawCellManager(boolean blockForInit){
int iterations = 0; int iterations = 0;
WindowUtils.updateLoadingWindow("WAITING ON WORLD DATA"); WindowUtils.updateLoadingWindow("WAITING ON WORLD DATA");
while(blockForInit && (Globals.clientWorldData == null || InitialAssetLoading.atlasQueuedTexture == null || !InitialAssetLoading.atlasQueuedTexture.hasLoaded()) && Globals.threadManager.shouldKeepRunning()){ while(blockForInit && (Globals.clientState.clientWorldData == null || InitialAssetLoading.atlasQueuedTexture == null || !InitialAssetLoading.atlasQueuedTexture.hasLoaded()) && Globals.threadManager.shouldKeepRunning()){
try { try {
TimeUnit.MILLISECONDS.sleep(10); TimeUnit.MILLISECONDS.sleep(10);
iterations++; iterations++;
@ -329,14 +329,14 @@ public class ClientLoading {
} }
if(iterations > MAX_DRAW_CELL_WAIT){ if(iterations > MAX_DRAW_CELL_WAIT){
String message = "Draw cell took too long to init!\n" + String message = "Draw cell took too long to init!\n" +
Globals.clientWorldData + "\n" + Globals.clientState.clientWorldData + "\n" +
InitialAssetLoading.atlasQueuedTexture.hasLoaded(); InitialAssetLoading.atlasQueuedTexture.hasLoaded();
throw new IllegalStateException(message); throw new IllegalStateException(message);
} }
} }
//initialize draw cell manager //initialize draw cell manager
// Globals.drawCellManager = new DrawCellManager(Globals.clientTerrainManager, 0, 0, 0); // Globals.drawCellManager = new DrawCellManager(Globals.clientTerrainManager, 0, 0, 0);
Globals.clientDrawCellManager = new ClientDrawCellManager(Globals.voxelTextureAtlas, Globals.clientWorldData.getWorldDiscreteSize()); Globals.clientDrawCellManager = new ClientDrawCellManager(Globals.voxelTextureAtlas, Globals.clientState.clientWorldData.getWorldDiscreteSize());
//Alerts the client simulation that it should start loading terrain //Alerts the client simulation that it should start loading terrain
Globals.clientSimulation.setLoadingTerrain(true); Globals.clientSimulation.setLoadingTerrain(true);
//wait for all the terrain data to arrive //wait for all the terrain data to arrive
@ -366,7 +366,7 @@ public class ClientLoading {
//wait for world data //wait for world data
WindowUtils.updateLoadingWindow("WAITING ON WORLD DATA"); WindowUtils.updateLoadingWindow("WAITING ON WORLD DATA");
while(blockForInit && Globals.clientWorldData == null && Globals.threadManager.shouldKeepRunning()){ while(blockForInit && Globals.clientState.clientWorldData == null && Globals.threadManager.shouldKeepRunning()){
try { try {
TimeUnit.MILLISECONDS.sleep(10); TimeUnit.MILLISECONDS.sleep(10);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
@ -406,7 +406,7 @@ public class ClientLoading {
static void initBlockCellManager(boolean blockForInit){ static void initBlockCellManager(boolean blockForInit){
int iterations = 0; int iterations = 0;
WindowUtils.updateLoadingWindow("WAITING ON WORLD DATA"); WindowUtils.updateLoadingWindow("WAITING ON WORLD DATA");
while(blockForInit && (Globals.clientWorldData == null || InitialAssetLoading.atlasQueuedTexture == null || !InitialAssetLoading.atlasQueuedTexture.hasLoaded()) && Globals.threadManager.shouldKeepRunning()){ while(blockForInit && (Globals.clientState.clientWorldData == null || InitialAssetLoading.atlasQueuedTexture == null || !InitialAssetLoading.atlasQueuedTexture.hasLoaded()) && Globals.threadManager.shouldKeepRunning()){
try { try {
TimeUnit.MILLISECONDS.sleep(10); TimeUnit.MILLISECONDS.sleep(10);
iterations++; iterations++;
@ -415,12 +415,12 @@ public class ClientLoading {
} }
if(iterations > MAX_DRAW_CELL_WAIT){ if(iterations > MAX_DRAW_CELL_WAIT){
String message = "Draw cell took too long to init!\n" + String message = "Draw cell took too long to init!\n" +
Globals.clientWorldData + "\n" + Globals.clientState.clientWorldData + "\n" +
InitialAssetLoading.atlasQueuedTexture.hasLoaded(); InitialAssetLoading.atlasQueuedTexture.hasLoaded();
throw new IllegalStateException(message); throw new IllegalStateException(message);
} }
} }
Globals.clientBlockCellManager = new ClientBlockCellManager(Globals.blockTextureAtlas, Globals.clientWorldData.getWorldDiscreteSize()); Globals.clientBlockCellManager = new ClientBlockCellManager(Globals.blockTextureAtlas, Globals.clientState.clientWorldData.getWorldDiscreteSize());
//Alerts the client simulation that it should start loading blocks //Alerts the client simulation that it should start loading blocks
Globals.clientSimulation.setLoadingTerrain(true); Globals.clientSimulation.setLoadingTerrain(true);
//wait for all the block data to arrive //wait for all the block data to arrive
@ -446,7 +446,7 @@ public class ClientLoading {
* Starts up the foliage manager * Starts up the foliage manager
*/ */
private static void initFoliageManager(){ private static void initFoliageManager(){
Globals.foliageCellManager = new FoliageCellManager(Globals.clientWorldData.getWorldDiscreteSize()); Globals.foliageCellManager = new FoliageCellManager(Globals.clientState.clientWorldData.getWorldDiscreteSize());
Globals.foliageCellManager.init(); Globals.foliageCellManager.init();
// Globals.foliageCellManager.start(); // Globals.foliageCellManager.start();
} }

View File

@ -68,7 +68,7 @@ public class ViewportLoading {
Globals.clientConnection.queueOutgoingMessage(TerrainMessage.constructRequestMetadataMessage()); Globals.clientConnection.queueOutgoingMessage(TerrainMessage.constructRequestMetadataMessage());
//block for client world data //block for client world data
while(Globals.clientWorldData == null){ while(Globals.clientState.clientWorldData == null){
try { try {
TimeUnit.MILLISECONDS.sleep(10); TimeUnit.MILLISECONDS.sleep(10);
} catch (InterruptedException e) { } catch (InterruptedException e) {

View File

@ -66,9 +66,11 @@ public class ServiceManager {
* Fires all functions required to unload a scene. * Fires all functions required to unload a scene.
*/ */
public void unloadScene(){ public void unloadScene(){
if(this.trackedServices != null){
for(Service serivce : this.trackedServices){ for(Service serivce : this.trackedServices){
serivce.unloadScene(); serivce.unloadScene();
} }
} }
}
} }

View File

@ -53,15 +53,15 @@ public class ClientCollidableTree implements BehaviorTree {
Quaterniond rotation = EntityUtils.getRotation(parent); Quaterniond rotation = EntityUtils.getRotation(parent);
Vector3d newPosition = new Vector3d(position); Vector3d newPosition = new Vector3d(position);
//bound to world bounds //bound to world bounds
if(Globals.clientWorldData != null){ if(Globals.clientState.clientWorldData != null){
if(newPosition.x < Globals.clientWorldData.getWorldBoundMin().x){ if(newPosition.x < Globals.clientState.clientWorldData.getWorldBoundMin().x){
newPosition.x = Globals.clientWorldData.getWorldBoundMin().x; newPosition.x = Globals.clientState.clientWorldData.getWorldBoundMin().x;
} }
if(newPosition.y < Globals.clientWorldData.getWorldBoundMin().y){ if(newPosition.y < Globals.clientState.clientWorldData.getWorldBoundMin().y){
newPosition.y = Globals.clientWorldData.getWorldBoundMin().y; newPosition.y = Globals.clientState.clientWorldData.getWorldBoundMin().y;
} }
if(newPosition.z < Globals.clientWorldData.getWorldBoundMin().z){ if(newPosition.z < Globals.clientState.clientWorldData.getWorldBoundMin().z){
newPosition.z = Globals.clientWorldData.getWorldBoundMin().z; newPosition.z = Globals.clientState.clientWorldData.getWorldBoundMin().z;
} }
} }
PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), newPosition, rotation, body); PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), newPosition, rotation, body);

View File

@ -2,7 +2,6 @@ package electrosphere.entity.state.movement.editor;
import electrosphere.entity.state.gravity.GravityUtils; import electrosphere.entity.state.gravity.GravityUtils;
import electrosphere.client.scene.ClientWorldData;
import electrosphere.data.creature.movement.EditorMovementSystem; import electrosphere.data.creature.movement.EditorMovementSystem;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.creature.CreatureUtils;
@ -197,7 +196,6 @@ public class ClientEditorMovementTree implements BehaviorTree {
float maxNaturalVelocity = EDITOR_MAX_VELOCITY; float maxNaturalVelocity = EDITOR_MAX_VELOCITY;
Entity serverEntity = EntityLookupUtils.getEntityById(Globals.clientSceneWrapper.mapClientToServerId(parent.getId())); Entity serverEntity = EntityLookupUtils.getEntityById(Globals.clientSceneWrapper.mapClientToServerId(parent.getId()));
ClientWorldData clientWorldData = Globals.clientWorldData;
// //
//rotation update //rotation update
@ -260,7 +258,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
rotation.set(movementQuaternion); rotation.set(movementQuaternion);
position.set(new Vector3d(position).add(new Vector3d(movementVector).mul(velocity))); position.set(new Vector3d(position).add(new Vector3d(movementVector).mul(velocity)));
if(serverEntity != null){ if(serverEntity != null){
if(position.x >= 0 && position.y >= 0 && position.z >= 0 && position.x < clientWorldData.getWorldBoundMax().x && position.y < clientWorldData.getWorldBoundMax().y && position.z < clientWorldData.getWorldBoundMax().z){ if(position.x >= 0 && position.y >= 0 && position.z >= 0 && position.x < Globals.clientState.clientWorldData.getWorldBoundMax().x && position.y < Globals.clientState.clientWorldData.getWorldBoundMax().y && position.z < Globals.clientState.clientWorldData.getWorldBoundMax().z){
ServerEntityUtils.repositionEntity(serverEntity, new Vector3d(position)); ServerEntityUtils.repositionEntity(serverEntity, new Vector3d(position));
} }
} }
@ -277,7 +275,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
rotation.set(movementQuaternion); rotation.set(movementQuaternion);
position.set(new Vector3d(position).add(new Vector3d(movementVector).mul(velocity))); position.set(new Vector3d(position).add(new Vector3d(movementVector).mul(velocity)));
if(serverEntity != null){ if(serverEntity != null){
if(position.x >= 0 && position.y >= 0 && position.z >= 0 && position.x < clientWorldData.getWorldBoundMax().x && position.y < clientWorldData.getWorldBoundMax().y && position.z < clientWorldData.getWorldBoundMax().z){ if(position.x >= 0 && position.y >= 0 && position.z >= 0 && position.x < Globals.clientState.clientWorldData.getWorldBoundMax().x && position.y < Globals.clientState.clientWorldData.getWorldBoundMax().y && position.z < Globals.clientState.clientWorldData.getWorldBoundMax().z){
ServerEntityUtils.repositionEntity(serverEntity, new Vector3d(position)); ServerEntityUtils.repositionEntity(serverEntity, new Vector3d(position));
} }
} }
@ -300,7 +298,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
rotation.set(movementQuaternion); rotation.set(movementQuaternion);
position.set(new Vector3d(position).add(new Vector3d(movementVector).mul(velocity))); position.set(new Vector3d(position).add(new Vector3d(movementVector).mul(velocity)));
if(serverEntity != null){ if(serverEntity != null){
if(position.x >= 0 && position.y >= 0 && position.z >= 0 && position.x < clientWorldData.getWorldBoundMax().x && position.y < clientWorldData.getWorldBoundMax().y && position.z < clientWorldData.getWorldBoundMax().z){ if(position.x >= 0 && position.y >= 0 && position.z >= 0 && position.x < Globals.clientState.clientWorldData.getWorldBoundMax().x && position.y < Globals.clientState.clientWorldData.getWorldBoundMax().y && position.z < Globals.clientState.clientWorldData.getWorldBoundMax().z){
ServerEntityUtils.repositionEntity(serverEntity, new Vector3d(position)); ServerEntityUtils.repositionEntity(serverEntity, new Vector3d(position));
} }
} }

View File

@ -31,7 +31,7 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
Globals.profiler.beginAggregateCpuSample("TerrainProtocol.handleTerrainMessage"); Globals.profiler.beginAggregateCpuSample("TerrainProtocol.handleTerrainMessage");
switch(message.getMessageSubtype()){ switch(message.getMessageSubtype()){
case RESPONSEMETADATA: case RESPONSEMETADATA:
Globals.clientWorldData = new ClientWorldData( Globals.clientState.clientWorldData = new ClientWorldData(
//Vector3f worldMinPoint, Vector3f worldMaxPoint, int dynamicInterpolationRatio, float randomDampener, int worldDiscreteSize //Vector3f worldMinPoint, Vector3f worldMaxPoint, int dynamicInterpolationRatio, float randomDampener, int worldDiscreteSize
new Vector3f( new Vector3f(
message.getworldMinX(), message.getworldMinX(),
@ -45,7 +45,7 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
), ),
message.getworldSizeDiscrete() message.getworldSizeDiscrete()
); );
Globals.clientSceneWrapper.getCollisionEngine().setCollisionWorldData(new CollisionWorldData(Globals.clientWorldData)); Globals.clientSceneWrapper.getCollisionEngine().setCollisionWorldData(new CollisionWorldData());
Globals.clientConnection.getMessageProtocol().setHasReceivedWorld(true); Globals.clientConnection.getMessageProtocol().setHasReceivedWorld(true);
break; break;
case SPAWNPOSITION: case SPAWNPOSITION:
@ -111,9 +111,9 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
//mark all relevant drawcells as updateable //mark all relevant drawcells as updateable
for(Vector3i worldPosToUpdate : positionsToUpdate){ for(Vector3i worldPosToUpdate : positionsToUpdate){
if( if(
worldPosToUpdate.x >= 0 && worldPosToUpdate.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPosToUpdate.x >= 0 && worldPosToUpdate.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPosToUpdate.y >= 0 && worldPosToUpdate.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPosToUpdate.y >= 0 && worldPosToUpdate.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPosToUpdate.z >= 0 && worldPosToUpdate.z < Globals.clientWorldData.getWorldDiscreteSize() worldPosToUpdate.z >= 0 && worldPosToUpdate.z < Globals.clientState.clientWorldData.getWorldDiscreteSize()
){ ){
// //
//mark terrain chunk for update //mark terrain chunk for update
@ -223,9 +223,9 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
//mark all relevant drawcells as updateable //mark all relevant drawcells as updateable
for(Vector3i worldPosToUpdate : positionsToUpdate){ for(Vector3i worldPosToUpdate : positionsToUpdate){
if( if(
worldPosToUpdate.x >= 0 && worldPosToUpdate.x < Globals.clientWorldData.getWorldDiscreteSize() && worldPosToUpdate.x >= 0 && worldPosToUpdate.x < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPosToUpdate.y >= 0 && worldPosToUpdate.y < Globals.clientWorldData.getWorldDiscreteSize() && worldPosToUpdate.y >= 0 && worldPosToUpdate.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPosToUpdate.z >= 0 && worldPosToUpdate.z < Globals.clientWorldData.getWorldDiscreteSize() worldPosToUpdate.z >= 0 && worldPosToUpdate.z < Globals.clientState.clientWorldData.getWorldDiscreteSize()
){ ){
// //
//mark terrain chunk for update //mark terrain chunk for update

View File

@ -66,7 +66,7 @@ public class DataCellPhysicsManager {
* @param discreteY The initial discrete position Y coordinate * @param discreteY The initial discrete position Y coordinate
*/ */
public DataCellPhysicsManager(Realm realm, int discreteX, int discreteY, int discreteZ){ public DataCellPhysicsManager(Realm realm, int discreteX, int discreteY, int discreteZ){
worldBoundDiscreteMax = (int)(Globals.clientWorldData.getWorldBoundMin().x / ServerTerrainChunk.CHUNK_DIMENSION * 1.0f); worldBoundDiscreteMax = (int)(Globals.clientState.clientWorldData.getWorldBoundMin().x / ServerTerrainChunk.CHUNK_DIMENSION * 1.0f);
cells = new HashSet<PhysicsDataCell>(); cells = new HashSet<PhysicsDataCell>();
invalid = new HashSet<String>(); invalid = new HashSet<String>();
updateable = new HashSet<String>(); updateable = new HashSet<String>();

View File

@ -35,7 +35,7 @@ public class ClientDrawCellManagerTests {
public void testJoinCase(){ public void testJoinCase(){
int worldDiscreteSize = 64; int worldDiscreteSize = 64;
Globals.clientWorldData = new ClientWorldData(new Vector3f(0), new Vector3f(worldDiscreteSize * ServerTerrainChunk.CHUNK_DIMENSION), worldDiscreteSize); Globals.clientState.clientWorldData = new ClientWorldData(new Vector3f(0), new Vector3f(worldDiscreteSize * ServerTerrainChunk.CHUNK_DIMENSION), worldDiscreteSize);
ClientDrawCellManager manager = new ClientDrawCellManager(null, 64); ClientDrawCellManager manager = new ClientDrawCellManager(null, 64);
Vector3i playerPos = new Vector3i(0,0,0); Vector3i playerPos = new Vector3i(0,0,0);
WorldOctTreeNode<DrawCell> node = WorldOctTreeNode.constructorForTests(manager.chunkTree, 1, new Vector3i(16,0,0), new Vector3i(32,16,16)); WorldOctTreeNode<DrawCell> node = WorldOctTreeNode.constructorForTests(manager.chunkTree, 1, new Vector3i(16,0,0), new Vector3i(32,16,16));

View File

@ -30,7 +30,7 @@ public class StateCleanupCheckerExtension implements AfterEachCallback {
Globals.playerManager, Globals.playerManager,
LoggerInterface.loggerEngine, LoggerInterface.loggerEngine,
RenderingEngine.screenFramebuffer, RenderingEngine.screenFramebuffer,
Globals.clientWorldData, Globals.clientState,
}; };
for(Object object : objectsToCheck){ for(Object object : objectsToCheck){
if(object != null){ if(object != null){