spite / THREE.MeshLine

Mesh replacement for THREE.Line
MIT License
2.13k stars 379 forks source link

BufferGeometry need to be called with `new` #139

Open tiye opened 3 years ago

tiye commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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

tiye commented 2 years ago

Well, already an PR https://github.com/spite/THREE.MeshLine/pull/143 but....

jrmahechad commented 2 years ago

interested in this fix