mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-02-04 17:24:59 +01:00
Remove force diffuse
- The batching engine may run in parallel, meaning the force diffuse state will not be read correctly - ModelTransformers only process vertices that will be rendered in the world - Add 0.6.1 to the issue template
This commit is contained in:
parent
aa08ef1430
commit
e1af5b2533
4 changed files with 4 additions and 34 deletions
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -59,6 +59,7 @@ body:
|
||||||
label: Mod Version
|
label: Mod Version
|
||||||
description: The version of the mod you were using when the bug occured
|
description: The version of the mod you were using when the bug occured
|
||||||
options:
|
options:
|
||||||
|
- "0.6.1"
|
||||||
- "0.6.0"
|
- "0.6.0"
|
||||||
- "0.5.1"
|
- "0.5.1"
|
||||||
- "0.5.0a"
|
- "0.5.0a"
|
||||||
|
|
|
@ -7,16 +7,12 @@ import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.function.BooleanSupplier;
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
import org.apache.commons.lang3.mutable.MutableInt;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public final class OptifineHandler {
|
public final class OptifineHandler {
|
||||||
public static final String OPTIFINE_ROOT_PACKAGE = "net.optifine";
|
public static final String OPTIFINE_ROOT_PACKAGE = "net.optifine";
|
||||||
public static final String SHADER_PACKAGE = "net.optifine.shaders";
|
public static final String SHADER_PACKAGE = "net.optifine.shaders";
|
||||||
|
|
||||||
private static final ThreadLocal<MutableInt> FORCE_DIFFUSE = ThreadLocal.withInitial(MutableInt::new);
|
|
||||||
|
|
||||||
private static boolean isOptifineInstalled;
|
private static boolean isOptifineInstalled;
|
||||||
private static boolean isUsingShaders;
|
private static boolean isUsingShaders;
|
||||||
private static BooleanSupplier shadowPassSupplier;
|
private static BooleanSupplier shadowPassSupplier;
|
||||||
|
@ -99,23 +95,4 @@ public final class OptifineHandler {
|
||||||
public static boolean isShadowPass() {
|
public static boolean isShadowPass() {
|
||||||
return shadowPassSupplier.getAsBoolean();
|
return shadowPassSupplier.getAsBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void pushForceDiffuse() {
|
|
||||||
if (isOptifineInstalled) {
|
|
||||||
FORCE_DIFFUSE.get().increment();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void popForceDiffuse() {
|
|
||||||
if (isOptifineInstalled) {
|
|
||||||
FORCE_DIFFUSE.get().decrement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldApplyDiffuse() {
|
|
||||||
if (isOptifineInstalled) {
|
|
||||||
return !isUsingShaders || (FORCE_DIFFUSE.get().intValue() > 0);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class BatchedMaterialGroup implements MaterialGroup {
|
||||||
|
|
||||||
for (BatchedMaterial<?> material : materials.values()) {
|
for (BatchedMaterial<?> material : materials.values()) {
|
||||||
for (CPUInstancer<?> instancer : material.models.values()) {
|
for (CPUInstancer<?> instancer : material.models.values()) {
|
||||||
instancer.sbb.context.outputColorDiffuse = !consumer.hasOverlay() && OptifineHandler.shouldApplyDiffuse();
|
instancer.sbb.context.outputColorDiffuse = !consumer.hasOverlay() && !OptifineHandler.isUsingShaders();
|
||||||
instancer.submitTasks(stack, pool, consumer);
|
instancer.submitTasks(stack, pool, consumer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,12 +47,9 @@ public class ModelTransformer {
|
||||||
normalMat = params.normal.copy();
|
normalMat = params.normal.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
DiffuseLightCalculator diffuseCalculator = params.diffuseCalculator;
|
final DiffuseLightCalculator diffuseCalculator = DiffuseLightCalculator.forCurrentLevel();
|
||||||
if (diffuseCalculator == null) {
|
|
||||||
diffuseCalculator = DiffuseLightCalculator.forCurrentLevel();
|
|
||||||
}
|
|
||||||
|
|
||||||
int vertexCount = reader.getVertexCount();
|
final int vertexCount = reader.getVertexCount();
|
||||||
for (int i = 0; i < vertexCount; i++) {
|
for (int i = 0; i < vertexCount; i++) {
|
||||||
float x = reader.getX(i);
|
float x = reader.getX(i);
|
||||||
float y = reader.getY(i);
|
float y = reader.getY(i);
|
||||||
|
@ -173,9 +170,6 @@ public class ModelTransformer {
|
||||||
public boolean useParamLight;
|
public boolean useParamLight;
|
||||||
public int packedLightCoords;
|
public int packedLightCoords;
|
||||||
|
|
||||||
// Diffuse
|
|
||||||
public DiffuseLightCalculator diffuseCalculator;
|
|
||||||
|
|
||||||
public Params() {
|
public Params() {
|
||||||
model = new Matrix4f();
|
model = new Matrix4f();
|
||||||
normal = new Matrix3f();
|
normal = new Matrix3f();
|
||||||
|
@ -193,7 +187,6 @@ public class ModelTransformer {
|
||||||
overlay = OverlayTexture.NO_OVERLAY;
|
overlay = OverlayTexture.NO_OVERLAY;
|
||||||
useParamLight = false;
|
useParamLight = false;
|
||||||
packedLightCoords = LightTexture.FULL_BRIGHT;
|
packedLightCoords = LightTexture.FULL_BRIGHT;
|
||||||
diffuseCalculator = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(Params from) {
|
public void load(Params from) {
|
||||||
|
@ -208,7 +201,6 @@ public class ModelTransformer {
|
||||||
overlay = from.overlay;
|
overlay = from.overlay;
|
||||||
useParamLight = from.useParamLight;
|
useParamLight = from.useParamLight;
|
||||||
packedLightCoords = from.packedLightCoords;
|
packedLightCoords = from.packedLightCoords;
|
||||||
diffuseCalculator = from.diffuseCalculator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Params color(int r, int g, int b, int a) {
|
public Params color(int r, int g, int b, int a) {
|
||||||
|
|
Loading…
Reference in a new issue