"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 Rendering
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.createGraphicTemplate = createGraphicTemplate;
const Symbols_1 = require("../common/internal/Symbols");
/** Create a GraphicTemplate.
 * If the caller specifies `noDispose` as `true`, every RenderGeometry in every node will be marked `noDispose`;
 * this permits the same template to be reused by multiple graphics. The garbage collector will reclaim its
 * WebGL resources and its `dispose` method will do nothing.
 * The `isInstancable` flag will be calculated from the nodes and their geometry.
 * @internal
 */
function createGraphicTemplate(args) {
    let isInstanceable = true;
    for (const node of args.nodes) {
        if (node.instances) {
            isInstanceable = false;
        }
        for (const geometry of node.geometry) {
            geometry.noDispose = args.noDispose;
            if (!geometry.isInstanceable) {
                isInstanceable = false;
            }
        }
    }
    return {
        [Symbols_1._implementationProhibited]: undefined,
        isInstanceable,
        [Symbols_1._nodes]: args.nodes,
        [Symbols_1._batch]: args.batch,
        [Symbols_1._branch]: args.branch,
    };
}
//# sourceMappingURL=GraphicTemplate.js.map