@woosh/meep-engine 2.33.32 → 2.33.36

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
@@ -381,7 +381,7 @@ export class PatchRepresentation {
381
381
  *
382
382
  * @param {MicronGeometryPatch} result
383
383
  * @param {THREE.BufferGeometry} source_geometry
384
- * @param {MicronVertexDataSpec} vertex_data_spec
384
+ * @param {VertexDataSpec} vertex_data_spec
385
385
  */
386
386
  buildMicronGeometryPatch(result, source_geometry, vertex_data_spec) {
387
387
 
@@ -214,7 +214,7 @@ export async function buildMicronGeometryFromBufferGeometry(input) {
214
214
  *
215
215
  * @param {PatchRepresentation} node
216
216
  * @param {THREE.BufferGeometry} geometry
217
- * @param {MicronVertexDataSpec} vertex_spec
217
+ * @param {VertexDataSpec} vertex_spec
218
218
  * @returns {MicronGeometryPatch}
219
219
  */
220
220
  function compilePatchGraph(node, geometry, vertex_spec) {
@@ -134,7 +134,7 @@ function compute_attribute_data_converter(source, spec) {
134
134
  * @param {MicronGeometryPatch} result
135
135
  * @param {THREE.BufferGeometry} buffer_geometry
136
136
  * @param {TopoMesh} topo
137
- * @param {MicronVertexDataSpec} vertex_data_spec
137
+ * @param {VertexDataSpec} vertex_data_spec
138
138
  */
139
139
  export function fill_patch_geometry_data(result, buffer_geometry, topo, vertex_data_spec) {
140
140
  /**
@@ -6,7 +6,7 @@ import { DataType2TypedArrayConstructorMapping } from "../../../../../core/colle
6
6
  *
7
7
  * @param {BinaryBuffer} buffer
8
8
  * @param {MicronGeometryPatch} patch
9
- * @param {MicronVertexDataSpec} vertex_spec
9
+ * @param {VertexDataSpec} vertex_spec
10
10
  * @param {MicronGeometryPatch[]} patch_array
11
11
  */
12
12
  export function deserialize_patch(buffer, patch, vertex_spec, patch_array) {
@@ -4,7 +4,7 @@ import { DataTypeByteSizes } from "../../../../../core/collection/table/DataType
4
4
  *
5
5
  * @param {BinaryBuffer} buffer
6
6
  * @param {MicronGeometryPatch} patch
7
- * @param {MicronVertexDataSpec} vertex_spec
7
+ * @param {VertexDataSpec} vertex_spec
8
8
  * @param {MicronGeometryPatch[]} patch_array
9
9
  */
10
10
  export function serialize_patch(buffer, patch, vertex_spec, patch_array) {
@@ -26,7 +26,7 @@ const MAX_TEXTURE_SIZE = 16384;
26
26
  export class PatchDataTextures {
27
27
  /**
28
28
  *
29
- * @param {MicronVertexDataSpec} spec
29
+ * @param {VertexDataSpec} spec
30
30
  * @param {number} [column_count]
31
31
  */
32
32
  constructor(spec, column_count = 2) {
@@ -35,7 +35,7 @@ export class PatchDataTextures {
35
35
 
36
36
  /**
37
37
  *
38
- * @type {MicronVertexDataSpec}
38
+ * @type {VertexDataSpec}
39
39
  * @private
40
40
  */
41
41
  this.__spec = spec;
@@ -77,7 +77,7 @@ export class PatchDataTextures {
77
77
 
78
78
  /**
79
79
  *
80
- * @returns {MicronVertexDataSpec}
80
+ * @returns {VertexDataSpec}
81
81
  */
82
82
  get spec() {
83
83
  return this.__spec;
@@ -14,7 +14,7 @@ import { shader_rewrite_standard } from "./shader/shader_rewrite_standard.js";
14
14
  export class ThreeInstancedAdapter {
15
15
  /**
16
16
  *
17
- * @param {MicronVertexDataSpec} spec
17
+ * @param {VertexDataSpec} spec
18
18
  */
19
19
  constructor(spec) {
20
20
  /**
@@ -9,7 +9,7 @@ const DEBUG_PATCHES = false;
9
9
  *
10
10
  * @param {{vertexShader,fragmentShader,uniforms:Object<IUniform>}} shader
11
11
  * @param {Object<IUniform>} uniforms
12
- * @param {MicronVertexDataSpec} spec
12
+ * @param {VertexDataSpec} spec
13
13
  * @param {number} column_count
14
14
  */
15
15
  export function shader_rewrite_standard(shader, uniforms, spec, column_count) {
@@ -3,7 +3,7 @@ import { Group, Mesh } from "three";
3
3
 
4
4
  /**
5
5
  *
6
- * @param {MicronVertexDataSpec} spec
6
+ * @param {VertexDataSpec} spec
7
7
  * @param {VirtualGeometry} virtual_geometry
8
8
  * @param {THREE.Material[]} materials
9
9
  * @returns {Mesh}
@@ -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 {
@@ -2,7 +2,7 @@ export class MaterialVertexSpec {
2
2
  constructor() {
3
3
  /**
4
4
  *
5
- * @type {MicronVertexDataSpec|null}
5
+ * @type {VertexDataSpec|null}
6
6
  */
7
7
  this.spec = null;
8
8
  /**
@@ -34,7 +34,7 @@ export class MaterialVertexSpec {
34
34
  }
35
35
 
36
36
  /**
37
- * @param {MicronVertexDataSpec} spec
37
+ * @param {VertexDataSpec} spec
38
38
  * @param {Material} material
39
39
  */
40
40
  static from(spec, material) {
@@ -19,7 +19,7 @@ export class ThreeVirtualGeometryAdapter {
19
19
 
20
20
  /**
21
21
  *
22
- * @type {MicronVertexDataSpec}
22
+ * @type {VertexDataSpec}
23
23
  * @private
24
24
  */
25
25
  this.__vertex_spec = null;
@@ -68,7 +68,7 @@ export class VGThreeRenderer {
68
68
 
69
69
  /**
70
70
  *
71
- * @param {MicronVertexDataSpec} spec
71
+ * @param {VertexDataSpec} spec
72
72
  * @param {Material} m
73
73
  * @returns {MaterialContext}
74
74
  * @private
@@ -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
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@woosh/meep-engine",
3
3
  "type": "module",
4
+ "license": "UNLICENSED",
4
5
  "productName": "Meep",
5
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
6
7
  "author": "Alexander Goldring",
7
- "version": "2.33.32",
8
+ "version": "2.33.36",
8
9
  "dependencies": {
9
10
  "fast-levenshtein": "2.0.6",
10
11
  "opentype.js": "1.3.3",
11
12
  "simplex-noise": "2.4.0",
12
- "three": "^0.132.2"
13
+ "three": "^0.135.0"
13
14
  },
14
15
  "devDependencies": {
15
16
  "babel-jest": "^26.6.3",
16
- "@types/three": "^0.132.2"
17
+ "@types/three": "^0.135.0"
17
18
  }
18
19
  }