public abstract class DelegatingHeightMap extends AbstractHeightMap
Modifier and Type | Field and Description |
---|---|
protected HeightMap[] |
children |
protected boolean |
constant |
protected int |
constantColour |
protected double |
constantValue |
name, seed
Modifier | Constructor and Description |
---|---|
protected |
DelegatingHeightMap(java.lang.String... roles) |
Modifier and Type | Method and Description |
---|---|
protected void |
childrenChanged() |
protected void |
determineConstant()
Determines whether this height map can be constant by checking that all
its children are constant height maps.
|
protected int |
doGetColour(int x,
int y) |
protected double |
doGetHeight(float x,
float y) |
protected double |
doGetHeight(int x,
int y) |
int |
getColour(int x,
int y)
Get the colour of the height map at a particular location as a combined
RGB value consisting of the red component in bits 16-23, the green
component in bits 8-15, and the blue component in bits 0-7.
|
double |
getConstantValue()
If the height map is
constant : returns the constant
value that would be returned for any location from
HeightMap.getHeight(int, int) and HeightMap.getHeight(float, float) . |
double |
getHeight(float x,
float y)
Get the height of the height map at a particular location.
|
double |
getHeight(int x,
int y)
Get the height of the height map at a particular location.
|
HeightMap |
getHeightMap(int index) |
HeightMap |
getHeightMap(java.lang.String role) |
int |
getHeightMapCount() |
int |
getIndex(HeightMap heightMap) |
int |
getIndex(java.lang.String role) |
java.lang.String |
getRole(int index) |
long |
getSeed()
Get the seed of the height map.
|
boolean |
isConstant()
Indicate whether the height map is constant, i.e.
|
protected java.lang.Object |
readResolve() |
void |
recalculateConstantValue()
Recursively recalculate the constant value, if any, of the tree of height
maps.
|
int |
replace(HeightMap oldChild,
HeightMap newChild) |
HeightMap |
replace(int index,
HeightMap newChild) |
void |
setHeightMap(int index,
HeightMap child) |
void |
setHeightMap(java.lang.String role,
HeightMap child) |
void |
setSeed(long seed)
Set the seed of the height map.
|
clone, getBaseHeight, getExtent, getName, getParent, setName
protected final HeightMap[] children
protected transient double constantValue
protected transient boolean constant
protected transient int constantColour
public void recalculateConstantValue()
public final int getHeightMapCount()
public final java.lang.String getRole(int index)
public final int getIndex(java.lang.String role)
public final int getIndex(HeightMap heightMap)
public final HeightMap getHeightMap(int index)
public final HeightMap getHeightMap(java.lang.String role)
public final void setHeightMap(int index, HeightMap child)
public final void setHeightMap(java.lang.String role, HeightMap child)
public final long getSeed()
HeightMap
getSeed
in interface HeightMap
getSeed
in class AbstractHeightMap
public final void setSeed(long seed)
HeightMap
setSeed
in interface HeightMap
setSeed
in class AbstractHeightMap
seed
- The new seed of the height map.public boolean isConstant()
HeightMap
isConstant
in interface HeightMap
isConstant
in class AbstractHeightMap
true
if the height map is constant.public double getConstantValue()
HeightMap
constant
: returns the constant
value that would be returned for any location from
HeightMap.getHeight(int, int)
and HeightMap.getHeight(float, float)
. If the
height map is not constant the behaviour is undefined.getConstantValue
in interface HeightMap
getConstantValue
in class AbstractHeightMap
HeightMap.isConstant()
.public final double getHeight(float x, float y)
HeightMap
getHeight
in interface HeightMap
getHeight
in class AbstractHeightMap
x
- The X coordinate of the location of which to get the height.y
- The Y coordinate of the location of which to get the height.public final double getHeight(int x, int y)
HeightMap
getHeight
in interface HeightMap
getHeight
in class AbstractHeightMap
x
- The X coordinate of the location of which to get the height.y
- The Y coordinate of the location of which to get the height.public final int getColour(int x, int y)
HeightMap
getColour
in interface HeightMap
getColour
in class AbstractHeightMap
x
- The X coordinate of the location of which to get the colour.y
- The Y coordinate of the location of which to get the colour.protected void childrenChanged()
protected void determineConstant()
protected int doGetColour(int x, int y)
protected double doGetHeight(float x, float y)
protected double doGetHeight(int x, int y)
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException