@woosh/meep-engine 2.75.8 → 2.76.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.
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +784 -982
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +784 -982
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +6 -3
- package/editor/actions/concrete/PatchTerrainTextureAction.js +6 -3
- package/editor/process/EditorProcess.js +12 -16
- package/editor/process/ProcessEngine.js +9 -10
- package/package.json +1 -1
- package/src/core/binary/dec2hex.js +1 -1
- package/src/{engine/ecs/ik/IKMath.js → core/geom/vec3/v3_computeOffsetVector.js} +1 -1
- package/src/core/math/newton_solver_1d.js +13 -4
- package/src/{engine/graphics → core/math/random}/generate_halton_jitter.js +2 -2
- package/src/core/math/solveQuadratic.js +5 -3
- package/src/core/math/spline/catmull_rom_compute_T.js +19 -0
- package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSpline.js +3 -3
- package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSplineUniformDistance.js +3 -3
- package/src/core/math/spline/computeNonuniformCatmullRomSplineSample.js +109 -0
- package/src/core/math/spline/interpolate_bicubic.js +12 -0
- package/src/core/math/spline/spline_catmullrom_1d.js +120 -0
- package/src/engine/control/ControlContext.js +25 -27
- package/src/engine/ecs/EntityManager.js +12 -9
- package/src/engine/ecs/EntityObserver.js +26 -22
- package/src/engine/ecs/binding/ComponentPropertyPath.js +12 -12
- package/src/engine/ecs/components/Motion.js +5 -7
- package/src/engine/ecs/components/SerializationMetadata.js +5 -3
- package/src/engine/ecs/dynamic_actions/actions/definition/AbstractActionDescription.js +0 -2
- package/src/engine/ecs/dynamic_actions/actions/definition/ActionSequenceDescription.js +7 -9
- package/src/engine/ecs/dynamic_actions/actions/definition/DelayActionDescription.js +3 -5
- package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +6 -8
- package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +14 -17
- package/src/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +8 -11
- package/src/engine/ecs/dynamic_actions/actions/definition/WriteToBlackboardActionDescription.js +15 -18
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +7 -7
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +6 -6
- package/src/engine/ecs/parent/EntityNode.js +39 -37
- package/src/engine/ecs/speaker/VoiceSystem.js +36 -39
- package/src/engine/ecs/system/SystemEntityContext.js +25 -23
- package/src/engine/ecs/tag/find_entities_with_tag.js +18 -0
- package/src/engine/ecs/terrain/TerrainClouds.js +23 -24
- package/src/engine/ecs/terrain/ecs/splat/SplatMapMaterialPatch.js +5 -2
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +15 -14
- package/src/engine/ecs/tooltip/TooltipComponent.js +6 -7
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -5
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
- package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +12 -14
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +22 -20
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -4
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -4
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -4
- package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -11
- package/src/engine/graphics/texture/sampler/Sampler2D.js +15 -366
- package/src/engine/graphics/texture/sampler/Sampler2D.spec.js +0 -31
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +166 -0
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.spec.js +31 -0
- package/src/engine/graphics/texture/sampler/sampler2d_paint.js +81 -0
- package/src/engine/graphics/texture/sampler/sampler2d_sub_copy_same_item_size.js +50 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +1 -1
- package/src/engine/navigation/ecs/components/Path.js +10 -9
- package/src/engine/physics/computeInterceptPoint.js +44 -0
- package/src/engine/plugin/EnginePlugin.js +1 -2
- package/src/engine/ecs/components/AlignToVelocity.js +0 -9
- package/src/engine/ecs/components/CharacterController.js +0 -31
- package/src/engine/ecs/components/PhysicalBody.js +0 -51
- package/src/engine/ecs/components/Steering.js +0 -111
- package/src/engine/ecs/components/SteeringSerializationAdapter.js +0 -34
- package/src/engine/ecs/systems/AlignToVelocitySystem.js +0 -51
- package/src/engine/ecs/systems/CharacterControlSystem.js +0 -134
- package/src/engine/ecs/systems/PhysicsSystem.js +0 -89
- package/src/engine/ecs/systems/PropertySetSystem.js +0 -18
- package/src/engine/ecs/systems/SteeringSystem.js +0 -171
- package/src/engine/ecs/systems/TagSystem.d.ts +0 -5
- package/src/engine/ecs/systems/TagSystem.js +0 -31
- package/src/engine/graphics/CanvasBlur.js +0 -599
- package/src/engine/graphics/material/LoadMaterial.js +0 -199
- package/src/engine/graphics/material/getTextureImmediate.js +0 -21
- package/src/engine/graphics/render/buffer/RenderGraph.js +0 -177
- package/src/engine/graphics/render/buffer/RenderGraphUtils.js +0 -32
- package/src/engine/graphics/render/buffer/buffers/DepthFrameBuffer.js +0 -101
- package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnection.js +0 -43
- package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionEndpoint.js +0 -39
- package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionValidator.js +0 -30
- package/src/engine/graphics/render/buffer/executor/FrameBufferPool.js +0 -127
- package/src/engine/graphics/render/buffer/executor/RenderGraphExecutor.js +0 -261
- package/src/engine/graphics/render/buffer/executor/RenderProgramCommandType.js +0 -5
- package/src/engine/graphics/render/buffer/node/DeferredRenderProgramDefinition.js +0 -142
- package/src/engine/graphics/render/buffer/node/RenderProgramDefinition.js +0 -21
- package/src/engine/graphics/render/buffer/node/RenderProgramInstance.js +0 -30
- package/src/engine/graphics/render/buffer/node/ScreenSpaceRenderProgramDefinition.js +0 -118
- package/src/engine/graphics/render/staged/PostProcessingEffect.js +0 -32
- package/src/engine/graphics/render/staged/PostProcessingEffectInputCoupling.js +0 -41
- package/src/engine/graphics/render/staged/PostProcessingStack.js +0 -29
- package/src/engine/graphics/render/staged/StagedRenderer.js +0 -161
- package/src/engine/graphics/render/staged/StandardRenderOutputs.js +0 -20
- package/src/engine/graphics/texture/CanvasClone.js +0 -28
- package/src/engine/graphics/texture/sampler/bicubic.js +0 -59
- package/src/engine/graphics/texture/sampler/bicubic.spec.js +0 -13
- package/src/engine/graphics/texture/sampler/differenceSampler.js +0 -36
- package/src/engine/graphics/texture/sampler/loadSampler2D.js +0 -41
- package/src/engine/graphics/texture/sampler/mergeSampler2D.js +0 -96
- package/src/engine/graphics/texture/sampler/rgbaData2valueSampler2D.js +0 -38
- package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +0 -242
- /package/src/{engine/graphics/texture → core/math/noise}/noise_octaves.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
|
-
}
|
|
File without changes
|