CubemapFaceRect

Description

struct Tinman.Terrain.Mapping.CubemapFaceRect

Represents a rectangle on a cubemap face.

Public / Constants

Zero


public static readonly attribute Zero → (CubemapFaceRect)

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

Public / Constructors

Cubemap​Face​Rect


public constructor CubemapFaceRect → (5)

in : int32

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

in : int32

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

width in : int32

[>=0]
Width of cubemap face rectangle.

height in : int32

[>=0]
Height of cubemap face rectangle.

face opt : CubemapFace = CubemapFace.NegZ

Cubemap face of rectangle (see Cubemap).

Creates a new instance of CubemapFaceRect.

From​Points


[Pure]
public static method FromPoints → (5)

x1 in : int32

X-coordinate of first corner point.

y1 in : int32

Y-coordinate of first corner point.

x2 in : int32

X-coordinate of second corner point.

y2 in : int32

Y-coordinate of second corner point.

face opt : CubemapFace = CubemapFace.NegZ

The cubemap face.

returns → CubemapFaceRect

The cubemap face rectangle.

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

Public / Methods

Apply​Transform


[Pure]
public method ApplyTransform → (2)

transform in : Transform

The transformation to apply.

in : int32

Maximum cubemap coordinate.

returns → CubemapFaceRect

The transformed cubemap face region. If this region is step-aligned, the transformed region will also be step-aligned.

Transforms this cubemap face region.

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

Clip


[Pure]
public method Clip → (2)

width in : int32

[>=0]
The width to clip to.

height in : int32

[>=0]
The height to clip to.

returns → CubemapFaceRect

The resulting cubemap face rectangle.

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

Shift


[Pure]
public method Shift → (1)

amount in : int32

The number of bits to shift leftwards. Specify a negative number for shifting rightwards.

returns → CubemapFaceRect

The shifted rectangle.

Shifts the coordinates of this cubemap face rectangle.

Step​Align


[Pure]
public method StepAlign → (1)

step in : int32

[pow2]
The step value.

returns → CubemapFaceRect

The aligned cubemap face rectangle.

Aligns this cubemap face rectangle to the given sample step.

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 in).

Step​Height


[Pure]
public method StepHeight → (1)

step in : int32

[pow2]
The sample step.

returns → int32

The rectangle height, in aligned sample steps.

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

Step​Width


[Pure]
public method StepWidth → (1)

step in : int32

[pow2]
The sample step.

returns → int32

The rectangle width, in aligned sample steps.

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

To​Cube


[Pure]
public method ToCube → (4)

in : int32

Local X-coordinate of sample in this rectangle.

in : int32

Local Y-coordinate of sample in this rectangle.

opt : int32 = MappingUtil.MaxSize

Maximum cubemap coordinate.

step opt : int32 = 1

[>=1]
The sample step.

returns → Vec3I

The cubemap coordinates.

Returns the cubemap coordinates of a sample in this rectangle.

To​Face


[Pure]
public method ToFace → (3)

in : int32

Local X-coordinate of sample in this rectangle.

in : int32

Local Y-coordinate of sample in this rectangle.

step opt : int32 = 1

[>=1]
The sample step.

returns → CubemapFaceCoordsI

The cubemap face coordinates.

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

Wrap​X


[Pure]
public method WrapX → (4)

in : int32

Maximum cubemap coordinate.

edge in : bool

Wrap around if region only touches a cubemap edge?

wrapped out : CubemapFaceRect

The cubemap face region part that lies on the wrapped cubemap face. Will be step-aligned if this region is step-aligned.

xy out : Vec2I

Local coordinates of the top-left sample of wrapped out in this cubemap face region (see remarks).

returns → Transform

The affine transformation to apply to wrapped out in order to fit the samples into the corresponding region of this cubemap face rectangle.

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

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

  • If X1 is less than zero:
    -in <= X1 <= X2 <= 0

  • If X2 is greater than in:
    in <= X1 <= X2 <= 2 * in

  • 0 <= Y1 <= Y2 <= in

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

region.ToFace(xy.X, xy.Y, 1)

Wrap​Y


[Pure]
public method WrapY → (4)

in : int32

Maximum cubemap coordinate.

edge in : bool

Wrap around if region only touches a cubemap edge?

wrapped out : CubemapFaceRect

The cubemap face region part that lies on the wrapped cubemap face. Will be step-aligned if this region is step-aligned.

xy out : Vec2I

Local coordinates of the top-left sample of wrapped out in this cubemap face region (see remarks).

returns → Transform

The affine transformation to apply to wrapped out in order to fit the samples into the corresponding region of this cubemap face rectangle.

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

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

  • If Y1 is less than zero:
    -in <= Y1 <= Y2 <= 0

  • If Y2 is greater than in:
    in <= Y1 <= Y2 <= 2 * in

  • 0 <= X1 <= X2 <= in

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

region.ToFace(xy.X, xy.Y, 1)

Public / Attributes

Face


public readonly attribute Face → (CubemapFace)

The cubemap face.

Height


public readonly attribute Height → (int32)

Height of cubemap face rectangle, in samples.

Is​Empty


public attribute IsEmpty → (get)

value : bool

true if the rectangle is empty, false if not.

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

Rect


public attribute Rect → (get)

value : Box2I

The bounds.

Returns the bounds of this cubemap face rectangle.

Width


public readonly attribute Width → (int32)

Width of cubemap face rectangle, in samples.

X1


public readonly attribute X1 → (int32)

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

X2


public attribute X2 → (get)

value : int32

The coordinate.

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

Y1


public readonly attribute Y1 → (int32)

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

Y2


public attribute Y2 → (get)

value : int32

The coordinate.

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

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<CubemapFaceRect>

[not-null]
The configurator object.

The configurator object for this type.