lecodes-sdk 0.19.0

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 (367) hide show
  1. package/README.md +114 -0
  2. package/dist/global.d.ts +503 -0
  3. package/dist/host.d.ts +61 -0
  4. package/dist/inject.js +4730 -0
  5. package/dist/types/animate/animate.d.ts +20 -0
  6. package/dist/types/animate/bezier.d.ts +2 -0
  7. package/dist/types/animate/easings.d.ts +21 -0
  8. package/dist/types/canvas/Canvas.d.ts +168 -0
  9. package/dist/types/core/Aspect.d.ts +171 -0
  10. package/dist/types/core/InspectorUI.d.ts +88 -0
  11. package/dist/types/core/StateMachine.d.ts +81 -0
  12. package/dist/types/core/color.d.ts +13 -0
  13. package/dist/types/core/compWrite.d.ts +11 -0
  14. package/dist/types/core/events.d.ts +11 -0
  15. package/dist/types/core/fields.d.ts +58 -0
  16. package/dist/types/core/registry.d.ts +7 -0
  17. package/dist/types/core/signals.d.ts +29 -0
  18. package/dist/types/core/time.d.ts +31 -0
  19. package/dist/types/g2/Camera2D.d.ts +19 -0
  20. package/dist/types/g2/CharacterController2D.d.ts +134 -0
  21. package/dist/types/g2/Node2D.d.ts +91 -0
  22. package/dist/types/g2/OneWay2D.d.ts +24 -0
  23. package/dist/types/g2/Physics2D.d.ts +147 -0
  24. package/dist/types/g2/Scene2D.d.ts +72 -0
  25. package/dist/types/g2/Shape2D.d.ts +58 -0
  26. package/dist/types/g2/Sprite.d.ts +51 -0
  27. package/dist/types/g2/SpriteAnimation.d.ts +50 -0
  28. package/dist/types/g2/SpriteSheet.d.ts +69 -0
  29. package/dist/types/g2/Texture2D.d.ts +16 -0
  30. package/dist/types/g2/Tilemap.d.ts +20 -0
  31. package/dist/types/g2/Tileset.d.ts +32 -0
  32. package/dist/types/g2/Trigger2D.d.ts +20 -0
  33. package/dist/types/g2/autotile.d.ts +133 -0
  34. package/dist/types/g2/cells.d.ts +14 -0
  35. package/dist/types/g2/defineScene2d.d.ts +141 -0
  36. package/dist/types/g2/groups2d.d.ts +16 -0
  37. package/dist/types/g2/loop.d.ts +4 -0
  38. package/dist/types/g2/scenarios2d.d.ts +30 -0
  39. package/dist/types/g2/touch.d.ts +2 -0
  40. package/dist/types/gl/Camera.d.ts +79 -0
  41. package/dist/types/gl/CameraPlace.d.ts +26 -0
  42. package/dist/types/gl/CharacterController.d.ts +98 -0
  43. package/dist/types/gl/Gearbox.d.ts +86 -0
  44. package/dist/types/gl/Geometry.d.ts +39 -0
  45. package/dist/types/gl/IK.d.ts +53 -0
  46. package/dist/types/gl/InstancedMesh.d.ts +46 -0
  47. package/dist/types/gl/Light.d.ts +73 -0
  48. package/dist/types/gl/Lightmap.d.ts +85 -0
  49. package/dist/types/gl/Locomotion.d.ts +279 -0
  50. package/dist/types/gl/Material.d.ts +100 -0
  51. package/dist/types/gl/Mesh.d.ts +33 -0
  52. package/dist/types/gl/Model.d.ts +53 -0
  53. package/dist/types/gl/NavAgent.d.ts +99 -0
  54. package/dist/types/gl/NavMesh.d.ts +169 -0
  55. package/dist/types/gl/Node.d.ts +99 -0
  56. package/dist/types/gl/Noise.d.ts +20 -0
  57. package/dist/types/gl/Particles.d.ts +277 -0
  58. package/dist/types/gl/Physics.d.ts +91 -0
  59. package/dist/types/gl/Plane.d.ts +19 -0
  60. package/dist/types/gl/Ragdoll.d.ts +86 -0
  61. package/dist/types/gl/Ray.d.ts +8 -0
  62. package/dist/types/gl/Scene.d.ts +221 -0
  63. package/dist/types/gl/Shape.d.ts +122 -0
  64. package/dist/types/gl/Terrain.d.ts +280 -0
  65. package/dist/types/gl/Texture.d.ts +27 -0
  66. package/dist/types/gl/Trigger.d.ts +10 -0
  67. package/dist/types/gl/Vehicle.d.ts +191 -0
  68. package/dist/types/gl/Wheel.d.ts +95 -0
  69. package/dist/types/gl/animation/AnimationClip.d.ts +60 -0
  70. package/dist/types/gl/animation/Animator.d.ts +219 -0
  71. package/dist/types/gl/animation/Layer.d.ts +31 -0
  72. package/dist/types/gl/animation/Loop.d.ts +17 -0
  73. package/dist/types/gl/animation/Playback.d.ts +36 -0
  74. package/dist/types/gl/animation/core.d.ts +367 -0
  75. package/dist/types/gl/controls.d.ts +19 -0
  76. package/dist/types/gl/physicsEvents.d.ts +1 -0
  77. package/dist/types/gl/scenarios.d.ts +98 -0
  78. package/dist/types/gl/state.d.ts +5 -0
  79. package/dist/types/gl/terrainMesh.d.ts +46 -0
  80. package/dist/types/gl/touch.d.ts +2 -0
  81. package/dist/types/inject.d.ts +123 -0
  82. package/dist/types/math/Mathf.d.ts +39 -0
  83. package/dist/types/math/mat4.d.ts +66 -0
  84. package/dist/types/math/quat.d.ts +53 -0
  85. package/dist/types/math/vec.d.ts +129 -0
  86. package/dist/types/net/codec.d.ts +25 -0
  87. package/dist/types/net/core.d.ts +106 -0
  88. package/dist/types/net/index.d.ts +80 -0
  89. package/dist/types/net/replication.d.ts +101 -0
  90. package/dist/types/plugins/camera.d.ts +25 -0
  91. package/dist/types/plugins/geolocation.d.ts +39 -0
  92. package/dist/types/plugins/oauth.d.ts +25 -0
  93. package/dist/types/plugins/permission.d.ts +1 -0
  94. package/dist/types/plugins/push.d.ts +46 -0
  95. package/dist/types/plugins/qr.d.ts +21 -0
  96. package/dist/types/plugins/service.d.ts +33 -0
  97. package/dist/types/runtime/app.d.ts +67 -0
  98. package/dist/types/runtime/appEvents.d.ts +7 -0
  99. package/dist/types/runtime/channel.d.ts +1 -0
  100. package/dist/types/runtime/clipboard.d.ts +7 -0
  101. package/dist/types/runtime/datetime.d.ts +80 -0
  102. package/dist/types/runtime/device.d.ts +126 -0
  103. package/dist/types/runtime/fetch.d.ts +31 -0
  104. package/dist/types/runtime/files.d.ts +33 -0
  105. package/dist/types/runtime/input.d.ts +121 -0
  106. package/dist/types/runtime/media.d.ts +46 -0
  107. package/dist/types/runtime/misc.d.ts +11 -0
  108. package/dist/types/runtime/net.d.ts +15 -0
  109. package/dist/types/runtime/rpc.d.ts +44 -0
  110. package/dist/types/runtime/service.d.ts +1 -0
  111. package/dist/types/runtime/share.d.ts +2 -0
  112. package/dist/types/runtime/storage.d.ts +5 -0
  113. package/dist/types/runtime/touch.d.ts +56 -0
  114. package/dist/types/scene/defineScene.d.ts +296 -0
  115. package/dist/types/scene/editorPlugins.d.ts +82 -0
  116. package/dist/types/scene/gizmos.d.ts +56 -0
  117. package/dist/types/scene/grammar.d.ts +56 -0
  118. package/dist/types/scene/level.d.ts +98 -0
  119. package/dist/types/scene/material.d.ts +76 -0
  120. package/dist/types/server/auth/appConfig.d.ts +16 -0
  121. package/dist/types/server/auth/global.d.ts +56 -0
  122. package/dist/types/server/auth/models.d.ts +164 -0
  123. package/dist/types/server/auth/types.d.ts +56 -0
  124. package/dist/types/server/channel.d.ts +28 -0
  125. package/dist/types/server/context.d.ts +27 -0
  126. package/dist/types/server/db/defineDb.d.ts +36 -0
  127. package/dist/types/server/db/fields.d.ts +146 -0
  128. package/dist/types/server/db/index.d.ts +6 -0
  129. package/dist/types/server/db/marci/query.d.ts +326 -0
  130. package/dist/types/server/db/types.d.ts +163 -0
  131. package/dist/types/server/errors.d.ts +8 -0
  132. package/dist/types/server/inject.d.ts +5 -0
  133. package/dist/types/ui/NativeView.d.ts +38 -0
  134. package/dist/types/ui/UI.d.ts +27 -0
  135. package/dist/types/ui/UIBottomSheet.d.ts +71 -0
  136. package/dist/types/ui/UIButton.d.ts +30 -0
  137. package/dist/types/ui/UIContainer.d.ts +33 -0
  138. package/dist/types/ui/UIImage.d.ts +35 -0
  139. package/dist/types/ui/UIInput.d.ts +110 -0
  140. package/dist/types/ui/UIModal.d.ts +70 -0
  141. package/dist/types/ui/UINode.d.ts +363 -0
  142. package/dist/types/ui/UIPager.d.ts +123 -0
  143. package/dist/types/ui/UIPopover.d.ts +39 -0
  144. package/dist/types/ui/UIScreen.d.ts +57 -0
  145. package/dist/types/ui/UIScrollable.d.ts +40 -0
  146. package/dist/types/ui/UISpacer.d.ts +9 -0
  147. package/dist/types/ui/UITabs.d.ts +96 -0
  148. package/dist/types/ui/UIText.d.ts +19 -0
  149. package/dist/types/ui/UIVideo.d.ts +28 -0
  150. package/dist/types/ui/UIVirtualizedList.d.ts +97 -0
  151. package/dist/types/ui/UIWidget.d.ts +65 -0
  152. package/dist/types/ui/fonts.d.ts +9 -0
  153. package/dist/types/ui/presentable.d.ts +68 -0
  154. package/dist/types/ui/router.d.ts +40 -0
  155. package/dist/types/ui/theme.d.ts +26 -0
  156. package/dist/types.json +1 -0
  157. package/package.json +46 -0
  158. package/prompts/2d.md +395 -0
  159. package/prompts/3d-scene-files.md +113 -0
  160. package/prompts/3d-scene.md +119 -0
  161. package/prompts/3d.md +303 -0
  162. package/prompts/README.md +142 -0
  163. package/prompts/ar.md +109 -0
  164. package/prompts/canvas.md +27 -0
  165. package/prompts/compose.ts +46 -0
  166. package/prompts/concept.md +49 -0
  167. package/prompts/core-design.md +75 -0
  168. package/prompts/core.md +264 -0
  169. package/prompts/design.md +218 -0
  170. package/prompts/dist/2d-game.md +1530 -0
  171. package/prompts/dist/3d-app.md +1672 -0
  172. package/prompts/dist/ar-app.md +1548 -0
  173. package/prompts/dist/concept.md +49 -0
  174. package/prompts/dist/design.md +498 -0
  175. package/prompts/dist/ui-app.md +1134 -0
  176. package/prompts/index.md +37 -0
  177. package/prompts/intake-prompt.md +33 -0
  178. package/prompts/namer-prompt.md +12 -0
  179. package/prompts/router-prompt.md +50 -0
  180. package/prompts/select.ts +111 -0
  181. package/prompts/ui-design.md +203 -0
  182. package/prompts/ui.md +803 -0
  183. package/src/animate/animate.ts +238 -0
  184. package/src/animate/bezier.ts +138 -0
  185. package/src/animate/easings.ts +126 -0
  186. package/src/bridges.d.ts +1345 -0
  187. package/src/canvas/Canvas.ts +305 -0
  188. package/src/compile/__tests__/assetIconMacro.test.ts +219 -0
  189. package/src/compile/__tests__/assetMacro.test.ts +74 -0
  190. package/src/compile/__tests__/assetName.test.ts +55 -0
  191. package/src/compile/__tests__/compile.test.ts +287 -0
  192. package/src/compile/__tests__/detectEntry.test.ts +132 -0
  193. package/src/compile/__tests__/fontMacro.test.ts +199 -0
  194. package/src/compile/aspectMacro.ts +86 -0
  195. package/src/compile/assetIconMacro.ts +384 -0
  196. package/src/compile/assetMacro.ts +146 -0
  197. package/src/compile/assetName.ts +50 -0
  198. package/src/compile/bundler.ts +287 -0
  199. package/src/compile/compileProject.ts +127 -0
  200. package/src/compile/detectEntry.ts +128 -0
  201. package/src/compile/fontMacro.ts +459 -0
  202. package/src/compile/fontRegistry.ts +78 -0
  203. package/src/compile/header.ts +67 -0
  204. package/src/compile/index.ts +100 -0
  205. package/src/compile/libraryImports.ts +52 -0
  206. package/src/compile/liteMaterial.ts +247 -0
  207. package/src/compile/sceneEditor.ts +88 -0
  208. package/src/compile/serverSplit.ts +233 -0
  209. package/src/compile/serverTypes.ts +227 -0
  210. package/src/compile/sfnt.ts +98 -0
  211. package/src/compile/shaderSchema.ts +202 -0
  212. package/src/compile/shaderTargets.ts +77 -0
  213. package/src/compile/sourcemap.ts +25 -0
  214. package/src/core/Aspect.ts +568 -0
  215. package/src/core/InspectorUI.ts +212 -0
  216. package/src/core/StateMachine.ts +308 -0
  217. package/src/core/__tests__/stateMachine.test.ts +132 -0
  218. package/src/core/color.ts +66 -0
  219. package/src/core/compWrite.ts +42 -0
  220. package/src/core/events.ts +38 -0
  221. package/src/core/fields.ts +120 -0
  222. package/src/core/registry.ts +23 -0
  223. package/src/core/signals.ts +277 -0
  224. package/src/core/time.ts +84 -0
  225. package/src/g2/Camera2D.ts +40 -0
  226. package/src/g2/CharacterController2D.ts +276 -0
  227. package/src/g2/Node2D.ts +267 -0
  228. package/src/g2/OneWay2D.ts +66 -0
  229. package/src/g2/Physics2D.ts +346 -0
  230. package/src/g2/Scene2D.ts +209 -0
  231. package/src/g2/Shape2D.ts +259 -0
  232. package/src/g2/Sprite.ts +89 -0
  233. package/src/g2/SpriteAnimation.ts +171 -0
  234. package/src/g2/SpriteSheet.ts +166 -0
  235. package/src/g2/Texture2D.ts +47 -0
  236. package/src/g2/Tilemap.ts +41 -0
  237. package/src/g2/Tileset.ts +71 -0
  238. package/src/g2/Trigger2D.ts +77 -0
  239. package/src/g2/autotile.ts +433 -0
  240. package/src/g2/cells.ts +91 -0
  241. package/src/g2/defineScene2d.ts +381 -0
  242. package/src/g2/groups2d.ts +106 -0
  243. package/src/g2/loop.ts +50 -0
  244. package/src/g2/scenarios2d.ts +69 -0
  245. package/src/g2/touch.ts +83 -0
  246. package/src/gl/Camera.ts +160 -0
  247. package/src/gl/CameraPlace.ts +52 -0
  248. package/src/gl/CharacterController.ts +238 -0
  249. package/src/gl/Gearbox.ts +212 -0
  250. package/src/gl/Geometry.ts +279 -0
  251. package/src/gl/IK.ts +193 -0
  252. package/src/gl/InstancedMesh.ts +132 -0
  253. package/src/gl/Light.ts +135 -0
  254. package/src/gl/Lightmap.ts +402 -0
  255. package/src/gl/Locomotion.ts +498 -0
  256. package/src/gl/Material.ts +279 -0
  257. package/src/gl/Mesh.ts +83 -0
  258. package/src/gl/Model.ts +124 -0
  259. package/src/gl/NavAgent.ts +337 -0
  260. package/src/gl/NavMesh.ts +397 -0
  261. package/src/gl/Node.ts +350 -0
  262. package/src/gl/Noise.ts +30 -0
  263. package/src/gl/Particles.ts +676 -0
  264. package/src/gl/Physics.ts +222 -0
  265. package/src/gl/Plane.ts +53 -0
  266. package/src/gl/Ragdoll.ts +270 -0
  267. package/src/gl/Ray.ts +16 -0
  268. package/src/gl/Scene.ts +505 -0
  269. package/src/gl/Shape.ts +409 -0
  270. package/src/gl/Terrain.ts +1092 -0
  271. package/src/gl/Texture.ts +63 -0
  272. package/src/gl/Trigger.ts +45 -0
  273. package/src/gl/Vehicle.ts +473 -0
  274. package/src/gl/Wheel.ts +240 -0
  275. package/src/gl/animation/AnimationClip.ts +204 -0
  276. package/src/gl/animation/Animator.ts +329 -0
  277. package/src/gl/animation/Layer.ts +39 -0
  278. package/src/gl/animation/Loop.ts +31 -0
  279. package/src/gl/animation/Playback.ts +52 -0
  280. package/src/gl/animation/core.ts +670 -0
  281. package/src/gl/controls.ts +95 -0
  282. package/src/gl/physicsEvents.ts +20 -0
  283. package/src/gl/scenarios.ts +291 -0
  284. package/src/gl/state.ts +6 -0
  285. package/src/gl/terrainMesh.ts +219 -0
  286. package/src/gl/touch.ts +68 -0
  287. package/src/host.d.ts +61 -0
  288. package/src/inject.ts +203 -0
  289. package/src/math/Mathf.ts +118 -0
  290. package/src/math/mat4.ts +278 -0
  291. package/src/math/quat.ts +232 -0
  292. package/src/math/vec.ts +255 -0
  293. package/src/net/codec.ts +119 -0
  294. package/src/net/core.ts +384 -0
  295. package/src/net/index.ts +181 -0
  296. package/src/net/replication.ts +622 -0
  297. package/src/plugins/camera.ts +81 -0
  298. package/src/plugins/geolocation.ts +123 -0
  299. package/src/plugins/oauth.ts +61 -0
  300. package/src/plugins/permission.ts +7 -0
  301. package/src/plugins/push.ts +132 -0
  302. package/src/plugins/qr.ts +73 -0
  303. package/src/plugins/service.ts +47 -0
  304. package/src/runtime/app.ts +101 -0
  305. package/src/runtime/appEvents.ts +54 -0
  306. package/src/runtime/channel.ts +61 -0
  307. package/src/runtime/clipboard.ts +20 -0
  308. package/src/runtime/datetime.ts +329 -0
  309. package/src/runtime/device.ts +293 -0
  310. package/src/runtime/fetch.ts +77 -0
  311. package/src/runtime/files.ts +108 -0
  312. package/src/runtime/input.ts +175 -0
  313. package/src/runtime/media.ts +111 -0
  314. package/src/runtime/misc.ts +16 -0
  315. package/src/runtime/net.ts +36 -0
  316. package/src/runtime/rpc.ts +218 -0
  317. package/src/runtime/service.ts +83 -0
  318. package/src/runtime/share.ts +9 -0
  319. package/src/runtime/storage.ts +13 -0
  320. package/src/runtime/touch.ts +76 -0
  321. package/src/scene/defineScene.ts +1396 -0
  322. package/src/scene/editorPlugins.ts +110 -0
  323. package/src/scene/gizmos.ts +148 -0
  324. package/src/scene/grammar.ts +120 -0
  325. package/src/scene/level.ts +296 -0
  326. package/src/scene/material.ts +188 -0
  327. package/src/server/auth/appConfig.ts +12 -0
  328. package/src/server/auth/global.ts +80 -0
  329. package/src/server/auth/host.ts +318 -0
  330. package/src/server/auth/models.ts +83 -0
  331. package/src/server/auth/types.ts +50 -0
  332. package/src/server/channel.ts +56 -0
  333. package/src/server/context.ts +36 -0
  334. package/src/server/db/defineDb.ts +237 -0
  335. package/src/server/db/fields.ts +132 -0
  336. package/src/server/db/httpTransport.ts +93 -0
  337. package/src/server/db/index.ts +7 -0
  338. package/src/server/db/marci/query.ts +412 -0
  339. package/src/server/db/types.ts +202 -0
  340. package/src/server/errors.ts +12 -0
  341. package/src/server/host.ts +74 -0
  342. package/src/server/inject.ts +13 -0
  343. package/src/server/runtime.ts +133 -0
  344. package/src/server/validate.ts +87 -0
  345. package/src/ui/NativeView.ts +142 -0
  346. package/src/ui/UI.ts +39 -0
  347. package/src/ui/UIBottomSheet.ts +139 -0
  348. package/src/ui/UIButton.ts +101 -0
  349. package/src/ui/UIContainer.ts +60 -0
  350. package/src/ui/UIImage.ts +83 -0
  351. package/src/ui/UIInput.ts +185 -0
  352. package/src/ui/UIModal.ts +139 -0
  353. package/src/ui/UINode.ts +830 -0
  354. package/src/ui/UIPager.ts +362 -0
  355. package/src/ui/UIPopover.ts +100 -0
  356. package/src/ui/UIScreen.ts +123 -0
  357. package/src/ui/UIScrollable.ts +87 -0
  358. package/src/ui/UISpacer.ts +14 -0
  359. package/src/ui/UITabs.ts +236 -0
  360. package/src/ui/UIText.ts +51 -0
  361. package/src/ui/UIVideo.ts +88 -0
  362. package/src/ui/UIVirtualizedList.ts +241 -0
  363. package/src/ui/UIWidget.ts +127 -0
  364. package/src/ui/fonts.ts +13 -0
  365. package/src/ui/presentable.ts +117 -0
  366. package/src/ui/router.ts +132 -0
  367. package/src/ui/theme.ts +84 -0
@@ -0,0 +1,367 @@
1
+ import { AnimationClip } from "./AnimationClip";
2
+ import { Loop } from "./Loop";
3
+ import { Layer } from "./Layer";
4
+ import { Playback } from "./Playback";
5
+ import { Vec3 } from "../../math/vec";
6
+ import type { Node } from "../Node";
7
+ /** A position on a blend axis (1D) or plane (2D). */
8
+ export type BlendPosition = number | readonly [number, number];
9
+ /** The transition time (seconds) a play / playLoop without `fade` uses. */
10
+ export declare const DEFAULT_FADE = 0.2;
11
+ export type PlayOptions = {
12
+ /** Transition seconds — how long the difference to the pose the layer SHOWED takes to decay
13
+ * (default 0.2; `0` = cut). Also the transition back at the end unless `fadeOut` overrides it. */
14
+ fade?: number;
15
+ /** Transition seconds for the way in only (overrides `fade`). */
16
+ fadeIn?: number;
17
+ /** One-shots: the transition BACK at the end (overrides `fade`). It starts this long before the
18
+ * clip ends — while it still plays — so the hand-over lands on the last pose, not after it. On a
19
+ * layer with no loop to return to, giving `fadeOut` releases the layer at the end instead of
20
+ * holding the last frame. */
21
+ fadeOut?: number;
22
+ /** Playback rate for this clip (default 1). */
23
+ speed?: number;
24
+ /** Rewind even if the clip is already playing (default: rewind only if it isn't). */
25
+ restart?: boolean;
26
+ /** Enter the clip at a point in the GAIT CYCLE instead of at its start: `'match'` = the phase the
27
+ * layer shows right now (the walk's left foot is down → the turn clip starts where its left foot
28
+ * is down too, so nothing slides), or a number 0–1. Clips without a gait cycle ignore it. */
29
+ phase?: number | "match";
30
+ /** TURN WARP (degrees, + = left): the node turns this much in total over the clip instead of what the
31
+ * clip's baked heading says — its turn curve scaled, so the difference grows where the clip turns and
32
+ * pivots about the planted foot. A 45° start played with `turn: 60` turns 60; played with `turn: 45`
33
+ * it lands on 45 exactly whatever the clip's own run-off. Needs `rootMotion` + `rootRotation` and a
34
+ * clip with a baked heading (`lecodes assets marks` / `retarget`); a clip that turns under 10° is
35
+ * left alone. Ignored by hosts without it. */
36
+ turn?: number;
37
+ };
38
+ export type StopOptions = {
39
+ fade?: number;
40
+ };
41
+ export type LoopOptions = {
42
+ /** Transition seconds from whatever the layer shows — its previous loop, or a one-shot still
43
+ * playing (default 0.2; `0` = cut). */
44
+ fade?: number;
45
+ /** Playback rate of the loop's clips (default 1). */
46
+ speed?: number;
47
+ /** Where in the CYCLE to start, 0–1, or `'match'` = where the layer is now (what a gait loop taking
48
+ * over from a start / turn clip wants). The members share one clock, so this is every member's phase. */
49
+ phase?: number | "match";
50
+ };
51
+ /** What a layer loops: one clip (name / index), or a blend space `{ name: position }`. */
52
+ export type LoopDef = string | number | Record<string, BlendPosition>;
53
+ /** One clip the layer shows this frame — `layer.active` / `anim.active` (a debug overlay's list). */
54
+ export type ActiveClip = {
55
+ name: string;
56
+ clip: AnimationClip;
57
+ /** contribution to the pose, 0–1: the shown one-shot 1, a loop member its blend share */
58
+ weight: number;
59
+ /** clock (s) */
60
+ time: number;
61
+ /** a member of the layer's loop (else the layer's one-shot) */
62
+ loop: boolean;
63
+ };
64
+ export type LayerOptions = {
65
+ /** Bone name(s): the layer drives only these subtrees (`'Spine1'` = upper body). Default: the whole rig. */
66
+ mask?: string | string[];
67
+ /** Blend each clip's DELTA from its own first frame on top of the layers below (lean, breathe, recoil)
68
+ * instead of overriding them. */
69
+ additive?: boolean;
70
+ /** Layer contribution 0–1 (default 1). */
71
+ weight?: number;
72
+ };
73
+ export type ClipEventHandler = (clip: string, layer: Layer) => void;
74
+ /** A foot planted: which one, and where in the world it landed. */
75
+ export type StepHandler = (side: "left" | "right", position: Vec3) => void;
76
+ /** What the engine measured on a clip once it was bound to this skeleton (`anim.curves('Walk')`).
77
+ * The root curves are of the clip's ROOT bone — its travel is what root motion would move. */
78
+ export type ClipCurves = {
79
+ /** total horizontal root travel, metres */
80
+ travel: number;
81
+ /** mean root speed over the clip, m/s */
82
+ speed: number;
83
+ /** total root yaw, radians (+ = left) */
84
+ turn: number;
85
+ /** the root barely moves — an in-place clip */
86
+ inPlace: boolean;
87
+ /** the clip has a gait cycle (feet planting in turn) — `phaseAt` is meaningful */
88
+ hasPhase: boolean;
89
+ /** When each foot TOUCHES the ground, seconds — the phase anchor. `still` is the window inside it
90
+ * where the foot is genuinely STATIONARY (a touching foot still rolls for its first beats, and a
91
+ * stop take's final plant touches long before the body has braked); absent = never still.
92
+ * `at` = where the foot is at the touch's start ([x, y, z], model space). */
93
+ contacts: {
94
+ side: "left" | "right";
95
+ from: number;
96
+ to: number;
97
+ at: [number, number, number];
98
+ still?: {
99
+ from: number;
100
+ to: number;
101
+ };
102
+ }[];
103
+ /** the HANDS on the ground (a cartwheel, a roll, a vault) — from the clip's marks in the GLB; empty when none */
104
+ hands: {
105
+ side: "left" | "right";
106
+ from: number;
107
+ to: number;
108
+ at: [number, number, number];
109
+ still?: {
110
+ from: number;
111
+ to: number;
112
+ };
113
+ }[];
114
+ /** A CLIMBING clip's tread levels (a stair or slope take): the model-space heights its feet plant
115
+ * at, sorted ascending, with the riser (median level spacing — the step height the clip was
116
+ * authored for). Absent on a flat clip. */
117
+ treads?: {
118
+ riser: number;
119
+ levels: number[];
120
+ };
121
+ /** the gait phase at `time`: 0 at a left-foot-down, 0.5 at a right-foot-down; -1 without a cycle */
122
+ phaseAt(time: number): number;
123
+ /** cumulative root travel (m) at `time` */
124
+ travelAt(time: number): number;
125
+ /** cumulative root yaw (rad, + = left) at `time` */
126
+ turnAt(time: number): number;
127
+ /** the root's own speed at `time`, m/s — how fast the clip is moving the body right there */
128
+ speedAt(time: number): number;
129
+ /** the unit travel direction at `time` ([x, z], model space, held through stills) — integrate
130
+ * direction × d(travel) to reconstruct the root's 2D path (a treadmill display, a turn's arc) */
131
+ directionAt(time: number): [number, number];
132
+ /** the first time the clip has turned `yaw` radians (+ = left): where to enter a turn a body has
133
+ * already begun, so the clip continues the move instead of restarting it */
134
+ timeAtTurn(yaw: number): number;
135
+ /** How far this clip's pose is from `target`'s, in metres — the joint distance plus the velocity
136
+ * difference over a tenth of a second, the planted foot weighted most. That difference is exactly
137
+ * what a hand-over hands the transition to decay away, so it says what switching to `target` would
138
+ * cost at `time`. The two are lined up by cycle PHASE (a clip that continues the walk) or by TIME
139
+ * (`align: 'time'` — two clips that both begin from standing share no cycle). */
140
+ fitTo(target: string | number, time: number, options?: {
141
+ align?: "phase" | "time";
142
+ }): number | undefined;
143
+ /** The earliest moment (seconds) at which handing over to `target` costs no more than `within`
144
+ * metres — a start's last steps ARE the walk, so this is where it stops being worth playing.
145
+ * `atContact` (default true) snaps to the next foot-down: a switch under a planted foot is the one
146
+ * the eye forgives. -1 = the clip never gets that close. */
147
+ exitTo(target: string | number, options?: {
148
+ within?: number;
149
+ atContact?: boolean;
150
+ align?: "phase" | "time";
151
+ }): number;
152
+ /** The knee's bend plane at `time`, predicted from the skeleton's calibrated hinge axis carried by
153
+ * this clip's own thigh rotation — continuous even where the leg is straight (where a plane
154
+ * derived from positions is pure noise). `pole` = unit direction from the hip→ankle line toward
155
+ * the knee (a two-bone solver's bend direction), `normal` = the plane's normal; both in the model
156
+ * pose's frame. Undefined = no leg chain, or no knee motion bound to calibrate from. */
157
+ kneePoleAt(side: "left" | "right", time: number): {
158
+ pole: [number, number, number];
159
+ normal: [number, number, number];
160
+ } | undefined;
161
+ /** The clip's baked physics at `time` (unit body mass, model space): `com` = the body's center of
162
+ * mass (biomechanical segment fractions on the classified bones), `velocity` = its velocity
163
+ * (= linear momentum per kg), `angular` = the angular momentum about the COM (m²/s per kg,
164
+ * low-passed ~0.5 s — the REGULATED component, e.g. a turn's sustained yaw; the per-stride
165
+ * pitch/roll exchange between the limbs and the trunk is filtered out),
166
+ * `support` = per-foot load [left, right] — contact-gated, split by where the COM stands between
167
+ * the feet, scaled by the vertical force proxy (above 1 on a landing impact, 0 in flight).
168
+ * A model, not a measurement — meant for ranking transitions and display, both sides of any
169
+ * comparison sharing the same model. Undefined = nothing classified on this skeleton. */
170
+ physicsAt(time: number): {
171
+ com: [number, number, number];
172
+ velocity: [number, number, number];
173
+ angular: [number, number, number];
174
+ support: [number, number];
175
+ } | undefined;
176
+ /** The clip's MATCHING FEATURE ROW at `time` — a fresh Float32Array(37) in the clip's heading
177
+ * frame at that time (x lateral, + left; y up; z forward): 0–5 feet positions relative to the
178
+ * pelvis' ground point, 6–11 feet velocities, 12–14 pelvis velocity, 15 pelvis height, 16–18
179
+ * COM velocity, 19–20 support L/R, 21–22 contact phase L/R, 23 yaw angular momentum, 24–31 the
180
+ * clip's own path 0.3/0.6/1.0/1.5 s ahead as (lateral, forward) pairs, 32–35 facing change at
181
+ * those horizons (rad, + = left), 36 cyclic flag. What a trajectory-and-state matcher compares.
182
+ * Undefined = no leg chain. */
183
+ featuresAt(time: number): Float32Array | undefined;
184
+ /** The take is a LOOP by measurement: its seam is continuous (feet back where they started
185
+ * relative to the root, no turn). Starts, stops and turns are not. */
186
+ cyclic: boolean;
187
+ };
188
+ /** The calibrated knee hinge-axis report (`anim.kneeAxis('left')`): the axis in the thigh's local
189
+ * frame, and the calibration's own confidence — the angular spread of its measurements (radians;
190
+ * a real knee comes in at a few degrees) over `samples` consecutive-frame deltas of the pack.
191
+ * `plant` = the calibrated PLANT HEIGHTS (model space): where the ankle / toe actually sit under
192
+ * full weight, the median of the pack's still-window lows — absent when nothing plants. */
193
+ export type KneeAxisReport = {
194
+ axis: [number, number, number];
195
+ spreadMean: number;
196
+ spreadMax: number;
197
+ samples: number;
198
+ plant?: {
199
+ ankleY: number;
200
+ toeY: number;
201
+ };
202
+ };
203
+ /** A clip bound to a layer — one per (clip, layer), reused by every play. `playback` = the most recent
204
+ * one-shot on it (`playing` while it still owns the layer; kept after that so its handle can still be
205
+ * read — a restart re-enters the same slot with a new record). */
206
+ export type SlotRec = {
207
+ name: string;
208
+ clip: AnimationClip;
209
+ slot: number;
210
+ layer: LayerRec;
211
+ inBlend: boolean;
212
+ playback?: PlaybackRec;
213
+ };
214
+ export type PlaybackRec = {
215
+ slot: SlotRec;
216
+ playing: boolean;
217
+ done: Promise<boolean>;
218
+ resolve: (natural: boolean) => void;
219
+ };
220
+ export type LayerRec = {
221
+ index: number;
222
+ view: Layer;
223
+ slots: SlotRec[];
224
+ loop?: LoopRec;
225
+ weight: number;
226
+ mask: string;
227
+ additive: boolean;
228
+ };
229
+ export type LoopRec = {
230
+ layer: LayerRec;
231
+ members: {
232
+ name: string;
233
+ slot: SlotRec;
234
+ }[];
235
+ value: BlendPosition;
236
+ view: Loop;
237
+ dead: boolean;
238
+ };
239
+ export declare class Core {
240
+ id: number;
241
+ /** Added clips by name (`addClip`) — the lookup index; an added name overrides an embedded one. */
242
+ readonly table: Map<string, AnimationClip>;
243
+ readonly layers: LayerRec[];
244
+ speed: number;
245
+ private _embedded?;
246
+ private readonly _added;
247
+ private _list?;
248
+ private readonly _listeners;
249
+ readonly node: Node;
250
+ constructor(node: Node);
251
+ embedded(): AnimationClip[];
252
+ /** The ordered clip list: the GLB's clips in file order (an added clip of the same name takes the
253
+ * embedded one's place), then the remaining added clips in insertion order. Cached until addClip. */
254
+ clips(): AnimationClip[];
255
+ addClip(name: string, clip: AnimationClip): void;
256
+ /** A clip by name (added first, then embedded), or by index into `clips()` (none = the first). */
257
+ resolveClip(ref: string | number | undefined): [string, AnimationClip] | undefined;
258
+ private clipNames;
259
+ /** Create the native animator on demand. False = nothing to animate (warned). */
260
+ ensure(): boolean;
261
+ destroy(): void;
262
+ newLayer(options?: LayerOptions): LayerRec;
263
+ addLayer(options: LayerOptions): Layer;
264
+ /** Arm the layer's next transition with a wind-up: see `Layer.anticipate`. */
265
+ anticipate(L: LayerRec, amount: number): void;
266
+ pushLayer(L: LayerRec): void;
267
+ /** The layer's slot for the clip — bound on first use, reused after that. */
268
+ slotFor(L: LayerRec, name: string, clip: AnimationClip): SlotRec | undefined;
269
+ /** The base layer's native slot for a clip, bound on first ask (-1 = no such clip / no animator). */
270
+ slotIndex(ref: string | number): number;
271
+ play(L: LayerRec, ref: string | number | undefined, o: PlayOptions): Playback;
272
+ /** A one-shot on the layer hasn't handed over yet. */
273
+ busy(L: LayerRec): boolean;
274
+ settle(p: PlaybackRec, natural: boolean): void;
275
+ /** Resolve every pending playback on the layer as cut short. */
276
+ private settleLayer;
277
+ stopSlot(s: SlotRec, fade: number): void;
278
+ stopLayer(L: LayerRec, fade: number): void;
279
+ stopAll(fade: number): void;
280
+ loop(L: LayerRec, def: LoopDef, o: LoopOptions): Loop | undefined;
281
+ /** The phase the layer shows, 0–1 through the gait cycle (-1 = nothing / no cycle). */
282
+ layerPhase(L: LayerRec): number;
283
+ /** The entry phase of a play / playLoop: a number as given, `'match'` = what the layer shows now
284
+ * (undefined when it shows no cycle — then the clip starts at its own beginning). */
285
+ private entryPhase;
286
+ /** The loop's phase through its cycle, 0–1 (the members share one clock). */
287
+ loopPhase(b: LoopRec): number;
288
+ setLoopPhase(b: LoopRec, phase: number): void;
289
+ setLoopValue(b: LoopRec, v: BlendPosition): void;
290
+ /** What the layer shows this frame: its source — the one-shot, or the loop's members with their
291
+ * blend shares — in binding order (stable rows). */
292
+ active(L: LayerRec): ActiveClip[];
293
+ slotWeight(s: SlotRec): number;
294
+ /** The slot's gait phase now, wrapped into 0–1 (-1 without a cycle). */
295
+ slotPhase(s: SlotRec): number;
296
+ /** A baked curve of the slot at its current time: 1 travel (m) / 2 yaw (rad) / 3 speed (m/s). */
297
+ slotCurveAt(s: SlotRec, which: 1 | 2 | 3): number;
298
+ /** The clip's total root yaw, radians (+ = left). */
299
+ slotTurn(s: SlotRec): number;
300
+ slotTime(s: SlotRec): number;
301
+ seek(s: SlotRec, time: number): void;
302
+ /** Scrub: set a bound clip's playhead directly, seconds — an inspector's tool. */
303
+ seekTime(ref: string | number, time: number): void;
304
+ /** Re-aim a playing clip's TURN WARP (see `PlayOptions.turn`): the clip's baked heading is scaled so that the
305
+ * whole clip turns `deg` — set mid-play, the scale applies to what is still to come, so a controller that
306
+ * wants a different heading while a turn plays asks for (the clip's total × what it still needs / what
307
+ * the clip still turns). Undefined `deg` switches the warp off. */
308
+ setTurnOf(ref: string | number, deg: number | undefined): void;
309
+ /** A bound clip's current playhead, seconds (-1 = not bound). */
310
+ timeOf(ref: string | number): number;
311
+ /** What the engine measured on the clip once it was bound to this skeleton — binds it if needed. */
312
+ curves(ref: string | number): ClipCurves | undefined;
313
+ /** The skeleton's calibrated knee hinge axis for a side, with its confidence report — measured once
314
+ * over every bound clip's knee rotation track. Undefined = no leg chain / no knee motion bound. */
315
+ kneeAxis(side: "left" | "right"): KneeAxisReport | undefined;
316
+ /** STEP WARP v2 (the warp rewrite's knobs): `stride` scales each foot's travel-direction offset
317
+ * from its hip — the step shortens or lengthens, uniformly through stance and swing; `lift` is
318
+ * METRES added to each foot's height, gated to the swing by the contact marks (0 = neutral,
319
+ * negative = a shuffle — no probing), and half of what it adds raises the pelvis so the body
320
+ * steps higher with the foot; `pitch` (degrees, + = toes up) rotates each foot about its
321
+ * own lateral axis — a slope's foot rotation; `slope` (degrees, + = ascending) is the INVISIBLE
322
+ * STAIRCASE: foot heights follow the incline (leading foot higher) and the feet auto-pitch by
323
+ * the same angle — pair it with raising the character by tan(slope) × the stride-scaled clip
324
+ * travel (`curves(clip).travelAt`), which holds every planted foot's world height constant on
325
+ * its own tread. Solved in the calibrated knee hinge plane with a SOFT reach (a leg at its limit
326
+ * keeps a residual knee bend instead of popping against the clamp), and whenever a leg would
327
+ * overreach — a descent, a long stride — the pelvis lowers by exactly the excess (weighted by
328
+ * the contact marks, spring-followed; zero when nothing overreaches, so an ascent or a shorter
329
+ * stride is untouched). Omit / null = stage off. */
330
+ setStepWarp(options?: {
331
+ stride?: number;
332
+ lift?: number;
333
+ pitch?: number;
334
+ slope?: number;
335
+ } | null): void;
336
+ /** A slot for a clip on the base layer, bound on demand — what the pair-wise measures address. */
337
+ private slotOf;
338
+ /** The baked distance curve between two clips, cached per pair (the engine caches the bake itself;
339
+ * this keeps the samples on the JS side so a controller can read them per frame without copying). */
340
+ private readonly _fit;
341
+ private fitCurve;
342
+ /** The earliest moment handing `src` over to `target` costs no more than `within` metres. */
343
+ private fitExit;
344
+ /** The contact bones, '
345
+ '-joined per side ("" = classify by name). */
346
+ private _feet?;
347
+ setFeet(left: string, right: string): void;
348
+ /** Stride / orientation warping, as the engine's fixed-order parameter array. */
349
+ private _warp?;
350
+ setWarp(params: Float32Array): void;
351
+ /** The feet stage (lock / ground IK), as the engine's fixed-order parameter array. */
352
+ private _feetParams?;
353
+ setFeetParams(params: Float32Array): void;
354
+ /** One foot's lock state after this frame's evaluation into `out` (8 floats); false = no such foot
355
+ * or no feet stage on this host. */
356
+ footState(side: 0 | 1, out: Float32Array): boolean;
357
+ private readonly _steps;
358
+ onStepHandler(cb: StepHandler): void;
359
+ offStepHandler(cb: StepHandler): void;
360
+ private onStep;
361
+ setSpeed(v: number): void;
362
+ setRootMotion(on: boolean, rotation?: boolean): void;
363
+ on(event: string, cb: ClipEventHandler): void;
364
+ off(event: string, cb: ClipEventHandler): void;
365
+ /** Native slot event: 0 completed / 1 loop / 2 settled (no longer a source) / 3 hand-over / 4+i clip event i. */
366
+ private onEvent;
367
+ }
@@ -0,0 +1,19 @@
1
+ import type { Node } from "./Node";
2
+ import type { Scene } from "./Scene";
3
+ export type ControlsOptions = {
4
+ /** Smallest uniform scale the pinch gesture allows (default 0.08). */
5
+ minScale?: number;
6
+ /** Largest uniform scale the pinch gesture allows (default 2). */
7
+ maxScale?: number;
8
+ /** One-finger drag moves the target across the ground plane (default true). */
9
+ pan?: boolean;
10
+ /** Two-finger pinch scales the target (default true). */
11
+ pinch?: boolean;
12
+ /** Two-finger twist rotates the target around its Y axis (default true). */
13
+ twist?: boolean;
14
+ };
15
+ /** Returned by `addControls` — call `remove()` to detach the gesture listeners. */
16
+ export type ControlsHandle = {
17
+ remove(): void;
18
+ };
19
+ export declare const attachControls: (scene: Scene, target: Node, options?: ControlsOptions) => ControlsHandle;
@@ -0,0 +1 @@
1
+ export declare const ensurePhysicsEvents: () => void;
@@ -0,0 +1,98 @@
1
+ import { Aspect } from "../core/Aspect";
2
+ import type { FieldMeta } from "../core/fields";
3
+ import type { InspectorUI } from "../core/InspectorUI";
4
+ import { Node } from "./Node";
5
+ import { Model } from "./Model";
6
+ type LoopMode = "once" | "loop" | "pingpong";
7
+ /** Travel from the node's starting position to a target node in `duration` seconds. */
8
+ export declare class MoveTo extends Aspect<"moveTo"> {
9
+ /** Where to travel — place an Empty node and pick it. */
10
+ target: Node | null;
11
+ /** Seconds for the full trip. */
12
+ duration: number;
13
+ /** Seconds to wait before starting. */
14
+ delay: number;
15
+ /** once = stop at the target · loop = restart from the start point · pingpong = back and forth. */
16
+ mode: LoopMode;
17
+ /** Motion curve. */
18
+ easing: "smooth" | "linear";
19
+ static readonly aspect = "moveTo";
20
+ static editor: {
21
+ rebuild: boolean;
22
+ };
23
+ static fields: FieldMeta<MoveTo>;
24
+ private _t;
25
+ private _start;
26
+ update(dt: number): void;
27
+ /** Editor-only path line (edit mode; play mode never calls this). */
28
+ rebuild(): void;
29
+ }
30
+ /** Travel through the children of a path node (add an Empty per waypoint) in `duration` seconds.
31
+ * `loop` runs the circuit closed (last → first); `pingpong` goes back and forth along the open
32
+ * path; `once` stops at the last waypoint. */
33
+ export declare class FollowPath extends Aspect<"followPath"> {
34
+ /** A node whose CHILDREN are the waypoints, in file order. */
35
+ path: Node | null;
36
+ /** Seconds for one full pass of the path. */
37
+ duration: number;
38
+ /** Seconds to wait before starting. */
39
+ delay: number;
40
+ mode: LoopMode;
41
+ /** Turn to face the direction of travel. */
42
+ orient: boolean;
43
+ /** Which local axis leads when orienting. */
44
+ forward: "-z" | "z" | "x" | "-x";
45
+ static readonly aspect = "followPath";
46
+ static editor: {
47
+ rebuild: boolean;
48
+ };
49
+ static fields: FieldMeta<FollowPath>;
50
+ private _t;
51
+ private _points;
52
+ update(dt: number): void;
53
+ /** Editor-only waypoint polyline (edit mode; play mode never calls this). */
54
+ rebuild(): void;
55
+ }
56
+ /** Continuous rotation about one of the node's local axes, degrees per second. */
57
+ export declare class Spin extends Aspect<"spin"> {
58
+ /** Degrees per second. */
59
+ speed: number;
60
+ /** Local axis to spin around. */
61
+ axis: "x" | "y" | "z";
62
+ static readonly aspect = "spin";
63
+ static fields: FieldMeta<Spin>;
64
+ update(dt: number): void;
65
+ }
66
+ /** Keep the node facing a target node (a turret tracking, a signpost, a camera aimed at a hero).
67
+ * Accessor `node.facing` — NOT `lookAt`, which would shadow the `Node.lookAt()` method. */
68
+ export declare class LookAt extends Aspect<"facing"> {
69
+ /** The node to face. */
70
+ target: Node | null;
71
+ /** Which local axis points at the target. */
72
+ forward: "-z" | "z" | "x" | "-x";
73
+ /** 0 = snap instantly; otherwise seconds of turn lag (bigger = slower, smoother). */
74
+ smoothing: number;
75
+ static readonly aspect = "facing";
76
+ static editor: {
77
+ rebuild: boolean;
78
+ };
79
+ static fields: FieldMeta<LookAt>;
80
+ update(dt: number): void;
81
+ /** Editor-only sight line (edit mode; play mode never calls this). */
82
+ rebuild(): void;
83
+ }
84
+ /** Start a GLB animation clip when the scene runs. Attach to a `model:` node; the inspector card
85
+ * lists the model's clips live and can preview them while editing. */
86
+ export declare class PlayAnimation extends Aspect<"playAnimation", Model> {
87
+ /** Clip name; empty = the model's first clip. */
88
+ clip: string;
89
+ loop: boolean;
90
+ /** Playback rate (1 = authored speed). */
91
+ speed: number;
92
+ static readonly aspect = "playAnimation";
93
+ static fields: FieldMeta<PlayAnimation>;
94
+ private _preview?;
95
+ onAttach(): void;
96
+ static inspector(ui: InspectorUI, a: PlayAnimation): void;
97
+ }
98
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Scene } from "./Scene";
2
+ export declare const glState: {
3
+ activeScene: Scene | null;
4
+ frame: number;
5
+ };
@@ -0,0 +1,46 @@
1
+ import { Geometry } from "./Geometry";
2
+ export type TerrainGrid = {
3
+ sizeX: number;
4
+ sizeZ: number;
5
+ cellSize: number;
6
+ /** sizeX × sizeZ heights, row-major (z rows). */
7
+ heights: Float32Array;
8
+ /** One byte per sample, 1 = hole; null = no holes. */
9
+ holes: Uint8Array | null;
10
+ };
11
+ /** The sample at integer (x, z), clamped to the grid. */
12
+ export declare const sampleAt: (g: TerrainGrid, x: number, z: number) => number;
13
+ export declare const isHole: (g: TerrainGrid, x: number, z: number) => boolean;
14
+ /** Surface normal at a sample from central differences (one-sided at the borders). Writes `out` (xyz). */
15
+ export declare const normalAt: (g: TerrainGrid, x: number, z: number, out?: Float32Array | number[]) => typeof out;
16
+ /**
17
+ * Height at a LOCAL (x, z) in metres, interpolated on the drawn triangles (the i00–i11 diagonal), so a
18
+ * character's feet and a raycast agree with what is rendered to the millimetre. NaN inside a hole
19
+ * triangle or outside the grid.
20
+ */
21
+ export declare const heightAt: (g: TerrainGrid, x: number, z: number) => number;
22
+ /** The geometric normal at a LOCAL (x, z): the drawn triangle's normal (not the smoothed vertex one). */
23
+ export declare const faceNormalAt: (g: TerrainGrid, x: number, z: number, out?: Float32Array | number[]) => typeof out;
24
+ /** Chunks along X and Z for a grid: a chunk covers `chunk` cells (chunk + 1 samples). */
25
+ export declare const chunkCounts: (g: TerrainGrid, chunk: number) => [number, number];
26
+ /**
27
+ * One chunk as a Geometry (positions, smooth normals, UV0 = local XZ metres, UV1 = the terrain's unit
28
+ * square, u16 indices), or null when every cell of it is a hole.
29
+ */
30
+ export declare const buildTerrainChunk: (g: TerrainGrid, cx: number, cz: number, chunk: number) => Geometry | null;
31
+ export type GridHit = {
32
+ x: number;
33
+ y: number;
34
+ z: number;
35
+ distance: number;
36
+ nx: number;
37
+ ny: number;
38
+ nz: number;
39
+ };
40
+ /**
41
+ * Nearest hit of a LOCAL ray (origin + direction, metres) on the drawn triangles — the same
42
+ * i00–i11 split and hole rule as `heightAt`, so a pick lands on what is rendered. Walks the cells
43
+ * the ray crosses (2D DDA on XZ), testing each cell's two triangles; holes let the ray through.
44
+ * Null when it misses (or never enters the grid within `maxDistance`).
45
+ */
46
+ export declare const gridRaycast: (g: TerrainGrid, ox: number, oy: number, oz: number, dx: number, dy: number, dz: number, maxDistance?: number) => GridHit | null;
@@ -0,0 +1,2 @@
1
+ export declare const registerTouchStartEvent: () => void;
2
+ export declare const registerTouchEndEvent: () => void;