Class DetailedWorldMapView
java.lang.Object
com.github.yellowstonegames.world.DetailedWorldMapView
- All Implemented Interfaces:
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.DetailedBiomeMapper.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.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int[]final int[]protected BiomeMapper.DetailedBiomeMapperprotected int[][]protected int[][]protected intprotected intprotected WorldMapGenerator -
Constructor Summary
ConstructorsConstructorDescriptionDetailedWorldMapView(long seed, int width, int height) DetailedWorldMapView(WorldMapGenerator worldMapGenerator) -
Method Summary
Modifier and TypeMethodDescriptionvoidalter()Uses the current colors inbiomeColorTableto partly-randomize themselves, and also incorporates three random floats from theFlowRandomstored ingetWorld().final booleanvoidgenerate()voidgenerate(float landMod, float heatMod) voidgenerate(long seedA, long seedB, float landMod, float heatMod) int[][]int[][]intintgetWidth()getWorld()inthashCode()voidvoidinitialize(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.voidmatch(int... similarColors) Initializes the colors to use in some combination for all biomes, without regard for what the biome really is.voidmatch(long seed, int... similarColors) Initializes the colors to use in some combination for all biomes, without regard for what the biome really is.voidsetBiomeMapper(BiomeMapper biomeMapper) voidsetColorMap(int[][] colorMap) voidsetColorMapOklab(int[][] colorMapOklab) voidsetWorld(WorldMapGenerator world) int[][]show()After callinggenerate(), you can call this to assign values togetColorMap()andgetColorMapOklab().toString()
-
Field Details
-
width
protected int width -
height
protected int height -
colorMap
protected int[][] colorMap -
colorMapOklab
protected int[][] colorMapOklab -
world
-
biomeMapper
-
biomeColorTable
public final int[] biomeColorTable -
biomeDarkColorTable
public final int[] biomeDarkColorTable
-
-
Constructor Details
-
DetailedWorldMapView
public DetailedWorldMapView() -
DetailedWorldMapView
-
DetailedWorldMapView
public DetailedWorldMapView(long seed, int width, int height)
-
-
Method Details
-
getWidth
public int getWidth()- Specified by:
getWidthin interfaceWorldMapView
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceWorldMapView
-
getColorMap
public int[][] getColorMap()- Specified by:
getColorMapin interfaceWorldMapView
-
setColorMap
public void setColorMap(int[][] colorMap) -
getColorMapOklab
public int[][] getColorMapOklab()- Specified by:
getColorMapOklabin interfaceWorldMapView
-
setColorMapOklab
public void setColorMapOklab(int[][] colorMapOklab) -
getBiomeMapper
- Specified by:
getBiomeMapperin interfaceWorldMapView
-
setBiomeMapper
- Specified by:
setBiomeMapperin interfaceWorldMapView
-
getWorld
- Specified by:
getWorldin interfaceWorldMapView
-
setWorld
- Specified by:
setWorldin interfaceWorldMapView
-
initialize
public void initialize()- Specified by:
initializein interfaceWorldMapView
-
initialize
public 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.- Specified by:
initializein interfaceWorldMapView- Parameters:
hue- hue rotation; 0.0 and 1.0 are no rotation, and 0.5 is maximum rotationsaturation- added to the saturation of a biome color; usually close to 0.0, always between -1 and 1brightness- added to the lightness of a biome color; often close to 0.0, always between -1 and 1contrast- multiplies the darkening factor for the dark sections of biomes; typically very close to 1
-
alter
public void alter()Uses the current colors inbiomeColorTableto partly-randomize themselves, and also incorporates three random floats from theFlowRandomstored ingetWorld(). 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 toinitialize(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 callinitialize()(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.- Specified by:
alterin interfaceWorldMapView
-
match
public 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 fromDescriptiveColor, may be produced byDescriptiveColor.describeOklab(String), or might be made manually, in advanced cases, withDescriptiveColor.limitToGamut(int, int, int)and specifying the L, A, and B channels.- Specified by:
matchin interfaceWorldMapView- Parameters:
similarColors- an array or vararg of packed int Oklab colors with at least one element
-
match
public 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 fromDescriptiveColor, may be produced byDescriptiveColor.describeOklab(String), or might be made manually, in advanced cases, withDescriptiveColor.limitToGamut(int, int, int)and specifying the L, A, and B channels.- Specified by:
matchin interfaceWorldMapView- Parameters:
seed- any long; used to determine how colors are matched to biomessimilarColors- an array or vararg of packed int Oklab colors with at least one element
-
generate
public void generate()- Specified by:
generatein interfaceWorldMapView
-
generate
public void generate(float landMod, float heatMod) - Specified by:
generatein interfaceWorldMapView
-
generate
public void generate(long seedA, long seedB, float landMod, float heatMod) - Specified by:
generatein interfaceWorldMapView
-
show
public int[][] show()After callinggenerate(), you can call this to assign values togetColorMap()andgetColorMapOklab(). This method returns the RGBA colorMap, but it assigns to colorMapOklab at the same time, so you can use the Oklab colors with methods likeDescriptiveColor.lighten(int, float)andDescriptiveColor.lerpColors(int, int, float).- Specified by:
showin interfaceWorldMapView- Returns:
- the RGBA8888 colorMap
-
equals
-
hashCode
-
toString
-