server data cell readiness fix
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-09-04 19:49:21 -04:00
parent b094c78ef1
commit b0a92ba6e1
9 changed files with 89 additions and 10 deletions

View File

@ -44,9 +44,7 @@ public class ThreadManager {
}
}
for(Thread thread : threadsToRemove){
while(loadingThreads.contains(thread)){
loadingThreads.remove(thread);
}
loadingThreads.remove(thread);
}
threadLock.release();

View File

@ -151,6 +151,9 @@ public class CameraEntityUtils {
}
public static Vector3f getCameraCenter(Entity camera){
if(camera == null){
return null;
}
return (Vector3f)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_CENTER);
}
@ -159,6 +162,9 @@ public class CameraEntityUtils {
}
public static Vector3f getCameraEye(Entity camera){
if(camera == null){
return null;
}
return (Vector3f)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_EYE);
}
@ -175,6 +181,9 @@ public class CameraEntityUtils {
}
public static float getCameraYaw(Entity camera){
if(camera == null){
return 0f;
}
return (float)camera.getData(EntityDataStrings.CAMERA_YAW);
}

View File

@ -478,12 +478,12 @@ public class RenderingEngine {
}
//generate depth map
if(Globals.RENDER_FLAG_RENDER_SHADOW_MAP){
if(Globals.RENDER_FLAG_RENDER_SHADOW_MAP && shouldRunPipelines()){
shadowMapPipeline.render(openGLState, renderPipelineState);
}
//render volume buffer
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT && shouldRunPipelines()){
volumeBufferPipeline.render(openGLState, renderPipelineState);
}
@ -493,7 +493,7 @@ public class RenderingEngine {
//Render content to the game framebuffer
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT && shouldRunPipelines()){
if(Globals.userSettings.getGraphicsPerformanceOIT()){
mainContentPipeline.render(openGLState, renderPipelineState);
} else {
@ -700,6 +700,17 @@ public class RenderingEngine {
return lastCode;
}
/**
* Checks if pipelines should run
* @return true if should render, false otherwise
*/
private boolean shouldRunPipelines(){
boolean rVal =
Globals.playerCamera != null
;
return rVal;
}
/**
* Checks for any errors currently caught by OpenGL.
* Refer: https://docs.gl/gl4/glGetError

View File

@ -102,9 +102,9 @@ public class ShadowMapPipeline implements RenderPipeline {
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW)!=null &&
currentEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)
){
currentEntity.getData(EntityDataStrings.DATA_STRING_DRAW)!=null &&
currentEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)
){
//fetch actor
Actor currentActor = EntityUtils.getActor(currentEntity);
//calculate camera-modified vector3f

View File

@ -37,6 +37,7 @@ public class ViewportDataCellManager implements DataCellManager {
ViewportDataCellManager rVal = new ViewportDataCellManager();
rVal.players = new LinkedList<Player>();
rVal.serverDataCell = new ServerDataCell(new Scene());
rVal.serverDataCell.setReady(true);
rVal.parent = realm;
return rVal;
}

View File

@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import org.joml.Vector3d;
import org.junit.jupiter.api.Disabled;
import annotations.IntegrationTest;
import electrosphere.controls.ControlHandler;
@ -25,6 +26,7 @@ public class ServerAttackTreeTests extends EntityTestTemplate {
/**
* Make sure can attack in default scene
*/
@Disabled //disabled until can place platform in viewport
@IntegrationTest
public void testClientAttack(){
//warm up engine

View File

@ -87,7 +87,7 @@ public class ClientEquipStateTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(1);
//spawn entities
Globals.playerEntity = TestViewportUtils.spawnPlayerCharacter("human");
TestViewportUtils.spawnPlayerCharacter("human");
//TODO: associate creature with player object created for viewport
ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H");

View File

@ -0,0 +1,37 @@
package electrosphere.entity.types.camera;
import org.junit.jupiter.api.Assertions;
import annotations.FastTest;
import annotations.UnitTest;
/**
* Camera entity utils unit tests
*/
public class CameraEntityUtilsUnitTests {
@UnitTest
@FastTest
public void getCameraCenter_NullValue_NoThrow(){
Assertions.assertDoesNotThrow(() -> {
CameraEntityUtils.getCameraCenter(null);
});
}
@UnitTest
@FastTest
public void getCameraEye_NullValue_NoThrow(){
Assertions.assertDoesNotThrow(() -> {
CameraEntityUtils.getCameraEye(null);
});
}
@UnitTest
@FastTest
public void getCameraYaw_NullValue_NoThrow(){
Assertions.assertDoesNotThrow(() -> {
CameraEntityUtils.getCameraYaw(null);
});
}
}

View File

@ -0,0 +1,21 @@
package electrosphere.server.datacell;
import static org.junit.jupiter.api.Assertions.assertEquals;
import annotations.FastTest;
import annotations.UnitTest;
/**
* Unit tests for viewport data cell manager
*/
public class ViewportDataCellManagerUnitTests {
@UnitTest
@FastTest
public void serverDataCell_isReady_true(){
ViewportDataCellManager manager = ViewportDataCellManager.create(null);
ServerDataCell dataCell = manager.getCellAtWorldPosition(null);
assertEquals(true, dataCell.isReady());
}
}