예제 #1
0
  private static MouseCursor createMouseCursor(
      final AWTImageLoader awtImageLoader, final String resourceName) throws IOException {
    final com.ardor3d.image.Image image =
        awtImageLoader.load(
            ResourceLocatorTool.getClassPathResourceAsStream(LwjglSwtExample.class, resourceName),
            false);

    return new MouseCursor("cursor1", image, 0, image.getHeight() - 1);
  }
예제 #2
0
  private static MouseCursor createMouseCursor(final String resourceName) throws IOException {
    final com.ardor3d.image.Image image =
        ImageLoaderUtil.loadImage(
            new URLResourceSource(
                ResourceLocatorTool.getClassPathResource(JoglSwtExample.class, resourceName)),
            false);

    return new MouseCursor("cursor1", image, 0, image.getHeight() - 1);
  }
예제 #3
0
  private void buildMips(final Image map) {
    final int max = heightMapSizes.size();
    int currentSize = heightMapSizes.get(max - 1);
    byte[] parentHeightMap = new byte[currentSize * currentSize * 3];
    // populate parentHeightMap from image
    map.getData(0).get(parentHeightMap);

    maps.add(parentHeightMap);
    // populate mips
    for (int i = 1; i < max; i++) {
      currentSize = heightMapSizes.get(max - i - 1);
      final byte[] heightMapMip = new byte[currentSize * currentSize * 3];
      for (int x = 0; x < currentSize; x++) {
        for (int z = 0; z < currentSize; z++) {
          heightMapMip[3 * (z * currentSize + x) + 0] =
              parentHeightMap[3 * (z * currentSize * 4 + x * 2) + 0];
          heightMapMip[3 * (z * currentSize + x) + 1] =
              parentHeightMap[3 * (z * currentSize * 4 + x * 2) + 1];
          heightMapMip[3 * (z * currentSize + x) + 2] =
              parentHeightMap[3 * (z * currentSize * 4 + x * 2) + 2];
        }
      }
      parentHeightMap = heightMapMip;
      maps.add(parentHeightMap);
    }
    Collections.reverse(maps);
  }