@woosh/meep-engine 2.34.11 → 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/engine/graphics/texture/sampler/Sampler2D.d.ts +21 -0
- package/engine/graphics/texture/sampler/Sampler2D.js +25 -1
- package/generation/grid/GridData.d.ts +3 -0
- package/generation/grid/GridTaskGenerator.js +1 -1
- package/generation/grid/generation/NoopGridTaskGenerator.js +8 -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
|
+
}
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
export class Sampler2D {
|
|
2
|
+
readonly height: number
|
|
3
|
+
readonly width: number
|
|
4
|
+
|
|
5
|
+
readonly itemSize: number
|
|
6
|
+
|
|
2
7
|
readChannel(x: number, y: number, channel: number): number
|
|
3
8
|
|
|
4
9
|
writeChannel(x: number, y: number, channel: number, value: number): void
|
|
10
|
+
|
|
11
|
+
static uint8clamped(itemSize: number, width: number, height: number): Sampler2D
|
|
12
|
+
|
|
13
|
+
static uint8(itemSize: number, width: number, height: number): Sampler2D
|
|
14
|
+
|
|
15
|
+
static uint16(itemSize: number, width: number, height: number): Sampler2D
|
|
16
|
+
|
|
17
|
+
static uint32(itemSize: number, width: number, height: number): Sampler2D
|
|
18
|
+
|
|
19
|
+
static int8(itemSize: number, width: number, height: number): Sampler2D
|
|
20
|
+
|
|
21
|
+
static int16(itemSize: number, width: number, height: number): Sampler2D
|
|
22
|
+
|
|
23
|
+
static int32(itemSize: number, width: number, height: number): Sampler2D
|
|
24
|
+
|
|
25
|
+
static float32(itemSize: number, width: number, height: number): Sampler2D
|
|
5
26
|
}
|
|
@@ -133,7 +133,7 @@ function sampleTriangleBottomRight(p1, p2, p3, dx, dy) {
|
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
135
|
*
|
|
136
|
-
* @param {
|
|
136
|
+
* @param {ArrayLike<number>|number[]|Uint8ClampedArray|Uint8Array|Uint16Array|Int8Array|Int16Array|Int32Array|Float32Array|Float64Array} data
|
|
137
137
|
* @param {int} itemSize
|
|
138
138
|
* @param {int} width
|
|
139
139
|
* @param {int} height
|
|
@@ -255,6 +255,18 @@ Sampler2D.int16 = function (itemSize, width, height) {
|
|
|
255
255
|
const sampler = new Sampler2D(data, itemSize, width, height);
|
|
256
256
|
return sampler;
|
|
257
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* @param {int} itemSize
|
|
261
|
+
* @param {int} width
|
|
262
|
+
* @param {int} height
|
|
263
|
+
* @return {Sampler2D}
|
|
264
|
+
*/
|
|
265
|
+
Sampler2D.int32 = function (itemSize, width, height) {
|
|
266
|
+
const data = new Int32Array(width * height * itemSize);
|
|
267
|
+
const sampler = new Sampler2D(data, itemSize, width, height);
|
|
268
|
+
return sampler;
|
|
269
|
+
};
|
|
258
270
|
|
|
259
271
|
/**
|
|
260
272
|
*
|
|
@@ -268,6 +280,18 @@ Sampler2D.float32 = function (itemSize, width, height) {
|
|
|
268
280
|
const sampler = new Sampler2D(data, itemSize, width, height);
|
|
269
281
|
return sampler;
|
|
270
282
|
};
|
|
283
|
+
/**
|
|
284
|
+
*
|
|
285
|
+
* @param {int} itemSize
|
|
286
|
+
* @param {int} width
|
|
287
|
+
* @param {int} height
|
|
288
|
+
* @return {Sampler2D}
|
|
289
|
+
*/
|
|
290
|
+
Sampler2D.float64 = function (itemSize, width, height) {
|
|
291
|
+
const data = new Float64Array(width * height * itemSize);
|
|
292
|
+
const sampler = new Sampler2D(data, itemSize, width, height);
|
|
293
|
+
return sampler;
|
|
294
|
+
};
|
|
271
295
|
|
|
272
296
|
/**
|
|
273
297
|
*
|
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",
|