In my .ts file, I am importing three classes. But they're all done in different ways.
import * as THREE from 'three'
import Stats from 'three/examples/jsm/libs/stats.module'
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls'
I come from a c#/lua background, and don't understand what the differences are here. My questions are:
- How can I know which import style to use?
- What does the * do, and why doesn't that first line need any path -- 'three' is not in my root directory.
- Why does OrbitControls need to be inside an object? I can construct it like
new OrbitControls(camera, renderer.domElement );
, but I don't understand why. Does it add OrbitControls to the global space? If so, why is the{ }
needed in the import line?
I understand the Stats import -- that seems normal. It's returning a Stats object, and there's a relative path there.