@itwin/core-frontend
Version:
iTwin.js frontend components
37 lines • 1.54 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* 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
*/
import { _batch, _branch, _implementationProhibited, _nodes } from "../../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
*/
export 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 {
[ ]: undefined,
isInstanceable,
[ ]: args.nodes,
[ ]: args.batch,
[ ]: args.branch,
};
}
//# sourceMappingURL=GraphicTemplateImpl.js.map