-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add quad splitting mode setting and integrate it with the partition t…
…ree builder and the topo sorter
- Loading branch information
Showing
13 changed files
with
160 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...net/caffeinemc/mods/sodium/client/render/chunk/translucent_sorting/QuadSplittingMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package net.caffeinemc.mods.sodium.client.render.chunk.translucent_sorting; | ||
|
||
import net.caffeinemc.mods.sodium.client.gui.options.TextProvider; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.util.Mth; | ||
|
||
public enum QuadSplittingMode implements TextProvider { | ||
OFF(0.0f, "options.off"), | ||
SAFE(1.0f, "sodium.options.quad_splitting.safe"), | ||
UNLIMITED(Float.POSITIVE_INFINITY, "sodium.options.quad_splitting.unlimited"); | ||
|
||
// how much bigger the final geometry is allowed to be compared to the input geometry when performing quad splitting. | ||
// 0.5f means that the final geometry can be 50% bigger than the input geometry. | ||
private final float quadSplittingFactor; | ||
private final Component name; | ||
|
||
QuadSplittingMode(float quadSplittingFactor, String name) { | ||
this.quadSplittingFactor = quadSplittingFactor; | ||
this.name = Component.translatable(name); | ||
} | ||
|
||
@Override | ||
public Component getLocalizedName() { | ||
return this.name; | ||
} | ||
|
||
public boolean allowsSplitting() { | ||
return this != OFF; | ||
} | ||
|
||
public int getMaxExtraQuads(int baseQuadCount) { | ||
return Mth.ceil(baseQuadCount * this.quadSplittingFactor); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.