Class ImageBasedHeightMap

All Implemented Interfaces:

public class ImageBasedHeightMap extends AbstractHeightMap
ImageBasedHeightMap is a height map created from the grayscale conversion of an image. The image used currently must have an equal height and width, although future work could scale an incoming image to a specific height and width.
  • Field Details

    • colorImage

      protected Image colorImage
  • Constructor Details

    • ImageBasedHeightMap

      public ImageBasedHeightMap(Image colorImage)
      Creates a HeightMap from an Image. The image will be converted to grayscale, and the grayscale values will be used to generate the height map. White is the highest point, and black is the lowest point. Currently, the Image used must be square (width == height), but future work could rescale the image.
      colorImage - Image to map to the height map.
    • ImageBasedHeightMap

      public ImageBasedHeightMap(Image colorImage, float heightScale)
  • Method Details

    • setImage

      public void setImage(Image image)
    • load

      public boolean load()
      Loads the image data from top left to bottom right
      true if the load was successful, false otherwise.
    • calculateHeight

      protected float calculateHeight(float red, float green, float blue)
      Get the grayscale value, or override in your own sub-classes
    • calculateHeight

      protected float calculateHeight(ColorRGBA color)
    • getImageRaster

      protected ImageRaster getImageRaster()
    • load

      public boolean load(boolean flipX, boolean flipY)