move rendering flags

This commit is contained in:
austin 2025-05-15 16:12:00 -04:00
parent 3cc51c008c
commit c5077a8800
8 changed files with 40 additions and 59 deletions

View File

@ -1826,6 +1826,8 @@ Push settings into config variable
Move window pointer into rendering engine Move window pointer into rendering engine
Move microSimulation into serverState Move microSimulation into serverState
Move fluidCellManager into clientState Move fluidCellManager into clientState
Move engine flags under engineState
Move rendering flags under renderingEngine

View File

@ -171,20 +171,6 @@ public class Globals {
//services //services
public static FileWatcherService fileWatcherService; public static FileWatcherService fileWatcherService;
public static StructureScanningService structureScanningService; public static StructureScanningService structureScanningService;
//
//
// Renderer flags
//
//
public static boolean RENDER_FLAG_RENDER_SHADOW_MAP = false;
public static boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
public static boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
public static boolean RENDER_FLAG_RENDER_BLACK_BACKGROUND = true;
public static boolean RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
public static boolean RENDER_FLAG_RENDER_UI = true;
public static boolean RENDER_FLAG_RENDER_UI_BOUNDS = false;
@ -210,15 +196,6 @@ public class Globals {
gameConfigCurrent = electrosphere.data.Config.loadDefaultConfig(); gameConfigCurrent = electrosphere.data.Config.loadDefaultConfig();
NetConfig.readNetConfig(); NetConfig.readNetConfig();
//render flags
RENDER_FLAG_RENDER_SHADOW_MAP = false;
RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
RENDER_FLAG_RENDER_BLACK_BACKGROUND = true;
RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
RENDER_FLAG_RENDER_UI = true;
RENDER_FLAG_RENDER_UI_BOUNDS = false;
//client state //client state
Globals.clientState = new ClientState(); Globals.clientState = new ClientState();
@ -441,12 +418,6 @@ public class Globals {
Globals.engineState = null; Globals.engineState = null;
Globals.renderingEngine = null; Globals.renderingEngine = null;
Globals.fileWatcherService = null; Globals.fileWatcherService = null;
Globals.RENDER_FLAG_RENDER_SHADOW_MAP = true;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
Globals.RENDER_FLAG_RENDER_UI = false;
Globals.RENDER_FLAG_RENDER_BLACK_BACKGROUND = false;
Globals.RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
LoggerInterface.destroyLoggers(); LoggerInterface.destroyLoggers();
} }

View File

@ -134,12 +134,12 @@ public class ClientLoading {
//make loading window disappear //make loading window disappear
Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION, () -> { Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false); WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false);
Globals.RENDER_FLAG_RENDER_SHADOW_MAP = true; Globals.renderingEngine.RENDER_FLAG_RENDER_SHADOW_MAP = true;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = true; Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = true;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = true; Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = true;
Globals.RENDER_FLAG_RENDER_UI = true; Globals.renderingEngine.RENDER_FLAG_RENDER_UI = true;
Globals.RENDER_FLAG_RENDER_BLACK_BACKGROUND = false; Globals.renderingEngine.RENDER_FLAG_RENDER_BLACK_BACKGROUND = false;
Globals.RENDER_FLAG_RENDER_WHITE_BACKGROUND = false; Globals.renderingEngine.RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
}); });
//recapture screen //recapture screen
Globals.controlHandler.setRecapture(true); Globals.controlHandler.setRecapture(true);
@ -176,12 +176,12 @@ public class ClientLoading {
//make loading window disappear //make loading window disappear
Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION, () -> { Globals.engineState.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false); WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false);
Globals.RENDER_FLAG_RENDER_SHADOW_MAP = true; Globals.renderingEngine.RENDER_FLAG_RENDER_SHADOW_MAP = true;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = true; Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = true;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = true; Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = true;
Globals.RENDER_FLAG_RENDER_UI = true; Globals.renderingEngine.RENDER_FLAG_RENDER_UI = true;
Globals.RENDER_FLAG_RENDER_BLACK_BACKGROUND = false; Globals.renderingEngine.RENDER_FLAG_RENDER_BLACK_BACKGROUND = false;
Globals.RENDER_FLAG_RENDER_WHITE_BACKGROUND = false; Globals.renderingEngine.RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
}); });
//recapture screen //recapture screen
Globals.controlHandler.setRecapture(true); Globals.controlHandler.setRecapture(true);

View File

@ -24,11 +24,11 @@ public class MainMenuLoading {
public static void returnToMainMenu(Object[] params){ public static void returnToMainMenu(Object[] params){
// //
//stop rendering game //stop rendering game
Globals.RENDER_FLAG_RENDER_SHADOW_MAP = false; Globals.renderingEngine.RENDER_FLAG_RENDER_SHADOW_MAP = false;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false; Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = true; Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = true;
Globals.RENDER_FLAG_RENDER_UI = true; Globals.renderingEngine.RENDER_FLAG_RENDER_UI = true;
Globals.RENDER_FLAG_RENDER_BLACK_BACKGROUND = true; Globals.renderingEngine.RENDER_FLAG_RENDER_BLACK_BACKGROUND = true;
// //
//reset state //reset state

View File

@ -79,6 +79,14 @@ public class RenderingEngine {
public static VisualShader drawChannel; public static VisualShader drawChannel;
public Framebuffer defaultFramebuffer; public Framebuffer defaultFramebuffer;
public boolean RENDER_FLAG_RENDER_SHADOW_MAP = false;
public boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
public boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
public boolean RENDER_FLAG_RENDER_BLACK_BACKGROUND = true;
public boolean RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
public boolean RENDER_FLAG_RENDER_UI = true;
public boolean RENDER_FLAG_RENDER_UI_BOUNDS = false;
@ -502,17 +510,17 @@ public class RenderingEngine {
Globals.elementService.handleAllSignals(); Globals.elementService.handleAllSignals();
//calculate render angle for frustum culling //calculate render angle for frustum culling
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){ if(this.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT){
this.updateFrustumBox(); this.updateFrustumBox();
} }
//generate depth map //generate depth map
if(Globals.RENDER_FLAG_RENDER_SHADOW_MAP && shouldRunPipelines()){ if(this.RENDER_FLAG_RENDER_SHADOW_MAP && shouldRunPipelines()){
shadowMapPipeline.render(openGLState, renderPipelineState); shadowMapPipeline.render(openGLState, renderPipelineState);
} }
//render volume buffer //render volume buffer
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT && shouldRunPipelines()){ if(this.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT && shouldRunPipelines()){
volumeBufferPipeline.render(openGLState, renderPipelineState); volumeBufferPipeline.render(openGLState, renderPipelineState);
} }
@ -522,7 +530,7 @@ public class RenderingEngine {
//Render content to the game framebuffer //Render content to the game framebuffer
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT && shouldRunPipelines()){ if(this.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT && shouldRunPipelines()){
if(Globals.gameConfigCurrent.getSettings().getGraphicsPerformanceOIT()){ if(Globals.gameConfigCurrent.getSettings().getGraphicsPerformanceOIT()){
mainContentPipeline.render(openGLState, renderPipelineState); mainContentPipeline.render(openGLState, renderPipelineState);
} else { } else {
@ -547,7 +555,7 @@ public class RenderingEngine {
//Render the game framebuffer texture to a quad //Render the game framebuffer texture to a quad
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER){ if(this.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER){
renderScreenPipeline.render(openGLState, renderPipelineState); renderScreenPipeline.render(openGLState, renderPipelineState);
this.checkError(); this.checkError();
} }
@ -557,7 +565,7 @@ public class RenderingEngine {
this.checkError(); this.checkError();
//Render boundaries of ui elements //Render boundaries of ui elements
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){ if(this.RENDER_FLAG_RENDER_UI_BOUNDS){
DebugRendering.drawUIBoundsWireframe(); DebugRendering.drawUIBoundsWireframe();
} }

View File

@ -62,7 +62,7 @@ public class DebugRendering {
static VisualShader elementDrawDebugProgram = null; static VisualShader elementDrawDebugProgram = null;
static Model planeModel = null; static Model planeModel = null;
public static void drawUIBounds(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){ public static void drawUIBounds(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){ if(Globals.renderingEngine.RENDER_FLAG_RENDER_UI_BOUNDS){
if(planeModel == null){ if(planeModel == null){
planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE); planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
} }
@ -86,7 +86,7 @@ public class DebugRendering {
} }
public static void drawUIBoundsWindow(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){ public static void drawUIBoundsWindow(Framebuffer parentFramebuffer, Vector3f boxPosition, Vector3f boxDimensions, Vector4f color){
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){ if(Globals.renderingEngine.RENDER_FLAG_RENDER_UI_BOUNDS){
if(planeModel == null){ if(planeModel == null){
planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE); planeModel = Globals.assetManager.fetchModel(AssetDataStrings.MODEL_IMAGE_PLANE);
} }

View File

@ -27,7 +27,7 @@ public class UIPipeline implements RenderPipeline {
// //
//Black background //Black background
// //
if(Globals.RENDER_FLAG_RENDER_BLACK_BACKGROUND){ if(Globals.renderingEngine.RENDER_FLAG_RENDER_BLACK_BACKGROUND){
openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders); openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders);
openGLState.glDepthTest(false); openGLState.glDepthTest(false);
GL40.glBindVertexArray(RenderingEngine.screenTextureVAO); GL40.glBindVertexArray(RenderingEngine.screenTextureVAO);
@ -43,7 +43,7 @@ public class UIPipeline implements RenderPipeline {
// //
//White background //White background
// //
if(Globals.RENDER_FLAG_RENDER_WHITE_BACKGROUND){ if(Globals.renderingEngine.RENDER_FLAG_RENDER_WHITE_BACKGROUND){
openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders); openGLState.setActiveShader(renderPipelineState, RenderingEngine.screenTextureShaders);
openGLState.glDepthTest(false); openGLState.glDepthTest(false);
GL40.glBindVertexArray(RenderingEngine.screenTextureVAO); GL40.glBindVertexArray(RenderingEngine.screenTextureVAO);
@ -59,7 +59,7 @@ public class UIPipeline implements RenderPipeline {
// //
// Set render pipeline state // Set render pipeline state
// //
if(Globals.RENDER_FLAG_RENDER_UI){ if(Globals.renderingEngine.RENDER_FLAG_RENDER_UI){
renderPipelineState.setUseMeshShader(true); renderPipelineState.setUseMeshShader(true);
renderPipelineState.setBufferStandardUniforms(false); renderPipelineState.setBufferStandardUniforms(false);
renderPipelineState.setBufferNonStandardUniforms(true); renderPipelineState.setBufferNonStandardUniforms(true);

View File

@ -128,8 +128,8 @@ public class ViewportLoadingTests {
EngineInit.setupConnectedTestViewport(); EngineInit.setupConnectedTestViewport();
//should still see viewport here //should still see viewport here
assertEquals(true,Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER); assertEquals(true,Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER);
assertEquals(true,Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT); assertEquals(true,Globals.renderingEngine.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT);
} }
} }