@woosh/meep-engine 2.110.13 → 2.110.14
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/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Fully featured ECS game engine written in JavaScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.110.
|
|
8
|
+
"version": "2.110.14",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"gl-matrix": "3.4.3",
|
|
42
42
|
"opentype.js": "1.3.3",
|
|
43
43
|
"robust-predicates": "3.0.2",
|
|
44
|
-
"simplex-noise": "2.4.0",
|
|
45
44
|
"pako": "2.0.3"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
@@ -13,12 +13,12 @@ export class CameraShake {
|
|
|
13
13
|
* @type {Vector3}
|
|
14
14
|
*/
|
|
15
15
|
limitsOffset: Vector3;
|
|
16
|
-
noiseRotataionX:
|
|
17
|
-
noiseRotataionY:
|
|
18
|
-
noiseRotataionZ:
|
|
19
|
-
noiseOffsetX:
|
|
20
|
-
noiseOffsetY:
|
|
21
|
-
noiseOffsetZ:
|
|
16
|
+
noiseRotataionX: (x: number, y: number) => number;
|
|
17
|
+
noiseRotataionY: (x: number, y: number) => number;
|
|
18
|
+
noiseRotataionZ: (x: number, y: number) => number;
|
|
19
|
+
noiseOffsetX: (x: number, y: number) => number;
|
|
20
|
+
noiseOffsetY: (x: number, y: number) => number;
|
|
21
|
+
noiseOffsetZ: (x: number, y: number) => number;
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
24
|
* @param {number} value between 0 and 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraShake.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/camera/CameraShake.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAIQ,aAAa;IAEb;;;OAGG;IACH,gBAFU,OAAO,CAEkB;IAEnC;;;OAGG;IACH,cAFU,OAAO,CAEgB;IAKjC,
|
|
1
|
+
{"version":3,"file":"CameraShake.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/camera/CameraShake.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAIQ,aAAa;IAEb;;;OAGG;IACH,gBAFU,OAAO,CAEkB;IAEnC;;;OAGG;IACH,cAFU,OAAO,CAEgB;IAKjC,kDAAiD;IACjD,kDAAiD;IACjD,kDAAiD;IAEjD,+CAA8C;IAC9C,+CAA8C;IAC9C,+CAA8C;IAIlD;;;;;;OAMG;IACH,YALW,MAAM,QACN,MAAM,UACN,OAAO,YACP,OAAO,QAyBjB;CAGJ;oBAvEmB,+BAA+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import SimplexNoise from 'simplex-noise';
|
|
2
1
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
2
|
+
import { create_simplex_noise_2d } from "../../../core/math/noise/create_simplex_noise_2d.js";
|
|
3
3
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -26,13 +26,13 @@ export class CameraShake {
|
|
|
26
26
|
|
|
27
27
|
const r = seededRandom(1);
|
|
28
28
|
|
|
29
|
-
this.noiseRotataionX =
|
|
30
|
-
this.noiseRotataionY =
|
|
31
|
-
this.noiseRotataionZ =
|
|
29
|
+
this.noiseRotataionX = create_simplex_noise_2d(r);
|
|
30
|
+
this.noiseRotataionY = create_simplex_noise_2d(r);
|
|
31
|
+
this.noiseRotataionZ = create_simplex_noise_2d(r);
|
|
32
32
|
|
|
33
|
-
this.noiseOffsetX =
|
|
34
|
-
this.noiseOffsetY =
|
|
35
|
-
this.noiseOffsetZ =
|
|
33
|
+
this.noiseOffsetX = create_simplex_noise_2d(r);
|
|
34
|
+
this.noiseOffsetY = create_simplex_noise_2d(r);
|
|
35
|
+
this.noiseOffsetZ = create_simplex_noise_2d(r);
|
|
36
36
|
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -52,9 +52,9 @@ export class CameraShake {
|
|
|
52
52
|
const nRZ = this.noiseRotataionZ;
|
|
53
53
|
|
|
54
54
|
rotation.set(
|
|
55
|
-
this.limitsRotation.x * value *
|
|
56
|
-
this.limitsRotation.y * value *
|
|
57
|
-
this.limitsRotation.z * value *
|
|
55
|
+
this.limitsRotation.x * value * nRX(t, 1),
|
|
56
|
+
this.limitsRotation.y * value * nRY(t, 2),
|
|
57
|
+
this.limitsRotation.z * value * nRZ(t, 3),
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
const nOX = this.noiseOffsetX;
|
|
@@ -62,9 +62,9 @@ export class CameraShake {
|
|
|
62
62
|
const nOZ = this.noiseOffsetZ;
|
|
63
63
|
|
|
64
64
|
offset.set(
|
|
65
|
-
this.limitsOffset.x * value *
|
|
66
|
-
this.limitsOffset.y * value *
|
|
67
|
-
this.limitsOffset.z * value *
|
|
65
|
+
this.limitsOffset.x * value * nOX(t, 1),
|
|
66
|
+
this.limitsOffset.y * value * nOY(t, 2),
|
|
67
|
+
this.limitsOffset.z * value * nOZ(t, 3)
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import SimplexNoise from 'simplex-noise';
|
|
2
1
|
import { makeEngineOptionsModel } from "../../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
3
2
|
import { enableEditor } from "../../../../../../editor/enableEditor.js";
|
|
4
3
|
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
5
4
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
5
|
+
import { create_simplex_noise_2d } from "../../../../../core/math/noise/create_simplex_noise_2d.js";
|
|
6
6
|
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
|
7
7
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
8
8
|
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
@@ -106,16 +106,16 @@ function seedTerrain(terrain, seed) {
|
|
|
106
106
|
|
|
107
107
|
const random = seededRandom(seed);
|
|
108
108
|
|
|
109
|
-
const noise =
|
|
109
|
+
const noise = create_simplex_noise_2d(random);
|
|
110
110
|
|
|
111
111
|
for (let i = 0; i < w; i++) {
|
|
112
112
|
const u = i / 20;
|
|
113
113
|
for (let j = 0; j < h; j++) {
|
|
114
114
|
const v = j / 20;
|
|
115
115
|
|
|
116
|
-
const noise_value_0 = noise
|
|
116
|
+
const noise_value_0 = noise(u, v);
|
|
117
117
|
|
|
118
|
-
const noise_value_1 = noise
|
|
118
|
+
const noise_value_1 = noise(u * 0.17 + 0.1231, v * 0.17 + 0.1231);
|
|
119
119
|
|
|
120
120
|
const noise_final = noise_value_0 * 0.7 + noise_value_1 * 0.3;
|
|
121
121
|
|