Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1274220

Browse files
author
Nikolay Grozdanov
committed
Initial commit
0 parents  commit 1274220

File tree

75 files changed

+10096
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+10096
-0
lines changed

.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

.flowconfig

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
10+
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
14+
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
17+
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
20+
21+
[include]
22+
23+
[libs]
24+
node_modules/react-native/Libraries/react-native/react-native-interface.js
25+
node_modules/react-native/flow/
26+
27+
[options]
28+
emoji=true
29+
30+
esproposal.optional_chaining=enable
31+
esproposal.nullish_coalescing=enable
32+
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
36+
37+
munge_underscores=true
38+
39+
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
40+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
41+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
42+
43+
suppress_type=$FlowIssue
44+
suppress_type=$FlowFixMe
45+
suppress_type=$FlowFixMeProps
46+
suppress_type=$FlowFixMeState
47+
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
50+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
51+
52+
[lints]
53+
sketchy-null-number=warn
54+
sketchy-null-mixed=warn
55+
sketchy-number=warn
56+
untyped-type-import=warn
57+
nonstrict-import=warn
58+
deprecated-type=warn
59+
unsafe-getters-setters=warn
60+
inexact-spread=warn
61+
unnecessary-invariant=warn
62+
signature-verification-failure=warn
63+
deprecated-utility=error
64+
65+
[strict]
66+
deprecated-type
67+
nonstrict-import
68+
sketchy-null
69+
unclear-type
70+
unsafe-getters-setters
71+
untyped-import
72+
untyped-type-import
73+
74+
[version]
75+
^0.105.0

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

.gitignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
24+
# Android/IntelliJ
25+
#
26+
build/
27+
.idea
28+
.gradle
29+
local.properties
30+
*.iml
31+
32+
# node.js
33+
#
34+
node_modules/
35+
npm-debug.log
36+
yarn-error.log
37+
38+
# BUCK
39+
buck-out/
40+
\.buckd/
41+
*.keystore
42+
!debug.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://nexus.magicleap.blue/repository/npm-group/

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};

.watchmanconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

App.js

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
import React from 'react';
2+
import { View, Text } from 'magic-script-components';
3+
4+
import { authorize } from 'react-native-app-auth';
5+
import { NativeModules } from 'react-native';
6+
7+
const { XrApp, XrClientBridge } = NativeModules;
8+
9+
const oAuthConfig = {
10+
cacheKey: 'auth/prod',
11+
issuer: 'https://auth.magicleap.com',
12+
clientId: 'com.magicleap.mobile.magicscript',
13+
redirectUrl: 'magicscript://code-callback',
14+
scopes: [
15+
'openid',
16+
'profile',
17+
'email'
18+
],
19+
serviceConfiguration: {
20+
authorizationEndpoint: 'https://oauth.magicleap.com/auth',
21+
tokenEndpoint: 'https://oauth.magicleap.com/token'
22+
}
23+
};
24+
25+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
26+
const getUUID = (id, pose) => `${id}#[${pose}]`;
27+
28+
class MyApp extends React.Component {
29+
constructor (props) {
30+
super(props);
31+
32+
this.state = {
33+
scenes: {},
34+
anchorCount: 0
35+
};
36+
}
37+
38+
componentDidMount () {
39+
setTimeout(async () => {
40+
console.log('MyXrDemoApp: sharing ARSession');
41+
await XrApp.shareSession();
42+
43+
await sleep(1000);
44+
45+
const oauth = await this.authorizeToXrServer(oAuthConfig);
46+
47+
await sleep(1000);
48+
49+
const status = await this.connectToXrServer(oauth);
50+
51+
this._updateInterval = setInterval(() => this.updateAnchors(), 1000);
52+
53+
}, 1000);
54+
}
55+
56+
componentWillUnmount () {
57+
if (Object.keys(this.state.scenes).length > 0) {
58+
XrClientBridge.removeAllAnchors();
59+
}
60+
}
61+
62+
async authorizeToXrServer (config) {
63+
console.log('MyXrDemoApp: authorizing');
64+
const result = await authorize(config);
65+
console.log('MyXrDemoApp: oAuthData', result);
66+
return result;
67+
}
68+
69+
async connectToXrServer (config) {
70+
console.log('MyXrDemoApp: XrClientBridge.connecting');
71+
const result = await XrClientBridge.connect(config.accessToken);
72+
console.log('MyXrDemoApp: XrClientBridge.connect result', result);
73+
return result;
74+
}
75+
76+
async updateAnchors () {
77+
const status = await XrClientBridge.getLocalizationStatus();
78+
console.log('MyXrDemoApp: localization status', status);
79+
80+
XrApp.setStatusMessage(status);
81+
82+
if (status === 'localized' && this.state.anchorCount === 0) {
83+
const pcfList = await XrClientBridge.getAllPCFs();
84+
console.log(`MyXrDemoApp: received ${pcfList.length} PCFs`);
85+
86+
if (pcfList.length > 0) {
87+
clearInterval(this._updateInterval);
88+
}
89+
90+
var scenes = {};
91+
92+
pcfList.forEach(pcfData => this.updateScenes(scenes, pcfData));
93+
94+
this.setState({ scenes: scenes, anchorCount: pcfList.length });
95+
96+
Object.values(scenes).forEach(scene => {
97+
// console.log(`PCF Id: ${scene.pcfId}, Pose:`, scene.pcfPose);
98+
XrClientBridge.createAnchor(scene.uuid, scene.pcfPose);
99+
});
100+
}
101+
}
102+
103+
updateScenes (scenes, pcfData) {
104+
const uuid = getUUID(pcfData.anchorId, pcfData.pose);
105+
106+
if (scenes[pcfData.anchorId] === undefined) {
107+
scenes[pcfData.anchorId] = {
108+
uuid: uuid,
109+
pcfId: pcfData.anchorId,
110+
pcfPose: pcfData.pose
111+
};
112+
}
113+
}
114+
115+
render () {
116+
const scenes = Object.values(this.state.scenes);
117+
return (
118+
<View name='main-view'>
119+
{ scenes.length === 0
120+
? (<Text text='Initializing ...' />)
121+
: scenes.map( scene => <Text key={scene.uuid} anchorUuid={scene.uuid} textSize={0.1} textColor={[1, 0, 0, 1]} text={scene.pcfId} />)
122+
}
123+
</View>
124+
);
125+
}
126+
}
127+
128+
export default MyApp;

MLXR/MLXR.framework/Headers/MLXR.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// %BANNER_BEGIN%
2+
// ---------------------------------------------------------------------
3+
// %COPYRIGHT_BEGIN%
4+
//
5+
// Copyright (c) 2019 Magic Leap, Inc. (COMPANY) All Rights Reserved.
6+
// Magic Leap, Inc. Confidential and Proprietary
7+
//
8+
// NOTICE: All information contained herein is, and remains the property
9+
// of COMPANY. The intellectual and technical concepts contained herein
10+
// are proprietary to COMPANY and may be covered by U.S. and Foreign
11+
// Patents, patents in process, and are protected by trade secret or
12+
// copyright law. Dissemination of this information or reproduction of
13+
// this material is strictly forbidden unless prior written permission is
14+
// obtained from COMPANY. Access to the source code contained herein is
15+
// hereby forbidden to anyone except current COMPANY employees, managers
16+
// or contractors who have executed Confidentiality and Non-disclosure
17+
// agreements explicitly covering such access.
18+
//
19+
// The copyright notice above does not evidence any actual or intended
20+
// publication or disclosure of this source code, which includes
21+
// information that is confidential and/or proprietary, and is a trade
22+
// secret, of COMPANY. ANY REPRODUCTION, MODIFICATION, DISTRIBUTION,
23+
// PUBLIC PERFORMANCE, OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS
24+
// SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF COMPANY IS
25+
// STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE LAWS AND
26+
// INTERNATIONAL TREATIES. THE RECEIPT OR POSSESSION OF THIS SOURCE
27+
// CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS
28+
// TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE,
29+
// USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
30+
// %COPYRIGHT_END%
31+
// ---------------------------------------------------------------------
32+
// %BANNER_END%
33+
#import <Foundation/Foundation.h>
34+
35+
//! Project version number for MLXR.
36+
FOUNDATION_EXPORT double MLXRVersionNumber;
37+
38+
//! Project version string for MLXR.
39+
FOUNDATION_EXPORT const unsigned char MLXRVersionString[];
40+
41+
#import <MLXR/MLXRSession.h>
42+
#import <MLXR/MLXRAnchor.h>
43+
#import <MLXR/MLXRLocalization.h>

0 commit comments

Comments
 (0)