Fix LOD shading applying incorrectly with Iris
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class DependencyInjector<BindableType extends IBindable> implements IDependencyInjector<BindableType> // Note to self: Don't try adding a generic type to IDhApiEvent, the constructor won't accept it
|
||||
{
|
||||
protected final Map<Class<? extends BindableType>, ArrayList<BindableType>> dependencies = new HashMap<>();
|
||||
protected final HashMap<Class<? extends BindableType>, ArrayList<BindableType>> dependencies = new HashMap<>();
|
||||
|
||||
/** Internal class reference to BindableType since we can't get it any other way. */
|
||||
protected final Class<? extends BindableType> bindableInterface;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.seibel.distanthorizons.api.enums.config.EDhApiMcRenderingFadeMode;
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiRenderPass;
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.*;
|
||||
import com.seibel.distanthorizons.core.api.internal.rendering.DhRenderState;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
|
||||
import com.seibel.distanthorizons.core.file.structure.ClientOnlySaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
@@ -40,6 +41,7 @@ import com.seibel.distanthorizons.core.util.objects.Pair;
|
||||
import com.seibel.distanthorizons.core.util.objects.RollingAverage;
|
||||
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhMetaRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhVanillaFadeRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhTestTriangleRenderer;
|
||||
@@ -148,6 +150,15 @@ public class ClientApi
|
||||
|
||||
public static long firstRenderTimeMs = 0;
|
||||
|
||||
/**
|
||||
* keeping track of this is necessary to fix
|
||||
* out-of-date LODs from rendering when the shading
|
||||
* is changed by Iris, causing LODs to often
|
||||
* lack the side shading, which looks pretty bad
|
||||
* when shaders are disabled.
|
||||
*/
|
||||
private boolean irisShadersEnabledLastFrame = false;
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
@@ -504,6 +515,27 @@ public class ClientApi
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
//====================//
|
||||
// Iris data re-build //
|
||||
//====================//
|
||||
//region
|
||||
|
||||
// delayed getter since ClientApi is created before this accessor is bound
|
||||
IIrisAccessor irisAccessor = ModAccessorInjector.INSTANCE.get(IIrisAccessor.class);
|
||||
if (irisAccessor != null)
|
||||
{
|
||||
boolean shadersActive = irisAccessor.isShaderPackInUse();
|
||||
if (this.irisShadersEnabledLastFrame != shadersActive)
|
||||
{
|
||||
this.irisShadersEnabledLastFrame = shadersActive;
|
||||
DhApi.Delayed.renderProxy.clearRenderDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user