UNPKG

ami-cjs.js

Version:

<p align="center"> <img src="https://cloud.githubusercontent.com/assets/214063/23213764/78ade038-f90c-11e6-8208-4fcade5f3832.png" width="60%"> </p>

75 lines (57 loc) 2.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * @module helpers/dummy */ var HelpersDummy = function (_THREE$Object3D) { _inherits(HelpersDummy, _THREE$Object3D); function HelpersDummy() { _classCallCheck(this, HelpersDummy); // this._material = null; // this._geometry = null; var _this = _possibleConstructorReturn(this, (HelpersDummy.__proto__ || Object.getPrototypeOf(HelpersDummy)).call(this)); // _this._mesh = null; // update object _this._create(); window.console.log(_this.uuid); return _this; } // private methods _createClass(HelpersDummy, [{ key: "_create", value: function _create() { var geometry = new THREE.SphereGeometry(5, 32, 32); var material = new THREE.MeshBasicMaterial({ color: 0xffff00 }); this._mesh = new THREE.Mesh(geometry, material); // and add it! this.add(this._mesh); // this.remove(this._mesh); } }, { key: "_update", value: function _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(); } }]); return HelpersDummy; }(THREE.Object3D); exports.default = HelpersDummy; module.exports = exports["default"];