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

RenderHandler.java 文件源码 项目:interactionwheel 阅读 32 收藏 0 点赞 0 评论 0
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();
}
SVertexBuilder.java 文件源码 项目:Backmemed 阅读 25 收藏 0 点赞 0 评论 0
public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, VertexBuffer wrr)
{
    Block block = blockState.getBlock();
    int i;
    int j;

    if (blockState instanceof BlockStateBase)
    {
        BlockStateBase blockstatebase = (BlockStateBase)blockState;
        i = blockstatebase.getBlockId();
        j = blockstatebase.getMetadata();
    }
    else
    {
        i = Block.getIdFromBlock(block);
        j = block.getMetaFromState(blockState);
    }

    i = BlockAliases.getMappedBlockId(i, j);
    int i1 = block.getRenderType(blockState).ordinal();
    int k = ((i1 & 65535) << 16) + (i & 65535);
    int l = j & 65535;
    wrr.sVertexBuilder.pushEntity(((long)l << 32) + (long)k);
}
SVertexBuilder.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
public static void endAddVertex(VertexBuffer wrr)
{
    SVertexBuilder svertexbuilder = wrr.sVertexBuilder;

    if (svertexbuilder.vertexSize == 14)
    {
        if (wrr.drawMode == 7 && wrr.vertexCount % 4 == 0)
        {
            svertexbuilder.calcNormal(wrr, wrr.getBufferSize() - 4 * svertexbuilder.vertexSize);
        }

        long i = svertexbuilder.entityData[svertexbuilder.entityDataIndex];
        int j = wrr.getBufferSize() - 14 + 12;
        wrr.rawIntBuffer.put(j, (int)i);
        wrr.rawIntBuffer.put(j + 1, (int)(i >> 32));
    }
}
TileEntityStructureRenderer.java 文件源码 项目:CustomWorldGen 阅读 18 收藏 0 点赞 0 评论 0
private void renderBox(Tessellator p_190055_1_, VertexBuffer p_190055_2_, double p_190055_3_, double p_190055_5_, double p_190055_7_, double p_190055_9_, double p_190055_11_, double p_190055_13_, int p_190055_15_, int p_190055_16_, int p_190055_17_)
{
    GlStateManager.glLineWidth(2.0F);
    p_190055_2_.begin(3, DefaultVertexFormats.POSITION_COLOR);
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_17_, p_190055_17_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_7_).color(p_190055_17_, p_190055_17_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_17_, p_190055_16_, p_190055_17_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_3_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_13_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_11_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color(p_190055_16_, p_190055_16_, p_190055_16_, p_190055_15_).endVertex();
    p_190055_2_.pos(p_190055_9_, p_190055_5_, p_190055_7_).color((float)p_190055_16_, (float)p_190055_16_, (float)p_190055_16_, 0.0F).endVertex();
    p_190055_1_.draw();
    GlStateManager.glLineWidth(1.0F);
}
LightUtil.java 文件源码 项目:CustomWorldGen 阅读 25 收藏 0 点赞 0 评论 0
public static void renderQuadColorSlow(VertexBuffer wr, BakedQuad quad, int auxColor)
{
    ItemConsumer cons;
    if(wr == Tessellator.getInstance().getBuffer())
    {
        cons = getItemConsumer();
    }
    else
    {
        cons = new ItemConsumer(new VertexBufferConsumer(wr));
    }
    float b = (float)(auxColor & 0xFF) / 0xFF;
    float g = (float)((auxColor >>> 8) & 0xFF) / 0xFF;
    float r = (float)((auxColor >>> 16) & 0xFF) / 0xFF;
    float a = (float)((auxColor >>> 24) & 0xFF) / 0xFF;

    cons.setAuxColor(r, g, b, a);
    quad.pipe(cons);
}
Barrier.java 文件源码 项目:Backmemed 阅读 34 收藏 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 = this.particleTexture.getMinU();
    float f1 = this.particleTexture.getMaxU();
    float f2 = this.particleTexture.getMinV();
    float f3 = this.particleTexture.getMaxV();
    float f4 = 0.5F;
    float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
    float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
    float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
    int i = this.getBrightnessForRender(partialTicks);
    int j = i >> 16 & 65535;
    int k = i & 65535;
    worldRendererIn.pos((double)(f5 - rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 - rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 + rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 + rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
}
Barrier.java 文件源码 项目:CustomWorldGen 阅读 27 收藏 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 = this.particleTexture.getMinU();
    float f1 = this.particleTexture.getMaxU();
    float f2 = this.particleTexture.getMinV();
    float f3 = this.particleTexture.getMaxV();
    float f4 = 0.5F;
    float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
    float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
    float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
    int i = this.getBrightnessForRender(partialTicks);
    int j = i >> 16 & 65535;
    int k = i & 65535;
    worldRendererIn.pos((double)(f5 - rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 - rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 - rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 + rotationX * 0.5F + rotationXY * 0.5F), (double)(f6 + rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F + rotationXZ * 0.5F)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
    worldRendererIn.pos((double)(f5 + rotationX * 0.5F - rotationXY * 0.5F), (double)(f6 - rotationZ * 0.5F), (double)(f7 + rotationYZ * 0.5F - rotationXZ * 0.5F)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
}
ParticleManager.java 文件源码 项目:Backmemed 阅读 22 收藏 0 点赞 0 评论 0
public void renderLitParticles(Entity entityIn, float partialTick)
{
    float f = 0.017453292F;
    float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F);
    float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F);
    float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
    float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F);
    float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F);

    for (int i = 0; i < 2; ++i)
    {
        Queue<Particle> queue = this.fxLayers[3][i];

        if (!queue.isEmpty())
        {
            Tessellator tessellator = Tessellator.getInstance();
            VertexBuffer vertexbuffer = tessellator.getBuffer();

            for (Particle particle : queue)
            {
                particle.renderParticle(vertexbuffer, entityIn, partialTick, f1, f5, f2, f3, f4);
            }
        }
    }
}
GuiCreateFlatWorld.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
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();
}
ModelRenderer.java 文件源码 项目:Backmemed 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Compiles a GL display list for this model
 */
private void compileDisplayList(float scale)
{
    if (this.displayList == 0)
    {
        this.savedScale = scale;
        this.displayList = GLAllocation.generateDisplayLists(1);
    }

    GlStateManager.glNewList(this.displayList, 4864);
    VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer();

    for (int i = 0; i < this.cubeList.size(); ++i)
    {
        ((ModelBox)this.cubeList.get(i)).render(vertexbuffer, scale);
    }

    for (int j = 0; j < this.spriteList.size(); ++j)
    {
        ModelSprite modelsprite = (ModelSprite)this.spriteList.get(j);
        modelsprite.render(Tessellator.getInstance(), scale);
    }

    GlStateManager.glEndList();
    this.compiled = true;
}
GuiStats.java 文件源码 项目:CustomWorldGen 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Draws a sprite from assets/textures/gui/container/stats_icons.png
 */
private void drawSprite(int p_146527_1_, int p_146527_2_, int p_146527_3_, int p_146527_4_)
{
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(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_146527_1_ + 0), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex();
    vertexbuffer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex();
    tessellator.draw();
}
DebugRendererPathfinding.java 文件源码 项目:Backmemed 阅读 30 收藏 0 点赞 0 评论 0
public void renderPathLine(float p_190067_1_, Path p_190067_2_)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);

    for (int i = 0; i < p_190067_2_.getCurrentPathLength(); ++i)
    {
        PathPoint pathpoint = p_190067_2_.getPathPointFromIndex(i);

        if (this.addDistanceToPlayer(pathpoint) <= 40.0F)
        {
            float f = (float)i / (float)p_190067_2_.getCurrentPathLength() * 0.33F;
            int j = i == 0 ? 0 : MathHelper.hsvToRGB(f, 0.9F, 0.9F);
            int k = j >> 16 & 255;
            int l = j >> 8 & 255;
            int i1 = j & 255;
            vertexbuffer.pos((double)pathpoint.xCoord - this.xo + 0.5D, (double)pathpoint.yCoord - this.yo + 0.5D, (double)pathpoint.zCoord - this.zo + 0.5D).color(k, l, i1, 255).endVertex();
        }
    }

    tessellator.draw();
}
ParticleCrit.java 文件源码 项目:CustomWorldGen 阅读 22 收藏 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.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    this.particleScale = this.oSize * f;
    super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
RackMountableRenderEvent.java 文件源码 项目:HeroUtils 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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();
}
RackMountableRenderEvent.java 文件源码 项目:HeroUtils 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Utility method for rendering an atlas texture as the front-side overlay
 * over a specified horizontal area.
 *
 * @param texture the atlas 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 renderOverlayFromAtlas(final ResourceLocation texture, final float u0, final float u1) {
    Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    final TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString());
    final Tessellator t = Tessellator.getInstance();
    final VertexBuffer r = t.getBuffer();
    r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    r.pos(u0, v1, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v1 * 16)).endVertex();
    r.pos(u1, v1, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v1 * 16)).endVertex();
    r.pos(u1, v0, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v0 * 16)).endVertex();
    r.pos(u0, v0, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v0 * 16)).endVertex();
    t.draw();
}
Gui.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Draws a texture rectangle using the texture currently bound to the TextureManager
 */
public void drawTexturedModalRect(int xCoord, int yCoord, TextureAtlasSprite textureSprite, int widthIn, int heightIn)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    vertexbuffer.pos((double)(xCoord + 0), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMaxV()).endVertex();
    vertexbuffer.pos((double)(xCoord + widthIn), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMaxV()).endVertex();
    vertexbuffer.pos((double)(xCoord + widthIn), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMinV()).endVertex();
    vertexbuffer.pos((double)(xCoord + 0), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMinV()).endVertex();
    tessellator.draw();
}
Minecraft.java 文件源码 项目:CustomWorldGen 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Draw with the WorldRenderer
 */
public void draw(int posX, int posY, int texU, int texV, int width, int height, int red, int green, int blue, int alpha)
{
    VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    float f = 0.00390625F;
    float f1 = 0.00390625F;
    vertexbuffer.pos((double)posX, (double)(posY + height), 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    vertexbuffer.pos((double)(posX + width), (double)(posY + height), 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    vertexbuffer.pos((double)(posX + width), (double)posY, 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    vertexbuffer.pos((double)posX, (double)posY, 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    Tessellator.getInstance().draw();
}
GuiButtonArrow.java 文件源码 项目:WirelessRedstone 阅读 18 收藏 0 点赞 0 评论 0
private void drawArrow(int x, int y, int colour)
{
    TextureUtils.changeTexture("wrcbe:textures/gui/arrow.png");

    new ColourARGB(colour).glColour();
    Tessellator t = Tessellator.getInstance();
    VertexBuffer buffer = t.getBuffer();
    buffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    buffer.pos(x + 0, y + 8, zLevel).tex( arrowdirection * 0.25, 1).endVertex();
    buffer.pos(x + 8, y + 8, zLevel).tex( (arrowdirection + 1) * 0.25, 1).endVertex();
    buffer.pos(x + 8, y + 0, zLevel).tex( (arrowdirection + 1) * 0.25, 0).endVertex();
    buffer.pos(x + 0, y + 0, zLevel).tex( arrowdirection * 0.25, 0).endVertex();
    t.draw();
}
OBJModel.java 文件源码 项目:MrglgaghCore 阅读 27 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
public void tessellate(VertexBuffer vb){
    vb.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_NORMAL);
    for (Triple<Point3i, Point3i, Point3i> face : faces) {
        vb.pos(vertices.get(face.getLeft().x).x, vertices.get(face.getLeft().x).y, vertices.get(face.getLeft().x).z)
                .tex(uvs.get(face.getLeft().y).x, uvs.get(face.getLeft().y).y)
                .normal(normals.get(face.getLeft().z).x, normals.get(face.getLeft().z).y, normals.get(face.getLeft().z).z).endVertex();
        vb.pos(vertices.get(face.getMiddle().x).x, vertices.get(face.getMiddle().x).y, vertices.get(face.getMiddle().x).z)
                .tex(uvs.get(face.getMiddle().y).x, uvs.get(face.getMiddle().y).y)
                .normal(normals.get(face.getMiddle().z).x, normals.get(face.getMiddle().z).y, normals.get(face.getMiddle().z).z).endVertex();
        vb.pos(vertices.get(face.getRight().x).x, vertices.get(face.getRight().x).y, vertices.get(face.getRight().x).z)
                .tex(uvs.get(face.getRight().y).x, uvs.get(face.getRight().y).y)
                .normal(normals.get(face.getRight().z).x, normals.get(face.getRight().z).y, normals.get(face.getRight().z).z).endVertex();
    }
}
DankNullRenderItem.java 文件源码 项目:DankNull 阅读 24 收藏 0 点赞 0 评论 0
private void draw(VertexBuffer renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha) {
    renderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    renderer.pos(x + 0, y + 0, 0.0D).color(red, green, blue, alpha).endVertex();
    renderer.pos(x + 0, y + height, 0.0D).color(red, green, blue, alpha).endVertex();
    renderer.pos(x + width, y + height, 0.0D).color(red, green, blue, alpha).endVertex();
    renderer.pos(x + width, y + 0, 0.0D).color(red, green, blue, alpha).endVertex();
    Tessellator.getInstance().draw();
}
GuiCustomizeWorldScreen.java 文件源码 项目:CustomWorldGen 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawDefaultBackground();
    this.list.drawScreen(mouseX, mouseY, partialTicks);
    this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 2, 16777215);
    this.drawCenteredString(this.fontRendererObj, this.subtitle, this.width / 2, 12, 16777215);
    this.drawCenteredString(this.fontRendererObj, this.pageTitle, this.width / 2, 22, 16777215);
    super.drawScreen(mouseX, mouseY, partialTicks);

    if (this.confirmMode != 0)
    {
        drawRect(0, 0, this.width, this.height, Integer.MIN_VALUE);
        this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 99, -2039584);
        this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 185, -6250336);
        this.drawVerticalLine(this.width / 2 - 91, 99, 185, -2039584);
        this.drawVerticalLine(this.width / 2 + 90, 99, 185, -6250336);
        float f = 85.0F;
        float f1 = 180.0F;
        GlStateManager.disableLighting();
        GlStateManager.disableFog();
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        this.mc.getTextureManager().bindTexture(OPTIONS_BACKGROUND);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        float f2 = 32.0F;
        vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        vertexbuffer.pos((double)(this.width / 2 - 90), 185.0D, 0.0D).tex(0.0D, 2.65625D).color(64, 64, 64, 64).endVertex();
        vertexbuffer.pos((double)(this.width / 2 + 90), 185.0D, 0.0D).tex(5.625D, 2.65625D).color(64, 64, 64, 64).endVertex();
        vertexbuffer.pos((double)(this.width / 2 + 90), 100.0D, 0.0D).tex(5.625D, 0.0D).color(64, 64, 64, 64).endVertex();
        vertexbuffer.pos((double)(this.width / 2 - 90), 100.0D, 0.0D).tex(0.0D, 0.0D).color(64, 64, 64, 64).endVertex();
        tessellator.draw();
        this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirmTitle", new Object[0]), this.width / 2, 105, 16777215);
        this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm1", new Object[0]), this.width / 2, 125, 16777215);
        this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm2", new Object[0]), this.width / 2, 135, 16777215);
        this.confirm.drawButton(this.mc, mouseX, mouseY);
        this.cancel.drawButton(this.mc, mouseX, mouseY);
    }
}
ParticleFallingDust.java 文件源码 项目:CustomWorldGen 阅读 26 收藏 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.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    this.particleScale = this.oSize * f;
    super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
LightUtil.java 文件源码 项目:CustomWorldGen 阅读 26 收藏 0 点赞 0 评论 0
public static IVertexConsumer getTessellator()
{
    if(tessellator == null)
    {
        Tessellator tes = Tessellator.getInstance();
        VertexBuffer wr = tes.getBuffer();
        tessellator = new VertexBufferConsumer(wr);
    }
    return tessellator;
}
Gui.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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();
}
Lagometer.java 文件源码 项目:Backmemed 阅读 22 收藏 0 点赞 0 评论 0
private static long renderTime(int p_renderTime_0_, long p_renderTime_1_, int p_renderTime_3_, int p_renderTime_4_, int p_renderTime_5_, float p_renderTime_6_, VertexBuffer p_renderTime_7_)
{
    long i = p_renderTime_1_ / 200000L;

    if (i < 3L)
    {
        return 0L;
    }
    else
    {
        p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ - (float)i + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex();
        p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex();
        return i;
    }
}
ParticleSnowShovel.java 文件源码 项目:CustomWorldGen 阅读 16 收藏 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.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    this.particleScale = this.snowDigParticleScale * f;
    super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
Gui.java 文件源码 项目:Backmemed 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Draws a textured rectangle using the texture currently bound to the TextureManager
 */
public void drawTexturedModalRect(float xCoord, float yCoord, 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)maxV), (double)this.zLevel).tex((double)((float)(minU + 0) * 0.00390625F), (double)((float)(minV + maxV) * 0.00390625F)).endVertex();
    vertexbuffer.pos((double)(xCoord + (float)maxU), (double)(yCoord + (float)maxV), (double)this.zLevel).tex((double)((float)(minU + maxU) * 0.00390625F), (double)((float)(minV + maxV) * 0.00390625F)).endVertex();
    vertexbuffer.pos((double)(xCoord + (float)maxU), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + maxU) * 0.00390625F), (double)((float)(minV + 0) * 0.00390625F)).endVertex();
    vertexbuffer.pos((double)(xCoord + 0.0F), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + 0) * 0.00390625F), (double)((float)(minV + 0) * 0.00390625F)).endVertex();
    tessellator.draw();
}
Minecraft.java 文件源码 项目:Backmemed 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Draw with the WorldRenderer
 */
public void draw(int posX, int posY, int texU, int texV, int width, int height, int red, int green, int blue, int alpha)
{
    VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    float f = 0.00390625F;
    float f1 = 0.00390625F;
    vertexbuffer.pos((double)posX, (double)(posY + height), 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    vertexbuffer.pos((double)(posX + width), (double)(posY + height), 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)(texV + height) * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    vertexbuffer.pos((double)(posX + width), (double)posY, 0.0D).tex((double)((float)(texU + width) * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    vertexbuffer.pos((double)posX, (double)posY, 0.0D).tex((double)((float)texU * 0.00390625F), (double)((float)texV * 0.00390625F)).color(red, green, blue, alpha).endVertex();
    Tessellator.getInstance().draw();
}
Gui.java 文件源码 项目:CustomWorldGen 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Draws a textured rectangle using the texture currently bound to the TextureManager
 */
public void drawTexturedModalRect(float xCoord, float yCoord, 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)maxV), (double)this.zLevel).tex((double)((float)(minU + 0) * 0.00390625F), (double)((float)(minV + maxV) * 0.00390625F)).endVertex();
    vertexbuffer.pos((double)(xCoord + (float)maxU), (double)(yCoord + (float)maxV), (double)this.zLevel).tex((double)((float)(minU + maxU) * 0.00390625F), (double)((float)(minV + maxV) * 0.00390625F)).endVertex();
    vertexbuffer.pos((double)(xCoord + (float)maxU), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + maxU) * 0.00390625F), (double)((float)(minV + 0) * 0.00390625F)).endVertex();
    vertexbuffer.pos((double)(xCoord + 0.0F), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + 0) * 0.00390625F), (double)((float)(minV + 0) * 0.00390625F)).endVertex();
    tessellator.draw();
}
ModelBox.java 文件源码 项目:Backmemed 阅读 22 收藏 0 点赞 0 评论 0
public void render(VertexBuffer renderer, float scale)
{
    for (TexturedQuad texturedquad : this.quadList)
    {
        if (texturedquad != null)
        {
            texturedquad.draw(renderer, scale);
        }
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号