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

Handle Geometry deprecation in three.js r125 #16

Closed
xawill opened this issue Jan 15, 2021 · 10 comments
Closed

Handle Geometry deprecation in three.js r125 #16

xawill opened this issue Jan 15, 2021 · 10 comments
Labels
bug Something isn't working

Comments

@xawill
Copy link
Contributor

xawill commented Jan 15, 2021

According to this PR (among other issues and PRs in the three.js repo), three.js will drop the support for the Geometry class in favour of BufferGeometry.

What do you want to do about it ?

PS: I know the deprecation is not yet effective in a released version of three.js, but it will be eventually (as soon as r125 at the end of the month) and it is in all cases way better to use BufferGeometry instead of Geometry for performance reasons, even though it might be a little less intuitive to work with code-wise.

@xawill xawill added the bug Something isn't working label Jan 15, 2021
@hishtadlut
Copy link

hishtadlut commented Feb 10, 2021

This is my error massage.

`Error: ./node_modules/three-csg-ts/lib/index.js 17:23-31
"export 'Geometry' was not found in 'three'

Error: ./node_modules/three-csg-ts/lib/index.js 49:25-33
"export 'Geometry' was not found in 'three'

Error: node_modules/three-csg-ts/lib/index.d.ts:1:26 - error TS2305: Module '"../../three/src/Three"' has no exported member 'Geometry'.

1 import { BufferGeometry, Geometry, Matrix4, Mesh, Vector2, Vector3 } from 'three';`

@xawill
Copy link
Contributor Author

xawill commented Feb 10, 2021

I saw a patch has been released recently to force the version of three.js below r126 (excluded). I don’t know if @samalexander did this to buy time or if this is a permanent « fix » and that the library is not planed to support three.js r126 and later.

@samalexander
Copy link
Owner

@xawill having seen that Geometry was deprecated in r125, I updated the peer dependency version range for three to < 0.125.0. This was purely to clarify compatibility of the library as things stand. Ordinarily we'd set peer dependency support up to the next major version, but since three doesn't follow conventional semver (and this is a breaking change), it's not that simple.

I suspect that this is going to require replacing the library's use of Geometry with BufferGeometry, which is trickier to work with. Open to any other suggestions..

This library was created to support a couple of our client's projects. They are not yet on the latest version of three and so this is not a priority for us right now.

That said, I'm happy to take a look once I get time. Otherwise, happy to accept any PRs.

@yandeu
Copy link

yandeu commented Feb 26, 2021

I forked this repo a while ago and added support for Three.js >= r125.
See this topic.

@JeffreyArts
Copy link

JeffreyArts commented May 14, 2021

@yandeu Would it be possible for you to create a pull request, to update this package by adding support for Three.js >= r125?

The simplified user interface is very much appreciated btw ;-)
Using CSG.subtract(MeshA, MeshB), instead of CSG.toMesh(CSG.fromMesh(MeshA).subtract(CSG.fromMesh(MeshB), MeshA.matrix). But that might just as well just be a me thing.

@yandeu
Copy link

yandeu commented May 14, 2021

Hi @JeffreyArts

There is now a better option available I want to use in the future.

@manthrax Updated its THREE-CSGMesh library lately to make it work with BufferGeometries. I have forked it with the idea to rewrite it in TypeScript and merge it back to THREE-CSGMesh and then use it in enable3d. It is nearly finished but I had not time to completely finish it yet.

Using CSG.subtract(MeshA, MeshB), instead of CSG.toMesh(CSG.fromMesh(MeshA).subtract(CSG.fromMesh(MeshB), MeshA.matrix). But that might just as well just be a me thing.

I think it is a good idea to include these fancy wrapper functions I use in enable3d.


@manthrax What do you think? Are you ready to merge my TypeScript fork once finished?
Or should I publish my own package as part of the enable3d organization?
Or has @samalexander plans to update this package to use BufferGeometries?

@JeffreyArts
Copy link

Hi @JeffreyArts

There is now a better option available I want to use in the future.

@manthrax Updated its THREE-CSGMesh library lately to make it work with BufferGeometries. I have forked it with the idea to rewrite it in TypeScript and merge it back to THREE-CSGMesh and then use it in enable3d. It is nearly finished but I had not time to completely finish it yet.
(...)
I honestly have no idea how to include @mathrax's library, in a maintainable manner. Since I can not find it on NPM.

@yandeu
Copy link

yandeu commented May 14, 2021

I honestly have no idea how to include @mathrax's library, in a maintainable manner. Since I can not find it on NPM.

This will be handled by my fork. Either I merge it back and @manthrax published it to npm or I keep the fork and publish it myself to npm. We will see.

@samalexander
Copy link
Owner

samalexander commented May 14, 2021

Support for three v0.125.0 and above has been released in three-csg-ts v3.0.0. Many thanks again to @manthrax for the original code.

@yandeu
Copy link

yandeu commented May 14, 2021

Thanks!

I will check with Michael what his plans are. But I guess I will just merge my fork into enable3d then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants