meta-client
Version:
Meta.js (Client)
1 lines • 1.23 kB
JavaScript
;Object.defineProperty(exports,'__esModule',{value:true});var _three=require('three');var _Graphics=require('../Graphics');var _Graphics2=_interopRequireDefault(_Graphics);var _Space=require('../../../Space');var _Space2=_interopRequireDefault(_Space);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function')}}var _DEFAULT={WIDTH:1,HEIGHT:1,LENGTH:1,SCALE:.5};var Cube=function Cube(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var stop=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;_classCallCheck(this,Cube);var scale=_DEFAULT.SCALE;if(typeof props==='boolean')stop=props;var _width=props.w||props.width||_DEFAULT.WIDTH;var _height=props.h||props.height||_DEFAULT.HEIGHT;var _length=props.l||props.length||_DEFAULT.LENGTH;if(typeof props==='number')_width=_height=_length=props;_width=_width*scale;_height=_height*scale;_length=_length*scale;this.geometry=new _three.CubeGeometry(_width,_height,_length);this.type='box';return stop?this.geometry:new _Graphics2.default(this)};exports.default=Cube;