@woosh/meep-engine 2.34.14 → 2.34.15
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/engine/asset/loaders/material/computeHashColor.js +7 -0
- package/engine/asset/loaders/material/computeMaterialEquality.js +22 -22
- package/engine/asset/loaders/material/computeMaterialHash.js +15 -13
- package/engine/asset/loaders/material/computeTextureEqualityById.js +22 -0
- package/engine/asset/loaders/material/textureHashById.js +12 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { planesEqual } from "./planesEqual.js";
|
|
2
|
-
import { computeTextureEquality } from "./computeTextureEquality.js";
|
|
3
2
|
import { isArraysEqualWithComparator } from "../../../../core/collection/array/isArraysEqualWithComparator.js";
|
|
3
|
+
import { computeTextureEqualityById } from "./computeTextureEqualityById.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* NOTE: does not do deep comparison on textures, only checks the IDs
|
|
7
7
|
* @param {Material|MeshStandardMaterial|MeshDepthMaterial|MeshMatcapMaterial} a
|
|
8
8
|
* @param {Material|MeshStandardMaterial|MeshDepthMaterial|MeshMatcapMaterial} b
|
|
9
9
|
* @returns {boolean}
|
|
@@ -76,28 +76,28 @@ export function computeMaterialEquality(a, b) {
|
|
|
76
76
|
|| a.wireframeLinewidth !== b.wireframeLinewidth
|
|
77
77
|
|| a.morphTargets !== b.morphTargets
|
|
78
78
|
|| a.morphNormals !== b.morphNormals
|
|
79
|
-
|| !
|
|
80
|
-
|| !
|
|
81
|
-
|| !
|
|
82
|
-
|| !
|
|
83
|
-
|| !
|
|
84
|
-
|| !
|
|
85
|
-
|| !
|
|
86
|
-
|| !
|
|
87
|
-
|| !
|
|
88
|
-
|| !
|
|
89
|
-
|| !
|
|
79
|
+
|| !computeTextureEqualityById(a.roughnessMap, b.roughnessMap)
|
|
80
|
+
|| !computeTextureEqualityById(a.metalnessMap, b.metalnessMap)
|
|
81
|
+
|| !computeTextureEqualityById(a.alphaMap, b.alphaMap)
|
|
82
|
+
|| !computeTextureEqualityById(a.envMap, b.envMap)
|
|
83
|
+
|| !computeTextureEqualityById(a.displacementMap, b.displacementMap)
|
|
84
|
+
|| !computeTextureEqualityById(a.normalMap, b.normalMap)
|
|
85
|
+
|| !computeTextureEqualityById(a.emissiveMap, b.emissiveMap)
|
|
86
|
+
|| !computeTextureEqualityById(a.bumpMap, b.bumpMap)
|
|
87
|
+
|| !computeTextureEqualityById(a.aoMap, b.aoMap)
|
|
88
|
+
|| !computeTextureEqualityById(a.map, b.map)
|
|
89
|
+
|| !computeTextureEqualityById(a.lightMap, b.lightMap)
|
|
90
90
|
) {
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
93
|
} else if (a.isMeshDepthMaterial) {
|
|
94
94
|
if (
|
|
95
|
-
!
|
|
95
|
+
!computeTextureEqualityById(a.alphaMap, b.alphaMap)
|
|
96
96
|
|| a.depthPacking !== b.depthPacking
|
|
97
|
-
|| !
|
|
97
|
+
|| !computeTextureEqualityById(a.displacementMap, b.displacementMap)
|
|
98
98
|
|| a.displacementScale !== b.displacementScale
|
|
99
99
|
|| a.displacementBias !== b.displacementBias
|
|
100
|
-
|| !
|
|
100
|
+
|| !computeTextureEqualityById(a.map, b.map)
|
|
101
101
|
|| a.morphTargets !== b.morphTargets
|
|
102
102
|
|| a.wireframe !== b.wireframe
|
|
103
103
|
|| a.wireframeLinewidth !== b.wireframeLinewidth
|
|
@@ -107,15 +107,15 @@ export function computeMaterialEquality(a, b) {
|
|
|
107
107
|
} else if (a.isMeshMatcapMaterial) {
|
|
108
108
|
if (
|
|
109
109
|
!a.color.equals(b.color)
|
|
110
|
-
|| !
|
|
111
|
-
|| !
|
|
112
|
-
|| !
|
|
113
|
-
|| !
|
|
110
|
+
|| !computeTextureEqualityById(a.matcap, b.matcap)
|
|
111
|
+
|| !computeTextureEqualityById(a.map, b.map)
|
|
112
|
+
|| !computeTextureEqualityById(a.bumpMap, b.bumpMap)
|
|
113
|
+
|| !computeTextureEqualityById(a.normalMap, b.normalMap)
|
|
114
114
|
|| !a.normalScale.equals(b.normalScale)
|
|
115
|
-
|| !
|
|
115
|
+
|| !computeTextureEqualityById(a.displacementMap, b.displacementMap)
|
|
116
116
|
|| a.displacementScale !== b.displacementScale
|
|
117
117
|
|| a.displacementBias !== b.displacementBias
|
|
118
|
-
|| !
|
|
118
|
+
|| !computeTextureEqualityById(a.alphaMap, b.alphaMap)
|
|
119
119
|
|| a.morphTargets !== b.morphTargets
|
|
120
120
|
|| a.morphNormals !== b.morphNormals
|
|
121
121
|
|| a.flatShading !== b.flatShading
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { planeHash } from "./planeHash.js";
|
|
2
|
-
import { computeTextureHash } from "./computeTextureHash.js";
|
|
3
2
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
4
3
|
import { computeHashArray } from "../../../../core/collection/array/computeHashArray.js";
|
|
5
4
|
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
6
5
|
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
6
|
+
import { textureHashById } from "./textureHashById.js";
|
|
7
|
+
import { computeHashColor } from "./computeHashColor.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
@@ -46,21 +47,22 @@ export function computeMaterialHash(material) {
|
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
if (material.isMeshStandardMaterial) {
|
|
49
|
-
//TODO extend hash
|
|
50
50
|
hash = computeHashIntegerArray(
|
|
51
51
|
hash,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
computeHashColor(material.color),
|
|
53
|
+
computeHashFloat(material.roughness),
|
|
54
|
+
computeHashFloat(material.metalness),
|
|
55
|
+
textureHashById(material.map),
|
|
56
|
+
textureHashById(material.lightMap),
|
|
57
|
+
computeHashFloat(material.lightMapIntensity),
|
|
58
|
+
textureHashById(material.aoMap),
|
|
59
|
+
computeHashFloat(material.aoMapIntensity),
|
|
60
|
+
computeHashColor(material.emissive),
|
|
61
|
+
computeHashFloat(material.emissiveIntensity),
|
|
62
|
+
textureHashById(material.emissiveMap),
|
|
62
63
|
computeHashFloat(material.envMapIntensity),
|
|
63
|
-
|
|
64
|
+
textureHashById(material.bumpMap),
|
|
65
|
+
textureHashById(material.normalMap),
|
|
64
66
|
);
|
|
65
67
|
} else if (material.isShaderMaterial) {
|
|
66
68
|
hash ^= material.lights ? 0 : 1;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Texture} a
|
|
4
|
+
* @param {Texture} b
|
|
5
|
+
* @returns {boolean}
|
|
6
|
+
*/
|
|
7
|
+
export function computeTextureEqualityById(a, b) {
|
|
8
|
+
if (a === b) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (
|
|
13
|
+
a === null
|
|
14
|
+
|| b === null
|
|
15
|
+
|| a === undefined
|
|
16
|
+
|| b === undefined
|
|
17
|
+
) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return a.id === b.id;
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.34.
|
|
8
|
+
"version": "2.34.15",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|