@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.
package/build/meep.cjs CHANGED
@@ -72146,7 +72146,7 @@ class Asset {
72146
72146
 
72147
72147
  /**
72148
72148
  *
72149
- * @type {Array.<AssetDescription>}
72149
+ * @type {Array<AssetDescription>}
72150
72150
  */
72151
72151
  this.dependencies = [];
72152
72152
 
@@ -82767,223 +82767,6 @@ function tryResolve(unresolvedTask) {
82767
82767
  return ResolutionType.READY;
82768
82768
  }
82769
82769
 
82770
- /**
82771
- * Created by Alex on 21/03/2016.
82772
- */
82773
-
82774
- /**
82775
- *
82776
- * @param {Number} currentValue
82777
- * @param {Number} upperLimit
82778
- * @param {Number} [lowerLimit=0]
82779
- * @constructor
82780
- */
82781
- const BoundedValue = function (currentValue, upperLimit, lowerLimit) {
82782
- /**
82783
- * @property {Number}
82784
- * @private
82785
- */
82786
- this.__value = currentValue !== undefined ? currentValue : 0;
82787
- /**
82788
- * @property {Number}
82789
- * @private
82790
- */
82791
- this.__limitUpper = upperLimit !== undefined ? upperLimit : 0;
82792
-
82793
- /**
82794
- * @type {Number}
82795
- * @private
82796
- */
82797
- this.__limitLower = lowerLimit !== undefined ? lowerLimit : 0;
82798
-
82799
- this.onChanged = new Signal();
82800
- this.onOverflow = new Signal();
82801
- this.onFilled = new Signal();
82802
-
82803
- this.on = {
82804
- changed: this.onChanged,
82805
- overflow: this.onOverflow
82806
- };
82807
- };
82808
-
82809
- /**
82810
- *
82811
- * @param {Number} v
82812
- */
82813
- BoundedValue.prototype.setUpperLimit = function (v) {
82814
- const oldValue = this.__limitUpper;
82815
- if (v === oldValue) {
82816
- //no change
82817
- return;
82818
- }
82819
- this.__limitUpper = v;
82820
- this.onChanged.send4(this.__value, this.__limitUpper, this.__value, oldValue);
82821
- };
82822
-
82823
-
82824
- /**
82825
- *
82826
- * @returns {Number}
82827
- */
82828
- BoundedValue.prototype.getUpperLimit = function () {
82829
- return this.__limitUpper;
82830
- };
82831
-
82832
- /**
82833
- *
82834
- * @returns {Number}
82835
- */
82836
- BoundedValue.prototype.getLowerLimit = function () {
82837
- return this.__limitLower;
82838
- };
82839
- /**
82840
- *
82841
- * @param {Number} v
82842
- */
82843
- BoundedValue.prototype.setLowerLimit = function (v) {
82844
- const old = this.__limitLower;
82845
-
82846
- if (v === old) {
82847
- //no change
82848
- return;
82849
- }
82850
-
82851
- this.__limitLower = v;
82852
-
82853
- //TODO change signal signature to include lower limit
82854
- this.onChanged.dispatch();
82855
- };
82856
-
82857
- /**
82858
- *
82859
- * @param {Number} v
82860
- */
82861
- BoundedValue.prototype.setValue = function (v) {
82862
- const oldValue = this.__value;
82863
- if (oldValue === v) {
82864
- //no change
82865
- return;
82866
- }
82867
-
82868
- const spill = v - this.__limitUpper;
82869
- this.__value = v;
82870
- //dispatch change
82871
- this.onChanged.send4(this.__value, this.__limitUpper, oldValue, this.__limitUpper);
82872
- if (spill > 0) {
82873
- this.onOverflow.send1(spill);
82874
- }
82875
- if (spill >= 0) {
82876
- this.onFilled.send0();
82877
- }
82878
- };
82879
-
82880
- /**
82881
- *
82882
- * @returns {Number}
82883
- */
82884
- BoundedValue.prototype.getValue = function () {
82885
- return this.__value;
82886
- };
82887
-
82888
-
82889
- /**
82890
- *
82891
- * @returns {number}
82892
- */
82893
- BoundedValue.prototype.getFraction = function () {
82894
- return inverseLerp(this.__limitLower, this.__limitUpper, this.__value);
82895
- };
82896
-
82897
- /**
82898
- *
82899
- */
82900
- BoundedValue.prototype.setValueToLimit = function () {
82901
- this.setValue(this.__limitUpper);
82902
- };
82903
-
82904
- /**
82905
- *
82906
- * @return {boolean}
82907
- */
82908
- BoundedValue.prototype.isValueAtLimit = function () {
82909
- return this.__value === this.__limitUpper;
82910
- };
82911
-
82912
- /**
82913
- *
82914
- * @param {Number} val
82915
- */
82916
- BoundedValue.prototype.addValue = function (val) {
82917
- this.setValue(this.__value + val);
82918
- };
82919
-
82920
- /**
82921
- *
82922
- * @param {BoundedValue} other
82923
- * @returns {BoundedValue}
82924
- */
82925
- BoundedValue.prototype.copy = function (other) {
82926
- this.setUpperLimit(other.getUpperLimit());
82927
- this.setValue(other.getValue());
82928
- return this;
82929
- };
82930
-
82931
- /**
82932
- *
82933
- * @param {BoundedValue} other
82934
- * @returns {boolean}
82935
- */
82936
- BoundedValue.prototype.equals = function (other) {
82937
- return this.__value === other.__value && this.__limitLower === other.__limitLower && this.__limitUpper === other.__limitUpper;
82938
- };
82939
-
82940
- /**
82941
- *
82942
- * @returns {number}
82943
- */
82944
- BoundedValue.prototype.hash = function () {
82945
- const v0 = computeHashFloat(this.__value);
82946
- const v1 = computeHashFloat(this.__limitLower);
82947
- const v2 = computeHashFloat(this.__limitUpper);
82948
-
82949
- const h0 = (v0 << 5) - v0 + v1;
82950
-
82951
- return (h0 << 5) - h0 + v2;
82952
- };
82953
-
82954
- BoundedValue.prototype.toJSON = function () {
82955
- return {
82956
- value: this.__value,
82957
- limit: this.__limitUpper
82958
- };
82959
- };
82960
-
82961
- BoundedValue.prototype.fromJSON = function (json) {
82962
- this.setUpperLimit(json.limit);
82963
- this.setValue(json.value);
82964
- };
82965
-
82966
- /**
82967
- *
82968
- * @param {BinaryBuffer} buffer
82969
- */
82970
- BoundedValue.prototype.toBinaryBuffer = function (buffer) {
82971
- buffer.writeFloat64(this.__value);
82972
- buffer.writeFloat64(this.__limitUpper);
82973
- };
82974
-
82975
- /**
82976
- *
82977
- * @param {BinaryBuffer} buffer
82978
- */
82979
- BoundedValue.prototype.fromBinaryBuffer = function (buffer) {
82980
- const value = buffer.readFloat64();
82981
- const upperLimit = buffer.readFloat64();
82982
-
82983
- this.setUpperLimit(upperLimit);
82984
- this.setValue(value);
82985
- };
82986
-
82987
82770
  class ObservedMap {
82988
82771
  /**
82989
82772
  * @template K,V
@@ -83986,10 +83769,6 @@ class BinaryHeap {
83986
83769
  }
83987
83770
  }
83988
83771
 
83989
- /**
83990
- * Created by Alex on 03/09/2014.
83991
- */
83992
-
83993
83772
  /**
83994
83773
  * @enum {number}
83995
83774
  */
@@ -83999,24 +83778,240 @@ const AssetLoadState = {
83999
83778
  Loading: 2,
84000
83779
  Succeeded: 3,
84001
83780
  Failed: 4
84002
- };
84003
-
83781
+ };
83782
+
83783
+ /**
83784
+ * Created by Alex on 21/03/2016.
83785
+ */
84004
83786
 
84005
- class PendingAsset {
83787
+ /**
83788
+ *
83789
+ * @param {Number} currentValue
83790
+ * @param {Number} upperLimit
83791
+ * @param {Number} [lowerLimit=0]
83792
+ * @constructor
83793
+ */
83794
+ const BoundedValue = function (currentValue, upperLimit, lowerLimit) {
84006
83795
  /**
84007
- *
84008
- * @param {AssetDescription} description
84009
- * @constructor
83796
+ * @property {Number}
83797
+ * @private
84010
83798
  */
84011
- constructor(description) {
84012
- /**
84013
- *
84014
- * @type {AssetDescription}
84015
- */
84016
- this.description = description;
83799
+ this.__value = currentValue !== undefined ? currentValue : 0;
83800
+ /**
83801
+ * @property {Number}
83802
+ * @private
83803
+ */
83804
+ this.__limitUpper = upperLimit !== undefined ? upperLimit : 0;
84017
83805
 
84018
- /**
84019
- *
83806
+ /**
83807
+ * @type {Number}
83808
+ * @private
83809
+ */
83810
+ this.__limitLower = lowerLimit !== undefined ? lowerLimit : 0;
83811
+
83812
+ this.onChanged = new Signal();
83813
+ this.onOverflow = new Signal();
83814
+ this.onFilled = new Signal();
83815
+
83816
+ this.on = {
83817
+ changed: this.onChanged,
83818
+ overflow: this.onOverflow
83819
+ };
83820
+ };
83821
+
83822
+ /**
83823
+ *
83824
+ * @param {Number} v
83825
+ */
83826
+ BoundedValue.prototype.setUpperLimit = function (v) {
83827
+ const oldValue = this.__limitUpper;
83828
+ if (v === oldValue) {
83829
+ //no change
83830
+ return;
83831
+ }
83832
+ this.__limitUpper = v;
83833
+ this.onChanged.send4(this.__value, this.__limitUpper, this.__value, oldValue);
83834
+ };
83835
+
83836
+
83837
+ /**
83838
+ *
83839
+ * @returns {Number}
83840
+ */
83841
+ BoundedValue.prototype.getUpperLimit = function () {
83842
+ return this.__limitUpper;
83843
+ };
83844
+
83845
+ /**
83846
+ *
83847
+ * @returns {Number}
83848
+ */
83849
+ BoundedValue.prototype.getLowerLimit = function () {
83850
+ return this.__limitLower;
83851
+ };
83852
+ /**
83853
+ *
83854
+ * @param {Number} v
83855
+ */
83856
+ BoundedValue.prototype.setLowerLimit = function (v) {
83857
+ const old = this.__limitLower;
83858
+
83859
+ if (v === old) {
83860
+ //no change
83861
+ return;
83862
+ }
83863
+
83864
+ this.__limitLower = v;
83865
+
83866
+ //TODO change signal signature to include lower limit
83867
+ this.onChanged.dispatch();
83868
+ };
83869
+
83870
+ /**
83871
+ *
83872
+ * @param {Number} v
83873
+ */
83874
+ BoundedValue.prototype.setValue = function (v) {
83875
+ const oldValue = this.__value;
83876
+ if (oldValue === v) {
83877
+ //no change
83878
+ return;
83879
+ }
83880
+
83881
+ const spill = v - this.__limitUpper;
83882
+ this.__value = v;
83883
+ //dispatch change
83884
+ this.onChanged.send4(this.__value, this.__limitUpper, oldValue, this.__limitUpper);
83885
+ if (spill > 0) {
83886
+ this.onOverflow.send1(spill);
83887
+ }
83888
+ if (spill >= 0) {
83889
+ this.onFilled.send0();
83890
+ }
83891
+ };
83892
+
83893
+ /**
83894
+ *
83895
+ * @returns {Number}
83896
+ */
83897
+ BoundedValue.prototype.getValue = function () {
83898
+ return this.__value;
83899
+ };
83900
+
83901
+
83902
+ /**
83903
+ *
83904
+ * @returns {number}
83905
+ */
83906
+ BoundedValue.prototype.getFraction = function () {
83907
+ return inverseLerp(this.__limitLower, this.__limitUpper, this.__value);
83908
+ };
83909
+
83910
+ /**
83911
+ *
83912
+ */
83913
+ BoundedValue.prototype.setValueToLimit = function () {
83914
+ this.setValue(this.__limitUpper);
83915
+ };
83916
+
83917
+ /**
83918
+ *
83919
+ * @return {boolean}
83920
+ */
83921
+ BoundedValue.prototype.isValueAtLimit = function () {
83922
+ return this.__value === this.__limitUpper;
83923
+ };
83924
+
83925
+ /**
83926
+ *
83927
+ * @param {Number} val
83928
+ */
83929
+ BoundedValue.prototype.addValue = function (val) {
83930
+ this.setValue(this.__value + val);
83931
+ };
83932
+
83933
+ /**
83934
+ *
83935
+ * @param {BoundedValue} other
83936
+ * @returns {BoundedValue}
83937
+ */
83938
+ BoundedValue.prototype.copy = function (other) {
83939
+ this.setUpperLimit(other.getUpperLimit());
83940
+ this.setValue(other.getValue());
83941
+ return this;
83942
+ };
83943
+
83944
+ /**
83945
+ *
83946
+ * @param {BoundedValue} other
83947
+ * @returns {boolean}
83948
+ */
83949
+ BoundedValue.prototype.equals = function (other) {
83950
+ return this.__value === other.__value && this.__limitLower === other.__limitLower && this.__limitUpper === other.__limitUpper;
83951
+ };
83952
+
83953
+ /**
83954
+ *
83955
+ * @returns {number}
83956
+ */
83957
+ BoundedValue.prototype.hash = function () {
83958
+ const v0 = computeHashFloat(this.__value);
83959
+ const v1 = computeHashFloat(this.__limitLower);
83960
+ const v2 = computeHashFloat(this.__limitUpper);
83961
+
83962
+ const h0 = (v0 << 5) - v0 + v1;
83963
+
83964
+ return (h0 << 5) - h0 + v2;
83965
+ };
83966
+
83967
+ BoundedValue.prototype.toJSON = function () {
83968
+ return {
83969
+ value: this.__value,
83970
+ limit: this.__limitUpper
83971
+ };
83972
+ };
83973
+
83974
+ BoundedValue.prototype.fromJSON = function (json) {
83975
+ this.setUpperLimit(json.limit);
83976
+ this.setValue(json.value);
83977
+ };
83978
+
83979
+ /**
83980
+ *
83981
+ * @param {BinaryBuffer} buffer
83982
+ */
83983
+ BoundedValue.prototype.toBinaryBuffer = function (buffer) {
83984
+ buffer.writeFloat64(this.__value);
83985
+ buffer.writeFloat64(this.__limitUpper);
83986
+ };
83987
+
83988
+ /**
83989
+ *
83990
+ * @param {BinaryBuffer} buffer
83991
+ */
83992
+ BoundedValue.prototype.fromBinaryBuffer = function (buffer) {
83993
+ const value = buffer.readFloat64();
83994
+ const upperLimit = buffer.readFloat64();
83995
+
83996
+ this.setUpperLimit(upperLimit);
83997
+ this.setValue(value);
83998
+ };
83999
+
84000
+ class PendingAsset {
84001
+ /**
84002
+ *
84003
+ * @param {AssetDescription} description
84004
+ * @constructor
84005
+ */
84006
+ constructor(description) {
84007
+ /**
84008
+ *
84009
+ * @type {AssetDescription}
84010
+ */
84011
+ this.description = description;
84012
+
84013
+ /**
84014
+ *
84020
84015
  * @type {AssetRequest[]}
84021
84016
  */
84022
84017
  this.requests = [];
@@ -84059,7 +84054,12 @@ class PendingAsset {
84059
84054
 
84060
84055
  return max_priority;
84061
84056
  }
84062
- }
84057
+ }
84058
+
84059
+ /**
84060
+ * Created by Alex on 03/09/2014.
84061
+ */
84062
+
84063
84063
 
84064
84064
  let Response$1 = class Response {
84065
84065
  /**
@@ -84090,141 +84090,144 @@ function get_pending_asset_priority_score(pending_asset) {
84090
84090
  class AssetManager {
84091
84091
  /**
84092
84092
  *
84093
- * @param {Engine} engine
84094
- * @constructor
84093
+ * @type {HashMap<AssetDescription, Asset>}
84094
+ * @private
84095
84095
  */
84096
- constructor(engine) {
84097
- /**
84098
- *
84099
- * @type {HashMap<AssetDescription, Asset>}
84100
- * @private
84101
- */
84102
- this.assets = new HashMap({
84103
- capacity: 1024
84104
- });
84096
+ assets = new HashMap({
84097
+ capacity: 1024
84098
+ });
84105
84099
 
84106
- /**
84107
- *
84108
- * @type {ObservedMap<AssetDescription, PendingAsset>}
84109
- * @private
84110
- */
84111
- this.request_map = new ObservedMap(new HashMap());
84100
+ /**
84101
+ *
84102
+ * @type {ObservedMap<AssetDescription, PendingAsset>}
84103
+ */
84104
+ request_map = new ObservedMap(new HashMap());
84112
84105
 
84113
- /**
84114
- * Waiting queue for assets that haven't yet been scheduled (passed to relevant loader)
84115
- * @type {BinaryHeap<PendingAsset>}
84116
- * @private
84117
- */
84118
- this.__pending_asset_wait_queue = new BinaryHeap(get_pending_asset_priority_score);
84119
- /**
84120
- * Assets currently being processed by loaders
84121
- * @type {Set<PendingAsset>}
84122
- * @private
84123
- */
84124
- this.__pending_asset_active_load_set = new Set();
84106
+ /**
84107
+ * Waiting queue for assets that haven't yet been scheduled (passed to relevant loader)
84108
+ * @type {BinaryHeap<PendingAsset>}
84109
+ * @private
84110
+ */
84111
+ #pending_asset_wait_queue = new BinaryHeap(get_pending_asset_priority_score);
84112
+ /**
84113
+ * Assets currently being processed by #loaders
84114
+ * @type {Set<PendingAsset>}
84115
+ * @private
84116
+ */
84117
+ #pending_asset_active_load_set = new Set();
84125
84118
 
84126
- /**
84127
- * Maximum number of requests that can be handled at the same time
84128
- * Since most of the requests are handled over the network, this can help you control network concurrency,
84129
- * this can be useful to keep some network slots available for high-priority requests such as UI related ones
84130
- * TODO currently nested asset requests are not recognized, so if nesting level exceeds concurrency - it will lead to a deadlock
84131
- * @type {number}
84132
- */
84133
- this.load_concurrency = Infinity;
84119
+ /**
84120
+ * Maximum number of requests that can be handled at the same time
84121
+ * Since most of the requests are handled over the network, this can help you control network concurrency,
84122
+ * this can be useful to keep some network slots available for high-priority requests such as UI related ones
84123
+ * TODO currently nested asset requests are not recognized, so if nesting level exceeds concurrency - it will lead to a deadlock
84124
+ * @type {number}
84125
+ */
84126
+ load_concurrency = Infinity;
84134
84127
 
84135
- /**
84136
- * Registered loaders
84137
- * @private
84138
- * @type {Object<AssetLoader>}
84139
- */
84140
- this.loaders = {};
84128
+ /**
84129
+ * Registered #loaders
84130
+ * @private
84131
+ * @type {Object<AssetLoader>}
84132
+ */
84133
+ #loaders = {};
84141
84134
 
84142
- /**
84143
- * After asset is loaded, a chain of transforms can be applied to it, these are registered here
84144
- * Transformers are executed in the order in which they are added
84145
- * Identified by asset "type" string
84146
- * @type {Object<AssetTransformer[]>}
84147
- * @private
84148
- */
84149
- this.transformers = {};
84135
+ /**
84136
+ * After asset is loaded, a chain of transforms can be applied to it, these are registered here
84137
+ * Transformers are executed in the order in which they are added
84138
+ * Identified by asset "type" string
84139
+ * @type {Object<AssetTransformer[]>}
84140
+ * @private
84141
+ */
84142
+ #transformers = {};
84150
84143
 
84151
- /**
84152
- * Named links to specific assets. Useful to later re-mapping assets and having meaningful names for them
84153
- * @type {Map<string, AssetDescription>}
84154
- * @private
84155
- */
84156
- this.aliases = new Map();
84144
+ /**
84145
+ * Named links to specific assets. Useful to later re-mapping assets and having meaningful names for them
84146
+ * @type {Map<string, AssetDescription>}
84147
+ * @private
84148
+ */
84149
+ #aliases = new Map();
84157
84150
 
84158
- /**
84159
- * This will be added to asset path for actual network resolution
84160
- * @type {string}
84161
- * @private
84162
- */
84163
- this.rootPath = '';
84151
+ /**
84152
+ * This will be added to asset path for actual network resolution
84153
+ * @type {string}
84154
+ * @private
84155
+ */
84156
+ rootPath = '';
84164
84157
 
84165
- /**
84166
- *
84167
- * @type {Engine}
84168
- * @private
84169
- */
84170
- this.__engine = engine;
84158
+ /**
84159
+ *
84160
+ * @type {CrossOriginConfig}
84161
+ */
84162
+ crossOriginConfig = new CrossOriginConfig();
84171
84163
 
84172
- /**
84173
- *
84174
- * @type {CrossOriginConfig}
84175
- */
84176
- this.crossOriginConfig = new CrossOriginConfig();
84164
+ /**
84165
+ *
84166
+ * @type {HashSet<AssetDescription>}
84167
+ * @private
84168
+ */
84169
+ #failures = new HashSet();
84177
84170
 
84178
- /**
84179
- *
84180
- * @type {HashSet<AssetDescription>}
84181
- * @private
84182
- */
84183
- this.failures = new HashSet();
84171
+ /**
84172
+ * Queue of responses that are waiting to be dispatched
84173
+ * @type {Deque<Response>}
84174
+ * @private
84175
+ */
84176
+ #response_queue = new Deque();
84184
84177
 
84185
- /**
84186
- * Queue of responses that are waiting to be dispatched
84187
- * @type {Deque<Response>}
84188
- * @private
84189
- */
84190
- this.__response_queue = new Deque();
84178
+ /**
84179
+ *
84180
+ * @type {Task}
84181
+ * @private
84182
+ */
84183
+ #response_processor = new Task({
84184
+ name: "Asset Manager Response processor",
84185
+ cycleFunction: () => {
84186
+ if (this.#response_queue.isEmpty()) {
84187
+ return TaskSignal.Yield;
84188
+ }
84191
84189
 
84192
- /**
84193
- *
84194
- * @type {Task}
84195
- * @private
84196
- */
84197
- this.__response_processor = new Task({
84198
- name: "Asset Manager Response processor",
84199
- cycleFunction: () => {
84200
- if (this.__response_queue.isEmpty()) {
84201
- return TaskSignal.Yield;
84202
- }
84190
+ const response = this.#response_queue.removeFirst();
84203
84191
 
84204
- const response = this.__response_queue.removeFirst();
84192
+ this.#process_response(response);
84205
84193
 
84206
- this.__process_response(response);
84194
+ return TaskSignal.Continue;
84195
+ }
84196
+ });
84207
84197
 
84208
- return TaskSignal.Continue;
84209
- }
84210
- });
84198
+ /**
84199
+ *
84200
+ * @type {boolean}
84201
+ * @private
84202
+ */
84203
+ #is_running = false;
84204
+
84205
+ /**
84206
+ *
84207
+ * @type {Engine|null}
84208
+ * @private
84209
+ */
84210
+ #engine = null;
84211
+
84212
+ /**
84213
+ *
84214
+ * @param {Engine} engine
84215
+ * @constructor
84216
+ */
84217
+ constructor(engine) {
84218
+
84219
+ this.#engine = engine;
84211
84220
 
84212
- /**
84213
- *
84214
- * @type {boolean}
84215
- * @private
84216
- */
84217
- this.__is_running = false;
84218
84221
  }
84219
84222
 
84220
84223
  startup() {
84221
- if (this.__is_running) {
84224
+ if (this.#is_running) {
84222
84225
  return;
84223
84226
  }
84224
84227
 
84225
- this.__engine.executor.run(this.__response_processor);
84228
+ this.#engine.executor.run(this.#response_processor);
84226
84229
 
84227
- this.__is_running = true;
84230
+ this.#is_running = true;
84228
84231
  }
84229
84232
 
84230
84233
  /**
@@ -84233,18 +84236,18 @@ class AssetManager {
84233
84236
  * @return {Promise<void>}
84234
84237
  */
84235
84238
  async shutdown(immediate = false) {
84236
- if (!this.__is_running) {
84239
+ if (!this.#is_running) {
84237
84240
  return;
84238
84241
  }
84239
84242
 
84240
84243
  if (!immediate) {
84241
84244
  // wait until all responses have been processed
84242
- await Promise.allSettled([Task.promise(this.__response_processor)]);
84245
+ await Promise.allSettled([Task.promise(this.#response_processor)]);
84243
84246
  }
84244
84247
 
84245
- this.__engine.executor.removeTask(this.__response_processor);
84248
+ this.#engine.executor.removeTask(this.#response_processor);
84246
84249
 
84247
- this.__is_running = false;
84250
+ this.#is_running = false;
84248
84251
  }
84249
84252
 
84250
84253
  /**
@@ -84333,6 +84336,8 @@ class AssetManager {
84333
84336
  console.warn(`Another asset under ${assetDescription} already exists and will be replaced`);
84334
84337
  }
84335
84338
 
84339
+ // TODO check for assets in-flight
84340
+
84336
84341
  this.assets.set(assetDescription, asset);
84337
84342
  }
84338
84343
 
@@ -84341,7 +84346,7 @@ class AssetManager {
84341
84346
  * @param {Response} response
84342
84347
  * @private
84343
84348
  */
84344
- __process_response(response) {
84349
+ #process_response(response) {
84345
84350
 
84346
84351
  try {
84347
84352
  response.request.successCallback(response.asset);
@@ -84356,8 +84361,8 @@ class AssetManager {
84356
84361
  * @param {AssetRequest} request
84357
84362
  * @private
84358
84363
  */
84359
- __schedule_response(asset, request) {
84360
- this.__response_queue.add(new Response$1(asset, request));
84364
+ #schedule_response(asset, request) {
84365
+ this.#response_queue.add(new Response$1(asset, request));
84361
84366
  }
84362
84367
 
84363
84368
  /**
@@ -84365,11 +84370,11 @@ class AssetManager {
84365
84370
  * @param {PendingAsset} asset
84366
84371
  * @private
84367
84372
  */
84368
- __schedule_load(asset) {
84369
- if (this.__pending_asset_active_load_set.size < this.load_concurrency) {
84370
- this.__dispatch_pending_asset(asset);
84373
+ #schedule_load(asset) {
84374
+ if (this.#pending_asset_active_load_set.size < this.load_concurrency) {
84375
+ this.#dispatch_pending_asset(asset);
84371
84376
  } else {
84372
- this.__pending_asset_wait_queue.push(asset);
84377
+ this.#pending_asset_wait_queue.push(asset);
84373
84378
  }
84374
84379
  }
84375
84380
 
@@ -84378,17 +84383,17 @@ class AssetManager {
84378
84383
  * @param {PendingAsset} asset
84379
84384
  * @private
84380
84385
  */
84381
- __force_load(asset) {
84386
+ #force_load(asset) {
84382
84387
  // check if the asset is already being loaded
84383
- if (this.__pending_asset_active_load_set.has(asset)) {
84388
+ if (this.#pending_asset_active_load_set.has(asset)) {
84384
84389
  return;
84385
84390
  }
84386
84391
 
84387
84392
  // remove from queue
84388
- this.__pending_asset_wait_queue.delete(asset);
84393
+ this.#pending_asset_wait_queue.delete(asset);
84389
84394
 
84390
84395
  // dispatch
84391
- this.__dispatch_pending_asset(asset);
84396
+ this.#dispatch_pending_asset(asset);
84392
84397
 
84393
84398
  }
84394
84399
 
@@ -84397,21 +84402,21 @@ class AssetManager {
84397
84402
  * @param {PendingAsset} pending_asset
84398
84403
  * @private
84399
84404
  */
84400
- __handle_asset_resolved(pending_asset) {
84405
+ #handle_asset_resolved(pending_asset) {
84401
84406
  // console.log(`Asset resolved ${pending_asset.description}`); // DEBUG
84402
84407
 
84403
- const active_set = this.__pending_asset_active_load_set;
84408
+ const active_set = this.#pending_asset_active_load_set;
84404
84409
 
84405
84410
  this.request_map.delete(pending_asset.description);
84406
84411
  active_set.delete(pending_asset);
84407
84412
 
84408
- const queue = this.__pending_asset_wait_queue;
84413
+ const queue = this.#pending_asset_wait_queue;
84409
84414
 
84410
84415
  // schedule more if possible
84411
84416
  while (!queue.isEmpty() && active_set.size < this.load_concurrency) {
84412
84417
  const load = queue.pop();
84413
84418
 
84414
- this.__dispatch_pending_asset(load);
84419
+ this.#dispatch_pending_asset(load);
84415
84420
  }
84416
84421
  }
84417
84422
 
@@ -84420,7 +84425,7 @@ class AssetManager {
84420
84425
  * @param {PendingAsset} pendingAsset
84421
84426
  * @private
84422
84427
  */
84423
- __dispatch_pending_asset(pendingAsset) {
84428
+ #dispatch_pending_asset(pendingAsset) {
84424
84429
  // console.log(`Asset load dispatched ${pendingAsset.description}`); // DEBUG
84425
84430
 
84426
84431
  const requests = pendingAsset.requests;
@@ -84428,7 +84433,7 @@ class AssetManager {
84428
84433
  const type = assetDescription.type;
84429
84434
  const path = assetDescription.path;
84430
84435
 
84431
- const loader = this.loaders[type];
84436
+ const loader = this.#loaders[type];
84432
84437
 
84433
84438
  if (loader === undefined) {
84434
84439
  let reported_error = false;
@@ -84437,7 +84442,7 @@ class AssetManager {
84437
84442
  const assetRequest = requests[i];
84438
84443
 
84439
84444
  if (typeof assetRequest.failureCallback === "function") {
84440
- assetRequest.failureCallback(`no loader exists for asset type '${type}', valid types are: ${Object.keys(this.loaders).join(', ')}`);
84445
+ assetRequest.failureCallback(`no loader exists for asset type '${type}', valid types are: ${Object.keys(this.#loaders).join(', ')}`);
84441
84446
  } else {
84442
84447
  //uncaught
84443
84448
  if (!reported_error) {
@@ -84447,16 +84452,16 @@ class AssetManager {
84447
84452
  }
84448
84453
  }
84449
84454
 
84450
- this.__handle_asset_resolved(pendingAsset);
84455
+ this.#handle_asset_resolved(pendingAsset);
84451
84456
 
84452
84457
  return;
84453
84458
  }
84454
84459
 
84455
84460
  // mark as being loaded
84456
- this.__pending_asset_active_load_set.add(pendingAsset);
84461
+ this.#pending_asset_active_load_set.add(pendingAsset);
84457
84462
 
84458
84463
  const assets = this.assets;
84459
- const failures = this.failures;
84464
+ const failures = this.#failures;
84460
84465
 
84461
84466
 
84462
84467
  /**
@@ -84480,7 +84485,7 @@ class AssetManager {
84480
84485
  let asset = loaded_asset;
84481
84486
 
84482
84487
  // apply transform chain
84483
- const transformers = this.transformers[type];
84488
+ const transformers = this.#transformers[type];
84484
84489
  if (transformers !== undefined) {
84485
84490
  const transformer_count = transformers.length;
84486
84491
  for (let i = 0; i < transformer_count; i++) {
@@ -84503,13 +84508,13 @@ class AssetManager {
84503
84508
  assets.set(assetDescription, asset);
84504
84509
 
84505
84510
  //clear callbacks etc.
84506
- this.__handle_asset_resolved(pendingAsset);
84511
+ this.#handle_asset_resolved(pendingAsset);
84507
84512
 
84508
84513
 
84509
84514
  // process callbacks
84510
84515
  for (let i = 0; i < requests.length; i++) {
84511
84516
  const request = requests[i];
84512
- this.__schedule_response(asset, request);
84517
+ this.#schedule_response(asset, request);
84513
84518
  }
84514
84519
 
84515
84520
  };
@@ -84537,7 +84542,7 @@ class AssetManager {
84537
84542
  }
84538
84543
 
84539
84544
  //clear callbacks etc.
84540
- this.__handle_asset_resolved(pendingAsset);
84545
+ this.#handle_asset_resolved(pendingAsset);
84541
84546
 
84542
84547
  // record failure
84543
84548
  failures.add(assetDescription);
@@ -84603,15 +84608,15 @@ class AssetManager {
84603
84608
 
84604
84609
  if (shouldSchedule) {
84605
84610
  // not loading yet, lets create a load container and schedule it
84606
- this.__schedule_load(pendingAsset);
84611
+ this.#schedule_load(pendingAsset);
84607
84612
  } else {
84608
84613
  // update priority queue if necessary
84609
- this.__pending_asset_wait_queue.updateElementScore(pendingAsset);
84614
+ this.#pending_asset_wait_queue.updateElementScore(pendingAsset);
84610
84615
  }
84611
84616
 
84612
84617
 
84613
84618
  if (request.getFlag(AssetRequestFlags.SkipQueue)) {
84614
- this.__force_load(pendingAsset);
84619
+ this.#force_load(pendingAsset);
84615
84620
  }
84616
84621
  }
84617
84622
 
@@ -84633,7 +84638,7 @@ class AssetManager {
84633
84638
  getLoaderByType(type) {
84634
84639
  assert.isString(type, 'type');
84635
84640
 
84636
- return this.loaders[type];
84641
+ return this.#loaders[type];
84637
84642
  }
84638
84643
 
84639
84644
  /**
@@ -84642,7 +84647,7 @@ class AssetManager {
84642
84647
  * @return {AssetDescription[]}
84643
84648
  * @private
84644
84649
  */
84645
- __getLoadedAssetDescriptorsByType(type) {
84650
+ #getLoadedAssetDescriptorsByType(type) {
84646
84651
  const loaded_assets = Array.from(this.assets.keys());
84647
84652
  return loaded_assets.filter(t => t.type === type);
84648
84653
  }
@@ -84653,18 +84658,18 @@ class AssetManager {
84653
84658
  * @param {AssetTransformer<T>} transformer
84654
84659
  */
84655
84660
  registerTransformer(type, transformer) {
84656
- let transformers = this.transformers[type];
84661
+ let transformers = this.#transformers[type];
84657
84662
 
84658
84663
  if (transformers === undefined) {
84659
84664
  transformers = [];
84660
84665
 
84661
- this.transformers[type] = transformers;
84666
+ this.#transformers[type] = transformers;
84662
84667
  }
84663
84668
 
84664
84669
  transformers.push(transformer);
84665
84670
 
84666
84671
  // check for loaded assets
84667
- const matching_assets = this.__getLoadedAssetDescriptorsByType(type);
84672
+ const matching_assets = this.#getLoadedAssetDescriptorsByType(type);
84668
84673
 
84669
84674
  if (matching_assets.length > 0) {
84670
84675
  console.warn(`Following assets of matching type '${type}' are already loaded and transform is not applied to them:\n\t${matching_assets.join('\n\t')}`);
@@ -84679,7 +84684,7 @@ class AssetManager {
84679
84684
  */
84680
84685
  unregisterTransformer(type, transformer) {
84681
84686
 
84682
- const transformers = this.transformers[type];
84687
+ const transformers = this.#transformers[type];
84683
84688
 
84684
84689
  if (transformers === undefined) {
84685
84690
  // not found
@@ -84692,7 +84697,7 @@ class AssetManager {
84692
84697
  }
84693
84698
 
84694
84699
  // check for loaded assets
84695
- const matching_assets = this.__getLoadedAssetDescriptorsByType(type);
84700
+ const matching_assets = this.#getLoadedAssetDescriptorsByType(type);
84696
84701
 
84697
84702
  if (matching_assets.length > 0) {
84698
84703
  console.warn(`Following assets of matching type '${type}' are already loaded and transform was probably already applied to them:\n\t${matching_assets.join('\n\t')}`);
@@ -84731,11 +84736,11 @@ class AssetManager {
84731
84736
 
84732
84737
  } else {
84733
84738
 
84734
- await loader.link(this, this.__engine);
84739
+ await loader.link(this, this.#engine);
84735
84740
 
84736
84741
  }
84737
84742
 
84738
- this.loaders[type] = loader;
84743
+ this.#loaders[type] = loader;
84739
84744
 
84740
84745
  return loader;
84741
84746
  }
@@ -84754,7 +84759,7 @@ class AssetManager {
84754
84759
  }
84755
84760
 
84756
84761
  // first remove the loader from registry so no further asset requests can be made
84757
- delete this.loaders[type];
84762
+ delete this.#loaders[type];
84758
84763
 
84759
84764
  // TODO address all pending requests, possibly waiting for all of them to finalize
84760
84765
 
@@ -84790,7 +84795,7 @@ class AssetManager {
84790
84795
  isFailed(path, type) {
84791
84796
  const ad = new AssetDescription(path, type);
84792
84797
 
84793
- return this.failures.has(ad);
84798
+ return this.#failures.has(ad);
84794
84799
  }
84795
84800
 
84796
84801
  /**
@@ -84802,7 +84807,7 @@ class AssetManager {
84802
84807
  assert.typeOf(alias, 'string', 'alias');
84803
84808
 
84804
84809
  // resolve alias
84805
- const assetDescription = this.aliases.get(alias);
84810
+ const assetDescription = this.#aliases.get(alias);
84806
84811
 
84807
84812
  if (assetDescription === undefined) {
84808
84813
  return new Promise.reject(`Alias '${alias}' not found`);
@@ -84820,7 +84825,7 @@ class AssetManager {
84820
84825
 
84821
84826
  // todo consider cloning result to protect against mutation
84822
84827
 
84823
- return this.aliases.get(alias);
84828
+ return this.#aliases.get(alias);
84824
84829
 
84825
84830
  }
84826
84831
 
@@ -84837,7 +84842,7 @@ class AssetManager {
84837
84842
 
84838
84843
  const assetDescription = new AssetDescription(path, type);
84839
84844
 
84840
- this.aliases.set(alias, assetDescription);
84845
+ this.#aliases.set(alias, assetDescription);
84841
84846
  }
84842
84847
  }
84843
84848