fix cache bug + foliage setting
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-11-09 20:51:27 -05:00
parent cc60818e35
commit 221bcd70a7
8 changed files with 57 additions and 13 deletions

View File

@ -13,6 +13,7 @@
"graphicsPerformanceEnableVSync" : false,
"graphicsPerformanceDrawShadows" : true,
"graphicsPerformanceOIT" : true,
"graphicsPerformanceEnableFoliageManager" : false,
"graphicsViewRange" : 20000.0,
"renderResolutionX": 1920,

View File

@ -971,6 +971,8 @@ Script engine synchronization utility
Convert ScriptEngine to service
ScriptEngine full re-initialization signal
Add surface width to test generator
User setting to toggle foliage manager
Fix client terrain cache lookup bug
# TODO

View File

@ -56,7 +56,7 @@ public class ClientFoliageManager {
*/
public void update(){
Globals.profiler.beginCpuSample("ClientFoliageManager.update");
if(ready && this.dependenciesAreReady()){
if(ready && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager() && this.dependenciesAreReady()){
this.flipUpdateCache();
for(int x = -chunkRadius; x < chunkRadius+1; x++){
for(int y = -chunkRadius; y < chunkRadius+1; y++){

View File

@ -187,7 +187,7 @@ public class ClientTerrainCache {
return cacheMapEighthRes;
}
case 4: {
return cacheMapEighthRes;
return cacheMapSixteenthRes;
}
default: {
throw new Error("Invalid stride probided! " + stride);

View File

@ -173,11 +173,16 @@ public class ClientDrawCellManager {
//update all full res cells
FloatingChunkTreeNode<DrawCell> rootNode = this.chunkTree.getRoot();
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - full res cells");
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, HALF_RES_LOD);
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, FULL_RES_LOD);
Globals.profiler.endCpuSample();
if(!updatedLastFrame && !this.initialized){
this.initialized = true;
}
if(!updatedLastFrame){
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - half res cells");
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, HALF_RES_LOD);
Globals.profiler.endCpuSample();
}
if(!updatedLastFrame){
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - half res cells");
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, QUARTER_RES_LOD);
@ -193,11 +198,11 @@ public class ClientDrawCellManager {
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, SIXTEENTH_RES_LOD);
Globals.profiler.endCpuSample();
}
if(!updatedLastFrame){
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - all res cells");
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, ALL_RES_LOD);
Globals.profiler.endCpuSample();
}
// if(!updatedLastFrame){
// Globals.profiler.beginCpuSample("ClientDrawCellManager.update - all res cells");
// updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, ALL_RES_LOD);
// Globals.profiler.endCpuSample();
// }
}
Globals.profiler.endCpuSample();
}
@ -528,7 +533,7 @@ public class ClientDrawCellManager {
node.isLeaf() &&
node.getData() != null &&
!node.getData().hasRequested() &&
(this.chunkTree.getMaxLevel() - node.getLevel()) < minLeafLod &&
(this.chunkTree.getMaxLevel() - node.getLevel()) <= minLeafLod &&
(
(
node.getLevel() == this.chunkTree.getMaxLevel()
@ -575,7 +580,7 @@ public class ClientDrawCellManager {
node.isLeaf() &&
node.getData() != null &&
!node.getData().hasGenerated() &&
(this.chunkTree.getMaxLevel() - node.getLevel()) < minLeafLod &&
(this.chunkTree.getMaxLevel() - node.getLevel()) <= minLeafLod &&
(
(
node.getLevel() == this.chunkTree.getMaxLevel()

View File

@ -152,6 +152,12 @@ public class ClientTerrainManager {
message.getworldX(), message.getworldY(), message.getworldZ(),
data
);
if(message.getworldX() == 16 && message.getworldY() == 0 && message.getworldZ() == 32){
System.out.println("Received! " + message.getchunkResolution());
for(int i = 0; i < 10; i++){
System.out.println(values[1][i][3]);
}
}
//remove from request map
this.requestedMap.remove(this.getRequestKey(message.getworldX(), message.getworldY(), message.getworldZ(), message.getchunkResolution()));
} break;

View File

@ -35,6 +35,12 @@ public class UserSettings {
boolean graphicsPerformanceEnableVSync;
boolean graphicsPerformanceDrawShadows;
boolean graphicsPerformanceOIT;
/**
* Controls whether the foliage manager runs or not
*/
boolean graphicsPerformanceEnableFoliageManager;
//resolution
int renderResolutionX;
int renderResolutionY;
@ -164,6 +170,21 @@ public class UserSettings {
}
/**
* Checks if the foliage manager is enabled or not
* @return true if enabled, false otherwise
*/
public boolean getGraphicsPerformanceEnableFoliageManager() {
return graphicsPerformanceEnableFoliageManager;
}
/**
* Sets if the foliage manager is enabled or not
* @param graphicsPerformanceEnableFoliageManager true if enabled, false otherwise
*/
public void setGraphicsPerformanceEnableFoliageManager(boolean graphicsPerformanceEnableFoliageManager) {
this.graphicsPerformanceEnableFoliageManager = graphicsPerformanceEnableFoliageManager;
}
@ -171,8 +192,11 @@ public class UserSettings {
/**
* Generates a default settings file
* @return The settings file
*/
static UserSettings getDefault(){
UserSettings rVal = new UserSettings();
@ -196,6 +220,7 @@ public class UserSettings {
rVal.graphicsPerformanceDrawShadows = true;
rVal.graphicsPerformanceEnableVSync = true;
rVal.graphicsPerformanceOIT = true;
rVal.graphicsPerformanceEnableFoliageManager = true;
rVal.renderResolutionX = 1920;
rVal.renderResolutionY = 1080;
@ -205,7 +230,9 @@ public class UserSettings {
return rVal;
}
/**
* Loads the user's settings
*/
public static void loadUserSettings(){
if(Globals.userSettings == null){
LoggerInterface.loggerStartup.INFO("Load user settings");

View File

@ -94,6 +94,9 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
float[][][] weights = new float[ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION];;
int[][][] values = new int[ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION];
if(worldX == 16 && worldY == 0 && worldZ == 32){
System.out.println(worldX + " " + worldY + " " + worldZ);
}
try {
//actual generation algo