Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const booleanFlags = new Set([
]);
const engineTypes = new Set(['development', 'performance', 'debug']);
const creditFields = ['title', 'author', 'source', 'license'];
const requiredCreditFields = ['title', 'author'];
const creditFieldSet = new Set(creditFields);

const splitFlag = (line) => {
Expand Down Expand Up @@ -134,7 +135,7 @@ const configBlockShape = {
return null;
}

const missing = creditFields.filter(field => !credit.fields[field]);
const missing = requiredCreditFields.filter(field => !credit.fields[field]);
if (missing.length) {
report(line, 'missingCreditFields', { fields: missing.join(', ') });
}
Expand Down
19 changes: 17 additions & 2 deletions examples/iframe/runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const moduleUrls = new Map();
const moduleUrlTasks = new Map();
const configRegex = /^[ \t]*\/\/ @config[ \t]*(?:\r?\n[ \t]*\/\/[^\r\n]*)*(?:\r?\n|$)/gm;
const CREDIT_FIELDS = ['title', 'author', 'source', 'license'];
const REQUIRED_CREDIT_FIELDS = ['title', 'author'];
const CREDIT_FIELD_SET = new Set(CREDIT_FIELDS);

const parseValue = (val) => {
Expand All @@ -52,7 +53,7 @@ const parseExampleConfig = (block, config) => {
let credit = null;

const completeCredit = () => {
const missing = CREDIT_FIELDS.filter(field => !credit[field]);
const missing = REQUIRED_CREDIT_FIELDS.filter(field => !credit[field]);
if (missing.length) {
throw new Error(`Incomplete @credit: missing ${missing.join(', ')}`);
}
Expand Down Expand Up @@ -118,7 +119,21 @@ const parseExampleConfig = (block, config) => {
completeCredit();
}

const text = description.join('\n').trim();
const paragraphs = [];
let current = [];
for (const line of description) {
const trimmed = line.trim();
if (trimmed) {
current.push(trimmed);
} else if (current.length) {
paragraphs.push(current.join(' '));
current = [];
}
}
if (current.length) {
paragraphs.push(current.join(' '));
}
const text = paragraphs.join('\n').trim();
if (text) {
config.DESCRIPTION = text;
}
Expand Down
15 changes: 9 additions & 6 deletions examples/src/app/components/Example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -493,23 +493,26 @@ class Example extends TypedComponent {
* @returns {ReactElement} rendered credit row.
*/
renderCredit(credit, index) {
const source = URL_IN_TEXT_PATTERN.exec(credit.source);
const source = credit.source ? URL_IN_TEXT_PATTERN.exec(credit.source) : null;
const label = fragment(
jsx('span', { className: 'example-credit-title' }, credit.title),
' by ',
jsx('span', { className: 'example-credit-author' }, credit.author)
);
const children = [source ? this.renderCreditLink(source[1], label) : label];
if (!source && credit.source) {
children.push(' \u00b7 ', credit.source);
}
if (credit.license) {
children.push(' \u00b7 ', this.renderLicenseLink(credit.license));
}
return jsx(
'p',
{
className: 'example-credit',
key: index
},
source ? this.renderCreditLink(source[1], label) : label,
source ? null : ' \u00b7 ',
source ? null : credit.source,
' \u00b7 ',
this.renderLicenseLink(credit.license)
...children
);
}

Expand Down
4 changes: 2 additions & 2 deletions examples/src/app/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* @typedef {object} Credit
* @property {string} title - The credit title.
* @property {string} author - The credit author.
* @property {string} source - The credit source.
* @property {string} license - The credit license.
* @property {string} [source] - The credit source (optional).
* @property {string} [license] - The credit license (optional).
*
* @typedef {object} StateEventDetail
* @property {Observer} observer - The PCUI observer.
Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/camera/first-person.example.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// @config
//
// `WASD` Move · `Space` Jump · `Mouse` Look
//
// @credit
// title: De Dust 2 with Real Light
// author: Sketchfab
// source: https://sketchfab.com/3d-models/de-dust-2-with-real-light-4ce74cd95c584ce9b12b5ed9dc418db5
// license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';
import { FirstPersonController } from 'playcanvas/scripts/esm/first-person-controller.mjs';
Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/compute/edge-detect.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
// red.
//
// @flag WEBGL_DISABLED
//
// @credit
// title: Chess Board
// author: Idmental
// source: https://sketchfab.com/3d-models/chess-board-901eeeca884f4622ac37b7e8f7cb82c3
// license: CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/compute/histogram.example.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// @config
// @flag WEBGL_DISABLED
//
// @credit
// title: UXR Icosahedron
// author: enealefons
// source: https://sketchfab.com/3d-models/uxr-icosahedron-66c69bd0538a455197aebe81ae3a4961
// license: CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/compute/indirect-dispatch.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
// edge (red) and smooth (blue) regions.
//
// @flag WEBGL_DISABLED
//
// @credit
// title: Wide Street 02
// author: Poly Haven
// source: https://polyhaven.com/a/wide_street_02
// license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/compute/texture-gen.example.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// @config
// @flag WEBGL_DISABLED
//
// @credit
// title: UXR Icosahedron
// author: enealefons
// source: https://sketchfab.com/3d-models/uxr-icosahedron-66c69bd0538a455197aebe81ae3a4961
// license: CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// @config
// @flag HIDDEN
// @flag NO_MINISTATS
//
// @credit
// title: Roman Parish
// author: Andrii Shramko
// source: https://www.linkedin.com/in/andrii-shramko/

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
//
// Interactive 3D annotations on a gaussian splat model. Click hotspots to reveal product details with
// tooltips that follow the 3D positions.
//
// @credit
// title: Bicycle
// author: Stéphane Agullo
// source: https://www.stephane-agullo.fr/

import * as pc from 'playcanvas';
import { Annotation, AnnotationManager } from 'playcanvas/scripts/esm/annotations.mjs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
// @flag NO_DEVICE_SELECTOR
// @flag WEBGPU_DISABLED
// @flag WEBGL_DISABLED
//
// @credit
// title: Roman Parish
// author: Andrii Shramko
// source: https://www.linkedin.com/in/andrii-shramko/

import * as pc from 'playcanvas';

Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/gaussian-splatting/editor.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
// GSplat editor with AABB selection, deletion, and cloning using GSplatProcessor.
//
// `Select button` Show selection box · `Gizmo` Move selection box · `LMB` Orbit
//
// @credit
// title: SA3D_R&D_XP47
// author: Stephane Agullo
// source: https://superspl.at/view?id=cdcec084
// license: CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

Expand Down
10 changes: 10 additions & 0 deletions examples/src/examples/gaussian-splatting/flipbook.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
// files.
//
// @flag NO_MINISTATS
//
// @credit
// title: Mirror's Edge Apartment - Interior Scene
// author: Aurélien Martel
// source: https://sketchfab.com/3d-models/mirrors-edge-apartment-interior-scene-9804e9f2fe284070b081c96ceaf8af96
// license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
//
// @credit
// title: Basketball Player
// author: azad_geniusxr

import * as pc from 'playcanvas';
import { GsplatFlipbook } from 'playcanvas/scripts/esm/gsplat/gsplat-flipbook.mjs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
//
// Demonstrates a grid of Gaussian Splat instances using the LOD system for stable performance, with a
// custom data stream storing IDs to colorize splats via a color lookup texture.
//
// @credit
// title: PLAYBOT
// author: Stephane Agullo
// source: https://superspl.at/view?id=ee6d8bc4
// license: CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// @config
//
// Demonstrates LOD streaming combined with spherical harmonics for view-dependent effects.
//
// @credit
// title: Skatepark
// author: Christoph Schindelar
// source: https://superspl.at/user?id=schindelar3d

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
// Demonstrates LOD streaming with radial reveal effect for progressive loading of Gaussian Splats.
//
// @flag NO_MINISTATS
//
// @credit
// title: Roman Parish
// author: Andrii Shramko
// source: https://www.linkedin.com/in/andrii-shramko/

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// @config
//
// Shows multiple Gaussian Splat objects in a gallery scene with custom vertex shaders.
//
// @credit
// title: VR Gallery
// author: Sketchfab
// source: https://sketchfab.com/3d-models/vr-gallery-1e087aa25dc742e680accb15249bd6be
// license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/gaussian-splatting/paint.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
// 3D painting on gaussian splats using GSplatProcessor.
//
// `RMB` Paint · `LMB` Orbit
//
// @credit
// title: SA3D_R&D_XP47
// author: Stephane Agullo
// source: https://superspl.at/view?id=cdcec084
// license: CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
//
// Procedural mesh converted to gaussian splats. Demonstrates converting a terrain scene with animated
// clouds to splat representation.
//
// @credit
// title: Terrain Low Poly
// author: Sketchfab
// source: https://sketchfab.com/3d-models/terrain-low-poly-248b21331315466e98d20c441935d99d
// license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';
import { GsplatMesh } from 'playcanvas/scripts/esm/gsplat/gsplat-mesh.mjs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// @config
//
// Procedural shapes rendered using gaussian splats. Demonstrates lines, text and image-based splats.
//
// @credit
// title: Bicycle
// author: Stéphane Agullo
// source: https://www.stephane-agullo.fr/

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
6 changes: 6 additions & 0 deletions examples/src/examples/gaussian-splatting/shadows.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
// Demonstrates shadow catching with Gaussian Splats.
//
// @flag HIDDEN
//
// @credit
// title: St Peter's Square Night
// author: Poly Haven
// source: https://polyhaven.com/a/st_peters_square_night
// license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';
import { ShadowCatcher } from 'playcanvas/scripts/esm/shadow-catcher.mjs';
Expand Down
16 changes: 16 additions & 0 deletions examples/src/examples/gaussian-splatting/splat-portal.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
// through it.
//
// @flag NO_MINISTATS
//
// @credit
// title: Portal Frame
// author: Sketchfab
// source: https://sketchfab.com/3d-models/portal-frame-da34b37a224e4e49b307c0b17a50af2c
// license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
//
// @credit
// title: Roman Parish
// author: Andrii Shramko
// source: https://www.linkedin.com/in/andrii-shramko/
//
// @credit
// title: Skatepark
// author: Christoph Schindelar
// source: https://superspl.at/user?id=schindelar3d

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
8 changes: 8 additions & 0 deletions examples/src/examples/gaussian-splatting/viewer.example.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
// @config
//
// @credit
// title: Wide Street 02
// author: Poly Haven
// source: https://polyhaven.com/a/wide_street_02
// license: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

import * as pc from 'playcanvas';

import { data, deviceType } from 'examples/context';
Expand Down
5 changes: 5 additions & 0 deletions examples/src/examples/gaussian-splatting/weather.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
// Particles follow the camera using a deterministic 3D grid with hash-based positioning and animation.
//
// @flag NO_MINISTATS
//
// @credit
// title: Roman Parish
// author: Andrii Shramko
// source: https://www.linkedin.com/in/andrii-shramko/

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
5 changes: 5 additions & 0 deletions examples/src/examples/gaussian-splatting/world.example.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// @config
//
// Shows a large world scene with LOD streaming and additional moving splats.
//
// @credit
// title: Skatepark
// author: Christoph Schindelar
// source: https://superspl.at/user?id=schindelar3d

import * as pc from 'playcanvas';
import { CameraControls } from 'playcanvas/scripts/esm/camera-controls.mjs';
Expand Down
Loading