-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Returning conversion warnings in 3DMLoader #21639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 21 commits
158a875
ec3ff76
89da0c7
78afc99
c810381
4176142
1d97c81
e21f211
da176ab
6c02601
ea34dbf
103675f
7731833
0652c61
b1ecb5e
27b8f45
92a0c62
6a35bd8
0f2ac4a
cb633a0
e3a7f58
3cdfabe
e9d7654
0c60f5f
5d06888
3ca34c0
bd86376
59dd4bd
7f8bcc4
a7806e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ class Rhino3dmLoader extends Loader { | |
| this.workerConfig = {}; | ||
|
|
||
| this.materials = []; | ||
| this.warnings = []; | ||
|
|
||
| } | ||
|
|
||
|
|
@@ -89,7 +90,7 @@ class Rhino3dmLoader extends Loader { | |
|
|
||
| this.decodeObjects( buffer, url ) | ||
| .then( onLoad ) | ||
| .catch( onError ); | ||
| .catch( e => onError( e ) ); | ||
|
|
||
| }, onProgress, onError ); | ||
|
|
||
|
|
@@ -121,12 +122,22 @@ class Rhino3dmLoader extends Loader { | |
|
|
||
| worker.postMessage( { type: 'decode', id: taskID, buffer }, [ buffer ] ); | ||
|
|
||
| //this.debug(); | ||
| // this.debug(); | ||
|
|
||
| } ); | ||
|
|
||
| } ) | ||
| .then( ( message ) => this._createGeometry( message.data ) ); | ||
| .then( ( message ) => { | ||
|
|
||
| const geometry = this._createGeometry( message.data ); | ||
| geometry.warnings = warnings; | ||
| return geometry; | ||
|
|
||
| } ).catch( e => { | ||
|
|
||
| throw e; | ||
|
|
||
| } ); | ||
|
|
||
| // Remove task from the task list. | ||
| // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416) | ||
|
|
@@ -160,7 +171,7 @@ class Rhino3dmLoader extends Loader { | |
|
|
||
| this.decodeObjects( data, '' ) | ||
| .then( onLoad ) | ||
| .catch( onError ); | ||
| .catch( e => onError( e ) ); | ||
|
|
||
| } | ||
|
|
||
|
|
@@ -332,7 +343,7 @@ class Rhino3dmLoader extends Loader { | |
|
|
||
| } else { | ||
|
|
||
| const material = this._createMaterial( ); | ||
| const material = this._createMaterial(); | ||
| _object = this._createObject( obj, material ); | ||
|
|
||
| } | ||
|
|
@@ -615,7 +626,7 @@ class Rhino3dmLoader extends Loader { | |
|
|
||
| } else if ( geometry.isLinearLight ) { | ||
|
|
||
| console.warn( 'THREE.3DMLoader: No conversion exists for linear lights.' ); | ||
| self.postMessage( { type: 'warning', id: taskID, message: 'THREE.3DMLoader: No conversion exists for linear lights.' } ); | ||
|
||
|
|
||
| return; | ||
|
|
||
|
|
@@ -709,6 +720,10 @@ class Rhino3dmLoader extends Loader { | |
|
|
||
| switch ( message.type ) { | ||
|
|
||
| case 'warning': | ||
| this.warnings.push( message ) | ||
| break; | ||
|
|
||
| case 'decode': | ||
| worker._callbacks[ message.id ].resolve( message ); | ||
| break; | ||
|
|
@@ -777,6 +792,7 @@ function Rhino3dmWorker() { | |
| let libraryPending; | ||
| let libraryConfig; | ||
| let rhino; | ||
| let taskID; | ||
|
|
||
| onmessage = function ( e ) { | ||
|
|
||
|
|
@@ -786,6 +802,7 @@ function Rhino3dmWorker() { | |
|
|
||
| case 'init': | ||
|
|
||
| console.log(message) | ||
karimi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| libraryConfig = message.libraryConfig; | ||
| const wasmBinary = libraryConfig.wasmBinary; | ||
| let RhinoModule; | ||
|
|
@@ -806,12 +823,20 @@ function Rhino3dmWorker() { | |
|
|
||
| case 'decode': | ||
|
|
||
| taskID = message.id; | ||
| const buffer = message.buffer; | ||
| libraryPending.then( () => { | ||
|
|
||
| const data = decodeObjects( rhino, buffer ); | ||
| try { | ||
|
|
||
| const data = decodeObjects( rhino, buffer, message.id ); | ||
karimi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| self.postMessage( { type: 'decode', id: message.id, data } ); | ||
|
|
||
| self.postMessage( { type: 'decode', id: message.id, data } ); | ||
| } catch ( error ) { | ||
|
|
||
| self.postMessage( { type: 'error', id: message.id, error } ); | ||
|
|
||
| } | ||
|
|
||
| } ); | ||
|
|
||
|
|
@@ -927,7 +952,7 @@ function Rhino3dmWorker() { | |
|
|
||
| } else { | ||
|
|
||
| console.warn( `THREE.3DMLoader: Image for ${textureType} texture not embedded in file.` ); | ||
| self.postMessage( { type: 'warning', id: taskID, message:`THREE.3DMLoader: Image for ${textureType} texture not embedded in file.` } ); | ||
| texture.image = null; | ||
|
|
||
| } | ||
|
|
@@ -1223,7 +1248,9 @@ function Rhino3dmWorker() { | |
| */ | ||
|
|
||
| default: | ||
| console.warn( `THREE.3DMLoader: TODO: Implement ${objectType.constructor.name}` ); | ||
|
|
||
| self.postMessage( { type: 'warning', id: taskID, message:`THREE.3DMLoader: TODO: Implement ${objectType.constructor.name}` } ); | ||
|
|
||
| break; | ||
|
|
||
| } | ||
|
|
@@ -1260,7 +1287,7 @@ function Rhino3dmWorker() { | |
|
|
||
| } else { | ||
|
|
||
| console.warn( `THREE.3DMLoader: ${objectType.constructor.name} has no associated mesh geometry.` ); | ||
| self.postMessage( { type: 'warning', id: taskID, message:`THREE.3DMLoader: ${objectType.constructor.name} has no associated mesh geometry.` } ); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,7 @@ | |
| // hide spinner | ||
| document.getElementById( 'loader' ).style.display = 'none'; | ||
|
|
||
| } ); | ||
| }, progress =>progress, error => ( console.log( error ) ) ); | ||
|
||
|
|
||
| controls = new OrbitControls( camera, renderer.domElement ); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.