re-add vanilla fading
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
package com.seibel.distanthorizons.core.api.internal;
|
package com.seibel.distanthorizons.core.api.internal;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.DhApi;
|
import com.seibel.distanthorizons.api.DhApi;
|
||||||
|
import com.seibel.distanthorizons.api.enums.config.EDhApiMcRenderingFadeMode;
|
||||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiRenderPass;
|
import com.seibel.distanthorizons.api.enums.rendering.EDhApiRenderPass;
|
||||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.*;
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.*;
|
||||||
import com.seibel.distanthorizons.core.api.internal.rendering.DhRenderState;
|
import com.seibel.distanthorizons.core.api.internal.rendering.DhRenderState;
|
||||||
@@ -37,6 +38,7 @@ import com.seibel.distanthorizons.core.util.objects.Pair;
|
|||||||
import com.seibel.distanthorizons.core.util.objects.RollingAverage;
|
import com.seibel.distanthorizons.core.util.objects.RollingAverage;
|
||||||
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IMcFadeRenderer;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IMcTestRenderer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.IMcTestRenderer;
|
||||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
@@ -643,28 +645,27 @@ public class ClientApi
|
|||||||
*/
|
*/
|
||||||
public void renderFadeOpaque()
|
public void renderFadeOpaque()
|
||||||
{
|
{
|
||||||
//IMcFadeRenderer fadeRenderer = SingletonInjector.INSTANCE.get(IMcFadeRenderer.class);
|
IMcFadeRenderer fadeRenderer = SingletonInjector.INSTANCE.get(IMcFadeRenderer.class);
|
||||||
//if (fadeRenderer == null)
|
if (fadeRenderer == null)
|
||||||
//{
|
{
|
||||||
// return;
|
return;
|
||||||
//}
|
}
|
||||||
//fadeRenderer.render();
|
|
||||||
|
|
||||||
|
// only fade when DH is rendering
|
||||||
//// only fade when DH is rendering
|
if (Config.Client.Advanced.Debugging.rendererMode.get() != EDhApiRendererMode.DISABLED
|
||||||
//if (Config.Client.Advanced.Debugging.rendererMode.get() != EDhApiRendererMode.DISABLED
|
&&
|
||||||
// &&
|
(
|
||||||
// (
|
// only fade when requested
|
||||||
// // only fade when requested
|
Config.Client.Advanced.Graphics.Quality.vanillaFadeMode.get() == EDhApiMcRenderingFadeMode.DOUBLE_PASS
|
||||||
// Config.Client.Advanced.Graphics.Quality.vanillaFadeMode.get() == EDhApiMcRenderingFadeMode.DOUBLE_PASS
|
// or if LOD-only mode is enabled (fading is used to remove the MC render pass)
|
||||||
// // or if LOD-only mode is enabled (fading is used to remove the MC render pass)
|
|| Config.Client.Advanced.Debugging.lodOnlyMode.get()
|
||||||
// || Config.Client.Advanced.Debugging.lodOnlyMode.get()
|
)
|
||||||
// )
|
// don't fade when Iris shaders are active, otherwise the rendering can get weird
|
||||||
// // don't fade when Iris shaders are active, otherwise the rendering can get weird
|
&& !DhApiRenderProxy.INSTANCE.getDeferTransparentRendering())
|
||||||
// && !DhApiRenderProxy.INSTANCE.getDeferTransparentRendering())
|
{
|
||||||
//{
|
fadeRenderer.render(RENDER_STATE.mcModelViewMatrix, RENDER_STATE.mcProjectionMatrix, RENDER_STATE.clientLevelWrapper);
|
||||||
// VanillaFadeRenderer.INSTANCE.render(RENDER_STATE.mcModelViewMatrix, RENDER_STATE.mcProjectionMatrix, RENDER_STATE.partialTickTime, RENDER_STATE.clientLevelWrapper);
|
//VanillaFadeRenderer.INSTANCE.render(RENDER_STATE.mcModelViewMatrix, RENDER_STATE.mcProjectionMatrix, RENDER_STATE.partialTickTime, RENDER_STATE.clientLevelWrapper);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The second fade pass.
|
* The second fade pass.
|
||||||
@@ -673,25 +674,30 @@ public class ClientApi
|
|||||||
*/
|
*/
|
||||||
public void renderFadeTransparent()
|
public void renderFadeTransparent()
|
||||||
{
|
{
|
||||||
|
IMcFadeRenderer fadeRenderer = SingletonInjector.INSTANCE.get(IMcFadeRenderer.class);
|
||||||
|
if (fadeRenderer == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only fade when DH is rendering
|
||||||
//// only fade when DH is rendering
|
if (Config.Client.Advanced.Debugging.rendererMode.get() != EDhApiRendererMode.DISABLED)
|
||||||
//if (Config.Client.Advanced.Debugging.rendererMode.get() != EDhApiRendererMode.DISABLED)
|
{
|
||||||
//{
|
boolean renderFade =
|
||||||
// boolean renderFade =
|
(
|
||||||
// (
|
// only fade when requested
|
||||||
// // only fade when requested
|
Config.Client.Advanced.Graphics.Quality.vanillaFadeMode.get() != EDhApiMcRenderingFadeMode.NONE
|
||||||
// Config.Client.Advanced.Graphics.Quality.vanillaFadeMode.get() != EDhApiMcRenderingFadeMode.NONE
|
// or if LOD-only mode is enabled (fading is used to remove the MC render pass)
|
||||||
// // or if LOD-only mode is enabled (fading is used to remove the MC render pass)
|
|| Config.Client.Advanced.Debugging.lodOnlyMode.get()
|
||||||
// || Config.Client.Advanced.Debugging.lodOnlyMode.get()
|
)
|
||||||
// )
|
// don't fade when Iris shaders are active, otherwise the rendering can get weird
|
||||||
// // don't fade when Iris shaders are active, otherwise the rendering can get weird
|
&& !DhApiRenderProxy.INSTANCE.getDeferTransparentRendering();
|
||||||
// && !DhApiRenderProxy.INSTANCE.getDeferTransparentRendering();
|
if (renderFade)
|
||||||
// if (renderFade)
|
{
|
||||||
// {
|
fadeRenderer.render(RENDER_STATE.mcModelViewMatrix, RENDER_STATE.mcProjectionMatrix, RENDER_STATE.clientLevelWrapper);
|
||||||
// VanillaFadeRenderer.INSTANCE.render(RENDER_STATE.mcModelViewMatrix, RENDER_STATE.mcProjectionMatrix, RENDER_STATE.partialTickTime, RENDER_STATE.clientLevelWrapper);
|
//VanillaFadeRenderer.INSTANCE.render(RENDER_STATE.mcModelViewMatrix, RENDER_STATE.mcProjectionMatrix, RENDER_STATE.partialTickTime, RENDER_STATE.clientLevelWrapper);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///endregion
|
///endregion
|
||||||
|
|||||||
+6
-2
@@ -157,6 +157,10 @@ public class McLodRenderer
|
|||||||
|
|
||||||
if (!runningDeferredPass)
|
if (!runningDeferredPass)
|
||||||
{
|
{
|
||||||
|
lodRenderer.clearColor();
|
||||||
|
lodRenderer.clearDepth();
|
||||||
|
|
||||||
|
|
||||||
//=========================//
|
//=========================//
|
||||||
// opaque and non-deferred //
|
// opaque and non-deferred //
|
||||||
// transparent rendering //
|
// transparent rendering //
|
||||||
@@ -235,8 +239,6 @@ public class McLodRenderer
|
|||||||
//DebugRenderer.INSTANCE.render(combinedMatrix);
|
//DebugRenderer.INSTANCE.render(combinedMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
lodRenderer.clearDepth();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -326,6 +328,8 @@ public class McLodRenderer
|
|||||||
lodRenderer.render(renderEventParam, opaquePass, modelPos, vbos, profilerWrapper);
|
lodRenderer.render(renderEventParam, opaquePass, modelPos, vbos, profilerWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lodRenderer.applyToMcTexture();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-1
@@ -19,11 +19,14 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.core.wrapperInterfaces.render;
|
package com.seibel.distanthorizons.core.wrapperInterfaces.render;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||||
|
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable;
|
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable;
|
||||||
|
|
||||||
public interface IMcFadeRenderer extends IBindable
|
public interface IMcFadeRenderer extends IBindable
|
||||||
{
|
{
|
||||||
|
|
||||||
void render();
|
void render(Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, IClientLevelWrapper level);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -33,6 +33,8 @@ public interface IMcLodRenderer extends IBindable
|
|||||||
|
|
||||||
int getVertexSize();
|
int getVertexSize();
|
||||||
|
|
||||||
|
void applyToMcTexture();
|
||||||
void clearDepth();
|
void clearDepth();
|
||||||
|
void clearColor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#version 150 core
|
||||||
|
|
||||||
|
in vec2 TexCoord;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
uniform sampler2D uDhColorTexture;
|
||||||
|
uniform sampler2D uDhDepthTexture;
|
||||||
|
|
||||||
|
// DH apply frag
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
//fragColor = texture(uApplyTexture, TexCoord);
|
||||||
|
|
||||||
|
fragColor = vec4(0.0);
|
||||||
|
|
||||||
|
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||||
|
// only update fragments that were drawn to
|
||||||
|
float fragmentDepth = texture(uDhDepthTexture, TexCoord).r;
|
||||||
|
if (fragmentDepth != 1)
|
||||||
|
{
|
||||||
|
fragColor = texture(uDhColorTexture, TexCoord);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// use the original MC texture if no LODs were drawn to this fragment
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#version 150 core
|
||||||
|
|
||||||
|
in vec2 vPosition;
|
||||||
|
|
||||||
|
out vec2 TexCoord;
|
||||||
|
|
||||||
|
// DH apply
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||||
|
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#version 150 core
|
||||||
|
|
||||||
|
in vec2 TexCoord;
|
||||||
|
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
uniform sampler2D uCopyTexture;
|
||||||
|
|
||||||
|
// DH copy frag
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
fragColor = texture(uCopyTexture, TexCoord);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#version 150 core
|
||||||
|
|
||||||
|
in vec2 vPosition;
|
||||||
|
|
||||||
|
out vec2 TexCoord;
|
||||||
|
|
||||||
|
// DH copy
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||||
|
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||||
|
}
|
||||||
+8
-7
@@ -5,21 +5,22 @@ in vec2 TexCoord;
|
|||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
uniform sampler2D uMcDepthTexture;
|
uniform sampler2D uMcDepthTexture;
|
||||||
uniform sampler2D uDhDepthTexture;
|
|
||||||
uniform sampler2D uCombinedMcDhColorTexture;
|
uniform sampler2D uCombinedMcDhColorTexture;
|
||||||
|
|
||||||
|
uniform sampler2D uDhDepthTexture;
|
||||||
uniform sampler2D uDhColorTexture;
|
uniform sampler2D uDhColorTexture;
|
||||||
|
|
||||||
layout (std140) uniform fragUniformBlock
|
layout (std140) uniform fragUniformBlock
|
||||||
{
|
{
|
||||||
// inverted model view matrix and projection matrix
|
bool uOnlyRenderLods;
|
||||||
mat4 uDhInvMvmProj;
|
|
||||||
mat4 uMcInvMvmProj;
|
|
||||||
|
|
||||||
float uStartFadeBlockDistance;
|
float uStartFadeBlockDistance;
|
||||||
float uEndFadeBlockDistance;
|
float uEndFadeBlockDistance;
|
||||||
float uMaxLevelHeight;
|
float uMaxLevelHeight;
|
||||||
|
|
||||||
bool uOnlyRenderLods;
|
// inverted model view matrix and projection matrix
|
||||||
|
mat4 uDhInvMvmProj;
|
||||||
|
mat4 uMcInvMvmProj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user