本文整理匯總了Java中net.minecraft.client.renderer.VertexBuffer.setTranslation方法的典型用法代碼示例。如果您正苦於以下問題:Java VertexBuffer.setTranslation方法的具體用法?Java VertexBuffer.setTranslation怎麽用?Java VertexBuffer.setTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.client.renderer.VertexBuffer
的用法示例。
在下文中一共展示了VertexBuffer.setTranslation方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawIconVectors
import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
private void drawIconVectors(double x, double y, double z, TextureManager tm, PowerOverlayData overlay) {
if (overlay == null || overlay.pos == null || overlay.power < 1) {
return;
}
VertexBuffer vb;
tm.bindTexture(ICONS_TEXTURE);
vb = Tessellator.getInstance().getBuffer();
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
vb.setTranslation(-x, -y, -z);
if (overlay.power > 0) {
renderVectors(vb, overlay.pos, TEXTURE_OFFSETS[0],
overlay.strongPowered ? TEXTURE_OFFSETS[0] : TEXTURE_OFFSETS[1]);
}
vb.setTranslation(0, 0, 0);
Tessellator.getInstance().draw();
}
示例2: renderOffsetAABB
import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
/**
* Renders a white box with the bounds of the AABB trasnlated by an offset.
*/
public static void renderOffsetAABB(AxisAlignedBB boundingBox, double x, double y, double z)
{
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
vertexbuffer.setTranslation(x, y, z);
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_NORMAL);
vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
tessellator.draw();
vertexbuffer.setTranslation(0.0D, 0.0D, 0.0D);
GlStateManager.enableTexture2D();
}
示例3: uploadChunk
import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
public ListenableFuture<Object> uploadChunk(final BlockRenderLayer p_188245_1_, final VertexBuffer p_188245_2_, final RenderChunk p_188245_3_, final CompiledChunk p_188245_4_, final double p_188245_5_)
{
if (Minecraft.getMinecraft().isCallingFromMinecraftThread())
{
if (OpenGlHelper.useVbo())
{
this.uploadVertexBuffer(p_188245_2_, p_188245_3_.getVertexBufferByLayer(p_188245_1_.ordinal()));
}
else
{
this.uploadDisplayList(p_188245_2_, ((ListedRenderChunk)p_188245_3_).getDisplayList(p_188245_1_, p_188245_4_), p_188245_3_);
}
p_188245_2_.setTranslation(0.0D, 0.0D, 0.0D);
return Futures.<Object>immediateFuture((Object)null);
}
else
{
ListenableFutureTask<Object> listenablefuturetask = ListenableFutureTask.<Object>create(new Runnable()
{
public void run()
{
ChunkRenderDispatcher.this.uploadChunk(p_188245_1_, p_188245_2_, p_188245_3_, p_188245_4_, p_188245_5_);
}
}, (Object)null);
synchronized (this.queueChunkUploads)
{
this.queueChunkUploads.add(new ChunkRenderDispatcher.PendingUpload(listenablefuturetask, p_188245_5_));
return listenablefuturetask;
}
}
}
示例4: renderTileEntityFast
import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的package包/類
public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer)
{
if(!te.hasCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null))
{
return;
}
if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockPos pos = te.getPos();
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
IBlockState state = world.getBlockState(pos);
if(state.getPropertyNames().contains(Properties.StaticProperty))
{
state = state.withProperty(Properties.StaticProperty, false);
}
if(state instanceof IExtendedBlockState)
{
IExtendedBlockState exState = (IExtendedBlockState)state;
if(exState.getUnlistedNames().contains(Properties.AnimationProperty))
{
float time = Animation.getWorldTime(getWorld(), partialTick);
Pair<IModelState, Iterable<Event>> pair = te.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null).apply(time);
handleEvents(te, time, pair.getRight());
// TODO: caching?
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean());
exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft());
renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ());
blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, renderer, false);
}
}
}
示例5: renderTileEntityAt
import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的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();
}
示例6: renderTileEntityAt
import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的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 (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(x - (double)blockpos.getX() + (double)te.getOffsetX(partialTicks), y - (double)blockpos.getY() + (double)te.getOffsetY(partialTicks), z - (double)blockpos.getZ() + (double)te.getOffsetZ(partialTicks));
World world = this.getWorld();
if (block == Blocks.PISTON_HEAD && te.getProgress(partialTicks) <= 0.25F)
{
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(x - (double)blockpos.getX(), y - (double)blockpos.getY(), z - (double)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();
}
}
示例7: renderTileEntityAt
import net.minecraft.client.renderer.VertexBuffer; //導入方法依賴的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();
}
}