# SceneScript Class Vec4

Vec4 utility class used for creating a vector with 4 dimensions. Note that Vec4 is rather uncommon in Wallpaper Engine, you will mostly find it in some effect parameters.

# Properties

# x: Number

Value of first component.

# y: Number

Value of second component.

# z: Number

Value of third component.

# w: Number

Value of fourth component.

# Constructors

# constructor(x: Number|Vec2|Vec3|Vec4|String, y?: Number, z?: Number, w?: Number): Vec4

Creates a 4-dimensional vector.

# Functions

# length(): Number

The length.

# lengthSqr(): Number

The length squared (more efficient for simple comparisons in your code).

# distance(other: Vec4): Number

Distance to another vector.

# distanceSqr(other: Vec4): Number

Distance squared to another vector (more efficient for simple comparisons in your code).

# normalize(): Vec4

Normalizes the length.

# copy(): Vec4

Makes a simple copy of the vector.

# equals(other: Vec4): Boolean

Checks if one vector is equal (with epsilon) to another vector.

# isFinite(): Boolean

Checks if all components are finite numbers.

# negate(): Vec4

Returns the vector negated component-wise.

# add(value: Number|Vec4): Vec4

Adds another vector or number.

# subtract(value: Number|Vec4): Vec4

Subtracts another vector or number.

# multiply(value: Number|Vec4): Vec4

Multiplies with another vector or number.

# divide(value: Number|Vec4): Vec4

Divides by another vector or number.

# dot(value: Vec4): Number

Computes dot product with value.

# reflect(normal: Vec4): Vec4

Reflects along given normal.

# project(value: Vec4): Vec4

Projects this vector onto another vector.

# mix(other: Vec4, amount: Number|Vec4): Vec4

Interpolate between this vector and another vector of the same dimension.

  • other: The other vector for the interpolation.
  • amount: Interpolation value between 0.00 and 1.00 where 1.00 represents the other vector.

# min(value: Vec4): Vec4

Return the smaller value per component of two vectors.

# max(value: Vec4): Vec4

Return the larger value per component of two vectors.

# clamp(min: Number|Vec4, max: Number|Vec4): Vec4

Clamps each component between min and max bounds (each may be a scalar or a vector).

# abs(): Vec4

Returns absolute values for each vector component.

# sign(): Vec4

Returns sign of each vector component.

# round(): Vec4

Rounds each vector component.

# floor(): Vec4

Returns floor value of each vector component.

# ceil(): Vec4

Returns ceil value of each vector component.

# fract(): Vec4

Returns the fractional part of each component (x - floor(x)).

# mod(value: Number|Vec4): Vec4

Modulo per component following GLSL semantics: x - y * floor(x / y).

# step(edge: Number|Vec4): Vec4

Per-component step: returns 0 where this < edge, 1 otherwise.

# smoothStep(min: Number|Vec4, max: Number|Vec4): Vec4

Per-component Hermite smooth interpolation between min and max edges.

# toString(): String

Converts components to a string representation that Wallpaper Engine understands.