@expofp/renderer 0.0.0-experimental.2d6c681

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/README.md +145 -0
  2. package/dist/Renderer.d.ts +102 -0
  3. package/dist/Renderer.js +96 -0
  4. package/dist/controls/CameraControls.d.ts +108 -0
  5. package/dist/controls/CameraControls.js +203 -0
  6. package/dist/controls/Controls.d.ts +53 -0
  7. package/dist/controls/Controls.js +54 -0
  8. package/dist/controls/camera-api.d.ts +226 -0
  9. package/dist/controls/camera-api.js +179 -0
  10. package/dist/controls/gestures.d.ts +71 -0
  11. package/dist/controls/gestures.js +98 -0
  12. package/dist/controls/handlers/DoubleTapZoom.d.ts +23 -0
  13. package/dist/controls/handlers/DoubleTapZoom.js +82 -0
  14. package/dist/controls/handlers/Inertia.d.ts +60 -0
  15. package/dist/controls/handlers/Inertia.js +222 -0
  16. package/dist/controls/handlers/Pan.d.ts +23 -0
  17. package/dist/controls/handlers/Pan.js +212 -0
  18. package/dist/controls/handlers/Pitch.d.ts +19 -0
  19. package/dist/controls/handlers/Pitch.js +200 -0
  20. package/dist/controls/handlers/Roll.d.ts +30 -0
  21. package/dist/controls/handlers/Roll.js +196 -0
  22. package/dist/controls/handlers/Zoom.d.ts +28 -0
  23. package/dist/controls/handlers/Zoom.js +34 -0
  24. package/dist/controls/hooks.d.ts +136 -0
  25. package/dist/controls/hooks.js +200 -0
  26. package/dist/controls/index.d.ts +9 -0
  27. package/dist/controls/index.js +7 -0
  28. package/dist/controls/zoom-to.d.ts +89 -0
  29. package/dist/controls/zoom-to.js +91 -0
  30. package/dist/core/InstanceUniforms.d.ts +108 -0
  31. package/dist/core/InstanceUniforms.js +298 -0
  32. package/dist/core/SquareDataTexture.d.ts +277 -0
  33. package/dist/core/SquareDataTexture.js +476 -0
  34. package/dist/core/batch/BatchedMesh.d.ts +74 -0
  35. package/dist/core/batch/BatchedMesh.js +155 -0
  36. package/dist/core/instanced/FrustumCulling.d.ts +141 -0
  37. package/dist/core/instanced/FrustumCulling.js +246 -0
  38. package/dist/core/instanced/InstancedMesh.d.ts +302 -0
  39. package/dist/core/instanced/InstancedMesh.js +497 -0
  40. package/dist/core/instanced/Instances.d.ts +119 -0
  41. package/dist/core/instanced/Instances.js +230 -0
  42. package/dist/core/instanced/Raycasting.d.ts +118 -0
  43. package/dist/core/instanced/Raycasting.js +134 -0
  44. package/dist/core/instanced/instanced-material.d.ts +77 -0
  45. package/dist/core/instanced/instanced-material.js +228 -0
  46. package/dist/core/lines/BatchedLines.d.ts +137 -0
  47. package/dist/core/lines/BatchedLines.js +215 -0
  48. package/dist/core/lines/FrustumCullingLines.d.ts +44 -0
  49. package/dist/core/lines/FrustumCullingLines.js +85 -0
  50. package/dist/core/lines/RaycastingLines.d.ts +45 -0
  51. package/dist/core/lines/RaycastingLines.js +91 -0
  52. package/dist/core/lines/lines-material.d.ts +47 -0
  53. package/dist/core/lines/lines-material.js +124 -0
  54. package/dist/core/shader-source.d.ts +70 -0
  55. package/dist/core/shader-source.js +110 -0
  56. package/dist/core/sprites/BatchedSprites.d.ts +115 -0
  57. package/dist/core/sprites/BatchedSprites.js +173 -0
  58. package/dist/core/sprites/RaycastingSprites.d.ts +41 -0
  59. package/dist/core/sprites/RaycastingSprites.js +71 -0
  60. package/dist/core/sprites/sprite-material.d.ts +59 -0
  61. package/dist/core/sprites/sprite-material.js +192 -0
  62. package/dist/core/text/BatchedText.d.ts +233 -0
  63. package/dist/core/text/BatchedText.js +473 -0
  64. package/dist/core/text/MemberTexture.d.ts +90 -0
  65. package/dist/core/text/MemberTexture.js +289 -0
  66. package/dist/core/text/Text.d.ts +88 -0
  67. package/dist/core/text/Text.js +230 -0
  68. package/dist/core/text/batched-text-material.d.ts +56 -0
  69. package/dist/core/text/batched-text-material.js +123 -0
  70. package/dist/core/text/glyph-packing.d.ts +17 -0
  71. package/dist/core/text/glyph-packing.js +61 -0
  72. package/dist/core/typed-array.d.ts +16 -0
  73. package/dist/core/typed-array.js +20 -0
  74. package/dist/debug/components/DebugPanelProvider.d.ts +20 -0
  75. package/dist/debug/components/DebugPanelProvider.js +50 -0
  76. package/dist/debug/components/DebugTools.d.ts +22 -0
  77. package/dist/debug/components/DebugTools.js +28 -0
  78. package/dist/debug/components/Gui.d.ts +22 -0
  79. package/dist/debug/components/Gui.js +42 -0
  80. package/dist/debug/components/MemoryInfo.d.ts +22 -0
  81. package/dist/debug/components/MemoryInfo.js +42 -0
  82. package/dist/debug/components/Panel.d.ts +31 -0
  83. package/dist/debug/components/Panel.js +104 -0
  84. package/dist/debug/components/Stats.d.ts +9 -0
  85. package/dist/debug/components/Stats.js +24 -0
  86. package/dist/debug/debug-chunk.d.ts +26 -0
  87. package/dist/debug/debug-chunk.js +32 -0
  88. package/dist/debug/debug-context.d.ts +41 -0
  89. package/dist/debug/debug-context.js +59 -0
  90. package/dist/debug/index.d.ts +41 -0
  91. package/dist/debug/index.js +43 -0
  92. package/dist/events/LayoutDriver.d.ts +36 -0
  93. package/dist/events/LayoutDriver.js +192 -0
  94. package/dist/events/PointerMissed.d.ts +23 -0
  95. package/dist/events/PointerMissed.js +58 -0
  96. package/dist/events/def-culling.d.ts +46 -0
  97. package/dist/events/def-culling.js +69 -0
  98. package/dist/events/layout-targets.d.ts +151 -0
  99. package/dist/events/layout-targets.js +397 -0
  100. package/dist/events/placement/box.d.ts +59 -0
  101. package/dist/events/placement/box.js +96 -0
  102. package/dist/events/placement/grid.d.ts +161 -0
  103. package/dist/events/placement/grid.js +235 -0
  104. package/dist/events/placement/index.d.ts +2 -0
  105. package/dist/events/placement/index.js +1 -0
  106. package/dist/events/placement/pass.d.ts +70 -0
  107. package/dist/events/placement/pass.js +617 -0
  108. package/dist/events/pointer.d.ts +194 -0
  109. package/dist/events/pointer.js +356 -0
  110. package/dist/external/ExternalCanvas.d.ts +56 -0
  111. package/dist/external/ExternalCanvas.js +177 -0
  112. package/dist/external/external-camera.d.ts +18 -0
  113. package/dist/external/external-camera.js +103 -0
  114. package/dist/external/external-events.d.ts +14 -0
  115. package/dist/external/external-events.js +33 -0
  116. package/dist/index.d.ts +13 -0
  117. package/dist/index.js +14 -0
  118. package/dist/objects/Background.d.ts +31 -0
  119. package/dist/objects/Background.js +37 -0
  120. package/dist/objects/containers/SlotContainer.d.ts +312 -0
  121. package/dist/objects/containers/SlotContainer.js +311 -0
  122. package/dist/objects/containers/hooks.d.ts +61 -0
  123. package/dist/objects/containers/hooks.js +196 -0
  124. package/dist/objects/containers/index.d.ts +6 -0
  125. package/dist/objects/containers/index.js +4 -0
  126. package/dist/objects/containers/keys.d.ts +10 -0
  127. package/dist/objects/containers/keys.js +18 -0
  128. package/dist/objects/containers/mesh-writes.d.ts +106 -0
  129. package/dist/objects/containers/mesh-writes.js +97 -0
  130. package/dist/objects/containers/props.d.ts +33 -0
  131. package/dist/objects/containers/props.js +1 -0
  132. package/dist/objects/images/ImageInstance.d.ts +29 -0
  133. package/dist/objects/images/ImageInstance.js +152 -0
  134. package/dist/objects/images/Images.d.ts +49 -0
  135. package/dist/objects/images/Images.js +394 -0
  136. package/dist/objects/images/atlas-packer.d.ts +129 -0
  137. package/dist/objects/images/atlas-packer.js +287 -0
  138. package/dist/objects/images/image-container.d.ts +74 -0
  139. package/dist/objects/images/image-container.js +100 -0
  140. package/dist/objects/images/index.d.ts +2 -0
  141. package/dist/objects/images/index.js +1 -0
  142. package/dist/objects/images/pack-sources.d.ts +190 -0
  143. package/dist/objects/images/pack-sources.js +272 -0
  144. package/dist/objects/images/texture-budget.d.ts +120 -0
  145. package/dist/objects/images/texture-budget.js +215 -0
  146. package/dist/objects/images/worker/atlas-worker.d.ts +56 -0
  147. package/dist/objects/images/worker/atlas-worker.js +123 -0
  148. package/dist/objects/images/worker/client.d.ts +62 -0
  149. package/dist/objects/images/worker/client.js +249 -0
  150. package/dist/objects/images/worker/index.d.ts +10 -0
  151. package/dist/objects/images/worker/index.js +1 -0
  152. package/dist/objects/layer/Layer.d.ts +28 -0
  153. package/dist/objects/layer/Layer.js +134 -0
  154. package/dist/objects/layer/index.d.ts +2 -0
  155. package/dist/objects/layer/index.js +1 -0
  156. package/dist/objects/layer/layer-context.d.ts +74 -0
  157. package/dist/objects/layer/layer-context.js +82 -0
  158. package/dist/objects/layer/mount-scheduler.d.ts +131 -0
  159. package/dist/objects/layer/mount-scheduler.js +289 -0
  160. package/dist/objects/layer/visibility-gui.d.ts +19 -0
  161. package/dist/objects/layer/visibility-gui.js +93 -0
  162. package/dist/objects/lighting/Lighting.d.ts +92 -0
  163. package/dist/objects/lighting/Lighting.js +384 -0
  164. package/dist/objects/lighting/OcclusionPasses.d.ts +23 -0
  165. package/dist/objects/lighting/OcclusionPasses.js +271 -0
  166. package/dist/objects/lighting/index.d.ts +11 -0
  167. package/dist/objects/lighting/index.js +10 -0
  168. package/dist/objects/lighting/lighting-gui.d.ts +24 -0
  169. package/dist/objects/lighting/lighting-gui.js +114 -0
  170. package/dist/objects/lighting/occluder.d.ts +34 -0
  171. package/dist/objects/lighting/occluder.js +62 -0
  172. package/dist/objects/lighting/occlusion-targets.d.ts +143 -0
  173. package/dist/objects/lighting/occlusion-targets.js +276 -0
  174. package/dist/objects/lines/LineInstance.d.ts +21 -0
  175. package/dist/objects/lines/LineInstance.js +73 -0
  176. package/dist/objects/lines/Lines.d.ts +17 -0
  177. package/dist/objects/lines/Lines.js +31 -0
  178. package/dist/objects/lines/index.d.ts +2 -0
  179. package/dist/objects/lines/index.js +1 -0
  180. package/dist/objects/lines/line-container.d.ts +35 -0
  181. package/dist/objects/lines/line-container.js +40 -0
  182. package/dist/objects/materials/ColorMaterial.d.ts +92 -0
  183. package/dist/objects/materials/ColorMaterial.js +124 -0
  184. package/dist/objects/materials/LineMaterial.d.ts +44 -0
  185. package/dist/objects/materials/LineMaterial.js +74 -0
  186. package/dist/objects/materials/ModelMaterial.d.ts +53 -0
  187. package/dist/objects/materials/ModelMaterial.js +111 -0
  188. package/dist/objects/materials/TextureMaterial.d.ts +33 -0
  189. package/dist/objects/materials/TextureMaterial.js +48 -0
  190. package/dist/objects/materials/effects/ao/ambient-occlusion-pass.d.ts +77 -0
  191. package/dist/objects/materials/effects/ao/ambient-occlusion-pass.js +296 -0
  192. package/dist/objects/materials/effects/ao/ambient-occlusion-patch.d.ts +29 -0
  193. package/dist/objects/materials/effects/ao/ambient-occlusion-patch.js +115 -0
  194. package/dist/objects/materials/effects/ao/blur-pass.d.ts +61 -0
  195. package/dist/objects/materials/effects/ao/blur-pass.js +101 -0
  196. package/dist/objects/materials/effects/ao/index.d.ts +129 -0
  197. package/dist/objects/materials/effects/ao/index.js +72 -0
  198. package/dist/objects/materials/effects/color-dim.d.ts +115 -0
  199. package/dist/objects/materials/effects/color-dim.js +206 -0
  200. package/dist/objects/materials/effects/contact-shadow.d.ts +100 -0
  201. package/dist/objects/materials/effects/contact-shadow.js +167 -0
  202. package/dist/objects/materials/effects/effects-context.d.ts +53 -0
  203. package/dist/objects/materials/effects/effects-context.js +24 -0
  204. package/dist/objects/materials/shared.d.ts +24 -0
  205. package/dist/objects/materials/shared.js +72 -0
  206. package/dist/objects/models/ModelInstance.d.ts +22 -0
  207. package/dist/objects/models/ModelInstance.js +33 -0
  208. package/dist/objects/models/Models.d.ts +22 -0
  209. package/dist/objects/models/Models.js +186 -0
  210. package/dist/objects/models/gltf-cache.d.ts +17 -0
  211. package/dist/objects/models/gltf-cache.js +50 -0
  212. package/dist/objects/models/index.d.ts +2 -0
  213. package/dist/objects/models/index.js +1 -0
  214. package/dist/objects/models/model-asset.d.ts +48 -0
  215. package/dist/objects/models/model-asset.js +77 -0
  216. package/dist/objects/models/model-container.d.ts +123 -0
  217. package/dist/objects/models/model-container.js +207 -0
  218. package/dist/objects/shapes/ShapeInstance.d.ts +26 -0
  219. package/dist/objects/shapes/ShapeInstance.js +39 -0
  220. package/dist/objects/shapes/Shapes.d.ts +21 -0
  221. package/dist/objects/shapes/Shapes.js +131 -0
  222. package/dist/objects/shapes/index.d.ts +2 -0
  223. package/dist/objects/shapes/index.js +1 -0
  224. package/dist/objects/shapes/shape-container.d.ts +141 -0
  225. package/dist/objects/shapes/shape-container.js +242 -0
  226. package/dist/objects/shapes/shape-geometry.d.ts +27 -0
  227. package/dist/objects/shapes/shape-geometry.js +94 -0
  228. package/dist/objects/text/TextInstance.d.ts +22 -0
  229. package/dist/objects/text/TextInstance.js +95 -0
  230. package/dist/objects/text/Texts.d.ts +30 -0
  231. package/dist/objects/text/Texts.js +43 -0
  232. package/dist/objects/text/index.d.ts +2 -0
  233. package/dist/objects/text/index.js +1 -0
  234. package/dist/objects/text/text-container.d.ts +121 -0
  235. package/dist/objects/text/text-container.js +229 -0
  236. package/dist/objects/text/text-layout.d.ts +92 -0
  237. package/dist/objects/text/text-layout.js +180 -0
  238. package/dist/space/Camera.d.ts +103 -0
  239. package/dist/space/Camera.js +321 -0
  240. package/dist/space/Scene.d.ts +47 -0
  241. package/dist/space/Scene.js +127 -0
  242. package/dist/space/Space.d.ts +325 -0
  243. package/dist/space/Space.js +359 -0
  244. package/dist/space/VisibleRect.d.ts +45 -0
  245. package/dist/space/VisibleRect.js +129 -0
  246. package/dist/space/camera-handle.d.ts +67 -0
  247. package/dist/space/camera-handle.js +63 -0
  248. package/dist/space/camera-kind.d.ts +26 -0
  249. package/dist/space/camera-kind.js +30 -0
  250. package/dist/space/canvas-size.d.ts +24 -0
  251. package/dist/space/canvas-size.js +20 -0
  252. package/dist/space/clipping.d.ts +69 -0
  253. package/dist/space/clipping.js +130 -0
  254. package/dist/space/layout-measure.d.ts +67 -0
  255. package/dist/space/layout-measure.js +175 -0
  256. package/dist/space/viewport.d.ts +112 -0
  257. package/dist/space/viewport.js +67 -0
  258. package/dist/types/defs.d.ts +234 -0
  259. package/dist/types/defs.js +1 -0
  260. package/dist/types/events.d.ts +198 -0
  261. package/dist/types/events.js +1 -0
  262. package/dist/types/guards.d.ts +21 -0
  263. package/dist/types/guards.js +52 -0
  264. package/dist/update/index.d.ts +3 -0
  265. package/dist/update/index.js +2 -0
  266. package/dist/update/slot-writers.d.ts +30 -0
  267. package/dist/update/slot-writers.js +76 -0
  268. package/dist/update/store.d.ts +41 -0
  269. package/dist/update/store.js +104 -0
  270. package/dist/utils/arrays.d.ts +13 -0
  271. package/dist/utils/arrays.js +20 -0
  272. package/dist/utils/colors.d.ts +19 -0
  273. package/dist/utils/colors.js +27 -0
  274. package/dist/utils/hot-state.d.ts +41 -0
  275. package/dist/utils/hot-state.js +37 -0
  276. package/dist/utils/logging.d.ts +29 -0
  277. package/dist/utils/logging.js +55 -0
  278. package/dist/utils/math.d.ts +52 -0
  279. package/dist/utils/math.js +76 -0
  280. package/package.json +79 -0
@@ -0,0 +1,233 @@
1
+ import { type BufferGeometry, type Camera, type Intersection, type Material, type Raycaster, type Scene, type WebGLRenderer } from 'three';
2
+ import { BatchedText as TroikaBatchedText, type TextMaterial } from 'troika-three-text';
3
+ import { type UniformSchemaShader } from '../InstanceUniforms';
4
+ import { type UniformValue, type UniformValueObj } from '../SquareDataTexture';
5
+ import { type TextImpl } from './Text';
6
+ /**
7
+ * troika's `BatchedText` with stable member ids, explicit paint order, and per-instance uniforms.
8
+ *
9
+ * Upstream keys everything by pack order — a counter assigned while packing the glyph attributes —
10
+ * which shifts on every add, remove and reorder, so no id survives a repack and nothing outside the
11
+ * class can address a member. This class separates the two things that counter conflated:
12
+ *
13
+ * - **The id** is a stable, batch-allocated index (free list, high-water mark). It is the row a
14
+ * member occupies in the matrix texture and in the uniforms texture, and it is what
15
+ * {@link addText} hands back so a caller can address the member later.
16
+ * - **Paint order** is the order ids are iterated while packing, since draw order is simply the
17
+ * order glyph runs appear in the batched attributes. {@link setOrder} sets it.
18
+ *
19
+ * Those are independent — the id is the *value* written into `aTroikaTextBatchMemberIndex`, the
20
+ * order is *where* it is written — which is what lets a batch have both numbered uniforms and a 2D
21
+ * painter's draw order without an indirect-index texture. The cost is that a pure reorder still
22
+ * repacks (rewriting the glyph attributes), where a `BatchedMesh` would only re-sort its draw list.
23
+ *
24
+ * Other departures from upstream:
25
+ *
26
+ * - **Sync is flag-driven, not scanned.** Members report property writes through
27
+ * `TextImpl._batchParent`, so an idle frame costs nothing instead of walking every member.
28
+ * - **Per-member frustum culling and visibility**, by zeroing a hidden member's matrix so its glyphs
29
+ * collapse to a degenerate triangle. See {@link MemberTexture}.
30
+ * - **Bounds are cached**, recomputed only when {@link invalidateBounds} says they moved, where
31
+ * upstream recomposed every member's matrix on every frame. The recompose itself stays in
32
+ * {@link updateBounds}, so a caller cannot forget it; what changed is that every mutation which
33
+ * moves a member now reports back, rather than the flag being set by accident.
34
+ * - **The derived material inherits the base's `transparent`**, rather than troika forcing it true.
35
+ * See {@link configureDerivedMaterial}.
36
+ *
37
+ * **Not built on {@link InstancedMeshImpl}'s machinery**, despite the family resemblance. That mesh
38
+ * draws one shared geometry through a per-frame list of instance ids, so it culls and sorts by
39
+ * rewriting the list; here draw order *is* the order glyph runs sit in the attributes, so a reorder
40
+ * costs a repack and culling collapses a matrix row instead. Its members are real objects carrying
41
+ * bounds and a layout of their own rather than indices into one geometry, its ids are allocated
42
+ * per member rather than in bulk by count, and visibility rides on the member's own `visible`. What
43
+ * the two genuinely share is {@link InstanceUniforms}.
44
+ *
45
+ * Members must be {@link TextImpl}, and are assumed to agree on `orientation` and `sdfGlyphSize`:
46
+ * both feed uniforms that are batch-wide rather than per-member, so mixing them across a batch
47
+ * leaves whichever member was written last in charge.
48
+ *
49
+ * Render it with {@link BatchedText}.
50
+ */
51
+ export declare class BatchedTextImpl extends TroikaBatchedText {
52
+ /**
53
+ * Marks this as a text batch. three's brand pattern, which `BatchedMeshImpl` inherits from three
54
+ * and `InstancedMeshImpl` declares for itself. troika ships no such flag on its own `BatchedText`,
55
+ * so this one is ours.
56
+ */
57
+ readonly isBatchedText = true;
58
+ /** Per-instance uniform store, shared with {@link BatchedMeshImpl} and {@link InstancedMeshImpl}. */
59
+ private readonly uniforms;
60
+ /** The per-member transform and style rows the batch's shader draws from. */
61
+ private readonly memberTexture;
62
+ /** Member ids in paint order; the iteration order for packing, and therefore the draw order. */
63
+ private ordered;
64
+ /** Id to member, with holes for released ids. Indexed by id, so it needs no map lookup. */
65
+ private textById;
66
+ /** Released ids, reused before the high-water mark grows. */
67
+ private freeIds;
68
+ private _addedMembersCount;
69
+ private boundsNeedsUpdate;
70
+ private batchNeedsSync;
71
+ /**
72
+ * Whether {@link dispose} has run. Syncing a member is asynchronous — troika fetches and parses
73
+ * the font — so a batch can be torn down with a repack still pending against it.
74
+ */
75
+ private disposed;
76
+ constructor();
77
+ /** Number of members in the batch. */
78
+ get size(): number;
79
+ /**
80
+ * One past the highest id ever handed out — the row count both textures are sized to, and the
81
+ * bound every per-member sweep iterates to. Larger than {@link size} whenever a removal left a
82
+ * hole.
83
+ *
84
+ * **A pure high-water mark: removing a member never pulls it back in**, unlike `Instances`, the
85
+ * equivalent for {@link InstancedMeshImpl}, which shrinks past trailing dead ids. Converting either
86
+ * to the other buys nothing. A dead row costs the sweeps here one array read and a `continue`; and
87
+ * this same number also sizes both textures, where `Instances` has a separate `capacity` for that
88
+ * — so shrinking it would reallocate the matrix and uniform textures every time the last member
89
+ * left, to save those reads.
90
+ */
91
+ get addedMembersCount(): number;
92
+ /** The material whose `onBeforeCompile` is already wrapped, so it is wrapped exactly once. */
93
+ private patchedMaterial;
94
+ /** Marks the batch as needing a sync pass. Members call this through `TextImpl._batchParent`. */
95
+ requestSync(): void;
96
+ /**
97
+ * Marks the batch's bounds as stale. Members call this through `TextImpl._batchParent` whenever
98
+ * their transform changes, so no caller has to remember to.
99
+ */
100
+ invalidateBounds(): void;
101
+ /**
102
+ * The member holding an id.
103
+ * @param memberId - The member to read.
104
+ * @returns The member, or `undefined` when the id holds none.
105
+ */
106
+ getText(memberId: number): TextImpl | undefined;
107
+ /**
108
+ * Shows or hides a member. A hidden member keeps its id and its glyphs; it is collapsed at draw
109
+ * time rather than repacked out, so hiding costs no repack.
110
+ *
111
+ * Invalidates the bounds, because they enclose only the visible members — without this, hiding
112
+ * one would leave the batch's sphere too large and showing one would leave it too small, either
113
+ * way mis-culling the whole batch.
114
+ * @param memberId - The member to show or hide.
115
+ * @param visible - Whether it draws.
116
+ */
117
+ setVisibleAt(memberId: number, visible: boolean): void;
118
+ /**
119
+ * Sets the order members draw in — the order their glyph runs are packed into the batched
120
+ * attributes, which is the only thing that resolves overlap between texts: 2D content never writes
121
+ * depth, so depth testing has nothing of its own to compare against.
122
+ *
123
+ * Resolved to ids as it is copied, rather than retained as members: the caller's array is
124
+ * usually its own live membership list, and the repack wants the row each run belongs to anyway.
125
+ * @param texts - Every member, in paint order. Members missing from it are not drawn, and anything
126
+ * that is not a member is dropped.
127
+ */
128
+ setOrder(texts: readonly TextImpl[]): void;
129
+ /**
130
+ * Declares per-instance uniforms, merging with any already declared and rebuilding the backing
131
+ * texture (existing values carried across). See {@link InstanceUniforms.add}.
132
+ * @param schema - The uniforms to add.
133
+ */
134
+ addUniforms(schema: UniformSchemaShader): void;
135
+ /**
136
+ * Reads one member's uniform.
137
+ * @param memberId - The member to address.
138
+ * @param name - The uniform's name.
139
+ * @param target - Receives the result; unused for a `float`, which is returned directly.
140
+ * @returns The value.
141
+ */
142
+ getUniformAt(memberId: number, name: string, target?: UniformValueObj): UniformValue;
143
+ /**
144
+ * Writes one member's uniform and marks its row for upload.
145
+ * @param memberId - The member to address.
146
+ * @param name - The uniform's name.
147
+ * @param value - The value to write.
148
+ */
149
+ setUniformAt(memberId: number, name: string, value: UniformValue): void;
150
+ /**
151
+ * Adds a member, allocating it an id.
152
+ * @param text - The text to batch.
153
+ * @returns The member’s id — stable for as long as it stays in the batch, and the index every
154
+ * other method here takes.
155
+ */
156
+ addText(text: TextImpl): number;
157
+ removeText(text: TextImpl): void;
158
+ /**
159
+ * Copies the text-level properties, and deliberately not the membership.
160
+ *
161
+ * Upstream hands the *source's own* members to the copy. Members are owned rather than shared —
162
+ * {@link addText} points `_batchParent` at the batch they join — so that step silently cuts the
163
+ * source off from its own members: nothing they report afterwards reaches the batch still drawing
164
+ * them. Cloning the members instead would be correct but costs a font fetch and a layout per
165
+ * member, so a copy starts empty and a caller that wants members adds its own.
166
+ *
167
+ * Not hypothetical: three.js devtools clones the object it highlights.
168
+ * @param source - The batch to copy from.
169
+ * @returns This batch.
170
+ */
171
+ copy(source: this): this;
172
+ dispose(): void;
173
+ /**
174
+ * Refreshes every member's local matrix and recomputes the batch's bounds from them.
175
+ *
176
+ * Inherited `updateMatrixWorld` calls this once per frame, so the flag is what keeps it cheap:
177
+ * upstream recomposed every member's matrix on every frame whether anything moved or not.
178
+ *
179
+ * Members are not in the scene graph, so this pass is the only thing that maintains their
180
+ * matrices — which is why the recompose sits ahead of the visibility check rather than inside it.
181
+ * A member hidden now may be shown later in the same frame, after this pass has run, and the
182
+ * per-draw texture fill would otherwise draw it at wherever it last stood.
183
+ */
184
+ updateBounds(): void;
185
+ raycast(raycaster: Raycaster, intersects: Intersection[]): void;
186
+ onBeforeRender(renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material): void;
187
+ /**
188
+ * Syncs members and repacks the batched geometry if needed.
189
+ *
190
+ * Unlike upstream, `callback` is invoked on every path — including the ones that find nothing to
191
+ * do — so `new Promise(resolve => batch.sync(resolve))` always settles.
192
+ * @param callback - Invoked once the batch is in sync.
193
+ */
194
+ sync(callback?: () => void): void;
195
+ /** The derived material, or `[outline, main]` once a member configures an outline. */
196
+ get material(): Material | [outline: TextMaterial, main: TextMaterial];
197
+ /**
198
+ * Sets the *base* material to derive from, tolerating the pair the getter answers with.
199
+ *
200
+ * The accessor is asymmetric upstream — the getter returns `[outline, main]` once an outline is
201
+ * configured, the setter only understands a single base — so `object.material =
202
+ * f(object.material)` stores an array where a material belongs, and the next read walks off it
203
+ * and takes the render loop down. Keeping the main pass makes the round trip a no-op, which is
204
+ * what a caller writing it meant; the outline is derived from the main one anyway.
205
+ *
206
+ * three.js devtools recolors a highlighted object exactly that way, and `Mesh.copy` does it too,
207
+ * so both a highlight and a {@link copy} of stroked text reach here with a pair.
208
+ */
209
+ set material(value: Material | [outline: TextMaterial, main: TextMaterial] | null);
210
+ /**
211
+ * Derives the batch's material: this batch's uniforms onto the base, then troika's derivation,
212
+ * then the corrections that make the result drawable as a batch.
213
+ * @param baseMaterial - The material to derive from.
214
+ * @returns The derived material.
215
+ */
216
+ createDerivedMaterial(baseMaterial: Material): TextMaterial;
217
+ /** Rewrites the batched glyph attributes from the members' render info, and re-measures. */
218
+ private repackBatchedGeometry;
219
+ /**
220
+ * Flags the material(s) for recompilation, e.g. after the uniform schema changed.
221
+ *
222
+ * Handles the pair `material` returns once an outline is configured, not just the single derived
223
+ * material — missing the outline layer would leave it compiled against the previous uniform
224
+ * layout.
225
+ */
226
+ private materialsNeedUpdate;
227
+ }
228
+ /**
229
+ * Registers the class as an R3F element, by value so the generated key cannot collide with anything
230
+ * three puts in the catalog when the canvas mounts.
231
+ */
232
+ export declare const BatchedText: import("react").ExoticComponent<import("@react-three/fiber/dist/declarations/src/core/utils").Mutable<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Partial<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<BatchedTextImpl, import("@react-three/fiber").MathProps<BatchedTextImpl> & import("@react-three/fiber").ReactProps<BatchedTextImpl> & Partial<import("@react-three/fiber").EventHandlers>>>, Omit<import("@react-three/fiber").InstanceProps<BatchedTextImpl, typeof BatchedTextImpl>, "object">>>>;
233
+ //# sourceMappingURL=BatchedText.d.ts.map