@woosh/meep-engine 2.47.8 → 2.47.11

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.
@@ -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
- result += g.getIndex().array.buffer.byteLength;
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;
@@ -1,4 +1,5 @@
1
- import { Uint32BufferAttribute } from "three";
1
+ import { UintArrayForCount } from "../../../../core/collection/array/typed/uint_array_for_count.js";
2
+ import { BufferAttribute } from "three";
2
3
 
3
4
  /**
4
5
  *
@@ -11,13 +12,16 @@ export function makeGeometryIndexed(geometry) {
11
12
  const position_attribute = geometry.getAttribute('position');
12
13
  // non-indexed geometry, build index
13
14
  const size = position_attribute.count;
14
- const array = new Uint32Array(size);
15
+
16
+ const UintArrayConstructor = UintArrayForCount(size);
17
+
18
+ const array = new UintArrayConstructor(size);
15
19
 
16
20
  for (let i = 0; i < size; i++) {
17
21
  array[i] = i;
18
22
  }
19
23
 
20
- index_attribute = new Uint32BufferAttribute(array, 1, false);
24
+ index_attribute = new BufferAttribute(array, 1, false);
21
25
 
22
26
  geometry.setIndex(index_attribute);
23
27
  }