@woosh/meep-engine 3.11.3 → 3.13.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 (596) hide show
  1. package/README.md +14 -18
  2. package/editor/SelectionVisualizer.js +127 -127
  3. package/editor/entity_world_bounds.js +27 -27
  4. package/editor/particles/rebuildParticleEmitter.js +31 -31
  5. package/editor/process/SymbolicDisplayProcess.js +1 -1
  6. package/editor/process/symbolic/CameraSymbolicDisplay.js +146 -146
  7. package/editor/process/symbolic/LightSymbolicDisplay.js +172 -172
  8. package/editor/prototypeEditorShell.js +156 -156
  9. package/editor/selection/editor_pick.js +130 -130
  10. package/editor/selection/screen_rect_frustum.js +119 -119
  11. package/editor/tools/v2/TransformControls.js +971 -971
  12. package/package.json +1 -1
  13. package/src/engine/Engine.d.ts +3 -3
  14. package/src/engine/Engine.d.ts.map +1 -1
  15. package/src/engine/Engine.js +726 -726
  16. package/src/engine/EngineHarness.d.ts +1 -1
  17. package/src/engine/EngineHarness.js +590 -590
  18. package/src/engine/ecs/HIERARCHY_REVIEW.md +717 -717
  19. package/src/engine/ecs/terrain/ecs/BuildLightTexture.d.ts +1 -1
  20. package/src/engine/ecs/terrain/ecs/BuildLightTexture.js +27 -27
  21. package/src/engine/ecs/terrain/ecs/Terrain.d.ts +1 -5
  22. package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
  23. package/src/engine/ecs/terrain/ecs/Terrain.js +790 -790
  24. package/src/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +129 -129
  25. package/src/engine/graphics/ecs/camera/camera_find_active.d.ts +1 -1
  26. package/src/engine/graphics/ecs/camera/camera_find_active.js +28 -28
  27. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +1 -1
  28. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +428 -428
  29. package/src/engine/graphics/ecs/water/Water.d.ts +1 -1
  30. package/src/engine/graphics/ecs/water/Water.js +104 -104
  31. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +1 -1
  32. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1 -1
  33. package/src/engine/graphics3/AnimationGraphSystem.d.ts +65 -0
  34. package/src/engine/graphics3/AnimationGraphSystem.d.ts.map +1 -0
  35. package/src/engine/graphics3/AnimationGraphSystem.js +329 -0
  36. package/src/engine/graphics3/AnimationGraphSystem3.d.ts +6 -61
  37. package/src/engine/graphics3/AnimationGraphSystem3.d.ts.map +1 -1
  38. package/src/engine/graphics3/AnimationGraphSystem3.js +6 -325
  39. package/src/engine/graphics3/AnimationSystem.d.ts +76 -0
  40. package/src/engine/graphics3/AnimationSystem.d.ts.map +1 -0
  41. package/src/engine/graphics3/AnimationSystem.js +352 -0
  42. package/src/engine/graphics3/AnimationSystem3.d.ts +6 -72
  43. package/src/engine/graphics3/AnimationSystem3.d.ts.map +1 -1
  44. package/src/engine/graphics3/AnimationSystem3.js +6 -348
  45. package/src/engine/graphics3/CameraSystem.d.ts +49 -0
  46. package/src/engine/graphics3/CameraSystem.d.ts.map +1 -0
  47. package/src/engine/graphics3/CameraSystem.js +170 -0
  48. package/src/engine/graphics3/CameraSystem3.d.ts +6 -45
  49. package/src/engine/graphics3/CameraSystem3.d.ts.map +1 -1
  50. package/src/engine/graphics3/CameraSystem3.js +6 -166
  51. package/src/engine/graphics3/DebugDrawSystem.d.ts +72 -0
  52. package/src/engine/graphics3/DebugDrawSystem.d.ts.map +1 -0
  53. package/src/engine/graphics3/DebugDrawSystem.js +205 -0
  54. package/src/engine/graphics3/DebugDrawSystem3.d.ts +6 -68
  55. package/src/engine/graphics3/DebugDrawSystem3.d.ts.map +1 -1
  56. package/src/engine/graphics3/DebugDrawSystem3.js +6 -201
  57. package/src/engine/graphics3/DecalSystem.d.ts +81 -0
  58. package/src/engine/graphics3/DecalSystem.d.ts.map +1 -0
  59. package/src/engine/graphics3/DecalSystem.js +441 -0
  60. package/src/engine/graphics3/DecalSystem3.d.ts +6 -77
  61. package/src/engine/graphics3/DecalSystem3.d.ts.map +1 -1
  62. package/src/engine/graphics3/DecalSystem3.js +6 -437
  63. package/src/engine/graphics3/FogOfWarSystem.d.ts +74 -0
  64. package/src/engine/graphics3/FogOfWarSystem.d.ts.map +1 -0
  65. package/src/engine/graphics3/FogOfWarSystem.js +265 -0
  66. package/src/engine/graphics3/FogOfWarSystem3.d.ts +6 -70
  67. package/src/engine/graphics3/FogOfWarSystem3.d.ts.map +1 -1
  68. package/src/engine/graphics3/FogOfWarSystem3.js +6 -261
  69. package/src/engine/graphics3/GraphicsEngine.d.ts +340 -0
  70. package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -0
  71. package/src/engine/graphics3/GraphicsEngine.js +790 -0
  72. package/src/engine/graphics3/GraphicsEngine3.d.ts +6 -336
  73. package/src/engine/graphics3/GraphicsEngine3.d.ts.map +1 -1
  74. package/src/engine/graphics3/GraphicsEngine3.js +6 -786
  75. package/src/engine/graphics3/HighlightSystem.d.ts +82 -0
  76. package/src/engine/graphics3/HighlightSystem.d.ts.map +1 -0
  77. package/src/engine/graphics3/HighlightSystem.js +241 -0
  78. package/src/engine/graphics3/HighlightSystem3.d.ts +6 -78
  79. package/src/engine/graphics3/HighlightSystem3.d.ts.map +1 -1
  80. package/src/engine/graphics3/HighlightSystem3.js +6 -237
  81. package/src/engine/graphics3/LightSystem.d.ts +40 -0
  82. package/src/engine/graphics3/LightSystem.d.ts.map +1 -0
  83. package/src/engine/graphics3/LightSystem.js +211 -0
  84. package/src/engine/graphics3/LightSystem3.d.ts +6 -36
  85. package/src/engine/graphics3/LightSystem3.d.ts.map +1 -1
  86. package/src/engine/graphics3/LightSystem3.js +6 -207
  87. package/src/engine/graphics3/MeshSystem.d.ts +106 -0
  88. package/src/engine/graphics3/MeshSystem.d.ts.map +1 -0
  89. package/src/engine/graphics3/MeshSystem.js +647 -0
  90. package/src/engine/graphics3/MeshSystem3.d.ts +6 -102
  91. package/src/engine/graphics3/MeshSystem3.d.ts.map +1 -1
  92. package/src/engine/graphics3/MeshSystem3.js +6 -642
  93. package/src/engine/graphics3/ParticipatingMedia.d.ts +2 -2
  94. package/src/engine/graphics3/ParticipatingMedia.js +203 -203
  95. package/src/engine/graphics3/ParticipatingMediaSystem.d.ts +87 -0
  96. package/src/engine/graphics3/ParticipatingMediaSystem.d.ts.map +1 -0
  97. package/src/engine/graphics3/ParticipatingMediaSystem.js +184 -0
  98. package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts +6 -83
  99. package/src/engine/graphics3/ParticipatingMediaSystem3.d.ts.map +1 -1
  100. package/src/engine/graphics3/ParticipatingMediaSystem3.js +6 -180
  101. package/src/engine/graphics3/ParticleEmitterSystem.d.ts +76 -0
  102. package/src/engine/graphics3/ParticleEmitterSystem.d.ts.map +1 -0
  103. package/src/engine/graphics3/ParticleEmitterSystem.js +289 -0
  104. package/src/engine/graphics3/ParticleEmitterSystem3.d.ts +6 -72
  105. package/src/engine/graphics3/ParticleEmitterSystem3.d.ts.map +1 -1
  106. package/src/engine/graphics3/ParticleEmitterSystem3.js +6 -285
  107. package/src/engine/graphics3/PathDisplaySystem.d.ts +70 -0
  108. package/src/engine/graphics3/PathDisplaySystem.d.ts.map +1 -0
  109. package/src/engine/graphics3/PathDisplaySystem.js +309 -0
  110. package/src/engine/graphics3/PathDisplaySystem3.d.ts +6 -66
  111. package/src/engine/graphics3/PathDisplaySystem3.d.ts.map +1 -1
  112. package/src/engine/graphics3/PathDisplaySystem3.js +6 -305
  113. package/src/engine/graphics3/Pickable.d.ts +1 -1
  114. package/src/engine/graphics3/Pickable.js +65 -65
  115. package/src/engine/graphics3/PickingQuery.d.ts +1 -1
  116. package/src/engine/graphics3/PickingQuery.js +48 -48
  117. package/src/engine/graphics3/PickingSystem.d.ts +67 -0
  118. package/src/engine/graphics3/PickingSystem.d.ts.map +1 -0
  119. package/src/engine/graphics3/PickingSystem.js +273 -0
  120. package/src/engine/graphics3/PickingSystem3.d.ts +6 -63
  121. package/src/engine/graphics3/PickingSystem3.d.ts.map +1 -1
  122. package/src/engine/graphics3/PickingSystem3.js +6 -269
  123. package/src/engine/graphics3/ShadedGeometrySystem.d.ts +47 -0
  124. package/src/engine/graphics3/ShadedGeometrySystem.d.ts.map +1 -0
  125. package/src/engine/graphics3/ShadedGeometrySystem.js +169 -0
  126. package/src/engine/graphics3/ShadedGeometrySystem3.d.ts +6 -43
  127. package/src/engine/graphics3/ShadedGeometrySystem3.d.ts.map +1 -1
  128. package/src/engine/graphics3/ShadedGeometrySystem3.js +6 -165
  129. package/src/engine/graphics3/TerrainSystem.d.ts +80 -0
  130. package/src/engine/graphics3/TerrainSystem.d.ts.map +1 -0
  131. package/src/engine/graphics3/TerrainSystem.js +566 -0
  132. package/src/engine/graphics3/TerrainSystem3.d.ts +6 -76
  133. package/src/engine/graphics3/TerrainSystem3.d.ts.map +1 -1
  134. package/src/engine/graphics3/TerrainSystem3.js +6 -562
  135. package/src/engine/graphics3/TooltipComponentSystem.d.ts +65 -0
  136. package/src/engine/graphics3/TooltipComponentSystem.d.ts.map +1 -0
  137. package/src/engine/graphics3/TooltipComponentSystem.js +328 -0
  138. package/src/engine/graphics3/TooltipComponentSystem3.d.ts +6 -61
  139. package/src/engine/graphics3/TooltipComponentSystem3.d.ts.map +1 -1
  140. package/src/engine/graphics3/TooltipComponentSystem3.js +6 -324
  141. package/src/engine/graphics3/Trail3DSystem.d.ts +73 -0
  142. package/src/engine/graphics3/Trail3DSystem.d.ts.map +1 -0
  143. package/src/engine/graphics3/Trail3DSystem.js +221 -0
  144. package/src/engine/graphics3/Trail3DSystem3.d.ts +6 -69
  145. package/src/engine/graphics3/Trail3DSystem3.d.ts.map +1 -1
  146. package/src/engine/graphics3/Trail3DSystem3.js +6 -217
  147. package/src/engine/graphics3/VolumetricLightMap.d.ts +2 -2
  148. package/src/engine/graphics3/VolumetricLightMap.js +2 -2
  149. package/src/engine/graphics3/VolumetricLightMapSystem.d.ts +98 -0
  150. package/src/engine/graphics3/VolumetricLightMapSystem.d.ts.map +1 -0
  151. package/src/engine/graphics3/VolumetricLightMapSystem.js +261 -0
  152. package/src/engine/graphics3/VolumetricLightMapSystem3.d.ts +6 -94
  153. package/src/engine/graphics3/VolumetricLightMapSystem3.d.ts.map +1 -1
  154. package/src/engine/graphics3/VolumetricLightMapSystem3.js +10 -261
  155. package/src/engine/graphics3/WaterSystem.d.ts +59 -0
  156. package/src/engine/graphics3/WaterSystem.d.ts.map +1 -0
  157. package/src/engine/graphics3/WaterSystem.js +293 -0
  158. package/src/engine/graphics3/WaterSystem3.d.ts +6 -55
  159. package/src/engine/graphics3/WaterSystem3.d.ts.map +1 -1
  160. package/src/engine/graphics3/WaterSystem3.js +6 -289
  161. package/src/engine/graphics3/animation/AnimationGraphController.d.ts +1 -1
  162. package/src/engine/graphics3/animation/AnimationGraphController.js +518 -518
  163. package/src/engine/graphics3/animation/ClipListPlayer.d.ts +1 -1
  164. package/src/engine/graphics3/animation/ClipListPlayer.js +263 -263
  165. package/src/engine/graphics3/animation/ClipPlayback.d.ts +2 -2
  166. package/src/engine/graphics3/animation/ClipPlayback.js +84 -84
  167. package/src/engine/graphics3/decal/GPUDecalRenderer.js +3 -3
  168. package/src/engine/graphics3/decal/graph_build_decal_clusters.d.ts.map +1 -1
  169. package/src/engine/graphics3/decal/graph_build_decal_clusters.js +6 -8
  170. package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts +0 -7
  171. package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts.map +1 -1
  172. package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +1 -1
  173. package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts +0 -4
  174. package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts.map +1 -1
  175. package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +1 -1
  176. package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
  177. package/src/engine/graphics3/decal/shader_decal_composite.js +4 -2
  178. package/src/engine/graphics3/highlight/GPUHighlightRenderer.d.ts.map +1 -1
  179. package/src/engine/graphics3/highlight/GPUHighlightRenderer.js +2 -3
  180. package/src/engine/graphics3/highlight/pack_highlight_table.d.ts +2 -2
  181. package/src/engine/graphics3/highlight/pack_highlight_table.d.ts.map +1 -1
  182. package/src/engine/graphics3/highlight/pack_highlight_table.js +74 -74
  183. package/src/engine/graphics3/highlight/shader_highlight_outline.js +150 -150
  184. package/src/engine/graphics3/pose/query_entity_node_world_pose.d.ts +1 -1
  185. package/src/engine/graphics3/pose/query_entity_node_world_pose.js +101 -101
  186. package/src/engine/graphics3/preview/make_model_thumbnail.d.ts +3 -3
  187. package/src/engine/graphics3/preview/make_model_thumbnail.d.ts.map +1 -1
  188. package/src/engine/graphics3/preview/make_model_thumbnail.js +48 -48
  189. package/src/engine/graphics3/shade_camera_projection_ray.d.ts +1 -1
  190. package/src/engine/graphics3/shade_camera_projection_ray.js +77 -77
  191. package/src/engine/graphics3/shade_node_to_entity_composition.d.ts +1 -1
  192. package/src/engine/graphics3/shade_node_to_entity_composition.js +84 -84
  193. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  194. package/src/shade/RENDERER_CONTRACT.md +2 -1
  195. package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.d.ts +18 -0
  196. package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.d.ts.map +1 -1
  197. package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +73 -0
  198. package/src/shade/device/PASS_ENCODER_PROPOSAL_2026_08_31.md +750 -0
  199. package/src/shade/device/ShadeGPUCommandContext.d.ts +10 -16
  200. package/src/shade/device/ShadeGPUCommandContext.d.ts.map +1 -1
  201. package/src/shade/device/ShadeGPUCommandContext.js +801 -994
  202. package/src/shade/device/pass/ShadeGPUComputePassEncoder.d.ts +107 -0
  203. package/src/shade/device/pass/ShadeGPUComputePassEncoder.d.ts.map +1 -0
  204. package/src/shade/device/pass/ShadeGPUComputePassEncoder.js +222 -0
  205. package/src/shade/device/pass/ShadeGPURenderPassEncoder.d.ts +168 -0
  206. package/src/shade/device/pass/ShadeGPURenderPassEncoder.d.ts.map +1 -0
  207. package/src/shade/device/pass/ShadeGPURenderPassEncoder.js +317 -0
  208. package/src/shade/device/timing/GPUTimerArray.d.ts +4 -9
  209. package/src/shade/device/timing/GPUTimerArray.d.ts.map +1 -1
  210. package/src/shade/device/timing/GPUTimerArray.js +261 -289
  211. package/src/shade/device/timing/GPU_PROFILER_PROPOSAL_2026_08_28.md +20 -2
  212. package/src/shade/device/timing/ShadeGPUContextProfiler.d.ts +59 -0
  213. package/src/shade/device/timing/ShadeGPUContextProfiler.d.ts.map +1 -0
  214. package/src/shade/device/timing/ShadeGPUContextProfiler.js +182 -0
  215. package/src/shade/device/timing/profile/GPUProfileSession.d.ts +4 -4
  216. package/src/shade/device/timing/profile/GPUProfileSession.js +4 -4
  217. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts.map +1 -1
  218. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.js +3 -2
  219. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.d.ts.map +1 -1
  220. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_points.js +3 -2
  221. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.d.ts.map +1 -1
  222. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_visibility.js +135 -134
  223. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.js +202 -202
  224. package/src/shade/playground/skinned_blas_refit/verify_traversal_reachability.js +249 -249
  225. package/src/shade/renderer/Renderer.d.ts +0 -6
  226. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  227. package/src/shade/renderer/Renderer.js +0 -29
  228. package/src/shade/renderer/STATIC_GRAPHICS_ENGINE_ASSETS.js +1 -1
  229. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  230. package/src/shade/renderer/animation/GPUAnimationManager.js +1 -3
  231. package/src/shade/renderer/animation/pose/PosePlayback.d.ts +2 -1
  232. package/src/shade/renderer/animation/pose/PosePlayback.d.ts.map +1 -1
  233. package/src/shade/renderer/animation/pose/PosePlayback.js +2 -1
  234. package/src/shade/renderer/animation/shader_animation_apply.d.ts.map +1 -1
  235. package/src/shade/renderer/animation/shader_animation_apply.js +128 -129
  236. package/src/shade/renderer/animation/shader_animation_pose_resolve.d.ts.map +1 -1
  237. package/src/shade/renderer/animation/shader_animation_pose_resolve.js +176 -177
  238. package/src/shade/renderer/animation/shader_animation_tick.d.ts.map +1 -1
  239. package/src/shade/renderer/animation/shader_animation_tick.js +4 -2
  240. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  241. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +8 -18
  242. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_geometry_sphere_derive.d.ts.map +1 -1
  243. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_geometry_sphere_derive.js +3 -2
  244. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.d.ts.map +1 -1
  245. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.js +4 -2
  246. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_scatter.d.ts +1 -1
  247. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_scatter.d.ts.map +1 -1
  248. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_scatter.js +24 -10
  249. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_skinned_mesh_bounds_refresh.d.ts.map +1 -1
  250. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_skinned_mesh_bounds_refresh.js +3 -2
  251. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.d.ts.map +1 -1
  252. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +5 -2
  253. package/src/shade/renderer/animation/skinning/shader_skin_matrix_prep.d.ts.map +1 -1
  254. package/src/shade/renderer/animation/skinning/shader_skin_matrix_prep.js +104 -105
  255. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.d.ts.map +1 -1
  256. package/src/shade/renderer/atmosphere/shader_multiscatter_lut.js +0 -1
  257. package/src/shade/renderer/atmosphere/shader_transmittance_lut.js +3 -3
  258. package/src/shade/renderer/buffer/graph_inspect_gpu_buffer.js +136 -136
  259. package/src/shade/renderer/buffer/table/GPUDatabase.d.ts.map +1 -1
  260. package/src/shade/renderer/buffer/table/GPUDatabase.js +16 -22
  261. package/src/shade/renderer/buffer/table/gpu_table_element_upload_shader.d.ts.map +1 -1
  262. package/src/shade/renderer/buffer/table/gpu_table_element_upload_shader.js +7 -2
  263. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.d.ts.map +1 -1
  264. package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +11 -5
  265. package/src/shade/renderer/buffer/util/shader_buffer_copy_storage_to_storage.d.ts.map +1 -1
  266. package/src/shade/renderer/buffer/util/shader_buffer_copy_storage_to_storage.js +43 -42
  267. package/src/shade/renderer/buffer/util/shader_buffer_intra_copy_regions.d.ts.map +1 -1
  268. package/src/shade/renderer/buffer/util/shader_buffer_intra_copy_regions.js +83 -84
  269. package/src/shade/renderer/deferred/shader_tonemap_HDR.d.ts.map +1 -1
  270. package/src/shade/renderer/deferred/shader_tonemap_HDR.js +4 -1
  271. package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.d.ts +2 -2
  272. package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.d.ts.map +1 -1
  273. package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.js +167 -167
  274. package/src/shade/renderer/dynamic/shader_dynamic_mesh.d.ts.map +1 -1
  275. package/src/shade/renderer/dynamic/shader_dynamic_mesh.js +177 -170
  276. package/src/shade/renderer/extension/RENDER_EXTENSION_DESIGN.md +918 -918
  277. package/src/shade/renderer/fow/GPUFogOfWarRenderer.js +3 -3
  278. package/src/shade/renderer/fow/shader_fog_of_war.d.ts.map +1 -1
  279. package/src/shade/renderer/fow/shader_fog_of_war.js +3 -1
  280. package/src/shade/renderer/geometry/bvh/record_blas_refit.js +102 -102
  281. package/src/shade/renderer/geometry/bvh/shader_blas_refit_leaf_bounds.d.ts.map +1 -1
  282. package/src/shade/renderer/geometry/bvh/shader_blas_refit_leaf_bounds.js +5 -2
  283. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts.map +1 -1
  284. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.js +3 -11
  285. package/src/shade/renderer/geometry/meshlet/shader_meshlet_metadata_address_patch.d.ts +1 -1
  286. package/src/shade/renderer/geometry/meshlet/shader_meshlet_metadata_address_patch.d.ts.map +1 -1
  287. package/src/shade/renderer/geometry/meshlet/shader_meshlet_metadata_address_patch.js +6 -4
  288. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  289. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +5 -10
  290. package/src/shade/renderer/geometry/sdf/shader_build_sdf.js +129 -129
  291. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.d.ts.map +1 -1
  292. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.js +5 -3
  293. package/src/shade/renderer/global_illumination/brick4/gpu/bake/shader_brick4_bake_probes.d.ts.map +1 -1
  294. package/src/shade/renderer/global_illumination/brick4/gpu/bake/shader_brick4_bake_probes.js +4 -1
  295. package/src/shade/renderer/global_illumination/brick4/gpu/bake/shader_brick4_bake_resolve_probes.d.ts.map +1 -1
  296. package/src/shade/renderer/global_illumination/brick4/gpu/bake/shader_brick4_bake_resolve_probes.js +3 -1
  297. package/src/shade/renderer/global_illumination/clipmap/shader_update_clipmap_cascade.d.ts.map +1 -1
  298. package/src/shade/renderer/global_illumination/clipmap/shader_update_clipmap_cascade.js +114 -112
  299. package/src/shade/renderer/global_illumination/lpv/placement/graph_generate_probe_locations.js +367 -367
  300. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lpv_store_sh.d.ts.map +1 -1
  301. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lpv_store_sh.js +4 -1
  302. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lvp_atlas_to_sh.d.ts.map +1 -1
  303. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_lvp_atlas_to_sh.js +9 -6
  304. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.d.ts.map +1 -1
  305. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.js +4 -1
  306. package/src/shade/renderer/global_illumination/sharc/SpatialHashRadianceCache.d.ts.map +1 -1
  307. package/src/shade/renderer/global_illumination/sharc/SpatialHashRadianceCache.js +6 -8
  308. package/src/shade/renderer/global_illumination/sharc/shader/shader_sharc_evict.d.ts.map +1 -1
  309. package/src/shade/renderer/global_illumination/sharc/shader/shader_sharc_evict.js +3 -1
  310. package/src/shade/renderer/global_illumination/sharc/shader/shader_sharc_update.d.ts.map +1 -1
  311. package/src/shade/renderer/global_illumination/sharc/shader/shader_sharc_update.js +3 -1
  312. package/src/shade/renderer/gpu_primitive/bvh/GPU_BVH_BUILD_PLAN.md +1115 -1115
  313. package/src/shade/renderer/gpu_primitive/bvh/PHASE1_HANDOVER.md +3 -3
  314. package/src/shade/renderer/gpu_primitive/bvh/graph_bvh_build_lbvh.js +10 -10
  315. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.d.ts.map +1 -1
  316. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_emit_hierarchy.js +4 -2
  317. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_morton.d.ts.map +1 -1
  318. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_morton.js +87 -83
  319. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_refit.d.ts.map +1 -1
  320. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_refit.js +4 -2
  321. package/src/shade/renderer/gpu_primitive/bvh/verify_gpu_bvh_build.d.ts +2 -2
  322. package/src/shade/renderer/gpu_primitive/bvh/verify_gpu_bvh_build.d.ts.map +1 -1
  323. package/src/shade/renderer/gpu_primitive/bvh/verify_gpu_bvh_build.js +43 -8
  324. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  325. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +4 -5
  326. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts.map +1 -1
  327. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.js +88 -85
  328. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts.map +1 -1
  329. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js +194 -192
  330. package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts.map +1 -1
  331. package/src/shade/renderer/hiz/HierarchicalZBuffer.js +33 -69
  332. package/src/shade/renderer/hiz/shader_hzb_reduce_any.d.ts.map +1 -1
  333. package/src/shade/renderer/hiz/shader_hzb_reduce_any.js +6 -1
  334. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.d.ts.map +1 -1
  335. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.js +23 -7
  336. package/src/shade/renderer/light/cluster/cull/graph_cull_lights.d.ts.map +1 -1
  337. package/src/shade/renderer/light/cluster/cull/graph_cull_lights.js +191 -198
  338. package/src/shade/renderer/light/cluster/cull/shader_cull_lights_frustum.d.ts +0 -6
  339. package/src/shade/renderer/light/cluster/cull/shader_cull_lights_frustum.d.ts.map +1 -1
  340. package/src/shade/renderer/light/cluster/cull/shader_cull_lights_frustum.js +120 -120
  341. package/src/shade/renderer/light/cluster/cull/shader_cull_lights_hzb.d.ts +0 -4
  342. package/src/shade/renderer/light/cluster/cull/shader_cull_lights_hzb.d.ts.map +1 -1
  343. package/src/shade/renderer/light/cluster/cull/shader_cull_lights_hzb.js +112 -112
  344. package/src/shade/renderer/light/cluster/graph_assign_clsuters.d.ts.map +1 -1
  345. package/src/shade/renderer/light/cluster/graph_assign_clsuters.js +4 -7
  346. package/src/shade/renderer/light/cluster/shader_cluster_assign_lights.d.ts +0 -6
  347. package/src/shade/renderer/light/cluster/shader_cluster_assign_lights.d.ts.map +1 -1
  348. package/src/shade/renderer/light/cluster/shader_cluster_assign_lights.js +1 -1
  349. package/src/shade/renderer/light/environment/execute_filter_environment_map.d.ts.map +1 -1
  350. package/src/shade/renderer/light/environment/execute_filter_environment_map.js +1 -2
  351. package/src/shade/renderer/light/environment/shader_convolve_reflection_map.d.ts.map +1 -1
  352. package/src/shade/renderer/light/environment/shader_convolve_reflection_map.js +6 -1
  353. package/src/shade/renderer/lightmap/bake/raster/graph_draw_lightmap_viz_buffer.d.ts.map +1 -1
  354. package/src/shade/renderer/lightmap/bake/raster/graph_draw_lightmap_viz_buffer.js +234 -219
  355. package/src/shade/renderer/lightmap/bake/raster/shader_lightmap_to_viz_buffer.js +222 -222
  356. package/src/shade/renderer/lightmap/bake/shader_lightmap_denoise_sh.js +191 -191
  357. package/src/shade/renderer/lightmap/bake/tile/shader_lightmap_accummulate_tile.d.ts.map +1 -1
  358. package/src/shade/renderer/lightmap/bake/tile/shader_lightmap_accummulate_tile.js +85 -82
  359. package/src/shade/renderer/lightmap/bake/tile/shader_lightmap_tile_composit.js +81 -81
  360. package/src/shade/renderer/material/GPUMaterialContext.js +380 -380
  361. package/src/shade/renderer/material/standard/fragment_gbuffer_vt.js +169 -169
  362. package/src/shade/renderer/object_property/shader_object_property_process.d.ts.map +1 -1
  363. package/src/shade/renderer/object_property/shader_object_property_process.js +83 -84
  364. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.d.ts.map +1 -1
  365. package/src/shade/renderer/object_property/shader_refresh_all_mesh_bounds.js +57 -58
  366. package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
  367. package/src/shade/renderer/particles/graph_particles.js +5 -3
  368. package/src/shade/renderer/particles/prototypeParticleSystem.js +5 -7
  369. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
  370. package/src/shade/renderer/particles/shaders/shader_particle_emit.js +27 -13
  371. package/src/shade/renderer/particles/shaders/shader_particle_finalize.d.ts.map +1 -1
  372. package/src/shade/renderer/particles/shaders/shader_particle_finalize.js +4 -4
  373. package/src/shade/renderer/particles/shaders/shader_particle_render.d.ts.map +1 -1
  374. package/src/shade/renderer/particles/shaders/shader_particle_render.js +190 -183
  375. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
  376. package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +18 -7
  377. package/src/shade/renderer/particles/sort/shader_particle_sort.d.ts.map +1 -1
  378. package/src/shade/renderer/particles/sort/shader_particle_sort.js +47 -21
  379. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
  380. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +7 -10
  381. package/src/shade/renderer/path_tracer/accumulating/shader_accumulating_path_tracer.d.ts.map +1 -1
  382. package/src/shade/renderer/path_tracer/accumulating/shader_accumulating_path_tracer.js +4 -1
  383. package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +184 -184
  384. package/src/shade/renderer/postprocess/bloom/shader_bloom_mix.d.ts.map +1 -1
  385. package/src/shade/renderer/postprocess/bloom/shader_bloom_mix.js +3 -1
  386. package/src/shade/renderer/postprocess/cas/shader_ffx_rcas.d.ts.map +1 -1
  387. package/src/shade/renderer/postprocess/cas/shader_ffx_rcas.js +4 -2
  388. package/src/shade/renderer/postprocess/denoise/fragment_shader_denoise_ao.js +147 -147
  389. package/src/shade/renderer/postprocess/denoise/graph_atorus_denoise_luma.d.ts.map +1 -1
  390. package/src/shade/renderer/postprocess/denoise/graph_atorus_denoise_luma.js +19 -17
  391. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts.map +1 -1
  392. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.js +1 -2
  393. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_gather_far.d.ts.map +1 -1
  394. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_gather_far.js +4 -1
  395. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_gather_near.d.ts.map +1 -1
  396. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_gather_near.js +4 -1
  397. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_recombine.d.ts.map +1 -1
  398. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_recombine.js +4 -1
  399. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_setup.d.ts.map +1 -1
  400. package/src/shade/renderer/postprocess/dof/gather/shader_dof2_setup.js +4 -1
  401. package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.d.ts.map +1 -1
  402. package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.js +5 -8
  403. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_composite.d.ts.map +1 -1
  404. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_composite.js +4 -1
  405. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_prefilter.d.ts.map +1 -1
  406. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_prefilter.js +4 -1
  407. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch.d.ts.map +1 -1
  408. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch.js +4 -1
  409. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.d.ts.map +1 -1
  410. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js +4 -2
  411. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.d.ts.map +1 -1
  412. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js +4 -2
  413. package/src/shade/renderer/postprocess/dof/shader_dof_autofocus.d.ts.map +1 -1
  414. package/src/shade/renderer/postprocess/dof/shader_dof_autofocus.js +4 -1
  415. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
  416. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +8 -11
  417. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
  418. package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +5 -1
  419. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
  420. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +11 -8
  421. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
  422. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +7 -8
  423. package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.d.ts.map +1 -1
  424. package/src/shade/renderer/postprocess/motion_blur/shader_motion_blur_reconstruct.js +3 -1
  425. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  426. package/src/shade/renderer/postprocess/nss/shader_nss_concat.d.ts.map +1 -1
  427. package/src/shade/renderer/postprocess/nss/shader_nss_concat.js +3 -2
  428. package/src/shade/renderer/postprocess/nss/shader_nss_conv_layer.d.ts.map +1 -1
  429. package/src/shade/renderer/postprocess/nss/shader_nss_conv_layer.js +225 -226
  430. package/src/shade/renderer/postprocess/nss/shader_nss_extract_feedback.d.ts.map +1 -1
  431. package/src/shade/renderer/postprocess/nss/shader_nss_extract_feedback.js +49 -50
  432. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.d.ts.map +1 -1
  433. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.js +291 -292
  434. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.d.ts.map +1 -1
  435. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.js +230 -231
  436. package/src/shade/renderer/postprocess/ssr/depth_max_shader.d.ts.map +1 -1
  437. package/src/shade/renderer/postprocess/ssr/depth_max_shader.js +70 -68
  438. package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts +16 -2
  439. package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts.map +1 -1
  440. package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.js +12 -12
  441. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts.map +1 -1
  442. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.js +3 -1
  443. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts.map +1 -1
  444. package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.js +4 -1
  445. package/src/shade/renderer/postprocess/ssr/shader_downsample_encoded_normal.d.ts.map +1 -1
  446. package/src/shade/renderer/postprocess/ssr/shader_downsample_encoded_normal.js +103 -101
  447. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts.map +1 -1
  448. package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.js +4 -2
  449. package/src/shade/renderer/postprocess/ssr/ssr_trace_shader.d.ts.map +1 -1
  450. package/src/shade/renderer/postprocess/ssr/ssr_trace_shader.js +3 -1
  451. package/src/shade/renderer/postprocess/taa/shader_taa.d.ts.map +1 -1
  452. package/src/shade/renderer/postprocess/taa/shader_taa.js +4 -1
  453. package/src/shade/renderer/postprocess/upscale-dither/fragment_shader_upscale_dither.js +5 -5
  454. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  455. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +339 -341
  456. package/src/shade/renderer/rasterize/bucket/shader_count_meshlets_by_material.d.ts.map +1 -1
  457. package/src/shade/renderer/rasterize/bucket/shader_count_meshlets_by_material.js +68 -69
  458. package/src/shade/renderer/rasterize/bucket/shader_make_meshlet_indirect_draw_commands_by_material.d.ts.map +1 -1
  459. package/src/shade/renderer/rasterize/bucket/shader_make_meshlet_indirect_draw_commands_by_material.js +59 -60
  460. package/src/shade/renderer/rasterize/bucket/shader_read_out_bucket.d.ts.map +1 -1
  461. package/src/shade/renderer/rasterize/bucket/shader_read_out_bucket.js +0 -1
  462. package/src/shade/renderer/rasterize/bucket/shader_sort_meshlets_by_material.d.ts.map +1 -1
  463. package/src/shade/renderer/rasterize/bucket/shader_sort_meshlets_by_material.js +64 -65
  464. package/src/shade/renderer/rasterize/compute/graph_mesh_frustum_cull.d.ts.map +1 -1
  465. package/src/shade/renderer/rasterize/compute/graph_mesh_frustum_cull.js +168 -169
  466. package/src/shade/renderer/rasterize/compute/graph_mesh_sphere_cull.d.ts.map +1 -1
  467. package/src/shade/renderer/rasterize/compute/graph_mesh_sphere_cull.js +160 -161
  468. package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_mesh_filter_2way.d.ts.map +1 -1
  469. package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_mesh_filter_2way.js +6 -2
  470. package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_meshlet_filter_1way_full.d.ts.map +1 -1
  471. package/src/shade/renderer/rasterize/cull/hzb/shader_hzb_meshlet_filter_1way_full.js +4 -2
  472. package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_classify_bucket.d.ts.map +1 -1
  473. package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_classify_bucket.js +139 -140
  474. package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_count_by_rasterization_bucket.d.ts.map +1 -1
  475. package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_count_by_rasterization_bucket.js +91 -92
  476. package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_rasterization_bucket_sort.d.ts.map +1 -1
  477. package/src/shade/renderer/rasterize/expand/bucket/mesh/shader_instances_rasterization_bucket_sort.js +88 -89
  478. package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_count_by_rasterization_bucket.d.ts.map +1 -1
  479. package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_count_by_rasterization_bucket.js +90 -91
  480. package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_extract_bucket.d.ts.map +1 -1
  481. package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_extract_bucket.js +5 -2
  482. package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_rasterization_bucket_sort.d.ts.map +1 -1
  483. package/src/shade/renderer/rasterize/expand/bucket/meshlet/shader_meshlets_rasterization_bucket_sort.js +89 -90
  484. package/src/shade/renderer/rasterize/expand/graph_mesh_filter_one_way.d.ts.map +1 -1
  485. package/src/shade/renderer/rasterize/expand/graph_mesh_filter_one_way.js +169 -170
  486. package/src/shade/renderer/rasterize/expand/mesh/shader_mesh_expand_to_meshlets_prefix.d.ts.map +1 -1
  487. package/src/shade/renderer/rasterize/expand/mesh/shader_mesh_expand_to_meshlets_prefix.js +89 -90
  488. package/src/shade/renderer/rasterize/expand/mesh/shader_meshes_to_meshlet_counts.d.ts.map +1 -1
  489. package/src/shade/renderer/rasterize/expand/mesh/shader_meshes_to_meshlet_counts.js +61 -62
  490. package/src/shade/renderer/rasterize/expand/pass1/filter_meshlets.2-way.compute.d.ts.map +1 -1
  491. package/src/shade/renderer/rasterize/expand/pass1/filter_meshlets.2-way.compute.js +153 -154
  492. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +144 -144
  493. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_pass_descriptor.js +88 -88
  494. package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.js +722 -722
  495. package/src/shade/renderer/rasterize/native/oit/shader_oit_generate_moments.js +217 -217
  496. package/src/shade/renderer/rasterize/native/oit/shader_oit_resolve_moments.js +179 -179
  497. package/src/shade/renderer/rasterize/native/oit/shader_oit_resolve_moments_ibl.js +178 -178
  498. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_alpha_tested_pass_descriptor.js +194 -194
  499. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.js +76 -76
  500. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.d.ts.map +1 -1
  501. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.js +1 -9
  502. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.d.ts.map +1 -1
  503. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.js +1 -6
  504. package/src/shade/renderer/restir/di/graph_restir_di.d.ts.map +1 -1
  505. package/src/shade/renderer/restir/di/graph_restir_di.js +2 -3
  506. package/src/shade/renderer/restir/di/graph_restir_di_denoise.d.ts.map +1 -1
  507. package/src/shade/renderer/restir/di/graph_restir_di_denoise.js +1 -2
  508. package/src/shade/renderer/restir/di/shader_restir_di_denoise.d.ts.map +1 -1
  509. package/src/shade/renderer/restir/di/shader_restir_di_denoise.js +5 -3
  510. package/src/shade/renderer/restir/di/shader_restir_di_resample.d.ts.map +1 -1
  511. package/src/shade/renderer/restir/di/shader_restir_di_resample.js +4 -3
  512. package/src/shade/renderer/restir/di/shader_restir_di_resolve.d.ts.map +1 -1
  513. package/src/shade/renderer/restir/di/shader_restir_di_resolve.js +4 -3
  514. package/src/shade/renderer/restir/di/shader_restir_di_spatial.d.ts.map +1 -1
  515. package/src/shade/renderer/restir/di/shader_restir_di_spatial.js +116 -117
  516. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
  517. package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +3 -7
  518. package/src/shade/renderer/scene/hierarchy/graph_scene_update_transform_hierarchy_naive.js +123 -123
  519. package/src/shade/renderer/scene/hierarchy/shader_nodes_record_input_positions.d.ts.map +1 -1
  520. package/src/shade/renderer/scene/hierarchy/shader_nodes_record_input_positions.js +64 -65
  521. package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy.d.ts.map +1 -1
  522. package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy.js +372 -373
  523. package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy_naive.d.ts.map +1 -1
  524. package/src/shade/renderer/scene/hierarchy/shader_nodes_update_transform_hierarchy_naive.js +111 -112
  525. package/src/shade/renderer/scene/shader_bvh_extract_instance_leaves.d.ts.map +1 -1
  526. package/src/shade/renderer/scene/shader_bvh_extract_instance_leaves.js +147 -145
  527. package/src/shade/renderer/shader/ComputeShader.d.ts +26 -5
  528. package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
  529. package/src/shade/renderer/shader/ComputeShader.js +347 -296
  530. package/src/shade/renderer/shader/ImageShader.js +217 -217
  531. package/src/shade/renderer/shader/ShaderDescriptor.d.ts +5 -0
  532. package/src/shade/renderer/shader/ShaderDescriptor.d.ts.map +1 -1
  533. package/src/shade/renderer/shader/ShaderDescriptor.js +20 -0
  534. package/src/shade/renderer/shader/pass/RenderPassDescriptor.d.ts +2 -2
  535. package/src/shade/renderer/shader/pass/RenderPassDescriptor.d.ts.map +1 -1
  536. package/src/shade/renderer/shader/pass/RenderPassDescriptor.js +189 -189
  537. package/src/shade/renderer/shader/resource/ShaderResourceSetDescriptor.d.ts.map +1 -1
  538. package/src/shade/renderer/shader/resource/ShaderResourceSetDescriptor.js +3 -1
  539. package/src/shade/renderer/shader/util/compute_infer_workgroup_size_from_source.d.ts +47 -0
  540. package/src/shade/renderer/shader/util/compute_infer_workgroup_size_from_source.d.ts.map +1 -0
  541. package/src/shade/renderer/shader/util/compute_infer_workgroup_size_from_source.js +448 -0
  542. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  543. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +14 -18
  544. package/src/shade/renderer/shadow/map/csm/graph_csm_setup_cascades.js +3 -3
  545. package/src/shade/renderer/shadow/map/shader/shader_shadowmap_remap_cube_to_octahedral.d.ts.map +1 -1
  546. package/src/shade/renderer/shadow/map/shader/shader_shadowmap_remap_cube_to_octahedral.js +5 -1
  547. package/src/shade/renderer/shadow/ray/shader_shadow_upscale.d.ts.map +1 -1
  548. package/src/shade/renderer/shadow/ray/shader_shadow_upscale.js +3 -1
  549. package/src/shade/renderer/shadow/ray/staged/gen/graph_gen_rays.js +73 -73
  550. package/src/shade/renderer/shadow/ray/staged/gen/shader_generate_rays.d.ts.map +1 -1
  551. package/src/shade/renderer/shadow/ray/staged/gen/shader_generate_rays.js +151 -148
  552. package/src/shade/renderer/shadow/ray/staged/trace/graph_trace_rays.d.ts.map +1 -1
  553. package/src/shade/renderer/shadow/ray/staged/trace/graph_trace_rays.js +6 -4
  554. package/src/shade/renderer/shadow/ray/staged/trace/shader_trace_rays.d.ts.map +1 -1
  555. package/src/shade/renderer/shadow/ray/staged/trace/shader_trace_rays.js +18 -4
  556. package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.d.ts.map +1 -1
  557. package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.js +11 -12
  558. package/src/shade/renderer/shadow/sdf/cascade/shader_build_scene_sdf_f32.d.ts.map +1 -1
  559. package/src/shade/renderer/shadow/sdf/cascade/shader_build_scene_sdf_f32.js +6 -2
  560. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_debug_viz.d.ts.map +1 -1
  561. package/src/shade/renderer/shadow/sdf/cascade/shader_scene_sdf_debug_viz.js +129 -127
  562. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.d.ts.map +1 -1
  563. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.js +5 -3
  564. package/src/shade/renderer/texture/virtual/VirtualTextureManager.d.ts.map +1 -1
  565. package/src/shade/renderer/texture/virtual/VirtualTextureManager.js +2 -5
  566. package/src/shade/renderer/texture/virtual/build_shader_vt_feedback.d.ts.map +1 -1
  567. package/src/shade/renderer/texture/virtual/build_shader_vt_feedback.js +3 -2
  568. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +1 -1
  569. package/src/shade/renderer/volumetrics/graph_build_volumetrics.d.ts.map +1 -1
  570. package/src/shade/renderer/volumetrics/graph_build_volumetrics.js +14 -19
  571. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts +3 -2
  572. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  573. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +3 -2
  574. package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.d.ts +0 -2
  575. package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.d.ts.map +1 -1
  576. package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.js +17 -6
  577. package/src/shade/renderer/water/shader_water.js +246 -246
  578. package/src/shade/vitest.setup.mjs +1 -1
  579. package/src/shade/wgsl/emulator/ComputeShaderEmulator.js +291 -291
  580. package/src/shade/wgsl/validate_wgsl_source.d.ts.map +1 -1
  581. package/src/shade/wgsl/validate_wgsl_source.js +8 -3
  582. package/src/view/minimap/Minimap.d.ts +2 -2
  583. package/src/view/minimap/Minimap.d.ts.map +1 -1
  584. package/src/view/minimap/Minimap.js +225 -225
  585. package/src/view/minimap/dom/MinimapCameraView.d.ts +3 -3
  586. package/src/view/minimap/dom/MinimapCameraView.d.ts.map +1 -1
  587. package/src/view/minimap/dom/MinimapCameraView.js +206 -206
  588. package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts +0 -21
  589. package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts.map +0 -1
  590. package/src/shade/device/timing/profile/make_profiling_pass_encoder.js +0 -114
  591. package/src/shade/device/timing/profile/parse_workgroup_size.d.ts +0 -20
  592. package/src/shade/device/timing/profile/parse_workgroup_size.d.ts.map +0 -1
  593. package/src/shade/device/timing/profile/parse_workgroup_size.js +0 -43
  594. package/src/shade/renderer/shadow/map/csm/shader/shader_setup_cascades.d.ts +0 -3
  595. package/src/shade/renderer/shadow/map/csm/shader/shader_setup_cascades.d.ts.map +0 -1
  596. package/src/shade/renderer/shadow/map/csm/shader/shader_setup_cascades.js +0 -20
@@ -1,717 +1,717 @@
1
- # Hierarchy in meep's ECS — a review against Unreal 6 / Scene Graph
2
-
3
- **Date:** 2026-08-23
4
- **Subject:** `ParentEntity`, `TransformAttachment`, `EntityNode`, and the systems behind them
5
- **Comparator:** Epic's Scene Graph — the entity/component framework that UE6 is being built on
6
-
7
- **Status, 2026-08-24.** §6.1 landed: both systems now keep a parent → children index
8
- (`ecs/hierarchy/EntityChildIndex.js`), which closed **D5**, **D7**, **D8** and **D11**, and made **D3** small enough
9
- to fix in the same pass. **D4** was addressed the day before. Still open: **D1**, **D2**, **D6**, **D9**, **D10**, and
10
- the question in §8. Sections below are written in the tense of what is true now; the reasoning that led there is
11
- unchanged.
12
-
13
- ---
14
-
15
- ## 0. Verdict up front
16
-
17
- The **core split is right, and it is a better decomposition than Unreal's.** meep separates *lifetime* parenting
18
- (`ParentEntity`) from *spatial* parenting (`TransformAttachment`) into two independent components. Scene Graph has one
19
- hierarchy that means lifetime, and bolts a spatial override onto it (`transform_component.Origin`). meep's version is
20
- the more honest model: two relations that are genuinely independent are stored as two relations, rather than one
21
- relation plus an escape hatch.
22
-
23
- The **propagation is also better than I expected.** I assumed the signal cascade would re-do work exponentially in
24
- depth. It does not — measured, each descendant is recomputed **exactly once** per root change, at any depth. That is
25
- optimal, and it is achieved without a sort, a level index, or a dirty-flag pass.
26
-
27
- What is weak is everything *around* that core:
28
-
29
- - `EntityNode`, described as "syntactic sugar", is not sugar. It holds live state (the local transform, the
30
- subscriptions) that the ECS does not have, and animation binds to it. It is a **shadow object graph** — the exact
31
- thing an ECS hierarchy exists to remove.
32
- - **Live reparenting does not work.** One path silently strips the spatial link (verified, repro below); the other
33
- asserts. Scene Graph treats reparenting as an ordinary operation.
34
- - ~~**Children are not stored anywhere.** Every "give me the subtree" operation is a full scan of the dataset, so
35
- subtree work is O(nodes × entities-in-world).~~ **Fixed** — each system now owns the back-links (§6.1).
36
- - Three parallel attachment mechanisms exist (`TransformAttachment`, `Attachment`, plus ad-hoc `transform.subscribe`
37
- closures in `MeshSystem3`). A fourth component, `ChildEntities`, was dead code and has been deleted.
38
-
39
- Severity-ordered defect list is in §5. Six of the eleven are correctness, and two of those I reproduced.
40
-
41
- ---
42
-
43
- ## 1. Scope and method
44
-
45
- **Read in full:** `ecs/parent/*` (`ParentEntity`, `ParentEntitySystem`, `ChildEntities` (since deleted), `EntityNode`,
46
- `EntityNodeFlags`, `entity_node_compute_bounding_box`), `ecs/transform-attachment/*` (`TransformAttachment`,
47
- `TransformAttachmentSystem`, `transform_attachment_parent_of`, `transform_attachment_find_descendant_by_name`),
48
- `ecs/attachment/*` (`Attachment`, `AttachmentSystem`, `AttachmentBinding`, `TransformAttachmentBinding`,
49
- `BoneAttachmentBinding`), plus `Entity`, `Transform`, and the relevant parts of `EntityComponentDataset`,
50
- `EntityManager` and `BinaryBufferSerializer`.
51
-
52
- **Consumers surveyed:** `shade_node_to_entity_composition`, `three_object_to_entity_composition`, `MeshSystem3`,
53
- `SGMeshSystem`, `ColliderObserverSystem`, `HierarchicalEntityListView`, `bind_property_writer`,
54
- `sg_hierarchy_compute_bounding_box_via_parent_entity`.
55
-
56
- **Measured, not assumed.** Four throwaway specs were run against the real systems (no mocks) and then deleted. Every
57
- number in §2.3, §5 D1, D2 and D10 is output from those runs, quoted verbatim. Where I state something I only read and
58
- did not execute, it says so.
59
-
60
- **On the Unreal side — read this before trusting §3.** Epic announced at State of Unreal (June 2026) that UE6 unifies
61
- UE and UEFN, and that Actors and Blueprints will eventually be deprecated in favour of Verse plus Scene Graph, with
62
- conversion tools and a multi-year transition. Scene Graph itself shipped first in UEFN and is documented there as
63
- experimental/beta. **The public documentation is the UEFN surface**, so the API names below are the Verse ones. Epic
64
- has not published Scene Graph's internal storage, so anything about *how* it stores hierarchy is unknown, and I make
65
- no claims about it.
66
-
67
- One terminology correction worth making, because it changes what "compare against Unreal's ECS" means: **Scene Graph
68
- is not Unreal's ECS.** Unreal's data-oriented ECS is **Mass** (archetype-based; components are "fragments", systems
69
- are "processors"), built for crowds and traffic. Scene Graph is an *entity/component gameplay framework* — the Actor
70
- replacement. It is Scene Graph, not Mass, that is the right comparator for meep's hierarchy, and that is what this
71
- document uses. Mass has no user-facing hierarchy to compare against.
72
-
73
- ---
74
-
75
- ## 2. What meep has today
76
-
77
- ### 2.1 Four mechanisms, not one
78
-
79
- | Mechanism | Means | Propagated by | Status |
80
- |---|---|---|---|
81
- | `ParentEntity { entity }` | **Lifetime.** Parent dies → child dies. | `ParentEntitySystem` listens for `EntityRemoved` on the parent, removes the child. | Live |
82
- | `TransformAttachment { transform, parent, flags }` | **Space.** Child world = parent world × local. | `TransformAttachmentSystem`, via `Transform` change signals. | Live |
83
- | `Attachment { parent, socket, transform }` | **Space, via a named socket / bone.** | `AttachmentSystem`, via `AttachmentBinding`s, polled every frame. | Live |
84
- | ad-hoc `transform.subscribe(follow)` | **Space, hand-rolled.** | A closure in `MeshSystem3` (line ~558) copying one transform to another. | Live |
85
- | ~~`ChildEntities { entities[] }`~~ | — | — | **Deleted** (D5). Was dead, and the wrong shape — see §4.2. |
86
-
87
- `EntityNode` sits on top of the first two as an authoring façade.
88
-
89
- The overlap between rows 2–4 is the first thing to notice. `TransformAttachmentBinding` (row 3's transform case) does
90
- what `UpdateContext` (row 2) does, with a socket offset spliced in, using matrices instead of `Transform` composition —
91
- and it carries a `TODO` saying so. Row 4 is row 2 with the local transform hard-coded to identity.
92
-
93
- ### 2.2 The two relations are genuinely independent — and that is the good part
94
-
95
- ```
96
- ParentEntity.entity → "when that entity dies, I die"
97
- TransformAttachment.parent → "my transform is relative to that entity"
98
- ```
99
-
100
- Nothing requires them to name the same entity. That is a real capability: a UI marker can be spatially attached to a
101
- unit's head while being owned by the HUD; a compound rigid body's colliders are `ParentEntity`-owned by the body
102
- (which is exactly how `ColliderObserverSystem` finds them) without necessarily composing transforms through it.
103
-
104
- Scene Graph cannot express this as two facts. It has one hierarchy — which means lifetime — and then
105
- `transform_component.Origin` to say "actually, compose me against *that* entity instead". Same expressive power,
106
- reached by exception rather than by construction.
107
-
108
- ### 2.3 How the transform composition actually behaves (measured)
109
-
110
- `TransformAttachmentSystem` builds an `UpdateContext` per attached entity holding `{attachment, transform, entity,
111
- parent_transform}` and subscribes it to *both* the parent's world `Transform` and the attachment's local `Transform`.
112
- Any change to either fires `ctx.update()`, which is one `m4_multiply` plus a decompose back into the child's world
113
- `Transform` — whose own position/rotation/scale setters fire, waking the grandchild's context. Propagation is a
114
- synchronous, re-entrant, depth-first cascade with no flush point.
115
-
116
- Measured on a straight chain, counting writes to each descendant's TRS channels for **one** root change:
117
-
118
- ```
119
- depth=4 translate: pos-writes=3 rot-writes=0 scale-writes=0 across 3 descendants
120
- depth=4 rotate: pos-writes=3 rot-writes=3 scale-writes=3 across 3 descendants
121
- depth=8 translate: pos-writes=7 rot-writes=0 scale-writes=0 across 7 descendants
122
- depth=8 rotate: pos-writes=7 rot-writes=7 scale-writes=7 across 7 descendants
123
- depth=16 translate: pos-writes=15 rot-writes=0 scale-writes=0 across 15 descendants
124
- depth=16 rotate: pos-writes=15 rot-writes=15 scale-writes=15 across 15 descendants
125
- ```
126
-
127
- **One recompute per descendant, every time.** No redundancy at any depth. The `Vector3.set`/`Quaternion.set` equality
128
- guards are doing real work here: a pure translation never wakes a rotation listener. This is a good design and it
129
- should be said plainly, because the rest of this document is mostly criticism.
130
-
131
- Two costs come with it, both real:
132
-
133
- **It is observable mid-cascade.** An observer of a descendant's `Transform` is called *during* propagation, when the
134
- transform is only partly updated. Measured on a depth-3 chain under one 90° root yaw, an observer of the leaf sees:
135
-
136
- ```
137
- [0] pos(0.000,-2.000) rotY(0.000) ← position already final, rotation still stale
138
- [1] pos(0.000,-2.000) rotY(0.707) ← settled
139
- ```
140
-
141
- State `[0]` is a pose that never existed. Anything that *accumulates* from a transform callback — a motion trail, a
142
- velocity estimate, a moved-event, a physics impulse — integrates a torn pose. Renderers get away with it because the
143
- last write before the frame ends is correct.
144
-
145
- **Every level does a decompose/recompose round-trip**, and it is lossy. Measured on a chain with **no scaling
146
- anywhere**, all-rotation locals:
147
-
148
- ```
149
- depth=8: leaf world scale = (1.00000009045938, 1, 1.00000009045938)
150
- depth=32: leaf world scale = (1.0000006507070245, 1, 1.0000006507070245)
151
- depth=64: leaf world scale = (1.0000014229381489, 1, 1.0000014229381489)
152
- ```
153
-
154
- The exact answer is `(1,1,1)` at every depth. The drift grows with depth, and — because it is a genuine change — it
155
- also fires a spurious `scale.onChanged` at every level on every rotation, which is where the `scale-writes=N` column
156
- above comes from. Anything subscribed to scale is woken by pure rotation.
157
-
158
- The same round-trip discards shear outright. Root scaled `(4,1,1)`, child yawed 45°:
159
-
160
- ```
161
- mid world scale stored as (2.9155, 1.0000, 2.9155)
162
- leaf world matrix row0 = 2.8284, 0.0000, -0.7071
163
- ```
164
-
165
- The true composed basis is non-orthogonal; TRS cannot hold it, so it is silently best-fitted. A mesh under a
166
- non-uniformly-scaled rotated parent draws wrong. **Scene Graph shares this limitation** — its transform is TRS too —
167
- but Unreal documents the non-uniform-scale caveat and meep does not.
168
-
169
- ### 2.4 `EntityNode` is not syntactic sugar
170
-
171
- Its own docstring says "syntactic sugar on top of `TransformAttachment` and `ParentEntity`". It is not, on three
172
- counts:
173
-
174
- 1. **It owns a third copy of the local transform.** `EntityNode.__transform` is the local transform; the component's
175
- `attachment.transform` is *also* the local transform. They are synced one-way, node → component, by
176
- `__transform_sync_down` on change. Write the component directly and the node is stale, with no way to notice.
177
- 2. **It is required at runtime, not just at authoring time.** `bind_property_writer` binds animation curves to
178
- `node.transform.position` / `.rotation` / `.scale` — the *node's* transform, not the component's. Every animated
179
- model therefore has to retain its `EntityNode` tree for as long as it animates. The object graph an ECS hierarchy
180
- is supposed to replace is still there, alive, next to the dataset.
181
- 3. **It carries behaviour the components do not have** — `build`/`destroy` ordering, `on.built`/`on.destroyed`,
182
- listener attach/detach, `root`, `traverse`. None of that is reachable from an entity id. Anything holding only an
183
- entity id cannot participate.
184
-
185
- So there are two ways to express a hierarchy in meep, and they are not interchangeable: components are the storage,
186
- `EntityNode` is the API, and the API is only available to whoever constructed the tree.
187
-
188
- ---
189
-
190
- ## 3. What Scene Graph does
191
-
192
- From Epic's UEFN documentation (see §8 for links):
193
-
194
- **Entities are containers; components supply data and behaviour.** One component instance per type per entity — need
195
- two, make two entities. Components are constructed with a pointer to their owning entity and **cannot be moved between
196
- parents**.
197
-
198
- **One hierarchy, and it means lifetime.** "Parenting represents object lifetime: if the parent is removed from the
199
- scene, so are the sub-objects." One simulation entity is the root; every map entity is a descendant of it.
200
-
201
- **Children are stored and enumerable.** `GetEntities()` returns the direct children; `GetParent()` walks up;
202
- `AddEntities(...)` adds children **and reparents them if they already have a parent**; `RemoveFromParent()` detaches,
203
- and the entity can be re-added later.
204
-
205
- **Space is layered on top, by exception.** `transform_component` holds `LocalTransform` plus an optional `Origin`. If
206
- `Origin` is unset, the entity composes against its parent. If set, it composes against whatever entity `Origin` names
207
- — "a child can orbit around a sibling rather than its parent". API is `Get/SetLocalTransform`, `Get/SetGlobalTransform`
208
- (both of which implicitly create the component), and `SetOrigin` / `GetOrigin[]` / `ResetOrigin`.
209
-
210
- **Lifecycle is a phase machine, not a boolean.** Components get `OnAddedToScene` → `OnBeginSimulation` →
211
- `OnSimulate` (suspending/async) → `OnEndSimulation` → `OnRemovingFromScene`. Adding a child to an in-scene parent
212
- "advances the child through lifetime phases to match parent state". Component queries only become valid after
213
- `OnAddedToScene`.
214
-
215
- **The hierarchy is an event bus.** `SendUp(event)` / `SendDown(event)`, with consumption halting propagation.
216
-
217
- **Entities carry tags** — `AddTag`, `ContainsAnyTag`, `RemoveAllTagsExcept`, etc.
218
-
219
- **Access is scoped.** `GetEntities()` and `GetComponents()` return what is "accessible from the calling context" —
220
- visibility is part of the model, not just a convention.
221
-
222
- **Their own performance guidance** is: don't re-scan the tree during gameplay; find what you need once in
223
- `OnBeginSimulation`, cache the references or subscribe to events, and react to events rather than searching again.
224
- Don't broadcast events across large portions of the graph.
225
-
226
- ---
227
-
228
- ## 4. Head-to-head
229
-
230
- | | meep | Scene Graph |
231
- |---|---|---|
232
- | Lifetime relation | `ParentEntity.entity` | the hierarchy itself |
233
- | Spatial relation | `TransformAttachment.parent` — **independent** | `transform_component.Origin`, defaulting to the parent |
234
- | Local transform | `TransformAttachment.transform` (+ a shadow copy on `EntityNode`) | `transform_component.LocalTransform` |
235
- | World transform | stored, as a decomposed `Transform` component | queried via `GetGlobalTransform()` |
236
- | Children stored? | Yes — a system-owned index, not a component (§4.2) | Yes — `GetEntities()` |
237
- | Reparenting | **Broken / unsupported** (§5 D1, D2) | `AddEntities` reparents as a normal operation |
238
- | Lifecycle | `isBuilt` boolean; `link`/`unlink` on systems | five explicit phases, propagated to children |
239
- | Events on the tree | none | `SendUp` / `SendDown` with consumption |
240
- | Tags | none (`Name` only) | first-class |
241
- | Cycle safety | detected on read, throws | not documented |
242
- | Serialization | asymmetric — spatial survives, lifetime does not (§5 D6) | prefab-based |
243
- | Shear under non-uniform scale | lost silently | lost (documented) |
244
-
245
- ### 4.1 The relation split — meep wins, and should not follow Unreal here
246
-
247
- Worth stating explicitly because it is tempting to read Unreal's design as the newer one and therefore the better one.
248
- It is not, on this axis. `Origin`-defaults-to-parent is a **"unset means auto" sentinel**: one field with two meanings,
249
- where the common case is invisible and the uncommon case is an override. meep's two independent fields say the same
250
- thing with uniform control flow — the common case (`TransformAttachment.parent === ParentEntity.entity`) is written
251
- out rather than implied.
252
-
253
- This also happens to be the shape the codebase already prefers. Adopting `Origin` would be adopting a sentinel.
254
-
255
- The cost meep pays is that **the coupling is real but undocumented**: `TransformAttachment` alone is not safe when the
256
- parent can die (§5 D3). `ParentEntity` is what makes it safe. Nothing says so, and `transform_attachment_parent_of`'s
257
- docstring — which is otherwise the best documentation in this area — describes the spatial hierarchy as if it stood
258
- alone.
259
-
260
- ### 4.2 Children were not stored — the biggest structural gap, now closed
261
-
262
- **Was:** `ParentEntitySystem.findChildrenOf` scanned **every** `ParentEntity` component in the dataset to find one
263
- entity's children, and `traverse` called it once per node. So computing a subtree bounding box (which
264
- `sg_hierarchy_compute_bounding_box_via_parent_entity` does exactly this way) was **O(subtree × all-parented-entities)**.
265
-
266
- Scene Graph stores children and Epic's own guidance is *still* "don't scan the tree during gameplay, cache in
267
- `OnBeginSimulation`". meep was scanning a structure that was a full dataset sweep rather than a stored list.
268
-
269
- **Now:** both systems own a parent → children index (`ecs/hierarchy/EntityChildIndex.js`), so `findChildrenOf` is a
270
- lookup and `traverse` is linear in the subtree. The shape and the reasoning are below; what actually landed is in §6.1.
271
-
272
- Two things this did **not** change, deliberately:
273
-
274
- - `transform_attachment_find_descendant_by_name` still scans every `Name` and walks up from each candidate — that is
275
- the bone-lookup path, and it searches by *name* first, which no parent → children index answers. Rewriting it as a
276
- downward walk over the spatial index is now possible and is the obvious follow-up, but it is a different search.
277
- - The editor's `HierarchicalEntityListView` still builds its own `Map<parent, children[]>`. It looked like the missing
278
- index implemented privately, and it is not quite: the view excludes editor-owned entities from the tree entirely, so
279
- its map is a *filtered* one, and it needs a full entity sweep regardless to find the roots — entities with no
280
- `ParentEntity` at all, which no children index knows about. Swapping in the real index would mean filtering on every
281
- read and taking a dependency on a running system, for no sweep saved. Left alone.
282
-
283
- #### Where the index belongs — *not* in a component
284
-
285
- The obvious move, and the one most engines make, is a `ChildEntities` component. meep had one already
286
- (`parent/ChildEntities.js`, dead). **That was the wrong shape, and it was deleted rather than revived.**
287
-
288
- A child list stored as a component is *derived data promoted to authored data*. The consequences are all bad and all
289
- structural:
290
-
291
- - **It is a two-place invariant.** `ParentEntity` lives on the child and `ChildEntities` lives on the parent — two
292
- entities, two components, one fact. Nothing in the type system or the dataset keeps them agreeing. They can drift,
293
- and the drift is silent.
294
- - **It is user-writable.** Being a component makes it authorable, mutable, and reachable from any system. Every one of
295
- those is an opportunity to corrupt an index that has one correct value.
296
- - **It is a burden at the layer least able to carry it.** Whoever builds a hierarchy now has to maintain both ends of
297
- every edge, for information the engine can derive.
298
- - **It doubles the state footprint** of every parent, and it has to be excluded from serialization by hand — one more
299
- thing to get wrong alongside D6.
300
-
301
- The alternative, and what was built, is to hold the back-links **at the system level**: `ParentEntitySystem` already
302
- observes every entity that gains or loses a `ParentEntity`, so it maintains a private parent → children index with no
303
- component, no authored state, and nothing for a user to desynchronise. One writer, one source of truth, rebuilt from
304
- scratch on load.
305
-
306
- The usual objection is ergonomics — a consumer now has to reach for the system instead of just calling `getComponent`.
307
- That objection does not survive contact with the actual call pattern: **`ChildEntities` would not have avoided it.** A
308
- component gives you one level of children as entity ids; to go a level deeper you need `getComponent(child,
309
- ChildEntities)`, so you are already reaching for the dataset. Component and system are equally indirect, and the system
310
- version is the one that cannot be wrong. `EntityManager.getSystem(SystemClass)` is typed on the class, so this stays
311
- inside the codebase's preference for typed lookup over string-keyed registries.
312
-
313
- The migration cost was also much smaller than it looked — see §6.1.
314
-
315
- ### 4.3 Reparenting
316
-
317
- Scene Graph: `AddEntities` reparents, and advances the child through lifecycle phases to match the new parent.
318
-
319
- meep: **neither path works.** Direct `.parent =` assignment strips the spatial link (D1, reproduced). `addChild` of an
320
- already-built node throws (D2, reproduced). There is no supported way to move a live subtree.
321
-
322
- This is the single largest functional gap, and it is not exotic — "pick this up", "get in the vehicle", "re-dock this
323
- panel" are all reparenting a live subtree.
324
-
325
- ### 4.4 Lifecycle phases
326
-
327
- meep has one bit (`isBuilt`) plus system `link`/`unlink`. The consequence is `TransformAttachmentSystem`'s retry
328
- queue: a child whose parent has not appeared yet cannot be linked, so it is parked and retried at 32 entries per
329
- frame, forever, with no diagnostic if the parent never arrives. `AttachmentSystem` has its own separate `waiting`
330
- array doing the same thing.
331
-
332
- That queue is *compensating for the absence of ordering guarantees*. Scene Graph's answer is that a child added to an
333
- in-scene parent is advanced to match the parent's phase — the "parent isn't ready yet" state is structurally
334
- impossible rather than polled for.
335
-
336
- Not a defect. But two hand-rolled retry queues is what the missing phase model costs.
337
-
338
- ### 4.5 Events, tags, scoping
339
-
340
- meep has none of `SendUp`/`SendDown`, tags, or context-scoped access. Of the three:
341
-
342
- - **`SendUp`/`SendDown` is worth having** and is cheap once children are stored. The idiom it enables — a hit on a
343
- limb bubbling to the creature, a "prefab" root broadcasting down — is currently done by walking to
344
- `ParentEntitySystem.findRoot` and dispatching manually.
345
- - **Tags** duplicate what a component already does in meep. Skip; a zero-field component is the same thing and stays
346
- typed, which is what this codebase prefers over string keys.
347
- - **Scoped access** is a Verse-language concern. Not applicable.
348
-
349
- ---
350
-
351
- ## 5. Defects
352
-
353
- Ordered by severity. **[repro]** = I reproduced it against the real systems. **[read]** = from reading only.
354
- Entries marked **FIXED** were closed on 2026-08-24 by the work in §6.1 and §6.3; the original finding is kept so the
355
- reasoning stays readable, with what changed appended.
356
-
357
- ---
358
-
359
- **D1 — `EntityNode.parent` setter destroys the spatial link. [repro]** — *correctness, high*
360
-
361
- `EntityNode.js:240-270`. The setter removes both components up front:
362
-
363
- ```js
364
- let parent_entity = this_entity.removeComponent(ParentEntity);
365
- let attachment = this_entity.removeComponent(TransformAttachment); // returns the instance
366
-
367
- if (node !== null) {
368
- ...
369
- this_entity.add(parent_entity); // ParentEntity IS re-added
370
-
371
- if (attachment === null) { // ...but it is NOT null,
372
- attachment = this.__safe_get_attachment(); // so this never runs
373
- }
374
- attachment.parent = parent_entity_id; // mutates a DETACHED component
375
- }
376
- ```
377
-
378
- `Entity.removeComponent` returns the removed instance (`Entity.js:286`), so the `=== null` branch is dead whenever the
379
- node was already parented. The re-add only happens through `__safe_get_attachment()`, which is skipped.
380
-
381
- Reproduced — build `a → b`, then assign `b.parent = c` directly:
382
-
383
- ```
384
- after build, b has TransformAttachment: true
385
- after reparent, b TransformAttachment: null
386
- after reparent, b ParentEntity: 2 (c.id: 2) ← lifetime link correct
387
- dataset has TransformAttachment on b: undefined ← spatial link gone
388
- ```
389
-
390
- The child keeps its new owner and silently stops following it in space; its world `Transform` freezes at its last
391
- value. `addChild()` happens to escape this because `removeChild()` runs first and clears the component via the
392
- `node === null` path — so the bug is confined to the public setter, which is the documented way to reparent.
393
-
394
- Fix is one line: drop the `if (attachment === null)` guard and always call `__safe_get_attachment()`.
395
-
396
- ---
397
-
398
- **D2 — live reparenting asserts in dev, silently no-ops in prod. [repro]** — *correctness, high*
399
-
400
- `EntityNode.addChild` calls `node.build(dataset)` when the receiving parent is built; `build` opens with
401
- `assert.notOk(this.__entity.isBuilt, 'Already built')`. Reproduced: `addChild` of a built node into a built parent
402
- throws `"Already built"`.
403
-
404
- Asserts are compiled out of production builds. In production the assert vanishes and `Entity.build` early-returns
405
- (`Entity.js:442-449`), so it degrades to a partial no-op rather than corruption — but combined with D1 the node can
406
- end up owned-but-not-attached with no error anywhere. **Dev throws, prod silently misbehaves**, which is the worse of
407
- the two orderings.
408
-
409
- ---
410
-
411
- **D3 — a child was not detached when its spatial parent died. [read]** — *correctness, high* — **FIXED 2026-08-24.**
412
-
413
- `UpdateContext` captured `parent_transform` at link time and subscribed to it. Nothing observed the *parent's*
414
- removal. When the parent entity was destroyed:
415
-
416
- - the child still had `TransformAttachment` + `Transform`, so the system's `unlink` was never called;
417
- - `this.__contexts[entity]` kept holding the context, which kept holding the dead parent's `Transform` alive;
418
- - the child composed against a transform nothing would ever update again — it froze, silently.
419
-
420
- `ParentEntity` masked this whenever both components named the same entity, because the child got destroyed too. It was
421
- exposed exactly when the two are used independently — i.e. the capability §4.1 credits as meep's advantage.
422
-
423
- **The fix**, mirroring what `ParentEntitySystem`'s `Context` already did: `UpdateContext` subscribes to its parent's
424
- `EntityRemoved` in `link()` and unsubscribes in `unlink()`, and on removal it takes `TransformAttachment` off the
425
- child. The child survives with the world transform it had, as a root, and its own subtree keeps composing against it.
426
- Dropping the component rather than quietly tearing the context down is what makes the detach observable, and it routes
427
- the teardown through the system's ordinary `unlink` path.
428
-
429
- Two details worth keeping:
430
-
431
- - **It is registered per child, not per parent, so the §6.1 index is not what makes it work.** The index would have
432
- needed a separate count of *bound* children to know when to add and drop a single per-parent listener — queued
433
- children are in the index but must not register — which is more state than one listener per context. The index is
434
- still what makes "which children point at me" answerable; this particular fix just did not need to ask.
435
- - **A stale dispatch is real and is guarded.** Entity event dispatch copies its listener list before invoking it, so
436
- when an entity carries *both* relations and the lifetime one destroys it first, the spatial detach still arrives —
437
- for an entity that no longer exists. `UpdateContext` tracks whether it is linked and ignores the late call. This is
438
- ordering-dependent (whichever system linked first is called first) and is covered both ways round in the spec.
439
-
440
- **Still not covered:** a child that is still *queued* when its parent dies. It never bound, so it never subscribed, and
441
- it goes on retrying against an id that may be recycled. That is the pre-existing gap §4.4 describes — the retry queue
442
- has no diagnostic for a parent that never arrives, and now also none for one that leaves.
443
-
444
- ---
445
-
446
- **D4 — mutating `TransformAttachment.parent` is silently ignored. [read]** — *correctness, medium* — **ADDRESSED
447
- 2026-08-24**, documented on the field to match `ParentEntity`'s existing constraint.
448
-
449
- `UpdateContext.update()` reads `this.parent_transform`, resolved once at link. Writing `attachment.parent = other`
450
- afterwards changes nothing; the entity keeps composing against the old parent. `ParentEntity` documents this
451
- constraint ("Must not be mutated while the component is attached to a dataset"); `TransformAttachment` did not, and
452
- its field is plain and public.
453
-
454
- Worth noting that this contract is **load-bearing for §6.1, not just hygiene.** A system-owned child index is correct
455
- precisely because `link`/`unlink` are the only transitions a parent reference can undergo. If either component's
456
- `parent` field could be rewritten in place, the index would need change detection to stay honest, and the argument for
457
- keeping it out of a component would weaken. Documenting the immutability is what makes the cheap index sound.
458
-
459
- ---
460
-
461
- **D5 — `ChildEntities` was dead code, and the wrong shape. [repro — zero references]** — *hygiene, medium* —
462
- **FIXED 2026-08-24.**
463
-
464
- Defined in `parent/ChildEntities.js`, referenced nowhere outside its own file.
465
-
466
- **Deleted.** Per §4.2 it was not a stub to finish — a component is the wrong home for a derived back-link, and leaving
467
- the file present implied both that a child index existed and that a component was where one should go. Neither was
468
- true. The index belongs to `ParentEntitySystem` (§6.1), and now lives there.
469
-
470
- ---
471
-
472
- **D6 — serialization is asymmetric between the two hierarchies. [read]** — *correctness, medium*
473
-
474
- `ParentEntity.serializable = false`, commented "Entity IDs are transient, serialization is not applicable".
475
- `TransformAttachment` sets no such flag, and `isComponentClassSerializable` defaults to serializable
476
- (`BinaryBufferSerializer.js:15`) — so its `parent` field, **also a raw entity id**, is written and read back.
477
-
478
- Entity ids do survive a round-trip (`BinaryBufferDeSerializer` calls `createEntitySpecific`), so this is not
479
- straightforwardly broken. But the two components make opposite decisions about the same kind of data, and the result
480
- is that a saved scene reloads with its **spatial** hierarchy intact and its **lifetime** hierarchy gone. Given D3,
481
- that reload also lands in exactly the configuration where an attachment is unsafe.
482
-
483
- Whichever way it is resolved, the two should agree.
484
-
485
- §6.1 sharpened this rather than changing it: the child index is rebuilt from the child-side components on load, so a
486
- scene that reloads without its `ParentEntity` components reloads with an empty lifetime index too. The index does not
487
- cause the omission, it just stops it being invisible.
488
-
489
- ---
490
-
491
- **D7 — subtree operations were O(subtree × world). [read]** — *performance, medium* — **FIXED 2026-08-24.**
492
-
493
- `ParentEntitySystem.findChildrenOf` swept every `ParentEntity` in the dataset per node; `traverse` called it per node.
494
- `sg_hierarchy_compute_bounding_box_via_parent_entity` and `transform_attachment_find_descendant_by_name` (the bone
495
- lookup) both paid it.
496
-
497
- The index in §6.1 fixed the first: `findChildrenOf` is a lookup and `traverse` is linear in the subtree. The bone
498
- lookup is untouched — it searches by name, which this index does not answer (§4.2).
499
-
500
- Also in `traverse`: `path.concat(entity)` allocated a new array per node per level, making cycle detection O(depth²) in
501
- allocations for a deep tree. The rewritten walk pushes and pops one shared path array instead, and cycle detection is
502
- now O(depth) comparisons per node against no allocation at all.
503
-
504
- ---
505
-
506
- **D8 — the cycle checker was a shared fixed buffer. [read]** — *correctness, low* — **FIXED 2026-08-24.**
507
-
508
- `ParentEntitySystem` used a module-level `Uint32Array(1024)` for `findRoot` and `isAncestorOf`, with no bounds check
509
- on `loop_checker_array[count++]`. Two consequences: writes past 1024 were silently dropped by JS typed arrays, so a
510
- hierarchy deeper than 1024 stopped detecting cycles and could spin forever; and because the buffer was shared and
511
- un-reentrant, a `findRoot` called from inside a `traverse` callback clobbered the outer walk's state.
512
-
513
- Depth > 1024 is not realistic. Re-entrancy was — `traverse` takes a user callback.
514
-
515
- Both walks now keep their own path array, which is per call and grows, so neither failure mode exists. It fell out of
516
- moving these two off the static-plus-`ecd` shape onto the system; the module global, `check_loop` and `genLoopString`
517
- went with it. A 2048-deep chain is in the spec.
518
-
519
- ---
520
-
521
- **D9 — transform sockets update twice per frame. [read]** — *performance, low*
522
-
523
- `TransformAttachmentBinding.link()` subscribes to the parent's and the attachment's transform changes, *and*
524
- `AttachmentSystem.__updateAll()` calls `binding.update()` for every binding every frame unconditionally. Either the
525
- subscription or the sweep is redundant. (`BoneAttachmentBinding` genuinely needs the per-frame sweep — its pose is a
526
- query with no change signal — so the sweep is the one to keep, and the `TransformAttachmentBinding` subscriptions are
527
- the removable half.)
528
-
529
- ---
530
-
531
- **D10 — decompose round-trip drifts and drops shear. [repro]** — *correctness, low-to-medium*
532
-
533
- Numbers in §2.3. Scale drifts to ~1.4e-6 over 64 rotation-only levels and fires spurious `scale.onChanged` at every
534
- level; shear from a non-uniformly-scaled rotated parent is silently best-fitted away.
535
-
536
- Not cheaply fixable — it is inherent to storing the world transform as a decomposed `Transform` — and Unreal has the
537
- same limitation.
538
-
539
- The documentation half is **done**: `TransformAttachment` now carries the non-uniform-scale caveat and the drift
540
- figure. The behaviour is unchanged and the defect stays open on that basis. Still worth considering: whether
541
- `UpdateContext.update()` should compose into the child's `matrix` and skip the decompose for consumers that only read
542
- the matrix.
543
-
544
- ---
545
-
546
- **D11 — neither system had a spec. [repro — no such files]** — *test coverage, medium* — **FIXED 2026-08-24.**
547
-
548
- There was no `TransformAttachmentSystem.spec.js` and no `ParentEntitySystem.spec.js`. `TransformAttachment.spec.js` and
549
- `EntityNode.spec.js` between them test `setFlag`/`clearFlag`/`getFlag`/`writeFlag` — twice, once each, in identical
550
- form — plus JSON round-trip and `addChild`/`removeChild` bookkeeping on *unbuilt* nodes.
551
-
552
- **The composition contract itself was untested.** Nothing asserted that a child's world transform equals parent ×
553
- local, that a change propagates, that a chain composes, or that a queued attachment links when its parent arrives.
554
- Nine other specs register both systems, but as fixture scaffolding — `MeshSystem3.spec.js` registers them so a model
555
- can expand, not to check them.
556
-
557
- Both specs now exist, on real `EntityManager`/`EntityComponentDataset` objects, and cover the composition contract,
558
- the index (empty/one/many, ordering, child removal, parent removal, id recycling, snapshot semantics), the queue path,
559
- subtree traversal against the full-scan implementation it replaced, cycles, and the D3 detach in both dispatch orders.
560
- `EntityChildIndex` has its own spec for what the systems cannot reach through their own API. The flag tests remain the
561
- vacuous-smoke-test shape and were left alone; they are not what this defect was about.
562
-
563
- Note that D1 and D2 are both immediately visible from a five-line test, which is why they are still here.
564
-
565
- ---
566
-
567
- ## 6. What is worth taking from Scene Graph
568
-
569
- In order of value per unit of change. Note that the first item takes Scene Graph's *capability* while explicitly
570
- rejecting its *storage* — the useful comparison here is not "copy what Unreal did".
571
-
572
- ### 6.1 Store children — as a system-owned index, not a component — **LANDED 2026-08-24**
573
-
574
- Take Scene Graph's *capability* (children are enumerable in O(children)) and reject its *storage*, because meep's
575
- system layer can derive the same thing without asking the user to maintain anything. Reasoning in §4.2; this is what
576
- was built.
577
-
578
- `ecs/hierarchy/EntityChildIndex.js` holds the structure — a sparse array of parent id → ascending child ids — and both
579
- systems own one, as `__children`. It has its own spec for the ordering and copy-out contracts.
580
-
581
- **The choke points already existed and were already overridden.** `ParentEntitySystem` extends `AbstractContextSystem`,
582
- whose `link()`/`unlink()` fire exactly once per entity gaining or losing a `ParentEntity`. `ParentEntitySystem`'s own
583
- `Context` already overrode both, and already read `this.components[0].entity` to subscribe to the parent's removal.
584
- Maintaining the index is one insert in `Context.link()` and one remove in `Context.unlink()`, beside code that was
585
- already there for exactly the same edge.
586
-
587
- Design notes that mattered, and how each was settled:
588
-
589
- - **Store entity ids, never contexts.** `AbstractContextSystem` pools its contexts through `ObjectPoolFactory` and
590
- reuses them after `unlink`. An index holding context references would alias recycled objects. The index stores ids.
591
- - **Define child order explicitly.** Insertion order is link order, which is deterministic only as far as entity
592
- creation order is. **Sorted ascending by entity id on insert**, via a binary-search insert — chosen over documenting
593
- link order because it makes iteration order independent of the thing that is hard to reason about, and child fan-out
594
- is small enough that the splice is not worth defending against.
595
- - **Hand out a snapshot, not the live array.** `handleParentEntityRemoval` destroys children from inside the cascade,
596
- so a consumer iterating a live array mutates under itself. `findChildrenOf` kept its `(result, result_offset, ...)
597
- -> count` shape — the `ecd` argument dropped, since the system knows its own dataset — which preserves the house
598
- convention from the bvh3 query API. `countChildrenOf` was added beside it, to size a buffer without filling one.
599
- - **The index does not serialize, and that is the point.** It is rebuilt from `ParentEntity` on load, so there is no
600
- format, no version, and no stale-id migration. **This does sharpen D6:** `ParentEntity.serializable === false` means
601
- a loaded scene has no `ParentEntity` components to rebuild *from*, so the lifetime hierarchy comes back empty. The
602
- index makes that omission visible rather than causing it.
603
- - **Entity ids are recycled**, so a parent whose last child leaves has its entry deleted outright rather than left
604
- empty. An id that comes back has to come back childless; both specs pin it.
605
-
606
- **Static-with-`ecd` versus instance.** `traverse` and `findChildrenOf` need the index, so they had to move onto the
607
- system. `findRoot`, `isAncestorOf` and `findParentEntity` walk child → parent and did not, but leaving them static
608
- would have meant two ways to ask the same system the same kind of question. All five are instance methods now and the
609
- `ecd` parameter is gone from all of them. Per library semantics the unreferenced ones were carried across rather than
610
- deleted.
611
-
612
- **Migration cost, measured before and confirmed after:** `ParentEntitySystem.traverse` had **exactly one caller** in
613
- the whole tree (`sg_hierarchy_compute_bounding_box_via_parent_entity.js:30`), which now takes the system in place of
614
- the `ecd`. `findChildrenOf`, `findRoot` and `isAncestorOf` had **zero** external callers. So the "you have to reach
615
- for the system" awkwardness cost one production signature change, plus standing up an `EntityManager` in
616
- `sg_hierarchy_compute_bounding_box_via_parent_entity.spec.js`, which had been running on a bare ECD.
617
-
618
- Payoff: killed D7 and D8, made D3 small enough to fix in the same pass (§6.3), and unblocks `SendUp`/`SendDown`. It did
619
- **not** let `HierarchicalEntityListView` drop its private `Map<parent, children[]>` — see §4.2 for why that map is not
620
- this index.
621
-
622
- **The same index shape applies to the spatial hierarchy**, and landed there too. `TransformAttachmentSystem` already
623
- keyed `__contexts` by child; the parent → children direction goes in at `link()` and out at `unlink()`. Inserting at
624
- `link()` rather than `__finalize_link()` means **a queued child is in the index before it binds** — the question the
625
- index answers is "which children point at me", and that is true of a child still waiting for its parent to gain a
626
- `Transform`. The consequence, documented on the system: a non-zero child count does not imply those children are
627
- composing yet.
628
-
629
- ### 6.2 Make reparenting a real, single operation
630
-
631
- **Not done — still the largest open item.** One function — `hierarchy_reparent(ecd, entity, new_parent)` — that
632
- updates both components together and is the only supported path. Fix D1 inside it and let `EntityNode.parent` delegate
633
- to it. This is Scene Graph's `AddEntities` semantics, minus the phase machine. D4's documented immutability means
634
- reparenting is a remove/re-add of the components, not a field write — which is the contract this function should
635
- encode rather than leave to callers, and which §6.1 turned from a convention into something the child indices depend
636
- on.
637
-
638
- ### 6.3 Detach on parent death — **LANDED 2026-08-24**
639
-
640
- `TransformAttachmentSystem` now listens for `EntityRemoved` on the parent (as `ParentEntitySystem`'s `Context` already
641
- did) and drops the child's `TransformAttachment`. This fixes D3, and makes the independent use of the two relations
642
- actually safe.
643
-
644
- One prediction here did not hold up. The expectation was that the 6.1 index would turn "which children do I unlink"
645
- into a lookup; in practice the listener is registered **per child context**, exactly as `ParentEntitySystem` does it,
646
- because a single per-parent listener would have needed its own count of *bound* children to know when to register and
647
- unregister — the index deliberately includes queued children, which must not register one. Per-child is less state
648
- and mirrors the sibling system. The index is still what makes the direction answerable at all; this fix just did not
649
- need to ask. Details, including the stale-dispatch guard, are in D3.
650
-
651
- ### 6.4 `SendUp` / `SendDown`
652
-
653
- Now cheap — 6.1 exists, so `SendDown` is a traversal that already terminates and `SendUp` is
654
- `ParentEntitySystem.findRoot`'s walk with a visitor. Replaces the manual `findRoot`-and-dispatch idiom. Not built;
655
- nothing in the tree asks for it yet.
656
-
657
- ### 6.5 Document the couplings — **DONE 2026-08-24**
658
-
659
- `TransformAttachment` needed what `ParentEntity` already had. All three halves are now on the component: the
660
- `parent`-immutability note (D4), the non-uniform-scale and drift caveat (D10), and the statement that without a
661
- lifetime relation an attachment does not survive its parent — which, since D3, means the component is removed and the
662
- entity becomes a world-space root rather than freezing.
663
-
664
- Both `parent` fields also now say *why* they must not be mutated in place: each system resolves the parent once at
665
- link and indexes the edge at the same moment, so an in-place write desynchronises both.
666
-
667
- ## 7. What is not worth taking
668
-
669
- - **`Origin`-defaults-to-parent.** §4.1 — meep's two-field split is better and matches the codebase's stated
670
- preference for uniform control flow over sentinels.
671
- - **A child list as stored, authored state.** §4.2 — take the enumerability, not the component. Scene Graph can afford
672
- a stored child list because its hierarchy *is* the entity and there is only one writer; in an ECS the same list
673
- becomes a second, user-writable copy of an edge that already exists on the child, with no mechanism keeping the two
674
- ends honest. Derive it in the system instead. This is the one place where the conventional engine answer and
675
- `ChildEntities` agree with each other and are both wrong.
676
- - **Tags.** A zero-field component already is a tag, and stays typed.
677
- - **The five-phase lifecycle, wholesale.** The valuable half is the ordering guarantee that removes the retry queues;
678
- adopting five named phases across every system is a much larger change than the problem warrants. If anything here
679
- is worth doing it is the *guarantee*, not the vocabulary.
680
- - **Scoped access.** A Verse language feature with no analogue here.
681
-
682
- ## 8. The one thing this review would change first
683
-
684
- Not any single defect — **`EntityNode`'s status.**
685
-
686
- It is documented as sugar and treated as sugar, but it holds the local transform that animation writes to, so it is
687
- load-bearing runtime state. Every gap in this document traces back to that: reparenting is broken because the fix
688
- belongs on the components but the API lives on the node; the transform has two homes because the node keeps its own;
689
- subtree queries scanned because the node had `children` and nothing at the dataset level did.
690
-
691
- That last clause is no longer true, which sharpens the question rather than answering it: since §6.1 there **is** a
692
- child enumeration below the node, owned by the systems. `EntityNode.children` is now a second answer to a question the
693
- dataset can already answer — a list of nodes, only available to whoever built the tree, next to a list of entity ids
694
- available to anything holding an entity id.
695
-
696
- Decide which one is the hierarchy. If it is the components, `EntityNode` must become genuinely stateless — its
697
- `transform` accessor forwarding to `attachment.transform`, its `children` reading through `ParentEntitySystem` — and
698
- animation binds to components. If it is `EntityNode`, then say so, and stop describing it as sugar.
699
-
700
- Scene Graph made this choice: the entity is the hierarchy, `transform_component.LocalTransform` is the one local
701
- transform, and there is no second object graph. That is the part of the design worth copying — not the API surface.
702
-
703
- ---
704
-
705
- ## Sources
706
-
707
- Unreal / Scene Graph — Epic documentation and reporting:
708
-
709
- - [Getting Started in Scene Graph in Fortnite](https://dev.epicgames.com/documentation/fortnite/getting-started-in-scene-graph-in-fortnite)
710
- - [entity class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/entity)
711
- - [component class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/component)
712
- - [Transforms in Scene Graph](https://dev.epicgames.com/documentation/en-us/fortnite/transforms-in-scene-graph-in-unreal-editor-for-fortnite)
713
- - [Scene Graph Best Practices](https://dev.epicgames.com/documentation/fortnite/scene-graph-best-practices-in-fortnite?lang=en-US)
714
- - [Scene Graph is Now Available as an Experimental Feature in UEFN](https://www.fortnite.com/news/scene-graph-is-now-available-as-an-experimental-feature-in-uefn)
715
- - [Unreal Engine 6 Will Combine UEFN and UE Into a "Unified Engine"](https://80.lv/articles/upd-unreal-engine-6-will-combine-uefn-and-ue-into-a-unified-engine)
716
- - [10 things CG artists need to know about Unreal Engine 6](https://www.cgchannel.com/2026/06/10-things-cg-artists-need-to-know-about-unreal-engine-6/)
717
- - [Mass Framework overview](https://vrealmatic.com/unreal-engine/mass) — for the Scene Graph ≠ Mass distinction
1
+ # Hierarchy in meep's ECS — a review against Unreal 6 / Scene Graph
2
+
3
+ **Date:** 2026-08-23
4
+ **Subject:** `ParentEntity`, `TransformAttachment`, `EntityNode`, and the systems behind them
5
+ **Comparator:** Epic's Scene Graph — the entity/component framework that UE6 is being built on
6
+
7
+ **Status, 2026-08-24.** §6.1 landed: both systems now keep a parent → children index
8
+ (`ecs/hierarchy/EntityChildIndex.js`), which closed **D5**, **D7**, **D8** and **D11**, and made **D3** small enough
9
+ to fix in the same pass. **D4** was addressed the day before. Still open: **D1**, **D2**, **D6**, **D9**, **D10**, and
10
+ the question in §8. Sections below are written in the tense of what is true now; the reasoning that led there is
11
+ unchanged.
12
+
13
+ ---
14
+
15
+ ## 0. Verdict up front
16
+
17
+ The **core split is right, and it is a better decomposition than Unreal's.** meep separates *lifetime* parenting
18
+ (`ParentEntity`) from *spatial* parenting (`TransformAttachment`) into two independent components. Scene Graph has one
19
+ hierarchy that means lifetime, and bolts a spatial override onto it (`transform_component.Origin`). meep's version is
20
+ the more honest model: two relations that are genuinely independent are stored as two relations, rather than one
21
+ relation plus an escape hatch.
22
+
23
+ The **propagation is also better than I expected.** I assumed the signal cascade would re-do work exponentially in
24
+ depth. It does not — measured, each descendant is recomputed **exactly once** per root change, at any depth. That is
25
+ optimal, and it is achieved without a sort, a level index, or a dirty-flag pass.
26
+
27
+ What is weak is everything *around* that core:
28
+
29
+ - `EntityNode`, described as "syntactic sugar", is not sugar. It holds live state (the local transform, the
30
+ subscriptions) that the ECS does not have, and animation binds to it. It is a **shadow object graph** — the exact
31
+ thing an ECS hierarchy exists to remove.
32
+ - **Live reparenting does not work.** One path silently strips the spatial link (verified, repro below); the other
33
+ asserts. Scene Graph treats reparenting as an ordinary operation.
34
+ - ~~**Children are not stored anywhere.** Every "give me the subtree" operation is a full scan of the dataset, so
35
+ subtree work is O(nodes × entities-in-world).~~ **Fixed** — each system now owns the back-links (§6.1).
36
+ - Three parallel attachment mechanisms exist (`TransformAttachment`, `Attachment`, plus ad-hoc `transform.subscribe`
37
+ closures in `MeshSystem`). A fourth component, `ChildEntities`, was dead code and has been deleted.
38
+
39
+ Severity-ordered defect list is in §5. Six of the eleven are correctness, and two of those I reproduced.
40
+
41
+ ---
42
+
43
+ ## 1. Scope and method
44
+
45
+ **Read in full:** `ecs/parent/*` (`ParentEntity`, `ParentEntitySystem`, `ChildEntities` (since deleted), `EntityNode`,
46
+ `EntityNodeFlags`, `entity_node_compute_bounding_box`), `ecs/transform-attachment/*` (`TransformAttachment`,
47
+ `TransformAttachmentSystem`, `transform_attachment_parent_of`, `transform_attachment_find_descendant_by_name`),
48
+ `ecs/attachment/*` (`Attachment`, `AttachmentSystem`, `AttachmentBinding`, `TransformAttachmentBinding`,
49
+ `BoneAttachmentBinding`), plus `Entity`, `Transform`, and the relevant parts of `EntityComponentDataset`,
50
+ `EntityManager` and `BinaryBufferSerializer`.
51
+
52
+ **Consumers surveyed:** `shade_node_to_entity_composition`, `three_object_to_entity_composition`, `MeshSystem`,
53
+ `SGMeshSystem`, `ColliderObserverSystem`, `HierarchicalEntityListView`, `bind_property_writer`,
54
+ `sg_hierarchy_compute_bounding_box_via_parent_entity`.
55
+
56
+ **Measured, not assumed.** Four throwaway specs were run against the real systems (no mocks) and then deleted. Every
57
+ number in §2.3, §5 D1, D2 and D10 is output from those runs, quoted verbatim. Where I state something I only read and
58
+ did not execute, it says so.
59
+
60
+ **On the Unreal side — read this before trusting §3.** Epic announced at State of Unreal (June 2026) that UE6 unifies
61
+ UE and UEFN, and that Actors and Blueprints will eventually be deprecated in favour of Verse plus Scene Graph, with
62
+ conversion tools and a multi-year transition. Scene Graph itself shipped first in UEFN and is documented there as
63
+ experimental/beta. **The public documentation is the UEFN surface**, so the API names below are the Verse ones. Epic
64
+ has not published Scene Graph's internal storage, so anything about *how* it stores hierarchy is unknown, and I make
65
+ no claims about it.
66
+
67
+ One terminology correction worth making, because it changes what "compare against Unreal's ECS" means: **Scene Graph
68
+ is not Unreal's ECS.** Unreal's data-oriented ECS is **Mass** (archetype-based; components are "fragments", systems
69
+ are "processors"), built for crowds and traffic. Scene Graph is an *entity/component gameplay framework* — the Actor
70
+ replacement. It is Scene Graph, not Mass, that is the right comparator for meep's hierarchy, and that is what this
71
+ document uses. Mass has no user-facing hierarchy to compare against.
72
+
73
+ ---
74
+
75
+ ## 2. What meep has today
76
+
77
+ ### 2.1 Four mechanisms, not one
78
+
79
+ | Mechanism | Means | Propagated by | Status |
80
+ |---|---|---|---|
81
+ | `ParentEntity { entity }` | **Lifetime.** Parent dies → child dies. | `ParentEntitySystem` listens for `EntityRemoved` on the parent, removes the child. | Live |
82
+ | `TransformAttachment { transform, parent, flags }` | **Space.** Child world = parent world × local. | `TransformAttachmentSystem`, via `Transform` change signals. | Live |
83
+ | `Attachment { parent, socket, transform }` | **Space, via a named socket / bone.** | `AttachmentSystem`, via `AttachmentBinding`s, polled every frame. | Live |
84
+ | ad-hoc `transform.subscribe(follow)` | **Space, hand-rolled.** | A closure in `MeshSystem` (line ~558) copying one transform to another. | Live |
85
+ | ~~`ChildEntities { entities[] }`~~ | — | — | **Deleted** (D5). Was dead, and the wrong shape — see §4.2. |
86
+
87
+ `EntityNode` sits on top of the first two as an authoring façade.
88
+
89
+ The overlap between rows 2–4 is the first thing to notice. `TransformAttachmentBinding` (row 3's transform case) does
90
+ what `UpdateContext` (row 2) does, with a socket offset spliced in, using matrices instead of `Transform` composition —
91
+ and it carries a `TODO` saying so. Row 4 is row 2 with the local transform hard-coded to identity.
92
+
93
+ ### 2.2 The two relations are genuinely independent — and that is the good part
94
+
95
+ ```
96
+ ParentEntity.entity → "when that entity dies, I die"
97
+ TransformAttachment.parent → "my transform is relative to that entity"
98
+ ```
99
+
100
+ Nothing requires them to name the same entity. That is a real capability: a UI marker can be spatially attached to a
101
+ unit's head while being owned by the HUD; a compound rigid body's colliders are `ParentEntity`-owned by the body
102
+ (which is exactly how `ColliderObserverSystem` finds them) without necessarily composing transforms through it.
103
+
104
+ Scene Graph cannot express this as two facts. It has one hierarchy — which means lifetime — and then
105
+ `transform_component.Origin` to say "actually, compose me against *that* entity instead". Same expressive power,
106
+ reached by exception rather than by construction.
107
+
108
+ ### 2.3 How the transform composition actually behaves (measured)
109
+
110
+ `TransformAttachmentSystem` builds an `UpdateContext` per attached entity holding `{attachment, transform, entity,
111
+ parent_transform}` and subscribes it to *both* the parent's world `Transform` and the attachment's local `Transform`.
112
+ Any change to either fires `ctx.update()`, which is one `m4_multiply` plus a decompose back into the child's world
113
+ `Transform` — whose own position/rotation/scale setters fire, waking the grandchild's context. Propagation is a
114
+ synchronous, re-entrant, depth-first cascade with no flush point.
115
+
116
+ Measured on a straight chain, counting writes to each descendant's TRS channels for **one** root change:
117
+
118
+ ```
119
+ depth=4 translate: pos-writes=3 rot-writes=0 scale-writes=0 across 3 descendants
120
+ depth=4 rotate: pos-writes=3 rot-writes=3 scale-writes=3 across 3 descendants
121
+ depth=8 translate: pos-writes=7 rot-writes=0 scale-writes=0 across 7 descendants
122
+ depth=8 rotate: pos-writes=7 rot-writes=7 scale-writes=7 across 7 descendants
123
+ depth=16 translate: pos-writes=15 rot-writes=0 scale-writes=0 across 15 descendants
124
+ depth=16 rotate: pos-writes=15 rot-writes=15 scale-writes=15 across 15 descendants
125
+ ```
126
+
127
+ **One recompute per descendant, every time.** No redundancy at any depth. The `Vector3.set`/`Quaternion.set` equality
128
+ guards are doing real work here: a pure translation never wakes a rotation listener. This is a good design and it
129
+ should be said plainly, because the rest of this document is mostly criticism.
130
+
131
+ Two costs come with it, both real:
132
+
133
+ **It is observable mid-cascade.** An observer of a descendant's `Transform` is called *during* propagation, when the
134
+ transform is only partly updated. Measured on a depth-3 chain under one 90° root yaw, an observer of the leaf sees:
135
+
136
+ ```
137
+ [0] pos(0.000,-2.000) rotY(0.000) ← position already final, rotation still stale
138
+ [1] pos(0.000,-2.000) rotY(0.707) ← settled
139
+ ```
140
+
141
+ State `[0]` is a pose that never existed. Anything that *accumulates* from a transform callback — a motion trail, a
142
+ velocity estimate, a moved-event, a physics impulse — integrates a torn pose. Renderers get away with it because the
143
+ last write before the frame ends is correct.
144
+
145
+ **Every level does a decompose/recompose round-trip**, and it is lossy. Measured on a chain with **no scaling
146
+ anywhere**, all-rotation locals:
147
+
148
+ ```
149
+ depth=8: leaf world scale = (1.00000009045938, 1, 1.00000009045938)
150
+ depth=32: leaf world scale = (1.0000006507070245, 1, 1.0000006507070245)
151
+ depth=64: leaf world scale = (1.0000014229381489, 1, 1.0000014229381489)
152
+ ```
153
+
154
+ The exact answer is `(1,1,1)` at every depth. The drift grows with depth, and — because it is a genuine change — it
155
+ also fires a spurious `scale.onChanged` at every level on every rotation, which is where the `scale-writes=N` column
156
+ above comes from. Anything subscribed to scale is woken by pure rotation.
157
+
158
+ The same round-trip discards shear outright. Root scaled `(4,1,1)`, child yawed 45°:
159
+
160
+ ```
161
+ mid world scale stored as (2.9155, 1.0000, 2.9155)
162
+ leaf world matrix row0 = 2.8284, 0.0000, -0.7071
163
+ ```
164
+
165
+ The true composed basis is non-orthogonal; TRS cannot hold it, so it is silently best-fitted. A mesh under a
166
+ non-uniformly-scaled rotated parent draws wrong. **Scene Graph shares this limitation** — its transform is TRS too —
167
+ but Unreal documents the non-uniform-scale caveat and meep does not.
168
+
169
+ ### 2.4 `EntityNode` is not syntactic sugar
170
+
171
+ Its own docstring says "syntactic sugar on top of `TransformAttachment` and `ParentEntity`". It is not, on three
172
+ counts:
173
+
174
+ 1. **It owns a third copy of the local transform.** `EntityNode.__transform` is the local transform; the component's
175
+ `attachment.transform` is *also* the local transform. They are synced one-way, node → component, by
176
+ `__transform_sync_down` on change. Write the component directly and the node is stale, with no way to notice.
177
+ 2. **It is required at runtime, not just at authoring time.** `bind_property_writer` binds animation curves to
178
+ `node.transform.position` / `.rotation` / `.scale` — the *node's* transform, not the component's. Every animated
179
+ model therefore has to retain its `EntityNode` tree for as long as it animates. The object graph an ECS hierarchy
180
+ is supposed to replace is still there, alive, next to the dataset.
181
+ 3. **It carries behaviour the components do not have** — `build`/`destroy` ordering, `on.built`/`on.destroyed`,
182
+ listener attach/detach, `root`, `traverse`. None of that is reachable from an entity id. Anything holding only an
183
+ entity id cannot participate.
184
+
185
+ So there are two ways to express a hierarchy in meep, and they are not interchangeable: components are the storage,
186
+ `EntityNode` is the API, and the API is only available to whoever constructed the tree.
187
+
188
+ ---
189
+
190
+ ## 3. What Scene Graph does
191
+
192
+ From Epic's UEFN documentation (see §8 for links):
193
+
194
+ **Entities are containers; components supply data and behaviour.** One component instance per type per entity — need
195
+ two, make two entities. Components are constructed with a pointer to their owning entity and **cannot be moved between
196
+ parents**.
197
+
198
+ **One hierarchy, and it means lifetime.** "Parenting represents object lifetime: if the parent is removed from the
199
+ scene, so are the sub-objects." One simulation entity is the root; every map entity is a descendant of it.
200
+
201
+ **Children are stored and enumerable.** `GetEntities()` returns the direct children; `GetParent()` walks up;
202
+ `AddEntities(...)` adds children **and reparents them if they already have a parent**; `RemoveFromParent()` detaches,
203
+ and the entity can be re-added later.
204
+
205
+ **Space is layered on top, by exception.** `transform_component` holds `LocalTransform` plus an optional `Origin`. If
206
+ `Origin` is unset, the entity composes against its parent. If set, it composes against whatever entity `Origin` names
207
+ — "a child can orbit around a sibling rather than its parent". API is `Get/SetLocalTransform`, `Get/SetGlobalTransform`
208
+ (both of which implicitly create the component), and `SetOrigin` / `GetOrigin[]` / `ResetOrigin`.
209
+
210
+ **Lifecycle is a phase machine, not a boolean.** Components get `OnAddedToScene` → `OnBeginSimulation` →
211
+ `OnSimulate` (suspending/async) → `OnEndSimulation` → `OnRemovingFromScene`. Adding a child to an in-scene parent
212
+ "advances the child through lifetime phases to match parent state". Component queries only become valid after
213
+ `OnAddedToScene`.
214
+
215
+ **The hierarchy is an event bus.** `SendUp(event)` / `SendDown(event)`, with consumption halting propagation.
216
+
217
+ **Entities carry tags** — `AddTag`, `ContainsAnyTag`, `RemoveAllTagsExcept`, etc.
218
+
219
+ **Access is scoped.** `GetEntities()` and `GetComponents()` return what is "accessible from the calling context" —
220
+ visibility is part of the model, not just a convention.
221
+
222
+ **Their own performance guidance** is: don't re-scan the tree during gameplay; find what you need once in
223
+ `OnBeginSimulation`, cache the references or subscribe to events, and react to events rather than searching again.
224
+ Don't broadcast events across large portions of the graph.
225
+
226
+ ---
227
+
228
+ ## 4. Head-to-head
229
+
230
+ | | meep | Scene Graph |
231
+ |---|---|---|
232
+ | Lifetime relation | `ParentEntity.entity` | the hierarchy itself |
233
+ | Spatial relation | `TransformAttachment.parent` — **independent** | `transform_component.Origin`, defaulting to the parent |
234
+ | Local transform | `TransformAttachment.transform` (+ a shadow copy on `EntityNode`) | `transform_component.LocalTransform` |
235
+ | World transform | stored, as a decomposed `Transform` component | queried via `GetGlobalTransform()` |
236
+ | Children stored? | Yes — a system-owned index, not a component (§4.2) | Yes — `GetEntities()` |
237
+ | Reparenting | **Broken / unsupported** (§5 D1, D2) | `AddEntities` reparents as a normal operation |
238
+ | Lifecycle | `isBuilt` boolean; `link`/`unlink` on systems | five explicit phases, propagated to children |
239
+ | Events on the tree | none | `SendUp` / `SendDown` with consumption |
240
+ | Tags | none (`Name` only) | first-class |
241
+ | Cycle safety | detected on read, throws | not documented |
242
+ | Serialization | asymmetric — spatial survives, lifetime does not (§5 D6) | prefab-based |
243
+ | Shear under non-uniform scale | lost silently | lost (documented) |
244
+
245
+ ### 4.1 The relation split — meep wins, and should not follow Unreal here
246
+
247
+ Worth stating explicitly because it is tempting to read Unreal's design as the newer one and therefore the better one.
248
+ It is not, on this axis. `Origin`-defaults-to-parent is a **"unset means auto" sentinel**: one field with two meanings,
249
+ where the common case is invisible and the uncommon case is an override. meep's two independent fields say the same
250
+ thing with uniform control flow — the common case (`TransformAttachment.parent === ParentEntity.entity`) is written
251
+ out rather than implied.
252
+
253
+ This also happens to be the shape the codebase already prefers. Adopting `Origin` would be adopting a sentinel.
254
+
255
+ The cost meep pays is that **the coupling is real but undocumented**: `TransformAttachment` alone is not safe when the
256
+ parent can die (§5 D3). `ParentEntity` is what makes it safe. Nothing says so, and `transform_attachment_parent_of`'s
257
+ docstring — which is otherwise the best documentation in this area — describes the spatial hierarchy as if it stood
258
+ alone.
259
+
260
+ ### 4.2 Children were not stored — the biggest structural gap, now closed
261
+
262
+ **Was:** `ParentEntitySystem.findChildrenOf` scanned **every** `ParentEntity` component in the dataset to find one
263
+ entity's children, and `traverse` called it once per node. So computing a subtree bounding box (which
264
+ `sg_hierarchy_compute_bounding_box_via_parent_entity` does exactly this way) was **O(subtree × all-parented-entities)**.
265
+
266
+ Scene Graph stores children and Epic's own guidance is *still* "don't scan the tree during gameplay, cache in
267
+ `OnBeginSimulation`". meep was scanning a structure that was a full dataset sweep rather than a stored list.
268
+
269
+ **Now:** both systems own a parent → children index (`ecs/hierarchy/EntityChildIndex.js`), so `findChildrenOf` is a
270
+ lookup and `traverse` is linear in the subtree. The shape and the reasoning are below; what actually landed is in §6.1.
271
+
272
+ Two things this did **not** change, deliberately:
273
+
274
+ - `transform_attachment_find_descendant_by_name` still scans every `Name` and walks up from each candidate — that is
275
+ the bone-lookup path, and it searches by *name* first, which no parent → children index answers. Rewriting it as a
276
+ downward walk over the spatial index is now possible and is the obvious follow-up, but it is a different search.
277
+ - The editor's `HierarchicalEntityListView` still builds its own `Map<parent, children[]>`. It looked like the missing
278
+ index implemented privately, and it is not quite: the view excludes editor-owned entities from the tree entirely, so
279
+ its map is a *filtered* one, and it needs a full entity sweep regardless to find the roots — entities with no
280
+ `ParentEntity` at all, which no children index knows about. Swapping in the real index would mean filtering on every
281
+ read and taking a dependency on a running system, for no sweep saved. Left alone.
282
+
283
+ #### Where the index belongs — *not* in a component
284
+
285
+ The obvious move, and the one most engines make, is a `ChildEntities` component. meep had one already
286
+ (`parent/ChildEntities.js`, dead). **That was the wrong shape, and it was deleted rather than revived.**
287
+
288
+ A child list stored as a component is *derived data promoted to authored data*. The consequences are all bad and all
289
+ structural:
290
+
291
+ - **It is a two-place invariant.** `ParentEntity` lives on the child and `ChildEntities` lives on the parent — two
292
+ entities, two components, one fact. Nothing in the type system or the dataset keeps them agreeing. They can drift,
293
+ and the drift is silent.
294
+ - **It is user-writable.** Being a component makes it authorable, mutable, and reachable from any system. Every one of
295
+ those is an opportunity to corrupt an index that has one correct value.
296
+ - **It is a burden at the layer least able to carry it.** Whoever builds a hierarchy now has to maintain both ends of
297
+ every edge, for information the engine can derive.
298
+ - **It doubles the state footprint** of every parent, and it has to be excluded from serialization by hand — one more
299
+ thing to get wrong alongside D6.
300
+
301
+ The alternative, and what was built, is to hold the back-links **at the system level**: `ParentEntitySystem` already
302
+ observes every entity that gains or loses a `ParentEntity`, so it maintains a private parent → children index with no
303
+ component, no authored state, and nothing for a user to desynchronise. One writer, one source of truth, rebuilt from
304
+ scratch on load.
305
+
306
+ The usual objection is ergonomics — a consumer now has to reach for the system instead of just calling `getComponent`.
307
+ That objection does not survive contact with the actual call pattern: **`ChildEntities` would not have avoided it.** A
308
+ component gives you one level of children as entity ids; to go a level deeper you need `getComponent(child,
309
+ ChildEntities)`, so you are already reaching for the dataset. Component and system are equally indirect, and the system
310
+ version is the one that cannot be wrong. `EntityManager.getSystem(SystemClass)` is typed on the class, so this stays
311
+ inside the codebase's preference for typed lookup over string-keyed registries.
312
+
313
+ The migration cost was also much smaller than it looked — see §6.1.
314
+
315
+ ### 4.3 Reparenting
316
+
317
+ Scene Graph: `AddEntities` reparents, and advances the child through lifecycle phases to match the new parent.
318
+
319
+ meep: **neither path works.** Direct `.parent =` assignment strips the spatial link (D1, reproduced). `addChild` of an
320
+ already-built node throws (D2, reproduced). There is no supported way to move a live subtree.
321
+
322
+ This is the single largest functional gap, and it is not exotic — "pick this up", "get in the vehicle", "re-dock this
323
+ panel" are all reparenting a live subtree.
324
+
325
+ ### 4.4 Lifecycle phases
326
+
327
+ meep has one bit (`isBuilt`) plus system `link`/`unlink`. The consequence is `TransformAttachmentSystem`'s retry
328
+ queue: a child whose parent has not appeared yet cannot be linked, so it is parked and retried at 32 entries per
329
+ frame, forever, with no diagnostic if the parent never arrives. `AttachmentSystem` has its own separate `waiting`
330
+ array doing the same thing.
331
+
332
+ That queue is *compensating for the absence of ordering guarantees*. Scene Graph's answer is that a child added to an
333
+ in-scene parent is advanced to match the parent's phase — the "parent isn't ready yet" state is structurally
334
+ impossible rather than polled for.
335
+
336
+ Not a defect. But two hand-rolled retry queues is what the missing phase model costs.
337
+
338
+ ### 4.5 Events, tags, scoping
339
+
340
+ meep has none of `SendUp`/`SendDown`, tags, or context-scoped access. Of the three:
341
+
342
+ - **`SendUp`/`SendDown` is worth having** and is cheap once children are stored. The idiom it enables — a hit on a
343
+ limb bubbling to the creature, a "prefab" root broadcasting down — is currently done by walking to
344
+ `ParentEntitySystem.findRoot` and dispatching manually.
345
+ - **Tags** duplicate what a component already does in meep. Skip; a zero-field component is the same thing and stays
346
+ typed, which is what this codebase prefers over string keys.
347
+ - **Scoped access** is a Verse-language concern. Not applicable.
348
+
349
+ ---
350
+
351
+ ## 5. Defects
352
+
353
+ Ordered by severity. **[repro]** = I reproduced it against the real systems. **[read]** = from reading only.
354
+ Entries marked **FIXED** were closed on 2026-08-24 by the work in §6.1 and §6.3; the original finding is kept so the
355
+ reasoning stays readable, with what changed appended.
356
+
357
+ ---
358
+
359
+ **D1 — `EntityNode.parent` setter destroys the spatial link. [repro]** — *correctness, high*
360
+
361
+ `EntityNode.js:240-270`. The setter removes both components up front:
362
+
363
+ ```js
364
+ let parent_entity = this_entity.removeComponent(ParentEntity);
365
+ let attachment = this_entity.removeComponent(TransformAttachment); // returns the instance
366
+
367
+ if (node !== null) {
368
+ ...
369
+ this_entity.add(parent_entity); // ParentEntity IS re-added
370
+
371
+ if (attachment === null) { // ...but it is NOT null,
372
+ attachment = this.__safe_get_attachment(); // so this never runs
373
+ }
374
+ attachment.parent = parent_entity_id; // mutates a DETACHED component
375
+ }
376
+ ```
377
+
378
+ `Entity.removeComponent` returns the removed instance (`Entity.js:286`), so the `=== null` branch is dead whenever the
379
+ node was already parented. The re-add only happens through `__safe_get_attachment()`, which is skipped.
380
+
381
+ Reproduced — build `a → b`, then assign `b.parent = c` directly:
382
+
383
+ ```
384
+ after build, b has TransformAttachment: true
385
+ after reparent, b TransformAttachment: null
386
+ after reparent, b ParentEntity: 2 (c.id: 2) ← lifetime link correct
387
+ dataset has TransformAttachment on b: undefined ← spatial link gone
388
+ ```
389
+
390
+ The child keeps its new owner and silently stops following it in space; its world `Transform` freezes at its last
391
+ value. `addChild()` happens to escape this because `removeChild()` runs first and clears the component via the
392
+ `node === null` path — so the bug is confined to the public setter, which is the documented way to reparent.
393
+
394
+ Fix is one line: drop the `if (attachment === null)` guard and always call `__safe_get_attachment()`.
395
+
396
+ ---
397
+
398
+ **D2 — live reparenting asserts in dev, silently no-ops in prod. [repro]** — *correctness, high*
399
+
400
+ `EntityNode.addChild` calls `node.build(dataset)` when the receiving parent is built; `build` opens with
401
+ `assert.notOk(this.__entity.isBuilt, 'Already built')`. Reproduced: `addChild` of a built node into a built parent
402
+ throws `"Already built"`.
403
+
404
+ Asserts are compiled out of production builds. In production the assert vanishes and `Entity.build` early-returns
405
+ (`Entity.js:442-449`), so it degrades to a partial no-op rather than corruption — but combined with D1 the node can
406
+ end up owned-but-not-attached with no error anywhere. **Dev throws, prod silently misbehaves**, which is the worse of
407
+ the two orderings.
408
+
409
+ ---
410
+
411
+ **D3 — a child was not detached when its spatial parent died. [read]** — *correctness, high* — **FIXED 2026-08-24.**
412
+
413
+ `UpdateContext` captured `parent_transform` at link time and subscribed to it. Nothing observed the *parent's*
414
+ removal. When the parent entity was destroyed:
415
+
416
+ - the child still had `TransformAttachment` + `Transform`, so the system's `unlink` was never called;
417
+ - `this.__contexts[entity]` kept holding the context, which kept holding the dead parent's `Transform` alive;
418
+ - the child composed against a transform nothing would ever update again — it froze, silently.
419
+
420
+ `ParentEntity` masked this whenever both components named the same entity, because the child got destroyed too. It was
421
+ exposed exactly when the two are used independently — i.e. the capability §4.1 credits as meep's advantage.
422
+
423
+ **The fix**, mirroring what `ParentEntitySystem`'s `Context` already did: `UpdateContext` subscribes to its parent's
424
+ `EntityRemoved` in `link()` and unsubscribes in `unlink()`, and on removal it takes `TransformAttachment` off the
425
+ child. The child survives with the world transform it had, as a root, and its own subtree keeps composing against it.
426
+ Dropping the component rather than quietly tearing the context down is what makes the detach observable, and it routes
427
+ the teardown through the system's ordinary `unlink` path.
428
+
429
+ Two details worth keeping:
430
+
431
+ - **It is registered per child, not per parent, so the §6.1 index is not what makes it work.** The index would have
432
+ needed a separate count of *bound* children to know when to add and drop a single per-parent listener — queued
433
+ children are in the index but must not register — which is more state than one listener per context. The index is
434
+ still what makes "which children point at me" answerable; this particular fix just did not need to ask.
435
+ - **A stale dispatch is real and is guarded.** Entity event dispatch copies its listener list before invoking it, so
436
+ when an entity carries *both* relations and the lifetime one destroys it first, the spatial detach still arrives —
437
+ for an entity that no longer exists. `UpdateContext` tracks whether it is linked and ignores the late call. This is
438
+ ordering-dependent (whichever system linked first is called first) and is covered both ways round in the spec.
439
+
440
+ **Still not covered:** a child that is still *queued* when its parent dies. It never bound, so it never subscribed, and
441
+ it goes on retrying against an id that may be recycled. That is the pre-existing gap §4.4 describes — the retry queue
442
+ has no diagnostic for a parent that never arrives, and now also none for one that leaves.
443
+
444
+ ---
445
+
446
+ **D4 — mutating `TransformAttachment.parent` is silently ignored. [read]** — *correctness, medium* — **ADDRESSED
447
+ 2026-08-24**, documented on the field to match `ParentEntity`'s existing constraint.
448
+
449
+ `UpdateContext.update()` reads `this.parent_transform`, resolved once at link. Writing `attachment.parent = other`
450
+ afterwards changes nothing; the entity keeps composing against the old parent. `ParentEntity` documents this
451
+ constraint ("Must not be mutated while the component is attached to a dataset"); `TransformAttachment` did not, and
452
+ its field is plain and public.
453
+
454
+ Worth noting that this contract is **load-bearing for §6.1, not just hygiene.** A system-owned child index is correct
455
+ precisely because `link`/`unlink` are the only transitions a parent reference can undergo. If either component's
456
+ `parent` field could be rewritten in place, the index would need change detection to stay honest, and the argument for
457
+ keeping it out of a component would weaken. Documenting the immutability is what makes the cheap index sound.
458
+
459
+ ---
460
+
461
+ **D5 — `ChildEntities` was dead code, and the wrong shape. [repro — zero references]** — *hygiene, medium* —
462
+ **FIXED 2026-08-24.**
463
+
464
+ Defined in `parent/ChildEntities.js`, referenced nowhere outside its own file.
465
+
466
+ **Deleted.** Per §4.2 it was not a stub to finish — a component is the wrong home for a derived back-link, and leaving
467
+ the file present implied both that a child index existed and that a component was where one should go. Neither was
468
+ true. The index belongs to `ParentEntitySystem` (§6.1), and now lives there.
469
+
470
+ ---
471
+
472
+ **D6 — serialization is asymmetric between the two hierarchies. [read]** — *correctness, medium*
473
+
474
+ `ParentEntity.serializable = false`, commented "Entity IDs are transient, serialization is not applicable".
475
+ `TransformAttachment` sets no such flag, and `isComponentClassSerializable` defaults to serializable
476
+ (`BinaryBufferSerializer.js:15`) — so its `parent` field, **also a raw entity id**, is written and read back.
477
+
478
+ Entity ids do survive a round-trip (`BinaryBufferDeSerializer` calls `createEntitySpecific`), so this is not
479
+ straightforwardly broken. But the two components make opposite decisions about the same kind of data, and the result
480
+ is that a saved scene reloads with its **spatial** hierarchy intact and its **lifetime** hierarchy gone. Given D3,
481
+ that reload also lands in exactly the configuration where an attachment is unsafe.
482
+
483
+ Whichever way it is resolved, the two should agree.
484
+
485
+ §6.1 sharpened this rather than changing it: the child index is rebuilt from the child-side components on load, so a
486
+ scene that reloads without its `ParentEntity` components reloads with an empty lifetime index too. The index does not
487
+ cause the omission, it just stops it being invisible.
488
+
489
+ ---
490
+
491
+ **D7 — subtree operations were O(subtree × world). [read]** — *performance, medium* — **FIXED 2026-08-24.**
492
+
493
+ `ParentEntitySystem.findChildrenOf` swept every `ParentEntity` in the dataset per node; `traverse` called it per node.
494
+ `sg_hierarchy_compute_bounding_box_via_parent_entity` and `transform_attachment_find_descendant_by_name` (the bone
495
+ lookup) both paid it.
496
+
497
+ The index in §6.1 fixed the first: `findChildrenOf` is a lookup and `traverse` is linear in the subtree. The bone
498
+ lookup is untouched — it searches by name, which this index does not answer (§4.2).
499
+
500
+ Also in `traverse`: `path.concat(entity)` allocated a new array per node per level, making cycle detection O(depth²) in
501
+ allocations for a deep tree. The rewritten walk pushes and pops one shared path array instead, and cycle detection is
502
+ now O(depth) comparisons per node against no allocation at all.
503
+
504
+ ---
505
+
506
+ **D8 — the cycle checker was a shared fixed buffer. [read]** — *correctness, low* — **FIXED 2026-08-24.**
507
+
508
+ `ParentEntitySystem` used a module-level `Uint32Array(1024)` for `findRoot` and `isAncestorOf`, with no bounds check
509
+ on `loop_checker_array[count++]`. Two consequences: writes past 1024 were silently dropped by JS typed arrays, so a
510
+ hierarchy deeper than 1024 stopped detecting cycles and could spin forever; and because the buffer was shared and
511
+ un-reentrant, a `findRoot` called from inside a `traverse` callback clobbered the outer walk's state.
512
+
513
+ Depth > 1024 is not realistic. Re-entrancy was — `traverse` takes a user callback.
514
+
515
+ Both walks now keep their own path array, which is per call and grows, so neither failure mode exists. It fell out of
516
+ moving these two off the static-plus-`ecd` shape onto the system; the module global, `check_loop` and `genLoopString`
517
+ went with it. A 2048-deep chain is in the spec.
518
+
519
+ ---
520
+
521
+ **D9 — transform sockets update twice per frame. [read]** — *performance, low*
522
+
523
+ `TransformAttachmentBinding.link()` subscribes to the parent's and the attachment's transform changes, *and*
524
+ `AttachmentSystem.__updateAll()` calls `binding.update()` for every binding every frame unconditionally. Either the
525
+ subscription or the sweep is redundant. (`BoneAttachmentBinding` genuinely needs the per-frame sweep — its pose is a
526
+ query with no change signal — so the sweep is the one to keep, and the `TransformAttachmentBinding` subscriptions are
527
+ the removable half.)
528
+
529
+ ---
530
+
531
+ **D10 — decompose round-trip drifts and drops shear. [repro]** — *correctness, low-to-medium*
532
+
533
+ Numbers in §2.3. Scale drifts to ~1.4e-6 over 64 rotation-only levels and fires spurious `scale.onChanged` at every
534
+ level; shear from a non-uniformly-scaled rotated parent is silently best-fitted away.
535
+
536
+ Not cheaply fixable — it is inherent to storing the world transform as a decomposed `Transform` — and Unreal has the
537
+ same limitation.
538
+
539
+ The documentation half is **done**: `TransformAttachment` now carries the non-uniform-scale caveat and the drift
540
+ figure. The behaviour is unchanged and the defect stays open on that basis. Still worth considering: whether
541
+ `UpdateContext.update()` should compose into the child's `matrix` and skip the decompose for consumers that only read
542
+ the matrix.
543
+
544
+ ---
545
+
546
+ **D11 — neither system had a spec. [repro — no such files]** — *test coverage, medium* — **FIXED 2026-08-24.**
547
+
548
+ There was no `TransformAttachmentSystem.spec.js` and no `ParentEntitySystem.spec.js`. `TransformAttachment.spec.js` and
549
+ `EntityNode.spec.js` between them test `setFlag`/`clearFlag`/`getFlag`/`writeFlag` — twice, once each, in identical
550
+ form — plus JSON round-trip and `addChild`/`removeChild` bookkeeping on *unbuilt* nodes.
551
+
552
+ **The composition contract itself was untested.** Nothing asserted that a child's world transform equals parent ×
553
+ local, that a change propagates, that a chain composes, or that a queued attachment links when its parent arrives.
554
+ Nine other specs register both systems, but as fixture scaffolding — `MeshSystem.spec.js` registers them so a model
555
+ can expand, not to check them.
556
+
557
+ Both specs now exist, on real `EntityManager`/`EntityComponentDataset` objects, and cover the composition contract,
558
+ the index (empty/one/many, ordering, child removal, parent removal, id recycling, snapshot semantics), the queue path,
559
+ subtree traversal against the full-scan implementation it replaced, cycles, and the D3 detach in both dispatch orders.
560
+ `EntityChildIndex` has its own spec for what the systems cannot reach through their own API. The flag tests remain the
561
+ vacuous-smoke-test shape and were left alone; they are not what this defect was about.
562
+
563
+ Note that D1 and D2 are both immediately visible from a five-line test, which is why they are still here.
564
+
565
+ ---
566
+
567
+ ## 6. What is worth taking from Scene Graph
568
+
569
+ In order of value per unit of change. Note that the first item takes Scene Graph's *capability* while explicitly
570
+ rejecting its *storage* — the useful comparison here is not "copy what Unreal did".
571
+
572
+ ### 6.1 Store children — as a system-owned index, not a component — **LANDED 2026-08-24**
573
+
574
+ Take Scene Graph's *capability* (children are enumerable in O(children)) and reject its *storage*, because meep's
575
+ system layer can derive the same thing without asking the user to maintain anything. Reasoning in §4.2; this is what
576
+ was built.
577
+
578
+ `ecs/hierarchy/EntityChildIndex.js` holds the structure — a sparse array of parent id → ascending child ids — and both
579
+ systems own one, as `__children`. It has its own spec for the ordering and copy-out contracts.
580
+
581
+ **The choke points already existed and were already overridden.** `ParentEntitySystem` extends `AbstractContextSystem`,
582
+ whose `link()`/`unlink()` fire exactly once per entity gaining or losing a `ParentEntity`. `ParentEntitySystem`'s own
583
+ `Context` already overrode both, and already read `this.components[0].entity` to subscribe to the parent's removal.
584
+ Maintaining the index is one insert in `Context.link()` and one remove in `Context.unlink()`, beside code that was
585
+ already there for exactly the same edge.
586
+
587
+ Design notes that mattered, and how each was settled:
588
+
589
+ - **Store entity ids, never contexts.** `AbstractContextSystem` pools its contexts through `ObjectPoolFactory` and
590
+ reuses them after `unlink`. An index holding context references would alias recycled objects. The index stores ids.
591
+ - **Define child order explicitly.** Insertion order is link order, which is deterministic only as far as entity
592
+ creation order is. **Sorted ascending by entity id on insert**, via a binary-search insert — chosen over documenting
593
+ link order because it makes iteration order independent of the thing that is hard to reason about, and child fan-out
594
+ is small enough that the splice is not worth defending against.
595
+ - **Hand out a snapshot, not the live array.** `handleParentEntityRemoval` destroys children from inside the cascade,
596
+ so a consumer iterating a live array mutates under itself. `findChildrenOf` kept its `(result, result_offset, ...)
597
+ -> count` shape — the `ecd` argument dropped, since the system knows its own dataset — which preserves the house
598
+ convention from the bvh3 query API. `countChildrenOf` was added beside it, to size a buffer without filling one.
599
+ - **The index does not serialize, and that is the point.** It is rebuilt from `ParentEntity` on load, so there is no
600
+ format, no version, and no stale-id migration. **This does sharpen D6:** `ParentEntity.serializable === false` means
601
+ a loaded scene has no `ParentEntity` components to rebuild *from*, so the lifetime hierarchy comes back empty. The
602
+ index makes that omission visible rather than causing it.
603
+ - **Entity ids are recycled**, so a parent whose last child leaves has its entry deleted outright rather than left
604
+ empty. An id that comes back has to come back childless; both specs pin it.
605
+
606
+ **Static-with-`ecd` versus instance.** `traverse` and `findChildrenOf` need the index, so they had to move onto the
607
+ system. `findRoot`, `isAncestorOf` and `findParentEntity` walk child → parent and did not, but leaving them static
608
+ would have meant two ways to ask the same system the same kind of question. All five are instance methods now and the
609
+ `ecd` parameter is gone from all of them. Per library semantics the unreferenced ones were carried across rather than
610
+ deleted.
611
+
612
+ **Migration cost, measured before and confirmed after:** `ParentEntitySystem.traverse` had **exactly one caller** in
613
+ the whole tree (`sg_hierarchy_compute_bounding_box_via_parent_entity.js:30`), which now takes the system in place of
614
+ the `ecd`. `findChildrenOf`, `findRoot` and `isAncestorOf` had **zero** external callers. So the "you have to reach
615
+ for the system" awkwardness cost one production signature change, plus standing up an `EntityManager` in
616
+ `sg_hierarchy_compute_bounding_box_via_parent_entity.spec.js`, which had been running on a bare ECD.
617
+
618
+ Payoff: killed D7 and D8, made D3 small enough to fix in the same pass (§6.3), and unblocks `SendUp`/`SendDown`. It did
619
+ **not** let `HierarchicalEntityListView` drop its private `Map<parent, children[]>` — see §4.2 for why that map is not
620
+ this index.
621
+
622
+ **The same index shape applies to the spatial hierarchy**, and landed there too. `TransformAttachmentSystem` already
623
+ keyed `__contexts` by child; the parent → children direction goes in at `link()` and out at `unlink()`. Inserting at
624
+ `link()` rather than `__finalize_link()` means **a queued child is in the index before it binds** — the question the
625
+ index answers is "which children point at me", and that is true of a child still waiting for its parent to gain a
626
+ `Transform`. The consequence, documented on the system: a non-zero child count does not imply those children are
627
+ composing yet.
628
+
629
+ ### 6.2 Make reparenting a real, single operation
630
+
631
+ **Not done — still the largest open item.** One function — `hierarchy_reparent(ecd, entity, new_parent)` — that
632
+ updates both components together and is the only supported path. Fix D1 inside it and let `EntityNode.parent` delegate
633
+ to it. This is Scene Graph's `AddEntities` semantics, minus the phase machine. D4's documented immutability means
634
+ reparenting is a remove/re-add of the components, not a field write — which is the contract this function should
635
+ encode rather than leave to callers, and which §6.1 turned from a convention into something the child indices depend
636
+ on.
637
+
638
+ ### 6.3 Detach on parent death — **LANDED 2026-08-24**
639
+
640
+ `TransformAttachmentSystem` now listens for `EntityRemoved` on the parent (as `ParentEntitySystem`'s `Context` already
641
+ did) and drops the child's `TransformAttachment`. This fixes D3, and makes the independent use of the two relations
642
+ actually safe.
643
+
644
+ One prediction here did not hold up. The expectation was that the 6.1 index would turn "which children do I unlink"
645
+ into a lookup; in practice the listener is registered **per child context**, exactly as `ParentEntitySystem` does it,
646
+ because a single per-parent listener would have needed its own count of *bound* children to know when to register and
647
+ unregister — the index deliberately includes queued children, which must not register one. Per-child is less state
648
+ and mirrors the sibling system. The index is still what makes the direction answerable at all; this fix just did not
649
+ need to ask. Details, including the stale-dispatch guard, are in D3.
650
+
651
+ ### 6.4 `SendUp` / `SendDown`
652
+
653
+ Now cheap — 6.1 exists, so `SendDown` is a traversal that already terminates and `SendUp` is
654
+ `ParentEntitySystem.findRoot`'s walk with a visitor. Replaces the manual `findRoot`-and-dispatch idiom. Not built;
655
+ nothing in the tree asks for it yet.
656
+
657
+ ### 6.5 Document the couplings — **DONE 2026-08-24**
658
+
659
+ `TransformAttachment` needed what `ParentEntity` already had. All three halves are now on the component: the
660
+ `parent`-immutability note (D4), the non-uniform-scale and drift caveat (D10), and the statement that without a
661
+ lifetime relation an attachment does not survive its parent — which, since D3, means the component is removed and the
662
+ entity becomes a world-space root rather than freezing.
663
+
664
+ Both `parent` fields also now say *why* they must not be mutated in place: each system resolves the parent once at
665
+ link and indexes the edge at the same moment, so an in-place write desynchronises both.
666
+
667
+ ## 7. What is not worth taking
668
+
669
+ - **`Origin`-defaults-to-parent.** §4.1 — meep's two-field split is better and matches the codebase's stated
670
+ preference for uniform control flow over sentinels.
671
+ - **A child list as stored, authored state.** §4.2 — take the enumerability, not the component. Scene Graph can afford
672
+ a stored child list because its hierarchy *is* the entity and there is only one writer; in an ECS the same list
673
+ becomes a second, user-writable copy of an edge that already exists on the child, with no mechanism keeping the two
674
+ ends honest. Derive it in the system instead. This is the one place where the conventional engine answer and
675
+ `ChildEntities` agree with each other and are both wrong.
676
+ - **Tags.** A zero-field component already is a tag, and stays typed.
677
+ - **The five-phase lifecycle, wholesale.** The valuable half is the ordering guarantee that removes the retry queues;
678
+ adopting five named phases across every system is a much larger change than the problem warrants. If anything here
679
+ is worth doing it is the *guarantee*, not the vocabulary.
680
+ - **Scoped access.** A Verse language feature with no analogue here.
681
+
682
+ ## 8. The one thing this review would change first
683
+
684
+ Not any single defect — **`EntityNode`'s status.**
685
+
686
+ It is documented as sugar and treated as sugar, but it holds the local transform that animation writes to, so it is
687
+ load-bearing runtime state. Every gap in this document traces back to that: reparenting is broken because the fix
688
+ belongs on the components but the API lives on the node; the transform has two homes because the node keeps its own;
689
+ subtree queries scanned because the node had `children` and nothing at the dataset level did.
690
+
691
+ That last clause is no longer true, which sharpens the question rather than answering it: since §6.1 there **is** a
692
+ child enumeration below the node, owned by the systems. `EntityNode.children` is now a second answer to a question the
693
+ dataset can already answer — a list of nodes, only available to whoever built the tree, next to a list of entity ids
694
+ available to anything holding an entity id.
695
+
696
+ Decide which one is the hierarchy. If it is the components, `EntityNode` must become genuinely stateless — its
697
+ `transform` accessor forwarding to `attachment.transform`, its `children` reading through `ParentEntitySystem` — and
698
+ animation binds to components. If it is `EntityNode`, then say so, and stop describing it as sugar.
699
+
700
+ Scene Graph made this choice: the entity is the hierarchy, `transform_component.LocalTransform` is the one local
701
+ transform, and there is no second object graph. That is the part of the design worth copying — not the API surface.
702
+
703
+ ---
704
+
705
+ ## Sources
706
+
707
+ Unreal / Scene Graph — Epic documentation and reporting:
708
+
709
+ - [Getting Started in Scene Graph in Fortnite](https://dev.epicgames.com/documentation/fortnite/getting-started-in-scene-graph-in-fortnite)
710
+ - [entity class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/entity)
711
+ - [component class — Verse API reference](https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/scenegraph/component)
712
+ - [Transforms in Scene Graph](https://dev.epicgames.com/documentation/en-us/fortnite/transforms-in-scene-graph-in-unreal-editor-for-fortnite)
713
+ - [Scene Graph Best Practices](https://dev.epicgames.com/documentation/fortnite/scene-graph-best-practices-in-fortnite?lang=en-US)
714
+ - [Scene Graph is Now Available as an Experimental Feature in UEFN](https://www.fortnite.com/news/scene-graph-is-now-available-as-an-experimental-feature-in-uefn)
715
+ - [Unreal Engine 6 Will Combine UEFN and UE Into a "Unified Engine"](https://80.lv/articles/upd-unreal-engine-6-will-combine-uefn-and-ue-into-a-unified-engine)
716
+ - [10 things CG artists need to know about Unreal Engine 6](https://www.cgchannel.com/2026/06/10-things-cg-artists-need-to-know-about-unreal-engine-6/)
717
+ - [Mass Framework overview](https://vrealmatic.com/unreal-engine/mass) — for the Scene Graph ≠ Mass distinction