End shader
This commit is contained in:
+2
-2
@@ -5,9 +5,9 @@ import java.util.Arrays;
|
|||||||
import org.saturnclient.client.player.SaturnPlayer;
|
import org.saturnclient.client.player.SaturnPlayer;
|
||||||
import org.saturnclient.config.Config;
|
import org.saturnclient.config.Config;
|
||||||
import org.saturnclient.cosmetics.Cloaks;
|
import org.saturnclient.cosmetics.Cloaks;
|
||||||
|
import org.saturnclient.impl.cosmetics.utils.ShaderUtils;
|
||||||
|
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.equipment.EquipmentModel;
|
import net.minecraft.client.render.entity.equipment.EquipmentModel;
|
||||||
@@ -297,7 +297,7 @@ public class CloakFeatureRenderer extends FeatureRenderer<PlayerEntityRenderStat
|
|||||||
light = (skyLight << 20) | (blockLight << 4);
|
light = (skyLight << 20) | (blockLight << 4);
|
||||||
|
|
||||||
VertexConsumer vertexConsumer = vertexConsumerProvider
|
VertexConsumer vertexConsumer = vertexConsumerProvider
|
||||||
.getBuffer(RenderLayer.getEntityAlpha(customCape));
|
.getBuffer(ShaderUtils.getRenderLayer(customCape));
|
||||||
|
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
||||||
|
|||||||
@@ -4,16 +4,18 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.saturnclient.impl.cosmetics.utils.ShaderUtils;
|
||||||
|
|
||||||
import de.javagl.obj.*;
|
import de.javagl.obj.*;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class ObjRenderer {
|
public class ObjRenderer {
|
||||||
|
|
||||||
public static Obj loadObj(Identifier objId) throws IOException {
|
public static Obj loadObj(Identifier objId) throws IOException {
|
||||||
try (InputStream is = MinecraftClient.getInstance().getResourceManager()
|
try (InputStream is = MinecraftClient.getInstance().getResourceManager()
|
||||||
.getResource(objId).get().getInputStream()) {
|
.getResource(objId).get().getInputStream()) {
|
||||||
@@ -39,8 +41,6 @@ public class ObjRenderer {
|
|||||||
if (mtl != null) {
|
if (mtl != null) {
|
||||||
String mapKd = mtl.getMapKd();
|
String mapKd = mtl.getMapKd();
|
||||||
if (mapKd != null) {
|
if (mapKd != null) {
|
||||||
// "#key" references are not resolvable at runtime without a texture map,
|
|
||||||
// so we only support direct resource location strings here
|
|
||||||
if (!mapKd.startsWith("#")) {
|
if (!mapKd.startsWith("#")) {
|
||||||
texture = Identifier.of(mapKd);
|
texture = Identifier.of(mapKd);
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ public class ObjRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexConsumer consumer = vertexConsumers.getBuffer(RenderLayer.getEntityAlpha(texture));
|
VertexConsumer consumer = vertexConsumers.getBuffer(ShaderUtils.getRenderLayer(texture));
|
||||||
|
|
||||||
int faces = groupObj.getNumFaces();
|
int faces = groupObj.getNumFaces();
|
||||||
final float fr = r, fg = g, fb = b;
|
final float fr = r, fg = g, fb = b;
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.saturnclient.impl.cosmetics.utils;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.render.RenderPhase;
|
||||||
|
import net.minecraft.client.render.VertexFormat.DrawMode;
|
||||||
|
import net.minecraft.client.render.VertexFormats;
|
||||||
|
import net.minecraft.client.render.RenderPhase.Textures;
|
||||||
|
import net.minecraft.client.render.block.entity.EndPortalBlockEntityRenderer;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class ShaderUtils {
|
||||||
|
public static final RenderLayer END_GATEWAY = RenderLayer.of(
|
||||||
|
"end_gateway_no_cull",
|
||||||
|
VertexFormats.POSITION,
|
||||||
|
DrawMode.QUADS,
|
||||||
|
1536,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
RenderLayer.MultiPhaseParameters.builder()
|
||||||
|
.program(RenderLayer.END_GATEWAY_PROGRAM)
|
||||||
|
.texture(Textures.create()
|
||||||
|
.add(EndPortalBlockEntityRenderer.SKY_TEXTURE, false, false)
|
||||||
|
.add(EndPortalBlockEntityRenderer.PORTAL_TEXTURE, false, false)
|
||||||
|
.build())
|
||||||
|
.cull(RenderPhase.DISABLE_CULLING)
|
||||||
|
.build(false));
|
||||||
|
|
||||||
|
public static RenderLayer getRenderLayer(Identifier texture) {
|
||||||
|
if (texture.getPath().endsWith("end.png")) {
|
||||||
|
return END_GATEWAY;
|
||||||
|
} else {
|
||||||
|
return RenderLayer.getEntityAlpha(texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user