ShaderSignal


The ShaderSignal represents a shader signal.

Properties

PropertyDescription

w

Gets the W component.

x

Gets the X component.

y

Gets the Y component.

z

Gets the Z component.

Methods

MethodDescription

abs

ScalarSignal.abs(): ScalarSignal

Returns a signal with the value that is the absolute value of the given signal.

See Also: ReactiveModule.abs

add

ScalarSignal.add(other: ScalarSignal): ScalarSignal PointSignal.add(other: VectorSignal): PointSignal VectorSignal.add(other: VectorSignal): VectorSignal VectorSignal.add(other: PointSignal): PointSignal

Returns a signal with the value that is the sum of the values of the given signals.

Note: add and sum functions are synonyms, the behavior they provide is equivalent.

See Also: ScalarSignal.sum, ReactiveModule.add`

atan2

ScalarSignal.atan2(other: ScalarSignal): ScalarSignal

Returns a signal with the value that is the angle in radians between the x-axis and the ray from (0, 0) to (x, y) where x and y are the values of the specified signals. The range is -PI to +PI.

See Also: ReactiveModule.atan2

ceil

ScalarSignal.ceil(): ScalarSignal

Returns a signal with the value that is the smallest integer that is greater than or equal to the value of the given signal.

See Also: ReactiveModule.ceil

cross

VectorSignal.cross(other: VectorSignal): VectorSignal

Returns a vector signal with the value that is the cross product of the given signals.

See Also: VectorSignal.dot, ScalarSignal.mul, VectorSignal.mul

distance

PointSignal.distance(other: PointSignal): ScalarSignal

Returns the distance from the point to another point as a ScalarSignal.

div

ScalarSignal.div(other: ScalarSignal): ScalarSignal

Returns a signal with the value that is the value of the first signal divided by the value of the second signal.

See Also: ReactiveModule.div

dot

VectorSignal.dot(other: VectorSignal): ScalarSignal

Returns a scalar signal with the value that is the dot product of the given signals.

See Also: VectorSignal.cross, ScalarSignal.mul, VectorSignal.mul

floor

ScalarSignal.floor(): ScalarSignal

Returns a signal with the value that is the largest integer that is less than or equal to the value of the given signal.

See Also: ReactiveModule.floor

fromRange

ReactiveModule.fromRange(x: ScalarSignal, min: ScalarSignal, max: ScalarSignal): ScalarSignal

Maps x from [min, max] range to [0.0, 1.0] range.

magnitude

VectorSignal.magnitude(): ScalarSignal

Returns the magnitude of the vector as a ScalarSignal.

mod

ScalarSignal.mod(other: ScalarSignal): ScalarSignal

Returns a signal with the value that is the floating-point remainder of the division of the value of the first signal by the value of the second signal.

See Also: ReactiveModule.mod

mul

ScalarSignal.mul(other: ScalarSignal): ScalarSignal ScalarSignal.mul(other: VectorSignal): VectorSignal VectorSignal.mul(other: ScalarSignal): VectorSignal VectorSignal.mul(other: ScalarSignal): VectorSignal

Returns a signal with the value that is the product of the values of the given signals.

See Also: ReactiveModule.mul, ScalarSignal.mul, VectorSignal.mul

neg

ScalarSignal.neg(): ScalarSignal VectorSignal.neg(): VectorSignal

Returns a signal with the negated value of the given signal.

See Also: ReactiveModule.neg, ScalarSignal.neg, VectorSignal.neg

normalize

ReactiveModule.normalize(v: VectorSignal): VectorSignal Vectorsignal.normalize(): VectorSignal

Returns the normalized (unit) vector in the direction of the original vector as a VectorSignal.

pow

ScalarSignal.pow(exponent: ScalarSignal): ScalarSignal

Returns a signal with the value that is the base signal raised to the power of the exponent signal.

Raising a negative base to the power of a fractional exponent produce a NaN. Raising 0 to the power of a negative exponent will produce positive infinity. Raising 0 to the power of any positive exponent will produce 0. Raising -1 to the power of a positive or negative infinity exponent will produce 1. Raising 1 to the power of any exponent, including NaN, will produce 1. Raising any base, including NaN, to the power of 0 will produce 1. Raising any base to the power of negative infinity, where |base| < 1, will produce positive infinity. Raising any base to the power of negative infinity, where |base| > 1, will produce 0. Raising any base to the power of positive infinity, where |base| < 1, will produce 0. Raising any base to the power of positive infinity, where |base| > 1, will produce positive infinity. Raising negative infinity to the power of a negative exponent will produce 0. Raising negative infinity to the power of a positive exponent will produce positive infinity. Raising positive infinity to the power of a negative exponent will produce 0. Raising positive infinity to the power of a positive exponent will produce positive infinity.

In all other cases, if either the base or the exponent is a NaN, a NaN will be produced.

See Also: ReactiveModule.pow

reflect

ReactiveModule.reflect(incident: VectorSignal, normal: VectorSignal): VectorSignal Vectorsignal.reflect(normal: VectorSignal): VectorSignal

Calculates the reflection direction for an incident vector and a normal as a VectorSignal.

round

ScalarSignal.round(): ScalarSignal

Returns a signal with the value that is the rounded value of the given signal.

Note: When the fractional part is 0.5, it rounds the number away from zero, which is at odds with JavaScript standard behavior of rounding it always up in such cases. Therefore, this function is NOT exactly the reactive counterpart of the standard JavaScript Math.round utility.

See Also: ReactiveModule.round

sign

ScalarSignal.sign(): ScalarSignal

Returns a signal with the value that is the sign of the given signal. Possible sign values: NaN, -0.0, 0.0, -1.0, 1.0.

Note: this function is the reactive counterpart of the standard JavaScript Math.sign utility.

See Also: ReactiveModule.sign

smoothStep

ReactiveModule.smoothStep(x: ScalarSignal, edge0: ScalarSignal, edge1: ScalarSignal): ScalarSignal

Returns 0.0 if x is less than edge0, and 1.0 if x is greater than edge1. If x is between edge0 and edge1, smooth Hermite interpolation is performed.

sqrt

ScalarSignal.sqrt(): ScalarSignal

Returns a signal with the value that is the square root of the value of the given signal.

See Also: ReactiveModule.sqrt

sub

ScalarSignal.sub(other: ScalarSignal): ScalarSignal PointSignal.sub(other: PointSignal): VectorSignal PointSignal.sub(other: VectorSignal): PointSignal VectorSignal.sub(other: VectorSignal): VectorSignal

Returns a signal with the value that is the difference of the values of the given signals.

See Also: ReactiveModule.sub, ScalarSignal.sub, VectorSignal.sub, PointSignal.sub

sum

ScalarSignal.sum(other: ScalarSignal): ScalarSignal PointSignal.sum(other: VectorSignal): PointSignal VectorSignal.sum(other: VectorSignal): VectorSignal VectorSignal.sum(other: PointSignal): PointSignal

Returns a signal with the value that is the sum of the values of the given signals.

Note: add and sum functions are synonyms, the behavior they provide is equivalent.

See Also: ScalarSignal.sum, ReactiveModule.add`

toRange

ReactiveModule.toRange(x: ScalarSignal, min: ScalarSignal, max: ScalarSignal): ScalarSignal

Maps x from [0.0, 1.0] range to [min, max] range.

valueOf (inherited from ISignal)

valueOf(): void

Throws an error. Signals are not supposed to be implicitly converted to scalar values.

See also: ScalarSignal.add, ScalarSignal.sub, ScalarSignal.mul, ScalarSignal.div