UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

63 lines 3.36 kB
"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.RenderTexture = void 0; const core_bentley_1 = require("@itwin/core-bentley"); /** Represents a texture image applied to a surface during rendering. * A RenderTexture is typically - but not always - associated with a [[RenderMaterial]]. * @see [RenderSystem.createTexture]($frontend) to obtain a texture. * @see [RenderSystem.createTextureFromElement]($frontend) to obtain a texture from a [Texture]($backend) element. * @public */ class RenderTexture { /** Indicates the type of texture. */ type; /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */ _guid; get isTileSection() { return RenderTexture.Type.TileSection === this.type; } get isGlyph() { return RenderTexture.Type.Glyph === this.type; } get isSkyBox() { return RenderTexture.Type.SkyBox === this.type; } constructor(type) { this.type = type; this._guid = core_bentley_1.Guid.createValue(); } /** Releases any WebGL resources owned by this texture. * For a texture created by a [RenderSystem]($frontend) for which [CreateTextureArgs.ownership]($frontend) was specified as "external", * the caller is responsible for invoking this method when it is finished using the texture; otherwise, the [RenderSystem]($frontend) will handle * its disposal. */ [Symbol.dispose]() { this.dispose(); // eslint-disable-line @typescript-eslint/no-deprecated } /** An [OrderedComparator]($bentley) that compares this texture against `other`. */ compare(other) { return (0, core_bentley_1.compareStrings)(this._guid, other._guid); } } exports.RenderTexture = RenderTexture; /** @public */ (function (RenderTexture) { /** The types of [[RenderTexture]]s that can be created by a [RenderSystem]($frontend). */ let Type; (function (Type) { /** An image applied to a surface, with support for mip-mapping and repetition. */ Type[Type["Normal"] = 0] = "Normal"; /** An image containing any number of text glyphs, used for efficiently rendering readable small text. */ Type[Type["Glyph"] = 1] = "Glyph"; /** A non-repeating image with no mip-maps, used for example for reality models. */ Type[Type["TileSection"] = 2] = "TileSection"; /** A three-dimensional texture used for rendering a skybox. */ Type[Type["SkyBox"] = 3] = "SkyBox"; /** A non-repeating image with mip-maps and and anisotropic filtering, used for map tiles when draped on terrain. */ Type[Type["FilteredTileSection"] = 4] = "FilteredTileSection"; /** A gradient image used for thematic display. */ Type[Type["ThematicGradient"] = 5] = "ThematicGradient"; })(Type = RenderTexture.Type || (RenderTexture.Type = {})); })(RenderTexture || (exports.RenderTexture = RenderTexture = {})); //# sourceMappingURL=RenderTexture.js.map