Skip to content

Commit

Permalink
Allow to self-host the sample-assets directory (fix #702) (#766)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfretin authored Sep 8, 2024
1 parent 408be16 commit a8294dc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,22 @@ npm start
```

Then navigate to __[http://localhost:3333/examples/](http://localhost:3333/examples/)__

## Self-hosting the sample-assets directory

The textures modal is using https://aframe.io/sample-assets/dist/images.json
to get the available textures.
The GitHub repository for those assets is https://github.com/aframevr/sample-assets

If you want to self-host this directory, do the following:

```bash
cd examples
git clone [email protected]:aframevr/sample-assets.git
```

edit `index.html` and define before any script tag this global variable:

```html
<script>window.AFRAME_SAMPLE_ASSETS_ROOT = "./sample-assets/";</script>
```
1 change: 1 addition & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8">
<title>Example Scene</title>
<!--<script>window.AFRAME_SAMPLE_ASSETS_ROOT = "./sample-assets/";</script>-->
<script src="https://cdn.jsdelivr.net/gh/aframevr/aframe@master/dist/aframe-master.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/aframe-environment-component.min.js"></script>
</head>
Expand Down
3 changes: 2 additions & 1 deletion src/lib/assetsLoader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Events from './Events';

const assetsBaseUrl = 'https://aframe.io/sample-assets/';
const assetsBaseUrl =
window.AFRAME_SAMPLE_ASSETS_ROOT || 'https://aframe.io/sample-assets/';
const assetsRelativeUrl = { images: 'dist/images.json' };

/**
Expand Down

0 comments on commit a8294dc

Please sign in to comment.