Use different naming for fullbright, and always reset it back after setting it.

This commit is contained in:
Sebastian Hartte
2020-08-16 14:05:10 +02:00
parent 73735c5cd5
commit ee67c5ea50
8 changed files with 45 additions and 21 deletions
@@ -79,10 +79,10 @@ class PaintSplotchesBakedModel implements IDynamicBakedModel {
if (s.isLumen()) { if (s.isLumen()) {
builder.setColorRGB(s.getColor().whiteVariant); builder.setColorRGB(s.getColor().whiteVariant);
builder.setRenderFullBright(true); builder.setEmissiveMaterial(true);
} else { } else {
builder.setColorRGB(s.getColor().mediumVariant); builder.setColorRGB(s.getColor().mediumVariant);
builder.setRenderFullBright(false); builder.setEmissiveMaterial(false);
} }
float offset = offsetConstant; float offset = offsetConstant;
@@ -117,7 +117,7 @@ class QnbFormedBakedModel implements IDynamicBakedModel {
if (formedState.isPowered()) { if (formedState.isPowered()) {
builder.setTexture(this.lightCornerTexture); builder.setTexture(this.lightCornerTexture);
builder.setRenderFullBright(true); builder.setEmissiveMaterial(true);
for (Direction facing : Direction.values()) { for (Direction facing : Direction.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn // Offset the face by a slight amount so that it is drawn over the already drawn
// ring texture // ring texture
@@ -131,6 +131,7 @@ class QnbFormedBakedModel implements IDynamicBakedModel {
DEFAULT_RENDER_MIN - zOffset, DEFAULT_RENDER_MAX + xOffset, DEFAULT_RENDER_MIN - zOffset, DEFAULT_RENDER_MAX + xOffset,
DEFAULT_RENDER_MAX + yOffset, DEFAULT_RENDER_MAX + zOffset); DEFAULT_RENDER_MAX + yOffset, DEFAULT_RENDER_MAX + zOffset);
} }
builder.setEmissiveMaterial(false);
} }
} else { } else {
builder.setTexture(this.ringTexture); builder.setTexture(this.ringTexture);
@@ -143,7 +144,7 @@ class QnbFormedBakedModel implements IDynamicBakedModel {
if (formedState.isPowered()) { if (formedState.isPowered()) {
builder.setTexture(this.lightTexture); builder.setTexture(this.lightTexture);
builder.setRenderFullBright(true); builder.setEmissiveMaterial(true);
for (Direction facing : Direction.values()) { for (Direction facing : Direction.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn // Offset the face by a slight amount so that it is drawn over the already drawn
// ring texture // ring texture
@@ -342,7 +342,7 @@ class CableBuilder {
this.addBigCoveredCableSizedCube(facing, cubeBuilder); this.addBigCoveredCableSizedCube(facing, cubeBuilder);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setEmissiveMaterial(true);
cubeBuilder.setTexture(oddChannel); cubeBuilder.setTexture(oddChannel);
cubeBuilder.setColorRGB(cableColor.blackVariant); cubeBuilder.setColorRGB(cableColor.blackVariant);
@@ -353,14 +353,14 @@ class CableBuilder {
this.addBigCoveredCableSizedCube(facing, cubeBuilder); this.addBigCoveredCableSizedCube(facing, cubeBuilder);
// Reset back to normal rendering for the rest // Reset back to normal rendering for the rest
cubeBuilder.setRenderFullBright(false); cubeBuilder.setEmissiveMaterial(false);
cubeBuilder.setTexture(texture); cubeBuilder.setTexture(texture);
} }
addCoveredCableSizedCube(facing, cubeBuilder); addCoveredCableSizedCube(facing, cubeBuilder);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setEmissiveMaterial(true);
cubeBuilder.setTexture(oddChannel); cubeBuilder.setTexture(oddChannel);
cubeBuilder.setColorRGB(cableColor.blackVariant); cubeBuilder.setColorRGB(cableColor.blackVariant);
@@ -369,6 +369,9 @@ class CableBuilder {
cubeBuilder.setTexture(evenChannel); cubeBuilder.setTexture(evenChannel);
cubeBuilder.setColorRGB(cableColor.whiteVariant); cubeBuilder.setColorRGB(cableColor.whiteVariant);
addCoveredCableSizedCube(facing, cubeBuilder); addCoveredCableSizedCube(facing, cubeBuilder);
// Reset back to default
cubeBuilder.setEmissiveMaterial(false);
} }
public void addStraightSmartConnection(Direction facing, AEColor cableColor, int channels, public void addStraightSmartConnection(Direction facing, AEColor cableColor, int channels,
@@ -386,7 +389,7 @@ class CableBuilder {
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels); TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setEmissiveMaterial(true);
cubeBuilder.setTexture(oddChannel); cubeBuilder.setTexture(oddChannel);
cubeBuilder.setColorRGB(cableColor.blackVariant); cubeBuilder.setColorRGB(cableColor.blackVariant);
@@ -395,6 +398,9 @@ class CableBuilder {
cubeBuilder.setTexture(evenChannel); cubeBuilder.setTexture(evenChannel);
cubeBuilder.setColorRGB(cableColor.whiteVariant); cubeBuilder.setColorRGB(cableColor.whiteVariant);
addStraightCoveredCableSizedCube(facing, cubeBuilder); addStraightCoveredCableSizedCube(facing, cubeBuilder);
// Reset back to default
cubeBuilder.setEmissiveMaterial(false);
} }
public void addConstrainedSmartConnection(Direction facing, AEColor cableColor, int distanceFromEdge, int channels, public void addConstrainedSmartConnection(Direction facing, AEColor cableColor, int distanceFromEdge, int channels,
@@ -417,7 +423,7 @@ class CableBuilder {
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels); TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setEmissiveMaterial(true);
cubeBuilder.setTexture(oddChannel); cubeBuilder.setTexture(oddChannel);
cubeBuilder.setColorRGB(cableColor.blackVariant); cubeBuilder.setColorRGB(cableColor.blackVariant);
@@ -426,6 +432,9 @@ class CableBuilder {
cubeBuilder.setTexture(evenChannel); cubeBuilder.setTexture(evenChannel);
cubeBuilder.setColorRGB(cableColor.whiteVariant); cubeBuilder.setColorRGB(cableColor.whiteVariant);
addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder); addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder);
// Reset back to default
cubeBuilder.setEmissiveMaterial(false);
} }
public void addDenseCoveredConnection(Direction facing, AEColor cableColor, AECableType connectionType, public void addDenseCoveredConnection(Direction facing, AEColor cableColor, AECableType connectionType,
@@ -449,7 +458,7 @@ class CableBuilder {
addDenseCableSizedCube(facing, cubeBuilder); addDenseCableSizedCube(facing, cubeBuilder);
// Reset back to normal rendering for the rest // Reset back to normal rendering for the rest
cubeBuilder.setRenderFullBright(false); cubeBuilder.setEmissiveMaterial(false);
cubeBuilder.setTexture(texture); cubeBuilder.setTexture(texture);
} }
@@ -485,7 +494,7 @@ class CableBuilder {
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels); TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setEmissiveMaterial(true);
cubeBuilder.setTexture(oddChannel); cubeBuilder.setTexture(oddChannel);
cubeBuilder.setColorRGB(cableColor.blackVariant); cubeBuilder.setColorRGB(cableColor.blackVariant);
@@ -496,7 +505,7 @@ class CableBuilder {
addDenseCableSizedCube(facing, cubeBuilder); addDenseCableSizedCube(facing, cubeBuilder);
// Reset back to normal rendering for the rest // Reset back to normal rendering for the rest
cubeBuilder.setRenderFullBright(false); cubeBuilder.setEmissiveMaterial(false);
cubeBuilder.setTexture(texture); cubeBuilder.setTexture(texture);
} }
@@ -529,7 +538,7 @@ class CableBuilder {
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels); TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setEmissiveMaterial(true);
cubeBuilder.setTexture(oddChannel); cubeBuilder.setTexture(oddChannel);
cubeBuilder.setColorRGB(cableColor.blackVariant); cubeBuilder.setColorRGB(cableColor.blackVariant);
@@ -538,6 +547,9 @@ class CableBuilder {
cubeBuilder.setTexture(evenChannel); cubeBuilder.setTexture(evenChannel);
cubeBuilder.setColorRGB(cableColor.whiteVariant); cubeBuilder.setColorRGB(cableColor.whiteVariant);
addStraightDenseCableSizedCube(facing, cubeBuilder); addStraightDenseCableSizedCube(facing, cubeBuilder);
// Reset back to default
cubeBuilder.setEmissiveMaterial(false);
} }
private static void addDenseCableSizedCube(Direction facing, CubeBuilder cubeBuilder) { private static void addDenseCableSizedCube(Direction facing, CubeBuilder cubeBuilder) {
@@ -52,7 +52,7 @@ public class CubeBuilder {
private boolean useStandardUV = false; private boolean useStandardUV = false;
private boolean renderFullBright; private boolean emissiveMaterial;
public CubeBuilder(List<BakedQuad> output) { public CubeBuilder(List<BakedQuad> output) {
this.output = output; this.output = output;
@@ -379,7 +379,7 @@ public class CubeBuilder {
if (e.getIndex() == 0) { if (e.getIndex() == 0) {
builder.put(i, u, v); builder.put(i, u, v);
break; break;
} else if (e.getIndex() == 2 && renderFullBright) { } else if (e.getIndex() == 2 && emissiveMaterial) {
// Force Brightness to 15, this is for full bright mode // Force Brightness to 15, this is for full bright mode
// this vertex element will only be present in that case // this vertex element will only be present in that case
final float lightMapU = (float) (15 * 0x20) / 0xFFFF; final float lightMapU = (float) (15 * 0x20) / 0xFFFF;
@@ -434,8 +434,8 @@ public class CubeBuilder {
this.setColorRGB((int) (r * 255) << 16 | (int) (g * 255) << 8 | (int) (b * 255)); this.setColorRGB((int) (r * 255) << 16 | (int) (g * 255) << 8 | (int) (b * 255));
} }
public void setRenderFullBright(boolean renderFullBright) { public void setEmissiveMaterial(boolean renderFullBright) {
this.renderFullBright = renderFullBright; this.emissiveMaterial = renderFullBright;
} }
public void setCustomUv(Direction facing, float u1, float v1, float u2, float v2) { public void setCustomUv(Direction facing, float u1, float v1, float u2, float v2) {
@@ -49,7 +49,7 @@ public class P2PTunnelFrequencyBakedModel implements IDynamicBakedModel {
cb.setTexture(this.texture); cb.setTexture(this.texture);
cb.useStandardUV(); cb.useStandardUV();
cb.setRenderFullBright(active); cb.setEmissiveMaterial(active);
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
final int[] offs = QUAD_OFFSETS[i]; final int[] offs = QUAD_OFFSETS[i];
@@ -70,6 +70,10 @@ public class P2PTunnelFrequencyBakedModel implements IDynamicBakedModel {
} }
} }
// Reset back to default
cb.setEmissiveMaterial(false);
return cb.getOutput(); return cb.getOutput();
} }
@@ -51,8 +51,10 @@ class LightBakedModel extends CraftingCubeBakedModel {
builder.addCube(x1, y1, z1, x2, y2, z2); builder.addCube(x1, y1, z1, x2, y2, z2);
boolean powered = state.get(AbstractCraftingUnitBlock.POWERED); boolean powered = state.get(AbstractCraftingUnitBlock.POWERED);
builder.setRenderFullBright(powered); builder.setEmissiveMaterial(powered);
builder.setTexture(this.lightTexture); builder.setTexture(this.lightTexture);
builder.addCube(x1, y1, z1, x2, y2, z2); builder.addCube(x1, y1, z1, x2, y2, z2);
// Reset back to default
builder.setEmissiveMaterial(false);
} }
} }
@@ -78,7 +78,7 @@ public class MonitorBakedModel extends CraftingCubeBakedModel {
AEColor color = getColor(modelData); AEColor color = getColor(modelData);
boolean powered = state.get(CraftingMonitorBlock.POWERED); boolean powered = state.get(CraftingMonitorBlock.POWERED);
builder.setRenderFullBright(powered); builder.setEmissiveMaterial(powered);
builder.setColorRGB(color.whiteVariant); builder.setColorRGB(color.whiteVariant);
builder.setTexture(this.lightBrightTexture); builder.setTexture(this.lightBrightTexture);
@@ -92,6 +92,8 @@ public class MonitorBakedModel extends CraftingCubeBakedModel {
builder.setTexture(this.lightDarkTexture); builder.setTexture(this.lightDarkTexture);
builder.addCube(x1, y1, z1, x2, y2, z2); builder.addCube(x1, y1, z1, x2, y2, z2);
// Reset back to default
builder.setEmissiveMaterial(false);
} }
private static AEColor getColor(IModelData modelData) { private static AEColor getColor(IModelData modelData) {
@@ -117,7 +117,7 @@ class SpatialPylonBakedModel implements IDynamicBakedModel {
if ((flags if ((flags
& SpatialPylonTileEntity.DISPLAY_POWERED_ENABLED) == SpatialPylonTileEntity.DISPLAY_POWERED_ENABLED) { & SpatialPylonTileEntity.DISPLAY_POWERED_ENABLED) == SpatialPylonTileEntity.DISPLAY_POWERED_ENABLED) {
builder.setRenderFullBright(true); builder.setEmissiveMaterial(true);
} }
builder.setTextures(this.textures.get(getTextureTypeFromSideInside(flags, ori, Direction.UP)), builder.setTextures(this.textures.get(getTextureTypeFromSideInside(flags, ori, Direction.UP)),
@@ -135,6 +135,9 @@ class SpatialPylonBakedModel implements IDynamicBakedModel {
builder.addCube(0, 0, 0, 16, 16, 16); builder.addCube(0, 0, 0, 16, 16, 16);
} }
// Reset back to default
builder.setEmissiveMaterial(false);
return builder.getOutput(); return builder.getOutput();
} }