push settings into config
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
d5f2ccc4dc
commit
f65d56d667
@ -1822,6 +1822,7 @@ Move serviceManager into engineState
|
||||
Move timeKeeper into engineState
|
||||
Move signalSystem into engineState
|
||||
Move some global state into rendering engine
|
||||
Push settings into config variable
|
||||
|
||||
|
||||
|
||||
|
||||
@ -249,7 +249,7 @@ public class CameraEntityUtils {
|
||||
* @return The far clip
|
||||
*/
|
||||
public static float getFarClip(Entity camera){
|
||||
return Globals.userSettings.getGraphicsViewDistance();
|
||||
return Globals.gameConfigCurrent.getSettings().getGraphicsViewDistance();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -100,8 +100,8 @@ public class FluidCellManager {
|
||||
program = Globals.terrainShaderProgram;
|
||||
|
||||
// drawRadius = Globals.userSettings.getGraphicsPerformanceLODChunkRadius();
|
||||
drawStepdownInterval = Globals.userSettings.getGameplayPhysicsCellRadius();
|
||||
physicsRadius = Globals.userSettings.getGameplayPhysicsCellRadius();
|
||||
drawStepdownInterval = Globals.gameConfigCurrent.getSettings().getGameplayPhysicsCellRadius();
|
||||
physicsRadius = Globals.gameConfigCurrent.getSettings().getGameplayPhysicsCellRadius();
|
||||
|
||||
invalidateAllCells();
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ public class FoliageCellManager {
|
||||
*/
|
||||
public void update(){
|
||||
Globals.profiler.beginCpuSample("FoliageCellManager.update");
|
||||
if(shouldUpdate && Globals.clientState.playerEntity != null && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager()){
|
||||
if(shouldUpdate && Globals.clientState.playerEntity != null && Globals.gameConfigCurrent.getSettings().getGraphicsPerformanceEnableFoliageManager()){
|
||||
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(playerPos);
|
||||
int distCache = this.getDistCache(this.lastPlayerPos, absVoxelPos);
|
||||
|
||||
@ -42,16 +42,16 @@ public class ImGuiRenderer {
|
||||
if(ImGui.collapsingHeader("Debug Toggles")){
|
||||
ImGui.indent();
|
||||
if(ImGui.button("Draw Client Hitboxes")){
|
||||
Globals.userSettings.setGraphicsDebugDrawCollisionSpheresClient(!Globals.userSettings.getGraphicsDebugDrawCollisionSpheresClient());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawCollisionSpheresClient(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresClient());
|
||||
}
|
||||
if(ImGui.button("Draw Server Hitboxes")){
|
||||
Globals.userSettings.setGraphicsDebugDrawCollisionSpheresServer(!Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawCollisionSpheresServer(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresServer());
|
||||
}
|
||||
if(ImGui.button("Draw Physics Objects")){
|
||||
Globals.userSettings.setGraphicsDebugDrawPhysicsObjects(!Globals.userSettings.graphicsDebugDrawPhysicsObjects());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjects(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjects());
|
||||
}
|
||||
if(ImGui.button("Draw Grid Alignment Data")){
|
||||
Globals.userSettings.setGraphicsDebugDrawGridAlignment(!Globals.userSettings.getGraphicsDebugDrawGridAlignment());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawGridAlignment(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawGridAlignment());
|
||||
}
|
||||
ImGui.unindent();
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ public class MenuGeneratorsInGame {
|
||||
//label (toggle draw client collision spheres)
|
||||
Button toggleClientCollisionSpheresButton = Button.createButton("Toggle draw client collision spheres", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
// Main.running = false;
|
||||
Globals.userSettings.setGraphicsDebugDrawCollisionSpheresClient(!Globals.userSettings.getGraphicsDebugDrawCollisionSpheresClient());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawCollisionSpheresClient(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresClient());
|
||||
return false;
|
||||
}});
|
||||
toggleClientCollisionSpheresButton.setMarginTop(BUTTON_MARGIN);
|
||||
@ -269,7 +269,7 @@ public class MenuGeneratorsInGame {
|
||||
//label (toggle draw server collision spheres)
|
||||
Button toggleServerCollisionSpheresButton = Button.createButton("Toggle draw server collision spheres", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
// Main.running = false;
|
||||
Globals.userSettings.setGraphicsDebugDrawCollisionSpheresServer(!Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawCollisionSpheresServer(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresServer());
|
||||
return false;
|
||||
}});
|
||||
toggleServerCollisionSpheresButton.setMarginTop(BUTTON_MARGIN);
|
||||
@ -279,7 +279,7 @@ public class MenuGeneratorsInGame {
|
||||
//label (toggle draw physics objects)
|
||||
Button togglePhysicsObjectsButton = Button.createButton("Toggle draw physics objects", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
// Main.running = false;
|
||||
Globals.userSettings.setGraphicsDebugDrawPhysicsObjects(!Globals.userSettings.graphicsDebugDrawPhysicsObjects());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawPhysicsObjects(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjects());
|
||||
return false;
|
||||
}});
|
||||
togglePhysicsObjectsButton.setMarginTop(BUTTON_MARGIN);
|
||||
@ -289,7 +289,7 @@ public class MenuGeneratorsInGame {
|
||||
//toggle draw grid alignment data
|
||||
Button toggleDrawGridAlignmentDataButton = Button.createButton("Toggle draw grid alignment data", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
// Main.running = false;
|
||||
Globals.userSettings.setGraphicsDebugDrawGridAlignment(!Globals.userSettings.getGraphicsDebugDrawGridAlignment());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawGridAlignment(!Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawGridAlignment());
|
||||
return false;
|
||||
}});
|
||||
toggleDrawGridAlignmentDataButton.setMarginTop(BUTTON_MARGIN);
|
||||
@ -299,7 +299,7 @@ public class MenuGeneratorsInGame {
|
||||
//label (toggle draw movement vectors)
|
||||
Button toggleMovementVectorsButton = Button.createButton("Toggle draw movement vectors", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
// Main.running = false;
|
||||
Globals.userSettings.setGraphicsDebugDrawMovementVectors(!Globals.userSettings.graphicsDebugDrawMovementVectors());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawMovementVectors(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawMovementVectors());
|
||||
return false;
|
||||
}});
|
||||
toggleMovementVectorsButton.setMarginTop(BUTTON_MARGIN);
|
||||
@ -309,7 +309,7 @@ public class MenuGeneratorsInGame {
|
||||
//label (toggle draw navmesh)
|
||||
Button toggleNavmeshButton = Button.createButton("Toggle draw navmesh", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||
// Main.running = false;
|
||||
Globals.userSettings.setGraphicsDebugDrawNavmesh(!Globals.userSettings.graphicsDebugDrawNavmesh());
|
||||
Globals.gameConfigCurrent.getSettings().setGraphicsDebugDrawNavmesh(!Globals.gameConfigCurrent.getSettings().graphicsDebugDrawNavmesh());
|
||||
return false;
|
||||
}});
|
||||
toggleNavmeshButton.setMarginTop(BUTTON_MARGIN);
|
||||
|
||||
@ -20,6 +20,7 @@ import electrosphere.data.foliage.FoliageTypeMap;
|
||||
import electrosphere.data.item.ItemDataMap;
|
||||
import electrosphere.data.item.source.ItemSourcingMap;
|
||||
import electrosphere.data.projectile.ProjectileTypeHolder;
|
||||
import electrosphere.data.settings.UserSettings;
|
||||
import electrosphere.data.struct.StructureDataLoader;
|
||||
import electrosphere.data.tutorial.HintDefinition;
|
||||
import electrosphere.data.units.UnitDefinitionFile;
|
||||
@ -34,6 +35,11 @@ import electrosphere.util.FileUtils;
|
||||
* Current configuration for the data of the game
|
||||
*/
|
||||
public class Config {
|
||||
|
||||
/**
|
||||
* Top level user settings object
|
||||
*/
|
||||
UserSettings userSettings;
|
||||
|
||||
/**
|
||||
* The container for all creature definitions
|
||||
@ -108,6 +114,7 @@ public class Config {
|
||||
*/
|
||||
public static Config loadDefaultConfig(){
|
||||
Config config = new Config();
|
||||
config.userSettings = UserSettings.loadUserSettings();
|
||||
config.creatureTypeLoader = Config.loadCreatureTypes("Data/entity/creatures.json");
|
||||
config.itemMap = ItemDataMap.loadItemFiles("Data/entity/items.json");
|
||||
config.foliageMap = Config.loadFoliageTypes("Data/entity/foliage.json");
|
||||
@ -258,6 +265,14 @@ public class Config {
|
||||
return loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user settings
|
||||
* @return The user settings
|
||||
*/
|
||||
public UserSettings getSettings(){
|
||||
return this.userSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the interface for creature definitions loaded into memory
|
||||
* @return The interface
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package electrosphere.data.settings;
|
||||
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.util.FileUtils;
|
||||
|
||||
@ -253,16 +252,13 @@ public class UserSettings {
|
||||
/**
|
||||
* Loads the user's settings
|
||||
*/
|
||||
public static void loadUserSettings(){
|
||||
if(Globals.userSettings == null){
|
||||
LoggerInterface.loggerStartup.INFO("Load user settings");
|
||||
Globals.userSettings = FileUtils.loadObjectFromAssetPath("/Config/settings.json", UserSettings.class);
|
||||
if(Globals.userSettings == null){
|
||||
Globals.userSettings = getDefault();
|
||||
}
|
||||
Globals.WINDOW_WIDTH = Globals.userSettings.displayWidth;
|
||||
Globals.WINDOW_HEIGHT = Globals.userSettings.displayHeight;
|
||||
public static UserSettings loadUserSettings(){
|
||||
LoggerInterface.loggerStartup.INFO("Load user settings");
|
||||
UserSettings rVal = FileUtils.loadObjectFromAssetPath("/Config/settings.json", UserSettings.class);
|
||||
if(rVal == null){
|
||||
rVal = UserSettings.getDefault();
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,29 +1,37 @@
|
||||
package electrosphere.engine;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import electrosphere.engine.service.ServiceManager;
|
||||
import electrosphere.engine.signal.SignalSystem;
|
||||
import electrosphere.engine.threads.ThreadManager;
|
||||
import electrosphere.engine.time.Timekeeper;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
|
||||
/**
|
||||
* State of the engine
|
||||
*/
|
||||
public class EngineState {
|
||||
|
||||
/**
|
||||
* Java Process ID for this application
|
||||
*/
|
||||
public String javaPID = ManagementFactory.getRuntimeMXBean().getName();
|
||||
|
||||
/**
|
||||
* The time keeping service
|
||||
*/
|
||||
public Timekeeper timekeeper = new Timekeeper();
|
||||
public Timekeeper timekeeper;
|
||||
|
||||
/**
|
||||
* The thread manager
|
||||
*/
|
||||
public final ThreadManager threadManager = new ThreadManager();
|
||||
public final ThreadManager threadManager;
|
||||
|
||||
/**
|
||||
* The service manager
|
||||
*/
|
||||
public final ServiceManager serviceManager = ServiceManager.create();
|
||||
public final ServiceManager serviceManager;
|
||||
|
||||
/**
|
||||
* The signal system
|
||||
@ -34,6 +42,13 @@ public class EngineState {
|
||||
* Constructor
|
||||
*/
|
||||
public EngineState(){
|
||||
//init loggers
|
||||
LoggerInterface.initLoggers();
|
||||
LoggerInterface.loggerStartup.INFO("Initialize global variables");
|
||||
|
||||
this.timekeeper = new Timekeeper();
|
||||
this.serviceManager = ServiceManager.create();
|
||||
this.threadManager = new ThreadManager();
|
||||
this.threadManager.init();
|
||||
this.signalSystem = (SignalSystem)this.serviceManager.registerService(new SignalSystem());
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
package electrosphere.engine;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
import electrosphere.audio.AudioEngine;
|
||||
import electrosphere.audio.VirtualAudioSourceManager;
|
||||
import electrosphere.audio.collision.HitboxAudioService;
|
||||
@ -20,7 +18,6 @@ import electrosphere.controls.MouseCallback;
|
||||
import electrosphere.controls.ScrollCallback;
|
||||
import electrosphere.controls.cursor.CursorState;
|
||||
import electrosphere.data.particle.ParticleDefinition;
|
||||
import electrosphere.data.settings.UserSettings;
|
||||
import electrosphere.data.voxel.VoxelType;
|
||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||
import electrosphere.engine.assetmanager.AssetManager;
|
||||
@ -55,16 +52,6 @@ import electrosphere.util.FileUtils;
|
||||
*/
|
||||
public class Globals {
|
||||
|
||||
//
|
||||
//Process data
|
||||
//
|
||||
public static String javaPID;
|
||||
|
||||
//
|
||||
//Top level user settings object
|
||||
//
|
||||
public static UserSettings userSettings;
|
||||
|
||||
/**
|
||||
* State for the engine
|
||||
*/
|
||||
@ -295,22 +282,19 @@ public class Globals {
|
||||
* Inits globals
|
||||
*/
|
||||
public static void initGlobals(){
|
||||
//initialize logging interfaces
|
||||
LoggerInterface.initLoggers();
|
||||
LoggerInterface.loggerStartup.INFO("Initialize global variables");
|
||||
//gets java pid of engine
|
||||
if(Globals.javaPID == null){
|
||||
Globals.javaPID = ManagementFactory.getRuntimeMXBean().getName();
|
||||
}
|
||||
//load user settings
|
||||
Globals.WINDOW_WIDTH = 1920;
|
||||
Globals.WINDOW_HEIGHT = 1080;
|
||||
UserSettings.loadUserSettings();
|
||||
|
||||
|
||||
//spin up engine state
|
||||
Globals.engineState = new EngineState();
|
||||
|
||||
//game config
|
||||
gameConfigDefault = electrosphere.data.Config.loadDefaultConfig();
|
||||
gameConfigCurrent = gameConfigDefault;
|
||||
NetConfig.readNetConfig();
|
||||
|
||||
//render flags
|
||||
RENDER_FLAG_RENDER_SHADOW_MAP = false;
|
||||
RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
|
||||
@ -337,16 +321,12 @@ public class Globals {
|
||||
shaderOptionMap.debug();
|
||||
//load asset manager
|
||||
assetManager = new AssetManager();
|
||||
//game config
|
||||
gameConfigDefault = electrosphere.data.Config.loadDefaultConfig();
|
||||
gameConfigCurrent = gameConfigDefault;
|
||||
NetConfig.readNetConfig();
|
||||
|
||||
//
|
||||
//Values that depend on the loaded config
|
||||
Globals.clientState.clientSelectedVoxelType = (VoxelType)gameConfigCurrent.getVoxelData().getTypes().toArray()[1];
|
||||
//net monitor
|
||||
if(Globals.userSettings.getNetRunNetMonitor()){
|
||||
if(Globals.gameConfigCurrent.getSettings().getNetRunNetMonitor()){
|
||||
netMonitor = new NetMonitor();
|
||||
}
|
||||
//profiler
|
||||
@ -548,7 +528,6 @@ public class Globals {
|
||||
Globals.engineState = null;
|
||||
Globals.renderingEngine = null;
|
||||
Globals.fileWatcherService = null;
|
||||
Globals.javaPID = null;
|
||||
Globals.RENDER_FLAG_RENDER_SHADOW_MAP = true;
|
||||
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT = false;
|
||||
Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER = false;
|
||||
|
||||
@ -79,7 +79,7 @@ public class Player {
|
||||
this.connectionHandler = connectionHandler;
|
||||
id = connectionHandler.getPlayerId();
|
||||
this.dbId = dbId;
|
||||
this.simulationRadius = Globals.userSettings.getGameplayPhysicsCellRadius();
|
||||
this.simulationRadius = Globals.gameConfigCurrent.getSettings().getGameplayPhysicsCellRadius();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -225,15 +225,15 @@ public class RenderingEngine {
|
||||
GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_DEBUG_CONTEXT, GLFW.GLFW_TRUE);
|
||||
}
|
||||
|
||||
if(Globals.userSettings.getDisplayWidth() <= 0 || Globals.userSettings.getDisplayHeight() <= 0){
|
||||
throw new Error("Trying to create window with width or height less than 1! " + Globals.userSettings.getDisplayWidth() + " " + Globals.userSettings.getDisplayHeight());
|
||||
if(Globals.gameConfigCurrent.getSettings().getDisplayWidth() <= 0 || Globals.gameConfigCurrent.getSettings().getDisplayHeight() <= 0){
|
||||
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
|
||||
if(Globals.userSettings.displayFullscreen() || Globals.WINDOW_FULLSCREEN){
|
||||
if(Globals.gameConfigCurrent.getSettings().displayFullscreen() || Globals.WINDOW_FULLSCREEN){
|
||||
//below line is for fullscreen
|
||||
Globals.window = GLFW.glfwCreateWindow(Globals.userSettings.getDisplayWidth(), Globals.userSettings.getDisplayHeight(), "ORPG", GLFW.glfwGetPrimaryMonitor(), NULL);
|
||||
Globals.window = GLFW.glfwCreateWindow(Globals.gameConfigCurrent.getSettings().getDisplayWidth(), Globals.gameConfigCurrent.getSettings().getDisplayHeight(), "ORPG", GLFW.glfwGetPrimaryMonitor(), NULL);
|
||||
} else {
|
||||
Globals.window = GLFW.glfwCreateWindow(Globals.userSettings.getDisplayWidth(), Globals.userSettings.getDisplayHeight(), "ORPG", NULL, NULL);
|
||||
Globals.window = GLFW.glfwCreateWindow(Globals.gameConfigCurrent.getSettings().getDisplayWidth(), Globals.gameConfigCurrent.getSettings().getDisplayHeight(), "ORPG", NULL, NULL);
|
||||
}
|
||||
// Errors for failure to create window (IE: No GUI mode on linux ?)
|
||||
if (Globals.window == NULL) {
|
||||
@ -310,7 +310,7 @@ public class RenderingEngine {
|
||||
|
||||
//this disables vsync to make game run faster
|
||||
//https://stackoverflow.com/questions/55598376/glfwswapbuffers-is-slow
|
||||
if(!Globals.userSettings.graphicsPerformanceEnableVSync()){
|
||||
if(!Globals.gameConfigCurrent.getSettings().graphicsPerformanceEnableVSync()){
|
||||
GLFW.glfwSwapInterval(0);
|
||||
}
|
||||
|
||||
@ -328,12 +328,12 @@ public class RenderingEngine {
|
||||
defaultFramebuffer = new Framebuffer(GL_DEFAULT_FRAMEBUFFER);
|
||||
|
||||
//generate framebuffers
|
||||
Texture screenTextureColor = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
Texture screenTextureColor = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
RenderingEngine.screenTextureColor = screenTextureColor;
|
||||
Texture screenTextureDepth = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
Texture screenTextureDepth = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
RenderingEngine.screenTextureDepth = screenTextureDepth;
|
||||
try {
|
||||
Framebuffer screenFramebuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY(), screenTextureColor, screenTextureDepth);
|
||||
Framebuffer screenFramebuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY(), screenTextureColor, screenTextureDepth);
|
||||
RenderingEngine.screenFramebuffer = screenFramebuffer;
|
||||
} catch (Exception e){
|
||||
LoggerInterface.loggerRenderer.ERROR(e);
|
||||
@ -367,10 +367,10 @@ public class RenderingEngine {
|
||||
//
|
||||
try {
|
||||
volumeDepthShaderProgram = VisualShader.loadSpecificShader("/Shaders/core/volumeBuffer/volumetric.vs", "/Shaders/core/volumeBuffer/volumetric.fs");
|
||||
volumeDepthBackfaceTexture = FramebufferUtils.generateDepthBufferTexture(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
volumeDepthBackfaceFramebuffer = FramebufferUtils.generateDepthBuffer(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY(), volumeDepthBackfaceTexture);
|
||||
volumeDepthFrontfaceTexture = FramebufferUtils.generateDepthBufferTexture(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
volumeDepthFrontfaceFramebuffer = FramebufferUtils.generateDepthBuffer(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY(), volumeDepthFrontfaceTexture);
|
||||
volumeDepthBackfaceTexture = FramebufferUtils.generateDepthBufferTexture(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
volumeDepthBackfaceFramebuffer = FramebufferUtils.generateDepthBuffer(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY(), volumeDepthBackfaceTexture);
|
||||
volumeDepthFrontfaceTexture = FramebufferUtils.generateDepthBufferTexture(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
volumeDepthFrontfaceFramebuffer = FramebufferUtils.generateDepthBuffer(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY(), volumeDepthFrontfaceTexture);
|
||||
} catch(Exception e){
|
||||
LoggerInterface.loggerRenderer.ERROR(e);
|
||||
}
|
||||
@ -379,9 +379,9 @@ public class RenderingEngine {
|
||||
//Game normals
|
||||
//
|
||||
try {
|
||||
gameImageNormalsTexture = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
Texture gameImageNormalsDepthTexture = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
gameImageNormalsFramebuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY(), gameImageNormalsTexture, gameImageNormalsDepthTexture);
|
||||
gameImageNormalsTexture = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
Texture gameImageNormalsDepthTexture = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
gameImageNormalsFramebuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY(), gameImageNormalsTexture, gameImageNormalsDepthTexture);
|
||||
renderNormalsShader = VisualShader.loadSpecificShader("Shaders/core/anime/renderNormals.vs", "Shaders/core/anime/renderNormals.fs");
|
||||
} catch(Exception e){
|
||||
LoggerInterface.loggerRenderer.ERROR(e);
|
||||
@ -392,24 +392,24 @@ public class RenderingEngine {
|
||||
//
|
||||
try {
|
||||
transparencyAccumulatorClear = new float[]{0.0f, 0.0f, 0.0f, 0.0f};
|
||||
transparencyAccumulatorTexture = FramebufferUtils.generateOITAccumulatorTexture(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
transparencyAccumulatorTexture = FramebufferUtils.generateOITAccumulatorTexture(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
transparencyRevealageClear = new float[]{1.0f, 1.0f, 1.0f, 1.0f};
|
||||
transparencyRevealageTexture = FramebufferUtils.generateOITRevealageTexture(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
transparencyBuffer = FramebufferUtils.generateOITFramebuffer(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY(), transparencyAccumulatorTexture, transparencyRevealageTexture, screenTextureDepth);
|
||||
transparencyRevealageTexture = FramebufferUtils.generateOITRevealageTexture(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
transparencyBuffer = FramebufferUtils.generateOITFramebuffer(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY(), transparencyAccumulatorTexture, transparencyRevealageTexture, screenTextureDepth);
|
||||
oitCompositeProgram = VisualShader.loadSpecificShader("Shaders/core/oit/composite.vs", "Shaders/core/oit/composite.fs");
|
||||
} catch(Exception e){
|
||||
LoggerInterface.loggerRenderer.ERROR(e);
|
||||
}
|
||||
|
||||
//projection matrices
|
||||
nearVolumeProjectionMatrix.setPerspective((float)(Globals.userSettings.getGraphicsFOV() * Math.PI /180.0f), (float)Globals.WINDOW_WIDTH / (float)Globals.WINDOW_HEIGHT, 0.1f, 100);
|
||||
nearVolumeProjectionMatrix.setPerspective((float)(Globals.gameConfigCurrent.getSettings().getGraphicsFOV() * Math.PI /180.0f), (float)Globals.WINDOW_WIDTH / (float)Globals.WINDOW_HEIGHT, 0.1f, 100);
|
||||
|
||||
//
|
||||
//Compositing textures and buffers
|
||||
//
|
||||
try {
|
||||
normalsOutlineTexture = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
normalsOutlineFrambuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY(), normalsOutlineTexture);
|
||||
normalsOutlineTexture = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
normalsOutlineFrambuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY(), normalsOutlineTexture);
|
||||
Globals.assetManager.addShaderToQueue("Shaders/core/anime/outlineNormals.vs", "Shaders/core/anime/outlineNormals.fs");
|
||||
} catch(Exception e){
|
||||
LoggerInterface.loggerRenderer.ERROR(e);
|
||||
@ -472,10 +472,10 @@ public class RenderingEngine {
|
||||
//
|
||||
// Projection and View matrix creation
|
||||
//
|
||||
this.verticalFOV = (float)(Globals.userSettings.getGraphicsFOV() * Math.PI /180.0f);
|
||||
this.verticalFOV = (float)(Globals.gameConfigCurrent.getSettings().getGraphicsFOV() * Math.PI /180.0f);
|
||||
//set local aspect ratio and global aspect ratio at the same time
|
||||
this.aspectRatio = Globals.WINDOW_WIDTH / (float)Globals.WINDOW_HEIGHT;
|
||||
this.projectionMatrix.setPerspective(this.verticalFOV, this.aspectRatio, this.nearClip, Globals.userSettings.getGraphicsViewDistance());
|
||||
this.projectionMatrix.setPerspective(this.verticalFOV, this.aspectRatio, this.nearClip, Globals.gameConfigCurrent.getSettings().getGraphicsViewDistance());
|
||||
this.viewMatrix.translation(new Vector3d(0.0f,0.0f,-3.0f));
|
||||
|
||||
/**
|
||||
@ -517,7 +517,7 @@ public class RenderingEngine {
|
||||
|
||||
//Render content to the game framebuffer
|
||||
if(Globals.RENDER_FLAG_RENDER_SCREEN_FRAMEBUFFER_CONTENT && shouldRunPipelines()){
|
||||
if(Globals.userSettings.getGraphicsPerformanceOIT()){
|
||||
if(Globals.gameConfigCurrent.getSettings().getGraphicsPerformanceOIT()){
|
||||
mainContentPipeline.render(openGLState, renderPipelineState);
|
||||
} else {
|
||||
mainContentNoOITPipeline.render(openGLState, renderPipelineState);
|
||||
@ -632,7 +632,7 @@ public class RenderingEngine {
|
||||
public void calculateProjectionMatrix(){
|
||||
float radVerticalFOV = (float)(this.verticalFOV * Math.PI /180.0f);
|
||||
float nearClip = 0.001f;
|
||||
this.projectionMatrix.setPerspective(radVerticalFOV, this.aspectRatio, nearClip, Globals.userSettings.getGraphicsViewDistance());
|
||||
this.projectionMatrix.setPerspective(radVerticalFOV, this.aspectRatio, nearClip, Globals.gameConfigCurrent.getSettings().getGraphicsViewDistance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -28,7 +28,7 @@ public class MainContentNoOITPipeline implements RenderPipeline {
|
||||
openGLState.glDepthTest(true);
|
||||
openGLState.glDepthFunc(GL40.GL_LESS);
|
||||
GL40.glDepthMask(true);
|
||||
openGLState.glViewport(Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
|
||||
openGLState.glBlend(true);
|
||||
openGLState.glBlendFunci(0, GL40.GL_ONE, GL40.GL_ONE);
|
||||
|
||||
@ -41,7 +41,7 @@ public class MainContentPipeline implements RenderPipeline {
|
||||
openGLState.glDepthTest(true);
|
||||
openGLState.glDepthFunc(GL40.GL_LESS);
|
||||
GL40.glDepthMask(true);
|
||||
openGLState.glViewport(Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
|
||||
///
|
||||
/// R E N D E R I N G S T U F F
|
||||
|
||||
@ -35,7 +35,7 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
||||
openGLState.glDepthFunc(GL40.GL_LESS);
|
||||
GL40.glDepthMask(true);
|
||||
|
||||
openGLState.glViewport(Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
|
||||
///
|
||||
/// R E N D E R I N G S T U F F
|
||||
|
||||
@ -37,10 +37,10 @@ public class PostProcessingPipeline implements RenderPipeline {
|
||||
*/
|
||||
public void init(OpenGLState openGLState){
|
||||
postProcessingShader = VisualShader.loadSpecificShader("Shaders/core/postprocessing/postprocessing.vs", "Shaders/core/postprocessing/postprocessing.fs");
|
||||
Texture screenTextureColor = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
Texture screenTextureDepth = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
Texture screenTextureColor = FramebufferUtils.generateScreenTextureColorAlpha(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
Texture screenTextureDepth = FramebufferUtils.generateScreenTextureDepth(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
try {
|
||||
postProcessBuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY(), screenTextureColor, screenTextureDepth);
|
||||
postProcessBuffer = FramebufferUtils.generateScreenTextureFramebuffer(openGLState, Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY(), screenTextureColor, screenTextureDepth);
|
||||
} catch (Exception e){
|
||||
LoggerInterface.loggerRenderer.ERROR(e);
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class PostProcessingPipeline implements RenderPipeline {
|
||||
//
|
||||
openGLState.glDepthTest(false);
|
||||
openGLState.glBlend(false);
|
||||
openGLState.glViewport(Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
|
||||
|
||||
postProcessBuffer.bind(openGLState);
|
||||
|
||||
@ -43,7 +43,7 @@ public class DebugBonesPipeline implements RenderPipeline {
|
||||
openGLState.glDepthFunc(GL40.GL_LESS);
|
||||
GL40.glDepthMask(true);
|
||||
openGLState.glBlend(false);
|
||||
openGLState.glViewport(Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
|
||||
///
|
||||
/// R E N D E R I N G S T U F F
|
||||
|
||||
@ -54,7 +54,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
||||
openGLState.glDepthTest(true);
|
||||
openGLState.glDepthFunc(GL40.GL_LESS);
|
||||
GL40.glDepthMask(true);
|
||||
openGLState.glViewport(Globals.userSettings.getRenderResolutionX(), Globals.userSettings.getRenderResolutionY());
|
||||
openGLState.glViewport(Globals.gameConfigCurrent.getSettings().getRenderResolutionX(), Globals.gameConfigCurrent.getSettings().getRenderResolutionY());
|
||||
|
||||
///
|
||||
/// R E N D E R I N G S T U F F
|
||||
@ -75,7 +75,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
||||
|
||||
Matrix4d modelTransformMatrix = new Matrix4d();
|
||||
|
||||
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresClient()){
|
||||
if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresClient()){
|
||||
Model hitboxModel;
|
||||
for(HitboxCollectionState hitboxState : Globals.clientState.clientSceneWrapper.getHitboxManager().getAllHitboxes()){
|
||||
for(DGeom geom : hitboxState.getGeometries()){
|
||||
@ -127,7 +127,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
|
||||
if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawCollisionSpheresServer()){
|
||||
Model hitboxModel;
|
||||
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId());
|
||||
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||
@ -184,7 +184,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
||||
}
|
||||
}
|
||||
|
||||
if(Globals.userSettings.graphicsDebugDrawPhysicsObjects()){
|
||||
if(Globals.gameConfigCurrent.getSettings().graphicsDebugDrawPhysicsObjects()){
|
||||
Model physicsGraphicsModel;
|
||||
CollisionEngine engine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
|
||||
for(Collidable collidable : engine.getCollidables()){
|
||||
@ -236,7 +236,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
||||
|
||||
//
|
||||
//Draw grid alignment data
|
||||
if(Globals.userSettings.getGraphicsDebugDrawGridAlignment()){
|
||||
if(Globals.gameConfigCurrent.getSettings().getGraphicsDebugDrawGridAlignment()){
|
||||
Model physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCUBE);
|
||||
for(Entity entity : Globals.clientState.clientSceneWrapper.getScene().getEntityList()){
|
||||
CommonEntityType data = CommonEntityUtils.getCommonData(entity);
|
||||
@ -269,7 +269,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
||||
//update pipeline state to use mats again
|
||||
renderPipelineState.setUseMaterial(true);
|
||||
|
||||
if(Globals.userSettings.graphicsDebugDrawNavmesh()){
|
||||
if(Globals.gameConfigCurrent.getSettings().graphicsDebugDrawNavmesh()){
|
||||
throw new Error("Not yet implemented!");
|
||||
}
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ public class ActorPanel extends BufferedStandardDrawableContainerElement impleme
|
||||
actor.applySpatialData(modelMatrix,new Vector3d(actorPosition));
|
||||
actor.draw(renderPipelineState,openGLState);
|
||||
|
||||
RenderingEngine.setFOV(Globals.userSettings.getGraphicsFOV());
|
||||
RenderingEngine.setFOV(Globals.gameConfigCurrent.getSettings().getGraphicsFOV());
|
||||
RenderingEngine.setAspectRatio(2.0f);
|
||||
|
||||
openGLState.glDepthTest(false);
|
||||
|
||||
@ -76,9 +76,9 @@ public class DataCellPhysicsManager {
|
||||
|
||||
program = Globals.terrainShaderProgram;
|
||||
|
||||
drawRadius = Globals.userSettings.getGraphicsPerformanceLODChunkRadius();
|
||||
drawStepdownInterval = Globals.userSettings.getGameplayPhysicsCellRadius();
|
||||
physicsRadius = Globals.userSettings.getGameplayPhysicsCellRadius();
|
||||
drawRadius = Globals.gameConfigCurrent.getSettings().getGraphicsPerformanceLODChunkRadius();
|
||||
drawStepdownInterval = Globals.gameConfigCurrent.getSettings().getGameplayPhysicsCellRadius();
|
||||
physicsRadius = Globals.gameConfigCurrent.getSettings().getGameplayPhysicsCellRadius();
|
||||
|
||||
update = true;
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ public class StateCleanupCheckerExtension implements AfterEachCallback {
|
||||
Object[] objectsToCheck = new Object[]{
|
||||
Globals.renderingEngine,
|
||||
Globals.audioEngine,
|
||||
Globals.javaPID,
|
||||
LoggerInterface.loggerEngine,
|
||||
RenderingEngine.screenFramebuffer,
|
||||
Globals.engineState,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user