UNPKG

nativescript-ar

Version:

NativeScript Augmented Reality plugin. ARKit on iOS and (with the help of Sceneform) ARCore on Android.

34 lines (33 loc) 1.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var arcommon_1 = require("./arcommon"); var arcommongeometry_1 = require("./arcommongeometry"); var ARBox = (function (_super) { __extends(ARBox, _super); function ARBox() { return _super !== null && _super.apply(this, arguments) || this; } ARBox.create = function (options, fragment) { var _this = this; return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { var node, defaultMaterial, size, center, renderable; return __generator(this, function (_a) { switch (_a.label) { case 0: node = arcommon_1.ARCommonNode.createNode(options, fragment); return [4, arcommon_1.ARCommonNode.getDefaultMaterial()]; case 1: defaultMaterial = _a.sent(); size = new com.google.ar.sceneform.math.Vector3(options.dimensions instanceof Object ? options.dimensions.x : options.dimensions, options.dimensions instanceof Object ? options.dimensions.y : options.dimensions, options.dimensions instanceof Object ? options.dimensions.z : options.dimensions); center = new com.google.ar.sceneform.math.Vector3(0, 0, 0); renderable = com.google.ar.sceneform.rendering.ShapeFactory.makeCube(size, center, defaultMaterial); node.setRenderable(renderable); resolve(new ARBox(options, node)); return [2]; } }); }); }); }; return ARBox; }(arcommongeometry_1.ARCommonGeometryNode)); exports.ARBox = ARBox;