import { Box3, Material, Object3D, WebGLRenderer } from 'three'; import { NodeRenderView } from '../tree/NodeRenderView.js'; import { type Batch, type BatchUpdateRange, type DrawGroup, GeometryType } from './Batch.js'; import { SpeckleBatchedText } from '../objects/SpeckleBatchedText.js'; import { AnchorX, AnchorY } from 'troika-three-text'; import { DrawRanges } from './DrawRanges.js'; export default class TextBatch implements Batch { id: string; subtreeId: string; renderViews: NodeRenderView[]; batchMaterial: Material; mesh: SpeckleBatchedText; protected drawRanges: DrawRanges; get bounds(): Box3; get drawCalls(): number; get minDrawCalls(): number; get maxDrawCalls(): number; get triCount(): number; get vertCount(): number; get pointCount(): number; get lineCount(): number; get geometryType(): GeometryType; get renderObject(): Object3D; getCount(): number; get materials(): Material[]; get groups(): Array; constructor(id: string, subtreeId: string, renderViews: NodeRenderView[]); setBatchMaterial(material: Material): void; onUpdate(deltaTime: number): void; onRender(renderer: WebGLRenderer): void; setVisibleRange(ranges: BatchUpdateRange[]): void; getVisibleRange(): BatchUpdateRange; /** TODO: Need to give this a glow up */ getOpaque(): BatchUpdateRange; /** TODO: Need to give this a glow up */ getDepth(): BatchUpdateRange; /** TODO: Need to give this a glow up */ getTransparent(): BatchUpdateRange; /** TODO: Need to give this a glow up */ getStencil(): BatchUpdateRange; /** Text batches are mix between how mesh and line batches work. * - They still keep track of various draw groups each with it's material * - However that material is not really being used, but rather the properies are copied over to the batch fp32 data texture * - For filtering we cheat and use `SpeckleTextColoredMaterial` only to store the gradient/ramp texture + gradient indices for each text in the batch * - The color from the gradient/ramp texture will be used only if the gradient index > 0, otherwise the regular color will be used * - The gradient index is stored in each text object in it's `userData` and written to the 27'th float in the batch data texture, where the shader reads if from * - Even if, the **text batch does not use the materials in it's draw groups**, it emulates the behavior as if it would */ setBatchBuffers(ranges: BatchUpdateRange[]): void; setDrawRanges(ranges: BatchUpdateRange[]): void; private cleanMaterials; resetDrawRanges(): void; protected alignmentXToAnchorX(value: number): AnchorX; protected alignmentYToAnchorY(value: number): AnchorY; buildBatch(): Promise; getRenderView(index: number): NodeRenderView | null; getMaterialAtIndex(index: number): Material | null; getMaterial(rv: NodeRenderView): Material | null; purge(): void; }