Created
August 30, 2014 07:53
-
-
Save jrenner/169438e75773d0dbe861 to your computer and use it in GitHub Desktop.
GroundChunk.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GroundChunk extends ModelInstance implements Visible { | |
private static final BoundingBox box = new BoundingBox(); | |
public Vector3 position; | |
public Vector3 dimensions; | |
public float radius; | |
public GroundChunk(Model model) { | |
super(model); | |
calculateTransforms(); | |
calculateBoundingBox(box); | |
dimensions = new Vector3(box.getDimensions()); | |
radius = dimensions.len() / 2f; | |
position = new Vector3(box.getCenter()); | |
Lists.groundChunks.add(this); | |
} | |
@Override | |
public boolean isVisible(PerspectiveCamera cam) { | |
return cam.frustum.sphereInFrustum(position, radius); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment