In my TypeScript file, I am importing three classes 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'
Coming from a background in c# and Lua, the differences in import styles confuse me. My questions are:
- How do I determine which import style to use?
- What is the purpose of using '*' in the first line without specifying a path - considering 'three' is not located in the root directory?
- Why does OrbitControls need to be defined within an object? Even though it can be constructed like
, I fail to see the reason behind it. Does this method add OrbitControls to the global space? If so, why is thenew OrbitControls(camera, renderer.domElement );
{ }
necessary in the import statement?
I grasp the concept behind the Stats import, as it appears straightforward. It returns a Stats object with a specified relative path.