Skip to content
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

Threejs loaders example request #41

Open
lobis opened this issue Apr 5, 2021 · 1 comment
Open

Threejs loaders example request #41

lobis opened this issue Apr 5, 2021 · 1 comment
Labels
feature New feature or request good first issue An issue awaits its hero. Contributions are welcome

Comments

@lobis
Copy link

lobis commented Apr 5, 2021

I am trying to call three.js in the browser using Kotlin.

In my first attempt, I used the original three.js wrapper from Lars Ivar Hatledal, which this project also includes. I started from the examples in https://laptrinhx.com/kotlin-wrappers-for-three-js-2366010328/, but I quickly found out the newest version of Kotlin (1.4.32) does not work out of the box with it (problems with kotlin.browser.* vs kotlinx.browser.*) so I used the version distributed by visionforge instead.

I managed to render a simple cube successfully (based on the first example in the linked page).

However, I cannot get the Loaders to work, I failed to load an .stl model and an Object3D model. The code compiles correctly but I get the following errors in the browser:

For Object3D loader:
image

For JSON loader (Object3D):
image
This seems to be related to the fact that JSONLoader was removed in the r99 release of three.js (https://discourse.threejs.org/t/objectloader-not-loading-json-file/5213)

For the STL something similar happens.

To me it looks like there are some problems with the three.js wrapper, please correct me if I am wrong. I would appreciate an example on how to correctly call this methods. Also I couldn't get the dat.gui or stats to work following the example.

Here you can find an example project which reproduces this issues.

Thank you.

Luis.

@altavir
Copy link
Member

altavir commented Apr 5, 2021

Three-JS has several modules and they need to be loaded into the webpack bundle in order to be accessible. I will research this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue An issue awaits its hero. Contributions are welcome
Projects
None yet
Development

No branches or pull requests

2 participants