_corners[7].addLocal(-_extents.getX(), -_extents.getY(), -_extents.getZ());
final ReadOnlyMatrix4 mvMatrix = getModelViewMatrix();
double optimalCameraNear = Double.MAX_VALUE;
double optimalCameraFar = -Double.MAX_VALUE;
final Vector4 position = Vector4.fetchTempInstance();
for (int i = 0; i < _corners.length; i++) {
position.set(_corners[i].getX(), _corners[i].getY(), _corners[i].getZ(), 1);
mvMatrix.applyPre(position, position);
optimalCameraNear = Math.min(-position.getZ(), optimalCameraNear);
optimalCameraFar = Math.max(-position.getZ(), optimalCameraFar);
}
Vector4.releaseTempInstance(position);
// XXX: use of getFrustumNear and getFrustumFar seems suspicious...
// XXX: It depends on the frustum being reset each update