TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class MappingUtil in Tinman.Terrain.Mapping

Helper class for this module.

static class MappingUtil  

Public / Constants

MaxSize

Maximum map raster size.

public constant MaxSize = 1073741824
type int32

See also:

MapInfo

MinSize

Minimum map raster size.

public constant MinSize = 256
type int32

See also:

MapInfo

Public / Methods

ComputeShiftToMaxSize

Computes the number of bits to shift in order to scale the coordinates of a map raster of the given size to a map raster of MaxSize.

[Pure]
public static method ComputeShiftToMaxSize (int32 size)
type int32
params size [pow2] The raster size of the map.
returns [0..22] The number of bits to shift.

ComputeSize

Computes the internal raster size for the given raster width and height.

[Pure]
public static method ComputeSize (int32 width, int32 height = 0, int32 minSize = MinSize)
type int32
params width The raster width.
  height The raster height. Defaults to 0.
  minSize The minimum size. Defaults to MinSize.
returns [pow2] The raster size.

Midpoint

Computes the map coordinates of the point that lies halfway between a and b.

[Pure]
public static method Midpoint (Vec2I a, Vec2I b)
type Vec2I
params a First point.
  b Second point.
returns The midpoint.

See also:

MaxSize

Computes the map coordinates of the point that lies halfway between a and b.

[Pure]
public static method Midpoint (Vec3I a, Vec3I b)
type Vec3I
params a First point.
  b Second point.
returns The midpoint.

See also:

MaxSize

Computes the map coordinate that lies halfway between a and b.

[Pure]
public static method Midpoint (int32 a, int32 b)
type int32
params a First coordinate.
  b Second coordinate.
returns The midpoint coordinate.

See also:

MaxSize

Valid

Checks if the given combination of map type, width and height is valid.

[Pure]
public static method Valid (MapType type, int32 width, int32 height)
type bool
params type The map type.
  width The map width.
  height The map height.
returns true if the combination is valid, false if not.

Wrap

Performs wrapping on the given map coordinates.

[Pure]
public static method Wrap (Vec2D coords, MapWrap wrapX, MapWrap wrapY)
type Vec2D
params coords The map coordinates.
  wrapX Wrapping along X-axis.
  wrapY Wrapping along Y-axis.
returns The wrapped coordinates or Undefined if coords are out of the valid map bounds.