ParticleBubble.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:Bewitchment 作者:
@Override
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
    int i = (int) (((float) this.life + partialTicks) / (float) this.particleMaxAge);

    if (i <= 7) {
        this.textureManager.bindTexture(ResourceLocations.BUBBLE);
        float minX = 0;
        float maxX = minX + 1;

        float minY = (float) i / 8F;
        float maxY = minY + 0.125F;

        float scale = 1.0F * this.particleScale;
        float x = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX);
        float y = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY);
        float z = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ);
        Vec3d vec0 = new Vec3d(-rotationX * scale - rotationXY * scale, -rotationZ * scale, -rotationYZ * scale - rotationXZ * scale);
        Vec3d vec1 = new Vec3d(-rotationX * scale + rotationXY * scale, rotationZ * scale, -rotationYZ * scale + rotationXZ * scale);
        Vec3d vec2 = new Vec3d(rotationX * scale + rotationXY * scale, rotationZ * scale, rotationYZ * scale + rotationXZ * scale);
        Vec3d vec3 = new Vec3d(rotationX * scale - rotationXY * scale, -rotationZ * scale, rotationYZ * scale - rotationXZ * scale);

        GlStateManager.color(getRedColorF(), getGreenColorF(), getBlueColorF(), 1.0F);
        buffer.begin(7, VERTEX_FORMAT);
        buffer.pos((double) x + vec0.x, (double) y + vec0.y, (double) z + vec0.z).tex((double) maxX, (double) maxY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
        buffer.pos((double) x + vec1.x, (double) y + vec1.y, (double) z + vec1.z).tex((double) maxX, (double) minY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
        buffer.pos((double) x + vec2.x, (double) y + vec2.y, (double) z + vec2.z).tex((double) minX, (double) minY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
        buffer.pos((double) x + vec3.x, (double) y + vec3.y, (double) z + vec3.z).tex((double) minX, (double) maxY).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
        Tessellator.getInstance().draw();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号