@itwin/core-frontend
Version:
iTwin.js frontend components
104 lines • 4.53 kB
TypeScript
/** @packageDocumentation
* @module Rendering
*/
import { TransientIdSequence, TransientIdSequenceProps } from "@itwin/core-bentley";
import { _implementationProhibited } from "../Symbols";
import { GraphicDescriptionContextProps, WorkerGraphicDescriptionContext, WorkerGraphicDescriptionContextProps, WorkerTextureParams } from "../../render/GraphicDescriptionContext";
import { MaterialParams } from "../../render/MaterialParams";
import { Gradient, ImageBufferFormat, ImageSourceFormat, RenderMaterial, RenderTexture, TextureTransparency } from "@itwin/core-common";
import { ImdlModel } from "../../imdl/ImdlModel";
/** As part of a [[WorkerGraphicDescriptionContext]], describes constraints imposed by the [[RenderSystem]] that a [[GraphicDescriptionBuilder]] needs to know about
* when creating a [[GraphicDescription]].
*/
export interface GraphicDescriptionConstraints {
/** @internal */
readonly [_implementationProhibited]: unknown;
/** The maximum dimension (width or height) permitted for a single WebGL texture. */
readonly maxTextureSize: number;
}
export interface WorkerGraphicDescriptionContextPropsImpl extends WorkerGraphicDescriptionContextProps {
readonly constraints: GraphicDescriptionConstraints;
readonly transientIds: TransientIdSequenceProps;
}
export interface GraphicDescriptionContextPropsImpl extends GraphicDescriptionContextProps {
readonly transientIds: TransientIdSequenceProps;
readonly textures: WorkerTextureProps[];
/** This is set to true the first time we use RenderSystem.createGraphicDescriptionContext on it.
* That prevents us from remapping transient Ids to different transient Ids, recreating duplicate textures+materials, etc if
* somebody tries to resolve the same props more than once.
* We will throw if somebody tries to re-resolve a GraphicDescriptionContextPropsImpl.
*/
resolved?: boolean;
}
export interface TextureUrlProps {
url: string;
transparency?: TextureTransparency;
gradient?: never;
imageBuffer?: never;
imageSource?: never;
width?: never;
format?: never;
}
export interface TextureImageBufferProps {
imageBuffer: Uint8Array;
format: ImageBufferFormat;
transparency?: TextureTransparency;
width: number;
gradient?: never;
imageSource?: never;
url?: never;
}
export interface TextureImageSourceProps {
imageSource: Uint8Array | string;
format: ImageSourceFormat;
transparency?: TextureTransparency;
width?: never;
url?: never;
imageBuffer?: never;
gradient?: never;
}
export interface TextureGradientSource {
gradient: Gradient.Symb;
transparency?: never;
format?: never;
imageBuffer?: never;
imageSource?: never;
url?: never;
width?: never;
}
export type TextureGradientSourceProps = Omit<TextureGradientSource, "gradient"> & {
gradient: Gradient.SymbProps;
};
export type TextureSource = TextureUrlProps | TextureImageBufferProps | TextureImageSourceProps | TextureGradientSource;
export type TextureSourceProps = TextureUrlProps | TextureImageBufferProps | TextureImageSourceProps | TextureGradientSourceProps;
export interface WorkerTextureProps {
type: RenderTexture.Type;
transparency?: TextureTransparency;
source: TextureSourceProps;
}
export declare class WorkerTexture extends RenderTexture {
readonly index: number;
readonly source: TextureSource;
constructor(index: number, params: WorkerTextureParams | Gradient.Symb);
dispose(): void;
get bytesUsed(): number;
toProps(xfer: Set<Transferable>): WorkerTextureProps;
}
export declare class WorkerMaterial extends RenderMaterial {
readonly params: MaterialParams;
constructor(params: MaterialParams);
toImdl(): ImdlModel.SurfaceMaterial;
}
export declare class WorkerGraphicDescriptionContextImpl implements WorkerGraphicDescriptionContext {
readonly [_implementationProhibited]: undefined;
readonly constraints: GraphicDescriptionConstraints;
readonly transientIds: TransientIdSequence;
readonly textures: WorkerTexture[];
readonly materials: WorkerMaterial[];
constructor(props: WorkerGraphicDescriptionContextProps);
createMaterial(params: MaterialParams): RenderMaterial;
createTexture(params: WorkerTextureParams): RenderTexture;
createGradientTexture(gradient: Gradient.Symb): RenderTexture;
toProps(transferables: Set<Transferable>): GraphicDescriptionContextPropsImpl;
}
//# sourceMappingURL=GraphicDescriptionContextImpl.d.ts.map