UNPKG

@itwin/core-backend

Version:
151 lines • 8.53 kB
/** @packageDocumentation * @module Elements */ import { Id64String } from "@itwin/core-bentley"; import { Code, CodeScopeProps, ElementProps, NormalMapProps, RenderMaterialProps, RgbFactorProps, TextureMapProps } from "@itwin/core-common"; import { DefinitionElement } from "./Element"; import { IModelDb } from "./IModelDb"; import { IModelElementCloneContext } from "./IModelElementCloneContext"; import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow } from "./Entity"; /** A PhysicalMaterial defines the matter that makes up physical elements. * @note See [[RenderMaterialElement]] for the DefinitionElement used to define rendering characteristics. * @public */ export declare abstract class PhysicalMaterial extends DefinitionElement { static get className(): string; /** Create a Code for a PhysicalMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel. * @param iModel The IModelDb * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name. * @param name The name (codeValue) of the PhysicalMaterial */ static createCode(iModel: IModelDb, definitionModelId: CodeScopeProps, name: string): Code; /** Create a PhysicalMaterial * @param iModelDb The IModelDb * @param definitionModelId The Id of the DefinitionModel that will contain the PhysicalMaterial and provide the scope for its name. * @param name The name (codeValue) of the PhysicalMaterial * @returns The newly constructed PhysicalMaterial * @throws [[IModelError]] if there is a problem creating the PhysicalMaterial */ static create<T extends PhysicalMaterial>(iModelDb: IModelDb, definitionModelId: CodeScopeProps, name: string): T; } /** Defines a rendering material. * @note See [[PhysicalMaterial]] for the DefinitionElement used to define the matter that makes up physical elements. * @public */ export declare class RenderMaterialElement extends DefinitionElement { static get className(): string; /** The name of a palette that can be used to categorize multiple materials. */ paletteName: string; /** An optional description of the material. */ description?: string; private constructor(); toJSON(): RenderMaterialProps; /** * RenderMaterialElement custom HandledProps includes 'paletteName'. * @inheritdoc * @beta */ protected static readonly _customHandledProps: CustomHandledProperty[]; /** * RenderMaterialElement deserializes 'paletteName'. * @inheritdoc * @beta */ static deserialize(props: DeserializeEntityArgs): RenderMaterialProps; /** * RenderMaterialElement serializes 'paletteName'. * @inheritdoc * @beta */ static serialize(props: RenderMaterialProps, iModel: IModelDb): ECSqlRow; /** Create a Code for a RenderMaterial given a name that is meant to be unique within the scope of the specified DefinitionModel. * @param iModel The IModelDb * @param scopeModelId The Id of the DefinitionModel that contains the RenderMaterial and provides the scope for its name. * @param name The RenderMaterial name */ static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, name: string): Code; /** * Create a RenderMaterial with given parameters. * @param iModelDb The iModel * @param definitionModelId The [[DefinitionModel]] * @param materialName The name/CodeValue of the RenderMaterial * @param params Parameters object which describes how to construct the RenderMaterial * @returns The newly constructed RenderMaterial element. * @throws [[IModelError]] if unable to create the element. */ static create(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): RenderMaterialElement; /** * Insert a new RenderMaterial into a model. * @param iModelDb Insert into this iModel * @param definitionModelId Insert the new Texture into this DefinitionModel * @param materialName The name/CodeValue of the RenderMaterial * @param params Parameters object which describes how to construct the RenderMaterial * @returns The Id of the newly inserted RenderMaterial element. * @throws [[IModelError]] if unable to insert the element. */ static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String; /** @beta */ protected static onCloned(context: IModelElementCloneContext, sourceProps: ElementProps, targetProps: ElementProps): Promise<void>; } /** @public */ export declare namespace RenderMaterialElement { /** Parameters used to construct a [[RenderMaterial]]. * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat. * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type. * @deprecated in 3.6 - might be removed in next major version. Because it is not useful to use a `class` - just use [[RenderMaterialElementParams]] directly instead. */ class Params { /** A required palette name that categorizes this RenderMaterial */ paletteName: string; /** An optional description of this RenderMaterial */ description?: string; /** If defined, the color to use for surface fill or diffuse illumination, overriding the surface's own color. */ color?: RgbFactorProps; /** The color to use for specular illumination. Default: black. */ specularColor?: RgbFactorProps; /** The specular exponent describing the surface's shininess, in the range 0 through 128. * Default: 0. */ finish?: number; /** A transparency to be applied to the surface, ranging from 0 (fully opaque) to 1 (fully transparent). * If defined, then the material transparency overrides the transparency of whatever surface the material is applied to. * If undefined, the material has no effect on surface transparency. * Default: undefined. */ transmit?: number; /** The surface's diffuse reflectivity from 0.0 to 1.0. Default: 0.6. */ diffuse?: number; /** The surface's specular reflectivity from 0.0 to 1.0. Default: 0.0. */ specular?: number; /** Currently unused. */ reflect?: number; /** Currently unused. */ reflectColor?: number[]; /** Specifies a texture image to map onto the surface, replacing or mixing with the surface's own color and transparency. * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence. */ patternMap?: TextureMapProps; /** Specifies a [normal map](https://en.wikipedia.org/wiki/Normal_mapping) to apply to the surface to simulate more surface detail than is present in the * surface's geometry. * @note With the exception of `TextureId`, the [TextureMapProps]($common) of [[patternMap]] and [[normalMap]] are expected to be identical. If a property is defined in both * [[patternMap]]] and [[normalMap]], the value in [[patternMap]] takes precedence. */ normalMap?: NormalMapProps & { /** A factor by which to multiply the components of the normal vectors read from the texture. * Default: 1. */ scale?: number; }; /** Construct a new RenderMaterial.Params object with the specified paletteName. Alter the public members on that object to specify settings. */ constructor(paletteName: string); } } /** Parameters used to create a [[RenderMaterial]] element. * The persistent JSON representation - [RenderMaterialAssetProps]($common) - is quite verbose and unwieldy. This representation simplifies it somewhat. * @see [[RenderMaterialElement.create]] and [[RenderMaterialElement.insert]] to create a [[RenderMaterial]] from parameters of this type. * @public */ export interface RenderMaterialElementParams extends RenderMaterialElement.Params { } //# sourceMappingURL=Material.d.ts.map