@woosh/meep-engine 2.165.0 → 2.165.1

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 (200) hide show
  1. package/README.md +137 -108
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/package.json +1 -1
  4. package/samples/generation/SampleGenerator0.js +3 -3
  5. package/samples/generation/filters/SampleGroundMoistureFilter.js +63 -56
  6. package/samples/generation/filters/SampleNoise20_0.js +6 -1
  7. package/samples/generation/themes/SampleTheme0.js +47 -47
  8. package/src/core/color/YCoCg/rgb_to_ycocg.d.ts +17 -0
  9. package/src/core/color/YCoCg/rgb_to_ycocg.d.ts.map +1 -0
  10. package/src/core/color/YCoCg/rgb_to_ycocg.js +20 -0
  11. package/src/core/color/YCoCg/ycocg_to_rgb.d.ts +14 -0
  12. package/src/core/color/YCoCg/ycocg_to_rgb.d.ts.map +1 -0
  13. package/src/core/color/YCoCg/ycocg_to_rgb.js +17 -0
  14. package/src/engine/REVIEW_2026_07_03.md +211 -0
  15. package/src/engine/animation/curve/actionProcessorOperations/curveActions.d.ts.map +1 -1
  16. package/src/engine/animation/curve/actionProcessorOperations/curveActions.js +3 -2
  17. package/src/engine/animation/curve/compression/sample_animation_curve_to_float_array.js +1 -1
  18. package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts.map +1 -1
  19. package/src/engine/animation/keyed2/AnimationTrackPlayback.js +3 -1
  20. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.js +2 -2
  21. package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
  22. package/src/engine/asset/preloader/AssetPreloader.js +6 -0
  23. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
  24. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +5 -2
  25. package/src/engine/ecs/Entity.js +1 -1
  26. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  27. package/src/engine/ecs/EntityComponentDataset.js +1 -0
  28. package/src/engine/ecs/EntityManager.js +1 -1
  29. package/src/engine/ecs/EntityObserver.js +1 -1
  30. package/src/engine/ecs/animation/AnimationClip.js +1 -1
  31. package/src/engine/ecs/attachment/AttachmentSystem.js +2 -2
  32. package/src/engine/ecs/attachment/TransformAttachmentBinding.d.ts.map +1 -1
  33. package/src/engine/ecs/attachment/TransformAttachmentBinding.js +11 -0
  34. package/src/engine/ecs/fow/FogOfWar.js +2 -2
  35. package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.d.ts.map +1 -1
  36. package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js +8 -0
  37. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +1 -1
  38. package/src/engine/ecs/gui/position/ViewportPosition.d.ts +3 -1
  39. package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
  40. package/src/engine/ecs/gui/position/ViewportPosition.js +4 -1
  41. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts +10 -0
  42. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts.map +1 -1
  43. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +43 -0
  44. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts +93 -0
  45. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts.map +1 -0
  46. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.js +315 -0
  47. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts +48 -0
  48. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts.map +1 -0
  49. package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.js +331 -0
  50. package/src/engine/ecs/storage/binary/object-v2/DESIGN.md +199 -0
  51. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts +53 -0
  52. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts.map +1 -0
  53. package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.js +57 -0
  54. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts +53 -0
  55. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts.map +1 -0
  56. package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.js +56 -0
  57. package/src/engine/ecs/storage/binary/object-v2/README.md +110 -0
  58. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts +13 -0
  59. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts.map +1 -0
  60. package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.js +48 -0
  61. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts +29 -0
  62. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts.map +1 -0
  63. package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.js +44 -0
  64. package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts.map +1 -1
  65. package/src/engine/graphics/camera/makeScreenScissorFrustum.js +11 -10
  66. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.d.ts.map +1 -1
  67. package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +3 -1
  68. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts +1 -1
  69. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts.map +1 -1
  70. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.js +2 -2
  71. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.d.ts.map +1 -1
  72. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.js +2 -0
  73. package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
  74. package/src/engine/graphics/ecs/camera/Camera.js +4 -0
  75. package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.d.ts.map +1 -1
  76. package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +7 -2
  77. package/src/engine/graphics/ecs/camera/set_camera_aspect_ratio.js +1 -1
  78. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
  79. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -1
  80. package/src/engine/graphics/ecs/light/binding/LightBinding.js +2 -2
  81. package/src/engine/graphics/ecs/mesh/MeshSystem.js +1 -1
  82. package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +1 -1
  83. package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +1 -1
  84. package/src/engine/graphics/ecs/water/WaterSystem.d.ts +6 -0
  85. package/src/engine/graphics/ecs/water/WaterSystem.d.ts.map +1 -1
  86. package/src/engine/graphics/ecs/water/WaterSystem.js +12 -1
  87. package/src/engine/graphics/geometry/buffered/ensureGeometryBoundingSphere.js +1 -1
  88. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.d.ts.map +1 -1
  89. package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.js +0 -15
  90. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +10 -10
  91. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
  92. package/src/engine/graphics/material/SplatMaterial.js +1 -1
  93. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
  94. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +3 -2
  95. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +1 -1
  96. package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
  97. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +3 -2
  98. package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
  99. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts +1 -8
  100. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
  101. package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +2 -14
  102. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts +9 -0
  103. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts.map +1 -0
  104. package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.js +14 -0
  105. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -1
  106. package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +4 -1
  107. package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts +69 -0
  108. package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts.map +1 -0
  109. package/src/engine/graphics/sh3/lpg/LightProbeGrid.js +173 -0
  110. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts +24 -0
  111. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts.map +1 -0
  112. package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.js +88 -0
  113. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts +20 -0
  114. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts.map +1 -0
  115. package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.js +79 -0
  116. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts +11 -0
  117. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts.map +1 -0
  118. package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.js +84 -0
  119. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts +29 -0
  120. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts.map +1 -0
  121. package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.js +160 -0
  122. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts +23 -0
  123. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts.map +1 -0
  124. package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.js +228 -0
  125. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts +2 -0
  126. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts.map +1 -0
  127. package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.js +24 -0
  128. package/src/engine/graphics/sh3/lpg/material/common.d.ts +3 -0
  129. package/src/engine/graphics/sh3/lpg/material/common.d.ts.map +1 -0
  130. package/src/engine/graphics/sh3/lpg/material/common.js +73 -0
  131. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts +6 -0
  132. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
  133. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.js +42 -0
  134. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts +6 -0
  135. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
  136. package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.js +49 -0
  137. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
  138. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
  139. package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.js +12 -0
  140. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts +6 -0
  141. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
  142. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.js +30 -0
  143. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts +6 -0
  144. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
  145. package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.js +41 -0
  146. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts +3 -0
  147. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts.map +1 -0
  148. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.js +15 -0
  149. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts +3 -0
  150. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts.map +1 -0
  151. package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.js +9 -0
  152. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
  153. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
  154. package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.js +12 -0
  155. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts +20 -0
  156. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts.map +1 -0
  157. package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.js +59 -0
  158. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -1
  159. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +8 -0
  160. package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts +2 -0
  161. package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts.map +1 -0
  162. package/src/engine/graphics/sh3/prototypeLightProbeGrid.js +170 -0
  163. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +1 -1
  164. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +1 -1
  165. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +1 -1
  166. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +3 -3
  167. package/src/engine/graphics/util/build_max_height_pyramid.d.ts.map +1 -1
  168. package/src/engine/graphics/util/build_max_height_pyramid.js +5 -2
  169. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
  170. package/src/engine/input/ecs/components/InputBinding.d.ts +7 -1
  171. package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
  172. package/src/engine/input/ecs/components/InputBinding.js +8 -1
  173. package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
  174. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts +2 -1
  175. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts.map +1 -1
  176. package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.js +6 -2
  177. package/src/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
  178. package/src/engine/knowledge/database/StaticKnowledgeDatabase.d.ts.map +1 -1
  179. package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +2 -4
  180. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts +1 -2
  181. package/src/engine/logging/elastic/ElasticSearchLogger.d.ts.map +1 -1
  182. package/src/engine/logging/elastic/ElasticSearchLogger.js +14 -10
  183. package/src/engine/navigation/ecs/path_following/PathFollower.js +1 -1
  184. package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
  185. package/src/engine/navigation/grid/find_path_on_grid_astar.js +5 -2
  186. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +1 -1
  187. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  188. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +17 -0
  189. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  190. package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
  191. package/src/engine/scene/SceneManager.d.ts.map +1 -1
  192. package/src/engine/scene/SceneManager.js +4 -2
  193. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  194. package/src/engine/simulation/Ticker.js +9 -0
  195. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
  196. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +6 -1
  197. package/src/engine/sound/material/concrete/json/serializeSoundMaterialToJSON.js +1 -1
  198. package/src/generation/theme/ThemeEngine.d.ts +9 -0
  199. package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
  200. package/src/generation/theme/ThemeEngine.js +37 -2
@@ -0,0 +1,30 @@
1
+ import { insert_after } from "../../../../../../core/primitives/strings/insert_after.js";
2
+ import PREAMBLE from "./preamble.frag.js";
3
+
4
+ //language=GLSL
5
+ const ACCUMULATION = `
6
+ {
7
+
8
+ vec3 lpg_world_normal = normalize( inverseTransformDirection( geometry.normal, viewMatrix ) );
9
+
10
+ irradiance += lpg_get_irradiance_at( lpg_world_normal, lpg_values ) * lpg_f_intensity;
11
+
12
+ }
13
+ `;
14
+
15
+ /**
16
+ *
17
+ * @param {string} source
18
+ */
19
+ export function build_fragment_shader(source) {
20
+
21
+ let result = PREAMBLE + source;
22
+
23
+ result = insert_after(
24
+ result,
25
+ '#include <lights_fragment_begin>',
26
+ ACCUMULATION
27
+ );
28
+
29
+ return result;
30
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ *
3
+ * @param {string} source
4
+ */
5
+ export function build_vertex_shader(source: string): string;
6
+ //# sourceMappingURL=build_vertex_shader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_vertex_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.js"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,4CAFW,MAAM,UAahB"}
@@ -0,0 +1,41 @@
1
+ import { insert_after } from "../../../../../../core/primitives/strings/insert_after.js";
2
+ import PREAMBLE_COMMON from "../common.js";
3
+ import PREAMBLE from "./preamble.vert.js";
4
+
5
+ /*
6
+ World position is computed from the raw 'position' attribute rather than three's 'worldPosition' (only declared
7
+ when shadow maps / env maps / transmission are enabled) or 'transformed' (only declared once <begin_vertex> has
8
+ run). 'position' is present on every non-raw shader that exposes the <fog_vertex> anchor. Probe GI is
9
+ low-frequency, so skipping morph/skin displacement in the lookup position is inconsequential.
10
+ */
11
+ //language=GLSL
12
+ const SHADER_CHUNK_ACCUMULATION = `
13
+ {
14
+ vec4 lpg_world_position = vec4( position, 1.0 );
15
+
16
+ #ifdef USE_INSTANCING
17
+ lpg_world_position = instanceMatrix * lpg_world_position;
18
+ #endif
19
+
20
+ lpg_world_position = modelMatrix * lpg_world_position;
21
+
22
+ lpg_values = lpg_fetch_sh( lpg_world_position.xyz );
23
+ }
24
+ `;
25
+
26
+ /**
27
+ *
28
+ * @param {string} source
29
+ */
30
+ export function build_vertex_shader(source) {
31
+
32
+ let result = PREAMBLE + PREAMBLE_COMMON + source;
33
+
34
+ result = insert_after(
35
+ result,
36
+ '#include <fog_vertex>',
37
+ SHADER_CHUNK_ACCUMULATION
38
+ );
39
+
40
+ return result;
41
+ }
@@ -0,0 +1,3 @@
1
+ declare const _default: "\n#ifndef LPG_SHADER_CHUNK_PREAMBLE_FRAGMENT\n#define LPG_SHADER_CHUNK_PREAMBLE_FRAGMENT\n\nuniform float lpg_f_intensity;\n\nvarying vec3[4] lpg_values;\n\n\n#ifndef LPG_CHUNK_GET_IRRADIANCE_AT\n#define LPG_CHUNK_GET_IRRADIANCE_AT\n\nvec3 lpg_get_irradiance_at(in vec3 normal, in vec3 shCoefficients[4]) {\n // normal is assumed to have unit length\n\n // band 0\n vec3 result = shCoefficients[0] * 0.8862269254527579;\n\n // band 1\n result += shCoefficients[1] * 1.0233267079464885 * normal.y;\n result += shCoefficients[2] * 1.0233267079464885 * normal.z;\n result += shCoefficients[3] * 1.0233267079464885 * normal.x;\n\n return result;\n}\n\n#endif\n\n\n#endif\n";
2
+ export default _default;
3
+ //# sourceMappingURL=preamble.frag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preamble.frag.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.js"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { chunk_lpg_get_irradiance_at } from "../chunk_lpg_get_irradiance_at.js";
2
+
3
+ //language=GLSL
4
+ export default `
5
+ #ifndef LPG_SHADER_CHUNK_PREAMBLE_FRAGMENT
6
+ #define LPG_SHADER_CHUNK_PREAMBLE_FRAGMENT
7
+
8
+ uniform float lpg_f_intensity;
9
+
10
+ varying vec3[4] lpg_values;
11
+
12
+ ${ chunk_lpg_get_irradiance_at }
13
+
14
+ #endif
15
+ `
@@ -0,0 +1,3 @@
1
+ declare const _default: "\n#ifndef LPG_SHADER_CHUNK_PREAMBLE_VERTEX\n#define LPG_SHADER_CHUNK_PREAMBLE_VERTEX\n\nvarying vec3[4] lpg_values;\n\n#endif\n";
2
+ export default _default;
3
+ //# sourceMappingURL=preamble.vert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preamble.vert.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.js"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ //language=GLSL
2
+ export default `
3
+ #ifndef LPG_SHADER_CHUNK_PREAMBLE_VERTEX
4
+ #define LPG_SHADER_CHUNK_PREAMBLE_VERTEX
5
+
6
+ varying vec3[4] lpg_values;
7
+
8
+ #endif
9
+ `
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Probe field is sampled per-vertex, interpolated SH coefficients are evaluated against the per-fragment normal
3
+ * @param {{vertexShader, fragmentShader}} shader
4
+ */
5
+ export function space_vertex_transform_shader(shader: {
6
+ vertexShader;
7
+ fragmentShader;
8
+ }): void;
9
+ //# sourceMappingURL=space_vertex_transform_shader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space_vertex_transform_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,sDAFW;IAAC,YAAY,CAAC;IAAC,cAAc,CAAA;CAAC,QAMxC"}
@@ -0,0 +1,12 @@
1
+ import { build_fragment_shader } from "./build_fragment_shader.js";
2
+ import { build_vertex_shader } from "./build_vertex_shader.js";
3
+
4
+ /**
5
+ * Probe field is sampled per-vertex, interpolated SH coefficients are evaluated against the per-fragment normal
6
+ * @param {{vertexShader, fragmentShader}} shader
7
+ */
8
+ export function space_vertex_transform_shader(shader) {
9
+
10
+ shader.vertexShader = build_vertex_shader(shader.vertexShader);
11
+ shader.fragmentShader = build_fragment_shader(shader.fragmentShader);
12
+ }
@@ -0,0 +1,20 @@
1
+ export class LightProbeGridSerializationAdapter extends BinaryClassSerializationAdapter<any> {
2
+ constructor();
3
+ klass: typeof LightProbeGrid;
4
+ version: number;
5
+ /**
6
+ *
7
+ * @param buffer
8
+ * @param {LightProbeGrid} value must be built, see {@link LightProbeGrid#build}
9
+ */
10
+ serialize(buffer: any, value: LightProbeGrid): void;
11
+ /**
12
+ *
13
+ * @param buffer
14
+ * @param {LightProbeGrid} value
15
+ */
16
+ deserialize(buffer: any, value: LightProbeGrid): void;
17
+ }
18
+ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
19
+ import { LightProbeGrid } from "../LightProbeGrid.js";
20
+ //# sourceMappingURL=LightProbeGridSerializationAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LightProbeGridSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.js"],"names":[],"mappings":"AAMA;;IAEI,6BAAsB;IACtB,gBAAW;IAEX;;;;OAIG;IACH,8BAFW,cAAc,QAiBxB;IAED;;;;OAIG;IACH,gCAFW,cAAc,QAqBxB;CACJ;gDAzD+C,mEAAmE;+BACpF,sBAAsB"}
@@ -0,0 +1,59 @@
1
+ import { AABB3 } from "../../../../../core/geom/3d/aabb/AABB3.js";
2
+ import { BinaryClassSerializationAdapter } from "../../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
3
+ import { LightProbeGrid } from "../LightProbeGrid.js";
4
+
5
+ const __bounds = new AABB3(0, 0, 0, 0, 0, 0);
6
+
7
+ export class LightProbeGridSerializationAdapter extends BinaryClassSerializationAdapter {
8
+
9
+ klass = LightProbeGrid
10
+ version = 0
11
+
12
+ /**
13
+ *
14
+ * @param buffer
15
+ * @param {LightProbeGrid} value must be built, see {@link LightProbeGrid#build}
16
+ */
17
+ serialize(buffer, value) {
18
+ const bounds = value.bounds;
19
+
20
+ buffer.writeFloat64(bounds.x0);
21
+ buffer.writeFloat64(bounds.y0);
22
+ buffer.writeFloat64(bounds.z0);
23
+ buffer.writeFloat64(bounds.x1);
24
+ buffer.writeFloat64(bounds.y1);
25
+ buffer.writeFloat64(bounds.z1);
26
+
27
+ buffer.writeUint32(value.resolution_x);
28
+ buffer.writeUint32(value.resolution_y);
29
+ buffer.writeUint32(value.resolution_z);
30
+
31
+ buffer.writeFloat32Array(value.harmonics, 0, value.count * 12);
32
+ }
33
+
34
+ /**
35
+ *
36
+ * @param buffer
37
+ * @param {LightProbeGrid} value
38
+ */
39
+ deserialize(buffer, value) {
40
+ const x0 = buffer.readFloat64();
41
+ const y0 = buffer.readFloat64();
42
+ const z0 = buffer.readFloat64();
43
+ const x1 = buffer.readFloat64();
44
+ const y1 = buffer.readFloat64();
45
+ const z1 = buffer.readFloat64();
46
+
47
+ __bounds.setBounds(x0, y0, z0, x1, y1, z1);
48
+
49
+ const resolution_x = buffer.readUint32();
50
+ const resolution_y = buffer.readUint32();
51
+ const resolution_z = buffer.readUint32();
52
+
53
+ value.build(__bounds, resolution_x, resolution_y, resolution_z);
54
+
55
+ buffer.readFloat32Array(value.harmonics, 0, value.count * 12);
56
+
57
+ value.incrementVersion();
58
+ }
59
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialConverter.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js"],"names":[],"mappings":"AA+BA;IA+BI;;;;OAIG;IACH,kBAHW,MAAM,QAAQ,GACZ,gBAAgB,CA6C5B;;CAEJ;iCA3GgC,uBAAuB"}
1
+ {"version":3,"file":"MaterialConverter.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js"],"names":[],"mappings":"AA+BA;IAuCI;;;;OAIG;IACH,kBAHW,MAAM,QAAQ,GACZ,gBAAgB,CA6C5B;;CAEJ;iCAnHgC,uBAAuB"}
@@ -52,6 +52,14 @@ export class MaterialConverter {
52
52
 
53
53
  const st = StandardTexture.from(sampler2D);
54
54
 
55
+ // carry the source texture's addressing/filtering across; the TextureWrapping
56
+ // and TextureFilter enums mirror three's constant values, so otherwise tiled
57
+ // (RepeatWrapping) surfaces would be sampled as ClampToEdge and stretch a
58
+ // single edge texel across the whole surface.
59
+ st.wrapS = texture.wrapS;
60
+ st.wrapT = texture.wrapT;
61
+ st.magFilter = texture.magFilter;
62
+
55
63
  // base-color/emissive maps are sRGB-authored and must be decoded to linear at sample time
56
64
  st.decode_sRGB = texture.encoding === sRGBEncoding;
57
65
 
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prototypeLightProbeGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prototypeLightProbeGrid.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/prototypeLightProbeGrid.js"],"names":[],"mappings":""}
@@ -0,0 +1,170 @@
1
+ import { GUI } from "dat.gui";
2
+ import '../../../../../../../css/game.scss';
3
+ import { Color } from "../../../core/color/Color.js";
4
+ import { kelvin_to_rgb } from "../../../core/color/kelvin/kelvin_to_rgb.js";
5
+ import { AABB3 } from "../../../core/geom/3d/aabb/AABB3.js";
6
+ import Vector3 from "../../../core/geom/Vector3.js";
7
+ import { max2 } from "../../../core/math/max2.js";
8
+ import { min2 } from "../../../core/math/min2.js";
9
+ import { RAD_TO_DEG } from "../../../core/math/RAD_TO_DEG.js";
10
+ import { v3_length } from "../../../core/geom/vec3/v3_length.js";
11
+ import { GLTFAssetLoader } from "../../asset/loaders/GLTFAssetLoader.js";
12
+ import GUIElementSystem from "../../ecs/gui/GUIElementSystem.js";
13
+ import ViewportPositionSystem from "../../ecs/gui/position/ViewportPositionSystem.js";
14
+ import { TransformAttachmentSystem } from "../../ecs/transform-attachment/TransformAttachmentSystem.js";
15
+ import { EngineHarness } from "../../EngineHarness.js";
16
+ import { Camera } from "../ecs/camera/Camera.js";
17
+ import { focal_length_to_fov } from "../ecs/camera/focal_length_to_fov.js";
18
+ import TopDownCameraController from "../ecs/camera/topdown/TopDownCameraController.js";
19
+ import LightSystem from "../ecs/light/LightSystem.js";
20
+ import { SGMeshSystem } from "../ecs/mesh-v2/aggregate/SGMeshSystem.js";
21
+ import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
22
+ import { ShadedGeometryFlags } from "../ecs/mesh-v2/ShadedGeometryFlags.js";
23
+ import { ShadedGeometrySystem } from "../ecs/mesh-v2/ShadedGeometrySystem.js";
24
+ import { three_object_to_entity_composition } from "../ecs/mesh-v2/three_object_to_entity_composition.js";
25
+ import { GizmoRenderingPlugin } from "../render/gizmo/GizmoRenderingPlugin.js";
26
+ import { ProbeResolutionStage } from "./gi/material/ProbeResolutionStage.js";
27
+ import { light_probe_grid_bake_via_task } from "./lpg/build_light_probe_grid_for_scene.js";
28
+ import { LightProbeGrid } from "./lpg/LightProbeGrid.js";
29
+ import { light_probe_grid_obtain_storage_cached } from "./lpg/light_probe_grid_obtain_storage_cached.js";
30
+ import { LightProbeGridMaterialTransformer } from "./lpg/material/LightProbeGridMaterialTransformer.js";
31
+
32
+ /**
33
+ *
34
+ * @param {Engine} engine
35
+ * @return {Promise<void>}
36
+ */
37
+ async function main(engine) {
38
+ const grid = new LightProbeGrid();
39
+
40
+ const transformer = new LightProbeGridMaterialTransformer({
41
+ grid,
42
+ stage: ProbeResolutionStage.Fragment
43
+ });
44
+
45
+ engine.graphics.getMaterialManager().addCompileStep(transformer);
46
+
47
+ await EngineHarness.buildBasics({
48
+ engine,
49
+ showFps: false,
50
+ enableWater: false,
51
+ enableTerrain: false,
52
+ enableLights: false,
53
+ cameraFarDistance: 200,
54
+ cameraController: false,
55
+ focus: { x: 0, y: 0, z: 0 },
56
+ pitch: 1,
57
+ yaw: -1.54,
58
+ distance: 54,
59
+ cameraFieldOfView: focal_length_to_fov(50, 25) * RAD_TO_DEG
60
+ });
61
+
62
+ const sun_color = new Color();
63
+
64
+ kelvin_to_rgb(sun_color, 0, 5000);
65
+
66
+ await EngineHarness.buildLights({
67
+ engine,
68
+ shadowmapResolution: 4096,
69
+ ambientIntensity: 0.0,
70
+ sun: sun_color,
71
+ sunIntensity: 3,
72
+ sunDirection: new Vector3(1.2, -1, 0.2)
73
+ })
74
+
75
+ engine.graphics.getRenderer().setClearColor('#1e3441', 1);
76
+
77
+ const ecd = engine.entityManager.dataset;
78
+
79
+ const path = 'data/models/pica_pica/pica_pica.gltf';
80
+
81
+ const mesh_asset = await engine.assetManager.promise(path, 'model/gltf+json');
82
+ const gltf = mesh_asset.gltf;
83
+
84
+ const composition = three_object_to_entity_composition(gltf.scene);
85
+
86
+ composition.traverse(n => {
87
+
88
+ /**
89
+ * @type {ShadedGeometry}
90
+ */
91
+ const sg = n.entity.getComponent(ShadedGeometry);
92
+
93
+ if (sg === null) {
94
+ return;
95
+ }
96
+
97
+ sg.writeFlag(ShadedGeometryFlags.CastShadow | ShadedGeometryFlags.ReceiveShadow, true);
98
+
99
+ const material = sg.material;
100
+ if (material !== null) {
101
+ material.depthTest = true;
102
+ material.depthWrite = true;
103
+ }
104
+ });
105
+
106
+ composition.build(ecd);
107
+
108
+ /**
109
+ * @type {AABB3}
110
+ */
111
+ const mesh_bounds = mesh_asset.boundingBox;
112
+
113
+ const model_footprint = v3_length(mesh_bounds.getExtentsX(), mesh_bounds.getExtentsY(), mesh_bounds.getExtentsZ());
114
+
115
+ const camera = ecd.getAnyComponent(Camera);
116
+ camera.component.clip_far = max2(100, model_footprint * 3);
117
+ const camera_controller = ecd.getComponent(camera.entity, TopDownCameraController);
118
+ camera_controller.distanceMax = model_footprint * 2;
119
+ camera_controller.distanceMin = min2(camera_controller.distanceMin, model_footprint * 0.01);
120
+ mesh_bounds.getCenter(camera_controller.target)
121
+
122
+ const spacing = model_footprint * 0.1;
123
+
124
+ console.time('getGrid');
125
+ await light_probe_grid_obtain_storage_cached({ engine, path, grid, spacing });
126
+ console.timeEnd('getGrid');
127
+
128
+ console.log('LPG:', grid);
129
+
130
+ transformer.update();
131
+
132
+ const gui = new GUI();
133
+ gui.add(transformer, 'intensity').min(0).max(10);
134
+
135
+ gui.add({
136
+ async bake() {
137
+ const grid_bounds = new AABB3(0, 0, 0, 1, 1, 1);
138
+ grid_bounds.copy(mesh_bounds);
139
+ grid_bounds.grow(spacing * 1.05);
140
+
141
+ grid.build(
142
+ grid_bounds,
143
+ max2(2, Math.ceil(grid_bounds.getExtentsX() / spacing) + 1),
144
+ max2(2, Math.ceil(grid_bounds.getExtentsY() / spacing) + 1),
145
+ max2(2, Math.ceil(grid_bounds.getExtentsZ() / spacing) + 1)
146
+ );
147
+
148
+ await light_probe_grid_bake_via_task(grid, ecd, engine);
149
+
150
+ transformer.update();
151
+ }
152
+ }, "bake").name("Bake");
153
+ }
154
+
155
+ new EngineHarness().initialize({
156
+ configuration(config, engine) {
157
+ config.addSystem(new ShadedGeometrySystem(engine));
158
+ config.addSystem(new LightSystem(engine, {
159
+ shadowResolution: 8192
160
+ }));
161
+ config.addSystem(new SGMeshSystem(engine));
162
+ config.addSystem(new TransformAttachmentSystem());
163
+ config.addSystem(new GUIElementSystem(engine.gui.view, engine));
164
+ config.addSystem(new ViewportPositionSystem(engine.gui.view.size));
165
+
166
+ config.addLoader('model/gltf+json', new GLTFAssetLoader());
167
+
168
+ config.addPlugin(GizmoRenderingPlugin);
169
+ }
170
+ }).then(main);
@@ -77,7 +77,7 @@ export class AtlasLookupTexture {
77
77
  data[address] = position.x;
78
78
  data[address + 1] = position.y;
79
79
 
80
- data[address + 2] = size.y;
80
+ data[address + 2] = size.x;
81
81
  data[address + 3] = size.y;
82
82
  }
83
83
 
@@ -150,7 +150,7 @@ export class CachingTextureAtlas extends AbstractTextureAtlas {
150
150
  * @private
151
151
  */
152
152
  __evict_all() {
153
- for (let i = this.__cached_patches.length - 1; i > 0; i--) {
153
+ for (let i = this.__cached_patches.length - 1; i >= 0; i--) {
154
154
  this.__evict(i);
155
155
  }
156
156
  }
@@ -90,7 +90,7 @@ export function sampler2d_scale_down_lanczos(source, destination, lobes = 2) {
90
90
  const ratio_x = source_width / d_w;
91
91
  const ratio_y = source_height / d_h;
92
92
 
93
- const rcp_ratio_y = 2 / ratio_x;
93
+ const rcp_ratio_y = 2 / ratio_y;
94
94
  const rcp_ratio_x = 2 / ratio_x;
95
95
 
96
96
 
@@ -121,7 +121,7 @@ export function sampler2d_copy_with_margins(
121
121
 
122
122
  //Write Bottom-left margin
123
123
  sOffset = (sourceY + height - 1) * sRowSize + sourceX * dItemSize;
124
- for (y = destinationY + width, yMax = Math.min(destination.height, y + marginBottom); y < yMax; y++) {
124
+ for (y = destinationY + height, yMax = Math.min(destination.height, y + marginBottom); y < yMax; y++) {
125
125
  dA = y * dRowSize;
126
126
 
127
127
  for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
@@ -135,7 +135,7 @@ export function sampler2d_copy_with_margins(
135
135
  }
136
136
  //Write Bottom margin
137
137
  sA = (sourceY + height - 1) * sRowSize;
138
- for (y = destinationY + width, yMax = Math.min(destination.height, y + marginBottom); y < yMax; y++) {
138
+ for (y = destinationY + height, yMax = Math.min(destination.height, y + marginBottom); y < yMax; y++) {
139
139
  dA = y * dRowSize;
140
140
 
141
141
  for (x = 0; x < width; x++) {
@@ -149,7 +149,7 @@ export function sampler2d_copy_with_margins(
149
149
  }
150
150
  //Write Bottom-right margin
151
151
  sOffset = (sourceY + height - 1) * sRowSize + (sourceX + width - 1) * dItemSize;
152
- for (y = destinationY + width, yMax = Math.min(destination.height, y + marginBottom); y < yMax; y++) {
152
+ for (y = destinationY + height, yMax = Math.min(destination.height, y + marginBottom); y < yMax; y++) {
153
153
  dA = y * dRowSize;
154
154
 
155
155
  for (x = destinationX + width, xMax = Math.min(destination.width, x + marginRight); x < xMax; x++) {
@@ -1 +1 @@
1
- {"version":3,"file":"build_max_height_pyramid.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/util/build_max_height_pyramid.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,8DAFa,kBAAkB,CA2G9B;mCAxI4F,OAAO"}
1
+ {"version":3,"file":"build_max_height_pyramid.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/util/build_max_height_pyramid.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,8DAFa,kBAAkB,CA8G9B;mCA3I4F,OAAO"}
@@ -44,8 +44,11 @@ export function build_max_height_pyramid(sampler) {
44
44
  let prevData = sampler.data;
45
45
 
46
46
  while (prevW > 1 || prevH > 1) {
47
- const curW = Math.max(1, prevW >> 1);
48
- const curH = Math.max(1, prevH >> 1);
47
+ // round UP so an odd dimension's last row/column is still folded
48
+ // into a coarse texel (the sx1/sy1 clamps below cover the overhang);
49
+ // a floor here would drop it and make the Hi-Z pyramid under-report.
50
+ const curW = Math.max(1, (prevW + 1) >> 1);
51
+ const curH = Math.max(1, (prevH + 1) >> 1);
49
52
  const curData = new Float32Array(curW * curH);
50
53
 
51
54
  const lastSrcX = prevW - 1;
@@ -53,7 +53,7 @@ class Synchronizer {
53
53
  break;
54
54
 
55
55
  case Transform2GridPositionMode.Ceil:
56
- v2.floor();
56
+ v2.ceil();
57
57
  break;
58
58
 
59
59
  case Transform2GridPositionMode.Round:
@@ -4,8 +4,9 @@ export class InputBinding {
4
4
  * @param {string} path
5
5
  * @param {function} listener
6
6
  * @param {boolean} [exclusive=false]
7
+ * @param {number} [priority=0] higher priority bindings on the same path are dispatched first
7
8
  */
8
- constructor({ path, listener, exclusive }: string);
9
+ constructor({ path, listener, exclusive, priority }: string);
9
10
  /**
10
11
  *
11
12
  * @type {string}
@@ -21,5 +22,10 @@ export class InputBinding {
21
22
  * @type {boolean}
22
23
  */
23
24
  exclusive: boolean;
25
+ /**
26
+ * Higher priority bindings on the same path are dispatched first.
27
+ * @type {number}
28
+ */
29
+ priority: number;
24
30
  }
25
31
  //# sourceMappingURL=InputBinding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;OAKG;IACH,2CAJW,MAAM,EAwBhB;IAfG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,mBAAwB;IACxB;;;OAGG;IACH,WAFU,OAAO,CAES;CAEjC"}
1
+ {"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;;OAMG;IACH,qDALW,MAAM,EA+BhB;IApBG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,mBAAwB;IACxB;;;OAGG;IACH,WAFU,OAAO,CAES;IAC1B;;;OAGG;IACH,UAFU,MAAM,CAEQ;CAE/B"}
@@ -6,11 +6,13 @@ export class InputBinding {
6
6
  * @param {string} path
7
7
  * @param {function} listener
8
8
  * @param {boolean} [exclusive=false]
9
+ * @param {number} [priority=0] higher priority bindings on the same path are dispatched first
9
10
  */
10
- constructor({ path, listener, exclusive = false }) {
11
+ constructor({ path, listener, exclusive = false, priority = 0 }) {
11
12
  assert.isString(path, 'path');
12
13
  assert.isFunction(listener, 'listener');
13
14
  assert.isBoolean(exclusive, 'exclusive');
15
+ assert.isNumber(priority, 'priority');
14
16
 
15
17
  /**
16
18
  *
@@ -27,5 +29,10 @@ export class InputBinding {
27
29
  * @type {boolean}
28
30
  */
29
31
  this.exclusive = exclusive;
32
+ /**
33
+ * Higher priority bindings on the same path are dispatched first.
34
+ * @type {number}
35
+ */
36
+ this.priority = priority;
30
37
  }
31
38
  }
@@ -103,7 +103,7 @@ function getOrCreateProxy(proxies, path, signal) {
103
103
  } else if (!a.exclusive && b.exclusive) {
104
104
  return 1;
105
105
  } else {
106
- return b.priotity - a.priority;
106
+ return b.priority - a.priority;
107
107
  }
108
108
  });
109
109
  }
@@ -5,9 +5,10 @@ export class OverrideContextBehavior extends AbstractDecoratorBehavior {
5
5
  * @param {Behavior} source
6
6
  * @return {OverrideContextBehavior}
7
7
  */
8
- static from(context: any, source: Behavior): OverrideContextBehavior;
8
+ static from(context: any, source: Behavior<any>): OverrideContextBehavior;
9
9
  __override_context: {};
10
10
  tick(timeDelta: any): import("../BehaviorStatus.js").BehaviorStatus;
11
11
  }
12
12
  import { AbstractDecoratorBehavior } from "./AbstractDecoratorBehavior.js";
13
+ import { Behavior } from "../Behavior.js";
13
14
  //# sourceMappingURL=OverrideContextBehavior.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OverrideContextBehavior.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/intelligence/behavior/decorator/OverrideContextBehavior.js"],"names":[],"mappings":"AAEA;IAII;;;;;OAKG;IACH,6CAFY,uBAAuB,CASlC;IAfD,uBAAwB;IAiBxB,oEAIC;CASJ;0CAlCyC,gCAAgC"}
1
+ {"version":3,"file":"OverrideContextBehavior.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/intelligence/behavior/decorator/OverrideContextBehavior.js"],"names":[],"mappings":"AAGA;IAII;;;;;OAKG;IACH,kDAFY,uBAAuB,CASlC;IAfD,uBAAwB;IAiBxB,oEAIC;CAYJ;0CArCyC,gCAAgC;yBADjD,gBAAgB"}
@@ -1,3 +1,4 @@
1
+ import { Behavior } from "../Behavior.js";
1
2
  import { AbstractDecoratorBehavior } from "./AbstractDecoratorBehavior.js";
2
3
 
3
4
  export class OverrideContextBehavior extends AbstractDecoratorBehavior {
@@ -26,10 +27,13 @@ export class OverrideContextBehavior extends AbstractDecoratorBehavior {
26
27
  }
27
28
 
28
29
  initialize(context) {
29
- super.initialize(context);
30
-
31
30
  const child_context = Object.assign({}, context, this.__override_context);
32
31
 
33
32
  this.__source.initialize(child_context);
33
+
34
+ // NOTE: deliberately not super.initialize() — AbstractDecoratorBehavior
35
+ // would re-initialize the source a second time with the un-overridden
36
+ // context. Do only the Behavior-level self-init.
37
+ Behavior.prototype.initialize.call(this, context);
34
38
  }
35
39
  }
@@ -58,7 +58,7 @@ export class WeightedElement {
58
58
  */
59
59
  equals(other) {
60
60
  return this.weight === other.weight
61
- && invokeObjectEquals(this.data, other.element);
61
+ && invokeObjectEquals(this.data, other.data);
62
62
  }
63
63
 
64
64
  /**