當前位置: 首頁>>代碼示例>>Java>>正文


Java VertexBuffer.begin方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.VertexBuffer.begin方法的典型用法代碼示例。如果您正苦於以下問題:Java VertexBuffer.begin方法的具體用法?Java VertexBuffer.begin怎麽用?Java VertexBuffer.begin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.VertexBuffer的用法示例。


在下文中一共展示了VertexBuffer.begin方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: blitIcon

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
private void blitIcon(int p_178051_1_, int p_178051_2_, ResourceLocation p_178051_3_)
{
    int i = p_178051_1_ + 5;
    GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ - 1, -2039584);
    GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ + 32, -6250336);
    GuiScreenCustomizePresets.this.drawVerticalLine(i - 1, p_178051_2_ - 1, p_178051_2_ + 32, -2039584);
    GuiScreenCustomizePresets.this.drawVerticalLine(i + 32, p_178051_2_ - 1, p_178051_2_ + 32, -6250336);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(p_178051_3_);
    int j = 32;
    int k = 32;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double)(i + 0), (double)(p_178051_2_ + 32), 0.0D).tex(0.0D, 1.0D).endVertex();
    vertexbuffer.pos((double)(i + 32), (double)(p_178051_2_ + 32), 0.0D).tex(1.0D, 1.0D).endVertex();
    vertexbuffer.pos((double)(i + 32), (double)(p_178051_2_ + 0), 0.0D).tex(1.0D, 0.0D).endVertex();
    vertexbuffer.pos((double)(i + 0), (double)(p_178051_2_ + 0), 0.0D).tex(0.0D, 0.0D).endVertex();
    tessellator.draw();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:GuiScreenCustomizePresets.java

示例2: drawItemBackground

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
 * Draws the background icon for an item, using a texture from stats.png with the given coords
 */
private void drawItemBackground(int x, int z, int textureX, int textureY)
{
    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)(x + 0), (double)(z + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 0) * 0.0078125F), (double)((float)(textureY + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(x + 18), (double)(z + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 18) * 0.0078125F), (double)((float)(textureY + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(x + 18), (double)(z + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 18) * 0.0078125F), (double)((float)(textureY + 0) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(x + 0), (double)(z + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(textureX + 0) * 0.0078125F), (double)((float)(textureY + 0) * 0.0078125F)).endVertex();
    tessellator.draw();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:21,代碼來源:GuiCreateFlatWorld.java

示例3: renderBoxOutline

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
private static void renderBoxOutline(BlockPos pos) {
    net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
    Minecraft.getMinecraft().entityRenderer.disableLightmap();
    GlStateManager.disableTexture2D();
    GlStateManager.disableBlend();
    GlStateManager.disableLighting();
    GlStateManager.disableAlpha();
    GlStateManager.glLineWidth(2);
    GlStateManager.color(1, 1, 1);

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer buffer = tessellator.getBuffer();
    float mx = pos.getX();
    float my = pos.getY();
    float mz = pos.getZ();
    buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
    RenderHelper.renderHighLightedBlocksOutline(buffer, mx, my, mz, .9f, .7f, 0, 1);

    tessellator.draw();

    Minecraft.getMinecraft().entityRenderer.enableLightmap();
    GlStateManager.enableTexture2D();
}
 
開發者ID:McJty,項目名稱:interactionwheel,代碼行數:24,代碼來源:RenderHandler.java

示例4: renderPortal

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
protected void renderPortal(float timeInPortal, ScaledResolution scaledRes)
{
    if (timeInPortal < 1.0F)
    {
        timeInPortal = timeInPortal * timeInPortal;
        timeInPortal = timeInPortal * timeInPortal;
        timeInPortal = timeInPortal * 0.8F + 0.2F;
    }

    GlStateManager.disableAlpha();
    GlStateManager.disableDepth();
    GlStateManager.depthMask(false);
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.color(1.0F, 1.0F, 1.0F, timeInPortal);
    this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.PORTAL.getDefaultState());
    float f = textureatlassprite.getMinU();
    float f1 = textureatlassprite.getMinV();
    float f2 = textureatlassprite.getMaxU();
    float f3 = textureatlassprite.getMaxV();
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex();
    vertexbuffer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex();
    vertexbuffer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex();
    vertexbuffer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex();
    tessellator.draw();
    GlStateManager.depthMask(true);
    GlStateManager.enableDepth();
    GlStateManager.enableAlpha();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:34,代碼來源:GuiIngame.java

示例5: renderOverlay

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
 * Utility method for rendering a texture as the front-side overlay
 * over a specified horizontal area.
 *
 * @param texture the texture to use to render the overlay.
 * @param u0      the lower end of the vertical area to render at.
 * @param u1      the upper end of the vertical area to render at.
 */
public void renderOverlay(final ResourceLocation texture, final float u0, final float u1) {
    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    final Tessellator t = Tessellator.getInstance();
    final VertexBuffer r = t.getBuffer();
    r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    r.pos(u0, v1, 0).tex(u0, v1).endVertex();
    r.pos(u1, v1, 0).tex(u1, v1).endVertex();
    r.pos(u1, v0, 0).tex(u1, v0).endVertex();
    r.pos(u0, v0, 0).tex(u0, v0).endVertex();
    t.draw();
}
 
開發者ID:Herobone,項目名稱:HeroUtils,代碼行數:20,代碼來源:RackMountableRenderEvent.java

示例6: drawTexturedModalRect

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel)
{
    float uScale = 1f / 0x100;
    float vScale = 1f / 0x100;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer wr = tessellator.getBuffer();
    wr.begin(7, DefaultVertexFormats.POSITION_TEX);
    wr.pos(x        , y + height, zLevel).tex( u          * uScale, ((v + height) * vScale)).endVertex();
    wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex();
    wr.pos(x + width, y         , zLevel).tex((u + width) * uScale, ( v           * vScale)).endVertex();
    wr.pos(x        , y         , zLevel).tex( u          * uScale, ( v           * vScale)).endVertex();
    tessellator.draw();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:14,代碼來源:GuiUtils.java

示例7: renderSkybox

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
 * Renders the skybox in the main menu
 */
private void renderSkybox(int mouseX, int mouseY, float partialTicks) {
	this.mc.getFramebuffer().unbindFramebuffer();
	GlStateManager.viewport(0, 0, 256, 256);
	this.drawPanorama(mouseX, mouseY, partialTicks);
	this.rotateAndBlurSkybox(partialTicks);
	int i = 3;
	CustomPanoramaProperties custompanoramaproperties = CustomPanorama.getCustomPanoramaProperties();

	if (custompanoramaproperties != null) {
		i = custompanoramaproperties.getBlur3();
	}

	for (int j = 0; j < i; ++j) {
		this.rotateAndBlurSkybox(partialTicks);
		this.rotateAndBlurSkybox(partialTicks);
	}

	this.mc.getFramebuffer().bindFramebuffer(true);
	GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
	float f2 = 120.0F / (float) (this.width > this.height ? this.width : this.height);
	float f = (float) this.height * f2 / 256.0F;
	float f1 = (float) this.width * f2 / 256.0F;
	int k = this.width;
	int l = this.height;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexbuffer = tessellator.getBuffer();
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
	vertexbuffer.pos(0.0D, (double) l, (double) this.zLevel).tex((double) (0.5F - f), (double) (0.5F + f1))
			.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
	vertexbuffer.pos((double) k, (double) l, (double) this.zLevel).tex((double) (0.5F - f), (double) (0.5F - f1))
			.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
	vertexbuffer.pos((double) k, 0.0D, (double) this.zLevel).tex((double) (0.5F + f), (double) (0.5F - f1))
			.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
	vertexbuffer.pos(0.0D, 0.0D, (double) this.zLevel).tex((double) (0.5F + f), (double) (0.5F + f1))
			.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
	tessellator.draw();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:41,代碼來源:GuiMainMenu.java

示例8: drawScaledCustomSizeModalRect

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
 * Draws a scaled, textured, tiled modal rect at z = 0. This method isn't used anywhere in vanilla code.
 */
public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight)
{
    float f = 1.0F / tileWidth;
    float f1 = 1.0F / tileHeight;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex();
    vertexbuffer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex();
    vertexbuffer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex();
    vertexbuffer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
    tessellator.draw();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:Gui.java

示例9: drawModalRectWithCustomSizedTexture

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
 * Draws a textured rectangle at z = 0. Args: x, y, u, v, width, height, textureWidth, textureHeight
 */
public static void drawModalRectWithCustomSizedTexture(int x, int y, float u, float v, int width, int height, float textureWidth, float textureHeight)
{
    float f = 1.0F / textureWidth;
    float f1 = 1.0F / textureHeight;
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)height) * f1)).endVertex();
    vertexbuffer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)width) * f), (double)((v + (float)height) * f1)).endVertex();
    vertexbuffer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)width) * f), (double)(v * f1)).endVertex();
    vertexbuffer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
    tessellator.draw();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:Gui.java

示例10: loadShader

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的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:sudofox,項目名稱:Backmemed,代碼行數:49,代碼來源:Shader.java

示例11: drawSplashScreen

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
private void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException
{
    ScaledResolution scaledresolution = new ScaledResolution(this);
    int i = scaledresolution.getScaleFactor();
    Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true);
    framebuffer.bindFramebuffer(false);
    GlStateManager.matrixMode(5889);
    GlStateManager.loadIdentity();
    GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
    GlStateManager.matrixMode(5888);
    GlStateManager.loadIdentity();
    GlStateManager.translate(0.0F, 0.0F, -2000.0F);
    GlStateManager.disableLighting();
    GlStateManager.disableFog();
    GlStateManager.disableDepth();
    GlStateManager.enableTexture2D();
    InputStream inputstream = null;

    try
    {
        inputstream = this.mcDefaultResourcePack.getInputStream(LOCATION_MOJANG_PNG);
        this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream)));
        textureManagerInstance.bindTexture(this.mojangLogo);
    }
    catch (IOException ioexception)
    {
        LOGGER.error("Unable to load logo: {}", new Object[] {LOCATION_MOJANG_PNG, ioexception});
    }
    finally
    {
        IOUtils.closeQuietly(inputstream);
    }

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    vertexbuffer.pos(0.0D, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
    vertexbuffer.pos((double)this.displayWidth, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
    vertexbuffer.pos((double)this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
    vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
    tessellator.draw();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    int j = 256;
    int k = 256;
    this.draw((scaledresolution.getScaledWidth() - 256) / 2, (scaledresolution.getScaledHeight() - 256) / 2, 0, 0, 256, 256, 255, 255, 255, 255);
    GlStateManager.disableLighting();
    GlStateManager.disableFog();
    framebuffer.unbindFramebuffer();
    framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i);
    GlStateManager.enableAlpha();
    GlStateManager.alphaFunc(516, 0.1F);
    this.updateDisplay();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:54,代碼來源:Minecraft.java

示例12: framebufferRenderExt

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
public void framebufferRenderExt(int width, int height, boolean p_178038_3_)
{
    if (OpenGlHelper.isFramebufferEnabled())
    {
        GlStateManager.colorMask(true, true, true, false);
        GlStateManager.disableDepth();
        GlStateManager.depthMask(false);
        GlStateManager.matrixMode(5889);
        GlStateManager.loadIdentity();
        GlStateManager.ortho(0.0D, (double)width, (double)height, 0.0D, 1000.0D, 3000.0D);
        GlStateManager.matrixMode(5888);
        GlStateManager.loadIdentity();
        GlStateManager.translate(0.0F, 0.0F, -2000.0F);
        GlStateManager.viewport(0, 0, width, height);
        GlStateManager.enableTexture2D();
        GlStateManager.disableLighting();
        GlStateManager.disableAlpha();

        if (p_178038_3_)
        {
            GlStateManager.disableBlend();
            GlStateManager.enableColorMaterial();
        }

        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.bindFramebufferTexture();
        float f = (float)width;
        float f1 = (float)height;
        float f2 = (float)this.framebufferWidth / (float)this.framebufferTextureWidth;
        float f3 = (float)this.framebufferHeight / (float)this.framebufferTextureHeight;
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        vertexbuffer.pos(0.0D, (double)f1, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
        vertexbuffer.pos((double)f, (double)f1, 0.0D).tex((double)f2, 0.0D).color(255, 255, 255, 255).endVertex();
        vertexbuffer.pos((double)f, 0.0D, 0.0D).tex((double)f2, (double)f3).color(255, 255, 255, 255).endVertex();
        vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)f3).color(255, 255, 255, 255).endVertex();
        tessellator.draw();
        this.unbindFramebufferTexture();
        GlStateManager.depthMask(true);
        GlStateManager.colorMask(true, true, true, true);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:44,代碼來源:Framebuffer.java

示例13: renderVignette

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
 * Renders a Vignette arount the entire screen that changes with light level.
 */
protected void renderVignette(float lightLevel, ScaledResolution scaledRes)
{
    lightLevel = 1.0F - lightLevel;
    lightLevel = MathHelper.clamp_float(lightLevel, 0.0F, 1.0F);
    WorldBorder worldborder = this.mc.theWorld.getWorldBorder();
    float f = (float)worldborder.getClosestDistance(this.mc.thePlayer);
    double d0 = Math.min(worldborder.getResizeSpeed() * (double)worldborder.getWarningTime() * 1000.0D, Math.abs(worldborder.getTargetSize() - worldborder.getDiameter()));
    double d1 = Math.max((double)worldborder.getWarningDistance(), d0);

    if ((double)f < d1)
    {
        f = 1.0F - (float)((double)f / d1);
    }
    else
    {
        f = 0.0F;
    }

    this.prevVignetteBrightness = (float)((double)this.prevVignetteBrightness + (double)(lightLevel - this.prevVignetteBrightness) * 0.01D);
    GlStateManager.disableDepth();
    GlStateManager.depthMask(false);
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);

    if (f > 0.0F)
    {
        GlStateManager.color(0.0F, f, f, 1.0F);
    }
    else
    {
        GlStateManager.color(this.prevVignetteBrightness, this.prevVignetteBrightness, this.prevVignetteBrightness, 1.0F);
    }

    this.mc.getTextureManager().bindTexture(VIGNETTE_TEX_PATH);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
    vertexbuffer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex();
    vertexbuffer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex();
    vertexbuffer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.depthMask(true);
    GlStateManager.enableDepth();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:50,代碼來源:GuiIngame.java

示例14: doRender

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    if (entity.getBlock() != null)
    {
        IBlockState iblockstate = entity.getBlock();

        if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL)
        {
            World world = entity.getWorldObj();

            if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
            {
                this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
                GlStateManager.pushMatrix();
                GlStateManager.disableLighting();
                Tessellator tessellator = Tessellator.getInstance();
                VertexBuffer vertexbuffer = tessellator.getBuffer();

                if (this.renderOutlines)
                {
                    GlStateManager.enableColorMaterial();
                    GlStateManager.enableOutlineMode(this.getTeamColor(entity));
                }

                vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
                BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
                GlStateManager.translate((float)(x - (double)blockpos.getX() - 0.5D), (float)(y - (double)blockpos.getY()), (float)(z - (double)blockpos.getZ() - 0.5D));
                BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
                blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, vertexbuffer, false, MathHelper.getPositionRandom(entity.getOrigin()));
                tessellator.draw();

                if (this.renderOutlines)
                {
                    GlStateManager.disableOutlineMode();
                    GlStateManager.disableColorMaterial();
                }

                GlStateManager.enableLighting();
                GlStateManager.popMatrix();
                super.doRender(entity, x, y, z, entityYaw, partialTicks);
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:48,代碼來源:RenderFallingBlock.java

示例15: drawScreen

import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
public void drawScreen(int mouseXIn, int mouseYIn, float partialTicks)
{
    if (this.visible)
    {
        this.mouseX = mouseXIn;
        this.mouseY = mouseYIn;
        this.drawBackground();
        int i = this.getScrollBarX();
        int j = i + 6;
        this.bindAmountScrolled();
        GlStateManager.disableLighting();
        GlStateManager.disableFog();
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
        int l = this.top + 4 - (int)this.amountScrolled;

        if (this.hasListHeader)
        {
            this.drawListHeader(k, l, tessellator);
        }

        this.drawSelectionBox(k, l, mouseXIn, mouseYIn);
        GlStateManager.disableDepth();
        this.overlayBackground(0, this.top, 255, 255);
        this.overlayBackground(this.bottom, this.height, 255, 255);
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ZERO, GlStateManager.DestFactor.ONE);
        GlStateManager.disableAlpha();
        GlStateManager.shadeModel(7425);
        GlStateManager.disableTexture2D();
        int i1 = this.getMaxScroll();

        if (i1 > 0)
        {
            int j1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();
            j1 = MathHelper.clamp_int(j1, 32, this.bottom - this.top - 8);
            int k1 = (int)this.amountScrolled * (this.bottom - this.top - j1) / i1 + this.top;

            if (k1 < this.top)
            {
                k1 = this.top;
            }

            vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            vertexbuffer.pos((double)i, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            vertexbuffer.pos((double)j, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            vertexbuffer.pos((double)j, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
            vertexbuffer.pos((double)i, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
            tessellator.draw();
            vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            vertexbuffer.pos((double)i, (double)(k1 + j1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            vertexbuffer.pos((double)j, (double)(k1 + j1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            vertexbuffer.pos((double)j, (double)k1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
            vertexbuffer.pos((double)i, (double)k1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
            tessellator.draw();
            vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            vertexbuffer.pos((double)i, (double)(k1 + j1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            vertexbuffer.pos((double)(j - 1), (double)(k1 + j1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            vertexbuffer.pos((double)(j - 1), (double)k1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex();
            vertexbuffer.pos((double)i, (double)k1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex();
            tessellator.draw();
        }

        this.renderDecorations(mouseXIn, mouseYIn);
        GlStateManager.enableTexture2D();
        GlStateManager.shadeModel(7424);
        GlStateManager.enableAlpha();
        GlStateManager.disableBlend();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:72,代碼來源:GuiSimpleScrolledSelectionListProxy.java


注:本文中的net.minecraft.client.renderer.VertexBuffer.begin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。