UNPKG

nativescript-ar

Version:

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

35 lines (34 loc) 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var arcommon_1 = require("./arcommon"); var arcommongeometry_1 = require("./arcommongeometry"); var ARTube = (function (_super) { __extends(ARTube, _super); function ARTube() { return _super !== null && _super.apply(this, arguments) || this; } ARTube.create = function (options, fragment) { var _this = this; return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { var node, defaultMaterial, radius, height, 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(); radius = options.outerRadius; height = options.height; center = new com.google.ar.sceneform.math.Vector3(0, 0, 0); renderable = com.google.ar.sceneform.rendering.ShapeFactory.makeCylinder(radius, height, center, defaultMaterial); node.setRenderable(renderable); resolve(new ARTube(options, node)); return [2]; } }); }); }); }; return ARTube; }(arcommongeometry_1.ARCommonGeometryNode)); exports.ARTube = ARTube;