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

ParticleSpark.java 文件源码 项目:Bewitchment 阅读 14 收藏 0 点赞 0 评论 0
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
    float scale = ((float) this.particleAge + partialTicks) / (float) this.particleMaxAge * 32.0F;
    scale = MathHelper.clamp(scale, 0.0F, 1.0F);
    this.particleScale = this.oSize * scale;
    super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
    GlStateManager.color(getRedColorF(), getGreenColorF(), getBlueColorF(), 1.0F);
}
EnergyHUD.java 文件源码 项目:Bewitchment 阅读 12 收藏 0 点赞 0 评论 0
private void renderTexture(double x, double y, double width, double height, double vMin, double vMax) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buff = tessellator.getBuffer();

    buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    buff.pos(x, y + height, 0).tex(0, vMax).endVertex();
    buff.pos(x + width, y + height, 0).tex(1, vMax).endVertex();
    buff.pos(x + width, y, 0).tex(1, vMin).endVertex();
    buff.pos(x, y, 0).tex(0, vMin).endVertex();

    tessellator.draw();
}
SkinTintBrew.java 文件源码 项目:Bewitchment 阅读 23 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(int x, int y, Minecraft mc, int amplifier) {
    mc.renderEngine.bindTexture(ResourceLocations.BREW_TEXTURES);
    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder buf = tessellator.getBuffer();
    GlStateManager.color(1F, 1F, 1F, 1F);
    final float f = 0.00390625F;

    buf.begin(7, DefaultVertexFormats.POSITION_TEX);
    buf.pos(x, y + 20, 0).tex(236 * f, (236 + 20) * f).endVertex();
    buf.pos(x + 20, y + 20, 0).tex((236 + 20) * f, (236 + 20) * f).endVertex();
    buf.pos(x + 20, y, 0).tex((236 + 20) * f, 236 * f).endVertex();
    buf.pos(x, y, 0).tex(236 * f, 236 * f).endVertex();
    tessellator.draw();

    int textureX = 9 % 14 * 18;
    int textureY = 0;
    x += 1;
    y += 1;

    GlStateManager.pushMatrix();

    EnumDyeColor dye = EnumDyeColor.byDyeDamage(Math.min(amplifier, EnumDyeColor.values().length - 1));
    int rgb = dye.getColorValue();

    float r = (rgb >>> 16 & 0xFF) / 256.0F;
    float g = (rgb >>> 8 & 0xFF) / 256.0F;
    float b = (rgb & 0xFF) / 256.0F;
    GlStateManager.color(r, g, b);

    buf.begin(7, DefaultVertexFormats.POSITION_TEX);
    buf.pos(x, y + 18, 0).tex(textureX * f, (textureY + 18) * f).endVertex();
    buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * f, (textureY + 18) * f).endVertex();
    buf.pos(x + 18, y, 0).tex((textureX + 18) * f, textureY * f).endVertex();
    buf.pos(x, y, 0).tex(textureX * f, textureY * f).endVertex();
    tessellator.draw();

    GlStateManager.popMatrix();
}
RenderUtils.java 文件源码 项目:EMC 阅读 27 收藏 0 点赞 0 评论 0
public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION);
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
    tessellator.draw();
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION);
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
    tessellator.draw();
    vertexbuffer.begin(1, DefaultVertexFormats.POSITION);
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex();
    vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex();
    vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex();
    tessellator.draw();
}
HarshenClientUtils.java 文件源码 项目:harshencastle 阅读 25 收藏 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();
}
HarshenClientUtils.java 文件源码 项目:harshencastle 阅读 25 收藏 0 点赞 0 评论 0
public static void renderGhostBlock(IBlockState state, BlockPos position, Color color, boolean noDepth, float partialTicks)
{
    if(!(state.getBlock() instanceof BlockLiquid) && !(state.getBlock() instanceof BlockFluidBase))
    {
        renderGhostModel(Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state), position, color, noDepth, partialTicks);
        return;
    }
    GlStateManager.enableBlend();
       GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_DST_COLOR);
    BufferBuilder vb;
    if(noDepth)
    {
           GlStateManager.depthFunc(519);
        vb = prepRenderBlockDepth(partialTicks, true);
    }
    else
        vb = prepRender(partialTicks, true);
       vb.begin(7, DefaultVertexFormats.BLOCK);
       World world = Minecraft.getMinecraft().world;
       Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlock(state, position.add(0, noDepth ? 500 : 0, 0), world, vb);
       for(int i = 0; i < vb.getVertexCount(); i++)
        vb.putColorMultiplier(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, i);
       vb.color(1, 1, 1, 0.1f);
       postRender();
       GlStateManager.disableBlend();
       GlStateManager.depthFunc(515);
}
HarshenClientUtils.java 文件源码 项目:harshencastle 阅读 23 收藏 0 点赞 0 评论 0
public static BufferBuilder prepLineRender(float partialTicks)
{
    GlStateManager.disableTexture2D();
       GlStateManager.disableBlend();
       GlStateManager.glLineWidth(line);
       BufferBuilder bufferbuilder = prepRender(partialTicks, true);
       bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
       return bufferbuilder;
}
ModelRendererPyramid.java 文件源码 项目:Halloween 阅读 19 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
private void compileDisplayList(float scale)
{
    this.displayList = GLAllocation.generateDisplayLists(1);
    GL11.glNewList(this.displayList, GL11.GL_COMPILE);
    BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();

    for (int i = 0; i < this.quadList.length; i++)
    {
        this.quadList[i].draw(bufferbuilder, scale);
    }

    GL11.glEndList();
    this.compiled = true;
}
HarshenClientUtils.java 文件源码 项目:harshencastle 阅读 25 收藏 0 点赞 0 评论 0
public static BufferBuilder prepRenderBlockDepth(float partialTicks, boolean movePosition)
{
    GlStateManager.pushMatrix();
       Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder bufferbuilder = tessellator.getBuffer();
       if(movePosition)
        translateCamera(0, 500, 0, partialTicks);
       return bufferbuilder;
}
GuiBlack.java 文件源码 项目:ObsidianSuite 阅读 16 收藏 0 点赞 0 评论 0
private void drawCustomGui(double x, double y, double width, double height, double zLevel)
{
       GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    Tessellator tessellator = Tessellator.getInstance();
       BufferBuilder bufferbuilder = tessellator.getBuffer();
       GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
       bufferbuilder.begin(7, DefaultVertexFormats.POSITION);
       bufferbuilder.pos(x + 0, y + height, zLevel).endVertex();
       bufferbuilder.pos(x + width, y + height, zLevel).endVertex();
       bufferbuilder.pos(x + width, y + 0, zLevel).endVertex();
       bufferbuilder.pos(x + 0, y + 0, zLevel).endVertex();
       tessellator.draw();
}


问题


面经


文章

微信
公众号

扫码关注公众号