Skip to content

Commit c741d79

Browse files
authored
Merge pull request #17357 from kaisalmen/OBJLoader2Parser_onProgressCorrection
OBJLoader2Parser: Simplified private _onError callback
2 parents fd500fd + cc1be0e commit c741d79

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const OBJLoader2Parser = function () {
1010

1111
let scope = this;
1212
this.callbacks = {
13-
onProgress: function ( type, text, numericalValue ) {
14-
scope._onProgress( type, text, numericalValue )
13+
onProgress: function ( text ) {
14+
scope._onProgress( text )
1515
},
1616
onAssetAvailable: function ( payload ) {
1717
scope._onAssetAvailable( payload )
@@ -217,26 +217,14 @@ OBJLoader2Parser.prototype = {
217217
},
218218

219219
/**
220-
* Announce feedback which is give to the registered callbacks.
220+
* Announce parse progress feedback which is logged to the console.
221221
* @private
222222
*
223-
* @param {string} type The type of event
224223
* @param {string} text Textual description of the event
225-
* @param {number} numericalValue Numerical value describing the progress
226224
*/
227-
_onProgress: function ( type, text, numericalValue ) {
225+
_onProgress: function ( text ) {
228226

229227
let message = text ? text : '';
230-
let event = {
231-
detail: {
232-
type: type,
233-
modelName: this.modelName,
234-
instanceNo: this.instanceNo,
235-
text: message,
236-
numericalValue: numericalValue
237-
}
238-
};
239-
240228
if ( this.logging.enabled && this.logging.debug ) {
241229

242230
console.log( message );
@@ -246,7 +234,7 @@ OBJLoader2Parser.prototype = {
246234
},
247235

248236
/**
249-
* Announce error feedback which is given to the generic error handler to the registered callbacks.
237+
* Announce error feedback which is logged as error message.
250238
* @private
251239
*
252240
* @param {String} errorMessage The event containing the error
@@ -825,8 +813,8 @@ OBJLoader2Parser.prototype = {
825813

826814
this._buildMesh( result );
827815
let progressBytesPercent = this.globalCounts.currentByte / this.globalCounts.totalBytes;
828-
this._onProgress( 'progressParse', 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + '' +
829-
'] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%', progressBytesPercent );
816+
this._onProgress( 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + '' +
817+
'] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%' );
830818
this._resetRawMesh();
831819

832820
}

0 commit comments

Comments
 (0)