@woosh/meep-engine 2.43.13 → 2.43.15
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/core/bvh2/aabb3/aabb3_detailed_volume_intersection.js +1 -1
- package/core/bvh2/traversal/__process_point_if_within_planes.js +1 -1
- package/core/geom/3d/SurfacePoint3.d.ts +5 -0
- package/core/geom/3d/plane/is_point_within_planes.js +1 -1
- package/core/geom/3d/plane/plane3_slerp.js +1 -1
- package/core/geom/3d/topology/computeTopoMeshVertexDuplicates.js +2 -1
- package/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +1 -1
- package/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +1 -1
- package/core/geom/3d/topology/weld_duplicate_vertices.js +1 -1
- package/core/geom/ConicRay.js +2 -1
- package/core/geom/Quaternion.js +2 -1
- package/core/geom/Vector3.js +5 -2
- package/core/geom/normalize_angle_rad.js +1 -1
- package/core/geom/random/randomPointInCircle.js +1 -1
- package/core/geom/random/randomPointInSphere.js +1 -1
- package/core/math/EPSILON.js +5 -0
- package/core/math/PI2.js +5 -0
- package/core/math/PI_HALF.js +5 -0
- package/core/math/bezierCurve.js +22 -0
- package/core/math/clamp.spec.js +15 -0
- package/core/math/computeGreatestCommonDivisor.js +28 -0
- package/core/math/computeIsoscelesTriangleApexAngle.js +17 -0
- package/core/math/computeWholeDivisorLow.js +30 -0
- package/core/math/computeWholeDivisorLow.spec.js +9 -0
- package/core/math/copysign.spec.js +13 -0
- package/core/math/cubicCurve.js +34 -0
- package/core/math/cubicCurve.spec.js +13 -0
- package/core/math/{MathUtils.d.ts → epsilonEquals.d.ts} +0 -0
- package/core/math/epsilonEquals.js +16 -0
- package/core/math/hash/computeHashFloat.spec.js +7 -0
- package/core/math/inverseLerp.spec.js +13 -0
- package/core/math/isValueBetween.spec.js +11 -0
- package/core/math/isValueBetweenInclusive.spec.js +16 -0
- package/core/math/lerp.spec.js +15 -0
- package/core/math/makeCubicCurve.js +15 -0
- package/core/math/makeCubicCurve.spec.js +9 -0
- package/core/math/makeSequenceLoop.js +20 -0
- package/core/math/max2.spec.js +13 -0
- package/core/math/max3.spec.js +27 -0
- package/core/math/min2.spec.js +12 -0
- package/core/math/min3.spec.js +27 -0
- package/core/math/normalizeArrayVector.js +25 -0
- package/core/math/overlap1D.spec.js +10 -0
- package/core/math/quadraticCurve.js +11 -0
- package/core/math/quadraticCurve.spec.js +13 -0
- package/core/math/sign.spec.js +13 -0
- package/core/model/stat/Stat.js +2 -1
- package/engine/EngineHarness.js +5 -23
- package/engine/achievements/AchievementManager.js +1 -1
- package/engine/animation/TransitionFunctions.js +1 -1
- package/engine/ecs/gui/position/ViewportPositionSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +1 -1
- package/engine/ecs/terrain/ecs/Terrain.d.ts +7 -0
- package/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +68 -0
- package/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.js +31 -0
- package/engine/ecs/terrain/ecs/{ClingToTerrainSystem.js → cling/ClingToTerrainSystem.js} +52 -34
- package/engine/ecs/terrain/ecs/{ClingToTerrainSystem.spec.js → cling/ClingToTerrainSystem.spec.js} +1 -1
- package/engine/ecs/terrain/tiles/TerrainTile.js +1 -1
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +2 -1
- package/engine/graphics/camera/CameraShake.js +1 -1
- package/engine/graphics/camera/testClippingPlaneComputation.js +1 -1
- package/engine/graphics/ecs/path/entity/EntityPath.js +1 -1
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -1
- package/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +4 -2
- package/engine/graphics/geometry/MikkT/NotZero.js +1 -1
- package/engine/graphics/impostors/octahedral/shader/ImpostorShaderV0.js +14 -288
- package/engine/graphics/micron/render/refinement/is_patch_facing_back.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/engine/graphics/shadows/testShadowMapRendering.js +1 -1
- package/engine/input/ecs/util/TerrainCameraTargetSampler.js +1 -1
- package/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +1 -1
- package/generation/example/themes/SampleTheme0.js +2 -2
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +1 -1
- package/generation/grid/generation/grid/select/CellSupplierBestN.js +1 -1
- package/generation/markers/GridActionRuleSet.js +1 -1
- package/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.js +1 -1
- package/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js +2 -1
- package/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js +2 -1
- package/package.json +1 -1
- package/view/elements/radial/RadialMenuElement.js +1 -1
- package/view/elements/radial/RadialText.js +1 -1
- package/view/tooltip/TooltipView.js +1 -1
- package/core/math/MathUtils.js +0 -247
- package/core/math/MathUtils.spec.js +0 -232
- package/engine/ecs/terrain/ecs/ClingToTerrain.js +0 -100
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { quadraticCurve } from "./quadraticCurve.js";
|
|
2
|
+
|
|
3
|
+
test("quadraticCurve", () => {
|
|
4
|
+
expect(quadraticCurve(2, 0.1, 0.2, 3)).toBe(11.3);
|
|
5
|
+
|
|
6
|
+
expect(quadraticCurve(1, -1, -2, -3)).toBe(-3);
|
|
7
|
+
|
|
8
|
+
expect(quadraticCurve(-1, -1, 0, 0)).toBe(-4);
|
|
9
|
+
|
|
10
|
+
expect(quadraticCurve(-1, -1, 1, 0)).toBe(-8);
|
|
11
|
+
|
|
12
|
+
expect(quadraticCurve(-1, 0, 0, 0)).toBe(0);
|
|
13
|
+
});
|
package/core/model/stat/Stat.js
CHANGED
|
@@ -2,9 +2,10 @@ import { assert } from "../../assert.js";
|
|
|
2
2
|
import List from "../../collection/list/List.js";
|
|
3
3
|
import { chainFunctions } from "../../function/Functions.js";
|
|
4
4
|
import Vector1 from "../../geom/Vector1.js";
|
|
5
|
-
import { EPSILON, epsilonEquals } from "../../math/MathUtils.js";
|
|
6
5
|
import { max2 } from "../../math/max2.js";
|
|
7
6
|
import LinearModifier from "./LinearModifier.js";
|
|
7
|
+
import { epsilonEquals } from "../../math/epsilonEquals.js";
|
|
8
|
+
import { EPSILON } from "../../math/EPSILON.js";
|
|
8
9
|
|
|
9
10
|
class Stat extends Number {
|
|
10
11
|
/**
|
package/engine/EngineHarness.js
CHANGED
|
@@ -28,6 +28,7 @@ import { ConsoleLoggerBackend } from "./logging/ConsoleLoggerBackend.js";
|
|
|
28
28
|
import { noop } from "../core/function/Functions.js";
|
|
29
29
|
import SoundListenerSystem from "./sound/ecs/SoundListenerSystem.js";
|
|
30
30
|
import SoundListener from "./sound/ecs/SoundListener.js";
|
|
31
|
+
import { getURLHash } from "./platform/GetURLHash.js";
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
*
|
|
@@ -35,29 +36,6 @@ import SoundListener from "./sound/ecs/SoundListener.js";
|
|
|
35
36
|
* @returns {Promise}
|
|
36
37
|
*/
|
|
37
38
|
function setLocale(engine) {
|
|
38
|
-
function getURLHash() {
|
|
39
|
-
const result = {};
|
|
40
|
-
|
|
41
|
-
if (window === undefined) {
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const location = window.location;
|
|
46
|
-
|
|
47
|
-
const hash = location.hash;
|
|
48
|
-
|
|
49
|
-
const hashRegEx = /([a-zA-Z0-9\-\_]+)\=([a-zA-Z0-9\-\_]+)/g;
|
|
50
|
-
|
|
51
|
-
let match;
|
|
52
|
-
while ((match = hashRegEx.exec(hash)) !== null) {
|
|
53
|
-
const variableName = match[1];
|
|
54
|
-
const value = match[2];
|
|
55
|
-
|
|
56
|
-
result[variableName] = value;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
39
|
|
|
62
40
|
const urlHash = getURLHash();
|
|
63
41
|
|
|
@@ -83,6 +61,10 @@ export class EngineHarness {
|
|
|
83
61
|
|
|
84
62
|
logger.addBackend(ConsoleLoggerBackend.INSTANCE);
|
|
85
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @readonly
|
|
66
|
+
* @type {Promise|null}
|
|
67
|
+
*/
|
|
86
68
|
this.p = null;
|
|
87
69
|
}
|
|
88
70
|
|
|
@@ -10,7 +10,6 @@ import EntityBuilder from "../ecs/EntityBuilder.js";
|
|
|
10
10
|
import GUIElement from "../ecs/gui/GUIElement.js";
|
|
11
11
|
import AnimationTrack from "../animation/keyed2/AnimationTrack.js";
|
|
12
12
|
import TransitionFunctions from "../animation/TransitionFunctions.js";
|
|
13
|
-
import { makeCubicCurve } from "../../core/math/MathUtils.js";
|
|
14
13
|
import { SequenceBehavior } from "../intelligence/behavior/composite/SequenceBehavior.js";
|
|
15
14
|
import { ActionBehavior } from "../intelligence/behavior/primitive/ActionBehavior.js";
|
|
16
15
|
import { AnimationBehavior } from "../animation/keyed2/behavior/AnimationBehavior.js";
|
|
@@ -24,6 +23,7 @@ import { globalMetrics } from "../metrics/GlobalMetrics.js";
|
|
|
24
23
|
import { MetricsCategory } from "../metrics/MetricsCategory.js";
|
|
25
24
|
import { ClockChannelType } from "../intelligence/behavior/ecs/ClockChannelType.js";
|
|
26
25
|
import { EnginePlugin } from "../plugin/EnginePlugin.js";
|
|
26
|
+
import { makeCubicCurve } from "../../core/math/makeCubicCurve.js";
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
const SLOW_CUBIC = makeCubicCurve(0.04, 0.4, 0.9, 0.99);
|
|
@@ -6,9 +6,9 @@ import ViewportPosition from './ViewportPosition.js';
|
|
|
6
6
|
import GUIElement from "../GUIElement.js";
|
|
7
7
|
import { assert } from "../../../../core/assert.js";
|
|
8
8
|
import { SignalBinding } from "../../../../core/events/signal/SignalBinding.js";
|
|
9
|
-
import { EPSILON } from "../../../../core/math/MathUtils.js";
|
|
10
9
|
import AABB2 from "../../../../core/geom/AABB2.js";
|
|
11
10
|
import { GUIElementEvent } from "../GUIElementEvent.js";
|
|
11
|
+
import { EPSILON } from "../../../../core/math/EPSILON.js";
|
|
12
12
|
|
|
13
13
|
const CSS_CLASS = 'ecs-viewport-position-component';
|
|
14
14
|
|
|
@@ -11,7 +11,7 @@ import Motion from '../components/Motion.js';
|
|
|
11
11
|
import { Transform } from '../transform/Transform.js';
|
|
12
12
|
import Steering, { SteeringEvents, SteeringFlags } from '../components/Steering.js';
|
|
13
13
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
14
|
-
import { alignToVector } from "../terrain/ecs/ClingToTerrainSystem.js";
|
|
14
|
+
import { alignToVector } from "../terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
15
15
|
import { v3_dot } from "../../../core/geom/v3_dot.js";
|
|
16
16
|
import { solveQuadratic } from "../../../core/math/solveQuadratic.js";
|
|
17
17
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Engine from "../../../Engine";
|
|
2
2
|
import {Texture} from "three";
|
|
3
|
+
import {SurfacePoint3} from "../../../../core/geom/3d/SurfacePoint3";
|
|
3
4
|
|
|
4
5
|
export default class Terrain {
|
|
5
6
|
fromJSON(json: any, engine: Engine): void;
|
|
@@ -7,4 +8,10 @@ export default class Terrain {
|
|
|
7
8
|
toJSON(): any
|
|
8
9
|
|
|
9
10
|
buildLightMap(quality: number): Promise<Texture>
|
|
11
|
+
|
|
12
|
+
raycastFirstSync(
|
|
13
|
+
result: SurfacePoint3,
|
|
14
|
+
originX: number, originY: number, originZ: number,
|
|
15
|
+
directionX: number, directionY: number, directionZ: number
|
|
16
|
+
): boolean
|
|
10
17
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Alex on 13/05/2016.
|
|
3
|
+
*/
|
|
4
|
+
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
5
|
+
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
6
|
+
|
|
7
|
+
class ClingToTerrain {
|
|
8
|
+
constructor({ normalAlign = false } = {}) {
|
|
9
|
+
/**
|
|
10
|
+
* @type {boolean}
|
|
11
|
+
*/
|
|
12
|
+
this.normalAlign = normalAlign;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Used internally for caching updates
|
|
16
|
+
* @type {Vector3}
|
|
17
|
+
*/
|
|
18
|
+
this.__lastPosition = new Vector3(0, 0, 0);
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Quaternion}
|
|
22
|
+
*/
|
|
23
|
+
this.__lastRotation = new Quaternion(0, 0, 0, 1);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Speed in Rad/s (Radians/second) by which rotation can change
|
|
27
|
+
* @type {number}
|
|
28
|
+
*/
|
|
29
|
+
this.rotationSpeed = 3;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
toJSON() {
|
|
33
|
+
return {
|
|
34
|
+
normalAlign: this.normalAlign,
|
|
35
|
+
rotationSpeed: this.rotationSpeed
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fromJSON(
|
|
40
|
+
{
|
|
41
|
+
normalAlign = false,
|
|
42
|
+
rotationSpeed = Number.POSITIVE_INFINITY
|
|
43
|
+
}
|
|
44
|
+
) {
|
|
45
|
+
this.normalAlign = normalAlign;
|
|
46
|
+
this.rotationSpeed = rotationSpeed;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param json
|
|
52
|
+
* @returns {ClingToTerrain}
|
|
53
|
+
*/
|
|
54
|
+
static fromJSON(json) {
|
|
55
|
+
const r = new ClingToTerrain();
|
|
56
|
+
|
|
57
|
+
r.fromJSON(json);
|
|
58
|
+
|
|
59
|
+
return r;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ClingToTerrain.typeName = "ClingToTerrain";
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export default ClingToTerrain;
|
|
67
|
+
|
|
68
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../../../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import ClingToTerrain from "./ClingToTerrain.js";
|
|
3
|
+
|
|
4
|
+
export class ClingToTerrainSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
|
|
8
|
+
this.klass = ClingToTerrain;
|
|
9
|
+
this.version = 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {BinaryBuffer} buffer
|
|
15
|
+
* @param {ClingToTerrain} value
|
|
16
|
+
*/
|
|
17
|
+
serialize(buffer, value) {
|
|
18
|
+
//TODO serialize rotation speed
|
|
19
|
+
buffer.writeUint8(value.normalAlign ? 1 : 0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {BinaryBuffer} buffer
|
|
25
|
+
* @param {ClingToTerrain} value
|
|
26
|
+
*/
|
|
27
|
+
deserialize(buffer, value) {
|
|
28
|
+
//TODO deserialize rotation speed
|
|
29
|
+
value.normalAlign = buffer.readUint8() !== 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 13/05/2016.
|
|
3
3
|
*/
|
|
4
|
-
import { min2 } from "
|
|
5
|
-
import { System } from '
|
|
6
|
-
import { Transform } from '
|
|
4
|
+
import { min2 } from "../../../../../core/math/min2.js";
|
|
5
|
+
import { System } from '../../../System.js';
|
|
6
|
+
import { Transform } from '../../../transform/Transform.js';
|
|
7
7
|
|
|
8
8
|
import ClingToTerrain from './ClingToTerrain.js';
|
|
9
9
|
|
|
10
|
-
import Vector3 from '
|
|
11
|
-
import Quaternion from "
|
|
12
|
-
import { EPSILON } from "../../../../core/math/MathUtils.js";
|
|
10
|
+
import Vector3 from '../../../../../core/geom/Vector3.js';
|
|
11
|
+
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
13
12
|
import { Matrix4 } from "three";
|
|
14
|
-
import { assert } from "
|
|
15
|
-
import { SurfacePoint3 } from "
|
|
16
|
-
import { Deque } from "
|
|
17
|
-
import { obtainTerrain } from "
|
|
18
|
-
import { clamp01 } from "
|
|
13
|
+
import { assert } from "../../../../../core/assert.js";
|
|
14
|
+
import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
|
|
15
|
+
import { Deque } from "../../../../../core/collection/queue/Deque.js";
|
|
16
|
+
import { obtainTerrain } from "../../util/obtainTerrain.js";
|
|
17
|
+
import { clamp01 } from "../../../../../core/math/clamp01.js";
|
|
18
|
+
import { EPSILON } from "../../../../../core/math/EPSILON.js";
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -24,6 +24,10 @@ import { clamp01 } from "../../../../core/math/clamp01.js";
|
|
|
24
24
|
*/
|
|
25
25
|
const temp_sp = new SurfacePoint3();
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {{update:function,transform:Transform}} datum
|
|
30
|
+
*/
|
|
27
31
|
function deregister(datum) {
|
|
28
32
|
const update = datum.update;
|
|
29
33
|
|
|
@@ -33,6 +37,14 @@ function deregister(datum) {
|
|
|
33
37
|
transform.rotation.onChanged.remove(update);
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
/**
|
|
41
|
+
* How many entities can be updated in a single tick, this is useful for performance optimization.
|
|
42
|
+
* If you have a large number of entities that need to be updated, updates can be executed over several ticks
|
|
43
|
+
* @readonly
|
|
44
|
+
* @type {number}
|
|
45
|
+
*/
|
|
46
|
+
const DEFAULT_UPDATE_LIMIT = 1024;
|
|
47
|
+
|
|
36
48
|
class ClingToTerrainSystem extends System {
|
|
37
49
|
/**
|
|
38
50
|
*
|
|
@@ -49,14 +61,19 @@ class ClingToTerrainSystem extends System {
|
|
|
49
61
|
*/
|
|
50
62
|
this.entityManager = null;
|
|
51
63
|
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @type {Deque<number>}
|
|
67
|
+
*/
|
|
52
68
|
this.updateQueue = new Deque();
|
|
69
|
+
|
|
53
70
|
this.data = [];
|
|
54
71
|
|
|
55
72
|
/**
|
|
56
73
|
* How many entities can be updated in a single tick, this is useful for performance optimization, if you have a large number of entities that need to be updated, updates can be executed over several ticks
|
|
57
74
|
* @type {number}
|
|
58
75
|
*/
|
|
59
|
-
this.updateBatchLimit =
|
|
76
|
+
this.updateBatchLimit = DEFAULT_UPDATE_LIMIT;
|
|
60
77
|
}
|
|
61
78
|
|
|
62
79
|
requestUpdate(entity) {
|
|
@@ -146,34 +163,35 @@ class ClingToTerrainSystem extends System {
|
|
|
146
163
|
|
|
147
164
|
const terrain = obtainTerrain(dataset);
|
|
148
165
|
|
|
149
|
-
if (terrain
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
this.updateBatchLimit
|
|
153
|
-
);
|
|
166
|
+
if (terrain === null) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
154
169
|
|
|
170
|
+
const batchSize = min2(
|
|
171
|
+
updateCandidates.size(),
|
|
172
|
+
this.updateBatchLimit
|
|
173
|
+
);
|
|
155
174
|
|
|
156
|
-
|
|
157
|
-
|
|
175
|
+
for (let i = 0; i < batchSize; i++) {
|
|
176
|
+
const entity = updateCandidates.removeFirst();
|
|
158
177
|
|
|
159
|
-
|
|
178
|
+
const c = this.data[entity];
|
|
160
179
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
180
|
+
if (c === undefined) {
|
|
181
|
+
/*
|
|
182
|
+
this should never happen as update queue is cleaned up when component is removed
|
|
183
|
+
the entity is gone
|
|
184
|
+
*/
|
|
166
185
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
186
|
+
console.warn("ClingToTerrain component was in the update queue, but no data found. Skipping");
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
170
189
|
|
|
171
|
-
|
|
190
|
+
const position_updated = doCling(c, terrain, timeDelta);
|
|
172
191
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
192
|
+
if (!position_updated) {
|
|
193
|
+
// no change, move back to update candidates
|
|
194
|
+
this.requestUpdate(entity);
|
|
177
195
|
}
|
|
178
196
|
}
|
|
179
197
|
}
|
|
@@ -315,7 +333,7 @@ function doCling(el, terrain, timeDelta) {
|
|
|
315
333
|
&& cling.__lastRotation.roughlyEquals(rotation, 0.0001)
|
|
316
334
|
) {
|
|
317
335
|
//do nothing, cached position matches with existing position
|
|
318
|
-
return;
|
|
336
|
+
return false;
|
|
319
337
|
}
|
|
320
338
|
|
|
321
339
|
const hit_found = terrain.raycastVerticalFirstSync(temp_sp, position.x, position.z);
|
|
@@ -212,7 +212,7 @@ class TerrainTile {
|
|
|
212
212
|
* @param {TerrainTile|undefined} bottomLeft
|
|
213
213
|
* @param {TerrainTile|undefined} bottomRight
|
|
214
214
|
*/
|
|
215
|
-
|
|
215
|
+
stitchNormals(top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight) {
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
const v0 = new Vector3(),
|
|
@@ -516,6 +516,7 @@ class TerrainTileManager {
|
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
/**
|
|
519
|
+
* Fix normals along the seams of the tile
|
|
519
520
|
*
|
|
520
521
|
* @param {number} x
|
|
521
522
|
* @param {number} y
|
|
@@ -556,7 +557,7 @@ class TerrainTileManager {
|
|
|
556
557
|
right = self.getRaw(x + 1, y);
|
|
557
558
|
}
|
|
558
559
|
|
|
559
|
-
tile.
|
|
560
|
+
tile.stitchNormals(top, bottom, left, right, topLeft, topRight, bottomLeft, bottomRight);
|
|
560
561
|
}
|
|
561
562
|
|
|
562
563
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
2
2
|
|
|
3
3
|
import SimplexNoise from 'simplex-noise';
|
|
4
|
-
import { makeCubicCurve } from "../../../core/math/MathUtils.js";
|
|
5
4
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
6
5
|
import { Behavior } from "../../intelligence/behavior/Behavior.js";
|
|
7
6
|
import { BehaviorStatus } from "../../intelligence/behavior/BehaviorStatus.js";
|
|
8
7
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
9
8
|
import { clamp01 } from "../../../core/math/clamp01.js";
|
|
9
|
+
import { makeCubicCurve } from "../../../core/math/makeCubicCurve.js";
|
|
10
10
|
|
|
11
11
|
export class CameraShakeTraumaBehavior extends Behavior {
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ import TopDownCameraControllerSystem from "../ecs/camera/topdown/TopDownCameraCo
|
|
|
17
17
|
import { TopDownCameraLanderSystem } from "../ecs/camera/topdown/TopDownCameraLanderSystem.js";
|
|
18
18
|
import { CameraSystem } from "../ecs/camera/CameraSystem.js";
|
|
19
19
|
import { MeshSystem } from "../ecs/mesh/MeshSystem.js";
|
|
20
|
-
import ClingToTerrainSystem from "../../ecs/terrain/ecs/ClingToTerrainSystem.js";
|
|
20
|
+
import ClingToTerrainSystem from "../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
21
21
|
import TerrainSystem from "../../ecs/terrain/ecs/TerrainSystem.js";
|
|
22
22
|
import WaterSystem from "../ecs/water/WaterSystem.js";
|
|
23
23
|
import Trail2DSystem from "../ecs/trail2d/Trail2DSystem.js";
|
|
@@ -2,9 +2,9 @@ import { IllegalStateException } from "../../../../../core/fsm/exceptions/Illega
|
|
|
2
2
|
import { EntityPathMarker } from "./EntityPathMarker.js";
|
|
3
3
|
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
4
4
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
5
|
-
import { EPSILON } from "../../../../../core/math/MathUtils.js";
|
|
6
5
|
import { assert } from "../../../../../core/assert.js";
|
|
7
6
|
import { binarySearchHighIndex } from "../../../../../core/collection/array/binarySearchHighIndex.js";
|
|
7
|
+
import { EPSILON } from "../../../../../core/math/EPSILON.js";
|
|
8
8
|
|
|
9
9
|
const scratch_v3 = new Vector3();
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ import TopDownCameraControllerSystem from "../camera/topdown/TopDownCameraContro
|
|
|
25
25
|
import { TopDownCameraLanderSystem } from "../camera/topdown/TopDownCameraLanderSystem.js";
|
|
26
26
|
import { CameraSystem } from "../camera/CameraSystem.js";
|
|
27
27
|
import { MeshSystem } from "../mesh/MeshSystem.js";
|
|
28
|
-
import ClingToTerrainSystem from "../../../ecs/terrain/ecs/ClingToTerrainSystem.js";
|
|
28
|
+
import ClingToTerrainSystem from "../../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
29
29
|
import TerrainSystem from "../../../ecs/terrain/ecs/TerrainSystem.js";
|
|
30
30
|
import WaterSystem from "../water/WaterSystem.js";
|
|
31
31
|
import Trail2DSystem from "../trail2d/Trail2DSystem.js";
|
|
@@ -18,7 +18,7 @@ import TopDownCameraControllerSystem from "../../camera/topdown/TopDownCameraCon
|
|
|
18
18
|
import { TopDownCameraLanderSystem } from "../../camera/topdown/TopDownCameraLanderSystem.js";
|
|
19
19
|
import { CameraSystem } from "../../camera/CameraSystem.js";
|
|
20
20
|
import { MeshSystem } from "../../mesh/MeshSystem.js";
|
|
21
|
-
import ClingToTerrainSystem from "../../../../ecs/terrain/ecs/ClingToTerrainSystem.js";
|
|
21
|
+
import ClingToTerrainSystem from "../../../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
22
22
|
import TerrainSystem from "../../../../ecs/terrain/ecs/TerrainSystem.js";
|
|
23
23
|
import WaterSystem from "../../water/WaterSystem.js";
|
|
24
24
|
import Trail2DSystem from "../../trail2d/Trail2DSystem.js";
|
|
@@ -39,7 +39,9 @@ import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSy
|
|
|
39
39
|
import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
|
|
40
40
|
import { InverseKinematicsSystem } from "../../../../ecs/animation/InverseKinematicsSystem.js";
|
|
41
41
|
import { PathDisplaySystem } from "../PathDisplaySystem.js";
|
|
42
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
AmbientOcclusionPostProcessEffect
|
|
44
|
+
} from "../../../render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
|
|
43
45
|
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
44
46
|
import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
|
|
45
47
|
import { JsonAssetLoader } from "../../../../asset/loaders/JsonAssetLoader.js";
|