All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.cesium.WeightSpline.kt Maven / Gradle / Ivy

There is a newer version: 1.90.0-10
Show newest version
// Automatically generated - do not modify!

@file:Suppress(
    "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE",
)

package cesium

/**
 * A spline that linearly interpolates over an array of weight values used by morph targets.
 * ```
 * var times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
 * var weights = [0.0, 1.0, 0.25, 0.75, 0.5, 0.5, 0.75, 0.25, 1.0, 0.0]; //Two targets
 * var spline = new WeightSpline({
 *     times : times,
 *     weights : weights
 * });
 *
 * var p0 = spline.evaluate(times[0]);
 * ```
 * @see Online Documentation
 */
@JsName("\$cesium__WeightSpline")
external class WeightSpline(options: ConstructorOptions) {
    /**
     * @property [times] An array of strictly increasing, unit-less, floating-point times at each point.
     *   The values are in no way connected to the clock time. They are the parameterization for the curve.
     * @property [weights] The array of floating-point control weights given. The weights are ordered such
     *   that all weights for the targets are given in chronological order and order in which they appear in
     *   the glTF from which the morph targets come. This means for 2 targets, weights = [w(0,0), w(0,1), w(1,0), w(1,1) ...]
     *   where i and j in w(i,j) are the time indices and target indices, respectively.
     */
    interface ConstructorOptions {
        var times: Array
        var weights: Array
    }

    /**
     * An array of times for the control weights.
     * @see Online Documentation
     */
    val times: Array

    /**
     * An array of floating-point array control weights.
     * @see Online Documentation
     */
    val weights: Array

    /**
     * Finds an index `i` in `times` such that the parameter
     * `time` is in the interval `[times[i], times[i + 1]]`.
     * @param [time] The time.
     * @return The index for the element at the start of the interval.
     * @see Online Documentation
     */
    fun findTimeInterval(time: Double): Int

    /**
     * Wraps the given time to the period covered by the spline.
     * @param [time] The time.
     * @return The time, wrapped around to the updated animation.
     * @see Online Documentation
     */
    fun wrapTime(time: Double): Double

    /**
     * Clamps the given time to the period covered by the spline.
     * @param [time] The time.
     * @return The time, clamped to the animation period.
     * @see Online Documentation
     */
    fun clampTime(time: Double): Double

    /**
     * Evaluates the curve at a given time.
     * @param [time] The time at which to evaluate the curve.
     * @param [result] The object onto which to store the result.
     * @return The modified result parameter or a new instance of the point on the curve at the given time.
     * @see Online Documentation
     */
    fun evaluate(
        time: Double,
        result: Array? = definedExternally,
    ): Array
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy