@itwin/core-frontend
Version:
iTwin.js frontend components
47 lines • 2.14 kB
TypeScript
/** @packageDocumentation
* @module WebGL
*/
import { Id64String } from "@itwin/core-bentley";
import { ModelFeature } from "@itwin/core-common";
import { IModelConnection } from "../../../IModelConnection";
import { BranchStack } from "./BranchStack";
import { Batch } from "./Graphic";
/**
* Assigns a transient, unique 32-bit integer ID to each Batch in a RenderCommands.
* A batch ID of 0 means "no batch".
* The first batch gets batch ID of 1.
* The next batch gets the previous batch's ID plus the number of features in the previous batch's feature table
* (or 1, if empty feature table).
* The IDs are set temporarily as members on the Batch objects and reset to 0 immediately after rendering.
* The currentBatch member identifies the batch containing primitives currently being drawn.
* The combination of the current batch's ID (passed as uniform to shader) and the index of a given Feature within
* its batch's FeatureTable (stored in vertex table) produce a unique ID for every feature rendered during a frame.
* During rendering, the feature IDs are written to the "feature ID" color attachment.
* The batch IDs remain valid during a call to Target.readPixels() so that they can be used to extract
* Features from the Batch's FeatureTables.
* @internal
*/
export declare class BatchState {
private readonly _stack;
private _batches;
private _curBatch?;
constructor(stack: BranchStack);
get currentBatch(): Batch | undefined;
get currentBatchId(): number;
get currentBatchIModel(): IModelConnection | undefined;
get isEmpty(): boolean;
push(batch: Batch, allowAdd: boolean): void;
pop(): void;
reset(): void;
private static readonly _scratchElementIdPair;
getElementId(featureId: number): Id64String;
getFeature(featureId: number, result: ModelFeature): ModelFeature | undefined;
get numFeatureIds(): number;
get numBatches(): number;
findBatchId(featureId: number): number;
get nextBatchId(): number;
private getBatchId;
private indexOf;
find(featureId: number): Batch | undefined;
}
//# sourceMappingURL=BatchState.d.ts.map