gtajesgenga-ami.js
Version:
1. [Hello AMI](#hello-ami) 2. [Features](#features) 3. [Usage](#yarn) 4. [Developer corner](#developer-corner) 5. [Change log](#change-log) 6. [Credits](#credits) 7. [Citations](#citations)
45 lines (38 loc) • 957 B
JavaScript
/**
* @module helpers/dummy
*/
export default class HelpersDummy extends THREE.Object3D {
constructor() {
//
super();
// this._material = null;
// this._geometry = null;
this._mesh = null;
// update object
this._create();
window.console.log(this.uuid);
}
// private methods
_create() {
let geometry = new THREE.SphereGeometry(5, 32, 32);
let material = new THREE.MeshBasicMaterial({ color: 0xffff00 });
this._mesh = new THREE.Mesh(geometry, material);
// and add it!
this.add(this._mesh);
// this.remove(this._mesh);
}
_update() {
// update slice
if (this._mesh) {
this._mesh.uuid = null;
this.remove(this._mesh);
this._mesh.geometry.dispose();
this._mesh.geometry = null;
// we do not want to dispose the texture!
this._mesh.material.dispose();
this._mesh.material = null;
this._mesh = null;
}
this._create();
}
}