Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade To THREE 0.166.0, upgrade to Expo SDK 51 #301

Merged
merged 39 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
297cc42
chore(example): Upgrade example app to use latest expo SDK
markrickert Mar 12, 2024
c6979ff
Another attempt at the example
markrickert Mar 14, 2024
88ce378
Fix metro config for png files and url matchers in loadAsync
markrickert Mar 14, 2024
7b60c1c
Move the example App.tsx back into place
markrickert Mar 14, 2024
2081c14
Update THREE to version 0.162.0
markrickert Mar 14, 2024
053ad41
Clean up more of the example code
markrickert Mar 14, 2024
0ff3026
Add react-native-reanimated
markrickert Mar 15, 2024
c42d45d
Aphpabetize devDependencies
markrickert Mar 18, 2024
1bea425
Upgrade yarn deps to latest
markrickert Mar 18, 2024
6fed60b
add expo-router to example app
Jpoliachik Mar 18, 2024
6f7f7c4
fix: Properly match the urls in loadAsync. With tests.
markrickert Mar 18, 2024
01e3b3c
Got tests working!
markrickert Mar 18, 2024
413e8bc
Get the example app working on the web.
markrickert Mar 18, 2024
a4557a3
updates after merge conflicts
Jpoliachik Mar 18, 2024
9c215b3
fix to bundle with metro
Jpoliachik Mar 18, 2024
0565098
add robot animation example
Jpoliachik Mar 18, 2024
40bf6e3
Add save refresh to robot
markrickert Mar 18, 2024
09491ba
Ensure timeout refs are used in all examples
markrickert Mar 18, 2024
ec9a53f
Add orbit controls to the demo Robot.
markrickert Mar 18, 2024
ff71bfa
Adds an example of a stats panel to calculate geometry and FPS
markrickert Mar 19, 2024
59fe8e6
Ensure stats are only reported in __DEV__ mode
markrickert Mar 19, 2024
9bf424e
Update the readme for `expo-asset` local file loading.
markrickert Mar 22, 2024
be8247f
Add expo-gl to Peer Dependencies
markrickert Mar 22, 2024
c7cb6ab
Squashed commit of the following:
markrickert Jun 12, 2024
48f7b3c
Ran: npx expo install --fix
markrickert Jun 12, 2024
4089570
Upgrade ThreeJS to 0.165.0
markrickert Jun 12, 2024
5b59f4a
Bump version in the app.json file
markrickert Jun 12, 2024
723d802
Add a rainbow effect to the flower field.
markrickert Jun 12, 2024
3d7627c
Clean up some examples and add a generic template file for making new…
markrickert Jun 12, 2024
080e43a
Add two new examples: GCode loader and interactive buffer geometry
markrickert Jun 12, 2024
c13b35a
Remove the spinning cubes example for now.
markrickert Jun 12, 2024
d1f0552
add back spinning cubes example with head model removed for simplicity
Jpoliachik Jun 13, 2024
6847a11
add head model .obj .mtl in separate example
Jpoliachik Jun 13, 2024
dca6e39
Add back bouncing ball(s) example
markrickert Jul 2, 2024
490f058
Update three to 166, expo-module-scripts and example to 51
markrickert Jul 2, 2024
7f04c7c
Get tests and linter working
markrickert Jul 2, 2024
e9f0a1d
Add an image picker to the bouncing balls example.
markrickert Jul 2, 2024
66645db
Addressing issues from review.
markrickert Jul 3, 2024
f3c86a4
Deleted webpack config as metro handles this for us now.
markrickert Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .eslintignore

This file was deleted.

7 changes: 5 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// @generated by expo-module-scripts
module.exports = require('expo-module-scripts/eslintrc.base.js');
module.exports = {
root: true,
extends: ['universe/native', 'universe/web'],
ignorePatterns: ['build'],
};
markrickert marked this conversation as resolved.
Show resolved Hide resolved
60 changes: 56 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
node_modules/**/*
secret/
/.expo
# OSX
#
.DS_Store

# VSCode
.vscode/
jsconfig.json

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IJ
#
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml
android/app/libs
android/keystores/debug.keystore

# Cocoapods
#
example/ios/Pods

# Ruby
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
build/

# Expo
.expo/*
32 changes: 12 additions & 20 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
.DS_Store
node_modules/
screenshots/
npm-debug.log
example/
secret/
*.tgz
babel.config.js
/src
/tsconfig.json
# Exclude all top-level hidden directories by convention
/.*/

.eslintignore
.eslintrc.js
.prettierrc
jest.config.js
example.js
app.json
# Exclude tarballs generated by `npm pack`
/*.tgz

/.expo
web-build
/.github/
/scripts
__mocks__
__tests__

/babel.config.js
/android/src/androidTest/
/android/src/test/
/android/build/
/example/
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,8 @@ All assets require a local URI to be loaded. You can resolve a local URI with `e
```ts
import { Asset } from 'expo-asset';

// Create an Asset from a resource
const asset = Asset.fromModule(require('./image.png'));

await asset.downloadAsync();

// This is the local URI
const uri = asset.localUri;
// Create an Asset from a local resource
const [{ localUri }] = await Asset.loadAsync(require('./image.png'));
```

### Loading a texture
Expand All @@ -143,11 +138,10 @@ import { TextureLoader } from 'three';
import { Asset } from 'expo-asset';

// Create an Asset from a resource
const asset = Asset.fromModule(require('./img.png'));
const [{ localUri }] = await Asset.loadAsync(require('./img.png'));

await asset.downloadAsync();
// This texture will be immediately ready but it'll load asynchronously
const texture = new TextureLoader().load(asset.localUri);
const texture = new TextureLoader().load(localUri);
```

### Loading an obj model
Expand All @@ -159,11 +153,10 @@ Be sure to add support for whatever model extension you wish to load to your `me
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader';
import { Asset } from 'expo-asset';

const asset = Asset.fromModule(require('./model.obj'));
await asset.downloadAsync();
const [{ localUri }] = await Asset.loadAsync(require('./model.obj'));

const loader = new OBJLoader();
loader.load(asset.localUri, group => {
loader.load(localUri, group => {
// Model loaded...
});
```
Expand Down Expand Up @@ -390,6 +383,19 @@ THREE.suppressMetroWarnings();

---

## Running the example app

Clone the repo and `cd expo-three` then run:

```sh
yarn
yarn build
# CMD+C to exit build watch mode
cd example
npx expo prebuild
npx expo run:android # or npx expo run:ios
```

## ⛓ Links

Somewhat out of date
Expand Down
14 changes: 14 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"expo": {
"name": "expo-three",
"slug": "expo-three",
"version": "7.0.1",
"description": "Utilities for using THREE.js with Expo",
"sdkVersion": "50.0.0",
"platforms": [
"ios",
"android",
"web"
]
}
}
4 changes: 0 additions & 4 deletions example/.expo-shared/assets.json

This file was deleted.

38 changes: 32 additions & 6 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
node_modules/**/*
.expo/*
npm-debug.*
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/
android/
ios/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
web-report/

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo
1 change: 0 additions & 1 deletion example/.watchmanconfig

This file was deleted.

104 changes: 0 additions & 104 deletions example/App.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions example/app.config.js

This file was deleted.

29 changes: 29 additions & 0 deletions example/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ConfigContext, ExpoConfig } from '@expo/config';

/**
* Use ts-node here so we can use TypeScript for our Config Plugins
* and not have to compile them to JavaScript
*/
require('ts-node/register');

/**
* @param config ExpoConfig coming from the static config app.json if it exists
*
* You can read more about Expo's Configuration Resolution Rules here:
* https://docs.expo.dev/workflow/configuration/#configuration-resolution-rules
*/
module.exports = ({ config }: ConfigContext): Partial<ExpoConfig> => {
const existingPlugins = config.plugins ?? [];

return {
...config,
plugins: [
...existingPlugins,
'expo-router',
'expo-asset',
require('./plugins/withFlipperDisabled').withFlipperDisabled,
require('./plugins/withBuildProperties').withBuildProperties,
require('./plugins/withImagePicker').withImagePicker,
],
};
};
Loading