This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _m1 = new THREE.Matrix4(); | |
const _obj = new THREE.Object3D(); | |
const _offset = new THREE.Vector3(); | |
class Geometry extends THREE.EventDispatcher { | |
constructor() { | |
super(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use the Web Storage API to save camera position and target between page refreshes. | |
* | |
* @param {Object} options | |
* @param {*} options.camera - The camera you want to store the position of. | |
* @param {*} [options.controls] - A controls object with a `.target` property. | |
* @param {String} [options.name="main"] - An optional label. Useful if you want to store multiple cameras. | |
* @param {Boolean} [options.session=true] - Indicates if you want to use local or session storage. | |
* See https://developer.mozilla.org/en-US/docs/Web/API/Storage | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const material = new THREE.MeshStandardMaterial({ | |
map: new THREE.TextureLoader().load('map.jpg'), | |
normalMap: new THREE.TextureLoader().load('normalMap.jpg') | |
}); | |
const loader = new THREE.JSONLoader(); | |
loader.load('geometry.json', geometry => { | |
const mesh = new THREE.Mesh(geometry, material); | |