/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module DisplayStyles
 */
/** Settings that control how a point cloud reality model is displayed within a [Viewport]($frontend).
 * @note This is an immutable type - to modify its properties, use [[clone]].
 * Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique that was designed to improve depth
 * perception in scientific visualization. It is particularly useful for visualizing monochrome point cloud data, but
 * also can be useful for point clouds with color information.
 * @note EDL mode is ignored (off) if the view is not perspective (camera is off)
 * @see [[RealityModelDisplaySettings.pointCloud]].
 * @beta
 */
export class PointCloudDisplaySettings {
    constructor(props) {
        this.shape = props?.shape ?? "round";
        this.sizeMode = props?.sizeMode ?? "voxel";
        // No sanity checks here - e.g., min < max, pixelSize and voxelScale > 0, etc.
        this.pixelSize = props?.pixelSize ?? 1;
        this.voxelScale = props?.voxelScale ?? 1;
        this.minPixelsPerVoxel = props?.minPixelsPerVoxel ?? 2;
        this.maxPixelsPerVoxel = props?.maxPixelsPerVoxel ?? 20;
        this.edlMode = props?.edlMode ?? "off";
        this.edlStrength = props?.edlStrength ?? 5;
        this.edlRadius = props?.edlRadius ?? 2;
        this.edlFilter = props?.edlFilter ?? 1;
        this.edlMixWts1 = props?.edlMixWts1 ?? 1.0;
        this.edlMixWts2 = props?.edlMixWts2 ?? 0.5;
        this.edlMixWts4 = props?.edlMixWts4 ?? 0.25;
    }
    /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */
    static fromJSON(props) {
        return props ? new PointCloudDisplaySettings(props) : this.defaults;
    }
    /** Convert these settings to their JSON representation. */
    toJSON() {
        const defs = PointCloudDisplaySettings.defaults;
        if (this.equals(defs))
            return undefined;
        const props = {};
        if (this.shape !== defs.shape)
            props.shape = this.shape;
        if (this.sizeMode !== defs.sizeMode)
            props.sizeMode = this.sizeMode;
        if (this.pixelSize !== defs.pixelSize)
            props.pixelSize = this.pixelSize;
        if (this.voxelScale !== defs.voxelScale)
            props.voxelScale = this.voxelScale;
        if (this.minPixelsPerVoxel !== defs.minPixelsPerVoxel)
            props.minPixelsPerVoxel = this.minPixelsPerVoxel;
        if (this.maxPixelsPerVoxel !== defs.maxPixelsPerVoxel)
            props.maxPixelsPerVoxel = this.maxPixelsPerVoxel;
        if (this.edlMode !== defs.edlMode)
            props.edlMode = this.edlMode;
        if (this.edlStrength !== defs.edlStrength)
            props.edlStrength = this.edlStrength;
        if (this.edlRadius !== defs.edlRadius)
            props.edlRadius = this.edlRadius;
        if (this.edlFilter !== defs.edlFilter)
            props.edlFilter = this.edlFilter;
        if (this.edlMixWts1 !== defs.edlMixWts1)
            props.edlMixWts1 = this.edlMixWts1;
        if (this.edlMixWts2 !== defs.edlMixWts2)
            props.edlMixWts2 = this.edlMixWts2;
        if (this.edlMixWts4 !== defs.edlMixWts4)
            props.edlMixWts4 = this.edlMixWts4;
        return props;
    }
    /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */
    clone(changedProps) {
        return PointCloudDisplaySettings.fromJSON({
            ...this.toJSON(),
            ...changedProps,
        });
    }
    /** Returns true if these settings are identical to `other`. */
    equals(other) {
        if (this === other)
            return true;
        return this.shape === other.shape && this.sizeMode === other.sizeMode && this.pixelSize === other.pixelSize
            && this.voxelScale === other.voxelScale && this.minPixelsPerVoxel === other.minPixelsPerVoxel && this.maxPixelsPerVoxel === other.maxPixelsPerVoxel
            && this.edlMode === other.edlMode && this.edlStrength === other.edlStrength && this.edlRadius === other.edlRadius
            && this.edlFilter === other.edlFilter
            && this.edlMixWts1 === other.edlMixWts1 && this.edlMixWts2 === other.edlMixWts2 && this.edlMixWts4 === other.edlMixWts4;
    }
}
/** Settings with all properties initialized to their default values. */
PointCloudDisplaySettings.defaults = new PointCloudDisplaySettings();
/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).
 * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.
 * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.
 * @note This is an immutable type - to modify its properties, use [[clone]].
 * @beta
 */
export class RealityModelDisplaySettings {
    constructor(overrideColorRatio, pointCloud) {
        this.overrideColorRatio = overrideColorRatio ?? 0.5;
        this.pointCloud = pointCloud;
    }
    /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */
    static fromJSON(props) {
        if (!props)
            return this.defaults;
        return new RealityModelDisplaySettings(props.overrideColorRatio, PointCloudDisplaySettings.fromJSON(props.pointCloud));
    }
    /** Convert these settings to their JSON representation, which is `undefined` if all of their properties match the default settings. */
    toJSON() {
        const pointCloud = this.pointCloud.toJSON();
        const overrideColorRatio = this.overrideColorRatio === RealityModelDisplaySettings.defaults.overrideColorRatio ? undefined : this.overrideColorRatio;
        if (undefined === pointCloud && undefined === overrideColorRatio)
            return undefined;
        const props = {};
        if (undefined !== pointCloud)
            props.pointCloud = pointCloud;
        if (undefined !== overrideColorRatio)
            props.overrideColorRatio = overrideColorRatio;
        return props;
    }
    /** Returns true if these settings are identical to `other`. */
    equals(other) {
        if (this === other)
            return true;
        return this.overrideColorRatio === other.overrideColorRatio && this.pointCloud.equals(other.pointCloud);
    }
    /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */
    clone(changedProps) {
        const pointCloud = changedProps.pointCloud ? this.pointCloud.clone(changedProps.pointCloud) : this.pointCloud;
        const colorRatio = changedProps.hasOwnProperty("overrideColorRatio") ? changedProps.overrideColorRatio : this.overrideColorRatio;
        return new RealityModelDisplaySettings(colorRatio, pointCloud);
    }
}
/** Settings with all properties initialized to their default values. */
RealityModelDisplaySettings.defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);
//# sourceMappingURL=RealityModelDisplaySettings.js.map