UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

32 lines 1.42 kB
/*--------------------------------------------------------------------------------------------- * 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 { compareStrings, Guid } from "@itwin/core-bentley"; /** Represents a material which can be applied to a surface to control aspects of its appearance such as color, reflectivity, texture, and so on. * @public */ export class RenderMaterial { /** If the material originated from a Material element in the [[IModelDb]], the Id of that element. */ key; /** Describes how to map an image to a surface to which this material is applied. */ textureMapping; /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */ _guid; constructor(params) { this.key = params.key; this.textureMapping = params.textureMapping; this._guid = Guid.createValue(); } get hasTexture() { return undefined !== this.textureMapping?.texture; } /** An [OrderedComparator]($bentley) that compares this material against `other`. */ compare(other) { return compareStrings(this._guid, other._guid); } } //# sourceMappingURL=RenderMaterial.js.map