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

struct CubemapFaceRect in Tinman.Terrain.Mapping

Represents a rectangle on a cubemap face.

struct CubemapFaceRect implements IEquatable<CubemapFaceRect>

Configuration

Config

The configurator object for this type.

public static property Config { get }
type IConfigurator<CubemapFaceRect>
value [not-null] The configurator object.

Public / Constants

Zero

An empty cubemap face rectangle at coordinates (0,0).

public static readonly field Zero
type CubemapFaceRect

Public / Attributes

Face

The cubemap face.

public readonly field Face
type CubemapFace

Height

Height of cubemap face rectangle, in samples.

public readonly field Height
type int32

IsEmpty

Is this cubemap face rectangle empty, i.e. it does not contain any samples?

public property IsEmpty { get }
type bool
value true if the rectangle is empty, false if not.

Rect

public property Rect { get }
type Box2I
value

Width

Width of cubemap face rectangle, in samples.

public readonly field Width
type int32

X1

X-coordinate of top-left corner of cubemap face rectangle.

public readonly field X1
type int32

X2

X-coordinate of bottom-right corner of cubemap face rectangle.

public property X2 { get }
type int32
value The coordinate.

Y1

Y-coordinate of top-left corner of cubemap face rectangle.

public readonly field Y1
type int32

Y2

Y-coordinate of bottom-right corner of cubemap face rectangle.

public property Y2 { get }
type int32
value The coordinate.

Public / Constructors

CubemapFaceRect

Creates a new instance of CubemapFaceRect.

public constructor CubemapFaceRect (int32 x, int32 y, int32 width, int32 height, CubemapFace face = CubemapFace.NegZ)
params x X-coordinate of top-left corner of cubemap face rectangle.
  y Y-coordinate of top-left corner of cubemap face rectangle.
  width [>=0] Width of cubemap face rectangle.
  height [>=0] Height of cubemap face rectangle.
  face Cubemap face of rectangle (see Cubemap).

Public / Methods

ApplyTransform

Transforms this cubemap face region.

[Pure]
public method ApplyTransform (Transform transform, int32 n)
type CubemapFaceRect
params transform The transformation to apply.
  n Maximum cubemap coordinate.
returns The transformed cubemap face region. If this region is step-aligned, the transformed region will also be step-aligned.

Remarks:

The transformation center is at (n/2; n/2).

Clip

Clips this cubemap face rectangle to the given width and height.

[Pure]
public method Clip (int32 width, int32 height)
type CubemapFaceRect
params width [>=0] The width to clip to.
  height [>=0] The height to clip to.
returns The resulting cubemap face rectangle.

Equals

public method Equals (CubemapFaceRect other)
type bool
params other

FromPoints

Creates a new instance of CubemapFaceRect from the given corner points.

[Pure]
public static method FromPoints (int32 x1, int32 y1, int32 x2, int32 y2, CubemapFace face = CubemapFace.NegZ)
type CubemapFaceRect
params x1 X-coordinate of first corner point.
  y1 Y-coordinate of first corner point.
  x2 X-coordinate of second corner point.
  y2 Y-coordinate of second corner point.
  face The cubemap face. Defaults to NegZ.
returns The cubemap face rectangle.

GetHashCode

public override method GetHashCode ()
type int32

Shift

Shifts the coordinates of this cubemap face rectangle.

[Pure]
public method Shift (int32 amount)
type CubemapFaceRect
params amount The number of bits to shift leftwards. Specify a negative number for shifting rightwards.
returns The shifted rectangle.

StepAlign

Aligns this cubemap face rectangle to the given sample step.

[Pure]
public method StepAlign (int32 step)
type CubemapFaceRect
params step [pow2] The step value.
returns The aligned cubemap face rectangle.

Remarks:

The returned cubemap face rectangle will contain only those sample of this rectangle that have coordinates which are divisible by the given step value (i.e. X1, Y1, X2 and Y2 are divisible by step).

StepHeight

Returns the height of this cubemap face rectangle when using the given sample step.

[Pure]
public method StepHeight (int32 step)
type int32
params step [pow2] The sample step.
returns [>=0] The rectangle height, in aligned sample steps.

StepWidth

Returns the width of this cubemap face rectangle when using the given sample step.

[Pure]
public method StepWidth (int32 step)
type int32
params step [pow2] The sample step.
returns [>=0] The rectangle width, in aligned sample steps.

ToCube

Returns the cubemap coordinates of a sample in this rectangle.

[Pure]
public method ToCube (int32 x, int32 y, int32 n = MappingUtil.MaxSize, int32 step = 1)
type Vec3I
params x Local X-coordinate of sample in this rectangle.
  y Local Y-coordinate of sample in this rectangle.
  n Maximum cubemap coordinate.
  step [>=1] The sample step. Defaults to 1.
returns The cubemap coordinates.

ToFace

Returns the cubemap face coordinates of a sample in this rectangle.

[Pure]
public method ToFace (int32 x, int32 y, int32 step = 1)
type CubemapFaceCoordsI
params x Local X-coordinate of sample in this rectangle.
  y Local Y-coordinate of sample in this rectangle.
  step [>=1] The sample step. Defaults to 1.
returns The cubemap face coordinates.

ToString

public override method ToString ()
type string

WrapX

Wraps this cubemap face region along the cubemap face X-axis.

[Pure]
public method WrapX (int32 n, bool edge, out CubemapFaceRect wrapped, out Vec2I xy)
type Transform
params n Maximum cubemap coordinate.
  edge Wrap around if region only touches a cubemap edge?
  wrapped The cubemap face region part that lies on the wrapped cubemap face. Will be step-aligned if this region is step-aligned.
  xy Local coordinates of the top-left sample of wrapped in this cubemap face region (see remarks).
returns The affine transformation to apply to wrapped in order to fit the samples into the corresponding region of this cubemap face rectangle.

Remarks:

Before wrapping, this region is clipped to the following bounds (in the order given):

The resulting wrapped cubemap face region will be step-aligned and fit onto the cubemap face.
The xy coordinates are given relative to X1 and Y1 with a sample step of one. To compute the cubemap face coordinates of xy, you can do the following:
region.ToFace(xy.X, xy.Y, 1)

WrapY

Wraps this cubemap face region along the cubemap face Y-axis.

[Pure]
public method WrapY (int32 n, bool edge, out CubemapFaceRect wrapped, out Vec2I xy)
type Transform
params n Maximum cubemap coordinate.
  edge Wrap around if region only touches a cubemap edge?
  wrapped The cubemap face region part that lies on the wrapped cubemap face. Will be step-aligned if this region is step-aligned.
  xy Local coordinates of the top-left sample of wrapped in this cubemap face region (see remarks).
returns The affine transformation to apply to wrapped in order to fit the samples into the corresponding region of this cubemap face rectangle.

Remarks:

Before wrapping, this region is clipped to the following bounds (in the order given):

The resulting wrapped cubemap face region will be step-aligned and fit onto the cubemap face.
The xy coordinates are given relative to X1 and Y1 with a sample step of one. To compute the cubemap face coordinates of xy, you can do the following:
region.ToFace(xy.X, xy.Y, 1)