@woosh/meep-engine 2.33.33 → 2.33.34
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
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
|
|
@@ -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
|
|
@@ -65,6 +73,29 @@ export class MaterialContext {
|
|
|
65
73
|
return this.instances.has(occurrence.instance_id);
|
|
66
74
|
}
|
|
67
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Generate a new custom cache key for three.js internal shader compilation
|
|
78
|
+
* @param {Material} material
|
|
79
|
+
* @returns {function()}
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
__make_custom_cache_key(material) {
|
|
83
|
+
let existingKeyMaker = material.customProgramCacheKey;
|
|
84
|
+
|
|
85
|
+
return () => {
|
|
86
|
+
let v = '';
|
|
87
|
+
const attributes = this.__vertex_spec.attributes;
|
|
88
|
+
const attribute_count = attributes.length;
|
|
89
|
+
|
|
90
|
+
for (let i = 0; i < attribute_count; i++) {
|
|
91
|
+
const a = attributes[i];
|
|
92
|
+
v += `${a.name}:${a.type}:${a.itemSize}:${a.normalized ? 1 : 0}`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return existingKeyMaker.call(material) + v;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
68
99
|
init(gl) {
|
|
69
100
|
this.adapter.__gl_context = gl;
|
|
70
101
|
|
|
@@ -74,6 +105,8 @@ export class MaterialContext {
|
|
|
74
105
|
|
|
75
106
|
if (material[MATERIAL_FLAG] === undefined) {
|
|
76
107
|
material.onBeforeCompile = composeCompile(this.material.onBeforeCompile, rewrite_material);
|
|
108
|
+
material.customProgramCacheKey = this.__make_custom_cache_key(this.material);
|
|
109
|
+
|
|
77
110
|
material[MATERIAL_FLAG] = true;
|
|
78
111
|
material[MATERIAL_VERTEX_DISPLACED] = true;
|
|
79
112
|
} else {
|
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.
|
|
7
|
+
"version": "2.33.34",
|
|
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.
|
|
12
|
+
"three": "^0.135.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"babel-jest": "^26.6.3",
|
|
16
|
-
"@types/three": "^0.
|
|
16
|
+
"@types/three": "^0.135.0"
|
|
17
17
|
}
|
|
18
18
|
}
|