upgrade three js version in autodesk forge viewer

痴心易碎 提交于 2021-01-04 05:40:46

问题


I was looking to upgrade the three js which is used in autodesk forge behind the scene and reason for upgrade is I am trying to use this library and this need three js r71 and above and inside forge viewer it seems they are using r33. I found a blog where it showed me how can I take the advantage of later three js. I followed it but seems like its not working. There forge viewer now have 2 references of three js and it gets confused which one to use and hence some of code behave weird

here is one of the example happening to me

THREE.Object3D.add: object not an instance of THREE.Object3D. 

I am getting this when I am trying to add a scene

some might would like to know what was happening with the three js which comes with forge viewer so here is the thing which is getting broken

I have also tried doing this below things adding source to three js

 <script src=" https://cdnjs.cloudflare.com/ajax/libs/three.js/r122/three.min.js"></script>

So is there any other solution which I can try and make it work also If someone had tried meshline library and faced similar issue and have solution for it do let me know


回答1:


Forge Viewer uses Three.js version 71, and due to the way both libraries are written, it is unfortunately very difficult to port Forge Viewer to more modern versions of Three.js.

You can try back-porting parts of Three.js that you're interested in manually (I did that for the Potree point cloud library), but such work is not an officially supported.



来源:https://stackoverflow.com/questions/65017846/upgrade-three-js-version-in-autodesk-forge-viewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!