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

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

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

package cesium

/**
 * Value and type information for per-instance geometry color.
 * ```
 * var instance = new GeometryInstance({
 *   geometry : BoxGeometry.fromDimensions({
 *     dimensions : new Cartesian3(1000000.0, 1000000.0, 500000.0)
 *   }),
 *   modelMatrix : Matrix4.multiplyByTranslation(Transforms.eastNorthUpToFixedFrame(
 *     Cartesian3.fromDegrees(0.0, 0.0)), new Cartesian3(0.0, 0.0, 1000000.0), new Matrix4()),
 *   id : 'box',
 *   attributes : {
 *     color : new ColorGeometryInstanceAttribute(red, green, blue, alpha)
 *   }
 * });
 * ```
 * @see Online Documentation
 *
 * @constructor
 * @param [red] The red component.
 *   Default value - `1.0`
 * @param [green] The green component.
 *   Default value - `1.0`
 * @param [blue] The blue component.
 *   Default value - `1.0`
 * @param [alpha] The alpha component.
 *   Default value - `1.0`
 * @see Online Documentation
 */
@JsName("\$cesium__ColorGeometryInstanceAttribute")
external class ColorGeometryInstanceAttribute(
    red: Double? = definedExternally,
    green: Double? = definedExternally,
    blue: Double? = definedExternally,
    alpha: Double? = definedExternally,
) {
    /**
     * The values for the attributes stored in a typed array.
     * @see Online Documentation
     */
    var value: org.khronos.webgl.Uint8Array

    /**
     * The datatype of each component in the attribute, e.g., individual elements in
     * [ColorGeometryInstanceAttribute.value].
     * @see Online Documentation
     */
    val componentDatatype: ComponentDatatype

    /**
     * The number of components in the attributes, i.e., [ColorGeometryInstanceAttribute.value].
     * @see Online Documentation
     */
    val componentsPerAttribute: Int

    /**
     * When `true` and `componentDatatype` is an integer format,
     * indicate that the components should be mapped to the range [0, 1] (unsigned)
     * or [-1, 1] (signed) when they are accessed as floating-point for rendering.
     * @see Online Documentation
     */
    val normalize: Boolean

    companion object {
        /**
         * Creates a new [ColorGeometryInstanceAttribute] instance given the provided [Color].
         * ```
         * var instance = new GeometryInstance({
         *   geometry : geometry,
         *   attributes : {
         *     color : fromColor(Color.CORNFLOWERBLUE),
         *   }
         * });
         * ```
         * @param [color] The color.
         * @return The new [ColorGeometryInstanceAttribute] instance.
         * @see Online Documentation
         */
        fun fromColor(color: Color): ColorGeometryInstanceAttribute

        /**
         * Converts a color to a typed array that can be used to assign a color attribute.
         * ```
         * var attributes = primitive.getGeometryInstanceAttributes('an id');
         * attributes.color = ColorGeometryInstanceAttribute.toValue(Color.AQUA, attributes.color);
         * ```
         * @param [color] The color.
         * @param [result] The array to store the result in, if undefined a new instance will be created.
         * @return The modified result parameter or a new instance if result was undefined.
         * @see Online Documentation
         */
        fun toValue(
            color: Color,
            result: org.khronos.webgl.Uint8Array? = definedExternally,
        ): org.khronos.webgl.Uint8Array

        /**
         * Compares the provided ColorGeometryInstanceAttributes and returns
         * `true` if they are equal, `false` otherwise.
         * @param [left] The first ColorGeometryInstanceAttribute.
         * @param [right] The second ColorGeometryInstanceAttribute.
         * @return `true` if left and right are equal, `false` otherwise.
         * @see Online Documentation
         */
        fun equals(
            left: ColorGeometryInstanceAttribute? = definedExternally,
            right: ColorGeometryInstanceAttribute? = definedExternally,
        ): Boolean
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy