move more render flags into rendering engine
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
c5077a8800
commit
7e8659d17b
@ -108,14 +108,8 @@ public class Globals {
|
|||||||
//
|
//
|
||||||
//OpenGL - Other
|
//OpenGL - Other
|
||||||
//
|
//
|
||||||
|
|
||||||
public static int WINDOW_WIDTH;
|
public static int WINDOW_WIDTH;
|
||||||
public static int WINDOW_HEIGHT;
|
public static int WINDOW_HEIGHT;
|
||||||
public static boolean WINDOW_DECORATED = true; //used to control whether the window is created with decorations or not (ie for testing)
|
|
||||||
public static boolean WINDOW_FULLSCREEN = false; //used to control whether the window is created fullscreen or not (ie for testing)
|
|
||||||
|
|
||||||
//title bar dimensions
|
|
||||||
public static int WINDOW_TITLE_BAR_HEIGHT = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -133,7 +127,6 @@ public class Globals {
|
|||||||
//
|
//
|
||||||
//OpenGL - Abstracted engine objects
|
//OpenGL - Abstracted engine objects
|
||||||
//
|
//
|
||||||
|
|
||||||
public static VisualShader defaultMeshShader;
|
public static VisualShader defaultMeshShader;
|
||||||
public static VisualShader terrainShaderProgram;
|
public static VisualShader terrainShaderProgram;
|
||||||
public static VisualShader blockShader;
|
public static VisualShader blockShader;
|
||||||
|
|||||||
@ -79,6 +79,10 @@ public class RenderingEngine {
|
|||||||
public static VisualShader drawChannel;
|
public static VisualShader drawChannel;
|
||||||
public Framebuffer defaultFramebuffer;
|
public Framebuffer defaultFramebuffer;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
//The rendering engine config flags
|
||||||
|
//
|
||||||
public boolean RENDER_FLAG_RENDER_SHADOW_MAP = false;
|
public boolean RENDER_FLAG_RENDER_SHADOW_MAP = false;
|
||||||
public boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
|
public boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
|
||||||
public boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
|
public boolean RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
|
||||||
@ -86,6 +90,14 @@ public class RenderingEngine {
|
|||||||
public boolean RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
|
public boolean RENDER_FLAG_RENDER_WHITE_BACKGROUND = false;
|
||||||
public boolean RENDER_FLAG_RENDER_UI = true;
|
public boolean RENDER_FLAG_RENDER_UI = true;
|
||||||
public boolean RENDER_FLAG_RENDER_UI_BOUNDS = false;
|
public boolean RENDER_FLAG_RENDER_UI_BOUNDS = false;
|
||||||
|
/**
|
||||||
|
* used to control whether the window is created with decorations or not (ie for testing)
|
||||||
|
*/
|
||||||
|
public static boolean WINDOW_DECORATED = true;
|
||||||
|
/**
|
||||||
|
* used to control whether the window is created fullscreen or not (ie for testing)
|
||||||
|
*/
|
||||||
|
public static boolean WINDOW_FULLSCREEN = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -155,8 +167,16 @@ public class RenderingEngine {
|
|||||||
*/
|
*/
|
||||||
LightManager lightManager;
|
LightManager lightManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The output framebuffer
|
||||||
|
*/
|
||||||
public static int outputFramebuffer = 0;
|
public static int outputFramebuffer = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Height of the titlebar
|
||||||
|
*/
|
||||||
|
protected int titlebarHeight = 0;
|
||||||
|
|
||||||
//used in calculating projection matrix
|
//used in calculating projection matrix
|
||||||
float aspectRatio = 1.0f;
|
float aspectRatio = 1.0f;
|
||||||
float verticalFOV = 90.0f;
|
float verticalFOV = 90.0f;
|
||||||
@ -233,7 +253,7 @@ public class RenderingEngine {
|
|||||||
if(EngineState.EngineFlags.RUN_HIDDEN){
|
if(EngineState.EngineFlags.RUN_HIDDEN){
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
|
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
|
||||||
}
|
}
|
||||||
if(!Globals.WINDOW_DECORATED){
|
if(!RenderingEngine.WINDOW_DECORATED){
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
GLFW.glfwWindowHint(GLFW.GLFW_DECORATED, GLFW.GLFW_FALSE);
|
||||||
}
|
}
|
||||||
if(EngineState.EngineFlags.ENGINE_DEBUG){
|
if(EngineState.EngineFlags.ENGINE_DEBUG){
|
||||||
@ -244,7 +264,7 @@ public class RenderingEngine {
|
|||||||
throw new Error("Trying to create window with width or height less than 1! " + Globals.gameConfigCurrent.getSettings().getDisplayWidth() + " " + Globals.gameConfigCurrent.getSettings().getDisplayHeight());
|
throw new Error("Trying to create window with width or height less than 1! " + Globals.gameConfigCurrent.getSettings().getDisplayWidth() + " " + Globals.gameConfigCurrent.getSettings().getDisplayHeight());
|
||||||
}
|
}
|
||||||
//Creates the window reference object
|
//Creates the window reference object
|
||||||
if(Globals.gameConfigCurrent.getSettings().displayFullscreen() || Globals.WINDOW_FULLSCREEN){
|
if(Globals.gameConfigCurrent.getSettings().displayFullscreen() || RenderingEngine.WINDOW_FULLSCREEN){
|
||||||
//below line is for fullscreen
|
//below line is for fullscreen
|
||||||
this.windowPtr = GLFW.glfwCreateWindow(Globals.gameConfigCurrent.getSettings().getDisplayWidth(), Globals.gameConfigCurrent.getSettings().getDisplayHeight(), "ORPG", GLFW.glfwGetPrimaryMonitor(), NULL);
|
this.windowPtr = GLFW.glfwCreateWindow(Globals.gameConfigCurrent.getSettings().getDisplayWidth(), Globals.gameConfigCurrent.getSettings().getDisplayHeight(), "ORPG", GLFW.glfwGetPrimaryMonitor(), NULL);
|
||||||
} else {
|
} else {
|
||||||
@ -278,7 +298,7 @@ public class RenderingEngine {
|
|||||||
int bufferHeight = yBuffer.get();
|
int bufferHeight = yBuffer.get();
|
||||||
|
|
||||||
//get title bar size
|
//get title bar size
|
||||||
Globals.WINDOW_TITLE_BAR_HEIGHT = Globals.WINDOW_HEIGHT - bufferHeight;
|
this.titlebarHeight = Globals.WINDOW_HEIGHT - bufferHeight;
|
||||||
|
|
||||||
Globals.WINDOW_WIDTH = bufferWidth;
|
Globals.WINDOW_WIDTH = bufferWidth;
|
||||||
Globals.WINDOW_HEIGHT = bufferHeight;
|
Globals.WINDOW_HEIGHT = bufferHeight;
|
||||||
@ -607,7 +627,7 @@ public class RenderingEngine {
|
|||||||
|
|
||||||
// Get the title bar dims
|
// Get the title bar dims
|
||||||
GLFW.glfwGetWindowFrameSize(this.windowPtr, tLeft, tTop, tRight, tBottom);
|
GLFW.glfwGetWindowFrameSize(this.windowPtr, tLeft, tTop, tRight, tBottom);
|
||||||
Globals.WINDOW_TITLE_BAR_HEIGHT = tTop.get();
|
this.titlebarHeight = tTop.get();
|
||||||
// System.out.println(tLeft.get() + " " + tTop.get() + " " + tRight.get() + " " + tBottom.get());
|
// System.out.println(tLeft.get() + " " + tTop.get() + " " + tRight.get() + " " + tBottom.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import electrosphere.client.ui.menu.WindowUtils;
|
|||||||
import electrosphere.engine.EngineState;
|
import electrosphere.engine.EngineState;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.Main;
|
import electrosphere.engine.Main;
|
||||||
|
import electrosphere.renderer.RenderingEngine;
|
||||||
import electrosphere.renderer.ui.elements.Div;
|
import electrosphere.renderer.ui.elements.Div;
|
||||||
import electrosphere.test.annotations.IntegrationTest;
|
import electrosphere.test.annotations.IntegrationTest;
|
||||||
import electrosphere.test.template.extensions.StateCleanupCheckerExtension;
|
import electrosphere.test.template.extensions.StateCleanupCheckerExtension;
|
||||||
@ -29,8 +30,8 @@ public class UIExtensionTests {
|
|||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void test_StartupShutdown_NoThrow(){
|
public void test_StartupShutdown_NoThrow(){
|
||||||
assertDoesNotThrow(() -> {
|
assertDoesNotThrow(() -> {
|
||||||
Globals.WINDOW_DECORATED = false;
|
RenderingEngine.WINDOW_DECORATED = false;
|
||||||
Globals.WINDOW_FULLSCREEN = true;
|
RenderingEngine.WINDOW_FULLSCREEN = true;
|
||||||
EngineState.EngineFlags.RUN_AUDIO = false;
|
EngineState.EngineFlags.RUN_AUDIO = false;
|
||||||
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
||||||
Globals.WINDOW_WIDTH = 1920;
|
Globals.WINDOW_WIDTH = 1920;
|
||||||
@ -45,8 +46,8 @@ public class UIExtensionTests {
|
|||||||
@Disabled
|
@Disabled
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void test_Screencapture_Match(){
|
public void test_Screencapture_Match(){
|
||||||
Globals.WINDOW_DECORATED = false;
|
RenderingEngine.WINDOW_DECORATED = false;
|
||||||
Globals.WINDOW_FULLSCREEN = true;
|
RenderingEngine.WINDOW_FULLSCREEN = true;
|
||||||
EngineState.EngineFlags.RUN_AUDIO = false;
|
EngineState.EngineFlags.RUN_AUDIO = false;
|
||||||
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
||||||
Globals.WINDOW_WIDTH = 1920;
|
Globals.WINDOW_WIDTH = 1920;
|
||||||
@ -71,8 +72,8 @@ public class UIExtensionTests {
|
|||||||
|
|
||||||
@IntegrationTest
|
@IntegrationTest
|
||||||
public void test_Screencapture_Blank_Match(){
|
public void test_Screencapture_Blank_Match(){
|
||||||
Globals.WINDOW_DECORATED = false;
|
RenderingEngine.WINDOW_DECORATED = false;
|
||||||
Globals.WINDOW_FULLSCREEN = true;
|
RenderingEngine.WINDOW_FULLSCREEN = true;
|
||||||
EngineState.EngineFlags.RUN_AUDIO = false;
|
EngineState.EngineFlags.RUN_AUDIO = false;
|
||||||
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
||||||
Globals.WINDOW_WIDTH = 1920;
|
Globals.WINDOW_WIDTH = 1920;
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import org.junit.jupiter.api.extension.ExtensionContext;
|
|||||||
import electrosphere.engine.EngineState;
|
import electrosphere.engine.EngineState;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.Main;
|
import electrosphere.engine.Main;
|
||||||
|
import electrosphere.renderer.RenderingEngine;
|
||||||
import electrosphere.test.testutils.EngineInit;
|
import electrosphere.test.testutils.EngineInit;
|
||||||
import electrosphere.test.testutils.TestEngineUtils;
|
import electrosphere.test.testutils.TestEngineUtils;
|
||||||
|
|
||||||
@ -17,8 +18,8 @@ public class UIExtension implements BeforeEachCallback, AfterEachCallback {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeEach(ExtensionContext context) throws Exception {
|
public void beforeEach(ExtensionContext context) throws Exception {
|
||||||
Globals.WINDOW_DECORATED = false;
|
RenderingEngine.WINDOW_DECORATED = false;
|
||||||
Globals.WINDOW_FULLSCREEN = true;
|
RenderingEngine.WINDOW_FULLSCREEN = true;
|
||||||
EngineState.EngineFlags.RUN_AUDIO = false;
|
EngineState.EngineFlags.RUN_AUDIO = false;
|
||||||
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
EngineState.EngineFlags.RUN_SCRIPTS = false;
|
||||||
Globals.WINDOW_WIDTH = 1920;
|
Globals.WINDOW_WIDTH = 1920;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user