コード例 #1
0
  // do all of the LOD calculations
  protected void updateLOD(List<Vector3f> locations, LodCalculator lodCalculator) {
    if (getSpatial() == null) {
      return;
    }

    // update any existing ones that need updating
    updateQuadLODs();

    if (lodCalculator.isLodOff()) {
      // we want to calculate the base lod at least once
      if (lodOffCount == 1) return;
      else lodOffCount++;
    } else lodOffCount = 0;

    if (lastCameraLocations != null) {
      if (!forceUpdate && lastCameraLocationsTheSame(locations) && !lodCalculator.isLodOff())
        return; // don't update if in same spot
      else lastCameraLocations = cloneVectorList(locations);
      forceUpdate = false;
    } else {
      lastCameraLocations = cloneVectorList(locations);
      return;
    }

    if (isLodCalcRunning()) {
      return;
    }
    setLodCalcRunning(true);

    if (executor == null) executor = createExecutorService();

    prepareTerrain();

    UpdateLOD updateLodThread = getLodThread(locations, lodCalculator);
    indexer = executor.submit(updateLodThread);
  }