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


Java VertexBuffer.setTranslation方法代码示例

本文整理汇总了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();
}
 
开发者ID:ToroCraft,项目名称:PowerProbe,代码行数:18,代码来源:PowerOverlayRender.java

示例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();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:Render.java

示例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;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:34,代码来源:ChunkRenderDispatcher.java

示例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);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:34,代码来源:AnimationTESR.java

示例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();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:FastTESR.java

示例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();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:TileEntityPistonRenderer.java

示例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();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:56,代码来源:TileEntityPistonRenderer.java


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