Add Inner Alpha Handling

This commit is contained in:
Kam committed 2026-02-19 01:35:21 -05:00
1 parent e5fc58366b
commit e91fe89e6a
5 files changed
+54 -20

No files matched your search

@@ -74,18 +74,20 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
// Render tail orb at origin (0,0,0) - only in anchored mode
// Don't render if head is too close to origin (would cause overlap/extra orb appearance)
if (beam.shouldRenderTailOrb() && headDistFromOrigin > headSize * 0.5) {
renderTailOrb(headSize * 0.8f, innerColor, outerColor, beam.isOuterColorEnabled(), beam.getOuterColorWidth(), outerAlpha);
renderTailOrb(headSize * 0.8f, innerColor, outerColor, beam.isOuterColorEnabled(), beam.getOuterColorWidth(), outerAlpha, beam.getInnerAlpha());
}
float innerAlpha = beam.getInnerAlpha();
// Render trail segments with smooth connections (with fading for non-anchored)
if (beam.hasFadingTrail()) {
renderFadingTrail(beam, trail, beamWidth, innerColor, outerColor, beam.isOuterColorEnabled(), beam.getOuterColorWidth());
renderFadingTrail(beam, trail, beamWidth, innerColor, outerColor, beam.isOuterColorEnabled(), beam.getOuterColorWidth(), innerAlpha);
} else {
renderSmoothTrail(trail, beamWidth, innerColor, outerColor, beam.isOuterColorEnabled(), beam.getOuterColorWidth());
renderSmoothTrail(trail, beamWidth, innerColor, outerColor, beam.isOuterColorEnabled(), beam.getOuterColorWidth(), innerAlpha);
}
// Render head at interpolated offset position
renderHead(beam, headOffsetX, headOffsetY, headOffsetZ, headSize, innerColor, outerColor, outerAlpha, partialTicks);
renderHead(beam, headOffsetX, headOffsetY, headOffsetZ, headSize, innerColor, outerColor, outerAlpha, innerAlpha, partialTicks);
GL11.glPopMatrix();
@@ -139,7 +141,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
// Render inner core
GL11.glScalef(innerScale, innerScale, innerScale);
renderCube(innerColor, 1.0f, 0.5f);
renderCube(innerColor, beam.getInnerAlpha(), 0.5f);
GL11.glPopMatrix();
GL11.glPopMatrix();
@@ -149,7 +151,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
* Render the tail orb at the origin (where the beam emanates from).
* This orb does not rotate - it's a stable anchor point.
*/
private void renderTailOrb(float size, int innerColor, int outerColor, boolean outerColorEnabled, float outerColorWidth, float outerAlpha) {
private void renderTailOrb(float size, int innerColor, int outerColor, boolean outerColorEnabled, float outerColorWidth, float outerAlpha, float innerAlpha) {
GL11.glPushMatrix();
// Already at origin (0,0,0)
@@ -171,7 +173,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
// Render inner core (solid)
GL11.glPushMatrix();
GL11.glScalef(size * innerScale, size * innerScale, size * innerScale);
renderCube(innerColor, 1.0f, 0.5f);
renderCube(innerColor, innerAlpha, 0.5f);
GL11.glPopMatrix();
GL11.glPopMatrix();
@@ -182,7 +184,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
* Uses averaged perpendicular vectors at connection points to prevent gaps.
*/
private void renderSmoothTrail(List<Vec3> trail, float width, int innerColor, int outerColor,
boolean outerColorEnabled, float outerColorWidth) {
boolean outerColorEnabled, float outerColorWidth, float innerAlpha) {
if (trail.size() < 2) return;
int trailSize = trail.size();
@@ -205,7 +207,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
}
// Render inner core trail
renderTrailTube(trail, perpFrames, innerWidth, innerColor, 0.9f, false);
renderTrailTube(trail, perpFrames, innerWidth, innerColor, innerAlpha, false);
}
/**
@@ -213,7 +215,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
* Older trail points fade out based on their age.
*/
private void renderFadingTrail(EntityAbilityBeam beam, List<Vec3> trail, float width, int innerColor, int outerColor,
boolean outerColorEnabled, float outerColorWidth) {
boolean outerColorEnabled, float outerColorWidth, float innerAlpha) {
if (trail.size() < 2) return;
List<Integer> ages = beam.getTrailPointAges();
@@ -235,7 +237,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
}
// Render inner core trail with fading
renderFadingTrailTube(trail, perpFrames, ages, fadeTime, innerWidth, innerColor, 0.9f);
renderFadingTrailTube(trail, perpFrames, ages, fadeTime, innerWidth, innerColor, innerAlpha);
}
/**
@@ -541,7 +543,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
* Coordinates are relative to origin.
*/
private void renderHead(EntityAbilityBeam beam, double x, double y, double z,
float size, int innerColor, int outerColor, float outerAlpha, float partialTicks) {
float size, int innerColor, int outerColor, float outerAlpha, float innerAlpha, float partialTicks) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
@@ -580,7 +582,7 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
// Render inner core
GL11.glScalef(innerScale, innerScale, innerScale);
renderCube(innerColor, 1.0f, 0.5f);
renderCube(innerColor, innerAlpha, 0.5f);
GL11.glPopMatrix();
GL11.glPopMatrix();
@@ -67,7 +67,7 @@ public class RenderAbilityDisc extends RenderEnergyAbility {
}
// Render inner square (solid)
renderFlatSquare(disc.getInnerColor(), 1.0f, radius * innerScale, thickness * 1.2f);
renderFlatSquare(disc.getInnerColor(), disc.getInnerAlpha(), radius * innerScale, thickness * 1.2f);
GL11.glPopMatrix();
GL11.glPopMatrix();
@@ -117,7 +117,7 @@ public class RenderAbilityLaser extends RenderEnergyAbility {
renderBeamRectangle(renderStartX, renderStartY, renderStartZ,
renderEndX, renderEndY, renderEndZ,
horzX, horzY, horzZ, vertX, vertY, vertZ,
innerWidth, laser.getInnerColor(), alpha);
innerWidth, laser.getInnerColor(), alpha * laser.getInnerAlpha());
// Render lightning along the laser beam
if (laser.hasLightningEffect() && laser.getCurrentLength() > 0.1f) {
@@ -53,8 +53,8 @@ public class RenderEnergySlicer extends RenderEnergyAbility {
GL11.glDepthMask(true);
}
// Render inner blade (solid core, alpha 1.0 like Orb pattern)
renderBlade(slicer.getInnerColor(), 1.0f,
// Render inner blade (solid core)
renderBlade(slicer.getInnerColor(), slicer.getInnerAlpha(),
width * 0.5f * innerScale, thickness, 0.03f);
GL11.glPopMatrix();
@@ -519,6 +519,30 @@ public abstract class AbilityZone extends Ability {
colorData.outerColorEnabled = enabled;
}
public float getInnerAlpha() {
return colorData.innerAlpha;
}
public void setInnerAlpha(float alpha) {
colorData.innerAlpha = alpha;
}
public float getOuterColorWidth() {
return colorData.outerColorWidth;
}
public void setOuterColorWidth(float width) {
colorData.outerColorWidth = width;
}
public float getOuterColorAlpha() {
return colorData.outerColorAlpha;
}
public void setOuterColorAlpha(float alpha) {
colorData.outerColorAlpha = alpha;
}
public boolean isGroundFill() {
return groundFill;
}
@@ -711,12 +735,20 @@ public abstract class AbilityZone extends Ability {
.tab("ability.tab.visual"),
FieldDef.section("ability.section.colors").tab("ability.tab.visual"),
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
.tab("ability.tab.visual"),
FieldDef.row(
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor),
FieldDef.floatField("ability.innerAlpha", this::getInnerAlpha, this::setInnerAlpha).range(0, 1)
).tab("ability.tab.visual"),
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
.tab("ability.tab.visual"),
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled)
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
FieldDef.row(
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
.range(0, 1).visibleWhen(this::isOuterColorEnabled)
).tab("ability.tab.visual")
));
}