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