当前位置: 首页>>代码示例>>Java>>正文


Java BufferBuilder类代码示例

本文整理汇总了Java中net.minecraft.client.renderer.BufferBuilder的典型用法代码示例。如果您正苦于以下问题:Java BufferBuilder类的具体用法?Java BufferBuilder怎么用?Java BufferBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BufferBuilder类属于net.minecraft.client.renderer包,在下文中一共展示了BufferBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawArrow

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
private void drawArrow(float progress) {
    double arrowBaseWidth = 0.4D;
    double arrowBaseLength = 0.8D;
    double arrowLength = 1.5D;
    double arrowWidth = 0.7D;
    double scale = 0.1D;
    GL11.glPushMatrix();
    GL11.glScaled(scale, scale, scale);
    GL11.glTranslatef(0, progress * 4, 0);
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
    wr.pos(-arrowBaseWidth, -arrowLength * 0.5D, 0).endVertex();
    wr.pos(-arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
    wr.pos(-arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
    wr.pos(0, arrowLength * 0.5D, 0).endVertex();
    wr.pos(arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
    wr.pos(arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0).endVertex();
    wr.pos(arrowBaseWidth, -arrowLength * 0.5D, 0).endVertex();
    Tessellator.getInstance().draw();
    GL11.glPopMatrix();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:RenderBlockArrows.java

示例2: renderInterpolated

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void renderInterpolated(RenderProgressingLine lastTickLine, float partialTick, float rotationYaw, float rotationPitch) {
    GL11.glPushMatrix();
    double renderProgress = getInter(progress, lastTickLine.progress, partialTick);
    GL11.glTranslated((getInter(endX, lastTickLine.endX, partialTick) - startX) * renderProgress, (getInter(endY, lastTickLine.endY, partialTick) - startY) * renderProgress, (getInter(endZ, lastTickLine.endZ, partialTick) - startZ) * renderProgress);
    GL11.glRotatef(rotationYaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(rotationPitch, 0.0F, 0.0F, 1.0F);
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    wr.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
    RenderUtils.glColorHex(color);
    double size = 5 / 16D;
    for (int i = 0; i < PneumaticCraftUtils.circlePoints; i++) {
        wr.pos(0, PneumaticCraftUtils.sin[i] * size, PneumaticCraftUtils.cos[i] * size).endVertex();
    }
    Tessellator.getInstance().draw();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glPopMatrix();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:RenderRing.java

示例3: renderAirParticle

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
private void renderAirParticle(float particleProgress) {
    int xStart = (width - xSize) / 2;
    int yStart = (height - ySize) / 2;
    float x = xStart + 117F;
    float y = yStart + 50.5F;
    if (particleProgress < 0.5F) {
        y += particleProgress * 56;
    } else if (particleProgress < 0.7F) {
        y += 28F;
        x -= (particleProgress - 0.5F) * 90;
    } else {
        y += 28F;
        x -= 18;
        y -= (particleProgress - 0.7F) * 70;
    }
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    GL11.glPointSize(5);
    wr.begin(GL11.GL_POINTS, DefaultVertexFormats.POSITION);
    wr.pos(x, y, zLevel).endVertex();
    Tessellator.getInstance().draw();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:GuiChargingStation.java

示例4: render

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
@Override
public void render(int mouseX, int mouseY, float partialTick) {
    drawRect(x, y, x + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT, enabled ? 0xFFA0A0A0 : 0xFF999999);
    drawRect(x + 1, y + 1, x + CHECKBOX_WIDTH - 1, y + CHECKBOX_HEIGHT - 1, enabled ? 0xFF202020 : 0xFFAAAAAA);
    if (checked) {
        GlStateManager.disableTexture2D();
        if (enabled) {
            GlStateManager.color(1, 1, 1, 1);
        } else {
            GlStateManager.color(0.8f, 0.8f, 0.8f, 1);
        }
        BufferBuilder wr = Tessellator.getInstance().getBuffer();
        wr.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
        wr.pos(x + 2, y + 5, zLevel).endVertex();
        wr.pos(x + 5, y + 7, zLevel).endVertex();
        wr.pos(x + 8, y + 3, zLevel).endVertex();
        Tessellator.getInstance().draw();
        GlStateManager.enableTexture2D();
        GlStateManager.color(0.25f, 0.25f, 0.25f, 1);
    }
    fontRenderer.drawString(I18n.format(text), x + 1 + CHECKBOX_WIDTH, y + CHECKBOX_HEIGHT / 2 - fontRenderer.FONT_HEIGHT / 2, enabled ? color : 0xFF888888);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:23,代码来源:GuiCheckBox.java

示例5: render

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
@Override
public void render() {
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture());
    int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0);
    int height = getHeight() + (hasStepOutput() ? 10 : 0);
    Pair<Double, Double> maxUV = getMaxUV();
    double u = maxUV.getLeft();
    double v = maxUV.getRight();
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    wr.pos(0, 0, 0).tex(0, 0).endVertex();
    wr.pos(0, height, 0).tex(0, v).endVertex();
    wr.pos(width, height, 0).tex(u, v).endVertex();
    wr.pos(width, 0, 0).tex(u, 0).endVertex();
    Tessellator.getInstance().draw();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:ProgWidget.java

示例6: renderParticle

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
  {
//super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
//System.out.println("rot: "+rotationX+" "+rotationZ+" "+rotationYZ+" "+rotationXY+" "+rotationXZ);
EnumFacing face=this.block.sideHit;
if(face == EnumFacing.UP)
	super.renderParticle(buffer, entityIn, partialTicks, 1, 0, 0, 0, 1);
else if(face == EnumFacing.DOWN)
	super.renderParticle(buffer, entityIn, partialTicks, 1, 0, 0, 0, -1);
else if(face == EnumFacing.NORTH)
	super.renderParticle(buffer, entityIn, partialTicks, 1, 1, 0, 0, 0);
else if(face == EnumFacing.SOUTH)
	super.renderParticle(buffer, entityIn, partialTicks, -1, 1, 0, 0, 0);
else if(face == EnumFacing.EAST)
	super.renderParticle(buffer, entityIn, partialTicks, 0, 1, 1, 0, 0);
else if(face == EnumFacing.WEST)
	super.renderParticle(buffer, entityIn, partialTicks, 0, 1, -1, 0, 0);
  }
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:ParticleBulletHole.java

示例7: render

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
@Override
public void render(Vector3 cameraPos) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buf = tessellator.getBuffer();

    for (LineStyle line : this.style.getLines()) {
        if (!line.prepare(this.style.getRenderType())) {
            continue;
        }

        buf.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
        line.applyColour();
        for (Vector3 vertex : this.vertices) {
            buf.pos(vertex.getX() - cameraPos.getX(), vertex.getY() - cameraPos.getY(), vertex.getZ() - cameraPos.getZ()).endVertex();
        }
        tessellator.draw();
    }
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:19,代码来源:Render3DPolygon.java

示例8: renderGhostModel

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
public static void renderGhostModel(IBakedModel model, BlockPos position, Color color, boolean noDepth, float partialTicks)
{
	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;
       BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
       dispatcher.getBlockModelRenderer().renderModel(world, model, Minecraft.getMinecraft().world.getBlockState(position), position.add(0, noDepth ? 500 : 0, 0), vb, false);
       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.depthFunc(515);
       GlStateManager.disableBlend();
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:24,代码来源:HarshenClientUtils.java

示例9: render

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public void render(BufferBuilder renderer) {
    int numVertices = vertices.length;
    if(faceNormal == null)
    	faceNormal = calculateFaceNormal();
    
    renderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
    for (int i = 0; i < numVertices; ++i) {
		Vertex v = vertices[i];
		TextureCoordinate tc = textureCoordinates[i];
        renderer.pos(v.x, v.y, v.z).tex(tc.u, tc.v).normal(faceNormal.x, faceNormal.y, faceNormal.z).endVertex();
    }
    //Renderer works with four vertices so add start point again if face is only three vertices.
    if(numVertices == 3)
    	renderer.pos(vertices[0].x, vertices[0].y, vertices[0].z).tex(textureCoordinates[0].u, textureCoordinates[0].v).normal(faceNormal.x, faceNormal.y, faceNormal.z).endVertex();
    
    Tessellator.getInstance().draw();
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:19,代码来源:Face.java

示例10: drawTextureWithMasking

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
private static void drawTextureWithMasking(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
    double uMin = (double) textureSprite.getMinU();
    double uMax = (double) textureSprite.getMaxU();
    double vMin = (double) textureSprite.getMinV();
    double vMax = (double) textureSprite.getMaxV();
    uMax = uMax - (maskRight / 16.0 * (uMax - uMin));
    vMax = vMax - (maskTop / 16.0 * (vMax - vMin));

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    bufferBuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
    bufferBuilder.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
    bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
    bufferBuilder.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
    bufferBuilder.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
    tessellator.draw();
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:18,代码来源:FluidStackRenderer.java

示例11: render

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
void render() {
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder buff = tessellator.getBuffer();

	buff.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
	buff.setTranslation(
			-TileEntityRendererDispatcher.staticPlayerX,
			-TileEntityRendererDispatcher.staticPlayerY,
			-TileEntityRendererDispatcher.staticPlayerZ
	);
	buff.pos(from.x, from.y, from.z).color(getRedColorF(), getGreenColorF(), getBlueColorF(), alpha * particleAlpha)
			.endVertex();
	buff.pos(to.x, to.y, to.z).color(getRedColorF(), getGreenColorF(), getBlueColorF(), alpha * particleAlpha)
			.endVertex();
	buff.setTranslation(0,0,0);
	tessellator.draw();
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:18,代码来源:ParticleBolt.java

示例12: drawCuboid

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
private static void drawCuboid(final BufferBuilder buffer, final BlockPos begin, final BlockPos end, final int sides, final int argb, final double delta) {
    if (buffer.getDrawMode() == -1 || sides == 0) {
        return;
    }

    final double x0 = begin.getX() - delta;
    final double y0 = begin.getY() - delta;
    final double z0 = begin.getZ() - delta;
    final double x1 = end.getX() + 1 + delta;
    final double y1 = end.getY() + 1 + delta;
    final double z1 = end.getZ() + 1 + delta;

    switch (buffer.getDrawMode()) {
    case GL11.GL_QUADS:
        drawQuads(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
        break;

    case GL11.GL_LINES:
        drawLines(buffer, x0, y0, z0, x1, y1, z1, sides, argb);
        break;

    default:
        throw new IllegalStateException("Unsupported mode!");
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:26,代码来源:GeometryTessellator.java

示例13: renderParticle

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
@Override
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
	if(sprite != null) {
		double uMin = 0F;
		double uMax = 1F;
		double vMin = 0F;
		double vMax = 1F;
		if(sprite instanceof FrameSpriteResource) {
			FrameSpriteResource framedSprite = ((FrameSpriteResource) sprite);
			Tuple<Double, Double> uv = framedSprite.getUVFrame((int) particleAngle);
			double uOffset = framedSprite.getU();
			double u = uv.getFirst();
			double vOffset = framedSprite.getV();
			double v = uv.getSecond();

			uMin = u;
			uMax = u + uOffset;
			vMin = v;
			vMax = v + vOffset;
		}

		sprite.bindManager();
		renderEasy(buffer, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ, uMin, uMax, vMin, vMax);
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:26,代码来源:ParticleBase.java

示例14: render

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
public void render(double size, float partialTicks) {
    double renderRotationAngle = oldRotationAngle + (rotationAngle - oldRotationAngle) * partialTicks;
    BufferBuilder wr = Tessellator.getInstance().getBuffer();

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    // GL11.glLineWidth((float)size * 20F);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glRotatef((float) renderRotationAngle, 0, 0, 1);
    for (int j = 0; j < 2; j++) {
        wr.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION);
        for (int i = 0; i < PneumaticCraftUtils.circlePoints / 4; i++) {
            wr.pos(PneumaticCraftUtils.cos[i] * size, PneumaticCraftUtils.sin[i] * size, 0).endVertex();
            wr.pos(PneumaticCraftUtils.cos[i] * (size + 0.1D), PneumaticCraftUtils.sin[i] * (size + 0.1D), 0).endVertex();
        }
        Tessellator.getInstance().draw();

        if (renderAsTagged) {
            GL11.glColor4d(1, 0, 0, 1);
            wr.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
            for (int i = 0; i < PneumaticCraftUtils.circlePoints / 4; i++) {
                wr.pos(PneumaticCraftUtils.cos[i] * size, PneumaticCraftUtils.sin[i] * size, 0).endVertex();
            }
            for (int i = PneumaticCraftUtils.circlePoints / 4 - 1; i >= 0; i--) {
                wr.pos(PneumaticCraftUtils.cos[i] * (size + 0.1D), PneumaticCraftUtils.sin[i] * (size + 0.1D), 0).endVertex();
            }
            Tessellator.getInstance().draw();
            GL11.glColor4d(1, 1, 0, 0.5);
        }

        GL11.glRotatef(180, 0, 0, 1);
    }

    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:40,代码来源:RenderTargetCircle.java

示例15: renderTileEntityFast

import net.minecraft.client.renderer.BufferBuilder; //导入依赖的package包/类
@Override
public void renderTileEntityFast(@Nonnull TilePhenomena phenomena, double x, double y, double z, float partialTick, int breakStage, float partial, @Nullable BufferBuilder renderer) {
	if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();

	BlockPos pos = phenomena.getPos();
	IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(phenomena.getWorld(), pos);
	IBlockState state = getState(phenomena, world, pos);

	if(state instanceof IExtendedBlockState) {
		IExtendedBlockState extendedState = (IExtendedBlockState) state;
		if(extendedState.getUnlistedNames().contains(Properties.AnimationProperty)) {
			float time = ((20 - phenomena.timer)) / 20F; // Using tile timer instead of world time.
			IAnimationStateMachine capability = phenomena.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null);
			if(capability != null) {
				Pair<IModelState, Iterable<Event>> pair = capability.apply(time);

				extendedState = extendedState.withProperty(Properties.AnimationProperty, pair.getLeft());
				IBakedModel model = getModel(state);

				assert renderer != null;
				renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());

				blockRenderer.getBlockModelRenderer().renderModel(world, model, extendedState, pos, renderer, false);
			}
		}
	}
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:28,代码来源:PhenomenaRenderer.java


注:本文中的net.minecraft.client.renderer.BufferBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。