Search in sources :

Example 1 with ITessellator

use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.

the class AgriCraftFX method renderParticle.

@Override
public void renderParticle(VertexBuffer worldRenderer, Entity entity, float partialTicks, float f0, float f1, float f2, float f3, float f4) {
    //I'm doing this because else the textures blink and are fucked up and I have no idea how to fix it,
    //if anyone sees this and knows how, let me know please, thanks :D
    ITessellator tessellator = TessellatorVertexBuffer.getInstance(worldRenderer);
    if (texture != null) {
        float f6 = 0;
        float f7 = 1;
        float f8 = 0;
        float f9 = 1;
        float f10 = 0.1F * this.particleScale;
        float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) f0 - interpPosX);
        float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) f0 - interpPosY);
        float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) f0 - interpPosZ);
        Minecraft.getMinecraft().renderEngine.bindTexture(this.texture);
        tessellator.setColorRGBA(1, 1, 1, 0.5F);
        tessellator.addVertexWithUV((f11 - f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 - f3 * f10 - f6 * f10), f7, f9);
        tessellator.addVertexWithUV((f11 - f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 - f3 * f10 + f6 * f10), f7, f8);
        tessellator.addVertexWithUV((f11 + f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 + f3 * f10 + f6 * f10), f6, f8);
        tessellator.addVertexWithUV((f11 + f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 + f3 * f10 - f6 * f10), f6, f9);
    } else {
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        super.renderParticle(worldRenderer, entity, partialTicks, f0, f1, f2, f3, f4);
    }
}
Also used : ITessellator(com.infinityraider.infinitylib.render.tessellation.ITessellator)

Example 2 with ITessellator

use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.

the class RuneFX method renderParticle.

@Override
public void renderParticle(VertexBuffer worldRenderer, Entity entity, float partialTicks, float f0, float f1, float f2, float f3, float f4) {
    ITessellator tessellator = TessellatorVertexBuffer.getInstance(worldRenderer);
    tessellator.draw();
    tessellator.startDrawingQuads(DefaultVertexFormats.BLOCK);
    float f6 = uMin;
    float f7 = uMax;
    float f8 = vMin;
    float f9 = vMax;
    float f10 = 0.1F * this.particleScale;
    float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) f0 - interpPosX);
    float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) f0 - interpPosY);
    float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) f0 - interpPosZ);
    Minecraft.getMinecraft().renderEngine.bindTexture(this.texture);
    tessellator.setColorRGBA(1, 1, 1, 1);
    tessellator.addVertexWithUV((f11 - f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 - f3 * f10 - f6 * f10), f7, f9);
    tessellator.addVertexWithUV((f11 - f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 - f3 * f10 + f6 * f10), f7, f8);
    tessellator.addVertexWithUV((f11 + f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 + f3 * f10 + f6 * f10), f6, f8);
    tessellator.addVertexWithUV((f11 + f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 + f3 * f10 - f6 * f10), f6, f9);
    tessellator.draw();
    tessellator.startDrawingQuads(DefaultVertexFormats.BLOCK);
}
Also used : ITessellator(com.infinityraider.infinitylib.render.tessellation.ITessellator)

Example 3 with ITessellator

use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.

the class RuneFX method renderParticle.

@Override
public void renderParticle(BufferBuilder worldRenderer, Entity entity, float partialTicks, float f0, float f1, float f2, float f3, float f4) {
    ITessellator tessellator = TessellatorVertexBuffer.getInstance(worldRenderer);
    tessellator.draw();
    tessellator.startDrawingQuads(DefaultVertexFormats.BLOCK);
    float f6 = uMin;
    float f7 = uMax;
    float f8 = vMin;
    float f9 = vMax;
    float f10 = 0.1F * this.particleScale;
    float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) f0 - interpPosX);
    float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) f0 - interpPosY);
    float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) f0 - interpPosZ);
    Minecraft.getMinecraft().renderEngine.bindTexture(this.texture);
    tessellator.setColorRGBA(1, 1, 1, 1);
    tessellator.addVertexWithUV((f11 - f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 - f3 * f10 - f6 * f10), f7, f9);
    tessellator.addVertexWithUV((f11 - f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 - f3 * f10 + f6 * f10), f7, f8);
    tessellator.addVertexWithUV((f11 + f1 * f10 + f4 * f10), (f12 + f2 * f10), (f13 + f3 * f10 + f6 * f10), f6, f8);
    tessellator.addVertexWithUV((f11 + f1 * f10 - f4 * f10), (f12 - f2 * f10), (f13 + f3 * f10 - f6 * f10), f6, f9);
    tessellator.draw();
    tessellator.startDrawingQuads(DefaultVertexFormats.BLOCK);
}
Also used : ITessellator(com.infinityraider.infinitylib.render.tessellation.ITessellator)

Example 4 with ITessellator

use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.

the class AgriPlantQuadGenerator method bakeQuadsForRhombusPattern.

@Nonnull
public List<BakedQuad> bakeQuadsForRhombusPattern(IAgriGrowable plant, IAgriGrowthStage stage, @Nullable Direction face, IntFunction<TextureAtlasSprite> spriteFunc) {
    if (face != null) {
        return ImmutableList.of();
    }
    ITessellator tessellator = this.getTessellator();
    tessellator.startDrawingQuads();
    tessellator.setFace((Direction) null);
    float d = MathHelper.sqrt(128);
    tessellator.pushMatrix();
    tessellator.translate(0, 0, 0.5F);
    tessellator.rotate(45, 0, 1, 0);
    double height = plant.getPlantHeight(stage);
    int layers = (int) Math.ceil(height / 16.0);
    int layer = 0;
    while ((16 * layer) < height) {
        TextureAtlasSprite sprite = spriteFunc.apply(layers - layer - 1);
        tessellator.drawScaledFaceDouble(0, 0, d, d, Direction.NORTH, sprite, 0);
        tessellator.drawScaledFaceDouble(0, 0, d, d, Direction.NORTH, sprite, d);
        tessellator.drawScaledFaceDouble(0, 0, d, d, Direction.EAST, sprite, 0);
        tessellator.drawScaledFaceDouble(0, 0, d, d, Direction.EAST, sprite, d);
        tessellator.translate(0, d / 16.0F, 0);
        layer++;
    }
    tessellator.popMatrix();
    List<BakedQuad> quads = tessellator.getQuads();
    tessellator.draw();
    return quads;
}
Also used : ITessellator(com.infinityraider.infinitylib.render.tessellation.ITessellator) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Nonnull(javax.annotation.Nonnull)

Example 5 with ITessellator

use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.

the class AgriPlantQuadGenerator method bakeQuadsForCrossPattern.

@Nonnull
public List<BakedQuad> bakeQuadsForCrossPattern(IAgriGrowable plant, IAgriGrowthStage stage, @Nullable Direction face, IntFunction<TextureAtlasSprite> spriteFunc) {
    if (face != null) {
        return ImmutableList.of();
    }
    ITessellator tessellator = this.getTessellator();
    tessellator.startDrawingQuads();
    tessellator.setFace((Direction) null);
    tessellator.pushMatrix();
    tessellator.translate(0.5f, 0, 0.5f);
    tessellator.rotate(45, 0, 1, 0);
    tessellator.translate(-0.5f, 0, -0.5f);
    double height = plant.getPlantHeight(stage);
    int layers = (int) Math.ceil(height / 16.0);
    int layer = 0;
    while ((16 * layer) < height) {
        TextureAtlasSprite sprite = spriteFunc.apply(layers - layer - 1);
        tessellator.drawScaledFaceDouble(0, 0, 16, 16, Direction.NORTH, sprite, 8);
        tessellator.drawScaledFaceDouble(0, 0, 16, 16, Direction.EAST, sprite, 8);
        tessellator.translate(0, 1, 0);
        layer++;
    }
    tessellator.popMatrix();
    List<BakedQuad> quads = tessellator.getQuads();
    tessellator.draw();
    return quads;
}
Also used : ITessellator(com.infinityraider.infinitylib.render.tessellation.ITessellator) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) Nonnull(javax.annotation.Nonnull)

Aggregations

ITessellator (com.infinityraider.infinitylib.render.tessellation.ITessellator)17 Nonnull (javax.annotation.Nonnull)6 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)6 IRenderTypeBuffer (net.minecraft.client.renderer.IRenderTypeBuffer)2 ImmutableList (com.google.common.collect.ImmutableList)1 IAgriPlant (com.infinityraider.agricraft.api.v1.plant.IAgriPlant)1 BakedQuad (net.minecraft.client.renderer.model.BakedQuad)1