question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move GLTFLoader, OrbitControls, and BufferGeometryUtils to core

See original GitHub issue

Is your feature request related to a problem? Please describe.

The GLTFLoader, OrbitControls, and BufferGeometryUtils are the three most imported things from the examples/jsm (and the postprocessing-related things are the fourth, I think). I also think that they are stable enough to be moved to the core.

Describe the solution you’d like

I suggest they would be moved to the core.

Describe alternatives you’ve considered

They can remain in the examples and then users will still import them from examples/jsm.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
donmccurdycommented, Mar 31, 2022

… But most users are using the three.js’ built-in one - and for them it would be just more understandable to import it from the core and not the examples.

I’m not sure I agree with this – isn’t it also confusing if some official loaders and controls come from one place, others from another? Why should switching from OrbitControls to MapControls change how you import the module?

It is a real source of confusion that we provide both examples/js and examples/jsm, and CDNs add another layer of complexity. I think Spotify’s concept of a golden path (“the opinionated and supported path to build something”) is a good thing, and we don’t really have that for our examples today. To me that is the underlying problem that leads people to want things moved into core, but I’m not sure it’s the right solution.

Keeping the core build small also makes it easier to avoid gradually slipping into complicated interdependencies. For example, GLTFLoader’s spec/gloss materials are not (and shouldn’t be) core three.js materials.

4reactions
donmccurdycommented, Mar 31, 2022

The threshold for “three” vs. “three/examples/jsm/…” should probably not be stability or popularity, but:

  1. Is it a building block for the three.js library, or key libraries in the ecosystem?
  2. Is it valuable for three.js to offer exactly one obvious way to solve the problem?

Personally I don’t think these modules satisfy those two goals. They’re popular, but not foundational to other things. There are many ways to implement or customize controls, of which OrbitControls is the most popular but not the “best” in any objective way. There are at least two other glTF loaders for three.js, with their own pros/cons.

I could see components related to post-processing or node materials needing to be pulled into the core build at some point, for these reasons. Stability is necessary but not sufficient, and popularity is orthogonal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OrbitControls – three.js docs
Orbit controls allow the camera to orbit around a target. To use this, as with all files in the /examples directory, you will...
Read more >
Importing examples jsm modules causes bundlers to bundle ...
For example, when doing import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' , the bundler will follow the import and ...
Read more >
cannot use/import GLTFLoader and OrbitControls from threejs ...
I want to load a 3dModel with GLTFLoader but I cannot import it. Then I have tried to import OrbitControls and I got...
Read more >
Adding OrbitControls to React Three Fiber - Code Workshop
Three.JS has an import we can use called OrbitControls that adds a lot of free camera movement functionality. It is very configurable and...
Read more >
TransformControls with GLTF Animations - Three.js Tutorials
import * as THREE from 'three' import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' import { GLTFLoader } from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found