(function (global, factory) { if (typeof define === "function" && define.amd) { define(["exports", "three"], factory); } else if (typeof exports !== "undefined") { factory(exports, require("three")); } else { var mod = { exports: {} }; factory(mod.exports, global.three); global.BoxLineGeometry = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.BoxLineGeometry = void 0; 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } Object.defineProperty(subClass, "prototype", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var BoxLineGeometry = /*#__PURE__*/function (_BufferGeometry) { _inherits(BoxLineGeometry, _BufferGeometry); var _super = _createSuper(BoxLineGeometry); function BoxLineGeometry() { var _this; var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; var widthSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; var heightSegments = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; var depthSegments = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; _classCallCheck(this, BoxLineGeometry); _this = _super.call(this); widthSegments = Math.floor(widthSegments); heightSegments = Math.floor(heightSegments); depthSegments = Math.floor(depthSegments); var widthHalf = width / 2; var heightHalf = height / 2; var depthHalf = depth / 2; var segmentWidth = width / widthSegments; var segmentHeight = height / heightSegments; var segmentDepth = depth / depthSegments; var vertices = []; var x = -widthHalf; var y = -heightHalf; var z = -depthHalf; for (var i = 0; i <= widthSegments; i++) { vertices.push(x, -heightHalf, -depthHalf, x, heightHalf, -depthHalf); vertices.push(x, heightHalf, -depthHalf, x, heightHalf, depthHalf); vertices.push(x, heightHalf, depthHalf, x, -heightHalf, depthHalf); vertices.push(x, -heightHalf, depthHalf, x, -heightHalf, -depthHalf); x += segmentWidth; } for (var _i = 0; _i <= heightSegments; _i++) { vertices.push(-widthHalf, y, -depthHalf, widthHalf, y, -depthHalf); vertices.push(widthHalf, y, -depthHalf, widthHalf, y, depthHalf); vertices.push(widthHalf, y, depthHalf, -widthHalf, y, depthHalf); vertices.push(-widthHalf, y, depthHalf, -widthHalf, y, -depthHalf); y += segmentHeight; } for (var _i2 = 0; _i2 <= depthSegments; _i2++) { vertices.push(-widthHalf, -heightHalf, z, -widthHalf, heightHalf, z); vertices.push(-widthHalf, heightHalf, z, widthHalf, heightHalf, z); vertices.push(widthHalf, heightHalf, z, widthHalf, -heightHalf, z); vertices.push(widthHalf, -heightHalf, z, -widthHalf, -heightHalf, z); z += segmentDepth; } _this.setAttribute('position', new _three.Float32BufferAttribute(vertices, 3)); return _this; } return _createClass(BoxLineGeometry); }(_three.BufferGeometry); _exports.BoxLineGeometry = BoxLineGeometry; });