use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.
the class AgriCraftFX method renderParticle.
@Override
public void renderParticle(BufferBuilder 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);
}
}
use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.
the class GuiPeripheral method drawScrollBar.
protected void drawScrollBar() {
int total = 160;
int slotWidth = 16;
int fullLength = slotWidth * methods.length;
float unit = ((float) slotWidth) / ((float) fullLength) * total;
int offset = (int) (scrollPosition * unit);
int length = (int) (BUTTON_AMOUNT * unit);
int xOffset = this.guiLeft + 242;
int yOffset = this.guiTop + 8;
// top part
this.drawTexturedModalRect(xOffset, yOffset + offset, 0, 253, 5, 1);
// middle part
float f = 0.00390625F;
ITessellator tessellator = TessellatorVertexBuffer.getInstance();
tessellator.startDrawingQuads(DefaultVertexFormats.BLOCK);
int xMax = xOffset + 5;
int yMin = yOffset + offset + 1;
int yMax = yOffset + length + offset;
float uMin = 0 * f;
float uMax = 5 * f;
float vMin = 254 * f;
float vMax = 254 * f;
tessellator.addVertexWithUV(xOffset, yMax, this.zLevel, uMin, vMax);
tessellator.addVertexWithUV(xMax, yMax, this.zLevel, uMax, vMax);
tessellator.addVertexWithUV(xMax, yMin, this.zLevel, uMax, vMin);
tessellator.addVertexWithUV(xOffset, yMin, this.zLevel, uMin, vMin);
tessellator.draw();
// bottom part
this.drawTexturedModalRect(xOffset, yOffset + offset + length, 0, 255, 5, 1);
}
use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.
the class BotanyPotsPlantRenderer method renderPlant.
public void renderPlant(IAgriPlant plant, IAgriGrowthStage stage, IAgriWeed weed, IAgriGrowthStage weedStage, MatrixStack matrix, IRenderTypeBuffer buffer, int light, int overlay, Direction... preferredSides) {
if (buffer instanceof IRenderTypeBuffer.Impl) {
ITessellator tessellator = this.getTessellator((IRenderTypeBuffer.Impl) buffer);
tessellator.pushMatrix();
tessellator.setBrightness(light);
tessellator.setOverlay(overlay);
tessellator.applyTransformation(matrix.getLast().getMatrix());
tessellator.startDrawingQuads();
tessellator.addQuads(this.fetchQuads(plant, stage, preferredSides));
tessellator.addQuads(this.fetchQuads(weed, weedStage, preferredSides));
tessellator.draw();
tessellator.popMatrix();
}
}
use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.
the class TileEntitySprinklerRenderer method render.
@Override
public void render(TileEntitySprinkler tile, float partialTicks, MatrixStack transforms, IRenderTypeBuffer buffer, int light, int overlay) {
if (buffer instanceof IRenderTypeBuffer.Impl) {
// Apply transformation
transforms.push();
transforms.translate(0.5, 0, 0.5);
transforms.rotate(Vector3f.YP.rotationDegrees(tile.getAngle(partialTicks)));
transforms.translate(-0.5, 0, -0.5);
// Fetch tessellator and start drawing
ITessellator tessellator = this.getTessellator((IRenderTypeBuffer.Impl) buffer);
tessellator.startDrawingQuads();
// Configure tessellator
tessellator.pushMatrix();
tessellator.applyTransformation(transforms.getLast().getMatrix());
tessellator.setBrightness(light).setOverlay(overlay);
// Draw
this.drawGeometry(tessellator);
// End drawing
tessellator.popMatrix().draw();
transforms.pop();
}
}
use of com.infinityraider.infinitylib.render.tessellation.ITessellator in project AgriCraft by AgriCraft.
the class AgriPlantQuadGenerator method bakeQuadsForGourdPattern.
@Nonnull
@Override
public List<BakedQuad> bakeQuadsForGourdPattern(IAgriGrowable plant, IAgriGrowthStage stage, @Nullable Direction face, IntFunction<TextureAtlasSprite> spriteFunc) {
if (face != null) {
return ImmutableList.of();
}
List<BakedQuad> baseQuads = this.bakeQuadsForHashPattern(plant, stage, face, spriteFunc);
if (stage.isFinal()) {
TextureAtlasSprite sprite = spriteFunc.apply(1);
ITessellator tessellator = this.getTessellator();
tessellator.startDrawingQuads();
tessellator.setFace((Direction) null);
tessellator.pushMatrix();
tessellator.drawScaledPrism(7, 0, 2, 11, 4, 6, sprite);
tessellator.drawScaledPrism(10, 0, 7, 14, 4, 11, sprite);
tessellator.drawScaledPrism(5, 0, 10, 9, 4, 14, sprite);
tessellator.drawScaledPrism(2, 0, 5, 6, 4, 9, sprite);
tessellator.popMatrix();
List<BakedQuad> quads = tessellator.getQuads();
tessellator.draw();
return new ImmutableList.Builder<BakedQuad>().addAll(baseQuads).addAll(quads).build();
} else {
return baseQuads;
}
}
Aggregations