nativescript-ar
Version:
NativeScript Augmented Reality plugin. ARKit on iOS and (with the help of Sceneform) ARCore on Android.
34 lines (33 loc) • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var arcommon_1 = require("./arcommon");
var arcommongeometry_1 = require("./arcommongeometry");
var ARSphere = (function (_super) {
__extends(ARSphere, _super);
function ARSphere() {
return _super !== null && _super.apply(this, arguments) || this;
}
ARSphere.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, 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.radius;
center = new com.google.ar.sceneform.math.Vector3(0, 0, 0);
renderable = com.google.ar.sceneform.rendering.ShapeFactory.makeSphere(radius, center, defaultMaterial);
node.setRenderable(renderable);
resolve(new ARSphere(options, node));
return [2];
}
});
}); });
};
return ARSphere;
}(arcommongeometry_1.ARCommonGeometryNode));
exports.ARSphere = ARSphere;