Beispiel #1
0
  protected void createMipMap(AttributeGrid grid) {
    grid.getGridBounds(gbounds);
    xgmin = gbounds[0];
    ygmin = gbounds[2];
    zgmin = gbounds[4];

    scaleFactor = grid.getWidth() / (gbounds[1] - gbounds[0]);

    int nx = grid.getWidth();
    int ny = grid.getHeight();
    int nz = grid.getDepth();

    if (DEBUG) {
      printf("createMipMap()\n grid [%d x %d x %d]\n", nx, ny, nz);
    }
    Vector vgrids = new Vector();
    vgrids.add(grid);
    int levelCount = 1;
    while (nx > 1 || ny > 1 || nz > 1) {

      grid = makeGridHalfSize(grid, nx, ny, nz, m_scalingType);
      vgrids.add(grid);

      nx = (nx + 1) / 2;
      ny = (ny + 1) / 2;
      nz = (nz + 1) / 2;

      if (DEBUG) {
        printf("  mipmap level [%d x %d x %d]\n", nx, ny, nz);
      }
      levelCount++;
    }
    printf("  levelCount: %d\n", levelCount);

    m_grids = (AttributeGrid[]) vgrids.toArray(new AttributeGrid[levelCount]);
  }