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>

76 lines (58 loc) 3.44 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 geometries/voxel */ var GeometriesVoxel = function (_THREE$BoxGeometry) { _inherits(GeometriesVoxel, _THREE$BoxGeometry); function GeometriesVoxel(dataPosition) { _classCallCheck(this, GeometriesVoxel); var _this = _possibleConstructorReturn(this, (GeometriesVoxel.__proto__ || Object.getPrototypeOf(GeometriesVoxel)).call(this, 1, 1, 1)); _this._location = dataPosition; _this.applyMatrix(new THREE.Matrix4().makeTranslation(_this._location.x, _this._location.y, _this._location.z)); _this.verticesNeedUpdate = true; return _this; } _createClass(GeometriesVoxel, [{ key: "resetVertices", value: function resetVertices() { this.vertices[0].set(0.5, 0.5, 0.5); this.vertices[1].set(0.5, 0.5, -0.5); this.vertices[2].set(0.5, -0.5, 0.5); this.vertices[3].set(0.5, -0.5, -0.5); this.vertices[4].set(-0.5, 0.5, -0.5); this.vertices[5].set(-0.5, 0.5, 0.5); this.vertices[6].set(-0.5, -0.5, -0.5); this.vertices[7].set(-0.5, -0.5, 0.5); } }, { key: "location", set: function set(location) { this._location = location; // update vertices from location this.vertices[0].set(+0.5, +0.5, +0.5); this.vertices[1].set(+0.5, +0.5, -0.5); this.vertices[2].set(+0.5, -0.5, +0.5); this.vertices[3].set(+0.5, -0.5, -0.5); this.vertices[4].set(-0.5, +0.5, -0.5); this.vertices[5].set(-0.5, +0.5, +0.5); this.vertices[6].set(-0.5, -0.5, -0.5); this.vertices[7].set(-0.5, -0.5, +0.5); this.applyMatrix(new THREE.Matrix4().makeTranslation(this._location.x, this._location.y, this._location.z)); this.verticesNeedUpdate = true; }, get: function get() { return this._location; } }]); return GeometriesVoxel; }(THREE.BoxGeometry); exports.default = GeometriesVoxel; module.exports = exports["default"];