Skip to content

Commit bfaff66

Browse files
Add UWP support to BabylonReactNative (#137)
* setup react windows project * start on cmake definition for babylon react native for uwp * cache some helper logic * change setup to x64 for local testing * add source files * add some needed files * working winrt plugin initialization * more windows work * failing during linker * add options to vcxproj to try and unblock debug builds * move to use jsi * fix modules * add react-native-windows dependency * working compilation * current state * current proto changes * working native input compilation * fix playground solution * close to working * working windows logic * hacked app setup to support working windows logic * working vr * move BabylonNative dll definition and add arm64 support * fix babylonnative to build in module folder * fix submodule declarations * remove unneeded build scripts * add clean solution * working build * working build * typescript content needs cleaned up * things need cleaned up but we will try a clean repo * fix package.json definition * remove debug logic * get metro to play nice with new exclusion list * add x86, arm build support * revert files * packages working * add reset function and allow babylonnative to build from modules folder * fix package path resolution for react native windows * prepare for draft review * comment out slider, needs work to fix * move to newest babylonnative and fix gitmodule repo * remove unneeded package-lock * remove untrue comments * remove unneeded comments * fix namespace comment names * avoid checking in bin log * revert unneeded metro.config.js changes * get npm install working vs using yarn * get project to work with npm install * add readme tips * fix permissions and slider initialization issues * add step value to fix windows slider usage * rename babylon native component to avoid lib collisions * rename to BabylonReactNative * ready for review * update build steps * cleanup some unneeded changes * avoid moving to new commit * add event revokers * add uwp build logic * revert settings file * remove files and update documentation * address review comments * address more review comments * Update Modules/@babylonjs/react-native/EngineHook.ts Co-authored-by: Ryan Tremblay <[email protected]> * address review comments * move hmd render behaviors to enginehook * remove unneeded dev dependencies * move engine logic into engineview * Update Modules/@babylonjs/react-native/EngineHook.ts Co-authored-by: Ryan Tremblay <[email protected]> * address review comments * remove unneeded reference * Update Apps/Playground/App.tsx Co-authored-by: Ryan Tremblay <[email protected]> Co-authored-by: Ryan Tremblay <[email protected]>
1 parent 30c248f commit bfaff66

Some content is hidden

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

72 files changed

+10963
-3138
lines changed

Apps/Playground/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@ buck-out/
6161

6262
# CocoaPods
6363
/ios/Pods/
64+
65+
# UWP
66+
build.binlog
67+
deploy.binlog
68+
msbuild.binlog

Apps/Playground/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const EngineScreen: FunctionComponent<ViewProps> = (props: ViewProps) => {
130130
</View>
131131
}
132132
<EngineView style={props.style} camera={camera} onInitialized={onInitialized} />
133-
<Slider style={{position: 'absolute', minHeight: 50, margin: 10, left: 0, right: 0, bottom: 0}} minimumValue={0.2} maximumValue={2} value={defaultScale} onValueChange={setScale} />
133+
<Slider style={{position: 'absolute', minHeight: 50, margin: 10, left: 0, right: 0, bottom: 0}} minimumValue={0.2} maximumValue={2} step={0.01} value={defaultScale} onValueChange={setScale} />
134134
<Text style={{fontSize: 12, color: 'yellow', position: 'absolute', margin: 10}}>{trackingStateToString(trackingState)}</Text>
135135
</View>
136136
}

Apps/Playground/metro.config.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*
55
* @format
66
*/
7-
87
const path = require('path');
98
const fs = require('fs');
9+
const exclusionList = require('metro-config/src/defaults/exclusionList');
1010

1111
// NOTE: The Metro bundler does not support symlinks (see https://github.com/facebook/metro/issues/1), which NPM uses for local packages.
1212
// To work around this, we explicity tell the metro bundler where to find local/linked packages.
@@ -62,14 +62,24 @@ module.exports = {
6262
resolver: {
6363
// Register an "extra modules proxy" for resolving modules outside of the normal resolution logic.
6464
extraNodeModules: new Proxy(
65-
// Provide the set of known local package mappings.
66-
moduleMappings,
67-
{
68-
// Provide a mapper function, which uses the above mappings for associated package ids,
69-
// otherwise fall back to the standard behavior and just look in the node_modules directory.
70-
get: (target, name) => name in target ? target[name] : path.join(__dirname, `node_modules/${name}`),
71-
},
65+
// Provide the set of known local package mappings.
66+
moduleMappings,
67+
{
68+
// Provide a mapper function, which uses the above mappings for associated package ids,
69+
// otherwise fall back to the standard behavior and just look in the node_modules directory.
70+
get: (target, name) => name in target ? target[name] : path.join(__dirname, `node_modules/${name}`),
71+
},
7272
),
73+
74+
blockList: exclusionList([
75+
// Avoid error EBUSY: resource busy or locked, open 'D:\a\1\s\packages\playground\msbuild.ProjectImports.zip' in pipeline
76+
/.*\.ProjectImports\.zip/,
77+
78+
// This stops "react-native run-windows" from causing the metro server to crash if its already running
79+
new RegExp(
80+
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
81+
),
82+
]),
7383
},
7484

7585
projectRoot: path.resolve(__dirname),

Apps/Playground/package-lock.json

Lines changed: 4648 additions & 3110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Apps/Playground/package.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"scripts": {
66
"android": "react-native run-android",
77
"ios": "react-native run-ios",
8+
"windows": "react-native run-windows --arch x64",
9+
"windows-verbose": "react-native run-windows --arch x64 --logging",
810
"start": "react-native start",
911
"test": "jest",
1012
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
@@ -13,28 +15,30 @@
1315
"@babylonjs/core": "^5.0.0-alpha.6",
1416
"@babylonjs/loaders": "^5.0.0-alpha.6",
1517
"@babylonjs/react-native": "file:../../Modules/@babylonjs/react-native",
16-
"@react-native-community/slider": "^2.0.9",
18+
"@react-native-community/slider": "4.0.0-rc.2",
1719
"logkitty": "^0.7.1",
18-
"react": "16.13.1",
19-
"react-native": "0.63.1",
20-
"react-native-permissions": "^2.1.4"
20+
"react": "^17.0.1",
21+
"react-native": "^0.64.0-rc.0",
22+
"react-native-permissions": "^3.0.0",
23+
"react-native-windows": "0.64.0-preview.5"
2124
},
2225
"devDependencies": {
2326
"@babel/core": "^7.8.4",
2427
"@babel/runtime": "^7.8.4",
2528
"@react-native-community/cli": "^4.13.0",
2629
"@react-native-community/eslint-config": "^1.1.0",
2730
"@types/jest": "^25.2.3",
28-
"@types/react-native": "0.63.1",
31+
"@types/react": "^16.9.0",
32+
"@types/react-native": "^0.63.18",
2933
"@types/react-test-renderer": "^16.9.2",
3034
"@typescript-eslint/eslint-plugin": "^2.27.0",
3135
"@typescript-eslint/parser": "^2.27.0",
3236
"babel-jest": "^25.1.0",
33-
"eslint": "^6.5.1",
37+
"eslint": "7.12.0",
3438
"jest": "^25.1.0",
3539
"metro-react-native-babel-preset": "^0.59.0",
3640
"prettier": "^2.0.4",
37-
"react-test-renderer": "16.13.1",
41+
"react-test-renderer": "^17.0.1",
3842
"typescript": "^3.8.3"
3943
},
4044
"jest": {

Apps/Playground/windows/.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
*AppPackages*
2+
*BundleArtifacts*
3+
4+
#OS junk files
5+
[Tt]humbs.db
6+
*.DS_Store
7+
8+
#Visual Studio files
9+
*.[Oo]bj
10+
*.user
11+
*.aps
12+
*.pch
13+
*.vspscc
14+
*.vssscc
15+
*_i.c
16+
*_p.c
17+
*.ncb
18+
*.suo
19+
*.tlb
20+
*.tlh
21+
*.bak
22+
*.[Cc]ache
23+
*.ilk
24+
*.log
25+
*.lib
26+
*.sbr
27+
*.sdf
28+
*.opensdf
29+
*.opendb
30+
*.unsuccessfulbuild
31+
ipch/
32+
[Oo]bj/
33+
[Bb]in
34+
[Dd]ebug*/
35+
[Rr]elease*/
36+
Ankh.NoLoad
37+
38+
# Visual C++ cache files
39+
ipch/
40+
*.aps
41+
*.ncb
42+
*.opendb
43+
*.opensdf
44+
*.sdf
45+
*.cachefile
46+
*.VC.db
47+
*.VC.VC.opendb
48+
49+
#MonoDevelop
50+
*.pidb
51+
*.userprefs
52+
53+
#Tooling
54+
_ReSharper*/
55+
*.resharper
56+
[Tt]est[Rr]esult*
57+
*.sass-cache
58+
59+
#Project files
60+
[Bb]uild/
61+
62+
#Subversion files
63+
.svn
64+
65+
# Office Temp Files
66+
~$*
67+
68+
# vim Temp Files
69+
*~
70+
71+
#NuGet
72+
packages/
73+
*.nupkg
74+
75+
#ncrunch
76+
*ncrunch*
77+
*crunch*.local.xml
78+
79+
# visual studio database projects
80+
*.dbmdl
81+
82+
#Test files
83+
*.testsettings
84+
85+
#Other files
86+
*.DotSettings
87+
.vs/
88+
*project.lock.json
89+
90+
#Files generated by the VS build
91+
**/Generated Files/**
92+

0 commit comments

Comments
 (0)