@woosh/meep-engine 2.47.8 → 2.47.10
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/build/meep.cjs +399 -394
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +399 -394
- package/package.json +1 -1
- package/src/engine/asset/Asset.js +1 -1
- package/src/engine/asset/AssetLoadState.js +10 -0
- package/src/engine/asset/AssetManager.js +164 -228
- package/src/engine/asset/PendingAsset.js +61 -0
- package/src/engine/graphics/geometry/buffered/compute_buffer_geometry_byte_size.js +5 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import BoundedValue from "../../core/model/BoundedValue.js";
|
|
2
|
+
import { AssetLoadState } from "./AssetLoadState.js";
|
|
3
|
+
|
|
4
|
+
export class PendingAsset {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {AssetDescription} description
|
|
8
|
+
* @constructor
|
|
9
|
+
*/
|
|
10
|
+
constructor(description) {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {AssetDescription}
|
|
14
|
+
*/
|
|
15
|
+
this.description = description;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @type {AssetRequest[]}
|
|
20
|
+
*/
|
|
21
|
+
this.requests = [];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @type {BoundedValue}
|
|
26
|
+
*/
|
|
27
|
+
this.progress = new BoundedValue(0, 0);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @type {AssetLoadState|number}
|
|
32
|
+
*/
|
|
33
|
+
this.state = AssetLoadState.Initial;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns aggregated priority of the pending asset based on highest priority of associated requests
|
|
38
|
+
* @return {number}
|
|
39
|
+
*/
|
|
40
|
+
get priority() {
|
|
41
|
+
let max_priority = 0;
|
|
42
|
+
|
|
43
|
+
const requests = this.requests;
|
|
44
|
+
const n = requests.length;
|
|
45
|
+
|
|
46
|
+
if (n > 0) {
|
|
47
|
+
max_priority = requests[0].priority;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (let i = 1; i < n; i++) {
|
|
51
|
+
const request = requests[i];
|
|
52
|
+
const priority = request.priority;
|
|
53
|
+
|
|
54
|
+
if (priority > max_priority) {
|
|
55
|
+
max_priority = request;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return max_priority;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
export function compute_buffer_geometry_byte_size(g) {
|
|
7
7
|
let result = 0;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const index = g.getIndex();
|
|
10
|
+
|
|
11
|
+
if (index !== null) {
|
|
12
|
+
result += index.array.buffer.byteLength;
|
|
13
|
+
}
|
|
10
14
|
|
|
11
15
|
for (const attribute_name in g.attributes) {
|
|
12
16
|
result += g.attributes[attribute_name].array.buffer.byteLength;
|