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

BufferGeometry need to be called with new #139

Open
tiye opened this issue May 7, 2021 · 5 comments
Open

BufferGeometry need to be called with new #139

tiye opened this issue May 7, 2021 · 5 comments

Comments

@tiye
Copy link

tiye commented May 7, 2021

The code uses https://github.com/spite/THREE.MeshLine/blob/master/src/THREE.MeshLine.js#L12

    THREE.BufferGeometry.call(this)

however recently threejs has some changes to make use of ES6 classes

All central engine components like Object3D, BufferGeometry or ShaderMaterial are now ES6 classes.

https://github.com/mrdoob/three.js/wiki/Migration-Guide#127--128

need an update now.

@RenaudRohlinger
Copy link

RenaudRohlinger commented May 18, 2021

Hello! Thank you very much for this amazing library @spite. I made a new version of a library using vite and typescript. I would be happy to PR it on your repo but I went a bit yolo and had to use --allow-unrelated-histories.
https://github.com/utsuboco/THREE.MeshLine

Temporary I published it on npm under the name meshline. It should work the same way, and it now exports es(2.89kb brotli) and umd(3.13kb).
image

If anyone could take over in cleaning the code that would be amazing.

Here a working example with react-three/fiber:
https://codesandbox.io/s/confetti-typescript-meshline-0f4mi?file=/src/index.tsx

EDIT:
Added typescript definitions in 2.0.3

@Alchemist0823
Copy link

Hello! Thank you very much for this amazing library @spite. I made a new version of a library using vite and typescript. I would be happy to PR it on your repo but I went a bit yolo and had to use --allow-unrelated-histories.
https://github.com/RenaudRohlinger/THREE.MeshLine

Temporary I published it on npm under the name meshline. It should work the same way, and it now exports es(2.89kb brotli) and umd(3.13kb).
image

If anyone could take over in cleaning the code that would be amazing.
I am not very strong with typescript maybe @xia-st you could be interested in helping on this part I saw your PR.

Here a working example with react-three/fiber:
https://codesandbox.io/s/confetti-forked-0f4mi?file=/src/index.js

Hi @RenaudRohlinger, if you build it using typescript, it's better to also generate the d.ts file and include them in the package so other typescript users can use it too.

@lucascassiano
Copy link

Class constructor BufferGeometry cannot be invoked without 'new' Error continues, anyone has solved this?

@tiye
Copy link
Author

tiye commented Sep 27, 2021

Well, already an PR #143 but....

@jrmahechad
Copy link

interested in this fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants