/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module WebGL
 */
import { dispose, disposeArray } from "@itwin/core-bentley";
/** The various graphics associated with a [[Target]].
 * @internal
 */
export class TargetGraphics {
    foreground = [];
    background = [];
    overlays = [];
    foregroundDynamics = [];
    overlayDynamics = [];
    _decorations;
    [Symbol.dispose]() {
        this.foreground.length = this.background.length = this.overlays.length = 0;
        disposeArray(this.foregroundDynamics);
        disposeArray(this.overlayDynamics);
        this._decorations = dispose(this._decorations);
    }
    get isDisposed() {
        return 0 === this.foreground.length && 0 === this.background.length && 0 === this.overlays.length
            && 0 === this.foregroundDynamics.length && 0 === this.overlayDynamics.length && !this._decorations;
    }
    changeScene(scene) {
        this.foreground = scene.foreground;
        this.background = scene.background;
        this.overlays = scene.overlay;
    }
    changeDynamics(foreground, overlay) {
        disposeArray(this.foregroundDynamics);
        disposeArray(this.overlayDynamics);
        this.foregroundDynamics = foreground ?? [];
        this.overlayDynamics = overlay ?? [];
    }
    get decorations() { return this._decorations; }
    set decorations(decorations) {
        dispose(this._decorations);
        this._decorations = decorations;
    }
    get canvasDecorations() {
        return this._decorations?.canvasDecorations;
    }
}
//# sourceMappingURL=TargetGraphics.js.map