"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module IModelApp
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoRenderApp = exports.NullRenderSystem = exports.NullTarget = void 0;
const core_common_1 = require("@itwin/core-common");
const IModelApp_1 = require("./IModelApp");
const RenderSystem_1 = require("./render/RenderSystem");
const RenderTarget_1 = require("./render/RenderTarget");
const ViewRect_1 = require("./common/ViewRect");
const Symbols_1 = require("./common/internal/Symbols");
/**
 * A RenderTarget for applications that must run in environments where WebGL is not present.
 * This is typically used in tests.
 * @internal
 */
class NullTarget extends RenderTarget_1.RenderTarget {
    [Symbols_1._implementationProhibited] = undefined;
    get analysisFraction() { return 0; }
    set analysisFraction(_fraction) { }
    get renderSystem() { return undefined; }
    get viewRect() { return new ViewRect_1.ViewRect(); }
    get wantInvertBlackBackground() { return false; }
    get animationBranches() { return undefined; }
    set animationBranches(_branches) { }
    onDestroy() { }
    reset(_realityMapLayerChanged) { }
    changeScene() { }
    changeDynamics() { }
    changeDecorations() { }
    changeRenderPlan() { }
    drawFrame(_sceneMilSecElapsed) { }
    overrideFeatureSymbology() { }
    setHiliteSet() { }
    setFlashed() { }
    setViewRect() { }
    onResized() { }
    [Symbol.dispose]() { }
    updateViewRect() { return false; }
    readPixels() { }
    get screenSpaceEffects() { return []; }
    set screenSpaceEffects(_effects) { }
}
exports.NullTarget = NullTarget;
/**
 * A RenderSystem for applications that must run in environments where WebGL is not present.
 * This is typically used in tests.
 * @internal
 */
class NullRenderSystem extends RenderSystem_1.RenderSystem {
    get isValid() { return false; }
    doIdleWork() { return false; }
    createTarget() { return new NullTarget(); }
    createOffscreenTarget() { return new NullTarget(); }
    createGraphic() { return undefined; }
    createGraphicList() { return undefined; }
    createGraphicBranch() { return undefined; }
    createBatch() { return undefined; }
    dispose() { }
    constructor() { super(); }
    createRenderGraphic() { return undefined; }
    createGraphicFromTemplate() { return undefined; }
}
exports.NullRenderSystem = NullRenderSystem;
/** A utility class intended for applications (primarily test-runners) that run in environments that lack support for WebGL.
 * It installs a [[RenderSystem]] that produces no graphics.
 * Use [[NoRenderApp.startup]] instead of [[IModelApp.startup]] to initialize your application frontend.
 * You may then use the [[IModelApp]] API as normal.
 * @public
 */
class NoRenderApp {
    /** Initializes [[IModelApp]] with a [[RenderSystem]] that produces no graphics.
     * Use this in place of [[IModelApp.startup]], then proceed to use [[IModelApp]]'s API as normal.
     */
    static async startup(opts) {
        opts = opts ? opts : {};
        opts.renderSys = new NullRenderSystem();
        opts.noRender = true;
        opts.localization = opts.localization ?? new core_common_1.EmptyLocalization();
        await IModelApp_1.IModelApp.startup(opts);
    }
}
exports.NoRenderApp = NoRenderApp;
//# sourceMappingURL=NoRenderApp.js.map