@woosh/meep-engine 2.75.7 → 2.75.9

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 (150) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +1052 -1234
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +1052 -1234
  5. package/editor/actions/concrete/ModifyPatchSampler2DAction.js +6 -3
  6. package/editor/actions/concrete/PatchTerrainTextureAction.js +6 -3
  7. package/editor/ecs/component/createObjectEditor.js +2 -2
  8. package/editor/process/EditorProcess.js +12 -16
  9. package/editor/process/ProcessEngine.js +9 -10
  10. package/package.json +1 -1
  11. package/src/core/binary/dec2hex.js +1 -1
  12. package/src/{engine/ecs/ik/IKMath.js → core/geom/vec3/v3_computeOffsetVector.js} +1 -1
  13. package/src/core/math/newton_solver_1d.js +13 -4
  14. package/src/core/math/solveQuadratic.js +5 -3
  15. package/src/core/math/spline/catmull_rom_compute_T.js +19 -0
  16. package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSpline.js +3 -3
  17. package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSplineUniformDistance.js +3 -3
  18. package/src/core/math/spline/computeNonuniformCatmullRomSplineSample.js +109 -0
  19. package/src/core/math/spline/interpolate_bicubic.js +12 -0
  20. package/src/core/math/spline/spline_catmullrom_1d.js +120 -0
  21. package/src/core/model/object/ImmutableObjectPool.js +14 -5
  22. package/src/engine/control/ControlContext.js +25 -27
  23. package/src/engine/ecs/EntityManager.js +12 -9
  24. package/src/engine/ecs/EntityObserver.js +26 -22
  25. package/src/engine/ecs/binding/ComponentPropertyPath.js +12 -12
  26. package/src/engine/ecs/components/Motion.js +5 -7
  27. package/src/engine/ecs/components/SerializationMetadata.js +5 -3
  28. package/src/engine/ecs/dynamic_actions/actions/definition/AbstractActionDescription.js +0 -2
  29. package/src/engine/ecs/dynamic_actions/actions/definition/ActionSequenceDescription.js +7 -9
  30. package/src/engine/ecs/dynamic_actions/actions/definition/DelayActionDescription.js +3 -5
  31. package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +6 -8
  32. package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +14 -17
  33. package/src/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +8 -11
  34. package/src/engine/ecs/dynamic_actions/actions/definition/WriteToBlackboardActionDescription.js +15 -18
  35. package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +7 -7
  36. package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +6 -6
  37. package/src/engine/ecs/parent/EntityNode.js +39 -37
  38. package/src/engine/ecs/speaker/VoiceSystem.js +36 -39
  39. package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +7 -9
  40. package/src/engine/ecs/storage/BinaryBufferSerializer.js +15 -16
  41. package/src/engine/ecs/storage/binary/BinaryClassUpgrader.js +10 -59
  42. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +14 -15
  43. package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +3 -3
  44. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +60 -62
  45. package/src/engine/ecs/storage/binary/executeBinaryClassUpgraderChain.js +46 -0
  46. package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.js +2 -2
  47. package/src/engine/ecs/system/SystemEntityContext.js +25 -23
  48. package/src/engine/ecs/tag/find_entities_with_tag.js +18 -0
  49. package/src/engine/ecs/terrain/TerrainClouds.js +23 -24
  50. package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +37 -31
  51. package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +8 -7
  52. package/src/engine/ecs/terrain/ecs/splat/SplatMapMaterialPatch.js +5 -2
  53. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +15 -14
  54. package/src/engine/ecs/tooltip/TooltipComponent.js +6 -7
  55. package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
  56. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -5
  57. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
  58. package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +12 -14
  59. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +22 -20
  60. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -4
  61. package/src/engine/graphics/render/RendererPool.js +36 -40
  62. package/src/engine/graphics/render/buffer/FrameBuffer.js +25 -24
  63. package/src/engine/graphics/render/buffer/RenderGraph.js +21 -21
  64. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
  65. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -5
  66. package/src/engine/graphics/render/frame_graph/IRenderContext.js +31 -1
  67. package/src/engine/graphics/render/frame_graph/RenderGraph.js +5 -5
  68. package/src/engine/graphics/render/frame_graph/RenderTarget.js +9 -0
  69. package/src/engine/graphics/render/frame_graph/RenderTextureManager.js +57 -0
  70. package/src/engine/graphics/render/frame_graph/ResourceEntry.js +7 -5
  71. package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +48 -33
  72. package/src/engine/graphics/render/frame_graph/TextureInitialState.js +14 -0
  73. package/src/engine/graphics/render/frame_graph/sample/deferred/CopyPass.js +20 -0
  74. package/src/engine/graphics/render/frame_graph/sample/deferred/LightingPass.js +4 -0
  75. package/src/engine/graphics/render/frame_graph/sample/deferred/run.js +34 -6
  76. package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js +34 -0
  77. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +3 -6
  78. package/src/engine/graphics/sh3/gi/prototypeSHGI.js +92 -0
  79. package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
  80. package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -11
  81. package/src/engine/graphics/texture/sampler/Sampler2D.js +15 -366
  82. package/src/engine/graphics/texture/sampler/Sampler2D.spec.js +0 -31
  83. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +166 -0
  84. package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.spec.js +31 -0
  85. package/src/engine/graphics/texture/sampler/sampler2d_paint.js +81 -0
  86. package/src/engine/graphics/texture/sampler/sampler2d_sub_copy_same_item_size.js +50 -0
  87. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMemoryMapping.js → VirtualTextureMemoryMapping.js} +2 -26
  88. package/src/engine/graphics/texture/virtual/{v2/VirtualTexturePage.js → VirtualTexturePage.js} +10 -10
  89. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureTileLoader.js → VirtualTextureTileLoader.js} +7 -7
  90. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsage.js → VirtualTextureUsage.js} +1 -1
  91. package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageUpdater.js → VirtualTextureUsageUpdater.js} +7 -7
  92. package/src/engine/graphics/texture/virtual/{v2/debug → debug}/ResidencyDebugView.js +4 -4
  93. package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsageDebugView.js +2 -2
  94. package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsagePyramidDebugView.js +4 -4
  95. package/src/engine/graphics/texture/virtual/{v2/prototype.js → prototype.js} +7 -7
  96. package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_finger_print.js +1 -1
  97. package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_tile_address.js +2 -2
  98. package/src/engine/graphics/texture/virtual/{v2/tile → tile}/tile_address_to_finger_print.js +1 -1
  99. package/src/engine/navigation/ecs/components/Path.js +10 -9
  100. package/src/engine/physics/computeInterceptPoint.js +44 -0
  101. package/src/engine/plugin/EnginePlugin.js +1 -2
  102. package/src/engine/ecs/components/AlignToVelocity.js +0 -9
  103. package/src/engine/ecs/components/CharacterController.js +0 -31
  104. package/src/engine/ecs/components/PhysicalBody.js +0 -51
  105. package/src/engine/ecs/components/Steering.js +0 -111
  106. package/src/engine/ecs/components/SteeringSerializationAdapter.js +0 -34
  107. package/src/engine/ecs/storage/json/Blueprint.js +0 -129
  108. package/src/engine/ecs/storage/json/EntityFactory.js +0 -207
  109. package/src/engine/ecs/storage/json/JSONDeSerializer.js +0 -148
  110. package/src/engine/ecs/storage/json/JSONSerializer.js +0 -132
  111. package/src/engine/ecs/storage/json/README.md +0 -5
  112. package/src/engine/ecs/systems/AlignToVelocitySystem.js +0 -51
  113. package/src/engine/ecs/systems/CharacterControlSystem.js +0 -134
  114. package/src/engine/ecs/systems/PhysicsSystem.js +0 -89
  115. package/src/engine/ecs/systems/PropertySetSystem.js +0 -18
  116. package/src/engine/ecs/systems/SteeringSystem.js +0 -171
  117. package/src/engine/ecs/systems/TagSystem.d.ts +0 -5
  118. package/src/engine/ecs/systems/TagSystem.js +0 -31
  119. package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +0 -108
  120. package/src/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +0 -71
  121. package/src/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +0 -39
  122. package/src/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +0 -21
  123. package/src/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +0 -41
  124. package/src/engine/graphics/render/webgpu/sample/main.js +0 -605
  125. package/src/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +0 -9
  126. package/src/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +0 -30
  127. package/src/engine/graphics/texture/sampler/bicubic.js +0 -59
  128. package/src/engine/graphics/texture/sampler/bicubic.spec.js +0 -13
  129. package/src/engine/graphics/texture/virtual/TileOperation.js +0 -13
  130. package/src/engine/graphics/texture/virtual/TileTree.js +0 -150
  131. package/src/engine/graphics/texture/virtual/TileTree.spec.js +0 -58
  132. package/src/engine/graphics/texture/virtual/TileUsage.js +0 -137
  133. package/src/engine/graphics/texture/virtual/VirtualTexture.js +0 -238
  134. package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +0 -39
  135. package/src/engine/graphics/texture/virtual/page/TilePage.js +0 -148
  136. package/src/engine/graphics/texture/virtual/page/TilePageSlot.js +0 -36
  137. package/src/engine/graphics/texture/virtual/tile/Tile.js +0 -44
  138. package/src/engine/graphics/texture/virtual/tile/Tile.spec.js +0 -11
  139. package/src/engine/graphics/texture/virtual/tile/TileAddress.js +0 -63
  140. package/src/engine/graphics/texture/virtual/tile/TileAddress.spec.js +0 -30
  141. package/src/engine/graphics/texture/virtual/tile/TileLoader.js +0 -178
  142. package/src/engine/graphics/texture/virtual/tile/TileRequest.js +0 -40
  143. package/src/engine/graphics/texture/virtual/tile/TileStatus.js +0 -10
  144. package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +0 -242
  145. /package/src/engine/graphics/texture/virtual/{v2/NOTES.md → NOTES.md} +0 -0
  146. /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMaterial.js → VirtualTextureMaterial.js} +0 -0
  147. /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageShader.js → VirtualTextureUsageShader.js} +0 -0
  148. /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/VirtualTextureTile.js +0 -0
  149. /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/decompose_finger_print.js +0 -0
  150. /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/finger_print_to_tile_address.js +0 -0
@@ -1,242 +0,0 @@
1
- /**
2
- *
3
- * @param {number[]} p0
4
- * @param {number[]} p1
5
- * @param {number} dimensions
6
- * @param {number} half_alpha between 0..0.5
7
- * @returns {number}
8
- */
9
- function getT(p0, p1, dimensions, half_alpha) {
10
- let a = 0;
11
-
12
- for (let i = 0; i < dimensions; i++) {
13
- const dx = p0[i] - p1[i];
14
-
15
- a += dx * dx;
16
- }
17
-
18
- return Math.pow(a, half_alpha);
19
- }
20
-
21
- /**
22
- * Based on wiki article: https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline#Code_example_in_Python
23
- * @param {number[]} result
24
- * @param {number[]} p0 spline point 0
25
- * @param {number[]} p1 spline point 1
26
- * @param {number[]} p2 spline point 2
27
- * @param {number[]} p3 spline point 3
28
- * @param {number} dimensions number of dimensions in the input and output vectors
29
- * @param {number} f between 0..1
30
- * @param {number} alpha between 0..1
31
- */
32
- export function computeNonuniformCatmullRomSplineSample(result, p0, p1, p2, p3, dimensions, f, alpha) {
33
- const half_alpha = alpha * 0.5;
34
-
35
- // calculate T
36
- const t0 = 0;
37
- let t_01 = getT(p0, p1, dimensions, half_alpha);
38
- let t_02 = getT(p1, p2, dimensions, half_alpha);
39
- let t_03 = getT(p2, p3, dimensions, half_alpha);
40
-
41
- // safety check for repeated points, to prevent division by 0
42
- if (t_01 < 1e-4) {
43
- t_01 = 1;
44
- }
45
- if (t_02 < 1e-4) {
46
- t_02 = t_01;
47
- }
48
- if (t_03 < 1e-4) {
49
- t_03 = t_02;
50
- }
51
-
52
- const t1 = t_01 + t0;
53
- const t2 = t_02 + t1;
54
- const t3 = t_03 + t2;
55
-
56
- /**
57
- * Interpolation between points 1 and 2
58
- * @type {number}
59
- */
60
- const t = t1 * (1 - f) + t2 * f;
61
-
62
- /*
63
- Vector2 A1 = (t1-t)/(t1-t0)*p0 + (t-t0)/(t1-t0)*p1;
64
- Vector2 A2 = (t2-t)/(t2-t1)*p1 + (t-t1)/(t2-t1)*p2;
65
- Vector2 A3 = (t3-t)/(t3-t2)*p2 + (t-t2)/(t3-t2)*p3;
66
-
67
- Vector2 B1 = (t2-t)/(t2-t0)*A1 + (t-t0)/(t2-t0)*A2;
68
- Vector2 B2 = (t3-t)/(t3-t1)*A2 + (t-t1)/(t3-t1)*A3;
69
-
70
- Vector2 C = (t2-t)/(t2-t1)*B1 + (t-t1)/(t2-t1)*B2;
71
- */
72
-
73
- const d_t1_t0 = t1 - t0;
74
-
75
- const m_A1_0 = (t1 - t) / d_t1_t0;
76
- const m_A1_1 = (t - t0) / d_t1_t0;
77
-
78
- const d_t2_t1 = t2 - t1;
79
-
80
- const m_A2_0 = (t2 - t) / d_t2_t1;
81
-
82
- const d_t_t1 = t - t1;
83
-
84
- const m_A2_1 = d_t_t1 / d_t2_t1;
85
-
86
- const d_t3_t2 = t3 - t2;
87
-
88
- const d_t3_t = t3 - t;
89
-
90
- const m_A3_0 = d_t3_t / d_t3_t2;
91
- const m_A3_1 = (t - t2) / d_t3_t2;
92
-
93
- const d_t2_t0 = t2 - t0;
94
-
95
- const m_B1_0 = (t2 - t) / d_t2_t0;
96
- const m_B1_1 = (t - t0) / d_t2_t0;
97
-
98
- const d_t3_t1 = t3 - t1;
99
-
100
- const m_B2_0 = d_t3_t / d_t3_t1;
101
- const m_B2_1 = d_t_t1 / d_t3_t1;
102
-
103
- const m_C_0 = (t2 - t) / d_t2_t1;
104
- const m_C_1 = d_t_t1 / d_t2_t1;
105
-
106
- for (let i = 0; i < dimensions; i++) {
107
- // read vector values for the dimension
108
- const v0 = p0[i];
109
- const v1 = p1[i];
110
- const v2 = p2[i];
111
- const v3 = p3[i];
112
-
113
- // compute resulting value in this dimension
114
- const A1 = m_A1_0 * v0 + m_A1_1 * v1;
115
- const A2 = m_A2_0 * v1 + m_A2_1 * v2;
116
- const A3 = m_A3_0 * v2 + m_A3_1 * v3;
117
-
118
- const B1 = m_B1_0 * A1 + m_B1_1 * A2;
119
- const B2 = m_B2_0 * A2 + m_B2_1 * A3;
120
-
121
- const C = m_C_0 * B1 + m_C_1 * B2;
122
-
123
- result[i] = C;
124
- }
125
- }
126
-
127
-
128
- /**
129
- * Alpha assumed to be 0.5
130
- * @param {number} f
131
- * @param {number} p0
132
- * @param {number} p1
133
- * @param {number} p2
134
- * @param {number} p3
135
- * @returns {number}
136
- */
137
- function catmullrom_1d(f, p0, p1, p2, p3) {
138
- const half_alpha = 0.25;
139
-
140
- /**
141
- *
142
- * @param {number} p0
143
- * @param {number} p1
144
- * @param {number} half_alpha between 0..0.5
145
- * @returns {number}
146
- */
147
- function getT(p0, p1, half_alpha) {
148
- const dx = p0 - p1;
149
-
150
- const a = dx * dx;
151
-
152
- return Math.pow(a, half_alpha);
153
- }
154
-
155
- // calculate T
156
- const t0 = 0;
157
- let t_01 = getT(p0, p1, half_alpha);
158
- let t_02 = getT(p1, p2, half_alpha);
159
- let t_03 = getT(p2, p3, half_alpha);
160
-
161
- // safety check for repeated points, to prevent division by 0
162
- if (t_01 < 1e-5) {
163
- t_01 = 1;
164
- }
165
- if (t_02 < 1e-5) {
166
- t_02 = t_01;
167
- }
168
- if (t_03 < 1e-5) {
169
- t_03 = t_02;
170
- }
171
-
172
- const t1 = t_01 + t0;
173
- const t2 = t_02 + t1;
174
- const t3 = t_03 + t2;
175
-
176
- /**
177
- * Interpolation between points 1 and 2
178
- * @type {number}
179
- */
180
- const t = t1 * (1 - f) + t2 * f;
181
-
182
- /*
183
- Vector2 A1 = (t1-t)/(t1-t0)*p0 + (t-t0)/(t1-t0)*p1;
184
- Vector2 A2 = (t2-t)/(t2-t1)*p1 + (t-t1)/(t2-t1)*p2;
185
- Vector2 A3 = (t3-t)/(t3-t2)*p2 + (t-t2)/(t3-t2)*p3;
186
-
187
- Vector2 B1 = (t2-t)/(t2-t0)*A1 + (t-t0)/(t2-t0)*A2;
188
- Vector2 B2 = (t3-t)/(t3-t1)*A2 + (t-t1)/(t3-t1)*A3;
189
-
190
- Vector2 C = (t2-t)/(t2-t1)*B1 + (t-t1)/(t2-t1)*B2;
191
- */
192
-
193
- const d_t1_t0 = t1 - t0;
194
-
195
- const m_A1_0 = (t1 - t) / d_t1_t0;
196
- const m_A1_1 = (t - t0) / d_t1_t0;
197
-
198
- const d_t2_t1 = t2 - t1;
199
-
200
- const m_A2_0 = (t2 - t) / d_t2_t1;
201
-
202
- const d_t_t1 = t - t1;
203
-
204
- const m_A2_1 = d_t_t1 / d_t2_t1;
205
-
206
- const d_t3_t2 = t3 - t2;
207
-
208
- const d_t3_t = t3 - t;
209
-
210
- const m_A3_0 = d_t3_t / d_t3_t2;
211
- const m_A3_1 = (t - t2) / d_t3_t2;
212
-
213
- const d_t2_t0 = t2 - t0;
214
-
215
- const m_B1_0 = (t2 - t) / d_t2_t0;
216
- const m_B1_1 = (t - t0) / d_t2_t0;
217
-
218
- const d_t3_t1 = t3 - t1;
219
-
220
- const m_B2_0 = d_t3_t / d_t3_t1;
221
- const m_B2_1 = d_t_t1 / d_t3_t1;
222
-
223
- const m_C_0 = (t2 - t) / d_t2_t1;
224
- const m_C_1 = d_t_t1 / d_t2_t1;
225
-
226
- // read vector values for the dimension
227
- const v0 = p0;
228
- const v1 = p1;
229
- const v2 = p2;
230
- const v3 = p3;
231
-
232
- // compute resulting value in this dimension
233
- const A1 = m_A1_0 * v0 + m_A1_1 * v1;
234
- const A2 = m_A2_0 * v1 + m_A2_1 * v2;
235
- const A3 = m_A3_0 * v2 + m_A3_1 * v3;
236
-
237
- const B1 = m_B1_0 * A1 + m_B1_1 * A2;
238
- const B2 = m_B2_0 * A2 + m_B2_1 * A3;
239
-
240
- return m_C_0 * B1 + m_C_1 * B2;
241
-
242
- }