|
1 | | -# PlayCanvas glTF Viewer |
| 1 | +# PlayCanvas Model Viewer |
| 2 | + |
| 3 | +[](https://github.com/playcanvas/model-viewer/releases) |
| 4 | +[](https://github.com/playcanvas/model-viewer/blob/main/LICENSE) |
| 5 | +[](https://discord.gg/RSaMRzg) |
| 6 | +[](https://www.reddit.com/r/PlayCanvas) |
| 7 | +[](https://x.com/intent/follow?screen_name=playcanvas) |
| 8 | + |
| 9 | +| [User Manual](https://developer.playcanvas.com) | [API Reference](https://api.playcanvas.com) | [Blog](https://blog.playcanvas.com) | [Forum](https://forum.playcanvas.com) | |
2 | 10 |
|
3 | 11 | The PlayCanvas glTF scene viewer is blazingly fast and 100% compliant with the glTF 2.0 spec. |
4 | 12 |
|
@@ -38,18 +46,16 @@ Some URL query parameters are available to override certain aspects of the viewe |
38 | 46 |
|
39 | 47 | Ensure you have [Node.js](https://nodejs.org) installed (v18.0+). Then, from a command prompt, run: |
40 | 48 |
|
41 | | - npm install |
42 | | - npm run build |
| 49 | +``` |
| 50 | +npm install |
| 51 | +npm run build |
| 52 | +``` |
43 | 53 |
|
44 | 54 | This will invoke Rollup and output the built viewer to the `dist` folder. To invoke Rollup with the `--watch` flag (which rebuilds the viewer on saving any source file), do: |
45 | 55 |
|
46 | | - npm run watch |
47 | | - |
48 | | -## How to build with local PlayCanvas engine |
49 | | - |
50 | | -You can set the npm build scripts to use local versions of the PlayCanvas engine & PlayCanvas extras builds by setting the following environment variables when launching the npm build scripts: |
51 | | - |
52 | | - ENGINE_PATH=./path/to/engine npm run build |
| 56 | +``` |
| 57 | +npm run watch |
| 58 | +``` |
53 | 59 |
|
54 | 60 | ## How to run |
55 | 61 |
|
|
68 | 74 | Open a browser and navigate to http://localhost:3000. |
69 | 75 |
|
70 | 76 | N.B. To load local models run `npx server --cors` in the directory containing the model (disables CORS). |
| 77 | + |
| 78 | +## Library integration testing |
| 79 | + |
| 80 | +The Model Viewer is built on the following open source libraries: |
| 81 | + |
| 82 | +| Library | Details | |
| 83 | +| ------------------------------------------------------------- | ------------------------------------------- | |
| 84 | +| [PlayCanvas Engine](https://github.com/playcanvas/engine) | Powers the Editor's 3D View and Launch Page | |
| 85 | +| [Observer](https://github.com/playcanvas/playcanvas-observer) | Data binding and history | |
| 86 | +| [PCUI](https://github.com/playcanvas/pcui) | Front-end component library | |
| 87 | + |
| 88 | +To test the integration of these libraries use [npm link](https://docs.npmjs.com/cli/v9/commands/npm-link). Follow these steps: |
| 89 | + |
| 90 | +1. Create a global link from source |
| 91 | + |
| 92 | + ```sh |
| 93 | + cd <library> |
| 94 | + npm link |
| 95 | + ``` |
| 96 | + |
| 97 | +2. Create a link to the global link |
| 98 | + |
| 99 | + ```sh |
| 100 | + cd model-viewer |
| 101 | + npm link <library> |
| 102 | + ``` |
0 commit comments