Issue using Three.js external renderers with version higher than r79

820
2
Jump to solution
01-04-2022 05:01 PM
BerNat
by
New Contributor

Hi

I’ve been scratching my head trying to figure out how to use Three.js from an external renderer.

I saw this example  https://totalapis.github.io/sample-code/scene-external-renderer-threejs/index.html which works fine by using r79 version of Three.js.

Instead, a bunch of errors are thrown by using newer versions of Three (such as   multipleDefine).

Does anyone have any idea to solve this issue?

 

 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
GreteSoosalu
Esri Contributor

Hi BerNat! 

Oh, I know the pain and have also run into various issues when wanting to upgrade the libraries in this sample: over time, Three.js has changed, ArcGIS JS API has changed and CORS policies have changed. 

Here's a codepen that works with Three.js r124 and above:
https://codepen.io/gsoosalu/pen/JjrZEaR 
In the code, you'll also find comments about what exactly is different compared to the previous sample. 

Note: this codepen app also works with JS API versions higher than 4.4 (i.e. also with the newest: 4.23), but newer versions run into CORS error when trying to access the ISS location JSON. For tackling that, the following page might be helpful: https://developers.arcgis.com/javascript/latest/cors/


I hope this helps you further! 

View solution in original post

2 Replies
GreteSoosalu
Esri Contributor

Hi BerNat! 

Oh, I know the pain and have also run into various issues when wanting to upgrade the libraries in this sample: over time, Three.js has changed, ArcGIS JS API has changed and CORS policies have changed. 

Here's a codepen that works with Three.js r124 and above:
https://codepen.io/gsoosalu/pen/JjrZEaR 
In the code, you'll also find comments about what exactly is different compared to the previous sample. 

Note: this codepen app also works with JS API versions higher than 4.4 (i.e. also with the newest: 4.23), but newer versions run into CORS error when trying to access the ISS location JSON. For tackling that, the following page might be helpful: https://developers.arcgis.com/javascript/latest/cors/


I hope this helps you further! 

BerNat
by
New Contributor

Thank you so much GreteSoosalu!

Your hints solved any issue and definitely saved me a lot of struggles!!

 

0 Kudos