IceCreamYou / THREE.Terrain

A procedural terrain generation engine for use with the Three.js 3D graphics library for the web.
https://icecreamyou.github.io/THREE.Terrain/
MIT License
706 stars 109 forks source link

Update for newer THREE.js versions (ES6) #38

Open oliver408i opened 3 months ago

oliver408i commented 3 months ago

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"

IceCreamYou commented 3 months ago

Sure, thanks for looking into it. I'd be happy to review a PR.