mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-09-22 13:43:15 +02:00
CubeParticle hotfix
- Switched to additive cube particle mode - Fixed cube particles not rendering properly with other entities in frame
This commit is contained in:
parent
257dc11f55
commit
a009540190
@ -1,7 +1,11 @@
|
||||
package com.simibubi.create.content.contraptions.particle;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import net.minecraft.client.particle.IParticleFactory;
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
@ -13,7 +17,6 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class CubeParticle extends Particle {
|
||||
|
||||
@ -38,20 +41,13 @@ public class CubeParticle extends Particle {
|
||||
|
||||
public static final Vec3d[] CUBE_NORMALS = {
|
||||
// modified normals for the sides
|
||||
new Vec3d(0, 1, 0),
|
||||
new Vec3d(0, -1, 0),
|
||||
new Vec3d(0, 0, 1),
|
||||
new Vec3d(0, 0, 1),
|
||||
new Vec3d(0, 0, 1),
|
||||
new Vec3d(0, 1, 0), new Vec3d(0, -1, 0), new Vec3d(0, 0, 1), new Vec3d(0, 0, 1), new Vec3d(0, 0, 1),
|
||||
new Vec3d(0, 0, 1),
|
||||
|
||||
|
||||
/*new Vec3d(0, 1, 0),
|
||||
new Vec3d(0, -1, 0),
|
||||
new Vec3d(0, 0, 1),
|
||||
new Vec3d(0, 0, -1),
|
||||
new Vec3d(-1, 0, 0),
|
||||
new Vec3d(1, 0, 0)*/
|
||||
/*
|
||||
* new Vec3d(0, 1, 0), new Vec3d(0, -1, 0), new Vec3d(0, 0, 1), new Vec3d(0, 0,
|
||||
* -1), new Vec3d(-1, 0, 0), new Vec3d(1, 0, 0)
|
||||
*/
|
||||
};
|
||||
|
||||
private static final IParticleRenderType renderType = new IParticleRenderType() {
|
||||
@ -60,15 +56,16 @@ public class CubeParticle extends Particle {
|
||||
RenderSystem.disableTexture();
|
||||
|
||||
// transparent, additive blending
|
||||
//RenderSystem.depthMask(false);
|
||||
//RenderSystem.enableBlend();
|
||||
//RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
|
||||
//RenderSystem.enableLighting();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
|
||||
RenderSystem.enableLighting();
|
||||
RenderSystem.enableColorMaterial();
|
||||
|
||||
// opaque
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.enableLighting();
|
||||
// RenderSystem.depthMask(true);
|
||||
// RenderSystem.disableBlend();
|
||||
// RenderSystem.enableLighting();
|
||||
|
||||
builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
}
|
||||
@ -76,6 +73,8 @@ public class CubeParticle extends Particle {
|
||||
@Override
|
||||
public void finishRender(Tessellator tessellator) {
|
||||
tessellator.draw();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA,
|
||||
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderSystem.enableTexture();
|
||||
}
|
||||
};
|
||||
@ -121,7 +120,12 @@ public class CubeParticle extends Particle {
|
||||
.add(lerpedX, lerpedY, lerpedZ);
|
||||
|
||||
Vec3d normal = CUBE_NORMALS[i];
|
||||
builder.vertex(vec.x, vec.y, vec.z).color(particleRed, particleGreen, particleBlue, particleAlpha).texture(0,0).light(light).normal((float)normal.x,(float) normal.y,(float) normal.z).endVertex();
|
||||
builder.vertex(vec.x, vec.y, vec.z)
|
||||
.color(particleRed, particleGreen, particleBlue, particleAlpha)
|
||||
.texture(0, 0)
|
||||
.light(light)
|
||||
.normal((float) normal.x, (float) normal.y, (float) normal.z)
|
||||
.endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -136,7 +140,8 @@ public class CubeParticle extends Particle {
|
||||
public Factory() {}
|
||||
|
||||
@Override
|
||||
public Particle makeParticle(CubeParticleData data, World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
||||
public Particle makeParticle(CubeParticleData data, World world, double x, double y, double z, double motionX,
|
||||
double motionY, double motionZ) {
|
||||
CubeParticle particle = new CubeParticle(world, x, y, z, motionX, motionY, motionZ);
|
||||
particle.setColor(data.r, data.g, data.b);
|
||||
particle.setScale(data.scale);
|
||||
|
Loading…
Reference in New Issue
Block a user