Skip to content

Commit

Permalink
Check if current element is Normal before doing any injections + rename
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed May 23, 2022
1 parent a4905a4 commit dc9f29c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.coderbot.iris.vertices.ExtendingBufferBuilder;
import net.coderbot.iris.vertices.IrisVertexFormats;
import net.coderbot.iris.vertices.NormalHelper;
import net.minecraft.client.renderer.texture.OverlayTexture;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -42,7 +41,7 @@ public abstract class MixinBufferBuilder implements BufferVertexConsumer, BlockS
private final Vector3f normal = new Vector3f();

@Unique
private boolean injectOverlayAndNormal;
private boolean injectNormal;

@Unique
private short currentBlock;
Expand Down Expand Up @@ -95,7 +94,7 @@ public abstract class MixinBufferBuilder implements BufferVertexConsumer, BlockS
vertexCount = 0;

if (extending) {
injectOverlayAndNormal = format == DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP;
injectNormal = format == DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP;
}
}

Expand Down Expand Up @@ -131,7 +130,7 @@ public abstract class MixinBufferBuilder implements BufferVertexConsumer, BlockS
return;
}

if (injectOverlayAndNormal) {
if (injectNormal && currentElement.getUsage() == VertexFormatElement.Usage.NORMAL) {
this.putInt(0, 0);
this.nextElement();
}
Expand Down

0 comments on commit dc9f29c

Please sign in to comment.