001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005
006 @SideOnly(Side.CLIENT)
007 public class Frustrum implements ICamera
008 {
009 private ClippingHelper clippingHelper = ClippingHelperImpl.getInstance();
010 private double xPosition;
011 private double yPosition;
012 private double zPosition;
013
014 public void setPosition(double par1, double par3, double par5)
015 {
016 this.xPosition = par1;
017 this.yPosition = par3;
018 this.zPosition = par5;
019 }
020
021 /**
022 * Calls the clipping helper. Returns true if the box is inside all 6 clipping planes, otherwise returns false.
023 */
024 public boolean isBoxInFrustum(double par1, double par3, double par5, double par7, double par9, double par11)
025 {
026 return this.clippingHelper.isBoxInFrustum(par1 - this.xPosition, par3 - this.yPosition, par5 - this.zPosition, par7 - this.xPosition, par9 - this.yPosition, par11 - this.zPosition);
027 }
028
029 /**
030 * Returns true if the bounding box is inside all 6 clipping planes, otherwise returns false.
031 */
032 public boolean isBoundingBoxInFrustum(AxisAlignedBB par1AxisAlignedBB)
033 {
034 return this.isBoxInFrustum(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
035 }
036 }