Introduce RegisterShadersEvent to register shaders with the proper timing (runs every client resource reload).

Fix ShaderInstance to allow resourcelocations with namespaces as input.
Fix shader parsing to respect resource domains.
Fix ForgeRenderTypes to use the right shader in each situation.
Add custom forge shader for unlit translucent entity rendering, equivalent to the vanilla entity translucent shader.
This commit is contained in:
gigaherz committed 2021-07-30 01:48:20 +02:00
1 parent 7d4c238165
commit 80d08dbf3a
9 files changed
+273 -37

No files matched your search

@@ -9,6 +9,14 @@
}
}
@@ -541,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_172768_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_172733_) -> {
f_172607_ = p_172733_;
}));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_172768_, list1));
} catch (IOException ioexception) {
list1.forEach((p_172772_) -> {
p_172772_.getFirst().close();
@@ -703,7 +_,7 @@
d0 *= (double)Mth.m_14179_(this.f_109059_.f_91066_.f_92070_, 1.0F, 0.85714287F);
}
@@ -0,0 +1,31 @@
--- a/net/minecraft/client/renderer/ShaderInstance.java
+++ b/net/minecraft/client/renderer/ShaderInstance.java
@@ -91,10 +_,14 @@
@Nullable
public final Uniform f_173320_;
+ @Deprecated // FORGE: Use the ResourceLocation variant below
public ShaderInstance(ResourceProvider p_173336_, String p_173337_, VertexFormat p_173338_) throws IOException {
- this.f_173300_ = p_173337_;
+ this(p_173336_, new ResourceLocation(p_173337_), p_173338_);
+ }
+ public ShaderInstance(ResourceProvider p_173336_, ResourceLocation shaderLocation, VertexFormat p_173338_) throws IOException {
+ this.f_173300_ = shaderLocation.m_135827_().equals("minecraft") ? shaderLocation.m_135815_() : shaderLocation.toString();
this.f_173307_ = p_173338_;
- ResourceLocation resourcelocation = new ResourceLocation("shaders/core/" + p_173337_ + ".json");
+ ResourceLocation resourcelocation = new ResourceLocation(shaderLocation.m_135827_(), "shaders/core/" + shaderLocation.m_135815_() + ".json");
Resource resource = null;
try {
@@ -202,8 +_,9 @@
Program program1 = p_173342_.m_85570_().get(p_173343_);
Program program;
if (program1 == null) {
- String s = "shaders/core/" + p_173343_ + p_173342_.m_85569_();
- ResourceLocation resourcelocation = new ResourceLocation(s);
+ ResourceLocation loc = new ResourceLocation(p_173343_);
+ String s = "shaders/core/" + loc.m_135815_() + p_173342_.m_85569_();
+ ResourceLocation resourcelocation = new ResourceLocation(loc.m_135827_(), s);
Resource resource = p_173341_.m_142591_(resourcelocation);
final String s1 = FileUtil.m_179922_(s);
@@ -21,8 +21,7 @@ package net.minecraftforge.client;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.*;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
@@ -52,8 +51,6 @@ import net.minecraft.client.resources.model.Material;
import net.minecraft.client.renderer.texture.TextureAtlas;
import com.mojang.blaze3d.platform.NativeImage;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.vertex.VertexFormatElement;
import com.mojang.blaze3d.vertex.VertexFormatElement.Usage;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.client.KeyMapping;
@@ -87,6 +84,7 @@ import net.minecraft.world.level.GameType;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.levelgen.WorldGenSettings;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.client.model.ModelLoader;
@@ -96,8 +94,10 @@ import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.model.TransformationHelper;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoader;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fmlclient.registry.ClientRegistry;
import net.minecraftforge.fml.StartupMessageManager;
import net.minecraftforge.registries.ForgeRegistries;
@@ -113,6 +113,7 @@ import org.lwjgl.opengl.GL13;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.Buffer;
import java.nio.ByteBuffer;
@@ -859,4 +860,23 @@ public class ForgeHooksClient
layerDefinitions.forEach((k, v) -> builder.put(k, v.get()));
}
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid="forge", bus= Mod.EventBusSubscriber.Bus.MOD)
public static class ClientEvents
{
@Nullable
private static ShaderInstance rendertypeEntityTranslucentUnlitShader;
public static ShaderInstance getEntityTranslucentUnlitShader()
{
return Objects.requireNonNull(rendertypeEntityTranslucentUnlitShader, "Attempted to call getEntityTranslucentUnlitShader before shaders have finished loading.");
}
@SubscribeEvent
public static void registerShaders(RegisterShadersEvent event) throws IOException
{
event.registerShader(new ShaderInstance(event.getResourceManager(), new ResourceLocation("forge","rendertype_entity_unlit_translucent"), DefaultVertexFormat.NEW_ENTITY), (p_172645_) -> {
rendertypeEntityTranslucentUnlitShader = p_172645_;
});
}
}
}
@@ -20,18 +20,31 @@
package net.minecraftforge.client;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.datafixers.util.Pair;
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderStateShard;
import net.minecraft.client.renderer.RenderStateShard.TextureStateShard;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.client.renderer.texture.TextureAtlas;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraftforge.client.event.RegisterShadersEvent;
import net.minecraftforge.common.util.NonNullLazy;
import net.minecraftforge.common.util.NonNullSupplier;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@SuppressWarnings("deprecation")
@@ -52,7 +65,7 @@ public enum ForgeRenderTypes
*/
public static RenderType getItemLayeredSolid(ResourceLocation textureLocation)
{
return Internal.layeredItemSolid(textureLocation);
return Internal.LAYERED_ITEM_SOLID.apply(textureLocation);
}
/**
@@ -60,7 +73,7 @@ public enum ForgeRenderTypes
*/
public static RenderType getItemLayeredCutout(ResourceLocation textureLocation)
{
return Internal.layeredItemCutout(textureLocation);
return Internal.LAYERED_ITEM_CUTOUT.apply(textureLocation);
}
/**
@@ -68,7 +81,7 @@ public enum ForgeRenderTypes
*/
public static RenderType getItemLayeredCutoutMipped(ResourceLocation textureLocation)
{
return Internal.layeredItemCutoutMipped(textureLocation);
return Internal.LAYERED_ITEM_CUTOUT_MIPPED.apply(textureLocation);
}
/**
@@ -76,7 +89,7 @@ public enum ForgeRenderTypes
*/
public static RenderType getItemLayeredTranslucent(ResourceLocation textureLocation)
{
return Internal.layeredItemTranslucent(textureLocation);
return Internal.LAYERED_ITEM_TRANSLUCENT.apply(textureLocation);
}
/**
@@ -84,7 +97,7 @@ public enum ForgeRenderTypes
*/
public static RenderType getUnsortedTranslucent(ResourceLocation textureLocation)
{
return Internal.unsortedTranslucent(textureLocation);
return Internal.UNSORTED_TRANSLUCENT.apply(textureLocation);
}
/**
@@ -93,7 +106,7 @@ public enum ForgeRenderTypes
*/
public static RenderType getUnlitTranslucent(ResourceLocation textureLocation)
{
return getUnlitTranslucent(textureLocation, true);
return Internal.UNLIT_TRANSLUCENT_SORTED.apply(textureLocation);
}
/**
@@ -103,31 +116,31 @@ public enum ForgeRenderTypes
*/
public static RenderType getUnlitTranslucent(ResourceLocation textureLocation, boolean sortingEnabled)
{
return Internal.unlitTranslucent(textureLocation, sortingEnabled);
return (sortingEnabled ? Internal.UNLIT_TRANSLUCENT_SORTED : Internal.UNLIT_TRANSLUCENT_UNSORTED).apply(textureLocation);
}
/**
* @return Same as {@link RenderType#getEntityCutout(ResourceLocation)}, but with mipmapping enabled.
* @return Same as {@link RenderType#entityCutout(ResourceLocation)}, but with mipmapping enabled.
*/
public static RenderType getEntityCutoutMipped(ResourceLocation textureLocation)
{
return Internal.layeredItemCutoutMipped(textureLocation);
return Internal.LAYERED_ITEM_CUTOUT_MIPPED.apply(textureLocation);
}
/**
* @return Replacement of {@link RenderType#getText(ResourceLocation)}, but with optional linear texture filtering.
* @return Replacement of {@link RenderType#text(ResourceLocation)}, but with optional linear texture filtering.
*/
public static RenderType getText(ResourceLocation locationIn)
{
return Internal.getText(locationIn);
return Internal.TEXT.apply(locationIn);
}
/**
* @return Replacement of {@link RenderType#getTextSeeThrough(ResourceLocation)}, but with optional linear texture filtering.
* @return Replacement of {@link RenderType#textSeeThrough(ResourceLocation)}, but with optional linear texture filtering.
*/
public static RenderType getTextSeeThrough(ResourceLocation locationIn)
{
return Internal.getTextSeeThrough(locationIn);
return Internal.TEXT_SEETHROUGH.apply(locationIn);
}
// ----------------------------------------
@@ -147,22 +160,25 @@ public enum ForgeRenderTypes
return renderTypeSupplier.get();
}
private static class Internal extends RenderType
{
private static final ShaderStateShard RENDERTYPE_ENTITY_TRANSLUCENT_UNLIT_SHADER = new ShaderStateShard(ForgeHooksClient.ClientEvents::getEntityTranslucentUnlitShader);
private Internal(String name, VertexFormat fmt, VertexFormat.Mode glMode, int size, boolean doCrumbling, boolean depthSorting, Runnable onEnable, Runnable onDisable)
{
super(name, fmt, glMode, size, doCrumbling, depthSorting, onEnable, onDisable);
throw new IllegalStateException("This class must not be instantiated");
}
public static RenderType unsortedTranslucent(ResourceLocation textureLocation)
public static Function<ResourceLocation, RenderType> UNSORTED_TRANSLUCENT = Util.memoize(Internal::unsortedTranslucent);
private static RenderType unsortedTranslucent(ResourceLocation textureLocation)
{
final boolean sortingEnabled = false;
CompositeState renderState = CompositeState.builder()
.setShaderState(RenderType.RENDERTYPE_ENTITY_TRANSLUCENT_SHADER)
.setTextureState(new TextureStateShard(textureLocation, false, false))
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
// .setDiffuseLightingState(DIFFUSE_LIGHTING) //TODO
// .setAlphaState(DEFAULT_ALPHA) //TODO
.setCullState(NO_CULL)
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
@@ -170,12 +186,26 @@ public enum ForgeRenderTypes
return create("forge_entity_unsorted_translucent", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, sortingEnabled, renderState);
}
public static RenderType unlitTranslucent(ResourceLocation textureLocation, boolean sortingEnabled)
private static final BiFunction<ResourceLocation, Boolean, RenderType> ENTITY_TRANSLUCENT = Util.memoize((p_173227_, p_173228_) -> {
RenderType.CompositeState rendertype$compositestate = RenderType.CompositeState.builder()
.setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_SHADER)
.setTextureState(new RenderStateShard.TextureStateShard(p_173227_, false, false))
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setCullState(NO_CULL)
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
.createCompositeState(p_173228_);
return create("entity_translucent", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, rendertype$compositestate);
});
public static Function<ResourceLocation, RenderType> UNLIT_TRANSLUCENT_SORTED = Util.memoize(tex -> Internal.unlitTranslucent(tex, true));
public static Function<ResourceLocation, RenderType> UNLIT_TRANSLUCENT_UNSORTED = Util.memoize(tex -> Internal.unlitTranslucent(tex, false));
private static RenderType unlitTranslucent(ResourceLocation textureLocation, boolean sortingEnabled)
{
CompositeState renderState = CompositeState.builder()
.setShaderState(RENDERTYPE_ENTITY_TRANSLUCENT_UNLIT_SHADER)
.setTextureState(new TextureStateShard(textureLocation, false, false))
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
// .setAlphaState(DEFAULT_ALPHA) //TODO
.setCullState(NO_CULL)
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
@@ -183,67 +213,70 @@ public enum ForgeRenderTypes
return create("forge_entity_unlit_translucent", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, sortingEnabled, renderState);
}
public static RenderType layeredItemSolid(ResourceLocation locationIn) {
public static Function<ResourceLocation, RenderType> LAYERED_ITEM_SOLID = Util.memoize(Internal::layeredItemSolid);
private static RenderType layeredItemSolid(ResourceLocation locationIn) {
RenderType.CompositeState rendertype$state = RenderType.CompositeState.builder()
.setShaderState(RenderType.RENDERTYPE_ENTITY_SOLID_SHADER)
.setTextureState(new RenderStateShard.TextureStateShard(locationIn, false, false))
.setTransparencyState(NO_TRANSPARENCY)
// .setDiffuseLightingState(DIFFUSE_LIGHTING) //TODO
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
.createCompositeState(true);
return create("forge_item_entity_solid", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, false, rendertype$state);
}
public static RenderType layeredItemCutout(ResourceLocation locationIn) {
public static Function<ResourceLocation, RenderType> LAYERED_ITEM_CUTOUT = Util.memoize(Internal::layeredItemCutout);
private static RenderType layeredItemCutout(ResourceLocation locationIn) {
RenderType.CompositeState rendertype$state = RenderType.CompositeState.builder()
.setShaderState(RenderType.RENDERTYPE_ENTITY_CUTOUT_SHADER)
.setTextureState(new RenderStateShard.TextureStateShard(locationIn, false, false))
.setTransparencyState(NO_TRANSPARENCY)
// .setDiffuseLightingState(DIFFUSE_LIGHTING) //TODO
// .setAlphaState(DEFAULT_ALPHA) //TODO
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
.createCompositeState(true);
return create("forge_item_entity_cutout", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, false, rendertype$state);
}
public static RenderType layeredItemCutoutMipped(ResourceLocation locationIn) {
public static Function<ResourceLocation, RenderType> LAYERED_ITEM_CUTOUT_MIPPED = Util.memoize(Internal::layeredItemCutoutMipped);
private static RenderType layeredItemCutoutMipped(ResourceLocation locationIn) {
RenderType.CompositeState rendertype$state = RenderType.CompositeState.builder()
.setShaderState(RenderType.RENDERTYPE_ENTITY_SMOOTH_CUTOUT_SHADER)
.setTextureState(new RenderStateShard.TextureStateShard(locationIn, false, true))
.setTransparencyState(NO_TRANSPARENCY)
// .setDiffuseLightingState(DIFFUSE_LIGHTING) //TODO
// .setAlphaState(DEFAULT_ALPHA) //TODO
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
.createCompositeState(true);
return create("forge_item_entity_cutout_mipped", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, false, rendertype$state);
}
public static RenderType layeredItemTranslucent(ResourceLocation locationIn) {
public static Function<ResourceLocation, RenderType> LAYERED_ITEM_TRANSLUCENT = Util.memoize(Internal::layeredItemTranslucent);
private static RenderType layeredItemTranslucent(ResourceLocation locationIn) {
RenderType.CompositeState rendertype$state = RenderType.CompositeState.builder()
.setShaderState(RenderType.RENDERTYPE_ENTITY_TRANSLUCENT_SHADER)
.setTextureState(new RenderStateShard.TextureStateShard(locationIn, false, false))
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
// .setDiffuseLightingState(DIFFUSE_LIGHTING) //TODO
// .setAlphaState(DEFAULT_ALPHA) //TODO
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
.createCompositeState(true);
return create("forge_item_entity_translucent_cull", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, true, rendertype$state);
}
public static RenderType getText(ResourceLocation locationIn) {
public static Function<ResourceLocation, RenderType> TEXT = Util.memoize(Internal::getText);
private static RenderType getText(ResourceLocation locationIn) {
RenderType.CompositeState rendertype$state = RenderType.CompositeState.builder()
.setShaderState(RENDERTYPE_TEXT_SHADER)
.setTextureState(new CustomizableTextureState(locationIn, () -> ForgeRenderTypes.enableTextTextureLinearFiltering, () -> false))
// .setAlphaState(DEFAULT_ALPHA) //TODO
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setLightmapState(LIGHTMAP)
.createCompositeState(false);
return create("forge_text", DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP, VertexFormat.Mode.QUADS, 256, false, true, rendertype$state);
}
public static RenderType getTextSeeThrough(ResourceLocation locationIn) {
public static Function<ResourceLocation, RenderType> TEXT_SEETHROUGH = Util.memoize(Internal::getTextSeeThrough);
private static RenderType getTextSeeThrough(ResourceLocation locationIn) {
RenderType.CompositeState rendertype$state = RenderType.CompositeState.builder()
.setShaderState(RENDERTYPE_TEXT_SHADER)
.setTextureState(new CustomizableTextureState(locationIn, () -> ForgeRenderTypes.enableTextTextureLinearFiltering, () -> false))
// .setAlphaState(DEFAULT_ALPHA) //TODO
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setLightmapState(LIGHTMAP)
.setDepthTestState(NO_DEPTH_TEST)
@@ -0,0 +1,51 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.event;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.IModBusEvent;
import java.util.List;
import java.util.function.Consumer;
public class RegisterShadersEvent extends Event implements IModBusEvent
{
private final ResourceManager resourceManager;
private final List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList;
public RegisterShadersEvent(ResourceManager resourceManager, List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList)
{
this.resourceManager = resourceManager;
this.shaderList = shaderList;
}
public ResourceManager getResourceManager()
{
return resourceManager;
}
public void registerShader(ShaderInstance shaderInstance, Consumer<ShaderInstance> onLoaded)
{
shaderList.add(Pair.of(shaderInstance, onLoaded));
}
}
@@ -0,0 +1,30 @@
#version 150
#moj_import <fog.glsl>
uniform sampler2D Sampler0;
uniform vec4 ColorModulator;
uniform float FogStart;
uniform float FogEnd;
uniform vec4 FogColor;
in float vertexDistance;
in vec4 vertexColor;
in vec4 lightMapColor;
in vec4 overlayColor;
in vec2 texCoord0;
in vec4 normal;
out vec4 fragColor;
void main() {
vec4 color = texture(Sampler0, texCoord0);
if (color.a < 0.1) {
discard;
}
color *= vertexColor * ColorModulator;
color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
color *= lightMapColor;
fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
}
@@ -0,0 +1,30 @@
{
"blend": {
"func": "add",
"srcrgb": "srcalpha",
"dstrgb": "1-srcalpha"
},
"vertex": "forge:rendertype_entity_unlit_translucent",
"fragment": "forge:rendertype_entity_unlit_translucent",
"attributes": [
"Position",
"Color",
"UV0",
"UV1",
"UV2",
"Normal"
],
"samplers": [
{ "name": "Sampler0" },
{ "name": "Sampler1" },
{ "name": "Sampler2" }
],
"uniforms": [
{ "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
]
}
@@ -0,0 +1,32 @@
#version 150
in vec3 Position;
in vec4 Color;
in vec2 UV0;
in ivec2 UV1;
in ivec2 UV2;
in vec3 Normal;
uniform sampler2D Sampler1;
uniform sampler2D Sampler2;
uniform mat4 ModelViewMat;
uniform mat4 ProjMat;
out float vertexDistance;
out vec4 vertexColor;
out vec4 lightMapColor;
out vec4 overlayColor;
out vec2 texCoord0;
out vec4 normal;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
vertexDistance = length((ModelViewMat * vec4(Position, 1.0)).xyz);
vertexColor = Color;
lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
overlayColor = texelFetch(Sampler1, UV1, 0);
texCoord0 = UV0;
normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
}
+1
View File
@@ -2,6 +2,7 @@ net/minecraft/client/gui/screens/MenuScreens.getScreenFactory(Lnet/minecraft/wor
net/minecraft/client/gui/screens/Screen.renderToolTip(Lcom/mojang/blaze3d/vertex/PoseStack;Ljava/util/List;IILnet/minecraft/client/gui/Font;)V=|p_96618_,p_96619_,p_96620_,p_96621_,font
net/minecraft/client/renderer/FogRenderer.setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V=|p_109025_,p_109026_,p_109027_,p_109028_,partialTicks
net/minecraft/client/renderer/ScreenEffectRenderer.getOverlayBlock(Lnet/minecraft/world/entity/player/Player;)Lorg/apache/commons/lang3/tuple/Pair;=|p_110717_
net/minecraft/client/renderer/ShaderInstance.<init>(Lnet/minecraft/server/packs/resources/ResourceProvider;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/blaze3d/vertex/VertexFormat;)V=|p_173336_,shaderLocation,p_173338_
net/minecraft/client/renderer/block/BlockModelShaper.getTexture(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;=|p_110883_,level,pos
net/minecraft/client/renderer/block/model/BlockModel.bakeVanilla(Lnet/minecraft/client/resources/model/ModelBakery;Lnet/minecraft/client/renderer/block/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;Z)Lnet/minecraft/client/resources/model/BakedModel;=|p_111450_,p_111451_,p_111452_,p_111453_,p_111454_,p_111455_
net/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk$ChunkCompileTask.<init>(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;Lnet/minecraft/world/level/ChunkPos;D)V=|p_112851_,pos,p_112852_