-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
108 changed files
with
12,941 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
paths: | ||
- "docs/**" | ||
branches: | ||
- main | ||
- chore/docs | ||
# Review gh actions docs if you want to further define triggers, paths, etc | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on | ||
|
||
jobs: | ||
build: | ||
name: Build Docusaurus | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# As we use typedoc we need to install the node_modules in the package as well | ||
- name: Install package/ deps | ||
working-directory: package | ||
run: | | ||
corepack enable | ||
yes | yarn install | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
cache-dependency-path: docs | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
working-directory: docs | ||
|
||
- name: Build website | ||
run: yarn build | ||
working-directory: docs | ||
|
||
- name: Upload Build Artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: docs/build | ||
|
||
deploy: | ||
name: Deploy to GitHub Pages | ||
needs: build | ||
|
||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
|
||
# Deploy to the github-pages environment | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Test deployment | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "docs/**" | ||
branches: | ||
- main | ||
# Review gh actions docs if you want to further define triggers, paths, etc | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on | ||
|
||
jobs: | ||
test-deploy: | ||
name: Test deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# As we use typedoc we need to install the node_modules in the package as well | ||
- name: Install package/ deps | ||
working-directory: package | ||
run: | | ||
corepack enable | ||
yes | yarn install | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
cache-dependency-path: docs | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
working-directory: docs | ||
- name: Test build website | ||
run: yarn build | ||
working-directory: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
docs/api | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
id: animator | ||
title: Animator | ||
sidebar_label: Animator | ||
slug: /guides/animator | ||
--- | ||
|
||
Documentation is added soon! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
id: asset-loading | ||
title: Asset loading | ||
sidebar_label: Asset loading | ||
slug: /guides/asset-loading | ||
--- | ||
|
||
# Load from everywhere | ||
|
||
You can load assets from basically any source that comes to mind. Assets refer to anything that is not code, like 3D models, textures, material shaders, etc. | ||
There are many components which accept a `source` prop, for example the `<Model source={...} />` component. For these components, the `source` prop can be of the following types: | ||
|
||
## 🧑💻 From assets in your project / metro | ||
|
||
Files that live next to your code. For this to work make sure you followed the metro bundle configuration in the [Getting Started](/docs/guides#configure-metro) guide. | ||
|
||
```tsx | ||
import { Model } from 'react-native-filament'; | ||
import BusterDrone from './BusterDrone.glb'; | ||
|
||
<Model source={BusterDrone} /> | ||
``` | ||
|
||
:::info | ||
Currently only loading `.glb` files is supported. You can convert any other 3D models (gltf, obj, FBX, etc) to .glb using blender or online converter tools. | ||
::: | ||
|
||
### Debug | ||
|
||
In debug mode this will get the file from the metro bundler server, running on your machine. That means a network requests is made for example to `http://localhost:8081/assets/BusterDrone.glb`. | ||
|
||
:::warning | ||
If your files are big loading over network can introduce some delay until the file is loaded and displayed. Make sure to profile your app in release! | ||
::: | ||
|
||
### Release | ||
|
||
React Natives default behaviour is to bundle all assets into the app binary. This means that the file is not loaded over network but from the app binary itself, which is faster than in debug over network. | ||
|
||
:::warning | ||
If you put your assets into other directories than the default `/assets` dir, you need to specify the path to the assets in your `react-native.config.js` file: | ||
```js | ||
module.exports = { | ||
assets: [ | ||
'./app/assets/3d/assets', | ||
], | ||
} | ||
``` | ||
|
||
See the [React Native documentation](https://github.com/react-native-community/cli/blob/main/docs/projects.md#projectandroidassets) for more information. | ||
::: | ||
|
||
## 📦 From native asset / bundle resources | ||
|
||
You can place assets directly in your native project and load them from there. This way the will load very fast, even in debug mode: | ||
|
||
- 🤖 android: place assets under `android/app/main/assets/BusterDrone.glb` | ||
- 🍏 ios: place assets under `ios/assets/BusterDrone.glb` and import them in your XCode project | ||
|
||
Then, you can simply load them by providing the name to the asset: | ||
|
||
```tsx | ||
<Model source={{ uri: "BusterDrone.glb" }}> | ||
|
||
// If the asset is in a subdirectory: | ||
<Model source={{ uri: "subdir/BusterDrone.glb" }}> | ||
``` | ||
|
||
|
||
## 📁 From a local file path | ||
|
||
Files can also be loaded from the file directory on the device. This is useful if you load models from the web and want to cache them, by downloading them to your app's file directory. | ||
Note that if you want to open files from a public directory, such as the user's Downloads you might need to ask for permissions first. | ||
|
||
```tsx | ||
<Model source={{ uri: `file://${path}` }}> | ||
``` | ||
|
||
|
||
## 🌐 From web urls | ||
|
||
You can also load assets from the web. This is useful if you want to load assets dynamically from a server or a CDN. | ||
|
||
```tsx | ||
<Model source={{ uri: "https://example.com/BusterDrone.glb" }}> | ||
``` |
Oops, something went wrong.