mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 06:18:00 +01:00
Simplify the horn glow renderer a bit
This commit is contained in:
parent
27ecb39202
commit
8a7253b345
3 changed files with 10 additions and 29 deletions
|
@ -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();
|
||||
|
|
|
@ -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<GlowRenderer> {
|
||||
|
||||
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
|
||||
|
|
|
@ -9,7 +9,7 @@ public class HornGlow extends Box<GlowRenderer> {
|
|||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue