Skip to content

Commit

Permalink
Fix translucent render typo
Browse files Browse the repository at this point in the history
  • Loading branch information
zbx1425 committed Dec 9, 2023
1 parent ad73279 commit ccc2bcb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ClientConfig {

public static boolean enableOptimization = true;
public static boolean enableBbModelPreload = false;
public static boolean translucentSort = true;
public static boolean translucentSort = false;

public static boolean enableScriptDebugOverlay = false;

Expand All @@ -37,7 +37,7 @@ public static void load(Path path) {
JsonObject configObject = Main.JSON_PARSER.parse(Files.readString(path)).getAsJsonObject();
enableOptimization = !getOrDefault(configObject, "shaderCompatMode", JsonElement::getAsBoolean, false);
enableBbModelPreload = getOrDefault(configObject, "enableBbModelPreload", JsonElement::getAsBoolean, false);
translucentSort = getOrDefault(configObject, "translucentSort", JsonElement::getAsBoolean, true);
translucentSort = getOrDefault(configObject, "translucentSort", JsonElement::getAsBoolean, false);
enableScriptDebugOverlay = getOrDefault(configObject, "enableScriptDebugOverlay", JsonElement::getAsBoolean, false);
enableRail3D = getOrDefault(configObject, "enableRail3D", JsonElement::getAsBoolean, true);
enableRailRender = getOrDefault(configObject, "enableRailRender", JsonElement::getAsBoolean, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void enqueueOpaqueBlaze(BufferSourceProxy vertexConsumers, Matrix4f pose,

public void enqueueTranslucentGl(BatchManager batchManager, Matrix4f matrix4f, int light, Profiler profiler) {
int shaderLightmapUV = AttrUtil.exchangeLightmapUVBits(light);
batchManager.enqueue(uploadedOpaqueParts, new EnqueueProp(
batchManager.enqueue(uploadedTranslucentParts, new EnqueueProp(
new VertAttrState()
.setColor(255, 255, 255, 255).setOverlayUVNoOverlay()
.setLightmapUV(shaderLightmapUV).setModelMatrix(matrix4f)
Expand All @@ -82,12 +82,14 @@ public void close(){
public void replaceTexture(String oldTexture, ResourceLocation newTexture) {
uploadedOpaqueParts.replaceTexture(oldTexture, newTexture);
opaqueParts.replaceTexture(oldTexture, newTexture);
uploadedTranslucentParts.replaceTexture(oldTexture, newTexture);
translucentParts.replaceTexture(oldTexture, newTexture);
}

public void replaceAllTexture(ResourceLocation newTexture) {
uploadedOpaqueParts.replaceAllTexture(newTexture);
opaqueParts.replaceAllTexture(newTexture);
uploadedTranslucentParts.replaceAllTexture(newTexture);
translucentParts.replaceAllTexture(newTexture);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public void enqueue(ModelCluster model, Matrix4f pose, int light) {
public void commit(BufferSourceProxy vertexConsumers, boolean isOptimized, boolean sortTranslucent, Profiler profiler) {
if (isOptimized && !shaderManager.isReady()) return;
if (drawCalls.isEmpty()) return;
if (isOptimized) {
if (!isOptimized) {
for (ClusterDrawCall drawCall : drawCalls)
drawCall.model.enqueueOpaqueGl(batchManager, drawCall.pose, drawCall.light, profiler);
drawCall.model.enqueueOpaqueBlaze(vertexConsumers, drawCall.pose, drawCall.light, profiler);
} else {
for (ClusterDrawCall drawCall : drawCalls)
drawCall.model.enqueueOpaqueBlaze(vertexConsumers, drawCall.pose, drawCall.light, profiler);
drawCall.model.enqueueOpaqueGl(batchManager, drawCall.pose, drawCall.light, profiler);
}
if (isOptimized && sortTranslucent) {
if (!isOptimized || sortTranslucent) {
for (ClusterDrawCall drawCall : drawCalls)
drawCall.model.enqueueTranslucentBlaze(vertexConsumers, drawCall.pose, drawCall.light, profiler);
} else {
Expand Down

0 comments on commit ccc2bcb

Please sign in to comment.