@sparkjsdev/spark 0.1.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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +212 -0
  3. package/dist/assets/worker-DQiiPuma.js.map +1 -0
  4. package/dist/assets/worker-DnqMl73p.js.map +1 -0
  5. package/dist/spark.cjs.js +12696 -0
  6. package/dist/spark.cjs.js.map +1 -0
  7. package/dist/spark.cjs.min.js +1086 -0
  8. package/dist/spark.cjs.min.js.map +1 -0
  9. package/dist/spark.module.js +12679 -0
  10. package/dist/spark.module.js.map +1 -0
  11. package/dist/spark.module.min.js +10048 -0
  12. package/dist/spark.module.min.js.map +1 -0
  13. package/dist/types/ForgeRenderer.d.ts +136 -0
  14. package/dist/types/ForgeViewpoint.d.ts +83 -0
  15. package/dist/types/PackedSplats.d.ts +87 -0
  16. package/dist/types/Readback.d.ts +50 -0
  17. package/dist/types/RgbaArray.d.ts +44 -0
  18. package/dist/types/SplatAccumulator.d.ts +27 -0
  19. package/dist/types/SplatEdit.d.ts +94 -0
  20. package/dist/types/SplatGenerator.d.ts +61 -0
  21. package/dist/types/SplatGeometry.d.ts +7 -0
  22. package/dist/types/SplatLoader.d.ts +80 -0
  23. package/dist/types/SplatMesh.d.ts +85 -0
  24. package/dist/types/SplatSkinning.d.ts +29 -0
  25. package/dist/types/antisplat.d.ts +5 -0
  26. package/dist/types/controls.d.ts +114 -0
  27. package/dist/types/defines.d.ts +17 -0
  28. package/dist/types/dyno/base.d.ts +174 -0
  29. package/dist/types/dyno/control.d.ts +6 -0
  30. package/dist/types/dyno/convert.d.ts +190 -0
  31. package/dist/types/dyno/logic.d.ts +103 -0
  32. package/dist/types/dyno/math.d.ts +214 -0
  33. package/dist/types/dyno/mathTypes.d.ts +47 -0
  34. package/dist/types/dyno/output.d.ts +25 -0
  35. package/dist/types/dyno/program.d.ts +30 -0
  36. package/dist/types/dyno/splats.d.ts +156 -0
  37. package/dist/types/dyno/texture.d.ts +50 -0
  38. package/dist/types/dyno/transform.d.ts +59 -0
  39. package/dist/types/dyno/trig.d.ts +94 -0
  40. package/dist/types/dyno/types.d.ts +62 -0
  41. package/dist/types/dyno/uniforms.d.ts +374 -0
  42. package/dist/types/dyno/util.d.ts +139 -0
  43. package/dist/types/dyno/value.d.ts +32 -0
  44. package/dist/types/dyno/vecmat.d.ts +226 -0
  45. package/dist/types/dyno.d.ts +16 -0
  46. package/dist/types/generators/snow.d.ts +65 -0
  47. package/dist/types/generators/static.d.ts +9 -0
  48. package/dist/types/generators.d.ts +2 -0
  49. package/dist/types/hands.d.ts +95 -0
  50. package/dist/types/index.d.ts +20 -0
  51. package/dist/types/ksplat.d.ts +6 -0
  52. package/dist/types/ply.d.ts +31 -0
  53. package/dist/types/shaders.d.ts +1 -0
  54. package/dist/types/splatConstructors.d.ts +46 -0
  55. package/dist/types/splatWorker.d.ts +20 -0
  56. package/dist/types/spz.d.ts +50 -0
  57. package/dist/types/utils.d.ts +150 -0
  58. package/dist/types/vrButton.d.ts +6 -0
  59. package/dist/types/worker.d.ts +1 -0
  60. package/package.json +63 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright © 2025 WORLD LABS TECHNOLOGIES, INC.
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
13
+ all 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
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ <p align="center">
2
+
3
+ ![Forge logo](https://github.com/user-attachments/assets/d9cec150-8ca1-47f4-b7d9-4782aa629166#gh-dark-mode-only)
4
+ ![Forge logo](https://github.com/user-attachments/assets/adb2f0d7-df30-49e5-be7f-75c14f008735#gh-light-mode-only)
5
+
6
+ <h3 align="center">An advanced 3D Gaussian Splatting renderer for THREE.js</h3>
7
+ <div align="center">
8
+
9
+ [Features](#features) -
10
+ [Getting Started](#getting-started) -
11
+ <a href="https://www.forge.dev/">Documentation</a> -
12
+ <a href="https://www.forge.dev/">FAQ</a>
13
+ </div>
14
+ </p>
15
+
16
+ <div align="center">
17
+
18
+ [![License](https://img.shields.io/badge/license-MIT-%23d43e4c)](https://github.com/forge-gfx/forge/blob/main/LICENSE)
19
+ [![npm version](https://img.shields.io/npm/v/forge?color=d43e4c)](https://www.npmjs.com/package/forge)
20
+
21
+ </div>
22
+
23
+ <p>
24
+ <a href="https://www.forge.dev" target="_blank">
25
+ <picture>
26
+ </picture>
27
+ </a>
28
+
29
+ ## Features
30
+
31
+ - Integrates with THREE.js rendering pipeline to fuse splat and mesh-based objects
32
+ - Portable: Works across almost all devices, targeting 98%+ WebGL2 support
33
+ - Renders fast even on low-powered mobile devices
34
+ - Render multiple splat objects together with correct sorting
35
+ - Most major splat file formats supported including .PLY (also compressed), .SPZ, .SPLAT, .KSPLAT
36
+ - Render multiple viewpoints simultaneously
37
+ - Fully dynamic: each splat can be transformed and edited for animation
38
+ - Real-time splat color editing, displacement, and skeletal animation
39
+ - Shader graph system to dynamically create/edit splats on the GPU
40
+
41
+ Check out all the [examples](https://forge.dev/examples/)
42
+
43
+ ## Getting Started
44
+
45
+ ### Copy Code
46
+
47
+ Copy the following code into an `index.html` file.
48
+
49
+
50
+ ```html
51
+ <style> body {margin: 0;} </style>
52
+ <script type="importmap">
53
+ {
54
+ "imports": {
55
+ "three": "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.174.0/three.module.js",
56
+ "@worldlabsai/forge": "https://forge.dev/releases/forge/0.1.0/forge.module.js"
57
+ }
58
+ }
59
+ </script>
60
+ <script type="module">
61
+ import * as THREE from "three";
62
+ import { SplatMesh } from "@worldlabsai/forge";
63
+
64
+ const scene = new THREE.Scene();
65
+ const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
66
+ const renderer = new THREE.WebGLRenderer();
67
+ renderer.setSize(window.innerWidth, window.innerHeight);
68
+ document.body.appendChild(renderer.domElement)
69
+
70
+ const splatURL = "https://forge.dev/assets/splats/butterfly.spz";
71
+ const butterfly = new SplatMesh({ url: splatURL });
72
+ butterfly.quaternion.set(1, 0, 0, 0);
73
+ butterfly.position.set(0, 0, -3);
74
+ scene.add(butterfly);
75
+
76
+ renderer.setAnimationLoop(function animate(time) {
77
+ renderer.render(scene, camera);
78
+ butterfly.rotation.y += 0.01;
79
+ });
80
+ </script>
81
+ ```
82
+
83
+ ### Web Editor
84
+
85
+ Remix the [glitch starter template](https://glitch.com/edit/#!/forge-dev)
86
+
87
+ ### CDN
88
+
89
+ ```html
90
+ <script type="importmap">
91
+ {
92
+ "imports": {
93
+ "three": "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.174.0/three.module.js",
94
+ "forge": "https://forge.dev/releases/forge/0.1.0/forge.module.js"
95
+ }
96
+ }
97
+ </script>
98
+ ```
99
+
100
+ ### NPM
101
+
102
+ ```shell
103
+ npm install @forge-dev/forge
104
+ ```
105
+
106
+ ## Run Examples locally
107
+
108
+ Install [Rust](https://www.rust-lang.org/tools/install) if it's not already installed in your machine.
109
+
110
+ Next, build Forge by running:
111
+ ```
112
+ npm install
113
+ npm run build
114
+ ```
115
+ This will first build the Rust Wasm component (can be invoked via `npm run build:wasm`), then Forge itself (`npm run build`).
116
+
117
+ The examples fetch assets from a remote URL. This step is optional, but offline development and faster loading times are possible if you download and cache the assets files locally with the following command:
118
+ ```
119
+ npm run assets:download
120
+ ```
121
+
122
+ Once you've built Forge and optionally downloaded the assets, you can now run the examples:
123
+ ```
124
+ npm start
125
+ ```
126
+ This will run a dev server by default at [http://localhost:8080/](http://localhost:8080/). Check the console log output to see if yours is served on a different port.
127
+
128
+ ## Develop and contribute to the project
129
+
130
+ ### Build troubleshooting
131
+
132
+ First try cleaning all the build files and re-building everything:
133
+ ```
134
+ npm run clean
135
+ npm install
136
+ npm run build
137
+ ```
138
+
139
+ There's no versioning system for assets. If you need to re-download a specific file you can delete that asset file individually or download all assets from scratch:
140
+
141
+ ```
142
+ npm run assets:clean
143
+ npm run assets:download
144
+ ```
145
+
146
+ ### Ignore dist directory during development
147
+
148
+ To ignore the dist directory and prevent accidental commits and merge conflicts
149
+
150
+ ```
151
+ git update-index --assume-unchanged dist/*
152
+ ```
153
+
154
+ To revert and be able to commit into to the dist directory again:
155
+
156
+ ```
157
+ git update-index --no-assume-unchanged dist/*
158
+ ```
159
+
160
+ To list ignored files in case of need to troubleshoot
161
+
162
+ ```
163
+ git ls-files -v | grep '^[a-z]' | cut -c3-
164
+ ```
165
+
166
+ ### Build docs and site
167
+
168
+ Install [Mkdocs Material](https://squidfunk.github.io/mkdocs-material/)
169
+
170
+ ```
171
+ pip install mkdocs-material
172
+ ```
173
+
174
+ If you hit an `externally managed environment` error on macOS and if you installed python via `brew` try:
175
+
176
+ ```
177
+ brew install mkdocs-material
178
+ ```
179
+
180
+ Edit markdown in `/docs` directory
181
+
182
+ ```
183
+ npm run docs
184
+ ```
185
+
186
+ ### Build Forge website
187
+
188
+ Build the static site and docs in a `site` directory.
189
+
190
+ ```
191
+ npm run site:build
192
+ ```
193
+
194
+ You can run any static server in the `site` directory but for convenience you can run
195
+
196
+ ```
197
+ npm run site:serve
198
+ ```
199
+
200
+ ### Deploy Forge website
201
+
202
+ The following command will generate a static site from the `docs` directory and push it to the [repo](https://github.com/forge-gfx/forge-gfx.github.io) that hosts the site via `gh-pages`
203
+
204
+ ```
205
+ npm run site:deploy
206
+ ```
207
+
208
+ ### Compress splats
209
+
210
+ To compress a splat to [spz](https://scaniverse.com/spz) run
211
+
212
+ `npm run assets:compress <file or URL to ply>`