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


Java GlStateManager.shadeModel方法代碼示例

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


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

示例1: drawGradientRect

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
/**
 * Draws a rectangle with a vertical gradient between the specified colors (ARGB format). Args : x1, y1, x2, y2,
 * topColor, bottomColor
 */
protected void drawGradientRect(int left, int top, int right, int 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();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos((double)right, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex();
    vertexbuffer.pos((double)left, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex();
    vertexbuffer.pos((double)left, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex();
    vertexbuffer.pos((double)right, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex();
    tessellator.draw();
    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:33,代碼來源:Gui.java

示例2: renderTileEntityAt

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
@Override
public final void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer VertexBuffer = tessellator.getBuffer();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();

    if (Minecraft.isAmbientOcclusionEnabled())
    {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    }
    else
    {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }

    VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

    renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, VertexBuffer);
    VertexBuffer.setTranslation(0, 0, 0);

    tessellator.draw();

    RenderHelper.enableStandardItemLighting();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:30,代碼來源:FastTESR.java

示例3: renderCrystalBeams

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
public static void renderCrystalBeams(double p_188325_0_, double p_188325_2_, double p_188325_4_, float p_188325_6_, double p_188325_7_, double p_188325_9_, double p_188325_11_, int p_188325_13_, double p_188325_14_, double p_188325_16_, double p_188325_18_)
{
    float f = (float)(p_188325_14_ - p_188325_7_);
    float f1 = (float)(p_188325_16_ - 1.0D - p_188325_9_);
    float f2 = (float)(p_188325_18_ - p_188325_11_);
    float f3 = MathHelper.sqrt(f * f + f2 * f2);
    float f4 = MathHelper.sqrt(f * f + f1 * f1 + f2 * f2);
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)p_188325_0_, (float)p_188325_2_ + 2.0F, (float)p_188325_4_);
    GlStateManager.rotate((float)(-Math.atan2((double)f2, (double)f)) * (180F / (float)Math.PI) - 90.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate((float)(-Math.atan2((double)f3, (double)f1)) * (180F / (float)Math.PI) - 90.0F, 1.0F, 0.0F, 0.0F);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableCull();
    GlStateManager.shadeModel(7425);
    float f5 = 0.0F - ((float)p_188325_13_ + p_188325_6_) * 0.01F;
    float f6 = MathHelper.sqrt(f * f + f1 * f1 + f2 * f2) / 32.0F - ((float)p_188325_13_ + p_188325_6_) * 0.01F;
    vertexbuffer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR);
    int i = 8;

    for (int j = 0; j <= 8; ++j)
    {
        float f7 = MathHelper.sin((float)(j % 8) * ((float)Math.PI * 2F) / 8.0F) * 0.75F;
        float f8 = MathHelper.cos((float)(j % 8) * ((float)Math.PI * 2F) / 8.0F) * 0.75F;
        float f9 = (float)(j % 8) / 8.0F;
        vertexbuffer.pos((double)(f7 * 0.2F), (double)(f8 * 0.2F), 0.0D).tex((double)f9, (double)f5).color(0, 0, 0, 255).endVertex();
        vertexbuffer.pos((double)f7, (double)f8, (double)f4).tex((double)f9, (double)f6).color(255, 255, 255, 255).endVertex();
    }

    tessellator.draw();
    GlStateManager.enableCull();
    GlStateManager.shadeModel(7424);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:37,代碼來源:RenderDragon.java

示例4: drawGradientRect

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor)
{
    float startAlpha = (float)(startColor >> 24 & 255) / 255.0F;
    float startRed = (float)(startColor >> 16 & 255) / 255.0F;
    float startGreen = (float)(startColor >> 8 & 255) / 255.0F;
    float startBlue = (float)(startColor & 255) / 255.0F;
    float endAlpha = (float)(endColor >> 24 & 255) / 255.0F;
    float endRed = (float)(endColor >> 16 & 255) / 255.0F;
    float endGreen = (float)(endColor >> 8 & 255) / 255.0F;
    float endBlue = (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();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
    vertexbuffer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex();
    vertexbuffer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
    vertexbuffer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex();
    tessellator.draw();

    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:32,代碼來源:GuiUtils.java

示例5: drawGradientRect

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
/**
 * Draws a rectangle with a vertical gradient between the specified colors (ARGB format). Args : x1, y1, x2, y2,
 * topColor, bottomColor
 */
protected void drawGradientRect(int left, int top, int right, int 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((double)right, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos((double)left, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos((double)left, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex();
    worldrenderer.pos((double)right, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex();
    tessellator.draw();
    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:33,代碼來源:Gui.java

示例6: drawBatch

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
/**
 * Render all TESRs batched so far.
 * You probably shouldn't call this manually.
 */
public void drawBatch(int pass)
{
    renderEngine.bindTexture(net.minecraft.client.renderer.texture.TextureMap.LOCATION_BLOCKS_TEXTURE);
    net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();

    if (net.minecraft.client.Minecraft.isAmbientOcclusionEnabled())
    {
        GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_SMOOTH);
    }
    else
    {
        GlStateManager.shadeModel(org.lwjgl.opengl.GL11.GL_FLAT);
    }

    if(pass > 0)
    {
        batchBuffer.getBuffer().sortVertexData((float)staticPlayerX, (float)staticPlayerY, (float)staticPlayerZ);
    }
    batchBuffer.draw();

    net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting();
    drawingBatch = false;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:31,代碼來源:TileEntityRendererDispatcher.java

示例7: drawScreen

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

示例8: drawScreen

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
public void drawScreen(int mouseXIn, int mouseYIn, float p_148128_3_)
{
    if (this.field_178041_q)
    {
        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();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        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();
        int i1 = 4;
        this.overlayBackground(0, this.top, 255, 255);
        this.overlayBackground(this.bottom, this.height, 255, 255);
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
        GlStateManager.disableAlpha();
        GlStateManager.shadeModel(7425);
        GlStateManager.disableTexture2D();
        int j1 = this.func_148135_f();

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

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

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

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

示例9: drawRechargeRay

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
/**
 * Draws the ray from the dragon to it's crystal
 */
protected void drawRechargeRay(EntityDragon dragon, double p_180574_2_, double p_180574_4_, double p_180574_6_, float p_180574_8_)
{
    float f = (float)dragon.healingEnderCrystal.innerRotation + p_180574_8_;
    float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F;
    f1 = (f1 * f1 + f1) * 0.2F;
    float f2 = (float)(dragon.healingEnderCrystal.posX - dragon.posX - (dragon.prevPosX - dragon.posX) * (double)(1.0F - p_180574_8_));
    float f3 = (float)((double)f1 + dragon.healingEnderCrystal.posY - 1.0D - dragon.posY - (dragon.prevPosY - dragon.posY) * (double)(1.0F - p_180574_8_));
    float f4 = (float)(dragon.healingEnderCrystal.posZ - dragon.posZ - (dragon.prevPosZ - dragon.posZ) * (double)(1.0F - p_180574_8_));
    float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4);
    float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4);
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)p_180574_2_, (float)p_180574_4_ + 2.0F, (float)p_180574_6_);
    GlStateManager.rotate((float)(-Math.atan2((double)f4, (double)f2)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate((float)(-Math.atan2((double)f5, (double)f3)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableCull();
    this.bindTexture(enderDragonCrystalBeamTextures);
    GlStateManager.shadeModel(7425);
    float f7 = 0.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F;
    float f8 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F;
    worldrenderer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR);
    int i = 8;

    for (int j = 0; j <= 8; ++j)
    {
        float f9 = MathHelper.sin((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F;
        float f10 = MathHelper.cos((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F;
        float f11 = (float)(j % 8) * 1.0F / 8.0F;
        worldrenderer.pos((double)(f9 * 0.2F), (double)(f10 * 0.2F), 0.0D).tex((double)f11, (double)f8).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double)f9, (double)f10, (double)f6).tex((double)f11, (double)f7).color(255, 255, 255, 255).endVertex();
    }

    tessellator.draw();
    GlStateManager.enableCull();
    GlStateManager.shadeModel(7424);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:44,代碼來源:RenderDragon.java

示例10: drawTriangle2D

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的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

示例11: renderFancyBeams2D

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
public static void renderFancyBeams2D(double x, double y, Color color, long seed, long continuousTick, float scale,
		int countFancy, int countNormal)
{
	int dstJump = 16;
	Random rand = new Random(seed);
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();
	GlStateManager.translate(x, y, 0);
	int fancy_count = !FMLClientHandler.instance().getClient().gameSettings.fancyGraphics ? countNormal
			: countFancy;

	Tessellator tes = Tessellator.getInstance();
	BufferBuilder vb = tes.getBuffer();

	RenderHelper.disableStandardItemLighting();
	float rotateSpeed = continuousTick / 1000.0F;
	float beamSize = 0.9F;

	GlStateManager.disableTexture2D();
	GlStateManager.shadeModel(GL11.GL_SMOOTH);
	GlStateManager.enableBlend();
	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
	GlStateManager.depthMask(false);
	GlStateManager.pushMatrix();
	for (int i = 0; i < fancy_count; i++)
	{
		GlStateManager.rotate(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
		GlStateManager.rotate(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);

		// Animate the beams spinning
		GlStateManager.rotate(rand.nextFloat() * 360.0F + rotateSpeed * 360.0F, 0.0F, 0.0F, 1.0F);

		vb.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
		// length and width of the individual beams
		float length = (rand.nextFloat() * 20.0F + 5.0F + beamSize * 10.0F)
				/ (30.0F / (Math.min(dstJump, 10 * scale) / 10.0F));
		length *= 90;
		float width = 3;

		vb.pos(0, 0, 0)
				.color(color.getRed(), color.getGreen(), color.getBlue(), (int) (255.0F * (1.0F - beamSize)) * 10)
				.endVertex();
		vb.pos(-0.7D * width, length, -0.5F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0)
				.endVertex();
		vb.pos(0.7D * width, length, -0.5F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0)
				.endVertex();
		vb.pos(0.0D, length, 1.0F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0).endVertex();
		vb.pos(-0.7D * width, length, -0.5F * width).color(color.getRed(), color.getGreen(), color.getBlue(), 0)
				.endVertex();
		tes.draw();
	}
	GlStateManager.popMatrix();
	GlStateManager.depthMask(true);
	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();
	RenderHelper.enableStandardItemLighting();

	GlStateManager.popAttrib();
	GlStateManager.popMatrix();
}
 
開發者ID:raphydaphy,項目名稱:ArcaneMagic,代碼行數:65,代碼來源:GLHelper.java

示例12: renderTileEntityAt

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (iblockstate.getMaterial() != Material.AIR && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
        vertexbuffer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
        World world = this.getWorld();

        if (block == Blocks.PISTON_HEAD && te.getProgress(partialTicks) < 0.5F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.STICKY_PISTON ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.renderStateModel(blockpos, iblockstate1, vertexbuffer, world, true);
            vertexbuffer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate = iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, true);
        }
        else
        {
            this.renderStateModel(blockpos, iblockstate, vertexbuffer, world, false);
        }

        vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:56,代碼來源:TileEntityPistonRenderer.java

示例13: renderTileEntityAt

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage)
{
    BlockPos blockpos = te.getPos();
    IBlockState iblockstate = te.getPistonState();
    Block block = iblockstate.getBlock();

    if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F)
    {
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        this.bindTexture(TextureMap.locationBlocksTexture);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.blendFunc(770, 771);
        GlStateManager.enableBlend();
        GlStateManager.disableCull();

        if (Minecraft.isAmbientOcclusionEnabled())
        {
            GlStateManager.shadeModel(7425);
        }
        else
        {
            GlStateManager.shadeModel(7424);
        }

        worldrenderer.begin(7, DefaultVertexFormats.BLOCK);
        worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks)));
        World world = this.getWorld();

        if (block == Blocks.piston_head && te.getProgress(partialTicks) < 0.5F)
        {
            iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else if (te.shouldPistonHeadBeRendered() && !te.isExtending())
        {
            BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.sticky_piston ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT;
            IBlockState iblockstate1 = Blocks.piston_head.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING));
            iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate1, world, blockpos), iblockstate1, blockpos, worldrenderer, true);
            worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ()));
            iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true));
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true);
        }
        else
        {
            this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, false);
        }

        worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
        tessellator.draw();
        RenderHelper.enableStandardItemLighting();
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:55,代碼來源:TileEntityPistonRenderer.java

示例14: onWorldLastRender

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldLastRender(RenderWorldLastEvent evt)
{
	World world = Minecraft.getMinecraft().theWorld;
	EntityPlayer player = Minecraft.getMinecraft().thePlayer;
	
   double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.partialTicks;
   double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.partialTicks;
   double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.partialTicks;
	
	GlStateManager.pushMatrix();
	GlStateManager.pushAttrib();
	
	GL11.glTranslated(-x, -y, -z);

	GlStateManager.disableTexture2D();
	GlStateManager.disableLighting();
	
	int shade_model = GL11.glGetInteger(GL11.GL_SHADE_MODEL);
	GlStateManager.shadeModel(GL11.GL_SMOOTH);
	
	GL11.glLineWidth(3);

	GL11.glBegin(GL11.GL_LINES);
	
	//display link process
	PlayerProperties props = (PlayerProperties)player.getExtendedProperties(PlayerProperties.ID);

	if(props != null && props.p_link != null 
			&& props.p_link.distanceSq(x,y+1,z) <= FundamentalChemistry.MAX_RELAY_DISTANCE-1f){ //distance check with some margin
		GlStateManager.color(0f,1f,0.5f,1f);
		GL11.glVertex3d(props.p_link.getX()+0.5, props.p_link.getY()+FundamentalChemistry.LASER_HEIGHT, props.p_link.getZ()+0.5);
		GlStateManager.color(0f,0.5f,1f,1f);
		GL11.glVertex3d(x, y+1, z);
	}

	for(TileEntity te : world.loadedTileEntityList){
		if(te instanceof TileLaserRelay){
			TileLaserRelay ent = (TileLaserRelay)te;
			
			// change matrix for absolute coordinates
			BlockPos cpos = ent.getPos();

			for(BlockPos pos : ent.inputs){
				TileEntity ce = te.getWorld().getTileEntity(pos);
				if(ce != null && ce instanceof TileLaserRelay && (player.getPosition().distanceSq(pos.getX(),pos.getY(),pos.getZ()) <= 500 
						|| player.getPosition().distanceSq(cpos.getX(),cpos.getY(),cpos.getZ()) <= 500)){
					//add height shift if it is a circular connections
					TileLaserRelay cent = (TileLaserRelay)ce;
					float shift = 0;
					if(cent.inputs.contains(cpos) && cpos.hashCode() < pos.hashCode())
						shift = 1/16.0f*2;
					
					//draw connection
					GlStateManager.color(0f,0.5f,1f,1f);
					GL11.glVertex3d(cpos.getX()+0.5, cpos.getY()+FundamentalChemistry.LASER_HEIGHT-shift, cpos.getZ()+0.5);
					GlStateManager.color(0f,1f,0.5f,1f);
					GL11.glVertex3d(pos.getX()+0.5, pos.getY()+FundamentalChemistry.LASER_HEIGHT-shift, pos.getZ()+0.5);
				}
			}
		}
	}
	
	GL11.glEnd();
	
	GlStateManager.shadeModel(shade_model);
	
	GlStateManager.enableTexture2D();
	GlStateManager.enableLighting();
	
	GlStateManager.popMatrix();
	GlStateManager.popAttrib();
}
 
開發者ID:ImagicTheCat,項目名稱:FundamentalChemistry,代碼行數:74,代碼來源:ClientEventHandler.java

示例15: doRenderLayer

import net.minecraft.client.renderer.GlStateManager; //導入方法依賴的package包/類
public void doRenderLayer(EntityDragon entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
    if (entitylivingbaseIn.deathTicks > 0)
    {
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        RenderHelper.disableStandardItemLighting();
        float f = ((float)entitylivingbaseIn.deathTicks + partialTicks) / 200.0F;
        float f1 = 0.0F;

        if (f > 0.8F)
        {
            f1 = (f - 0.8F) / 0.2F;
        }

        Random random = new Random(432L);
        GlStateManager.disableTexture2D();
        GlStateManager.shadeModel(7425);
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(770, 1);
        GlStateManager.disableAlpha();
        GlStateManager.enableCull();
        GlStateManager.depthMask(false);
        GlStateManager.pushMatrix();
        GlStateManager.translate(0.0F, -1.0F, -2.0F);

        for (int i = 0; (float)i < (f + f * f) / 2.0F * 60.0F; ++i)
        {
            GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
            GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GlStateManager.rotate(random.nextFloat() * 360.0F + f * 90.0F, 0.0F, 0.0F, 1.0F);
            float f2 = random.nextFloat() * 20.0F + 5.0F + f1 * 10.0F;
            float f3 = random.nextFloat() * 2.0F + 1.0F + f1 * 2.0F;
            worldrenderer.begin(6, DefaultVertexFormats.POSITION_COLOR);
            worldrenderer.pos(0.0D, 0.0D, 0.0D).color(255, 255, 255, (int)(255.0F * (1.0F - f1))).endVertex();
            worldrenderer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex();
            worldrenderer.pos(0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex();
            worldrenderer.pos(0.0D, (double)f2, (double)(1.0F * f3)).color(255, 0, 255, 0).endVertex();
            worldrenderer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex();
            tessellator.draw();
        }

        GlStateManager.popMatrix();
        GlStateManager.depthMask(true);
        GlStateManager.disableCull();
        GlStateManager.disableBlend();
        GlStateManager.shadeModel(7424);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.enableTexture2D();
        GlStateManager.enableAlpha();
        RenderHelper.enableStandardItemLighting();
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:57,代碼來源:LayerEnderDragonDeath.java


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