

This switches the way compatible browsers will interact with the scene. If we do have a device which supports the DeviceOrientation spec (our Google Chrome mobile browser), then we take our the controls variable which previously had our OrbitControls object, and replace it with our DeviceOrientationControls object. Every Three.js visualisation needs a scene because that is where every other element is placed.

Our init() function begins by setting up our scene variable as a Three.js Scene object.

In our JavaScript, we set up our initial global variables and call an init() function that will kick everything off.
