Java Code Examples for net.minecraft.client.renderer.Tessellator

The following examples show how to use net.minecraft.client.renderer.Tessellator. These examples are extracted from open source projects.
Example 1
Project: GardenCollection   File: RenderHelperLL.java    License: MIT License 6 votes vote down vote up
private void renderXYZUVAO (int[][] index) {
    Tessellator tessellator = Tessellator.instance;

    int[] tl = index[TL];
    int[] bl = index[BL];
    int[] br = index[BR];
    int[] tr = index[TR];

    tessellator.setColorOpaque_F(state.colorTopLeft[0], state.colorTopLeft[1], state.colorTopLeft[2]);
    tessellator.setBrightness(state.brightnessTopLeft);
    tessellator.addVertexWithUV(xyz[tl[0]], xyz[tl[1]], xyz[tl[2]], uv[tl[3]], uv[tl[4]]);

    tessellator.setColorOpaque_F(state.colorBottomLeft[0], state.colorBottomLeft[1], state.colorBottomLeft[2]);
    tessellator.setBrightness(state.brightnessBottomLeft);
    tessellator.addVertexWithUV(xyz[bl[0]], xyz[bl[1]], xyz[bl[2]], uv[bl[3]], uv[bl[4]]);

    tessellator.setColorOpaque_F(state.colorBottomRight[0], state.colorBottomRight[1], state.colorBottomRight[2]);
    tessellator.setBrightness(state.brightnessBottomRight);
    tessellator.addVertexWithUV(xyz[br[0]], xyz[br[1]], xyz[br[2]], uv[br[3]], uv[br[4]]);

    tessellator.setColorOpaque_F(state.colorTopRight[0], state.colorTopRight[1], state.colorTopRight[2]);
    tessellator.setBrightness(state.brightnessTopRight);
    tessellator.addVertexWithUV(xyz[tr[0]], xyz[tr[1]], xyz[tr[2]], uv[tr[3]], uv[tr[4]]);
}
 
Example 2
Project: Gadomancy   File: MultiTickEffectDispatcher.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void handleWispyLineEffects(World currentRenderWorld, float partialTicks) {
    Tessellator tessellator;
    Iterator<FloatyLineInfo> it = floatyLineInfos.iterator();
    while(it.hasNext()) {
        FloatyLineInfo info = it.next();
        if(info.dimId != currentRenderWorld.provider.dimensionId) {
            it.remove();
            continue;
        }
        info.renderTicks++;
        if(info.renderTicks > info.tickCap) {
            it.remove();
            continue;
        }

        if(info.randomOffset == -1) {
            info.randomOffset = currentRenderWorld.rand.nextInt(20);
        }

        float ticks = Minecraft.getMinecraft().renderViewEntity.ticksExisted + info.randomOffset + partialTicks;
        UtilsFX.drawFloatyLine(info.pedestalX, info.pedestalY, info.pedestalZ, info.originX, info.originY, info.originZ, partialTicks, info.colorAsInt, "textures/misc/wispy.png", -0.02F, Math.min(ticks, 10.0F) / 10.0F);
    }
}
 
Example 3
Project: NOVA-Core   File: FWParticle.java    License: GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderParticle(VertexBuffer worldRendererIn, net.minecraft.entity.Entity p_180434_2_, float p_70539_2_, float x, float y, float z, float p_70539_6_, float p_70539_7_) {
	if (firstTick) {
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		setPosition(posX, posY, posZ);
		firstTick = false;
	}
	float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX);
	float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY);
	float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ);

	Tessellator.getInstance().draw();
	FWEntityRenderer.render(this, wrapped, f11, f12, f13);
	Tessellator.getInstance().getBuffer().begin(GL_QUADS, DefaultVertexFormats.BLOCK);
	FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderUtility.particleResource);
}
 
Example 4
Project: PneumaticCraft   File: GuiCheckBox.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? -6250336 : 0xFF999999);
    drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? -16777216 : 0xFFAAAAAA);
    if(checked) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        if(enabled) {
            GL11.glColor4d(1, 1, 1, 1);
        } else {
            GL11.glColor4d(0.8, 0.8, 0.8, 1);
        }
        Tessellator t = Tessellator.instance;

        t.startDrawing(GL11.GL_LINE_STRIP);
        t.addVertex(x + 2, y + 5, zLevel);
        t.addVertex(x + 5, y + 7, zLevel);
        t.addVertex(x + 8, y + 3, zLevel);
        t.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
 
Example 5
Project: Signals   File: GuiCheckBox.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? -6250336 : 0xFF999999);
    drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? -16777216 : 0xFFAAAAAA);
    if(checked) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        if(enabled) {
            GL11.glColor4d(1, 1, 1, 1);
        } else {
            GL11.glColor4d(0.8, 0.8, 0.8, 1);
        }
        BufferBuilder wr = Tessellator.getInstance().getBuffer();
        wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
        wr.pos(x + 2, y + 5, zLevel).endVertex();
        wr.pos(x + 5, y + 7, zLevel).endVertex();
        wr.pos(x + 8, y + 3, zLevel).endVertex();
        Tessellator.getInstance().draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
 
Example 6
Project: seppuku   File: RenderUtil.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void drawPlane(AxisAlignedBB boundingBox, int color) {
    float alpha = (color >> 24 & 0xFF) / 255.0F;
    float red = (color >> 16 & 0xFF) / 255.0F;
    float green = (color >> 8 & 0xFF) / 255.0F;
    float blue = (color & 0xFF) / 255.0F;

    double minX = boundingBox.minX;
    double minY = boundingBox.minY;
    double minZ = boundingBox.minZ;

    double maxX = boundingBox.maxX;
    double maxY = boundingBox.maxY;
    double maxZ = boundingBox.maxZ;

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();

    bufferbuilder.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
    bufferbuilder.pos(minX, minY, minZ).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos(maxX, minY, maxZ).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos(minX, minY, maxZ).color(red, green, blue, 0).endVertex();
    bufferbuilder.pos(maxZ, minY, minZ).color(red, green, blue, alpha).endVertex();

    tessellator.draw();
}
 
Example 7
Project: bleachhack-1.14   File: RenderUtils.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) {
	gl11Setup();
	GL11.glLineWidth(t);
       
	Vec3d ren = renderPos();
       
       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder buffer = tessellator.getBuffer();
       buffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
       buffer.pos(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 0.0F).endVertex();
       buffer.pos(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 1.0F).endVertex();
       buffer.pos(x2 - ren.x, y2 - ren.y, z2 - ren.z).color(r, g, b, 1.0F).endVertex();
       tessellator.draw();
       
	gl11Cleanup();
       
}
 
Example 8
Project: Et-Futurum   File: BlockChorusFlowerRender.java    License: The Unlicense 6 votes vote down vote up
private void renderCube(RenderBlocks renderer, Block block, int meta) {
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawingQuads();
	tessellator.setNormal(0.0F, -1.0F, 0.0F);
	renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
	tessellator.setNormal(0.0F, 1.0F, 0.0F);
	renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
	tessellator.setNormal(0.0F, 0.0F, -1.0F);
	renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
	tessellator.setNormal(0.0F, 0.0F, 1.0F);
	renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
	tessellator.setNormal(-1.0F, 0.0F, 0.0F);
	renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
	tessellator.setNormal(1.0F, 0.0F, 0.0F);
	renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
	tessellator.draw();
}
 
Example 9
Project: Et-Futurum   File: LingeringPotionRenderer.java    License: The Unlicense 6 votes vote down vote up
private void renderIcon(IIcon icon) {
	Tessellator tessellator = Tessellator.instance;

	float minU = icon.getMinU();
	float maxU = icon.getMaxU();
	float minV = icon.getMinV();
	float maxV = icon.getMaxV();

	OpenGLHelper.rotate(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
	OpenGLHelper.rotate(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
	tessellator.startDrawingQuads();
	tessellator.setNormal(0.0F, 1.0F, 0.0F);
	tessellator.addVertexWithUV(-0.5F, -0.25F, 0.0D, minU, maxV);
	tessellator.addVertexWithUV(0.5F, -0.25F, 0.0D, maxU, maxV);
	tessellator.addVertexWithUV(0.5F, 0.75F, 0.0D, maxU, minV);
	tessellator.addVertexWithUV(-0.5F, 0.75F, 0.0D, minU, minV);
	tessellator.draw();
}
 
Example 10
Project: Chisel   File: RenderBlocksCTM.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean renderStandardBlock(Block block, int x, int y, int z)
{
    bx = x;
    by = y;
    bz = z;

    tessellator = Tessellator.instance;
    tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);

    tessellator.addTranslation(x, y, z);

    boolean res = super.renderStandardBlock(block, x, y, z);

    tessellator.addTranslation(-x, -y, -z);

    return res;
}
 
Example 11
Project: XRay-Mod   File: GuiAddBlock.java    License: GNU General Public License v3.0 6 votes vote down vote up
static void renderPreview(int x, int y, float r, float g, float b) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder tessellate = tessellator.getBuffer();
    RenderSystem.enableBlend();
    RenderSystem.disableTexture();
    RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    RenderSystem.color4f(r/255, g/255, b/255, 1);
    tessellate.begin(7, DefaultVertexFormats.POSITION);
    tessellate.pos(x, y, 0.0D).endVertex();
    tessellate.pos(x, y + 45, 0.0D).endVertex();
    tessellate.pos(x + 202, y + 45, 0.0D).endVertex();
    tessellate.pos(x + 202, y, 0.0D).endVertex();
    tessellator.draw();
    RenderSystem.enableTexture();
    RenderSystem.disableBlend();
}
 
Example 12
Project: PneumaticCraft   File: GuiRadioButton.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void drawCircle(int x, int y, int radius, int color){
    Tessellator t = Tessellator.instance;
    float f = (color >> 24 & 255) / 255.0F;
    float f1 = (color >> 16 & 255) / 255.0F;
    float f2 = (color >> 8 & 255) / 255.0F;
    float f3 = (color & 255) / 255.0F;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(f1, f2, f3, f);
    t.startDrawing(GL11.GL_TRIANGLE_FAN);
    int points = 20;
    for(int i = 0; i < points; i++) {
        double sin = Math.sin((double)i / points * Math.PI * 2);
        double cos = Math.cos((double)i / points * Math.PI * 2);
        t.addVertex(x + sin * radius, y + cos * radius, zLevel);
    }
    t.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}
 
Example 13
Project: BigReactors   File: BeefGuiTextureProgressBar.java    License: MIT License 6 votes vote down vote up
@Override
protected void drawProgressBar(Tessellator tessellator,
		TextureManager renderEngine, int barMinX, int barMaxX, int barMinY,
		int barMaxY, int zLevel) {

	double barHeight = Math.round((getProgress() * (this.height-2))) + 2;
	if(getProgress() > 0.00001) { barHeight = Math.max(getBarMinHeight(), barHeight); }

	double barMaxV = 1;
	double barMinV = 1 - Math.min(1, Math.max(0, barHeight / this.height));
	
	renderEngine.bindTexture(getBarTexture());
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height, zLevel, barLeftU, barMaxV);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height, zLevel, barRightU, barMaxV);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height - barHeight, zLevel, barRightU, barMinV);
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height - barHeight, zLevel, barLeftU, barMinV);
	tessellator.draw();
}
 
Example 14
Project: PneumaticCraft   File: RenderBlockArrows.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void drawArrow(float progress){
    double arrowBaseWidth = 0.4D;
    double arrowBaseLength = 0.8D;
    double arrowLength = 1.5D;
    double arrowWidth = 0.7D;
    double scale = 0.1D;
    GL11.glPushMatrix();
    GL11.glScaled(scale, scale, scale);
    GL11.glTranslatef(0, progress * 4, 0);
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINE_STRIP);
    tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D, 0);
    tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(-arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(0, arrowLength * 0.5D, 0);
    tess.addVertex(arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D, 0);
    tess.draw();
    GL11.glPopMatrix();
}
 
Example 15
Project: MediaMod   File: PlayerOverlay.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a rectangle with a vertical gradient between the specified colors (ARGB format).
 * Args: x1, y1, x2, y2, topColor, bottomColor
 *
 * @author ScottehBoeh
 */
private void drawGradientRect(double left, double top, double right, double bottom, int startColor, int endColor) {
    float f = (float) (startColor >> 24 & 255) / 255.0F;
    float f1 = (float) (startColor >> 16 & 255) / 255.0F;
    float f2 = (float) (startColor >> 8 & 255) / 255.0F;
    float f3 = (float) (startColor & 255) / 255.0F;
    float f4 = (float) (endColor >> 24 & 255) / 255.0F;
    float f5 = (float) (endColor >> 16 & 255) / 255.0F;
    float f6 = (float) (endColor >> 8 & 255) / 255.0F;
    float f7 = (float) (endColor & 255) / 255.0F;
    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.shadeModel(7425);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(right, top, 0).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos(left, top, 0).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos(left, bottom, 0).color(f5, f6, f7, f4).endVertex();
    worldrenderer.pos(right, bottom, 0).color(f5, f6, f7, f4).endVertex();
    tessellator.draw();
    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
Example 16
Project: PneumaticCraft   File: ProgWidget.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render(){
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture());
    int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0);
    int height = getHeight() + (hasStepOutput() ? 10 : 0);
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();
    t.addVertexWithUV(0, 0, 0, 0, 0);
    t.addVertexWithUV(0, height, 0, 0, 1);
    t.addVertexWithUV(width, height, 0, 1, 1);
    t.addVertexWithUV(width, 0, 0, 1, 0);
    t.draw();
}
 
Example 17
Project: Signals   File: DirectionalityRenderer.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void render(int dimensionID, BufferBuilder b){
    BakedRenderer bakedRenderer = bakedRenderers.get(dimensionID);
    if(bakedRenderer != null) {
        b.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION);
        bakedRenderer.render(b);
        Tessellator.getInstance().draw();
    }
}
 
Example 18
Project: Gadomancy   File: FXVortex.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void sheduleRender(List<FXVortex> vortexes, Tessellator tessellator, float partialTicks) {
    synchronized (EffectHandler.lockEffects) {
        for (FXVortex vortex : vortexes) {
            GL11.glPushMatrix();
            vortex.render(tessellator, partialTicks);
            GL11.glPopMatrix();
        }
    }
}
 
Example 19
Project: TFC2   File: GuiInventoryButton.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void drawIcon(int x, int y, int textureX, int textureY, int width, int height)
{
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexbuffer = tessellator.getBuffer();
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexbuffer.pos((double)(x + 0), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 16), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 16), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 0), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	tessellator.draw();
}
 
Example 20
Project: seppuku   File: RenderUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static void drawGradientRect(float left, float top, float right, float bottom, int startColor, int endColor) {
    float f = (float) (startColor >> 24 & 255) / 255.0F;
    float f1 = (float) (startColor >> 16 & 255) / 255.0F;
    float f2 = (float) (startColor >> 8 & 255) / 255.0F;
    float f3 = (float) (startColor & 255) / 255.0F;
    float f4 = (float) (endColor >> 24 & 255) / 255.0F;
    float f5 = (float) (endColor >> 16 & 255) / 255.0F;
    float f6 = (float) (endColor >> 8 & 255) / 255.0F;
    float f7 = (float) (endColor & 255) / 255.0F;
    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.shadeModel(7425);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
    bufferbuilder.pos((double) right, (double) top, (double) 0).color(f1, f2, f3, f).endVertex();
    bufferbuilder.pos((double) left, (double) top, (double) 0).color(f1, f2, f3, f).endVertex();
    bufferbuilder.pos((double) left, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex();
    bufferbuilder.pos((double) right, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex();
    tessellator.draw();
    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
Example 21
Project: GardenCollection   File: RenderHelper.java    License: MIT License 5 votes vote down vote up
public void renderCrossedSquares (IBlockAccess blockAccess, Block block, int x, int y, int z, IIcon icon) {
    Tessellator tessellator = Tessellator.instance;
    tessellator.setBrightness(block.getMixedBrightnessForBlock(blockAccess, x, y, z));

    calculateBaseColor(colorScratch, block.colorMultiplier(blockAccess, x, y, z));
    setTessellatorColor(tessellator, colorScratch);

    drawCrossedSquares(icon, x, y, z, 1.0F);
}
 
Example 22
Project: PneumaticCraft   File: RenderProgressingLine.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void render(){
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(startX, startY, startZ);
    tess.addVertex(startX + (endX - startX) * progress, startY + (endY - startY) * progress, startZ + (endZ - startZ) * progress);
    tess.draw();
}
 
Example 23
Project: seppuku   File: RenderUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static void drawTexture(float x, float y, float width, float height, float u, float v, float t, float s) {
    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX);
    bufferbuilder.pos(x + width, y, 0F).tex(t, v).endVertex();
    bufferbuilder.pos(x, y, 0F).tex(u, v).endVertex();
    bufferbuilder.pos(x, y + height, 0F).tex(u, s).endVertex();
    bufferbuilder.pos(x, y + height, 0F).tex(u, s).endVertex();
    bufferbuilder.pos(x + width, y + height, 0F).tex(t, s).endVertex();
    bufferbuilder.pos(x + width, y, 0F).tex(t, v).endVertex();
    tessellator.draw();
}
 
Example 24
Project: Chisel-2   File: EntityHolystoneFX.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
	particleScale = 0.25f + initialScale * (float) Math.sin((particleAge + angleOffset) / 180.f);

	if (particleAge < fadetime)
		particleAlpha = particleAge / fadetime;
	else if (particleAge + fadetime >= particleMaxAge)
		particleAlpha = (particleMaxAge - particleAge) / fadetime;
	else
		particleAlpha = 1.0f;

	super.renderParticle(tessellator, partialTick, rotX, rotXZ, rotZ, rotYZ, rotXY);

}
 
Example 25
Project: CommunityMod   File: GuiAssembler.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public void drawGradientRect(GuiRoutiduct gui, int x, int y, int width, int height, int startColor, int endColor) {
	x = adjustX(gui, x);
	y = adjustY(gui, y);

	int left = x;
	int top = y;
	int right = x + width;
	int bottom = y + height;
	float f = (float) (startColor >> 24 & 255) / 255.0F;
	float f1 = (float) (startColor >> 16 & 255) / 255.0F;
	float f2 = (float) (startColor >> 8 & 255) / 255.0F;
	float f3 = (float) (startColor & 255) / 255.0F;
	float f4 = (float) (endColor >> 24 & 255) / 255.0F;
	float f5 = (float) (endColor >> 16 & 255) / 255.0F;
	float f6 = (float) (endColor >> 8 & 255) / 255.0F;
	float f7 = (float) (endColor & 255) / 255.0F;
	GlStateManager.disableTexture2D();
	GlStateManager.enableBlend();
	GlStateManager.disableAlpha();
	GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
	GlStateManager.shadeModel(7425);
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder vertexbuffer = tessellator.getBuffer();
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
	vertexbuffer.pos((double) right, (double) top, (double) 0).color(f1, f2, f3, f).endVertex();
	vertexbuffer.pos((double) left, (double) top, (double) 0).color(f1, f2, f3, f).endVertex();
	vertexbuffer.pos((double) left, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex();
	vertexbuffer.pos((double) right, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex();
	tessellator.draw();
	GlStateManager.shadeModel(7424);
	GlStateManager.disableBlend();
	GlStateManager.enableAlpha();
	GlStateManager.enableTexture2D();
}
 
Example 26
Project: BigReactors   File: BeefGuiControlBase.java    License: MIT License 5 votes vote down vote up
protected static void drawTexturedModelRectFromIcon(int x, int y, IIcon icon, int width, int height)
{
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV((double)(x + 0), (double)(y + height), 0.0D, (double)icon.getMinU(), (double)icon.getMaxV());
    tessellator.addVertexWithUV((double)(x + width), (double)(y + height), 0.0D, (double)icon.getMaxU(), (double)icon.getMaxV());
    tessellator.addVertexWithUV((double)(x + width), (double)(y + 0), 0.0D, (double)icon.getMaxU(), (double)icon.getMinV());
    tessellator.addVertexWithUV((double)(x + 0), (double)(y + 0), 0.0D, (double)icon.getMinU(), (double)icon.getMinV());
    tessellator.draw();
}
 
Example 27
Project: AdvancedRocketry   File: GroupObject.java    License: MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void render()
{
    if (faces.size() > 0)
    {
        BufferBuilder buffer = Tessellator.getInstance().getBuffer();
        buffer.begin(glDrawingMode, drawMode);
        render(buffer);
        Tessellator.getInstance().draw();
    }
}
 
Example 28
Project: ExNihiloAdscensio   File: RenderProjectileStone.java    License: MIT License 5 votes vote down vote up
@Override
public void doRender(ProjectileStone entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    TextureAtlasSprite texture = getTexture(Blocks.STONE.getDefaultState());
    
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer buffer = tessellator.getBuffer();
    
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    
    double minU = (double) texture.getMinU();
    double maxU = (double) texture.getMaxU();
    double minV = (double) texture.getMinV();
    double maxV = (double) texture.getMaxV();

    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
    
    double size = 0.5;
    
    //bufferCuboid(buffer, 1, minU, minV, maxU, maxV, -8, -8, -8, 8, 8, 8);
    
    bufferCuboid(buffer, size, minU, minV, maxU, maxV, -4, -2, -2, -2,  2,  2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV,  4,  2,  2,  2, -2, -2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -4, -2,  2, -2,  2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV,  2,  4,  2, -2,  2, -2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -2, -4,  2,  2,  -2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV,  2,  2,  4, -2, -2,  2);
    
    tessellator.draw();
    
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
 
Example 29
Project: OpenModsLib   File: BaseComponent.java    License: MIT License 5 votes vote down vote up
protected void drawSprite(Icon icon, int x, int y, int width, int height) {
	parent.bindTexture(icon.texture);

	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder worldrenderer = tessellator.getBuffer();
	worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	worldrenderer.pos(x + 0, y + height, this.zLevel).tex(icon.minU, icon.maxV).endVertex();
	worldrenderer.pos(x + width, y + height, this.zLevel).tex(icon.maxU, icon.maxV).endVertex();
	worldrenderer.pos(x + width, y + 0, this.zLevel).tex(icon.maxU, icon.minV).endVertex();
	worldrenderer.pos(x + 0, y + 0, this.zLevel).tex(icon.minU, icon.minV).endVertex();
	tessellator.draw();
}
 
Example 30
Project: OpenModsLib   File: CachedRendererFactory.java    License: MIT License 5 votes vote down vote up
public DisplayListRenderer(Tessellator tes) {
	displayList = GL11.glGenLists(1);
	if (isDisplayListValid()) {
		GL11.glNewList(displayList, GL11.GL_COMPILE);
		tes.draw();
		GL11.glEndList();
	}
}
 
Example 31
Project: bartworks   File: RendererGlasBlock.java    License: MIT License 5 votes vote down vote up
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;
    block.setBlockBoundsForItemRender();
    renderer.setRenderBoundsFromBlock(block);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
 
Example 32
Project: BigReactors   File: RotorSimpleRenderer.java    License: MIT License 5 votes vote down vote up
public static void renderBlade(RenderBlocks renderer, int x, int y, int z, Block block, int metadata, ForgeDirection rotorDir) {
	if(rotorDir == ForgeDirection.UNKNOWN) {
		rotorDir = ForgeDirection.UP;
	}
	
	double xMin, yMin, zMin, xMax, yMax, zMax;
	xMin = yMin = zMin = 0D;
	xMax = yMax = zMax = 1D;
	
	if(rotorDir.offsetX != 0) {
		xMin = 0.45D;
		xMax = 0.55D;
	}
	else if(rotorDir.offsetY != 0) {
		yMin = 0.45D;
		yMax = 0.55D;
	}
	else if(rotorDir.offsetZ != 0) {
		zMin = 0.45D;
		zMax = 0.55D;
	}
	
       Tessellator.instance.setColorRGBA(255, 255, 255, 255);
       renderer.setRenderBoundsFromBlock(block);
       renderer.setOverrideBlockTexture(null);
	
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata));
       renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax);
       renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata));
       renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D);
}
 
Example 33
Project: NOVA-Core   File: FWEntityRenderer.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void render(FWEntity wrapper, nova.core.entity.Entity entity, double x, double y, double z) {
	Optional<DynamicRenderer> opRenderer = entity.components.getOp(DynamicRenderer.class);

	if (opRenderer.isPresent()) {
		BWModel model = new BWModel();
		model.matrix
			.translate(x, y, z)
			.scale(entity.scale())
			.translate(entity.pivot())
			.rotate(entity.rotation())
			.translate(entity.pivot().negate());

		opRenderer.get().onRender.accept(model);

		if (model.blendSFactor > 0 && model.blendDFactor > 0) {
			glShadeModel(GL_SMOOTH);
			glEnable(GL_BLEND);
			GL11.glBlendFunc(model.blendSFactor, model.blendDFactor);
		}

		Tessellator.getInstance().getBuffer().begin(GL_QUADS, DefaultVertexFormats.ITEM);
		model.render(Minecraft.getMinecraft().getRenderManager());
		Tessellator.getInstance().draw();

		if (model.blendSFactor > 0 && model.blendDFactor > 0) {
			RenderUtility.disableBlending();
		}
	}
}
 
Example 34
Project: CodeChickenLib   File: CCRenderState.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void writeVert() {
    WorldRenderer r = Tessellator.getInstance().getWorldRenderer();
    
    if(hasNormal)
        r.normal((float) normal.x, (float) normal.y, (float) normal.z);
    if(hasColour)
        r.color(colour>>>24, colour>>16 & 0xFF, colour>>8 & 0xFF, alphaOverride >= 0 ? alphaOverride : colour & 0xFF);
    if(hasBrightness)
        r.lightmap(brightness >> 16 & 65535, brightness & 65535);
}
 
Example 35
Project: TFC2   File: UIComponent.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void draw(Tessellator tess, VertexBuffer buffer)
{
	setupGL();
	buffer.begin(GLMode, format);
	for(Vertex v : vertexList)
	{
		v.addVertex(buffer);
	}
	tess.draw();
}
 
Example 36
Project: Hyperium   File: CustomCrosshairGraphics.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawFilledRectangle(int x1, int y1, int x2, int y2, final Color colour) {
    if (x1 < x2) {
        final int tempX = x1;
        x1 = x2;
        x2 = tempX;
    }
    if (y1 < y2) {
        final int tempY = y1;
        y1 = y2;
        y2 = tempY;
    }
    final Tessellator tessellator = Tessellator.getInstance();
    final WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager
        .color(colour.getRed() / 255.0f, colour.getGreen() / 255.0f, colour.getBlue() / 255.0f,
            colour.getAlpha() / 255.0f);
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
    worldrenderer.pos(x1, y2, 0.0).endVertex();
    worldrenderer.pos(x2, y2, 0.0).endVertex();
    worldrenderer.pos(x2, y1, 0.0).endVertex();
    worldrenderer.pos(x1, y1, 0.0).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 37
Project: OpenModsLib   File: TessellatorPool.java    License: MIT License 5 votes vote down vote up
public void startDrawing(int primitive, VertexFormat vertexFormat, WorldRendererUser user) {
	final Tessellator tes = reserveTessellator();

	final BufferBuilder wr = tes.getBuffer();
	wr.begin(primitive, vertexFormat);
	user.execute(wr);
	tes.draw();

	pool.add(tes);
}
 
Example 38
Project: ehacks-pro   File: CellViewer.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void renderQuad(Tessellator p_77017_1_, int p_77017_2_, int p_77017_3_, int p_77017_4_, int p_77017_5_, int p_77017_6_) {
    p_77017_1_.startDrawingQuads();
    p_77017_1_.setColorOpaque_I(p_77017_6_);
    p_77017_1_.addVertex((p_77017_2_), (p_77017_3_), 0.0D);
    p_77017_1_.addVertex((p_77017_2_), (p_77017_3_ + p_77017_5_), 0.0D);
    p_77017_1_.addVertex((p_77017_2_ + p_77017_4_), (p_77017_3_ + p_77017_5_), 0.0D);
    p_77017_1_.addVertex((p_77017_2_ + p_77017_4_), (p_77017_3_), 0.0D);
    p_77017_1_.draw();
}
 
Example 39
Project: GardenCollection   File: RenderHelper.java    License: MIT License 5 votes vote down vote up
public void drawCrossedSquares(IIcon icon, double x, double y, double z, float scale)
{
    Tessellator tessellator = Tessellator.instance;

    x += state.renderOffsetX;
    y += state.renderOffsetY;
    z += state.renderOffsetZ;

    double uMin = icon.getInterpolatedU(state.renderMinX * 16.0D);
    double uMax = icon.getInterpolatedU(state.renderMaxX * 16.0D);
    double vMin = icon.getInterpolatedV(16 - state.renderMaxY * 16.0D);
    double vMax = icon.getInterpolatedV(16 - state.renderMinY * 16.0D);

    double d7 = 0.45D * (double)scale;
    double xMin = x + 0.5D - d7;
    double xMax = x + 0.5D + d7;
    double yMin = y + state.renderMinY * scale;
    double yMax = y + state.renderMaxY * scale;
    double zMin = z + 0.5D - d7;
    double zMax = z + 0.5D + d7;

    tessellator.addVertexWithUV(xMin, yMax, zMin, uMin, vMin);
    tessellator.addVertexWithUV(xMin, yMin, zMin, uMin, vMax);
    tessellator.addVertexWithUV(xMax, yMin, zMax, uMax, vMax);
    tessellator.addVertexWithUV(xMax, yMax, zMax, uMax, vMin);
    tessellator.addVertexWithUV(xMax, yMax, zMax, uMin, vMin);
    tessellator.addVertexWithUV(xMax, yMin, zMax, uMin, vMax);
    tessellator.addVertexWithUV(xMin, yMin, zMin, uMax, vMax);
    tessellator.addVertexWithUV(xMin, yMax, zMin, uMax, vMin);

    tessellator.addVertexWithUV(xMin, yMax, zMax, uMin, vMin);
    tessellator.addVertexWithUV(xMin, yMin, zMax, uMin, vMax);
    tessellator.addVertexWithUV(xMax, yMin, zMin, uMax, vMax);
    tessellator.addVertexWithUV(xMax, yMax, zMin, uMax, vMin);
    tessellator.addVertexWithUV(xMax, yMax, zMin, uMin, vMin);
    tessellator.addVertexWithUV(xMax, yMin, zMin, uMin, vMax);
    tessellator.addVertexWithUV(xMin, yMin, zMax, uMax, vMax);
    tessellator.addVertexWithUV(xMin, yMax, zMax, uMax, vMin);
}
 
Example 40
Project: ehacks-pro   File: ShowArmor.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void drawTexturedModalRect(int p_73729_1_, int p_73729_2_, int p_73729_3_, int p_73729_4_, int p_73729_5_, int p_73729_6_) {
    float f = 0.00390625F;
    float f1 = 0.00390625F;
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV((p_73729_1_), (p_73729_2_ + p_73729_6_), 300f, ((p_73729_3_) * f), ((p_73729_4_ + p_73729_6_) * f1));
    tessellator.addVertexWithUV((p_73729_1_ + p_73729_5_), (p_73729_2_ + p_73729_6_), 300f, ((p_73729_3_ + p_73729_5_) * f), ((p_73729_4_ + p_73729_6_) * f1));
    tessellator.addVertexWithUV((p_73729_1_ + p_73729_5_), (p_73729_2_), 300f, ((p_73729_3_ + p_73729_5_) * f), ((p_73729_4_) * f1));
    tessellator.addVertexWithUV((p_73729_1_), (p_73729_2_), 300f, ((p_73729_3_) * f), ((p_73729_4_) * f1));
    tessellator.draw();
}