Skip to content

Commit

Permalink
Fix shadow frustum issues, rename some unnamed instances
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Sep 11, 2021
1 parent 2f0eb06 commit 823937f
Show file tree
Hide file tree
Showing 26 changed files with 66 additions and 528 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@

import java.util.Collections;

public class EntityColorVertexConsumerProvider extends MultiBufferSource.BufferSource implements Groupable {
public class EntityColorMultiBufferSource extends MultiBufferSource.BufferSource implements Groupable {
private final MultiBufferSource wrapped;
private final MultiBufferSource.BufferSource wrappedImmediate;
private final MultiBufferSource.BufferSource wrappedBufferSource;
private final Groupable groupable;
private final EntityColorRenderStateShard phase;

public EntityColorVertexConsumerProvider(MultiBufferSource wrapped, EntityColorRenderStateShard phase) {
public EntityColorMultiBufferSource(MultiBufferSource wrapped, EntityColorRenderStateShard phase) {
super(new BufferBuilder(0), Collections.emptyMap());

this.wrapped = wrapped;

if (wrapped instanceof BufferSource) {
this.wrappedImmediate = (BufferSource) wrapped;
this.wrappedBufferSource = (BufferSource) wrapped;
} else {
this.wrappedImmediate = null;
this.wrappedBufferSource = null;
}

if (wrapped instanceof Groupable) {
Expand All @@ -35,21 +35,21 @@ public EntityColorVertexConsumerProvider(MultiBufferSource wrapped, EntityColorR
}

@Override
public VertexConsumer getBuffer(RenderType renderLayer) {
return wrapped.getBuffer(new InnerWrappedRenderLayer("iris_entity_color", renderLayer, phase));
public VertexConsumer getBuffer(RenderType renderType) {
return wrapped.getBuffer(new InnerWrappedRenderType("iris_entity_color", renderType, phase));
}

@Override
public void endBatch() {
if (wrappedImmediate != null) {
wrappedImmediate.endBatch();
if (wrappedBufferSource != null) {
wrappedBufferSource.endBatch();
}
}

@Override
public void endBatch(RenderType layer) {
if (wrappedImmediate != null) {
wrappedImmediate.endBatch(layer);
public void endBatch(RenderType type) {
if (wrappedBufferSource != null) {
wrappedBufferSource.endBatch(type);
}
}

Expand Down
84 changes: 0 additions & 84 deletions src/main/java/net/coderbot/iris/layer/InnerWrappedRenderLayer.java

This file was deleted.

83 changes: 0 additions & 83 deletions src/main/java/net/coderbot/iris/layer/IrisRenderLayerWrapper.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import org.jetbrains.annotations.Nullable;

public class IrisRenderTypeWrapper extends RenderType implements WrappableRenderType {
private final UseProgramRenderState useProgram;
private final UseProgramRenderStateShard useProgram;
private final RenderType wrapped;

public IrisRenderTypeWrapper(String name, RenderType wrapped, UseProgramRenderState useProgram) {
public IrisRenderTypeWrapper(String name, RenderType wrapped, UseProgramRenderStateShard useProgram) {
super(name, wrapped.format(), wrapped.mode(), wrapped.bufferSize(),
wrapped.affectsCrumbling(), isTranslucent(wrapped), wrapped::setupRenderState, wrapped::clearRenderState);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.coderbot.iris.layer;

import net.minecraft.client.renderer.RenderStateShard;

public class IsBlockEntityRenderStateShard extends RenderStateShard {
public static final IsBlockEntityRenderStateShard INSTANCE = new IsBlockEntityRenderStateShard();

private IsBlockEntityRenderStateShard() {
super("iris:is_block_entity", GbufferPrograms::beginBlockEntities, GbufferPrograms::endBlockEntities);
}
}
11 changes: 0 additions & 11 deletions src/main/java/net/coderbot/iris/layer/IsEntityRenderState.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.coderbot.iris.layer;

import net.minecraft.client.renderer.RenderStateShard;

public class IsEntityRenderStateShard extends RenderStateShard {
public static final IsEntityRenderStateShard INSTANCE = new IsEntityRenderStateShard();

private IsEntityRenderStateShard() {
super("iris:is_entity", GbufferPrograms::beginEntities, GbufferPrograms::endEntities);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public String toString() {
return "iris_wrapped:" + this.wrapped.toString();
}

private static boolean isTranslucent(RenderType layer) {
return ((RenderTypeAccessor) layer).isTranslucent();
private static boolean isTranslucent(RenderType type) {
return ((RenderTypeAccessor) type).isTranslucent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import java.util.Objects;
import net.minecraft.client.renderer.RenderStateShard;

public class UseProgramRenderState extends RenderStateShard {
public class UseProgramRenderStateShard extends RenderStateShard {
private GbufferProgram program;

public UseProgramRenderState(GbufferProgram program) {
public UseProgramRenderStateShard(GbufferProgram program) {
super("iris:use_program", () -> GbufferPrograms.push(program), () -> GbufferPrograms.pop(program));

this.program = program;
Expand All @@ -22,7 +22,7 @@ public boolean equals(Object object) {
return false;
}

UseProgramRenderState other = (UseProgramRenderState) object;
UseProgramRenderStateShard other = (UseProgramRenderStateShard) object;

return Objects.equals(this.program, other.program);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.spongepowered.asm.mixin.Shadow;

@Mixin(BlockBehaviour.BlockStateBase.class)
public abstract class MixinAbstractBlockState {
public abstract class MixinBlockStateBehavior {
@Shadow
public abstract Block getBlock();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.coderbot.batchedentityrendering.impl.Groupable;
import net.coderbot.iris.Iris;
import net.coderbot.iris.layer.EntityColorRenderStateShard;
import net.coderbot.iris.layer.EntityColorVertexConsumerProvider;
import net.coderbot.iris.layer.EntityColorMultiBufferSource;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.world.entity.LivingEntity;
Expand Down Expand Up @@ -35,7 +35,7 @@ public abstract class MixinLivingEntityRenderer {

if (hurt || whiteFlash > 0.0) {
EntityColorRenderStateShard phase = new EntityColorRenderStateShard(hurt, whiteFlash);
return new EntityColorVertexConsumerProvider(provider, phase);
return new EntityColorMultiBufferSource(provider, phase);
} else {
return provider;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MultiBufferSource.BufferSource.class)
public class MixinImmediateVertexConsumerProvider {
public class MixinMultiBufferSourceChild {
@Unique
private final Set<String> unwrapped = new ObjectOpenHashSet<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ private void ensureWrapped(RenderType base) {

@Unique
private RenderType iris$wrapWithIsEntity(RenderType base) {
return new OuterWrappedRenderType("iris:is_entity", base, IsEntityRenderState.INSTANCE);
return new OuterWrappedRenderType("iris:is_entity", base, IsEntityRenderStateShard.INSTANCE);
}

@Unique
private RenderType iris$wrapWithIsBlockEntity(RenderType base) {
return new OuterWrappedRenderType("iris:is_block_entity", base, IsBlockEntityRenderState.INSTANCE);
return new OuterWrappedRenderType("iris:is_block_entity", base, IsBlockEntityRenderStateShard.INSTANCE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.mojang.blaze3d.vertex.PoseStack;
import net.coderbot.batchedentityrendering.impl.Groupable;
import net.coderbot.iris.layer.EntityColorRenderStateShard;
import net.coderbot.iris.layer.EntityColorVertexConsumerProvider;
import net.coderbot.iris.layer.EntityColorMultiBufferSource;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
import net.minecraft.world.level.block.state.BlockState;
Expand All @@ -22,7 +22,7 @@ public abstract class MixinTntMinecartEntityRenderer {

if (drawFlash) {
EntityColorRenderStateShard phase = new EntityColorRenderStateShard(false, 1.0F);
return new EntityColorVertexConsumerProvider(provider, phase);
return new EntityColorMultiBufferSource(provider, phase);
} else {
return provider;
}
Expand Down
Loading

0 comments on commit 823937f

Please sign in to comment.