@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,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 01/04/2014.
|
|
3
|
-
*/
|
|
4
|
-
import { System } from '../System.js';
|
|
5
|
-
import PhysicalBody from '../components/PhysicalBody.js';
|
|
6
|
-
import { Transform } from '../transform/Transform.js';
|
|
7
|
-
import PhysicsWorld from '../../physics/ammo/World.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class PhysicsSystem extends System {
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
|
|
14
|
-
this.dependencies = [PhysicalBody];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
rayTest(from, to, callback) {
|
|
18
|
-
this.physics.rayTest(from, to, callback);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
startup(entityManager, readyCallback, errorCallback) {
|
|
22
|
-
this.entityManager = entityManager;
|
|
23
|
-
this.physics = new PhysicsWorld(readyCallback);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
shutdown(entityManager, readyCallback, errorCallback) {
|
|
27
|
-
try {
|
|
28
|
-
this.physics = null;
|
|
29
|
-
readyCallback();
|
|
30
|
-
} catch (e) {
|
|
31
|
-
errorCallback(e);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
add(component, entity) {
|
|
36
|
-
const body = component.body;
|
|
37
|
-
body.__entity = entity;
|
|
38
|
-
this.physics.addBody(body);
|
|
39
|
-
//collisions
|
|
40
|
-
if (component.notifyCollision) {
|
|
41
|
-
const entityManager = this.entityManager;
|
|
42
|
-
|
|
43
|
-
body.onCollision(function (other) {
|
|
44
|
-
entityManager.sendEvent(entity, "collision", other.__entity);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
remove(component) {
|
|
50
|
-
const body = component.body;
|
|
51
|
-
this.physics.removeBody(body);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
update(timeDelta) {
|
|
55
|
-
const entityManager = this.entityManager;
|
|
56
|
-
let signals = entityManager.eventManager.signals;
|
|
57
|
-
//set position to physical body
|
|
58
|
-
entityManager.traverseEntities([PhysicalBody, Transform], function (physicalBody, transform) {
|
|
59
|
-
//copy position into body
|
|
60
|
-
const body = physicalBody.body;
|
|
61
|
-
body.position.copy(transform.position);
|
|
62
|
-
body.rotation.copy(transform.rotation);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const stepFinishedCallback = function () {
|
|
67
|
-
//set position from physical body
|
|
68
|
-
entityManager.traverseEntities([PhysicalBody, Transform], function (physicalBody, transform, entity) {
|
|
69
|
-
//copy position from body
|
|
70
|
-
const body = physicalBody.body;
|
|
71
|
-
const previousPosition = transform.previousPosition;
|
|
72
|
-
const currentPosition = transform.position;
|
|
73
|
-
if (previousPosition.x != currentPosition.x || previousPosition.y != currentPosition.y || previousPosition.z != currentPosition.z) {
|
|
74
|
-
//write previous position is the current position is different from before
|
|
75
|
-
previousPosition.copy(currentPosition);
|
|
76
|
-
}
|
|
77
|
-
currentPosition.copy(body.position);
|
|
78
|
-
// transform.rotation.copy(body.rotation);
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
this.physics.simulate(timeDelta, stepFinishedCallback);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
function collisionHandler() {
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default PhysicsSystem;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 13/04/2017.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { System } from '../System.js';
|
|
7
|
-
import PropertySet from '../components/PropertySet.js';
|
|
8
|
-
|
|
9
|
-
class PropertySetSystem extends System {
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
|
|
13
|
-
this.dependencies = [PropertySet];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export default PropertySetSystem;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User: Alex Goldring
|
|
3
|
-
* Date: 1/6/2014
|
|
4
|
-
* Time: 08:37
|
|
5
|
-
*/
|
|
6
|
-
import { max2 } from "../../../core/math/max2.js";
|
|
7
|
-
import { min2 } from "../../../core/math/min2.js";
|
|
8
|
-
import { System } from '../System.js';
|
|
9
|
-
import PhysicalBody from '../components/PhysicalBody.js';
|
|
10
|
-
import Motion from '../components/Motion.js';
|
|
11
|
-
import { Transform } from '../transform/Transform.js';
|
|
12
|
-
import Steering, { SteeringEvents, SteeringFlags } from '../components/Steering.js';
|
|
13
|
-
import Vector3 from "../../../core/geom/Vector3.js";
|
|
14
|
-
import { alignToVector } from "../terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
15
|
-
import { v3_dot } from "../../../core/geom/vec3/v3_dot.js";
|
|
16
|
-
import { solveQuadratic } from "../../../core/math/solveQuadratic.js";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param {Vector3} result
|
|
21
|
-
* @param {Vector3} source
|
|
22
|
-
* @param {Vector3} target
|
|
23
|
-
* @param {Vector3} targetVelocity
|
|
24
|
-
* @param {number} sourceSpeed
|
|
25
|
-
* @return {boolean}
|
|
26
|
-
*/
|
|
27
|
-
function computeInterceptPoint(result, source, target, targetVelocity, sourceSpeed) {
|
|
28
|
-
const d_ts_x = target.x - source.x;
|
|
29
|
-
const d_ts_y = target.y - source.y;
|
|
30
|
-
const d_ts_z = target.z - source.z;
|
|
31
|
-
|
|
32
|
-
// Get quadratic equation components
|
|
33
|
-
const a = targetVelocity.dot(targetVelocity) - sourceSpeed * sourceSpeed;
|
|
34
|
-
const b = 2 * v3_dot(targetVelocity.x, targetVelocity.y, targetVelocity.z, d_ts_x, d_ts_y, d_ts_z);
|
|
35
|
-
|
|
36
|
-
const c = v3_dot(
|
|
37
|
-
d_ts_x, d_ts_y, d_ts_z,
|
|
38
|
-
d_ts_x, d_ts_y, d_ts_z
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
// Solve quadratic
|
|
42
|
-
const ts = [];
|
|
43
|
-
const root_count = solveQuadratic(ts, 0, a, b, c); // See quad(), below
|
|
44
|
-
|
|
45
|
-
// Find smallest positive solution
|
|
46
|
-
if (root_count > 0) {
|
|
47
|
-
const t0 = ts[0], t1 = ts[1];
|
|
48
|
-
let t = Math.min(t0, t1);
|
|
49
|
-
if (t < 0) t = Math.max(t0, t1);
|
|
50
|
-
|
|
51
|
-
if (t > 0) {
|
|
52
|
-
result.copy(targetVelocity).multiplyScalar(t).add(target);
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
class SteeringSystem extends System {
|
|
61
|
-
constructor() {
|
|
62
|
-
super();
|
|
63
|
-
|
|
64
|
-
this.dependencies = [Steering];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
update(timeDelta) {
|
|
68
|
-
const entityManager = this.entityManager;
|
|
69
|
-
|
|
70
|
-
const ecd = entityManager.dataset;
|
|
71
|
-
|
|
72
|
-
if (ecd === null) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
* @param {number} entity
|
|
79
|
-
* @param {Steering} steering
|
|
80
|
-
* @param {Transform} transform
|
|
81
|
-
* @param {Vector3} velocity
|
|
82
|
-
*/
|
|
83
|
-
function process(entity, steering, transform, velocity) {
|
|
84
|
-
if (!steering.getFlag(SteeringFlags.Active)) {
|
|
85
|
-
//steering is inactive
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const destination = steering.destination;
|
|
90
|
-
|
|
91
|
-
const delta = destination.clone().sub(transform.position);
|
|
92
|
-
delta.normalize();
|
|
93
|
-
|
|
94
|
-
const distanceWithError = computeDistanceWithError(transform.position, destination, steering.targetMargin);
|
|
95
|
-
|
|
96
|
-
if (distanceWithError > 0) {
|
|
97
|
-
//not at the target yet
|
|
98
|
-
const d = steering.maxSpeed;
|
|
99
|
-
|
|
100
|
-
const angularLimit = steering.rotationSpeed * timeDelta;
|
|
101
|
-
|
|
102
|
-
alignToVector(transform.rotation, delta, angularLimit, Vector3.up, Vector3.forward);
|
|
103
|
-
|
|
104
|
-
//compute forward vector
|
|
105
|
-
const v = Vector3.forward.clone();
|
|
106
|
-
v.applyQuaternion(transform.rotation);
|
|
107
|
-
v.normalize();
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
//check old velocity to avoid flying past target
|
|
111
|
-
if (distanceWithError < d * timeDelta) {
|
|
112
|
-
const distance = delta.length();
|
|
113
|
-
const adjustedVelocity = min2(d, distance / timeDelta);
|
|
114
|
-
v.multiplyScalar(adjustedVelocity);
|
|
115
|
-
} else {
|
|
116
|
-
v.multiplyScalar(d);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
velocity.copy(v);
|
|
120
|
-
|
|
121
|
-
} else {
|
|
122
|
-
//goal is reached, de-activate
|
|
123
|
-
steering.clearFlag(SteeringFlags.Active);
|
|
124
|
-
|
|
125
|
-
//drop velocity
|
|
126
|
-
velocity.set(0, 0, 0);
|
|
127
|
-
|
|
128
|
-
//dispatch
|
|
129
|
-
ecd.sendEvent(entity, SteeringEvents.DestinationReached, steering);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
//Make sure physical bodies exist
|
|
134
|
-
if (ecd.isComponentTypeRegistered(PhysicalBody)) {
|
|
135
|
-
|
|
136
|
-
ecd.traverseEntities([Steering, PhysicalBody, Transform], function (steering, physicalBody, transform, entity) {
|
|
137
|
-
|
|
138
|
-
const body = physicalBody.body;
|
|
139
|
-
|
|
140
|
-
process(entity, steering, transform, body.linearVelocity);
|
|
141
|
-
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
ecd.traverseEntities([Steering, Motion, Transform], function (steering, motion, transform, entity) {
|
|
147
|
-
process(entity, steering, transform, motion.velocity);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
* @param {Vector3} v0
|
|
155
|
-
* @param {Vector3} v1
|
|
156
|
-
* @param {Vector3} error
|
|
157
|
-
* @return {number}
|
|
158
|
-
*/
|
|
159
|
-
function computeDistanceWithError(v0, v1, error) {
|
|
160
|
-
const absDelta = v0.clone().sub(v1).abs();
|
|
161
|
-
|
|
162
|
-
absDelta.set(
|
|
163
|
-
max2(absDelta.x - error.x, 0),
|
|
164
|
-
max2(absDelta.y - error.y, 0),
|
|
165
|
-
max2(absDelta.z - error.z, 0)
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
return absDelta.length();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export default SteeringSystem;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 23/04/2014.
|
|
3
|
-
*/
|
|
4
|
-
import { System } from '../System.js';
|
|
5
|
-
import Tag from '../components/Tag.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TagSystem extends System {
|
|
9
|
-
|
|
10
|
-
dependencies = [Tag];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {string} tag
|
|
15
|
-
* @param {EntityComponentDataset} ecd
|
|
16
|
-
* @returns {number[]}
|
|
17
|
-
*/
|
|
18
|
-
static find_entities_with_tag(tag, ecd) {
|
|
19
|
-
const r = [];
|
|
20
|
-
ecd.traverseComponents(Tag, (t, e) => {
|
|
21
|
-
if (t.contains(tag)) {
|
|
22
|
-
r.push(e);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return r;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export default TagSystem;
|