Interface WorldMapView

All Known Implementing Classes:
BlendedWorldMapView, DetailedWorldMapView, SimpleWorldMapView, UnrealisticWorldMapView

public interface WorldMapView
Takes a WorldMapGenerator, such as a LocalMap, RotatingGlobeMap, or StretchWorldMap, and wraps it so that you can call generate() on this to coordinate calls to WorldMapGenerator.generate() and BiomeMapper.makeBiomes(WorldMapGenerator). For extra convenience, you can get a possible interpretation of how the generated world would look by calling show(), which returns a 2D array of ints as RGBA8888 colors.
The main implementations of this so far are DetailedWorldMapView and BlendedWorldMapView, which use a BiomeMapper.DetailedBiomeMapper and a BiomeMapper.BlendedBiomeMapper, respectively. The Blended types tend to be easier to use and produce smoother transitions between biomes; they are preferred. There is also UnrealisticWorldMapView, which is meant for debugging world maps to find any flaws in a particular generator.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Partly-randomizes the colors used for biomes.
    void
     
    void
    generate(float landMod, float heatMod)
     
    void
    generate(long seedA, long seedB, float landMod, float heatMod)
     
     
    int[][]
     
    int[][]
     
    int
     
    int
     
     
    void
     
    void
    initialize(float hue, float saturation, float brightness, float contrast)
    Initializes the color tables this uses for all biomes, but allows rotating all hues and adjusting brightness/saturation/contrast to produce maps of non-Earth-like planets.
    void
    match(int... similarColors)
    Initializes the colors to use in some combination for all biomes, without regard for what the biome really is.
    void
    match(long seed, int... similarColors)
    Initializes the colors to use in some combination for all biomes, without regard for what the biome really is.
    void
     
    void
     
    int[][]
    After calling generate(), you can call this to assign values to getColorMap() and getColorMapOklab().
  • Method Details

    • getWidth

      int getWidth()
    • getHeight

      int getHeight()
    • getColorMap

      int[][] getColorMap()
    • getColorMapOklab

      int[][] getColorMapOklab()
    • getBiomeMapper

      BiomeMapper getBiomeMapper()
    • setBiomeMapper

      void setBiomeMapper(BiomeMapper biomeMapper)
    • getWorld

      WorldMapGenerator getWorld()
    • setWorld

      void setWorld(WorldMapGenerator world)
    • initialize

      void initialize()
    • initialize

      void initialize(float hue, float saturation, float brightness, float contrast)
      Initializes the color tables this uses for all biomes, but allows rotating all hues and adjusting brightness/saturation/contrast to produce maps of non-Earth-like planets.
      Parameters:
      hue - hue rotation; 0.0 and 1.0 are no rotation, and 0.5 is maximum rotation
      saturation - added to the saturation of a biome color; usually close to 0.0, always between -1 and 1
      brightness - added to the lightness of a biome color; often close to 0.0, always between -1 and 1
      contrast - multiplies the darkening factor for the dark sections of biomes; typically very close to 1
    • alter

      void alter()
      Partly-randomizes the colors used for biomes. This may request random numbers from the FlowRandom in the WorldMapGenerator. This should map similar colors in the input color table, like varieties of dark green forest, into similar output colors. It will not change color 60 (empty space), but will change everything else. Typically, colors like white ice will still map to white, and different shades of ocean blue will become different shades of some color (which could still be some sort of blue). This can be a useful alternative to initialize(float, float, float, float), because that method hue-rotates all colors by the same amount, while this method adjusts each input hue differently and based on their original value. You may want to call initialize() (either with no arguments or with four) before each call to this, because changes this makes to the color table would be read back the second time this is called without reinitialization.
    • match

      void match(int... similarColors)
      Initializes the colors to use in some combination for all biomes, without regard for what the biome really is. There should be at least one packed int Oklab color given in similarColors, but there can be many of them. This type of color can be any of the color constants from DescriptiveColor, may be produced by DescriptiveColor.describeOklab(String), or might be made manually, in advanced cases, with DescriptiveColor.limitToGamut(int, int, int) and specifying the L, A, and B channels.
      Parameters:
      similarColors - an array or vararg of packed int Oklab colors with at least one element
    • match

      void match(long seed, int... similarColors)
      Initializes the colors to use in some combination for all biomes, without regard for what the biome really is. There should be at least one packed int Oklab color given in similarColors, but there can be many of them. This type of color can be any of the color constants from DescriptiveColor, may be produced by DescriptiveColor.describeOklab(String), or might be made manually, in advanced cases, with DescriptiveColor.limitToGamut(int, int, int) and specifying the L, A, and B channels.
      Parameters:
      seed - any long; used to determine how colors are matched to biomes
      similarColors - an array or vararg of packed int Oklab colors with at least one element
    • generate

      void generate()
    • generate

      void generate(float landMod, float heatMod)
    • generate

      void generate(long seedA, long seedB, float landMod, float heatMod)
    • show

      int[][] show()
      After calling generate(), you can call this to assign values to getColorMap() and getColorMapOklab(). This method returns the RGBA colorMap, but it assigns to colorMapOklab at the same time, so you can use the Oklab colors with methods like DescriptiveColor.lighten(int, float) and DescriptiveColor.lerpColors(int, int, float).
      Returns:
      the RGBA8888 colorMap