create-playcanvas 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +15 -2
  2. package/dist/index.mjs +41 -38
  3. package/package.json +5 -2
  4. package/templates/_features/physics/assets/public/ammo/SOURCE.md +4 -1
  5. package/templates/{react/interactive-sphere/src/App.css → _shared/interactive-sphere/src/counter.css} +0 -6
  6. package/templates/engine/base/README.md +1 -1
  7. package/templates/engine/base/vite.config.ts +3 -0
  8. package/templates/engine/first-person-controller/src/main.ts +2 -3
  9. package/templates/engine/interactive-sphere/src/App.ts +1 -1
  10. package/templates/engine/interactive-sphere/src/main.ts +3 -5
  11. package/templates/engine/model-viewer/src/main.ts +3 -3
  12. package/templates/engine/physics-playground/src/main.ts +2 -3
  13. package/templates/engine/spinning-cube/src/main.ts +1 -1
  14. package/templates/engine/splat-viewer/src/main.ts +1 -1
  15. package/templates/engine/third-person-controller/src/main.ts +2 -3
  16. package/templates/react/base/README.md +1 -1
  17. package/templates/react/base/vite.config.ts +3 -0
  18. package/templates/react/interactive-sphere/src/App.tsx +5 -6
  19. package/templates/react/interactive-sphere/src/Scene.tsx +1 -1
  20. package/templates/react/model-viewer/src/App.tsx +4 -2
  21. package/templates/react/spinning-cube/src/App.tsx +2 -0
  22. package/templates/react/splat-viewer/src/App.tsx +2 -0
  23. package/templates/web-components/base/README.md +1 -1
  24. package/templates/web-components/base/vite.config.ts +3 -0
  25. package/templates/web-components/first-person-controller/index.html +1 -6
  26. package/templates/web-components/interactive-sphere/src/main.ts +2 -2
  27. package/templates/web-components/model-viewer/index.html +2 -2
  28. package/templates/web-components/model-viewer/src/main.ts +0 -1
  29. package/templates/web-components/physics-playground/index.html +1 -6
  30. package/templates/web-components/spinning-cube/src/main.ts +0 -1
  31. package/templates/web-components/splat-viewer/src/main.ts +0 -1
  32. package/templates/web-components/third-person-controller/index.html +1 -6
  33. package/templates/_features/physics/assets/public/ammo/ammo.js +0 -973
  34. package/templates/engine/interactive-sphere/index.html +0 -13
  35. package/templates/engine/interactive-sphere/src/style.css +0 -28
  36. package/templates/engine/model-viewer/index.html +0 -13
  37. package/templates/engine/model-viewer/src/style.css +0 -8
  38. package/templates/engine/spinning-cube/index.html +0 -13
  39. package/templates/engine/spinning-cube/src/style.css +0 -8
  40. package/templates/engine/splat-viewer/index.html +0 -13
  41. package/templates/engine/splat-viewer/src/style.css +0 -8
  42. package/templates/react/base/.prettierignore +0 -3
  43. package/templates/react/base/_gitignore +0 -24
  44. package/templates/react/base/_npmrc +0 -1
  45. package/templates/react/base/prettier.config.mjs +0 -1
  46. package/templates/react/base/src/assets/playcanvas.png +0 -0
  47. package/templates/react/base/src/inspector.css +0 -33
  48. package/templates/react/base/src/inspector.ts +0 -38
  49. package/templates/react/base/src/starter.css +0 -104
  50. package/templates/react/base/src/vite-env.d.ts +0 -19
  51. package/templates/react/interactive-sphere/index.html +0 -13
  52. package/templates/react/interactive-sphere/src/index.css +0 -4
  53. package/templates/react/interactive-sphere/src/main.tsx +0 -11
  54. package/templates/react/model-viewer/index.html +0 -13
  55. package/templates/react/model-viewer/src/index.css +0 -9
  56. package/templates/react/model-viewer/src/main.tsx +0 -11
  57. package/templates/react/spinning-cube/index.html +0 -13
  58. package/templates/react/spinning-cube/src/index.css +0 -9
  59. package/templates/react/spinning-cube/src/main.tsx +0 -11
  60. package/templates/react/splat-viewer/index.html +0 -13
  61. package/templates/react/splat-viewer/src/index.css +0 -9
  62. package/templates/react/splat-viewer/src/main.tsx +0 -11
  63. package/templates/web-components/base/.prettierignore +0 -3
  64. package/templates/web-components/base/_gitignore +0 -24
  65. package/templates/web-components/base/_npmrc +0 -1
  66. package/templates/web-components/base/prettier.config.mjs +0 -1
  67. package/templates/web-components/base/src/assets/playcanvas.png +0 -0
  68. package/templates/web-components/base/src/inspector.css +0 -33
  69. package/templates/web-components/base/src/inspector.ts +0 -38
  70. package/templates/web-components/base/src/starter.css +0 -104
  71. package/templates/web-components/base/src/vite-env.d.ts +0 -19
  72. package/templates/web-components/interactive-sphere/src/style.css +0 -53
  73. package/templates/web-components/model-viewer/src/style.css +0 -8
  74. package/templates/web-components/spinning-cube/src/style.css +0 -8
  75. package/templates/web-components/splat-viewer/src/style.css +0 -8
  76. /package/templates/{engine/base → _common}/.prettierignore +0 -0
  77. /package/templates/{engine/base → _common}/_gitignore +0 -0
  78. /package/templates/{engine/base → _common}/_npmrc +0 -0
  79. /package/templates/{engine/base → _common}/prettier.config.mjs +0 -0
  80. /package/templates/{engine/base → _common}/src/assets/playcanvas.png +0 -0
  81. /package/templates/{engine/base → _common}/src/inspector.css +0 -0
  82. /package/templates/{engine/base → _common}/src/inspector.ts +0 -0
  83. /package/templates/{engine/base → _common}/src/starter.css +0 -0
  84. /package/templates/{engine/base → _common}/src/vite-env.d.ts +0 -0
@@ -33,7 +33,7 @@ Open <http://localhost:5173>. Edit `index.html` to change the scene.
33
33
  | `npm run fmt` | Check formatting |
34
34
  | `npm run typecheck` | Run TypeScript checks |
35
35
 
36
- Run `npm run build` to generate a deployable static site in `dist/`.
36
+ Run `npm run build` to generate a deployable static site in `dist/`. Its paths are relative, so it runs from any folder, such as a GitHub Pages project site or an itch.io upload.
37
37
 
38
38
  ## How it fits together
39
39
 
@@ -2,6 +2,9 @@ import { defineConfig } from 'vite';
2
2
 
3
3
  // https://vite.dev/config/
4
4
  export default defineConfig({
5
+ // Relative URLs, so the build runs wherever it's served from: a domain root, a subpath such as
6
+ // GitHub Pages or itch.io, or a Snapchat Web Lens
7
+ base: './',
5
8
  plugins: [
6
9
  {
7
10
  // Dev only: install the PlayCanvas Inspector before the app starts (press ` to toggle)
@@ -14,12 +14,7 @@
14
14
  <pc-material id="green-material" diffuse="#2e6638" emissive="#09140b" gloss="0.2"></pc-material>
15
15
  <pc-material id="wood-material" diffuse="#7a451a" emissive="#180e05" gloss="0.2"></pc-material>
16
16
  <pc-material id="metal-material" diffuse="#475461" emissive="#0e1113" gloss="0.5"></pc-material>
17
- <pc-wasm
18
- name="Ammo"
19
- glue="/ammo/ammo.wasm.js"
20
- wasm="/ammo/ammo.wasm.wasm"
21
- fallback="/ammo/ammo.js"
22
- ></pc-wasm>
17
+ <pc-wasm name="Ammo" glue="./ammo/ammo.wasm.js" wasm="./ammo/ammo.wasm.wasm"></pc-wasm>
23
18
  <pc-scene>
24
19
  <pc-entity name="light" rotation="50 30 0"
25
20
  ><pc-light
@@ -4,8 +4,8 @@ import { Asset, TEXTURETYPE_RGBP } from 'playcanvas';
4
4
  import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
5
5
  import { Grid } from 'playcanvas/scripts/esm/grid.mjs';
6
6
 
7
+ import './counter.css';
7
8
  import './starter.css';
8
- import './style.css';
9
9
 
10
10
  const HOVER_COLOR = '#40ccff';
11
11
  const DEFAULT_COLOR = '#e6edf9';
@@ -25,7 +25,7 @@ const app = appElement.app!;
25
25
  const envAtlas = new Asset(
26
26
  'env-atlas',
27
27
  'texture',
28
- { url: '/environment-map.png' },
28
+ { url: './environment-map.png' },
29
29
  {
30
30
  type: TEXTURETYPE_RGBP,
31
31
  mipmaps: false
@@ -8,8 +8,8 @@
8
8
  </head>
9
9
  <body>
10
10
  <pc-app>
11
- <!-- Swap this for your own model - anything you drop in public/ is served from the site root -->
12
- <pc-asset id="model" src="/playcanvas-cube.glb"></pc-asset>
11
+ <!-- Swap this for your own model - files in public/ are served next to index.html, so use a ./ path -->
12
+ <pc-asset id="model" src="./playcanvas-cube.glb"></pc-asset>
13
13
 
14
14
  <pc-scene>
15
15
  <!-- Camera. Orbit controls are attached in src/main.ts. The sky is HDR, so it needs
@@ -4,7 +4,6 @@ import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
4
4
  import { ProceduralSky } from 'playcanvas/scripts/esm/sky/procedural-sky.mjs';
5
5
 
6
6
  import './starter.css';
7
- import './style.css';
8
7
 
9
8
  // The camera is awaited as <pc-camera> rather than the <pc-entity> holding it - an entity becomes
10
9
  // ready before its component children do, and CameraControls needs the camera component to exist
@@ -8,12 +8,7 @@
8
8
  </head>
9
9
  <body>
10
10
  <pc-app>
11
- <pc-wasm
12
- name="Ammo"
13
- glue="/ammo/ammo.wasm.js"
14
- wasm="/ammo/ammo.wasm.wasm"
15
- fallback="/ammo/ammo.js"
16
- ></pc-wasm>
11
+ <pc-wasm name="Ammo" glue="./ammo/ammo.wasm.js" wasm="./ammo/ammo.wasm.wasm"></pc-wasm>
17
12
  <pc-material id="floor-material" diffuse="#2e333d" gloss="0.2"></pc-material>
18
13
  <pc-material id="cyan-material" diffuse="#29ade6" gloss="0.45"></pc-material>
19
14
  <pc-material id="coral-material" diffuse="#f25738" gloss="0.45"></pc-material>
@@ -3,7 +3,6 @@ import { whenReady } from '@playcanvas/web-components';
3
3
  import { Script } from 'playcanvas';
4
4
 
5
5
  import './starter.css';
6
- import './style.css';
7
6
 
8
7
  class Rotate extends Script {
9
8
  static scriptName = 'rotate';
@@ -2,7 +2,6 @@ import { whenReady } from '@playcanvas/web-components';
2
2
  import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
3
3
 
4
4
  import './starter.css';
5
- import './style.css';
6
5
 
7
6
  // The camera is awaited as <pc-camera> rather than the <pc-entity> holding it - an entity becomes
8
7
  // ready before its component children do, and CameraControls needs the camera component to exist
@@ -16,12 +16,7 @@
16
16
  <pc-material id="shirt-material" diffuse="#268bd2"></pc-material>
17
17
  <pc-material id="skin-material" diffuse="#c78759"></pc-material>
18
18
  <pc-material id="pants-material" diffuse="#2e4a85"></pc-material>
19
- <pc-wasm
20
- name="Ammo"
21
- glue="/ammo/ammo.wasm.js"
22
- wasm="/ammo/ammo.wasm.wasm"
23
- fallback="/ammo/ammo.js"
24
- ></pc-wasm>
19
+ <pc-wasm name="Ammo" glue="./ammo/ammo.wasm.js" wasm="./ammo/ammo.wasm.wasm"></pc-wasm>
25
20
  <pc-scene>
26
21
  <pc-entity name="camera" position="0 3 6"><pc-camera clear-color="#7ab8e6"></pc-camera></pc-entity>
27
22
  <pc-entity name="light" rotation="45 30 0"