Hook user settings into engine more

This commit is contained in:
austin 2021-08-07 17:43:43 -04:00
parent 6bbcc4af50
commit 0ef9d8c309
4 changed files with 12 additions and 10 deletions

View File

@ -6,7 +6,7 @@
"graphicsFOV" : 90.0,
"graphicsPerformanceEnableVSync" : false,
"graphicsPerformanceEnableVSync" : true,
"graphicsPerformanceDrawShadows" : true,
"graphicsDebugDrawCollisionSpheres" : false,

View File

@ -284,11 +284,11 @@ public class LoadingThread extends Thread {
float randomDampener = 0.0f; //0.25f;
Globals.serverTerrainManager = new ServerTerrainManager(2000,50,100,randomDampener,0);
if(Globals.RUN_SERVER){
if(Globals.LOAD_TERRAIN){
Globals.serverTerrainManager.load();
} else {
if(Globals.userSettings.gameplayGenerateWorld()){
Globals.serverTerrainManager.generate();
Globals.serverTerrainManager.save();
} else {
Globals.serverTerrainManager.load();
}
}

View File

@ -187,7 +187,7 @@ public class Globals {
public static EntityManager entityManager;
//terrain manager
public static boolean LOAD_TERRAIN = true;
// public static boolean LOAD_TERRAIN = true;
public static ServerTerrainManager serverTerrainManager;
public static Vector3f spawnPoint = new Vector3f(1000,0,1000);

View File

@ -82,8 +82,8 @@ public class RenderingEngine {
static ShaderProgram lightDepthShaderProgram;
static Framebuffer lightDepthBuffer;
public static boolean renderHitboxes = false;
public static boolean renderPhysics = false;
// public static boolean renderHitboxes = false;
// public static boolean renderPhysics = false;
static float currentViewPlanarAngle;
@ -122,7 +122,9 @@ public class RenderingEngine {
//this disables vsync to make game run faster
//https://stackoverflow.com/questions/55598376/glfwswapbuffers-is-slow
GLFW.glfwSwapInterval(0);
if(!Globals.userSettings.graphicsPerformanceEnableVSync()){
GLFW.glfwSwapInterval(0);
}
// //Hide the cursor and capture it
// glfwSetInputMode(Globals.window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
@ -374,7 +376,7 @@ public class RenderingEngine {
}
}
if(renderHitboxes){
if(Globals.userSettings.graphicsDebugDrawCollisionSpheres()){
for(Entity currentHitbox : Globals.hitboxManager.getAllHitboxes()){
if((boolean)currentHitbox.getData(EntityDataStrings.DATA_STRING_DRAW)){
Model hitboxModel;
@ -416,7 +418,7 @@ public class RenderingEngine {
}
}
if(renderPhysics){
if(Globals.userSettings.graphicsDebugDrawPhysicsObjects()){
Model physicsGraphicsModel;
for(Entity physicsEntity : Globals.collisionEngine.getDynamicPhysicsEntities()){
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW)){