@itwin/core-frontend
Version:
iTwin.js frontend components
43 lines • 2.3 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
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RenderGraphicOwner = exports.RenderGraphic = void 0;
/** Abstract representation of an object which can be rendered by a [[RenderSystem]].
* Two broad classes of graphics exist:
* - "Scene" graphics generated on the back-end to represent the contents of the models displayed in a [[Viewport]]; and
* - [[Decorations]] created on the front-end to be rendered along with the scene.
* The latter are produced using a [[GraphicBuilder]].
* @public
* @extensions
*/
class RenderGraphic {
[Symbol.dispose]() {
this.dispose(); // eslint-disable-line @typescript-eslint/no-deprecated
}
}
exports.RenderGraphic = RenderGraphic;
/** A graphic that owns another graphic. By default, every time a [[Viewport]]'s decorations or dynamics graphics change, the previous graphics are disposed of.
* Use a GraphicOwner to prevent disposal of a graphic that you want to reuse. The graphic owner can be added to decorations and list of dynamics just like any other graphic, but the graphic it owns
* will never be automatically disposed of. Instead, you assume responsibility for disposing of the owned graphic by calling [[disposeGraphic]] when the owned graphic is no longer in use. Failure
* to do so will result in leaks of graphics memory or other webgl resources.
* @public
* @extensions
*/
class RenderGraphicOwner extends RenderGraphic {
/** Does nothing. To dispose of the owned graphic, use [[disposeGraphic]]. */
dispose() { }
/** Disposes of the owned graphic. */
disposeGraphic() { this.graphic[Symbol.dispose](); }
/** @internal */
collectStatistics(stats) { this.graphic.collectStatistics(stats); }
/** @internal */
unionRange(range) { this.graphic.unionRange(range); }
}
exports.RenderGraphicOwner = RenderGraphicOwner;
//# sourceMappingURL=RenderGraphic.js.map
;