THREE.MeshLine icon indicating copy to clipboard operation
THREE.MeshLine copied to clipboard

BufferGeometry need to be called with `new`

Open tiye opened this issue 4 years ago • 5 comments

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.

tiye avatar May 07 '21 16:05 tiye

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

RenaudRohlinger avatar May 18 '21 05:05 RenaudRohlinger

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.

Alchemist0823 avatar Jun 05 '21 21:06 Alchemist0823

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

lucascassiano avatar Sep 27 '21 01:09 lucascassiano

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

tiye avatar Sep 27 '21 03:09 tiye

interested in this fix

jrmahechad avatar Feb 10 '22 16:02 jrmahechad