@itwin/core-frontend
Version:
iTwin.js frontend components
197 lines • 6.51 kB
TypeScript
/** @packageDocumentation
* @module Tiles
*/
import { UintArray } from "@itwin/core-bentley";
import { XYAndZ } from "@itwin/core-geometry";
import { ColorDefProps, FeatureIndexType, FillFlags, Gradient, LinePixels, PolylineTypeFlags, QParams2dProps, QParams3dProps } from "@itwin/core-common";
import { EdgeTable } from "../internal/render/EdgeParams";
import { SurfaceMaterialAtlas, SurfaceType } from "../internal/render/SurfaceParams";
import { AuxChannelTableProps } from "../internal/render/AuxChannelTable";
import { ImdlAreaPattern, ImdlDocument } from "./ImdlSchema";
import { InstancedGraphicProps } from "../render/InstancedGraphicParams";
/** Types comprising the parsed representation of an ImdlDocument, produced by [[parseImdlDocument]] and consumed by [[decodeImdlGraphics]].
* All of the types are required to support [structured cloning](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) so that they
* can be passed between workers and the main JavaScript thread.
* @internal
*/
export declare namespace ImdlModel {
interface VertexTable {
data: Uint8Array;
usesUnquantizedPositions?: boolean;
qparams: QParams3dProps;
width: number;
height: number;
hasTranslucency: boolean;
uniformColor?: ColorDefProps;
featureIndexType: FeatureIndexType;
uniformFeatureID?: number;
numVertices: number;
numRgbaPerVertex: number;
uvParams?: QParams2dProps;
}
interface PointStringParams {
vertices: VertexTable;
indices: Uint8Array;
weight: number;
}
interface TesselatedPolyline {
indices: Uint8Array;
prevIndices: Uint8Array;
nextIndicesAndParams: Uint8Array;
}
interface PolylineParams {
vertices: VertexTable;
polyline: TesselatedPolyline;
isPlanar: boolean;
type: PolylineTypeFlags;
weight: number;
linePixels: LinePixels;
}
interface SegmentEdgeParams {
indices: Uint8Array;
endPointAndQuadIndices: Uint8Array;
}
interface SilhouetteParams extends SegmentEdgeParams {
normalPairs: Uint8Array;
}
interface IndexedEdgeParams {
indices: Uint8Array;
edges: EdgeTable;
}
interface EdgeParams {
weight: number;
linePixels: LinePixels;
segments?: SegmentEdgeParams;
silhouettes?: SilhouetteParams;
polylines?: TesselatedPolyline;
indexed?: IndexedEdgeParams;
}
interface SurfaceMaterialParams {
alpha?: number;
diffuse?: {
color?: ColorDefProps;
weight?: number;
};
specular?: {
color?: ColorDefProps;
weight?: number;
exponent?: number;
};
}
interface SurfaceRenderMaterial {
isAtlas: false;
material: string | SurfaceMaterialParams;
}
type SurfaceMaterial = SurfaceRenderMaterial | SurfaceMaterialAtlas;
interface SurfaceParams {
type: SurfaceType;
indices: Uint8Array;
fillFlags: FillFlags;
hasBakedLighting: boolean;
material?: SurfaceMaterial;
textureMapping?: {
texture: string | Gradient.SymbProps;
alwaysDisplayed: boolean;
};
}
interface MeshParams {
vertices: VertexTable;
surface: SurfaceParams;
edges?: EdgeParams;
isPlanar: boolean;
auxChannels?: AuxChannelTableProps;
}
interface Instances extends InstancedGraphicProps {
type: "instances";
}
interface ViewIndependentOrigin {
type: "viewIndependentOrigin";
origin: XYAndZ;
}
type PrimitiveModifier = Instances | ViewIndependentOrigin;
type Primitive = {
params: MeshParams;
modifier?: PrimitiveModifier;
type: "mesh";
} | {
params: PointStringParams;
modifier?: PrimitiveModifier;
type: "point";
} | {
params: PolylineParams;
modifier?: PrimitiveModifier;
type: "polyline";
};
type AreaPatternParams = Omit<ImdlAreaPattern, "xyOffsets"> & {
xyOffsets: Float32Array;
};
type NodePrimitive = Primitive | {
params: AreaPatternParams;
modifier?: never;
type: "pattern";
};
interface BasicNode {
primitives: NodePrimitive[];
animationNodeId?: never;
animationId?: never;
layerId?: never;
groupId?: never;
}
interface AnimationNode {
primitives: NodePrimitive[];
animationNodeId: number;
animationId?: string;
layerId?: never;
groupId?: never;
}
interface Layer {
primitives: NodePrimitive[];
layerId: string;
groupId?: never;
animationNodeId?: never;
animationId?: never;
}
/** Nodes that contain primitives. */
type PrimitivesNode = BasicNode | AnimationNode | Layer;
/** A grouping node that contains other nodes. These don't nest. */
interface GroupNode {
groupId: number;
nodes: PrimitivesNode[];
primitives?: never;
animationNodeId?: never;
animationId?: never;
layerId?: never;
}
type Node = PrimitivesNode | GroupNode;
interface SingleModelFeatureTable {
multiModel: false;
data: Uint32Array;
numFeatures: number;
animationNodeIds?: UintArray;
numSubCategories?: never;
}
interface MultiModelFeatureTable {
multiModel: true;
data: Uint32Array;
numFeatures: number;
numSubCategories: number;
animationNodeIds?: UintArray;
}
type FeatureTable = SingleModelFeatureTable | MultiModelFeatureTable;
interface Document {
featureTable: FeatureTable;
nodes: Node[];
patterns: Map<string, Primitive[]>;
rtcCenter?: XYAndZ;
binaryData: Uint8Array;
json: ImdlDocument;
}
}
/** @internal */
export declare function addPrimitiveTransferables(xfers: Set<Transferable>, primitive: ImdlModel.NodePrimitive): void;
/** Collect an array of all the [transferable objects](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects)
* within the specified document.
* @internal
*/
export declare function collectTransferables(document: ImdlModel.Document): Transferable[];
//# sourceMappingURL=ImdlModel.d.ts.map