THREE.Terrain icon indicating copy to clipboard operation
THREE.Terrain copied to clipboard

Update for newer THREE.js versions (ES6)

Open oliver408i opened this issue 7 months ago • 1 comments

As of r165, importmaps and es6 import statements must be used in Three.js. Additionally, the THREE module can no longer be extended. Instead, I had to come up with some edits (and workarounds).

  1. mesh.geometry.computeFaceNormals(); had to be removed, I'm not too sure what the exact effect is, terrain works fine without it (its undefined now)
  2. Instead of THREE.Terrain, a separate object needs to be made, such as window.THREETerrain
  3. I haven't been able to fully convert this to a module, instead, we need to assign the THREE module from a es6 (import * as THREE from 'three'; window.THREE = THREE), then change THREE to window.THREE

I can make a PR if there is interest in this current state of "revision"

oliver408i avatar Jun 29 '24 06:06 oliver408i