mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 05:48:00 +01:00
Fixed glitchy magic glows with vulkan mod
This commit is contained in:
parent
db75aa1600
commit
5a0d3a073d
1 changed files with 9 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.RenderPhase;
|
||||
import net.minecraft.client.render.VertexFormat;
|
||||
|
@ -8,16 +9,21 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.Util;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class MagicGlow extends RenderPhase {
|
||||
private MagicGlow(String name, Runnable beginAction, Runnable endAction) {
|
||||
super(name, beginAction, endAction);
|
||||
}
|
||||
|
||||
private static final RenderLayer MAGIC = RenderLayer.of("mlp_magic_glow", VertexFormats.POSITION_COLOR_LIGHT, VertexFormat.DrawMode.QUADS, 256, RenderLayer.MultiPhaseParameters.builder()
|
||||
private static final Supplier<RenderLayer> MAGIC = Suppliers.memoize(() -> {
|
||||
return RenderLayer.of("mlp_magic_glow",
|
||||
FabricLoader.getInstance().isModLoaded("vulkanmod") ? VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL : VertexFormats.POSITION_COLOR_LIGHT,
|
||||
VertexFormat.DrawMode.QUADS, 256, RenderLayer.MultiPhaseParameters.builder()
|
||||
.program(EYES_PROGRAM)
|
||||
.writeMaskState(COLOR_MASK)
|
||||
.depthTest(LEQUAL_DEPTH_TEST)
|
||||
|
@ -25,6 +31,7 @@ public abstract class MagicGlow extends RenderPhase {
|
|||
.lightmap(DISABLE_LIGHTMAP)
|
||||
.cull(DISABLE_CULLING)
|
||||
.build(false));
|
||||
});
|
||||
|
||||
private static final BiFunction<Identifier, Integer, RenderLayer> TINTED_LAYER = Util.memoize((texture, color) -> {
|
||||
return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, true, true, RenderLayer.MultiPhaseParameters.builder()
|
||||
|
@ -39,7 +46,7 @@ public abstract class MagicGlow extends RenderPhase {
|
|||
});
|
||||
|
||||
public static RenderLayer getRenderLayer() {
|
||||
return MAGIC;
|
||||
return MAGIC.get();
|
||||
}
|
||||
|
||||
public static RenderLayer getColoured(Identifier texture, int color) {
|
||||
|
|
Loading…
Reference in a new issue