Defines common operations of IHeightmap objects.
interface
|
IHeightmapOps
|
base of
|
IHeightmap
|
The IHeightmap object that is returned by the heightmap operation methods must be used by the caller instead of the IHeightmap on which the method has been called.
Pads
this
heightmap
to
the
smallest
fitting
size
of
2^n+1
.
[OwnerReturn, OwnerThis]
|
||||
method
|
Border
(HeightmapSample borderSample,
int32 borderFalloff)
|
|||
type
|
IHeightmap
|
|||
params
|
borderSample
|
The border heightmap sample. | ||
borderFalloff
|
[>0]
|
Width of the border falloff region, in heightmap samples. | ||
returns
|
|
The padded heightmap. |
Remarks:
This method will add a border region at the right and bottom edges of a rectangular heightmap (see Rect). A smooth falloff is computed at the heightmap edges in order to avoid unnecessary triangles being created by CLOD mesh refinement for overly sharp corners.
Clips away portions of this heightmap, according to the Coverage layer of the given heightmap.
[OwnerReturn, OwnerThis]
|
||||
method
|
Clip
([Owner]
IHeightmap mask,
bool inverse = false)
|
|||
type
|
IHeightmap
|
|||
params
|
mask
|
[not-null]
|
The heightmap that is used as the clip mask (see remarks). | |
inverse
|
Invert
the
coverage
values
in
mask
before
clipping?
Defaults
to
false .
|
|||
returns
|
|
The resulting heightmap. |
Remarks:
The coverage values of the returned heightmap are computed like this:
inverse == false : c_out = c_in * c_mask inverse == true : c_out = in * (1 - c_mask)where
c_out
is
the
normalized
coverage
value
(i.e.
in
the
range
[0..1])
of
the
returned
heightmap,
c_in
is
the
normalized
coverage
value
of
this
heightmap
and
c_arg
is
the
normalized
coverage
value
of
mask.
Adds detail to this heightmap by combining it with the given heightmap.
[OwnerReturn, OwnerThis]
|
||||
method
|
Combine
([Owner]
IHeightmap detail,
ColorOp textureOp = ColorOp.Blend)
|
|||
type
|
IHeightmap
|
|||
params
|
detail
|
[not-null]
|
The detail heightmap. | |
textureOp
|
The color operation to apply to the Texture layer, if present. Defaults to Blend. | |||
returns
|
|
The resulting heightmap. |
Remarks:
The
heightmap
samples
of
this
heightmap
(source
)
are
modified
using
the
samples
of
the
given
detail
heightmap
(detail
)
according
to
these
rules:
first
)
and
the
color
of
the
given
detail
heightmap
(
second
).
255
,
the
source
token
will
be
replaced
with
the
detail
token.
Otherwise,
the
source
token
will
be
gradually
blend
into
the
detail
token
(see
Mix).
Merges the given heightmap with this one. The coverage of both heightmaps will be taken into account during merging.
[OwnerReturn, OwnerThis]
|
||||
method
|
Merge
([Owner]
IHeightmap second)
|
|||
type
|
IHeightmap
|
|||
params
|
second
|
[not-null]
|
The second heightmap. | |
returns
|
|
The resulting heightmap. |
Remarks:
Merged heightmaps fill data into heightmap samples in order, with heightmaps at a later stage overwriting sample data written by heightmaps of an earlier stage.
Both heightmaps (this one and second) will be scaled to the maximum possible size.
Returns a scaled version of this heightmap.
[OwnerReturn, OwnerThis]
|
||||
method
|
Scale
(int32 newSize)
|
|||
type
|
IHeightmap
|
|||
params
|
newSize
|
[pow2+1]
|
The scaled internal size (see Type). The minimum internal size is MinSize. | |
returns
|
|
The scaled heightmap. |
Remarks:
The
maximum
upscaling
factor
for
heightmaps
is
65536
,
so
the
given
condition
should
be
met
when
upscaling
a
heightmap
(otherwise
only
the
16
most
significant
bits
of
the
interpolation
factor
will
be
used):
(newSize - 1) / (Size - 1) <= 65536where newSize is the new heightmap size and Type is the current size of this heightmap.
Splits the layers of this heightmap.
[OwnerReturn, OwnerThis]
|
||||
method
|
Split
(HeightmapLayer layers)
|
|||
type
|
IHeightmap
|
|||
params
|
layers
|
The heightmap layers to retain in the split heightmap. | ||
returns
|
|
The resulting heightmap. |
Wraps this heightmap in a pixel pyramid.
[OwnerReturn, OwnerThis]
|
||||
method
|
ToPyramid
(int32 tileSize = 256,
int32 tilePad = 0,
int32 levels = 0,
IPixelLayer pixelLayer = null,
PyramidFlags flags = PyramidFlags.None)
|
|||
type
|
IPixelPyramid
|
|||
params
|
tileSize
|
[pow2]
|
The
tile
size.
Defaults
to
256 . |
|
tilePad
|
[>=0]
|
The
tile
padding.
Defaults
to
0 . |
||
levels
|
[>=0]
|
Defines
how
many
pyramid
levels
(starting
at
the
bottommost
level)
shall
contain
data.
The
heightmap
sample
step
is
1
for
the
bottommost
level
and
is
multiplied
by
two
for
each
parent
level.
If
0 ,
all
pyramid
levels
will
contain
data.
Defaults
to
0 .
|
||
pixelLayer
|
Optional
pixel
layer
to
use.
Defaults
to
null . |
|||
flags
|
Optional pyramid flags. Defaults to None. | |||
returns
|
|
The pixel pyramid. |
Translates the normalized elevation values of this heightmap to the given range.
[OwnerReturn, OwnerThis]
|
||||
method
|
TransformRange
(VerticalRange range,
UnitOfMeasure unit = null,
bool reinterpret = false)
|
|||
type
|
IHeightmap
|
|||
params
|
range
|
The range to translate to (see Vertical). | ||
unit
|
The
vertical
unit
of
range.
If
null ,
Metre
will
be
used.
Defaults
to
null .
|
|||
reinterpret
|
Keep
elevation
values
of
this
heightmap
and
reinterpret
them
according
to
range
and
unit,
instead
of
scaling
them?
Defaults
to
false .
|
|||
returns
|
|
The resulting heightmap. |
Return a heightmap that computes texture colors using an elevation-based color ramp.
[OwnerReturn, OwnerThis]
|
||||
method
|
UseColorRamp
(IColorRamp colorRamp)
|
|||
type
|
IHeightmap
|
|||
params
|
colorRamp
|
[not-null]
|
The color ramp to use. | |
returns
|
|
The resulting heightmap. |
Remarks:
The terrain-space values of the Elevation layer (according to the vertical range and unit of the heightmap) are fed into the color ramp. The resulting diffuse color is used as the Texture layer.