From 8a7253b345d0aa07428f5057c2cb0d53ec42ee5e Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 7 Nov 2019 15:22:51 +0200 Subject: [PATCH] Simplify the horn glow renderer a bit --- .../client/model/components/UnicornHorn.java | 10 +++++-- .../client/util/render/GlowRenderer.java | 27 +------------------ .../client/util/render/HornGlow.java | 2 +- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java b/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java index 3b1bab53..08fbf12e 100644 --- a/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java +++ b/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java @@ -1,8 +1,10 @@ package com.minelittlepony.client.model.components; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.Model; +import com.minelittlepony.client.util.render.Color; import com.minelittlepony.client.util.render.GlowRenderer; import com.minelittlepony.client.util.render.PonyRenderer; import com.minelittlepony.model.ICapitated; @@ -37,7 +39,6 @@ public class UnicornHorn implements IPart { .pitch = 0.5F; glow.offset(HORN_X + x, HORN_Y + y, HORN_Z + z) - .setAlpha(0.4f) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .box(0, 0, 0, 1, 4, 1, stretch + 0.5F) .box(0, 0, 0, 1, 3, 1, stretch + 0.8F); @@ -58,8 +59,13 @@ public class UnicornHorn implements IPart { enableBlend(); blendFunc(GL_SRC_ALPHA, GL_ONE); + MinecraftClient.getInstance().gameRenderer.disableLightmap(); + Color.glColor(tint, 0.4F); + horn.applyTransform(scale); - glow.setTint(tint).render(scale); + glow.render(scale); + + MinecraftClient.getInstance().gameRenderer.enableLightmap(); enableTexture(); enableLighting(); diff --git a/src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java b/src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java index 66693d20..96fa7e6a 100644 --- a/src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java +++ b/src/main/java/com/minelittlepony/client/util/render/GlowRenderer.java @@ -1,40 +1,15 @@ package com.minelittlepony.client.util.render; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.model.Model; public class GlowRenderer extends AbstractRenderer { - - int tint; - float alpha = 1; - public GlowRenderer(Model model, int x, int y) { super(model, x, y); } - public GlowRenderer setAlpha(float alpha) { - this.alpha = alpha; - - return this; - } - - public GlowRenderer setTint(int tint) { - this.tint = tint; - - return this; - } - @Override public void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { - boxes.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor, alpha)); - } - - @Override - public void render(float scale) { - MinecraftClient.getInstance().gameRenderer.disableLightmap(); - Color.glColor(tint, alpha); - super.render(scale); - MinecraftClient.getInstance().gameRenderer.enableLightmap(); + boxes.add(new HornGlow(this, textureOffsetX, textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor)); } @Override diff --git a/src/main/java/com/minelittlepony/client/util/render/HornGlow.java b/src/main/java/com/minelittlepony/client/util/render/HornGlow.java index c74af468..ca37a303 100644 --- a/src/main/java/com/minelittlepony/client/util/render/HornGlow.java +++ b/src/main/java/com/minelittlepony/client/util/render/HornGlow.java @@ -9,7 +9,7 @@ public class HornGlow extends Box { private Quad[] polygons; - public HornGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale, float alpha) { + public HornGlow(GlowRenderer renderer, int texX, int texY, float xMin, float yMin, float zMin, int w, int h, int d, float scale) { super(renderer, texX, texY, xMin, yMin, zMin, w, h, d, scale); float xMax = xMin + w + scale;