@margoengine/points 0.0.0-stage → 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 (52) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +794 -3
  4. package/dist/attributes-DNc-1pdr.js +256 -0
  5. package/dist/attributes.d.ts +48 -0
  6. package/dist/clip.d.ts +55 -0
  7. package/dist/clip.js +122 -0
  8. package/dist/cloud-B4O_G-Df.js +545 -0
  9. package/dist/cloud.d.ts +155 -0
  10. package/dist/color.d.ts +1 -0
  11. package/dist/copc.d.ts +55 -0
  12. package/dist/copc.js +130 -0
  13. package/dist/depth-video.d.ts +98 -0
  14. package/dist/depth-video.js +164 -0
  15. package/dist/e57.d.ts +163 -0
  16. package/dist/e57.js +624 -0
  17. package/dist/frame.d.ts +9 -0
  18. package/dist/index.d.ts +16 -0
  19. package/dist/index.js +1246 -0
  20. package/dist/las.d.ts +213 -0
  21. package/dist/las.js +500 -0
  22. package/dist/laz.d.ts +50 -0
  23. package/dist/laz.js +1025 -0
  24. package/dist/material.d.ts +167 -0
  25. package/dist/math.d.ts +103 -0
  26. package/dist/octree.d.ts +182 -0
  27. package/dist/octree.js +360 -0
  28. package/dist/pick.d.ts +76 -0
  29. package/dist/pick.js +192 -0
  30. package/dist/plugin.d.ts +235 -0
  31. package/dist/potree.d.ts +70 -0
  32. package/dist/potree.js +451 -0
  33. package/dist/range-BQuJAjUM.js +23 -0
  34. package/dist/range.d.ts +4 -0
  35. package/dist/screen-door-CALlYs39.js +7 -0
  36. package/dist/shaders-Deu8H36P.js +278 -0
  37. package/dist/shaders.d.ts +52 -0
  38. package/dist/shared/fog.d.ts +33 -0
  39. package/dist/shared/pass.d.ts +53 -0
  40. package/dist/shared/selection-mask.d.ts +52 -0
  41. package/dist/shared/style-expression.d.ts +18 -0
  42. package/dist/sprites.d.ts +78 -0
  43. package/dist/storage-limit.d.ts +6 -0
  44. package/dist/style.d.ts +124 -0
  45. package/dist/style.js +708 -0
  46. package/dist/surfels.d.ts +95 -0
  47. package/dist/surfels.js +538 -0
  48. package/dist/survey-DToZwkJv.js +46 -0
  49. package/dist/survey.d.ts +10 -0
  50. package/dist/tier-BcFbLPVT.js +91 -0
  51. package/dist/tier.d.ts +6 -0
  52. package/package.json +96 -6
@@ -0,0 +1,91 @@
1
+ import { MargoError as e } from "@margoengine/math/errors";
2
+ //#region ../shared/require-webgpu.js
3
+ function t(t, n) {
4
+ if (t.backend === "webgl2" || !t.gpu) throw new e("unsupported", `${n} needs WebGPU; see https://margoengine.com/errors#webgpu`);
5
+ }
6
+ //#endregion
7
+ //#region src/storage-limit.ts
8
+ function n(e, t, n) {
9
+ let r = Math.min(t.maxStorageBufferBindingSize, t.maxBufferSize), i = Math.max(12, n, e.colors ? 4 * e.colorStride : 0);
10
+ if (e.count * i > r) throw RangeError(`Point cloud of ${e.count} points exceeds the device storage limit of ${Math.floor(r / i)} points at ${i} bytes a point; split it into several clouds${i === 16 ? " or use colorFormat 'rgba8'" : ""}.`);
11
+ }
12
+ //#endregion
13
+ //#region ../shared/errors.js
14
+ var r = (e, t) => Object.assign(Error(t), {
15
+ name: "MargoError",
16
+ code: e
17
+ }), i = (e, t) => `${e}; see https://margoengine.com/errors#${t}`, a = (e, t, n = e) => r(e, i(t, n));
18
+ //#endregion
19
+ //#region ../shared/view-rect.js
20
+ function o(e) {
21
+ return e?.view?.viewport;
22
+ }
23
+ function s(e) {
24
+ let t = o(e);
25
+ return t ? [t[2], t[3]] : [e.width, e.height];
26
+ }
27
+ function c(e, t) {
28
+ let n = o(t);
29
+ if (!n) return;
30
+ e.setViewport(n[0], n[1], n[2], n[3], 0, 1);
31
+ let r = t.view.scissor ?? n;
32
+ e.setScissorRect(r[0], r[1], r[2], r[3]);
33
+ }
34
+ function l(e) {
35
+ return e?.view?.id ?? 0;
36
+ }
37
+ var u = class {
38
+ constructor(e, t = () => {}) {
39
+ this.create = e, this.release = t, this.states = /* @__PURE__ */ new Map(), this.frame = 0;
40
+ }
41
+ get(e) {
42
+ let t = l(e), n = this.states.get(t);
43
+ return n || this.states.set(t, n = {
44
+ state: this.create(e),
45
+ frame: 0
46
+ }), n.frame = this.frame, n.state;
47
+ }
48
+ find(e) {
49
+ return this.states.get(e)?.state;
50
+ }
51
+ *values() {
52
+ for (let e of this.states.values()) yield e.state;
53
+ }
54
+ *drawn() {
55
+ for (let e of this.states.values()) e.frame === this.frame && (yield e.state);
56
+ }
57
+ prune() {
58
+ for (let [e, t] of this.states) t.frame < this.frame && (this.states.delete(e), this.release(t.state));
59
+ this.frame++;
60
+ }
61
+ clear() {
62
+ for (let e of this.states.values()) this.release(e.state);
63
+ this.states.clear();
64
+ }
65
+ };
66
+ //#endregion
67
+ //#region ../shared/compat.js
68
+ function d(e, t, n = "full") {
69
+ let r = {
70
+ ldr: 0,
71
+ "half-float": 1,
72
+ full: 2
73
+ };
74
+ if (!Object.hasOwn(r, n)) throw TypeError("minimum must be full, half-float or ldr");
75
+ let i = e?.adapter?.capabilities?.tier;
76
+ if (i && r[i] < r[n]) throw a("unsupported", `${t} requires the ${n} compatibility tier; this device is ${i}`, "compatibility-layer");
77
+ }
78
+ function f(e) {
79
+ return e?.adapterInfo?.vendor === "margo-webgl2" ? "webgl2" : "native";
80
+ }
81
+ function p(e) {
82
+ return f(e) === "native" && e?.features?.has("core-features-and-limits") === !1;
83
+ }
84
+ //#endregion
85
+ //#region src/tier.ts
86
+ function m(e) {
87
+ let t = e.adapter?.capabilities?.tier;
88
+ return f(e) === "webgl2" && t !== "full";
89
+ }
90
+ //#endregion
91
+ export { u as a, s as c, t as d, d as i, a as l, f as n, c as o, p as r, o as s, m as t, n as u };
package/dist/tier.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Whether the WebGL2 layer rounds this device's r32float targets: below its full tier it stores them as r16float (and
3
+ * on its ldr tier in 8 bits), whose rounding of a depth (about 0.004 at a depth of 4) moves the surfel blend window
4
+ * and the eye-dome depth steps. Such a device gets its depths packed into rgba8unorm instead, exactly.
5
+ */
6
+ export declare function roundsFloatTargets(device: GPUDevice): boolean;
package/package.json CHANGED
@@ -1,6 +1,96 @@
1
- {
2
- "name": "@margoengine/points",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@margoengine/points",
3
+ "version": "0.1.0",
4
+ "description": "Large point clouds (PointCloud, PointsMaterial) and instanced sprites (SpriteBatch, SpriteMaterial) for Margo Engine, WebGPU.",
5
+ "keywords": [
6
+ "margoengine",
7
+ "webgpu",
8
+ "3d",
9
+ "points"
10
+ ],
11
+ "homepage": "https://margoengine.com",
12
+ "bugs": {
13
+ "url": "https://github.com/scottcampbelldata/margoengine/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/scottcampbelldata/margoengine.git",
18
+ "directory": "packages/points"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "author": "Scott Campbell",
22
+ "type": "module",
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "build": "node scripts/build.js",
28
+ "test": "npm run build && node --test tests/*.test.js ../../examples/package-benchmarks/proofs/package-guard.mjs",
29
+ "test:gpu": "cd ../.. && node packages/points/tests/scale-check.mjs",
30
+ "test:browser": "npm run build && node scripts/test-browser.js",
31
+ "prepack": "npm run build",
32
+ "test:gpu:scale": "npm run build && cd ../.. && node packages/points/tests/scale-check.mjs"
33
+ },
34
+ "sideEffects": false,
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js"
39
+ },
40
+ "./las": {
41
+ "types": "./dist/las.d.ts",
42
+ "import": "./dist/las.js"
43
+ },
44
+ "./laz": {
45
+ "types": "./dist/laz.d.ts",
46
+ "import": "./dist/laz.js"
47
+ },
48
+ "./e57": {
49
+ "types": "./dist/e57.d.ts",
50
+ "import": "./dist/e57.js"
51
+ },
52
+ "./copc": {
53
+ "types": "./dist/copc.d.ts",
54
+ "import": "./dist/copc.js"
55
+ },
56
+ "./octree": {
57
+ "types": "./dist/octree.d.ts",
58
+ "import": "./dist/octree.js"
59
+ },
60
+ "./surfels": {
61
+ "types": "./dist/surfels.d.ts",
62
+ "import": "./dist/surfels.js"
63
+ },
64
+ "./potree": {
65
+ "types": "./dist/potree.d.ts",
66
+ "import": "./dist/potree.js"
67
+ },
68
+ "./depth-video": {
69
+ "types": "./dist/depth-video.d.ts",
70
+ "import": "./dist/depth-video.js"
71
+ },
72
+ "./pick": {
73
+ "types": "./dist/pick.d.ts",
74
+ "import": "./dist/pick.js"
75
+ },
76
+ "./clip": {
77
+ "types": "./dist/clip.d.ts",
78
+ "import": "./dist/clip.js"
79
+ },
80
+ "./style": {
81
+ "types": "./dist/style.d.ts",
82
+ "import": "./dist/style.js"
83
+ }
84
+ },
85
+ "files": [
86
+ "dist",
87
+ "NOTICE"
88
+ ],
89
+ "peerDependencies": {
90
+ "@margoengine/core": "^0.1.0"
91
+ },
92
+ "dependencies": {
93
+ "@margoengine/decoders": "^0.1.0",
94
+ "@margoengine/math": "^0.1.0"
95
+ }
96
+ }