net.minecraft.client.renderer.Tessellator Java Examples

The following examples show how to use net.minecraft.client.renderer.Tessellator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderHelperLL.java    From GardenCollection with 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
Source File: GuiCheckBox.java    From Signals with 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 #3
Source File: FWParticle.java    From NOVA-Core with 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
Source File: GuiCheckBox.java    From PneumaticCraft with 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
Source File: RenderBlockArrows.java    From PneumaticCraft with 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 #6
Source File: RenderUtil.java    From seppuku with 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
Source File: RenderUtils.java    From bleachhack-1.14 with 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
Source File: BlockChorusFlowerRender.java    From Et-Futurum with 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
Source File: LingeringPotionRenderer.java    From Et-Futurum with 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
Source File: BeefGuiTextureProgressBar.java    From BigReactors with 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 #11
Source File: RenderBlocksCTM.java    From Chisel with 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 #12
Source File: GuiRadioButton.java    From PneumaticCraft with 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
Source File: GuiAddBlock.java    From XRay-Mod with 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 #14
Source File: RenderProgressingLine.java    From PneumaticCraft with 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 #15
Source File: CellViewer.java    From ehacks-pro with 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 #16
Source File: TessellatorPool.java    From OpenModsLib with 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 #17
Source File: BeefGuiControlBase.java    From BigReactors with 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 #18
Source File: GroupObject.java    From AdvancedRocketry with 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 #19
Source File: PlayerOverlay.java    From MediaMod with 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 #20
Source File: CustomCrosshairGraphics.java    From Hyperium with 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 #21
Source File: RenderProjectileStone.java    From ExNihiloAdscensio with 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 #22
Source File: BaseComponent.java    From OpenModsLib with 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 #23
Source File: MultiTickEffectDispatcher.java    From Gadomancy with GNU Lesser General Public License v3.0 5 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 #24
Source File: CachedRendererFactory.java    From OpenModsLib with 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 #25
Source File: UIComponent.java    From TFC2 with 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 #26
Source File: RendererGlasBlock.java    From bartworks with 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 #27
Source File: RotorSimpleRenderer.java    From BigReactors with 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 #28
Source File: FWEntityRenderer.java    From NOVA-Core with 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 #29
Source File: XRayBlockSlot.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void drawSlot(int i, int j, int k, int var4, Tessellator var5, int var6, int var7) {
    XRayBlock xblock = XRayBlock.blocks.get(i);
    XRayGui var10000 = this.xrayGui;
    XRayGui.drawRect((175 + j), (1 + k), (this.xrayGui.width - j - 20), (15 + k), (((51200 | xblock.r) << 8 | xblock.g) << 8 | xblock.b));
    if (xblock.id != null && Block.blockRegistry.containsKey(xblock.id)) {
        this.xrayGui.drawString(this.xrayGui.render, ((Block) Block.blockRegistry.getObject(xblock.id)).getLocalizedName(), j + 2, k + 1, 16777215);
    }
}
 
Example #30
Source File: CCRenderState.java    From CodeChickenLib with 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);
}