@woosh/meep-engine 2.33.31 → 2.33.35

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.
@@ -20,6 +20,14 @@ export default class Vector2 {
20
20
 
21
21
  _sub(x: number, y: number): void
22
22
 
23
+ abs(): void
24
+
25
+ round(): void
26
+
27
+ floor(): void
28
+
29
+ ceil(): void
30
+
23
31
  copy(other: Vector2): void
24
32
 
25
33
  distanceTo(other: Vector2): number
@@ -31,6 +31,14 @@ export default class Vector3 implements Vector3Like {
31
31
 
32
32
  _sub(x: number, y: number, z: number): void
33
33
 
34
+ abs(): void
35
+
36
+ round(): void
37
+
38
+ floor(): void
39
+
40
+ ceil(): void
41
+
34
42
  _multiply(x: number, y: number, z: number): void
35
43
 
36
44
  multiply(other: Vector3Like): void
@@ -1,4 +1,8 @@
1
+ import Signal from "../events/signal/Signal";
2
+
1
3
  export default class ObservedBoolean {
4
+ readonly onChanged: Signal<boolean, boolean>
5
+
2
6
  constructor(value: boolean)
3
7
 
4
8
  set(value: boolean): ObservedBoolean
@@ -1,6 +1,6 @@
1
1
  import { ThreeInstancedAdapter } from "../instanced/ThreeInstancedAdapter.js";
2
2
  import { composeCompile } from "../../../material/composeCompile.js";
3
- import { Mesh, MeshDepthMaterial, MeshNormalMaterial, RGBADepthPacking } from "three";
3
+ import { Material, Mesh, MeshDepthMaterial, MeshNormalMaterial, RGBADepthPacking } from "three";
4
4
  import { VIRTUAL_MESH_FLAG } from "../VIRTUAL_MESH_FLAG.js";
5
5
 
6
6
  const MATERIAL_FLAG = '@micron_instanced_rewritten';
@@ -9,7 +9,7 @@ const MATERIAL_VERTEX_DISPLACED = '@meep/vertex-displaced';
9
9
  export class MaterialContext {
10
10
  /**
11
11
  *
12
- * @param {MicronVertexDataSpec} spec
12
+ * @param {VertexDataSpec} spec
13
13
  * @param {Material} material
14
14
  */
15
15
  constructor(spec, material) {
@@ -19,6 +19,13 @@ export class MaterialContext {
19
19
  */
20
20
  this.adapter = new ThreeInstancedAdapter(spec);
21
21
 
22
+ /**
23
+ *
24
+ * @type {VertexDataSpec}
25
+ * @private
26
+ */
27
+ this.__vertex_spec = spec;
28
+
22
29
  /**
23
30
  *
24
31
  * @type {Material}
@@ -56,6 +63,7 @@ export class MaterialContext {
56
63
  this.__patch_count = 0;
57
64
  }
58
65
 
66
+
59
67
  /**
60
68
  *
61
69
  * @param {MicronGeometryPatchOccurrence} occurrence
@@ -74,6 +82,7 @@ export class MaterialContext {
74
82
 
75
83
  if (material[MATERIAL_FLAG] === undefined) {
76
84
  material.onBeforeCompile = composeCompile(this.material.onBeforeCompile, rewrite_material);
85
+
77
86
  material[MATERIAL_FLAG] = true;
78
87
  material[MATERIAL_VERTEX_DISPLACED] = true;
79
88
  } else {
@@ -60,14 +60,30 @@ function forEachTouch(touchList, callback) {
60
60
  */
61
61
  function getTouchCenter(touchList, result) {
62
62
  const length = touchList.length;
63
+
63
64
  let x = 0, y = 0;
64
- for (let i = 0; i < length; i++) {
65
- const touch = touchList.item(i);
66
- x += touch.clientX;
67
- y += touch.clientY;
65
+
66
+ if (length > 0) {
67
+
68
+ for (let i = 0; i < length; i++) {
69
+ const touch = touchList.item(i);
70
+
71
+ if (touch === null) {
72
+ continue;
73
+ }
74
+
75
+ x += touch.clientX;
76
+ y += touch.clientY;
77
+ }
78
+
79
+ // average to get center
80
+ x /= length;
81
+ y /= length;
82
+
68
83
  }
69
- //
70
- result.set(x / length, y / length);
84
+
85
+ result.set(x, y);
86
+
71
87
  }
72
88
 
73
89
  /**
@@ -435,13 +451,13 @@ function PointerDevice(domElement) {
435
451
  observeTap(this.on.up, this.on.down, this.on.move, 10, this.on.tap);
436
452
  observeDrag(globalUp, this.on.down, this.on.move, this.on.dragStart, this.on.dragEnd, this.on.drag);
437
453
  observePinch({
438
- touchStart: touchStart,
439
- touchEnd: touchEnd,
440
- touchMove: touchMove,
441
- pinch: this.on.pinch,
442
- pinchStart: this.on.pinchStart,
443
- pinchEnd: this.on.pinchEnd
444
- });
454
+ touchStart: touchStart,
455
+ touchEnd: touchEnd,
456
+ touchMove: touchMove,
457
+ pinch: this.on.pinch,
458
+ pinchStart: this.on.pinchStart,
459
+ pinchEnd: this.on.pinchEnd
460
+ });
445
461
  }
446
462
 
447
463
  /**
package/package.json CHANGED
@@ -4,15 +4,15 @@
4
4
  "productName": "Meep",
5
5
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
6
6
  "author": "Alexander Goldring",
7
- "version": "2.33.31",
7
+ "version": "2.33.35",
8
8
  "dependencies": {
9
9
  "fast-levenshtein": "2.0.6",
10
10
  "opentype.js": "1.3.3",
11
11
  "simplex-noise": "2.4.0",
12
- "three": "^0.132.2"
12
+ "three": "^0.135.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "babel-jest": "^26.6.3",
16
- "@types/three": "^0.132.2"
16
+ "@types/three": "^0.135.0"
17
17
  }
18
18
  }