UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

111 lines 6.13 kB
/** @packageDocumentation * @module Rendering */ import { Id64, Id64String, UintArray } from "@itwin/core-bentley"; import { BatchType, ComputeNodeId, FeatureTable, ModelFeature, PackedFeature, PackedFeatureWithIndex, RenderFeatureTable } from "../FeatureTable"; /** * An immutable, packed representation of a [[FeatureTable]]. The features are packed into a single array of 32-bit integer values, * wherein each feature occupies 3 32-bit integers. * @internal */ export declare class PackedFeatureTable implements RenderFeatureTable { readonly data: Uint32Array; readonly batchModelId: Id64String; readonly batchModelIdPair: Id64.Uint32Pair; readonly numFeatures: number; readonly anyDefined: boolean; readonly type: BatchType; animationNodeIds?: UintArray; get byteLength(): number; /** Construct a PackedFeatureTable from the packed binary data. * This is used internally when deserializing Tiles in iMdl format. * @internal */ constructor(data: Uint32Array, modelId: Id64String, numFeatures: number, type: BatchType, animationNodeIds?: UintArray); /** Create a packed feature table from a [[FeatureTable]]. */ static pack(featureTable: FeatureTable): PackedFeatureTable; /** Retrieve the Feature associated with the specified index. */ getFeature(featureIndex: number, result: ModelFeature): ModelFeature; /** Returns the Feature associated with the specified index, or undefined if the index is out of range. */ findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined; /** @internal */ getElementIdPair(featureIndex: number, out?: Id64.Uint32Pair): Id64.Uint32Pair; /** @internal */ getSubCategoryIdPair(featureIndex: number): Id64.Uint32Pair; /** @internal */ getAnimationNodeId(featureIndex: number): number; /** @internal */ getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature; getModelIdPair(_featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair; /** Returns the element ID of the Feature associated with the specified index, or undefined if the index is out of range. */ findElementId(featureIndex: number): Id64String | undefined; /** Return true if this table contains exactly 1 feature. */ get isUniform(): boolean; /** If this table contains exactly 1 feature, return it. */ getUniform(result: ModelFeature): ModelFeature | undefined; get isVolumeClassifier(): boolean; get isPlanarClassifier(): boolean; get isClassifier(): boolean; /** Unpack the features into a [[FeatureTable]]. */ unpack(): FeatureTable; populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void; iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex>; iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>; private get _subCategoriesOffset(); private readId; } interface PackedFeatureModelEntry { lastFeatureIndex: number; idLower: number; idUpper: number; } /** A table of model Ids associated with a [[MultiModelPackedFeatureTable]]. * The feature indices in the packed feature table are grouped together by model, such that the first N features belong to model 1, the next M features to model 2, and so on. * The model table itself consists of one entry per model, where each entry looks like: * indexOfLastFeatureInModel: u32 * modelId: u64 * The modelId associated with a feature can therefore be derived by finding the entry in the model table with the highest indexOfLastFeatureInModel no greater than the feature index. * This lookup can be optimized using binary search. * Moreover, while iterating the feature table in sequence, the model table can be iterated in parallel so that no per-feature lookup of model Id is required. * @internal */ export declare class PackedFeatureModelTable { private readonly _data; constructor(data: Uint32Array); /** The number of models in the table. */ get length(): number; get byteLength(): number; private getLastFeatureIndex; getEntry(modelIndex: number, result: PackedFeatureModelEntry): PackedFeatureModelEntry; /** Get the Id of the model associated with the specified feature, or an invalid Id if the feature is not associated with any model. */ getModelIdPair(featureIndex: number, result?: Id64.Uint32Pair): Id64.Uint32Pair; } /** A PackedFeatureTable with a PackedFeatureModelTable appended to it, capable of storing features belonging to more than one model. * @internal */ export declare class MultiModelPackedFeatureTable implements RenderFeatureTable { private readonly _features; private readonly _models; constructor(features: PackedFeatureTable, models: PackedFeatureModelTable); static create(data: Uint32Array, batchModelId: Id64String, numFeatures: number, type: BatchType, numSubCategories: number): MultiModelPackedFeatureTable; get batchModelId(): string; get batchModelIdPair(): Id64.Uint32Pair; get numFeatures(): number; get type(): BatchType; get animationNodeIds(): UintArray | undefined; set animationNodeIds(ids: UintArray | undefined); get byteLength(): number; getPackedFeature(featureIndex: number, result: PackedFeature): PackedFeature; getFeature(featureIndex: number, result: ModelFeature): ModelFeature; findFeature(featureIndex: number, result: ModelFeature): ModelFeature | undefined; getElementIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair; getModelIdPair(featureIndex: number, out: Id64.Uint32Pair): Id64.Uint32Pair; findElementId(featureIndex: number): Id64String | undefined; iterator(output: PackedFeatureWithIndex): Iterator<PackedFeatureWithIndex>; iterable(output: PackedFeatureWithIndex): Iterable<PackedFeatureWithIndex>; getAnimationNodeId(featureIndex: number): number; populateAnimationNodeIds(computeNodeId: ComputeNodeId, maxNodeId: number): void; } export declare function createPackedFeature(): PackedFeature; export {}; //# sourceMappingURL=PackedFeatureTable.d.ts.map