@playcanvas/supersplat-viewer 1.3.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 PlayCanvas Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # SuperSplat Viewer
2
+
3
+ [![NPM Version][npm-version-badge]][npm-url]
4
+ [![NPM Downloads][npm-downloads-badge]][npm-trends-url]
5
+ [![License][license-badge]][license-url]
6
+ [![GitHub Actions Build Status][build-status-badge]][workflow-url]
7
+ [![Github Issue Resolve Time][issue-resolve-badge]][isitmaintained-url]
8
+ [![Github Open Issues][open-issues-badge]][isitmaintained-url]
9
+
10
+ | [User Manual][manual-url] | [API Reference][api-url] | [Blog][blog-url] | [Forum][forum-url] | [Discord][discord-url] | [Reddit][reddit-url] | [Twitter][twitter-url] |
11
+
12
+ This is the official viewer for https://superspl.at and the SuperSplat Editor HTML export.
13
+
14
+ <img width="1088" alt="Screenshot 2025-04-11 at 13 36 02" src="https://github.com/user-attachments/assets/a5e2a2eb-3064-4d73-beb9-eb9c4708b2b2" />
15
+
16
+ This webapp compiles to simple, self-contained, static website.
17
+
18
+ The app supports a few useful URL parameters (though please note these are subject to change):
19
+ - `&settings=url` - specify the URL of the `settings.json` file (default is `./settings.json`)
20
+ - `&content=url` - specify the URL of the `scene.compressed.ply` file (default is `./scene.compressed.ply`)
21
+
22
+ As well as the following:
23
+ - `&noui` - hide UI
24
+ - `&noanim` - start with animation paused
25
+ - `&poster=url` - show an image while loading the scene content
26
+ - `&ministats` - show the runtime CPU (and on desktop, GPU) performance graphs
27
+ - `&skybox=url` - specify an equirectangular skybox image for the skybox
28
+
29
+ The webapp source files is available as strings for templating when imported as an NPM module:
30
+
31
+ ```ts
32
+ import { html, css, js } from '@playcanvas/supersplat-viewer`;
33
+
34
+ // logs the source of index.html
35
+ console.log(html);
36
+
37
+ // logs the source of index.css
38
+ console.log(css);
39
+
40
+ // logs the source of index.js
41
+ console.log(js);
42
+ ```
43
+
44
+ ## Local Development
45
+
46
+ To initialize a local development environment for SuperSplat Viewer, ensure you have [Node.js](https://nodejs.org/) 18 or later installed. Follow these steps:
47
+
48
+ 1. Clone the repository:
49
+
50
+ ```sh
51
+ git clone https://github.com/playcanvas/supersplat-viewer.git
52
+ cd supersplat-viewer
53
+ ```
54
+
55
+ 2. Install dependencies:
56
+
57
+ ```sh
58
+ npm install
59
+ ```
60
+
61
+ 3. Build SuperSplat Viewer and start a local web server:
62
+
63
+ ```sh
64
+ npm run develop
65
+ ```
66
+
67
+ 4. Open the browser at http://localhost:3000.
68
+
69
+ ## Settings Schema
70
+
71
+ The `settings.json` file has the following schema (as defined in typescript, taken from SuperSplat editor):
72
+
73
+
74
+ ```typescript
75
+ type AnimTrack = {
76
+ name: string,
77
+ duration: number,
78
+ frameRate: number,
79
+ target: 'camera',
80
+ loopMode: 'none' | 'repeat' | 'pingpong',
81
+ interpolation: 'step' | 'spline',
82
+ keyframes: {
83
+ times: number[],
84
+ values: {
85
+ position: number[],
86
+ target: number[],
87
+ }
88
+ }
89
+ };
90
+
91
+ type ExperienceSettings = {
92
+ camera: {
93
+ fov?: number,
94
+ position?: number[],
95
+ target?: number[],
96
+ startAnim: 'none' | 'orbit' | 'animTrack',
97
+ animTrack: string
98
+ },
99
+ background: {
100
+ color?: number[]
101
+ },
102
+ animTracks: AnimTrack[]
103
+ };
104
+ ```
105
+
106
+ ### Example settings.json
107
+
108
+ ```json
109
+ {
110
+ "background": {"color": [0,0,0,0]},
111
+ "camera": {
112
+ "fov": 1.0,
113
+ "position": [0,1,-1],
114
+ "target": [0,0,0],
115
+ "startAnim": "orbit"
116
+ }
117
+ }
118
+ ```
119
+
120
+ [npm-version-badge]: https://img.shields.io/npm/v/@playcanvas/supersplat-viewer.svg
121
+ [npm-downloads-badge]: https://img.shields.io/npm/dw/@playcanvas/supersplat-viewer
122
+ [license-badge]: https://img.shields.io/npm/l/@playcanvas/supersplat-viewer.svg
123
+ [build-status-badge]: https://github.com/playcanvas/supersplat-viewer/actions/workflows/ci.yml/badge.svg
124
+ [issue-resolve-badge]: https://isitmaintained.com/badge/resolution/playcanvas/supersplat-viewer.svg
125
+ [open-issues-badge]: https://isitmaintained.com/badge/open/playcanvas/supersplat-viewer.svg
126
+
127
+ [npm-url]: https://www.npmjs.com/package/@playcanvas/supersplat-viewer
128
+ [npm-trends-url]: https://npmtrends.com/@playcanvas/supersplat-viewer
129
+ [license-url]: https://github.com/playcanvas/supersplat-viewer/blob/main/LICENSE
130
+ [workflow-url]: https://github.com/playcanvas/supersplat-viewer/actions/workflows/ci.yml
131
+ [isitmaintained-url]: https://isitmaintained.com/project/playcanvas/supersplat-viewer
132
+
133
+ [manual-url]: https://developer.playcanvas.com
134
+ [api-url]: https://api.playcanvas.com
135
+ [blog-url]: https://blog.playcanvas.com
136
+ [forum-url]: https://forum.playcanvas.com
137
+ [discord-url]: https://discord.gg/RSaMRzg
138
+ [reddit-url]: https://www.reddit.com/r/PlayCanvas/
139
+ [twitter-url]: https://twitter.com/intent/follow?screen_name=playcanvas
@@ -0,0 +1,3 @@
1
+ export const html: string;
2
+ export const css: string;
3
+ export const js: string;