java类net.minecraft.client.renderer.Tessellator的实例源码

RenderItem.java 文件源码 项目:BaseClient 阅读 23 收藏 0 点赞 0 评论 0
private void func_181565_a(WorldRenderer p_181565_1_, int p_181565_2_, int p_181565_3_, int p_181565_4_, int p_181565_5_, int p_181565_6_, int p_181565_7_, int p_181565_8_, int p_181565_9_)
{
    p_181565_1_.begin(7, DefaultVertexFormats.POSITION_COLOR);
    p_181565_1_.pos((double)(p_181565_2_ + 0), (double)(p_181565_3_ + 0), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex();
    p_181565_1_.pos((double)(p_181565_2_ + 0), (double)(p_181565_3_ + p_181565_5_), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex();
    p_181565_1_.pos((double)(p_181565_2_ + p_181565_4_), (double)(p_181565_3_ + p_181565_5_), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex();
    p_181565_1_.pos((double)(p_181565_2_ + p_181565_4_), (double)(p_181565_3_ + 0), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex();
    Tessellator.getInstance().draw();
}
TexturedQuad.java 文件源码 项目:Backmemed 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Draw this primitve. This is typically called only once as the generated drawing instructions are saved by the
 * renderer and reused later.
 */
public void draw(VertexBuffer renderer, float scale)
{
    Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D);
    Vec3d vec3d1 = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[2].vector3D);
    Vec3d vec3d2 = vec3d1.crossProduct(vec3d).normalize();
    float f = (float)vec3d2.xCoord;
    float f1 = (float)vec3d2.yCoord;
    float f2 = (float)vec3d2.zCoord;

    if (this.invertNormal)
    {
        f = -f;
        f1 = -f1;
        f2 = -f2;
    }

    if (Config.isShaders())
    {
        renderer.begin(7, SVertexFormat.defVertexFormatTextured);
    }
    else
    {
        renderer.begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL);
    }

    for (int i = 0; i < 4; ++i)
    {
        PositionTextureVertex positiontexturevertex = this.vertexPositions[i];
        renderer.pos(positiontexturevertex.vector3D.xCoord * (double)scale, positiontexturevertex.vector3D.yCoord * (double)scale, positiontexturevertex.vector3D.zCoord * (double)scale).tex((double)positiontexturevertex.texturePositionX, (double)positiontexturevertex.texturePositionY).normal(f, f1, f2).endVertex();
    }

    Tessellator.getInstance().draw();
}
Gui.java 文件源码 项目:BaseClient 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Draws a solid color rectangle with the specified coordinates and color (ARGB format). Args: x1, y1, x2, y2, 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();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION);
    worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
    worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
    worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
    worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
GuiWinGame.java 文件源码 项目:Backmemed 阅读 30 收藏 0 点赞 0 评论 0
private void drawWinGameScreen(int p_146575_1_, int p_146575_2_, float p_146575_3_)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    int i = this.width;
    float f = 0.0F - ((float)this.time + p_146575_3_) * 0.5F * 0.5F;
    float f1 = (float)this.height - ((float)this.time + p_146575_3_) * 0.5F * 0.5F;
    float f2 = 0.015625F;
    float f3 = ((float)this.time + p_146575_3_ - 0.0F) * 0.02F;
    float f4 = (float)(this.totalScrollLength + this.height + this.height + 24) / 0.5F;
    float f5 = (f4 - 20.0F - ((float)this.time + p_146575_3_)) * 0.005F;

    if (f5 < f3)
    {
        f3 = f5;
    }

    if (f3 > 1.0F)
    {
        f3 = 1.0F;
    }

    f3 = f3 * f3;
    f3 = f3 * 96.0F / 255.0F;
    vertexbuffer.pos(0.0D, (double)this.height, (double)this.zLevel).tex(0.0D, (double)(f * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
    vertexbuffer.pos((double)i, (double)this.height, (double)this.zLevel).tex((double)((float)i * 0.015625F), (double)(f * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
    vertexbuffer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)((float)i * 0.015625F), (double)(f1 * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
    vertexbuffer.pos(0.0D, 0.0D, (double)this.zLevel).tex(0.0D, (double)(f1 * 0.015625F)).color(f3, f3, f3, 1.0F).endVertex();
    tessellator.draw();
}
NickGuiTextField.java 文件源码 项目:Lithium-Forge 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 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();
}
HarshenClientUtils.java 文件源码 项目:harshencastle 阅读 21 收藏 0 点赞 0 评论 0
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();
}
RenderUtils.java 文件源码 项目:Backmemed 阅读 25 收藏 0 点赞 0 评论 0
public static void drawNameplate(FontRenderer fontRendererIn, String str, float x, float y, float z, int verticalShift, float viewerYaw, float viewerPitch, boolean isThirdPersonFrontal)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-viewerYaw, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate((float)(isThirdPersonFrontal ? -1 : 1) * viewerPitch, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(-0.025F, -0.025F, 0.025F);
    GlStateManager.disableLighting();
    GlStateManager.depthMask(false);

    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    int i = fontRendererIn.getStringWidth(str) / 2;
    GlStateManager.disableTexture2D();
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos((double)(-i - 1), (double)(-1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    vertexbuffer.pos((double)(-i - 1), (double)(8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    vertexbuffer.pos((double)(i + 1), (double)(8 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    vertexbuffer.pos((double)(i + 1), (double)(-1 + verticalShift), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();

    GlStateManager.depthMask(true);
    fontRendererIn.drawString(str, -fontRendererIn.getStringWidth(str) / 2, verticalShift, -1);
    GlStateManager.enableLighting();
    GlStateManager.disableBlend();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}
GuiWinGame.java 文件源码 项目:BaseClient 阅读 22 收藏 0 点赞 0 评论 0
private void drawWinGameScreen(int p_146575_1_, int p_146575_2_, float p_146575_3_)
{
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    int i = this.width;
    float f = 0.0F - ((float)this.field_146581_h + p_146575_3_) * 0.5F * this.field_146578_s;
    float f1 = (float)this.height - ((float)this.field_146581_h + p_146575_3_) * 0.5F * this.field_146578_s;
    float f2 = 0.015625F;
    float f3 = ((float)this.field_146581_h + p_146575_3_ - 0.0F) * 0.02F;
    float f4 = (float)(this.field_146579_r + this.height + this.height + 24) / this.field_146578_s;
    float f5 = (f4 - 20.0F - ((float)this.field_146581_h + p_146575_3_)) * 0.005F;

    if (f5 < f3)
    {
        f3 = f5;
    }

    if (f3 > 1.0F)
    {
        f3 = 1.0F;
    }

    f3 = f3 * f3;
    f3 = f3 * 96.0F / 255.0F;
    worldrenderer.pos(0.0D, (double)this.height, (double)this.zLevel).tex(0.0D, (double)(f * f2)).color(f3, f3, f3, 1.0F).endVertex();
    worldrenderer.pos((double)i, (double)this.height, (double)this.zLevel).tex((double)((float)i * f2), (double)(f * f2)).color(f3, f3, f3, 1.0F).endVertex();
    worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)((float)i * f2), (double)(f1 * f2)).color(f3, f3, f3, 1.0F).endVertex();
    worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex(0.0D, (double)(f1 * f2)).color(f3, f3, f3, 1.0F).endVertex();
    tessellator.draw();
}
ParticleFootStep.java 文件源码 项目:CustomWorldGen 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Renders the particle
 */
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
    float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge;
    f = f * f;
    float f1 = 2.0F - f * 2.0F;

    if (f1 > 1.0F)
    {
        f1 = 1.0F;
    }

    f1 = f1 * 0.2F;
    GlStateManager.disableLighting();
    float f2 = 0.125F;
    float f3 = (float)(this.posX - interpPosX);
    float f4 = (float)(this.posY - interpPosY);
    float f5 = (float)(this.posZ - interpPosZ);
    float f6 = this.worldObj.getLightBrightness(new BlockPos(this.posX, this.posY, this.posZ));
    this.currentFootSteps.bindTexture(FOOTPRINT_TEXTURE);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    worldRendererIn.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(0.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
    worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(1.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
    worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(1.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
    worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(0.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
    Tessellator.getInstance().draw();
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
}
GuiStreamIndicator.java 文件源码 项目:BaseClient 阅读 20 收藏 0 点赞 0 评论 0
public void render(int p_152437_1_, int p_152437_2_)
{
    if (this.mc.getTwitchStream().isBroadcasting())
    {
        GlStateManager.enableBlend();
        int i = this.mc.getTwitchStream().func_152920_A();

        if (i > 0)
        {
            String s = "" + i;
            int j = this.mc.fontRendererObj.getStringWidth(s);
            int k = 20;
            int l = p_152437_1_ - j - 1;
            int i1 = p_152437_2_ + 20 - 1;
            int j1 = p_152437_2_ + 20 + this.mc.fontRendererObj.FONT_HEIGHT - 1;
            GlStateManager.disableTexture2D();
            Tessellator tessellator = Tessellator.getInstance();
            WorldRenderer worldrenderer = tessellator.getWorldRenderer();
            GlStateManager.color(0.0F, 0.0F, 0.0F, (0.65F + 0.35000002F * this.field_152443_c) / 2.0F);
            worldrenderer.begin(7, DefaultVertexFormats.POSITION);
            worldrenderer.pos((double)l, (double)j1, 0.0D).endVertex();
            worldrenderer.pos((double)p_152437_1_, (double)j1, 0.0D).endVertex();
            worldrenderer.pos((double)p_152437_1_, (double)i1, 0.0D).endVertex();
            worldrenderer.pos((double)l, (double)i1, 0.0D).endVertex();
            tessellator.draw();
            GlStateManager.enableTexture2D();
            this.mc.fontRendererObj.drawString(s, p_152437_1_ - j, p_152437_2_ + 20, 16777215);
        }

        this.render(p_152437_1_, p_152437_2_, this.func_152440_b(), 0);
        this.render(p_152437_1_, p_152437_2_, this.func_152438_c(), 17);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号