Skip to content

Commit

Permalink
update OcclusionCullerThread
Browse files Browse the repository at this point in the history
  • Loading branch information
RogoShum committed Apr 23, 2024
1 parent d8bd581 commit 747f671
Show file tree
Hide file tree
Showing 59 changed files with 1,880 additions and 843 deletions.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ repositories {
}
}

loom {
accessWidenerPath = file("src/main/resources/brute_force_rendering_culling.accesswidener")
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
Expand All @@ -42,6 +46,8 @@ dependencies {

implementation("org.anarres:jcpp:1.4.14")
modImplementation("io.github.douira:glsl-transformer:2.0.0-pre13")

modImplementation('maven.modrinth:nvidium:0.2.6-beta')
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10
loader_version=0.15.9

# Mod Properties
mod_version=0.4.8
mod_version=0.5.1
maven_group=rogo.renderingculling
archives_base_name=BruteForceRenderingCulling-fabric-1.20.1

Expand Down
64 changes: 0 additions & 64 deletions src/main/java/rogo/renderingculling/api/ChunkCullingMap.java

This file was deleted.

62 changes: 38 additions & 24 deletions src/main/java/rogo/renderingculling/api/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

public class Config {
private static final PropertyMirror<Double> SAMPLING = PropertyMirror.create(ConfigTypes.DOUBLE);
private static final PropertyMirror<Boolean> CULL_ENTITY = PropertyMirror.create(ConfigTypes.BOOLEAN);
private static final PropertyMirror<Boolean> CULL_CHUNK = PropertyMirror.create(ConfigTypes.BOOLEAN);
private static final PropertyMirror<Boolean> ASYNC = PropertyMirror.create(ConfigTypes.BOOLEAN);
private static final PropertyMirror<Integer> UPDATE_DELAY = PropertyMirror.create(ConfigTypes.INTEGER);
private static final PropertyMirror<List<String>> ENTITY_SKIP = PropertyMirror.create(ConfigTypes.makeList(ConfigTypes.STRING));
private static final PropertyMirror<List<String>> BLOCK_ENTITY_SKIP = PropertyMirror.create(ConfigTypes.makeList(ConfigTypes.STRING));

public static double getSampling() {
if(unload())
Expand All @@ -30,8 +36,6 @@ public static void setSampling(double value) {
save();
}

private static final PropertyMirror<Boolean> CULL_ENTITY = PropertyMirror.create(ConfigTypes.BOOLEAN);

public static boolean getCullEntity() {
if(unload() || !CullingHandler.gl33())
return false;
Expand All @@ -43,56 +47,66 @@ public static void setCullEntity(boolean value) {
save();
}

private static final PropertyMirror<Boolean> CULL_CHUNK = PropertyMirror.create(ConfigTypes.BOOLEAN);

public static boolean getCullChunk() {
if(unload())
return false;
return CULL_CHUNK.getValue();
}

public static boolean shouldCullChunk() {
if (unload())
return false;

if (CullingHandler.CHUNK_CULLING_MAP == null || !CullingHandler.CHUNK_CULLING_MAP.isDone())
return false;

return getCullChunk();
}

public static void setCullChunk(boolean value) {
CULL_CHUNK.setValue(value);
save();
}

private static final PropertyMirror<Integer> UPDATE_DELAY = PropertyMirror.create(ConfigTypes.INTEGER);
public static boolean getAsyncChunkRebuild() {
if (unload())
return false;

public static int getDepthUpdateDelay() {
if(unload())
return 1;
int dynamicWithShader = CullingHandler.INSTANCE.renderingShader() ? 1 : 0;
return UPDATE_DELAY.getValue() + dynamicWithShader;
if(!shouldCullChunk())
return false;

return ASYNC.getValue();
}

public static void setDepthUpdateDelay(int value) {
UPDATE_DELAY.setValue(value);
public static void setAsyncChunkRebuild(boolean value) {
if(!shouldCullChunk())
return;

ASYNC.setValue(value);
save();
}

private static final PropertyMirror<Integer> CULLING_ENTITY_RATE = PropertyMirror.create(ConfigTypes.INTEGER);
public static int getShaderDynamicDelay() {
return CullingHandler.enabledShader() ? 1 : 0;
}

public static int getCullingEntityRate() {
public static int getDepthUpdateDelay() {
if(unload())
return 20;
return CULLING_ENTITY_RATE.getValue();
return 1;
return UPDATE_DELAY.getValue() <= 9 ? UPDATE_DELAY.getValue() + getShaderDynamicDelay() : UPDATE_DELAY.getValue();
}

public static void setCullingEntityRate(int value) {
CULLING_ENTITY_RATE.setValue(value);
public static void setDepthUpdateDelay(int value) {
UPDATE_DELAY.setValue(value);
save();
}

private static final PropertyMirror<List<String>> ENTITY_SKIP = PropertyMirror.create(ConfigTypes.makeList(ConfigTypes.STRING));

public static List<String> getEntitiesSkip() {
if(unload())
return ImmutableList.of();
return ENTITY_SKIP.getValue();
}

private static final PropertyMirror<List<String>> BLOCK_ENTITY_SKIP = PropertyMirror.create(ConfigTypes.makeList(ConfigTypes.STRING));

public static List<String> getBlockEntitiesSkip() {
if(unload())
return ImmutableList.of();
Expand Down Expand Up @@ -140,8 +154,8 @@ private static void init() {
.beginValue(getTranslatedItem("brute_force_rendering_culling.cull_chunk"), ConfigTypes.BOOLEAN, true)
.finishValue(CULL_CHUNK::mirror)

.beginValue(getTranslatedItem("brute_force_rendering_culling.culling_entity_update_rate"), ConfigTypes.INTEGER, 20)
.finishValue(CULLING_ENTITY_RATE::mirror)
.beginValue(getTranslatedItem("brute_force_rendering_culling.async"), ConfigTypes.BOOLEAN, true)
.finishValue(ASYNC::mirror)

.beginValue(getTranslatedItem("brute_force_rendering_culling.skip_culling_entities"), ConfigTypes.makeList(ConfigTypes.STRING), entityList)
.finishValue(ENTITY_SKIP::mirror)
Expand Down
Loading

0 comments on commit 747f671

Please sign in to comment.