fix cache bug + foliage setting
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
cc60818e35
commit
221bcd70a7
@ -13,6 +13,7 @@
|
|||||||
"graphicsPerformanceEnableVSync" : false,
|
"graphicsPerformanceEnableVSync" : false,
|
||||||
"graphicsPerformanceDrawShadows" : true,
|
"graphicsPerformanceDrawShadows" : true,
|
||||||
"graphicsPerformanceOIT" : true,
|
"graphicsPerformanceOIT" : true,
|
||||||
|
"graphicsPerformanceEnableFoliageManager" : false,
|
||||||
"graphicsViewRange" : 20000.0,
|
"graphicsViewRange" : 20000.0,
|
||||||
|
|
||||||
"renderResolutionX": 1920,
|
"renderResolutionX": 1920,
|
||||||
|
|||||||
@ -971,6 +971,8 @@ Script engine synchronization utility
|
|||||||
Convert ScriptEngine to service
|
Convert ScriptEngine to service
|
||||||
ScriptEngine full re-initialization signal
|
ScriptEngine full re-initialization signal
|
||||||
Add surface width to test generator
|
Add surface width to test generator
|
||||||
|
User setting to toggle foliage manager
|
||||||
|
Fix client terrain cache lookup bug
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class ClientFoliageManager {
|
|||||||
*/
|
*/
|
||||||
public void update(){
|
public void update(){
|
||||||
Globals.profiler.beginCpuSample("ClientFoliageManager.update");
|
Globals.profiler.beginCpuSample("ClientFoliageManager.update");
|
||||||
if(ready && this.dependenciesAreReady()){
|
if(ready && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager() && this.dependenciesAreReady()){
|
||||||
this.flipUpdateCache();
|
this.flipUpdateCache();
|
||||||
for(int x = -chunkRadius; x < chunkRadius+1; x++){
|
for(int x = -chunkRadius; x < chunkRadius+1; x++){
|
||||||
for(int y = -chunkRadius; y < chunkRadius+1; y++){
|
for(int y = -chunkRadius; y < chunkRadius+1; y++){
|
||||||
|
|||||||
@ -187,7 +187,7 @@ public class ClientTerrainCache {
|
|||||||
return cacheMapEighthRes;
|
return cacheMapEighthRes;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
return cacheMapEighthRes;
|
return cacheMapSixteenthRes;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error("Invalid stride probided! " + stride);
|
throw new Error("Invalid stride probided! " + stride);
|
||||||
|
|||||||
@ -173,11 +173,16 @@ public class ClientDrawCellManager {
|
|||||||
//update all full res cells
|
//update all full res cells
|
||||||
FloatingChunkTreeNode<DrawCell> rootNode = this.chunkTree.getRoot();
|
FloatingChunkTreeNode<DrawCell> rootNode = this.chunkTree.getRoot();
|
||||||
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - full res cells");
|
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();
|
Globals.profiler.endCpuSample();
|
||||||
if(!updatedLastFrame && !this.initialized){
|
if(!updatedLastFrame && !this.initialized){
|
||||||
this.initialized = true;
|
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){
|
if(!updatedLastFrame){
|
||||||
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - half res cells");
|
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - half res cells");
|
||||||
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, QUARTER_RES_LOD);
|
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);
|
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, SIXTEENTH_RES_LOD);
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
if(!updatedLastFrame){
|
// if(!updatedLastFrame){
|
||||||
Globals.profiler.beginCpuSample("ClientDrawCellManager.update - all res cells");
|
// Globals.profiler.beginCpuSample("ClientDrawCellManager.update - all res cells");
|
||||||
updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, ALL_RES_LOD);
|
// updatedLastFrame = this.recursivelyUpdateCells(rootNode, playerPos, evaluationMap, ALL_RES_LOD);
|
||||||
Globals.profiler.endCpuSample();
|
// Globals.profiler.endCpuSample();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
@ -528,7 +533,7 @@ public class ClientDrawCellManager {
|
|||||||
node.isLeaf() &&
|
node.isLeaf() &&
|
||||||
node.getData() != null &&
|
node.getData() != null &&
|
||||||
!node.getData().hasRequested() &&
|
!node.getData().hasRequested() &&
|
||||||
(this.chunkTree.getMaxLevel() - node.getLevel()) < minLeafLod &&
|
(this.chunkTree.getMaxLevel() - node.getLevel()) <= minLeafLod &&
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
node.getLevel() == this.chunkTree.getMaxLevel()
|
node.getLevel() == this.chunkTree.getMaxLevel()
|
||||||
@ -575,7 +580,7 @@ public class ClientDrawCellManager {
|
|||||||
node.isLeaf() &&
|
node.isLeaf() &&
|
||||||
node.getData() != null &&
|
node.getData() != null &&
|
||||||
!node.getData().hasGenerated() &&
|
!node.getData().hasGenerated() &&
|
||||||
(this.chunkTree.getMaxLevel() - node.getLevel()) < minLeafLod &&
|
(this.chunkTree.getMaxLevel() - node.getLevel()) <= minLeafLod &&
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
node.getLevel() == this.chunkTree.getMaxLevel()
|
node.getLevel() == this.chunkTree.getMaxLevel()
|
||||||
|
|||||||
@ -152,6 +152,12 @@ public class ClientTerrainManager {
|
|||||||
message.getworldX(), message.getworldY(), message.getworldZ(),
|
message.getworldX(), message.getworldY(), message.getworldZ(),
|
||||||
data
|
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
|
//remove from request map
|
||||||
this.requestedMap.remove(this.getRequestKey(message.getworldX(), message.getworldY(), message.getworldZ(), message.getchunkResolution()));
|
this.requestedMap.remove(this.getRequestKey(message.getworldX(), message.getworldY(), message.getworldZ(), message.getchunkResolution()));
|
||||||
} break;
|
} break;
|
||||||
|
|||||||
@ -35,6 +35,12 @@ public class UserSettings {
|
|||||||
boolean graphicsPerformanceEnableVSync;
|
boolean graphicsPerformanceEnableVSync;
|
||||||
boolean graphicsPerformanceDrawShadows;
|
boolean graphicsPerformanceDrawShadows;
|
||||||
boolean graphicsPerformanceOIT;
|
boolean graphicsPerformanceOIT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls whether the foliage manager runs or not
|
||||||
|
*/
|
||||||
|
boolean graphicsPerformanceEnableFoliageManager;
|
||||||
|
|
||||||
//resolution
|
//resolution
|
||||||
int renderResolutionX;
|
int renderResolutionX;
|
||||||
int renderResolutionY;
|
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(){
|
static UserSettings getDefault(){
|
||||||
UserSettings rVal = new UserSettings();
|
UserSettings rVal = new UserSettings();
|
||||||
|
|
||||||
@ -196,6 +220,7 @@ public class UserSettings {
|
|||||||
rVal.graphicsPerformanceDrawShadows = true;
|
rVal.graphicsPerformanceDrawShadows = true;
|
||||||
rVal.graphicsPerformanceEnableVSync = true;
|
rVal.graphicsPerformanceEnableVSync = true;
|
||||||
rVal.graphicsPerformanceOIT = true;
|
rVal.graphicsPerformanceOIT = true;
|
||||||
|
rVal.graphicsPerformanceEnableFoliageManager = true;
|
||||||
rVal.renderResolutionX = 1920;
|
rVal.renderResolutionX = 1920;
|
||||||
rVal.renderResolutionY = 1080;
|
rVal.renderResolutionY = 1080;
|
||||||
|
|
||||||
@ -205,7 +230,9 @@ public class UserSettings {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the user's settings
|
||||||
|
*/
|
||||||
public static void loadUserSettings(){
|
public static void loadUserSettings(){
|
||||||
if(Globals.userSettings == null){
|
if(Globals.userSettings == null){
|
||||||
LoggerInterface.loggerStartup.INFO("Load user settings");
|
LoggerInterface.loggerStartup.INFO("Load user settings");
|
||||||
|
|||||||
@ -94,6 +94,9 @@ public class TestGenerationChunkGenerator implements ChunkGenerator {
|
|||||||
float[][][] weights = new float[ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION][ServerTerrainChunk.CHUNK_DIMENSION];;
|
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];
|
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 {
|
try {
|
||||||
//actual generation algo
|
//actual generation algo
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user