Add particle culling (#6981)
This commit is contained in:
parent
d8eaeabf3c
commit
cf09f3eeb9
4 changed files with 53 additions and 3 deletions
|
@ -0,0 +1,15 @@
|
||||||
|
--- a/net/minecraft/client/particle/Particle.java
|
||||||
|
+++ b/net/minecraft/client/particle/Particle.java
|
||||||
|
@@ -208,4 +208,12 @@
|
||||||
|
public void func_187108_a(AxisAlignedBB p_187108_1_) {
|
||||||
|
this.field_187120_G = p_187108_1_;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Forge added method that controls if a particle should be culled to it's bounding box.
|
||||||
|
+ * Default behaviour is culling enabled
|
||||||
|
+ */
|
||||||
|
+ public boolean shouldCull() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
}
|
|
@ -34,9 +34,17 @@
|
||||||
return iparticlefactory == null ? null : iparticlefactory.func_199234_a(p_199927_1_, this.field_78878_a, p_199927_2_, p_199927_4_, p_199927_6_, p_199927_8_, p_199927_10_, p_199927_12_);
|
return iparticlefactory == null ? null : iparticlefactory.func_199234_a(p_199927_1_, this.field_78878_a, p_199927_2_, p_199927_4_, p_199927_6_, p_199927_8_, p_199927_10_, p_199927_12_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,14 +315,21 @@
|
@@ -313,16 +313,29 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /**@deprecated Forge: use {@link #renderParticles(MatrixStack, IRenderTypeBuffer.Impl, LightTexture, ActiveRenderInfo, float, net.minecraft.client.renderer.culling.ClippingHelper)} with ClippingHelper as additional parameter*/
|
||||||
|
+ @Deprecated
|
||||||
public void func_228345_a_(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_) {
|
public void func_228345_a_(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_) {
|
||||||
|
+ renderParticles(p_228345_1_, p_228345_2_, p_228345_3_, p_228345_4_, p_228345_5_, null);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void renderParticles(MatrixStack p_228345_1_, IRenderTypeBuffer.Impl p_228345_2_, LightTexture p_228345_3_, ActiveRenderInfo p_228345_4_, float p_228345_5_, @Nullable net.minecraft.client.renderer.culling.ClippingHelper clippingHelper) {
|
||||||
p_228345_3_.func_205109_c();
|
p_228345_3_.func_205109_c();
|
||||||
+ Runnable enable = () -> {
|
+ Runnable enable = () -> {
|
||||||
RenderSystem.enableAlphaTest();
|
RenderSystem.enableAlphaTest();
|
||||||
|
@ -57,7 +65,15 @@
|
||||||
Iterable<Particle> iterable = this.field_78876_b.get(iparticlerendertype);
|
Iterable<Particle> iterable = this.field_78876_b.get(iparticlerendertype);
|
||||||
if (iterable != null) {
|
if (iterable != null) {
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
@@ -362,7 +369,7 @@
|
@@ -331,6 +344,7 @@
|
||||||
|
iparticlerendertype.func_217600_a(bufferbuilder, this.field_78877_c);
|
||||||
|
|
||||||
|
for(Particle particle : iterable) {
|
||||||
|
+ if (clippingHelper != null && particle.shouldCull() && !clippingHelper.func_228957_a_(particle.func_187116_l())) continue;
|
||||||
|
try {
|
||||||
|
particle.func_225606_a_(bufferbuilder, p_228345_4_, p_228345_5_);
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
@@ -362,7 +376,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) {
|
public void func_180533_a(BlockPos p_180533_1_, BlockState p_180533_2_) {
|
||||||
|
@ -66,7 +82,7 @@
|
||||||
VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_);
|
VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_);
|
||||||
double d0 = 0.25D;
|
double d0 = 0.25D;
|
||||||
voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> {
|
voxelshape.func_197755_b((p_228348_3_, p_228348_5_, p_228348_7_, p_228348_9_, p_228348_11_, p_228348_13_) -> {
|
||||||
@@ -434,6 +441,12 @@
|
@@ -434,6 +448,12 @@
|
||||||
return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum());
|
return String.valueOf(this.field_78876_b.values().stream().mapToInt(Collection::size).sum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,24 @@
|
||||||
IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.func_228659_m_());
|
IVertexBuilder ivertexbuilder2 = irendertypebuffer$impl.getBuffer(RenderType.func_228659_m_());
|
||||||
this.func_228429_a_(p_228426_1_, ivertexbuilder2, p_228426_6_.func_216773_g(), d0, d1, d2, blockpos, blockstate);
|
this.func_228429_a_(p_228426_1_, ivertexbuilder2, p_228426_6_.func_216773_g(), d0, d1, d2, blockpos, blockstate);
|
||||||
}
|
}
|
||||||
|
@@ -1119,7 +1124,7 @@
|
||||||
|
this.field_239224_H_.func_237506_a_(this.field_72777_q.func_147110_a());
|
||||||
|
RenderState.field_239237_T_.func_228547_a_();
|
||||||
|
iprofiler.func_219895_b("particles");
|
||||||
|
- this.field_72777_q.field_71452_i.func_228345_a_(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_);
|
||||||
|
+ this.field_72777_q.field_71452_i.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper);
|
||||||
|
RenderState.field_239237_T_.func_228549_b_();
|
||||||
|
} else {
|
||||||
|
iprofiler.func_219895_b("translucent");
|
||||||
|
@@ -1129,7 +1134,7 @@
|
||||||
|
iprofiler.func_219895_b("string");
|
||||||
|
this.func_228441_a_(RenderType.func_241715_r_(), p_228426_1_, d0, d1, d2);
|
||||||
|
iprofiler.func_219895_b("particles");
|
||||||
|
- this.field_72777_q.field_71452_i.func_228345_a_(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_);
|
||||||
|
+ this.field_72777_q.field_71452_i.renderParticles(p_228426_1_, irendertypebuffer$impl, p_228426_8_, p_228426_6_, p_228426_2_, clippinghelper);
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderSystem.pushMatrix();
|
||||||
@@ -2076,7 +2081,12 @@
|
@@ -2076,7 +2081,12 @@
|
||||||
this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_);
|
this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ net/minecraft/block/FireBlock.tryCatchFire(Lnet/minecraft/world/World;Lnet/minec
|
||||||
net/minecraft/block/RedstoneWireBlock.canConnectTo(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/IBlockReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/Direction;)Z=|p_176343_0_,world,pos,p_176343_1_
|
net/minecraft/block/RedstoneWireBlock.canConnectTo(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/IBlockReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/Direction;)Z=|p_176343_0_,world,pos,p_176343_1_
|
||||||
net/minecraft/client/gui/ScreenManager.getScreenFactory(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/Minecraft;ILnet/minecraft/util/text/ITextComponent;)Ljava/util/Optional;=|p_216909_0_,p_216909_1_,p_216909_2_,p_216909_3_
|
net/minecraft/client/gui/ScreenManager.getScreenFactory(Lnet/minecraft/inventory/container/ContainerType;Lnet/minecraft/client/Minecraft;ILnet/minecraft/util/text/ITextComponent;)Ljava/util/Optional;=|p_216909_0_,p_216909_1_,p_216909_2_,p_216909_3_
|
||||||
net/minecraft/client/gui/screen/Screen.renderToolTip(Lcom/mojang/blaze3d/matrix/MatrixStack;Ljava/util/List;IILnet/minecraft/client/gui/FontRenderer;)V=|p_238654_1_,p_238654_2_,p_238654_3_,p_238654_4_,font
|
net/minecraft/client/gui/screen/Screen.renderToolTip(Lcom/mojang/blaze3d/matrix/MatrixStack;Ljava/util/List;IILnet/minecraft/client/gui/FontRenderer;)V=|p_238654_1_,p_238654_2_,p_238654_3_,p_238654_4_,font
|
||||||
|
net/minecraft/client/particle/ParticleManager.renderParticles(Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer$Impl;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/renderer/ActiveRenderInfo;FLnet/minecraft/client/renderer/culling/ClippingHelper;)V=|p_228345_1_,p_228345_2_,p_228345_3_,p_228345_4_,p_228345_5_,clippingHelper
|
||||||
net/minecraft/client/renderer/BlockModelRenderer.renderModel(Lcom/mojang/blaze3d/matrix/MatrixStack$Entry;Lcom/mojang/blaze3d/vertex/IVertexBuilder;Lnet/minecraft/block/BlockState;Lnet/minecraft/client/renderer/model/IBakedModel;FFFIILnet/minecraftforge/client/model/data/IModelData;)V=|p_228804_1_,p_228804_2_,p_228804_3_,p_228804_4_,p_228804_5_,p_228804_6_,p_228804_7_,p_228804_8_,p_228804_9_,modelData
|
net/minecraft/client/renderer/BlockModelRenderer.renderModel(Lcom/mojang/blaze3d/matrix/MatrixStack$Entry;Lcom/mojang/blaze3d/vertex/IVertexBuilder;Lnet/minecraft/block/BlockState;Lnet/minecraft/client/renderer/model/IBakedModel;FFFIILnet/minecraftforge/client/model/data/IModelData;)V=|p_228804_1_,p_228804_2_,p_228804_3_,p_228804_4_,p_228804_5_,p_228804_6_,p_228804_7_,p_228804_8_,p_228804_9_,modelData
|
||||||
net/minecraft/client/renderer/BlockRendererDispatcher.renderBlock(Lnet/minecraft/block/BlockState;Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;IILnet/minecraftforge/client/model/data/IModelData;)V=|p_228791_1_,p_228791_2_,p_228791_3_,p_228791_4_,p_228791_5_,modelData
|
net/minecraft/client/renderer/BlockRendererDispatcher.renderBlock(Lnet/minecraft/block/BlockState;Lcom/mojang/blaze3d/matrix/MatrixStack;Lnet/minecraft/client/renderer/IRenderTypeBuffer;IILnet/minecraftforge/client/model/data/IModelData;)V=|p_228791_1_,p_228791_2_,p_228791_3_,p_228791_4_,p_228791_5_,modelData
|
||||||
net/minecraft/client/renderer/FogRenderer.setupFog(Lnet/minecraft/client/renderer/ActiveRenderInfo;Lnet/minecraft/client/renderer/FogRenderer$FogType;FZF)V=|p_228372_0_,p_228372_1_,p_228372_2_,p_228372_3_,partialTicks
|
net/minecraft/client/renderer/FogRenderer.setupFog(Lnet/minecraft/client/renderer/ActiveRenderInfo;Lnet/minecraft/client/renderer/FogRenderer$FogType;FZF)V=|p_228372_0_,p_228372_1_,p_228372_2_,p_228372_3_,partialTicks
|
||||||
|
|
Loading…
Reference in a new issue