Skip to content

Commit

Permalink
Extras merged into engine (#6228)
Browse files Browse the repository at this point in the history
* moved extras inside src and updated import paths

* added fflate to build, removed extras build code; added legacy pcx support for UMD build

* removed extras from examples and load everything from playcanvas

* fixed usdz exporter bug

* removed bundle tar in examples root

* fixed bundles path in comment in example

* use module fflate instead of browser served version

* removes building extras from ci

* type fix in examples loader

* fixed pcx for dithered example

* fixed playcanvas paths

* added render passes to graphics category

* updated index.js for extras

* added folder level for extras
  • Loading branch information
kpal81xd authored Apr 15, 2024
1 parent 3985cdc commit 024e091
Show file tree
Hide file tree
Showing 56 changed files with 10,162 additions and 15,151 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ jobs:
- name: Build PlayCanvas (ESM-only)
run: npm run build:esm

- name: Build PlayCanvas Extras
run: npm run build:extras

- name: Build TypeScript declarations
run: npm run build:types

Expand Down
Binary file removed examples/bundle.tar
Binary file not shown.
1 change: 0 additions & 1 deletion examples/iframe/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
document.addEventListener('DOMContentLoaded', () => {
loader.start({
engineUrl: '@ENGINE',
extrasUrl: './playcanvas-extras/index.js',
exampleUrl: '@EXAMPLE',
controlsUrl: '@CONTROLS'
});
Expand Down
9 changes: 3 additions & 6 deletions examples/iframe/loader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,13 @@ class ExampleLoader {
}

/**
* @param {{ engineUrl: string, extrasUrl: string, exampleUrl: string, controlsUrl: string }} options - Options to start the loader
* @param {{ engineUrl: string, exampleUrl: string, controlsUrl: string }} options - Options to start the loader
*/
async start({ engineUrl, extrasUrl, exampleUrl, controlsUrl }) {
async start({ engineUrl, exampleUrl, controlsUrl }) {
window.pc = await import(engineUrl);
window.pcx = await import(extrasUrl);

// @ts-ignore
window.top.pc = window.pc;
// @ts-ignore
window.top.pcx = window.pcx;

files['example.mjs'] = await fetchFile(exampleUrl);
files['controls.mjs'] = await fetchFile(controlsUrl);
Expand Down Expand Up @@ -135,7 +132,7 @@ class ExampleLoader {
}

/**
* @param {*} enabled - The enabled state of ministats
* @param {boolean} enabled - The enabled state of ministats
*/
setMiniStats(enabled = false) {
MiniStats.enable(this._app, enabled);
Expand Down
6 changes: 3 additions & 3 deletions examples/iframe/ministats.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getQueryParams } from '@examples/utils';
const params = getQueryParams(window.top?.location.href ?? '');

export default class MiniStats {
/** @type {import('playcanvas-extras').MiniStats | null} */
/** @type {import('playcanvas').MiniStats | null} */
static instance = null;

/**
Expand All @@ -18,7 +18,7 @@ export default class MiniStats {
if (params.miniStats === 'false') {
return;
}
if (typeof pc === 'undefined' || typeof pcx === 'undefined') {
if (typeof window.pc === 'undefined') {
return;
}
if (!app) {
Expand All @@ -30,7 +30,7 @@ export default class MiniStats {
}
if (state) {
if (!MiniStats.instance) {
MiniStats.instance = new pcx.MiniStats(app);
MiniStats.instance = new window.pc.MiniStats(app);
}
}
if (!MiniStats.instance) {
Expand Down
Loading

0 comments on commit 024e091

Please sign in to comment.