當前位置: 首頁>>代碼示例>>Java>>正文


Java RenderGlobal.drawBoundingBox方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.RenderGlobal.drawBoundingBox方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderGlobal.drawBoundingBox方法的具體用法?Java RenderGlobal.drawBoundingBox怎麽用?Java RenderGlobal.drawBoundingBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.RenderGlobal的用法示例。


在下文中一共展示了RenderGlobal.drawBoundingBox方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawSelection

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
protected void drawSelection(Tessellator tessellator, BufferBuilder bufferBuilder)
{
    if(this.region == null) return;

    AxisAlignedBB box = this.region.toAABB();
    // draw edge without depth to show extent of region
    GlStateManager.disableDepth();
    GlStateManager.glLineWidth(2.0F);
    bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
    RenderGlobal.drawBoundingBox(bufferBuilder, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, SELECT.red, SELECT.green, SELECT.blue, 1f);
    tessellator.draw();

    // draw sides with depth to better show what parts are unobstructed
    GlStateManager.enableDepth();
    bufferBuilder.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR);
    RenderGlobal.addChainedFilledBoxVertices(bufferBuilder, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, SELECT.red, SELECT.green, SELECT.blue, 0.4f);
    tessellator.draw();
}
 
開發者ID:grondag,項目名稱:Hard-Science,代碼行數:21,代碼來源:CuboidBuilder.java

示例2: renderDebugBoundingBox

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
/**
 * Renders the bounding box around an entity when F3+B is pressed
 */
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    float f = entityIn.width / 2.0F;
    AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
    RenderGlobal.drawBoundingBox(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z, 1.0F, 1.0F, 1.0F, 1.0F);

    if (entityIn instanceof EntityLivingBase)
    {
        float f1 = 0.01F;
        RenderGlobal.drawBoundingBox(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f, 1.0F, 0.0F, 0.0F, 1.0F);
    }

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    Vec3d vec3d = entityIn.getLook(partialTicks);
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
    vertexbuffer.pos(x + vec3d.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3d.yCoord * 2.0D, z + vec3d.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:34,代碼來源:RenderManager.java

示例3: renderAABB

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
/**
 * Render model's hit box
 *
 * Just like in Minecraft's world when you hit F3 + H. This method renders
 * similar box, but in model editor.
 */
private void renderAABB()
{
    Model.Pose current = this.getCurrentLimbPose();

    if (current == null)
    {
        return;
    }

    float minX = -current.size[0] / 2.0F;
    float maxX = current.size[0] / 2.0F;
    float minY = 0.0F;
    float maxY = current.size[1];
    float minZ = -current.size[0] / 2.0F;
    float maxZ = current.size[0] / 2.0F;

    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();

    RenderGlobal.drawBoundingBox(minX, minY, minZ, maxX, maxY, maxZ, 1.0F, 1.0F, 1.0F, 1.0F);

    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
開發者ID:mchorse,項目名稱:blockbuster,代碼行數:37,代碼來源:GuiModelEditor.java

示例4: drawBounds

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
/** return true if something was drawn */
@SideOnly(Side.CLIENT)
public boolean drawBounds(BufferBuilder bufferbuilder, Entity viewEntity, double d0, double d1, double d2, float partialTicks)
{
    this.lastEyePosition = viewEntity.getPositionEyes(partialTicks);
    if(this.visibilityBounds.contains(this.lastEyePosition))
    {
        if(this.positions == null)
        {
            AxisAlignedBB box = this.aabb;
            RenderGlobal.drawBoundingBox(bufferbuilder, box.minX - d0, box.minY - d1, box.minZ - d2, box.maxX - d0, box.maxY - d1, box.maxZ - d2, 1f, 0.3f, 0.3f, 1f);
        }
        else
        {
            for(BlockPos pos : this.positions)
            {
                double x = pos.getX() - d0;
                double y = pos.getY() - d1;
                double z = pos.getZ() - d2;
                RenderGlobal.drawBoundingBox(bufferbuilder, x, y, z, x + 1, y + 1, z + 1, 1f, 0.3f, 0.3f, 1f);
            }
        }
        this.didDrawBoundsLastTime = true;
        return true;
    }
    else
    {
        this.didDrawBoundsLastTime = false;
        return false;
    }
}
 
開發者ID:grondag,項目名稱:Hard-Science,代碼行數:32,代碼來源:ExcavationRenderer.java

示例5: drawPlacementPreview

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
/** 
 * Draw single-block sample to show shape/orientation of block to be be placed.
 * Does not render for excavations.
 */
@SideOnly(Side.CLIENT)
protected void drawPlacementPreview(Tessellator tessellator, BufferBuilder bufferBuilder)
{
    if(this.previewPos() == null || this.isExcavation) return;
    
    GlStateManager.disableDepth();
    
    ModelState placementModelState = this.previewModelState();
    if(placementModelState == null)
    {
        // No model state, draw generic box
        BlockPos pos = this.previewPos();
        bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
        RenderGlobal.drawBoundingBox(bufferBuilder, pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1, OBSTRUCTED.red, OBSTRUCTED.green, OBSTRUCTED.blue, 1f);
        tessellator.draw();
    }
    else
    {
        // Draw collision boxes
        GlStateManager.glLineWidth(1.0F);
        for (AxisAlignedBB blockAABB : placementModelState.collisionBoxes(this.previewPos()))
        {
            bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
            RenderGlobal.drawBoundingBox(bufferBuilder, blockAABB.minX, blockAABB.minY, blockAABB.minZ, blockAABB.maxX, blockAABB.maxY, blockAABB.maxZ, 1f, 1f, 1f, 1f);
            tessellator.draw();
        }
    }
}
 
開發者ID:grondag,項目名稱:Hard-Science,代碼行數:33,代碼來源:PlacementSpecBuilder.java

示例6: drawPlacement

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
protected void drawPlacement(Tessellator tessellator, BufferBuilder bufferBuilder, PlacementPreviewRenderMode previewMode)
{
    switch(previewMode)
    {
    case EXCAVATE:
        
        AxisAlignedBB box = new AxisAlignedBB(this.pPos.inPos);

        // draw edges without depth to show extent of region
        GlStateManager.disableDepth();
        GlStateManager.glLineWidth(2.0F);
        bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
        RenderGlobal.drawBoundingBox(bufferBuilder, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, previewMode.red, previewMode.green, previewMode.blue, 1f);
        tessellator.draw();
        
        // draw sides with depth to better show what parts are unobstructed
        GlStateManager.enableDepth();
        bufferBuilder.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR);
        RenderGlobal.addChainedFilledBoxVertices(bufferBuilder, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, previewMode.red, previewMode.green, previewMode.blue, 0.4f);
        tessellator.draw();
        
        break;
    case PLACE:
        this.drawPlacementPreview(tessellator, bufferBuilder);
        break;
        
    case SELECT:
    case OBSTRUCTED:
    default:
        break;
    
    }
}
 
開發者ID:grondag,項目名稱:Hard-Science,代碼行數:36,代碼來源:SingleBuilder.java

示例7: render

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
@Override
public void render(@Nonnull TileResearchApparatus te, double x, double y, double z, float partialTicks, int destroyStage, float unused) {
	if (!te.isInvalid()) {
		if (te.isSentinel() && Minecraft.getMinecraft().getRenderManager().isDebugBoundingBox()) {
			GlStateManager.pushMatrix();
			GlStateManager.translate(x, y, z);
			GlStateManager.depthMask(false);
			GlStateManager.disableTexture2D();
			GlStateManager.disableLighting();
			GlStateManager.disableCull();
			GlStateManager.disableBlend();
			AxisAlignedBB aabb = te.getEffectBounds().offset(-te.getPos().getX(), -te.getPos().getY(), -te.getPos().getZ());
			RenderGlobal.drawBoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX + 1, aabb.maxY + 1, aabb.maxZ + 1, 1F, 0F, 1F, 1F);
			GlStateManager.enableBlend();
			GlStateManager.enableCull();
			GlStateManager.enableLighting();
			GlStateManager.enableTexture2D();
			GlStateManager.depthMask(true);
			GlStateManager.popMatrix();
		}

		if (!te.getObservableStack().isEmpty()) {
			GlStateManager.pushMatrix();
			GlStateManager.translate(x + 0.5, y + 0.7, z + 0.5);
			GlStateManager.translate(0, MathHelper.sin((te.getWorld().getTotalWorldTime() + partialTicks) / 10.0F) * 0.1F + 0.1F, 0);
			GlStateManager.scale(0.75, 0.75, 0.75);
			float angle = (te.getWorld().getTotalWorldTime() + partialTicks) / 20.0F * (180F / (float) Math.PI);
			GlStateManager.rotate(angle, 0.0F, 1.0F, 0.0F);
			Minecraft.getMinecraft().getRenderItem().renderItem(te.getObservableStack(), ItemCameraTransforms.TransformType.GROUND);
			GlStateManager.popMatrix();
		}
	}
}
 
開發者ID:T145,項目名稱:magistics,代碼行數:34,代碼來源:RenderResearchApparatus.java

示例8: renderDebugBoundingBox

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
/**
 * Renders the bounding box around an entity when F3+B is pressed
 */
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    float f = entityIn.width / 2.0F;
    AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
    RenderGlobal.drawBoundingBox(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z, 1.0F, 1.0F, 1.0F, 1.0F);
    Entity[] aentity = entityIn.getParts();

    if (aentity != null)
    {
        for (Entity entity : aentity)
        {
            double d0 = (entity.posX - entity.prevPosX) * (double)partialTicks;
            double d1 = (entity.posY - entity.prevPosY) * (double)partialTicks;
            double d2 = (entity.posZ - entity.prevPosZ) * (double)partialTicks;
            AxisAlignedBB axisalignedbb1 = entity.getEntityBoundingBox();
            RenderGlobal.drawBoundingBox(axisalignedbb1.minX - this.renderPosX + d0, axisalignedbb1.minY - this.renderPosY + d1, axisalignedbb1.minZ - this.renderPosZ + d2, axisalignedbb1.maxX - this.renderPosX + d0, axisalignedbb1.maxY - this.renderPosY + d1, axisalignedbb1.maxZ - this.renderPosZ + d2, 0.25F, 1.0F, 0.0F, 1.0F);
        }
    }

    if (entityIn instanceof EntityLivingBase)
    {
        float f1 = 0.01F;
        RenderGlobal.drawBoundingBox(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f, 1.0F, 0.0F, 0.0F, 1.0F);
    }

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    Vec3d vec3d = entityIn.getLook(partialTicks);
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
    vertexbuffer.pos(x + vec3d.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3d.yCoord * 2.0D, z + vec3d.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:47,代碼來源:RenderManager.java

示例9: renderInvisibleBlocks

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
private void renderInvisibleBlocks(TileEntityStructure p_190054_1_, double p_190054_2_, double p_190054_4_, double p_190054_6_, BlockPos p_190054_8_, Tessellator p_190054_9_, VertexBuffer p_190054_10_, boolean p_190054_11_)
{
    GlStateManager.glLineWidth(p_190054_11_ ? 3.0F : 1.0F);
    p_190054_10_.begin(3, DefaultVertexFormats.POSITION_COLOR);
    World world = p_190054_1_.getWorld();
    BlockPos blockpos = p_190054_1_.getPos();
    BlockPos blockpos1 = blockpos.add(p_190054_8_);

    for (BlockPos blockpos2 : BlockPos.getAllInBox(blockpos1, blockpos1.add(p_190054_1_.getStructureSize()).add(-1, -1, -1)))
    {
        IBlockState iblockstate = world.getBlockState(blockpos2);
        boolean flag = iblockstate == Blocks.AIR.getDefaultState();
        boolean flag1 = iblockstate == Blocks.STRUCTURE_VOID.getDefaultState();

        if (flag || flag1)
        {
            float f = flag ? 0.05F : 0.0F;
            double d0 = (double)((float)(blockpos2.getX() - blockpos.getX()) + 0.45F) + p_190054_2_ - (double)f;
            double d1 = (double)((float)(blockpos2.getY() - blockpos.getY()) + 0.45F) + p_190054_4_ - (double)f;
            double d2 = (double)((float)(blockpos2.getZ() - blockpos.getZ()) + 0.45F) + p_190054_6_ - (double)f;
            double d3 = (double)((float)(blockpos2.getX() - blockpos.getX()) + 0.55F) + p_190054_2_ + (double)f;
            double d4 = (double)((float)(blockpos2.getY() - blockpos.getY()) + 0.55F) + p_190054_4_ + (double)f;
            double d5 = (double)((float)(blockpos2.getZ() - blockpos.getZ()) + 0.55F) + p_190054_6_ + (double)f;

            if (p_190054_11_)
            {
                RenderGlobal.drawBoundingBox(p_190054_10_, d0, d1, d2, d3, d4, d5, 0.0F, 0.0F, 0.0F, 1.0F);
            }
            else if (flag)
            {
                RenderGlobal.drawBoundingBox(p_190054_10_, d0, d1, d2, d3, d4, d5, 0.5F, 0.5F, 1.0F, 1.0F);
            }
            else
            {
                RenderGlobal.drawBoundingBox(p_190054_10_, d0, d1, d2, d3, d4, d5, 1.0F, 0.25F, 0.25F, 1.0F);
            }
        }
    }

    p_190054_9_.draw();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:42,代碼來源:TileEntityStructureRenderer.java

示例10: renderInvisibleBlocks

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
private void renderInvisibleBlocks(TileEntityStructure p_190054_1_, double p_190054_2_, double p_190054_4_, double p_190054_6_, BlockPos p_190054_8_, Tessellator p_190054_9_, VertexBuffer p_190054_10_, boolean p_190054_11_)
{
    GlStateManager.glLineWidth(p_190054_11_ ? 3.0F : 1.0F);
    p_190054_10_.begin(3, DefaultVertexFormats.POSITION_COLOR);
    World world = p_190054_1_.getWorld();
    BlockPos blockpos = p_190054_1_.getPos();
    BlockPos blockpos1 = blockpos.add(p_190054_8_);

    for (BlockPos blockpos2 : BlockPos.MutableBlockPos.getAllInBox(blockpos1, blockpos1.add(p_190054_1_.getStructureSize()).add(-1, -1, -1)))
    {
        IBlockState iblockstate = world.getBlockState(blockpos2);
        boolean flag = iblockstate == Blocks.AIR.getDefaultState();
        boolean flag1 = iblockstate == Blocks.STRUCTURE_VOID.getDefaultState();

        if (flag || flag1)
        {
            float f = flag ? 0.05F : 0.0F;
            double d0 = (double)((float)(blockpos2.getX() - blockpos.getX()) + 0.45F) + p_190054_2_ - (double)f;
            double d1 = (double)((float)(blockpos2.getY() - blockpos.getY()) + 0.45F) + p_190054_4_ - (double)f;
            double d2 = (double)((float)(blockpos2.getZ() - blockpos.getZ()) + 0.45F) + p_190054_6_ - (double)f;
            double d3 = (double)((float)(blockpos2.getX() - blockpos.getX()) + 0.55F) + p_190054_2_ + (double)f;
            double d4 = (double)((float)(blockpos2.getY() - blockpos.getY()) + 0.55F) + p_190054_4_ + (double)f;
            double d5 = (double)((float)(blockpos2.getZ() - blockpos.getZ()) + 0.55F) + p_190054_6_ + (double)f;

            if (p_190054_11_)
            {
                RenderGlobal.drawBoundingBox(p_190054_10_, d0, d1, d2, d3, d4, d5, 0.0F, 0.0F, 0.0F, 1.0F);
            }
            else if (flag)
            {
                RenderGlobal.drawBoundingBox(p_190054_10_, d0, d1, d2, d3, d4, d5, 0.5F, 0.5F, 1.0F, 1.0F);
            }
            else
            {
                RenderGlobal.drawBoundingBox(p_190054_10_, d0, d1, d2, d3, d4, d5, 1.0F, 0.25F, 0.25F, 1.0F);
            }
        }
    }

    p_190054_9_.draw();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:42,代碼來源:TileEntityStructureRenderer.java

示例11: drawPlacement

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
protected void drawPlacement(Tessellator tessellator, BufferBuilder bufferBuilder, PlacementPreviewRenderMode previewMode)
{
    if(this.region == null) return;

    AxisAlignedBB box = this.region.toAABB();

    // fixed regions could be outside of view
    if(ClientProxy.camera() == null || !ClientProxy.camera().isBoundingBoxInFrustum(box)) return;

    // draw edges without depth to show extent of region
    GlStateManager.disableDepth();
    GlStateManager.glLineWidth(2.0F);
    bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
    RenderGlobal.drawBoundingBox(bufferBuilder, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, previewMode.red, previewMode.green, previewMode.blue, 1f);
    tessellator.draw();

    Entity entity = Minecraft.getMinecraft().getRenderViewEntity();
    if(entity != null)
    {
        GlStateManager.glLineWidth(1.0F);
        bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
        RenderUtil.drawGrid(
                bufferBuilder, 
                box, 
                entity.getPositionEyes(Minecraft.getMinecraft().getRenderPartialTicks()),
                0, 0, 0, previewMode.red, previewMode.green, previewMode.blue, 0.5f);

        tessellator.draw();
    }

    if(previewMode == OBSTRUCTED)
    {
        // try to show where obstructions are
        for(BlockPos pos : this.region.exclusions())
        {
            bufferBuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
            RenderGlobal.drawBoundingBox(bufferBuilder, pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1, OBSTRUCTED.red, OBSTRUCTED.green, OBSTRUCTED.blue, 1f);
            tessellator.draw();
        }
    }
    else if(previewMode == PLACE)
    {
        // show shape/orientation of blocks to be be placed via a sample 
        this.drawPlacementPreview(tessellator, bufferBuilder);
    }

    // draw sides with depth to better show what parts are unobstructed
    GlStateManager.enableDepth();
    bufferBuilder.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR);
    RenderGlobal.addChainedFilledBoxVertices(bufferBuilder, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, previewMode.red, previewMode.green, previewMode.blue, 0.4f);
    tessellator.draw();
}
 
開發者ID:grondag,項目名稱:Hard-Science,代碼行數:55,代碼來源:CuboidBuilder.java

示例12: renderEntityDebugBoundingBox

import net.minecraft.client.renderer.RenderGlobal; //導入方法依賴的package包/類
public static void renderEntityDebugBoundingBox(Entity entityIn, float partialTicks, boolean renderLook, boolean renderEyeHeight)
{
    Entity renderViewEntity = Minecraft.getMinecraft().getRenderViewEntity();
    double x = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double y = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double z = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
    x -= renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * (double)partialTicks;
    y -= renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * (double)partialTicks;
    z -= renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * (double)partialTicks;

    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    GlStateManager.glLineWidth(1.0F);

    double entityRadius = entityIn.width / 2.0D;
    AxisAlignedBB bb = entityIn.getEntityBoundingBox();

    RenderGlobal.drawBoundingBox(bb.minX - entityIn.posX + x,
                                 bb.minY - entityIn.posY + y,
                                 bb.minZ - entityIn.posZ + z,
                                 bb.maxX - entityIn.posX + x,
                                 bb.maxY - entityIn.posY + y,
                                 bb.maxZ - entityIn.posZ + z,
                                 1.0F, 1.0F, 1.0F, 1.0F);

    if (renderEyeHeight && entityIn instanceof EntityLivingBase)
    {
        RenderGlobal.drawBoundingBox(x - entityRadius,
                                     y + entityIn.getEyeHeight() - 0.01D,
                                     z - entityRadius,
                                     x + entityRadius,
                                     y + entityIn.getEyeHeight() + 0.01D,
                                     z + entityRadius, 1.0F, 0.0F, 0.0F, 1.0F);
    }

    if (renderLook)
    {
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder vertexbuffer = tessellator.getBuffer();
        Vec3d look = entityIn.getLook(partialTicks);
        vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
        vertexbuffer.pos(x, y + entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
        vertexbuffer.pos(x + look.x * 2.0D, y + entityIn.getEyeHeight() + look.y * 2.0D, z + look.z * 2.0D).color(0, 0, 255, 255).endVertex();
        tessellator.draw();
    }

    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
開發者ID:maruohon,項目名稱:enderutilities,代碼行數:57,代碼來源:RenderUtils.java


注:本文中的net.minecraft.client.renderer.RenderGlobal.drawBoundingBox方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。