当前位置: 首页>>代码示例>>Java>>正文


Java Tessellator.getBuffer方法代码示例

本文整理汇总了Java中net.minecraft.client.renderer.Tessellator.getBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java Tessellator.getBuffer方法的具体用法?Java Tessellator.getBuffer怎么用?Java Tessellator.getBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.renderer.Tessellator的用法示例。


在下文中一共展示了Tessellator.getBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: blitSlotIcon

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
private void blitSlotIcon(int p_148171_1_, int p_148171_2_, int p_148171_3_, int p_148171_4_)
{
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(Gui.STAT_ICONS);
    float f = 0.0078125F;
    float f1 = 0.0078125F;
    int i = 18;
    int j = 18;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double)(p_148171_1_ + 0), (double)(p_148171_2_ + 18), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 0) * 0.0078125F), (double)((float)(p_148171_4_ + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_148171_1_ + 18), (double)(p_148171_2_ + 18), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 18) * 0.0078125F), (double)((float)(p_148171_4_ + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_148171_1_ + 18), (double)(p_148171_2_ + 0), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 18) * 0.0078125F), (double)((float)(p_148171_4_ + 0) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_148171_1_ + 0), (double)(p_148171_2_ + 0), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 0) * 0.0078125F), (double)((float)(p_148171_4_ + 0) * 0.0078125F)).endVertex();
    tessellator.draw();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:GuiFlatPresets.java

示例2: drawTextureWithMasking

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
    double uMin = (double) textureSprite.getMinU();
    double uMax = (double) textureSprite.getMaxU();
    double vMin = (double) textureSprite.getMinV();
    double vMax = (double) textureSprite.getMaxV();
    uMax = uMax - (maskRight / 16.0 * (uMax - uMin));
    vMax = vMax - (maskTop / 16.0 * (vMax - vMin));

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
    bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
    bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
    bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
    bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
    tessellator.draw();
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:18,代码来源:FluidStackRenderer.java

示例3: drawSelectionBox

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
 * Draws the blue selection box.
 */
private void drawSelectionBox(int startX, int startY, int endX, int endY) {
	if (startX < endX) {
		int i = startX;
		startX = endX;
		endX = i;
	}

	if (startY < endY) {
		int j = startY;
		startY = endY;
		endY = j;
	}

	if (endX > this.x + this.width) {
		endX = this.x + this.width;
	}

	if (startX > this.x + this.width) {
		startX = this.x + this.width;
	}

	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder bufferbuilder = tessellator.getBuffer();
	GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F);
	GlStateManager.disableTexture2D();
	GlStateManager.enableColorLogic();
	GlStateManager.colorLogicOp(GlStateManager.LogicOp.OR_REVERSE);
	bufferbuilder.begin(7, DefaultVertexFormats.POSITION);
	bufferbuilder.pos((double) startX, (double) endY, 0.0D).endVertex();
	bufferbuilder.pos((double) endX, (double) endY, 0.0D).endVertex();
	bufferbuilder.pos((double) endX, (double) startY, 0.0D).endVertex();
	bufferbuilder.pos((double) startX, (double) startY, 0.0D).endVertex();
	tessellator.draw();
	GlStateManager.disableColorLogic();
	GlStateManager.enableTexture2D();
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:40,代码来源:NickGuiTextField.java

示例4: drawRect

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
 * Draws a solid color rectangle with the specified coordinates and color.
 */
public static void drawRect(int left, int top, int right, int bottom, int color)
{
    if (left < right)
    {
        int i = left;
        left = right;
        right = i;
    }

    if (top < bottom)
    {
        int j = top;
        top = bottom;
        bottom = j;
    }

    float f3 = (float)(color >> 24 & 255) / 255.0F;
    float f = (float)(color >> 16 & 255) / 255.0F;
    float f1 = (float)(color >> 8 & 255) / 255.0F;
    float f2 = (float)(color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.color(f, f1, f2, f3);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION);
    vertexbuffer.pos((double)left, (double)bottom, 0.0D).endVertex();
    vertexbuffer.pos((double)right, (double)bottom, 0.0D).endVertex();
    vertexbuffer.pos((double)right, (double)top, 0.0D).endVertex();
    vertexbuffer.pos((double)left, (double)top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:39,代码来源:Gui.java

示例5: render

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
@Override
public void render(Vector3 cameraPos) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buf = tessellator.getBuffer();

    double xPos = this.centreX - cameraPos.getX();
    double zPos = this.centreZ - cameraPos.getZ();

    for (LineStyle line : this.style.getLines()) {
        if (!line.prepare(this.style.getRenderType())) {
            continue;
        }

        double twoPi = Math.PI * 2;
        for (int yBlock : new int[] { this.minY, this.maxY + 1 }) {
            buf.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
            line.applyColour();

            for (int i = 0; i <= 75; i++) {
                double tempTheta = i * twoPi / 75;
                double tempX = this.radX * Math.cos(tempTheta);
                double tempZ = this.radZ * Math.sin(tempTheta);

                buf.pos(xPos + tempX, yBlock - cameraPos.getY(), zPos + tempZ).endVertex();
            }
            tessellator.draw();
        }
    }
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:30,代码来源:RenderCylinderBox.java

示例6: rotateAndBlurSkybox

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
 * Rotate and blurs the skybox view in the main menu
 */
private void rotateAndBlurSkybox(float partialTicks)
{
    this.mc.getTextureManager().bindTexture(this.backgroundTexture);
    GlStateManager.glTexParameteri(3553, 10241, 9729);
    GlStateManager.glTexParameteri(3553, 10240, 9729);
    GlStateManager.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, 256, 256);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.colorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    GlStateManager.disableAlpha();
    int i = 3;

    for (int j = 0; j < 3; ++j)
    {
        float f = 1.0F / (float)(j + 1);
        int k = this.width;
        int l = this.height;
        float f1 = (float)(j - 1) / 256.0F;
        vertexbuffer.pos((double)k, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        vertexbuffer.pos((double)k, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        vertexbuffer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        vertexbuffer.pos(0.0D, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
    }

    tessellator.draw();
    GlStateManager.enableAlpha();
    GlStateManager.colorMask(true, true, true, true);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:35,代码来源:GuiMainMenu.java

示例7: drawContainerBackground

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
protected void drawContainerBackground(Tessellator tessellator)
{
    VertexBuffer buffer = tessellator.getBuffer();
    this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f = 32.0F;
    buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    buffer.pos((double)this.left,  (double)this.bottom, 0.0D).tex((double)((float)this.left  / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
    buffer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
    buffer.pos((double)this.right, (double)this.top,    0.0D).tex((double)((float)this.right / f), (double)((float)(this.top    + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
    buffer.pos((double)this.left,  (double)this.top,    0.0D).tex((double)((float)this.left  / f), (double)((float)(this.top    + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
    tessellator.draw();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:GuiSlot.java

示例8: renderOffsetAABB

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
/**
 * Renders a white box with the bounds of the AABB trasnlated by an offset.
 */
public static void renderOffsetAABB(AxisAlignedBB boundingBox, double x, double y, double z)
{
    GlStateManager.disableTexture2D();
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    vertexbuffer.setTranslation(x, y, z);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_NORMAL);
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    tessellator.draw();
    vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
    GlStateManager.enableTexture2D();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:Render.java

示例9: GuiRenderEvent

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public GuiRenderEvent(Tessellator tessellator, float partialTicks, int mouseX, int mouseY) {
    this.tessellator = tessellator;
    this.builder = tessellator.getBuffer();
    this.partialTicks = partialTicks;
    this.mouseX = mouseX;
    this.mouseY = mouseY;
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:8,代码来源:GuiRenderEvent.java

示例10: drawLine

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public static void drawLine(Vec3d startPos, Vec3d endPos, int color, boolean smooth, float width) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder BufferBuilder = tessellator.getBuffer();

    Vec3d endVecPos = endPos.subtract(startPos);

    float r = (float)(color >> 16 & 255) / 255.0F;
    float g = (float)(color >> 8 & 255) / 255.0F;
    float b = (float)(color & 255) / 255.0F;
    float a = (float)(color >> 24 & 255) / 255.0F;

    if(smooth)
        GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glLineWidth(width);

    GlStateManager.pushMatrix();
    GlStateManager.translate(startPos.x, startPos.y, startPos.z);
    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
    GlStateManager.shadeModel(GL11.GL_SMOOTH);

    BufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
    BufferBuilder.pos(0, 0, 0).color(r, g, b, a).endVertex();
    BufferBuilder.pos(endVecPos.x, endVecPos.y, endVecPos.z).color(r, g, b, a).endVertex();
    tessellator.draw();

    if(smooth)
        GL11.glDisable(GL11.GL_LINE_SMOOTH);

    GlStateManager.shadeModel(GL11.GL_FLAT);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
    GlStateManager.enableDepth();
    GlStateManager.enableCull();
    GlStateManager.popMatrix();
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:41,代码来源:RenderUtils.java

示例11: drawTexturedModalRect

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public void drawTexturedModalRect(float xCoord, float yCoord, float width, float height, int minU, int minV, int maxU, int maxV)
{
    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)(xCoord + 0.0F), (double)(yCoord + (float)height), (double)0).tex((double)((float)(minU + 0) * 0.03125F), (double)((float)(minV + maxV) * 0.03125F)).endVertex();
    vertexbuffer.pos((double)(xCoord + (float)width), (double)(yCoord + (float)height), (double)0).tex((double)((float)(minU + maxU) * 0.03125F), (double)((float)(minV + maxV) * 0.03125F)).endVertex();
    vertexbuffer.pos((double)(xCoord + (float)width), (double)(yCoord + 0.0F), (double)0).tex((double)((float)(minU + maxU) * 0.03125F), (double)((float)(minV + 0) * 0.03125F)).endVertex();
    vertexbuffer.pos((double)(xCoord + 0.0F), (double)(yCoord + 0.0F), (double)0).tex((double)((float)(minU + 0) * 0.03125F), (double)((float)(minV + 0) * 0.03125F)).endVertex();
    tessellator.draw();
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:14,代码来源:GuiObjectTitle.java

示例12: drawTexture

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public static void drawTexture(int x, int y, float u, float v, float uWidth, float vHeight, int width, int height, float tileWidth, float tileHeight)
{
	float f = 1.0F / tileWidth;
       float f1 = 1.0F / tileHeight;
       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder bufferbuilder = tessellator.getBuffer();
       bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
       bufferbuilder.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + vHeight) * f1)).endVertex();
       bufferbuilder.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + uWidth) * f), (double)((v + vHeight) * f1)).endVertex();
       bufferbuilder.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + uWidth) * f), (double)(v * f1)).endVertex();
       bufferbuilder.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
       tessellator.draw();
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:14,代码来源:HarshenClientUtils.java

示例13: loadShader

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public void loadShader(float p_148042_1_)
{
    this.preLoadShader();
    this.framebufferIn.unbindFramebuffer();
    float f = (float)this.framebufferOut.framebufferTextureWidth;
    float f1 = (float)this.framebufferOut.framebufferTextureHeight;
    GlStateManager.viewport(0, 0, (int)f, (int)f1);
    this.manager.addSamplerTexture("DiffuseSampler", this.framebufferIn);

    for (int i = 0; i < this.listAuxFramebuffers.size(); ++i)
    {
        this.manager.addSamplerTexture((String)this.listAuxNames.get(i), this.listAuxFramebuffers.get(i));
        this.manager.getShaderUniformOrDefault("AuxSize" + i).set((float)((Integer)this.listAuxWidths.get(i)).intValue(), (float)((Integer)this.listAuxHeights.get(i)).intValue());
    }

    this.manager.getShaderUniformOrDefault("ProjMat").set(this.projectionMatrix);
    this.manager.getShaderUniformOrDefault("InSize").set((float)this.framebufferIn.framebufferTextureWidth, (float)this.framebufferIn.framebufferTextureHeight);
    this.manager.getShaderUniformOrDefault("OutSize").set(f, f1);
    this.manager.getShaderUniformOrDefault("Time").set(p_148042_1_);
    Minecraft minecraft = Minecraft.getMinecraft();
    this.manager.getShaderUniformOrDefault("ScreenSize").set((float)minecraft.displayWidth, (float)minecraft.displayHeight);
    this.manager.useShader();
    this.framebufferOut.framebufferClear();
    this.framebufferOut.bindFramebuffer(false);
    GlStateManager.depthMask(false);
    GlStateManager.colorMask(true, true, true, true);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos(0.0D, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex();
    vertexbuffer.pos((double)f, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex();
    vertexbuffer.pos((double)f, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex();
    vertexbuffer.pos(0.0D, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex();
    tessellator.draw();
    GlStateManager.depthMask(true);
    GlStateManager.colorMask(true, true, true, true);
    this.manager.endShader();
    this.framebufferOut.unbindFramebuffer();
    this.framebufferIn.unbindFramebufferTexture();

    for (Object object : this.listAuxFramebuffers)
    {
        if (object instanceof Framebuffer)
        {
            ((Framebuffer)object).unbindFramebufferTexture();
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:49,代码来源:Shader.java

示例14: onPipeBoundingBoxRender

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
@SubscribeEvent
public static void onPipeBoundingBoxRender(DrawBlockHighlightEvent event) {
	if (event.getTarget() != null && event.getTarget().typeOfHit == RayTraceResult.Type.BLOCK) {
		BlockPos pos = event.getTarget().getBlockPos();
		EntityPlayer player = event.getPlayer();
		EnumFacing side = event.getTarget().sideHit;
		if (player.world.getBlockState(pos).getBlock() == RegistryManager.pipe
				&& player.world.getTileEntity(pos) != null) {
			TileEntityPipe te = (TileEntityPipe) player.world.getTileEntity(pos);
			float hitX = 0, hitY = 0, hitZ = 0;
			if (side.getAxis() != EnumFacing.Axis.X) {
				hitX = (float) event.getTarget().hitVec.x - pos.getX();
			}
			if (side.getAxis() != EnumFacing.Axis.Y) {
				hitY = (float) event.getTarget().hitVec.y - pos.getY();
			}
			if (side.getAxis() != EnumFacing.Axis.Z) {
				hitZ = (float) event.getTarget().hitVec.z - pos.getZ();
			}
			EnumFacing connection = te.viewedConnection(player, side, hitX, hitY, hitZ);
			event.setCanceled(true);

			GlStateManager.enableBlend();
			GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
					GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
					GlStateManager.DestFactor.ZERO);
			GlStateManager.glLineWidth(2.0F);
			GlStateManager.disableTexture2D();
			GlStateManager.depthMask(false);

			double d0 = player.lastTickPosX
					+ (player.posX - player.lastTickPosX) * (double) event.getPartialTicks();
			double d1 = player.lastTickPosY
					+ (player.posY - player.lastTickPosY) * (double) event.getPartialTicks();
			double d2 = player.lastTickPosZ
					+ (player.posZ - player.lastTickPosZ) * (double) event.getPartialTicks();
			Tessellator tessellator = Tessellator.getInstance();
			BufferBuilder vertexbuffer = tessellator.getBuffer();
			vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
			vertexbuffer.setTranslation(-d0, -d1, -d2);

			if (player.getHeldItem(EnumHand.MAIN_HAND).getItem() == RegistryManager.tuning_fork
					|| player.getHeldItem(EnumHand.OFF_HAND).getItem() == RegistryManager.tuning_fork) {
				drawPipeConnectionAABB(vertexbuffer, connection, pos);
			} else {
				IBlockState blockstate = player.world.getBlockState(pos);
				IExtendedBlockState state = (IExtendedBlockState) blockstate.getBlock().getExtendedState(blockstate,
						player.world, pos);
				drawFullPipeAABB(vertexbuffer, state, pos, player.world);
			}

			tessellator.draw();
			vertexbuffer.setTranslation(0D, 0D, 0D);

			GlStateManager.depthMask(true);
			GlStateManager.enableTexture2D();
			GlStateManager.disableBlend();
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:61,代码来源:BoundingBoxRenderHandler.java

示例15: drawTriangle2D

import net.minecraft.client.renderer.Tessellator; //导入方法依赖的package包/类
public static void drawTriangle2D(double width, float rotation, double x, double y, Color color, int lineWidth)
{
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();

	GlStateManager.translate(x, y, 0);
	GlStateManager.rotate(rotation, 0, 0, 1);
	double p = (3 * width) / 2;
	double area = Math.sqrt((p * (p - width) * (p - width) * (p - width)));
	double height = 2 * (area / width);

	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);

	GL11.glLineWidth(lineWidth);
	Tessellator tes = Tessellator.getInstance();
	BufferBuilder vb = tes.getBuffer();

	GlStateManager.rotate(60f, 0, 0, 1);
	vb.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

	vb.pos(0, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	vb.pos(width, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	tes.draw();

	GlStateManager.rotate(60f, 0, 0, 1);
	vb.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

	vb.pos(0, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	vb.pos(width, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	tes.draw();

	GlStateManager.rotate(60f, 0, 0, 1);
	GlStateManager.translate(0, -height, 0);
	vb.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);

	vb.pos(-width / 2, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	vb.pos(width / 2, 0, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

	tes.draw();

	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GlStateManager.disableBlend();
	GlStateManager.shadeModel(GL11.GL_FLAT);
	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.enableTexture2D();
	GlStateManager.enableAlpha();
	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:61,代码来源:GLHelper.java


注:本文中的net.minecraft.client.renderer.Tessellator.getBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。