-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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
Geometries: Move to ES6 classes. #17425
Conversation
I realize right now that a lot of example code needs to be converted to classes during this process. For instance as soon as |
If this is a concern then maybe the buble transformation can be applied to the |
I'm fine with that. Although I think the transition in the examples folder is definitely manageable. It will just take a little bit more time. TBH, my comment was not intended to question the migration itself 😅. I think it's important to go that way. We just have to be aware about the consequences. |
Oh yeah! I think it's great we're moving to classes. I just mean to suggest that if the migration of the examples is disagreeable for whatever reason that this could be a solution / stopgap. |
Hi ! do you know a time frame when this will be merged ? thx ! |
@mrdoob Is it okay to move on with the class migration? |
thx mugen87 ! |
@Mugen87 note that your JSFiddle could also be fixed with the somewhat easier change to |
That's great! I was not aware of the usage of |
Um, I've directly tried the I've just copied over the latest code of THREE.ParametricGeometry.constructor.call( this, ParametricTube, segments, segmentsRadius ); |
@Mugen87 Hm, you're right. My suggestion runs in that Fiddle, because Unless we want to transpile all classes (for both the module and commonjs builds) during the migration, sounds like we'll need to start with |
Aha! found this PR. Will look into the scripts and see if I can do a similar thing with one of the smaller folders. |
Closing this for now. Let's proceed with ES6 classes next year when |
Moves all geometry generators to ES6 classes.
One important note: It was necessary to refactor
ParametricGeometries
from the examples. It used to derive fromParametricGeometry
viaParametricGeometry.call()
which is not valid with ES6 classes anymore. The following small fiddle demonstrates this issue:https://jsfiddle.net/w2xfb6eg/
All devs have to be aware of this language detail. Again, there will be no problem when using
three.js
orthree.min.js
. But consumers ofthree.module.js
will have to upgrade their code to classes or add some sort of additional compilation step if they derive own classes from library entities viaFunction.prototype.call()
.