@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.
- package/core/geom/Vector2.d.ts +8 -0
- package/core/geom/Vector3.d.ts +8 -0
- package/engine/graphics/micron/build/PatchRepresentation.js +1 -1
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +1 -1
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/format/serialization/deserialize_patch.js +1 -1
- package/engine/graphics/micron/format/serialization/serialize_patch.js +1 -1
- package/engine/graphics/micron/render/instanced/PatchDataTextures.js +3 -3
- package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +1 -1
- package/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +1 -1
- package/engine/graphics/micron/render/makeThreeMeshFromVirtualGeometry.js +1 -1
- package/engine/graphics/micron/render/v1/MaterialContext.js +11 -2
- package/engine/graphics/micron/render/v1/MaterialVertexSpec.js +2 -2
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/micron/render/v1/VGThreeRenderer.js +1 -1
- package/engine/input/devices/PointerDevice.js +29 -13
- package/package.json +4 -3
package/core/geom/Vector2.d.ts
CHANGED
package/core/geom/Vector3.d.ts
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
80
|
+
* @returns {VertexDataSpec}
|
|
81
81
|
*/
|
|
82
82
|
get spec() {
|
|
83
83
|
return this.__spec;
|
|
@@ -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 {
|
|
12
|
+
* @param {VertexDataSpec} spec
|
|
13
13
|
* @param {number} column_count
|
|
14
14
|
*/
|
|
15
15
|
export function shader_rewrite_standard(shader, uniforms, spec, column_count) {
|
|
@@ -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 {
|
|
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 {
|
|
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 {
|
|
37
|
+
* @param {VertexDataSpec} spec
|
|
38
38
|
* @param {Material} material
|
|
39
39
|
*/
|
|
40
40
|
static from(spec, material) {
|
|
@@ -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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
|
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
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
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.
|
|
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.
|
|
13
|
+
"three": "^0.135.0"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"babel-jest": "^26.6.3",
|
|
16
|
-
"@types/three": "^0.
|
|
17
|
+
"@types/three": "^0.135.0"
|
|
17
18
|
}
|
|
18
19
|
}
|