@popaya/pgsg-viewer 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.
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-PYYLHUV6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,33 @@
1
+ // src/viewer/pgsg-viewer.ts
2
+ var PGSGViewer = class {
3
+ constructor(options) {
4
+ this.options = options;
5
+ }
6
+ engine;
7
+ async load() {
8
+ const type = this.options.viewerType ?? "three";
9
+ if (type === "playcanvas") {
10
+ const { PGSGPlayCanvasViewer } = await import("./pgsg-playcanvas-viewer-4WORM4WU.js");
11
+ this.engine = new PGSGPlayCanvasViewer(this.options);
12
+ } else {
13
+ const { PGSGThreeViewer } = await import("./pgsg-three-viewer-ZU5OI33Q.js");
14
+ this.engine = new PGSGThreeViewer(this.options);
15
+ }
16
+ await this.engine.load();
17
+ this.engine.start?.();
18
+ }
19
+ resize() {
20
+ this.engine?.resize();
21
+ }
22
+ destroy() {
23
+ this.engine?.destroy();
24
+ }
25
+ setCameraMode(mode) {
26
+ this.engine?.setCameraMode?.(mode);
27
+ }
28
+ };
29
+
30
+ export {
31
+ PGSGViewer
32
+ };
33
+ //# sourceMappingURL=chunk-TBA7YDMF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/viewer/pgsg-viewer.ts"],"sourcesContent":["import type { ViewerType, PGSGViewerEngine } from \"../viewers/types\";\nimport type { PGSGViewerOptions } from \"../core/types\";\n\nexport class PGSGViewer {\n private engine!: PGSGViewerEngine;\n\n constructor(\n private options: PGSGViewerOptions & { viewerType?: ViewerType },\n ) {}\n\n async load() {\n const type = this.options.viewerType ?? \"three\";\n\n if (type === \"playcanvas\") {\n const { PGSGPlayCanvasViewer } =\n await import(\"../viewers/playcanvas/pgsg-playcanvas-viewer\");\n this.engine = new PGSGPlayCanvasViewer(this.options);\n } else {\n const { PGSGThreeViewer } =\n await import(\"../viewers/three/pgsg-three-viewer\");\n this.engine = new PGSGThreeViewer(this.options);\n }\n\n await this.engine.load();\n this.engine.start?.();\n }\n\n resize() {\n this.engine?.resize();\n }\n\n destroy() {\n this.engine?.destroy();\n }\n\n setCameraMode(mode: \"orbit\" | \"walk\") {\n this.engine?.setCameraMode?.(mode);\n }\n}\n"],"mappings":";AAGO,IAAM,aAAN,MAAiB;AAAA,EAGtB,YACU,SACR;AADQ;AAAA,EACP;AAAA,EAJK;AAAA,EAMR,MAAM,OAAO;AACX,UAAM,OAAO,KAAK,QAAQ,cAAc;AAExC,QAAI,SAAS,cAAc;AACzB,YAAM,EAAE,qBAAqB,IAC3B,MAAM,OAAO,sCAA8C;AAC7D,WAAK,SAAS,IAAI,qBAAqB,KAAK,OAAO;AAAA,IACrD,OAAO;AACL,YAAM,EAAE,gBAAgB,IACtB,MAAM,OAAO,iCAAoC;AACnD,WAAK,SAAS,IAAI,gBAAgB,KAAK,OAAO;AAAA,IAChD;AAEA,UAAM,KAAK,OAAO,KAAK;AACvB,SAAK,OAAO,QAAQ;AAAA,EACtB;AAAA,EAEA,SAAS;AACP,SAAK,QAAQ,OAAO;AAAA,EACtB;AAAA,EAEA,UAAU;AACR,SAAK,QAAQ,QAAQ;AAAA,EACvB;AAAA,EAEA,cAAc,MAAwB;AACpC,SAAK,QAAQ,gBAAgB,IAAI;AAAA,EACnC;AACF;","names":[]}
@@ -0,0 +1,48 @@
1
+ type ViewerType = "three" | "playcanvas" | "spark";
2
+
3
+ type SourceType = "pgsg" | "ply";
4
+ interface PGSGSource {
5
+ type: "pgsg";
6
+ url: string;
7
+ }
8
+ interface PLYSource {
9
+ type: "ply";
10
+ url: string;
11
+ }
12
+ type ViewerSource = PGSGSource | PLYSource;
13
+ interface CameraOptions {
14
+ fov?: number;
15
+ near?: number;
16
+ far?: number;
17
+ upAxis?: "Y" | "Z";
18
+ }
19
+ interface ControlOptions {
20
+ orbit?: boolean;
21
+ pan?: boolean;
22
+ zoom?: boolean;
23
+ }
24
+ interface PGSGViewerOptions {
25
+ container: HTMLElement;
26
+ source: ViewerSource;
27
+ camera?: CameraOptions;
28
+ controls?: ControlOptions;
29
+ renderer?: {
30
+ pixelRatio?: number;
31
+ antialias?: boolean;
32
+ };
33
+ debug?: boolean;
34
+ }
35
+
36
+ declare class PGSGViewer {
37
+ private options;
38
+ private engine;
39
+ constructor(options: PGSGViewerOptions & {
40
+ viewerType?: ViewerType;
41
+ });
42
+ load(): Promise<void>;
43
+ resize(): void;
44
+ destroy(): void;
45
+ setCameraMode(mode: "orbit" | "walk"): void;
46
+ }
47
+
48
+ export { type CameraOptions, type ControlOptions, type PGSGSource, PGSGViewer, type PGSGViewerOptions, type PLYSource, type SourceType, type ViewerSource };
@@ -0,0 +1,8 @@
1
+ import "../chunk-PYYLHUV6.js";
2
+ import {
3
+ PGSGViewer
4
+ } from "../chunk-TBA7YDMF.js";
5
+ export {
6
+ PGSGViewer
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ export { CameraOptions, ControlOptions, PGSGSource, PGSGViewer, PGSGViewerOptions, PLYSource, SourceType, ViewerSource } from './core/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import "./chunk-PYYLHUV6.js";
2
+ import {
3
+ PGSGViewer
4
+ } from "./chunk-TBA7YDMF.js";
5
+ export {
6
+ PGSGViewer
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}