bugfixes
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
3db6180c0e
commit
7da8472d0e
@ -1100,6 +1100,11 @@ Fix backing out to main menu
|
|||||||
Refactor ShaderProgram -> VisualShader
|
Refactor ShaderProgram -> VisualShader
|
||||||
Break out shader uniform setting into shared file
|
Break out shader uniform setting into shared file
|
||||||
Fix being able to walk off far side of the world (ie in level editor)
|
Fix being able to walk off far side of the world (ie in level editor)
|
||||||
|
Fix chunks saving to disk in wrong stride
|
||||||
|
Fix server terrain generation lock spinning on loading terrain from disk
|
||||||
|
Fix crosshair NPE when camera undefined
|
||||||
|
Fix ray casting entity filtering bug
|
||||||
|
Fix ClientTerrainManager concurrent editing bug
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public class Crosshair {
|
|||||||
|
|
||||||
static final float TARGET_MAX_DIST = 1;
|
static final float TARGET_MAX_DIST = 1;
|
||||||
public static void checkTargetable(){
|
public static void checkTargetable(){
|
||||||
if(crossHairEntity != null && Globals.playerEntity != null){
|
if(crossHairEntity != null && Globals.playerEntity != null && Globals.playerCamera != null){
|
||||||
Vector3d parentPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d parentPos = EntityUtils.getPosition(Globals.playerEntity);
|
||||||
// if(currentTarget == null){
|
// if(currentTarget == null){
|
||||||
if(!crosshairActive){
|
if(!crosshairActive){
|
||||||
|
|||||||
@ -78,6 +78,11 @@ public class ClientTerrainManager {
|
|||||||
* Tracks what outgoing requests are currently active
|
* Tracks what outgoing requests are currently active
|
||||||
*/
|
*/
|
||||||
Map<Long,Integer> requestedMap = new HashMap<Long,Integer>();
|
Map<Long,Integer> requestedMap = new HashMap<Long,Integer>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to clear the request map
|
||||||
|
*/
|
||||||
|
List<Long> toClearFailedRequests = new LinkedList<Long>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -178,11 +183,17 @@ public class ClientTerrainManager {
|
|||||||
for(Long key : this.requestedMap.keySet()){
|
for(Long key : this.requestedMap.keySet()){
|
||||||
int duration = this.requestedMap.get(key);
|
int duration = this.requestedMap.get(key);
|
||||||
if(duration > FAILED_REQUEST_THRESHOLD){
|
if(duration > FAILED_REQUEST_THRESHOLD){
|
||||||
this.requestedMap.remove(key);
|
toClearFailedRequests.add(key);
|
||||||
} else {
|
} else {
|
||||||
this.requestedMap.put(key,duration + 1);
|
this.requestedMap.put(key,duration + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(this.toClearFailedRequests.size() > 0){
|
||||||
|
for(Long key : toClearFailedRequests){
|
||||||
|
this.requestedMap.remove(key);
|
||||||
|
}
|
||||||
|
this.toClearFailedRequests.clear();
|
||||||
|
}
|
||||||
lock.release();
|
lock.release();
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,8 +95,8 @@ void RayCallback(void *Data, dGeomID Geometry1, dGeomID Geometry2) {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
collidable1 != null && collidable1.getParent() != Globals.playerEntity && //don't self cast -- should work on both server and client
|
(collidable1 == null || collidable1 != null && collidable1.getParent() != Globals.playerEntity) && //don't self cast -- should work on both server and client
|
||||||
collidable2 != null && collidable2.getParent() != Globals.playerEntity //don't self cast -- should work on both server and client
|
(collidable2 == null || collidable2 != null && collidable2.getParent() != Globals.playerEntity) //don't self cast -- should work on both server and client
|
||||||
){
|
){
|
||||||
//calculate collisions
|
//calculate collisions
|
||||||
int numc = OdeHelper.collide(o1,o2,MAX_CONTACTS,contacts.getGeomBuffer());
|
int numc = OdeHelper.collide(o1,o2,MAX_CONTACTS,contacts.getGeomBuffer());
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import electrosphere.engine.Globals;
|
|||||||
import electrosphere.engine.signal.Signal.SignalType;
|
import electrosphere.engine.signal.Signal.SignalType;
|
||||||
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
||||||
import electrosphere.renderer.ui.elements.Window;
|
import electrosphere.renderer.ui.elements.Window;
|
||||||
|
import electrosphere.server.datacell.RealmManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loading thread that returns the client to the main menu
|
* Loading thread that returns the client to the main menu
|
||||||
@ -47,8 +48,10 @@ public class MainMenuLoading {
|
|||||||
* Resets the client state
|
* Resets the client state
|
||||||
*/
|
*/
|
||||||
private static void resetClientState(){
|
private static void resetClientState(){
|
||||||
|
Globals.playerEntity = null;
|
||||||
Globals.clientSimulation = null;
|
Globals.clientSimulation = null;
|
||||||
Globals.clientConnection.setShouldDisconnect(true);
|
Globals.clientConnection.setShouldDisconnect(true);
|
||||||
|
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +62,7 @@ public class MainMenuLoading {
|
|||||||
Globals.server = null;
|
Globals.server = null;
|
||||||
Globals.serverSynchronizationManager = null;
|
Globals.serverSynchronizationManager = null;
|
||||||
Globals.realmManager.reset();
|
Globals.realmManager.reset();
|
||||||
Globals.realmManager = null;
|
Globals.realmManager = new RealmManager();
|
||||||
Globals.macroSimulation = null;
|
Globals.macroSimulation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -209,15 +209,22 @@ public class RealmManager {
|
|||||||
* Resets the realm manager
|
* Resets the realm manager
|
||||||
*/
|
*/
|
||||||
public void reset(){
|
public void reset(){
|
||||||
for(Realm realm : this.realms){
|
|
||||||
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerTerrainManager() != null){
|
|
||||||
realm.getServerWorldData().getServerTerrainManager().closeThreads();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.realms.clear();
|
this.realms.clear();
|
||||||
this.entityToRealmMap.clear();
|
this.entityToRealmMap.clear();
|
||||||
this.playerToRealmMap.clear();
|
this.playerToRealmMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the realm manager, destroying all resources
|
||||||
|
*/
|
||||||
|
public void close(){
|
||||||
|
for(Realm realm : this.realms){
|
||||||
|
if(realm.getServerWorldData() != null && realm.getServerWorldData().getServerTerrainManager() != null){
|
||||||
|
realm.getServerWorldData().getServerTerrainManager().closeThreads();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import java.nio.FloatBuffer;
|
|||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.zip.DeflaterOutputStream;
|
import java.util.zip.DeflaterOutputStream;
|
||||||
import java.util.zip.InflaterOutputStream;
|
import java.util.zip.InflaterOutputStream;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class ChunkDiskMap {
|
|||||||
* Locks the chunk disk map for thread safety
|
* Locks the chunk disk map for thread safety
|
||||||
*/
|
*/
|
||||||
@Exclude
|
@Exclude
|
||||||
Semaphore lock = new Semaphore(1);
|
ReentrantLock lock = new ReentrantLock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -90,9 +90,9 @@ public class ChunkDiskMap {
|
|||||||
* @return True if the map contains the chunk, false otherwise
|
* @return True if the map contains the chunk, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean containsTerrainAtPosition(int worldX, int worldY, int worldZ){
|
public boolean containsTerrainAtPosition(int worldX, int worldY, int worldZ){
|
||||||
lock.acquireUninterruptibly();
|
lock.lock();
|
||||||
boolean rVal = worldPosFileMap.containsKey(getTerrainChunkKey(worldX, worldY, worldZ));
|
boolean rVal = worldPosFileMap.containsKey(getTerrainChunkKey(worldX, worldY, worldZ));
|
||||||
lock.release();
|
lock.unlock();
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +104,9 @@ public class ChunkDiskMap {
|
|||||||
* @return True if the map contains the chunk, false otherwise
|
* @return True if the map contains the chunk, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean containsFluidAtPosition(int worldX, int worldY, int worldZ){
|
public boolean containsFluidAtPosition(int worldX, int worldY, int worldZ){
|
||||||
lock.acquireUninterruptibly();
|
lock.lock();
|
||||||
boolean rVal = worldPosFileMap.containsKey(getFluidChunkKey(worldX, worldY, worldZ));
|
boolean rVal = worldPosFileMap.containsKey(getFluidChunkKey(worldX, worldY, worldZ));
|
||||||
lock.release();
|
lock.unlock();
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ public class ChunkDiskMap {
|
|||||||
* @return The server terrain chunk if it exists, null otherwise
|
* @return The server terrain chunk if it exists, null otherwise
|
||||||
*/
|
*/
|
||||||
public ServerTerrainChunk getTerrainChunk(int worldX, int worldY, int worldZ){
|
public ServerTerrainChunk getTerrainChunk(int worldX, int worldY, int worldZ){
|
||||||
lock.acquireUninterruptibly();
|
lock.lock();
|
||||||
LoggerInterface.loggerEngine.INFO("Load chunk " + worldX + " " + worldY + " " + worldZ);
|
LoggerInterface.loggerEngine.INFO("Load chunk " + worldX + " " + worldY + " " + worldZ);
|
||||||
ServerTerrainChunk rVal = null;
|
ServerTerrainChunk rVal = null;
|
||||||
if(containsTerrainAtPosition(worldX, worldY, worldZ)){
|
if(containsTerrainAtPosition(worldX, worldY, worldZ)){
|
||||||
@ -142,7 +142,7 @@ public class ChunkDiskMap {
|
|||||||
if(rawData != null){
|
if(rawData != null){
|
||||||
ByteBuffer buffer = ByteBuffer.wrap(rawData);
|
ByteBuffer buffer = ByteBuffer.wrap(rawData);
|
||||||
FloatBuffer floatView = buffer.asFloatBuffer();
|
FloatBuffer floatView = buffer.asFloatBuffer();
|
||||||
int DIM = ServerTerrainChunk.CHUNK_DIMENSION;
|
int DIM = ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE;
|
||||||
float[][][] weights = new float[DIM][DIM][DIM];
|
float[][][] weights = new float[DIM][DIM][DIM];
|
||||||
int[][][] values = new int[DIM][DIM][DIM];
|
int[][][] values = new int[DIM][DIM][DIM];
|
||||||
for(int x = 0; x < DIM; x++){
|
for(int x = 0; x < DIM; x++){
|
||||||
@ -171,7 +171,7 @@ public class ChunkDiskMap {
|
|||||||
rVal = new ServerTerrainChunk(worldX, worldY, worldZ, homogenous ? firstType : ChunkData.NOT_HOMOGENOUS, weights, values);
|
rVal = new ServerTerrainChunk(worldX, worldY, worldZ, homogenous ? firstType : ChunkData.NOT_HOMOGENOUS, weights, values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lock.release();
|
lock.unlock();
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ public class ChunkDiskMap {
|
|||||||
* @param terrainChunk The terrain chunk
|
* @param terrainChunk The terrain chunk
|
||||||
*/
|
*/
|
||||||
public void saveToDisk(ServerTerrainChunk terrainChunk){
|
public void saveToDisk(ServerTerrainChunk terrainChunk){
|
||||||
lock.acquireUninterruptibly();
|
lock.lock();
|
||||||
LoggerInterface.loggerEngine.DEBUG("Save to disk: " + terrainChunk.getWorldX() + " " + terrainChunk.getWorldY() + " " + terrainChunk.getWorldZ());
|
LoggerInterface.loggerEngine.DEBUG("Save to disk: " + terrainChunk.getWorldX() + " " + terrainChunk.getWorldY() + " " + terrainChunk.getWorldZ());
|
||||||
//get the file name for this chunk
|
//get the file name for this chunk
|
||||||
String fileName = null;
|
String fileName = null;
|
||||||
@ -193,7 +193,7 @@ public class ChunkDiskMap {
|
|||||||
//generate binary for the file
|
//generate binary for the file
|
||||||
float[][][] weights = terrainChunk.getWeights();
|
float[][][] weights = terrainChunk.getWeights();
|
||||||
int[][][] values = terrainChunk.getValues();
|
int[][][] values = terrainChunk.getValues();
|
||||||
int DIM = ServerTerrainChunk.CHUNK_DIMENSION;
|
int DIM = ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE;
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(DIM * DIM * DIM * 4 + DIM * DIM * DIM * 4);
|
ByteBuffer buffer = ByteBuffer.allocate(DIM * DIM * DIM * 4 + DIM * DIM * DIM * 4);
|
||||||
FloatBuffer floatView = buffer.asFloatBuffer();
|
FloatBuffer floatView = buffer.asFloatBuffer();
|
||||||
for(int x = 0; x < DIM; x++){
|
for(int x = 0; x < DIM; x++){
|
||||||
@ -227,7 +227,7 @@ public class ChunkDiskMap {
|
|||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
lock.release();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user