@giro3d/piero-plugin-obj 0.0.0-stage → 1.0.0-beta.12

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/README.md CHANGED
@@ -1,3 +1,38 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
+ <a href="https://piero.giro3d.org">
3
+ <img src="https://piero.giro3d.org/piero_logo.svg" height="120" alt="Piero">
4
+ </a>
5
+ </div>
2
6
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
7
+ <div align="center">
8
+ A versatile web library to visualize 3D geospatial data in the browser.
9
+ </div>
10
+
11
+ <br>
12
+
13
+ <div align="center">
14
+ <a href="https://gitlab.com/giro3d/piero/badges/main/pipeline.svg"><img src="https://gitlab.com/giro3d/piero/badges/main/pipeline.svg" alt="Pipeline status"></a>
15
+ <a href="https://www.npmjs.com/package/@giro3d/piero-plugin-obj"><img alt="NPMJS latest package badge" src="https://img.shields.io/npm/v/@giro3d/piero-plugin-obj?color=blue"></a>
16
+ <a href="https://matrix.to/#/#giro3d:matrix.org"><img src="https://img.shields.io/matrix/giro3d:matrix.org" alt="Matrix chat"></a>
17
+ </div>
18
+
19
+ ## `piero-plugin-obj`
20
+
21
+ Plugin for `@giro3d/piero` to add support for OBJ datasets.
22
+
23
+ ## Getting started
24
+
25
+ Register the `OBJLoader` module when starting the app:
26
+
27
+ ```ts
28
+ // index.ts
29
+ import { createPieroApp } from '@giro3d/piero';
30
+ import { OBJLoader } from '@giro3d/piero-plugin-obj';
31
+
32
+ createPieroApp({
33
+ ...
34
+ modules: [
35
+ new OBJLoader(),
36
+ ]
37
+ });
38
+ ```
@@ -0,0 +1,4 @@
1
+ "use strict";var b=Object.defineProperty;var O=(t,e,s)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>O(t,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@giro3d/piero"),x=require("@giro3d/giro3d/entities/Entity3D"),l=require("three"),g=require("three/examples/jsm/loaders/OBJLoader.js"),j=t=>t!=null&&typeof t=="object";class p extends x{constructor(s,c){super(new l.Group);o(this,"isOBJEntity",!0);o(this,"source");o(this,"type","OBJEntity");o(this,"_context");this.source=s,this._context=c}async preprocess(){const c=(await this._context.http.getText(this.source.url)).split(`
2
+ `),d=new l.Box3().makeEmpty(),r=new l.Vector3;c.filter(a=>a.startsWith("v ")).forEach(a=>{const[n,m,y,f]=a.split(" ");r.set(parseFloat(m),parseFloat(y),parseFloat(f)),d.expandByPoint(r)}),d.getCenter(r);const h=c.map(a=>{if(a.startsWith("v ")){const n=a.split(" ");return n[1]=(parseFloat(n[1])-r.x).toString(),n[2]=(parseFloat(n[2])-r.y).toString(),n[3]=(parseFloat(n[3])-r.z).toString(),n.join(" ")}else return a}),i=new g.OBJLoader().parse(h.join(`
3
+ `));this.source.name!=null&&(i.name=this.source.name),i.position.set(r.x,r.y,r.z),i.updateWorldMatrix(!0,!0),i.updateMatrix(),i.updateMatrixWorld(!0),this.onObjectCreated(i),this.object3d.add(i),u.fillObject3DUserData(this,{filename:this.source.name??this._context.http.getContext(this.source.url).filename}),this.notifyChange(this.object3d)}}o(p,"isOBJEntity",s=>j(s)&&s.isOBJEntity);const B=u.configuration.dataset.Dataset.extend({url:u.configuration.url.UrlOrFile}),J=t=>{const e={name:t.filename,type:"obj",url:t.file,visible:!0};return Promise.resolve(e)},v=t=>e=>{const s=B.parse(e.dataset),c=new p({name:s.name,url:s.url},t);return Promise.resolve({entities:[c]})};class E{constructor(){o(this,"id","builtin-loader-obj");o(this,"name","OBJ")}initialize(e){e.datasets.registerDatasetType("obj",{builder:v(e),fileExtensions:["obj"],icon:"bi-file-earmark-3d",loader:J,name:"OBJ"})}}exports.OBJLoader=E;
4
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/OBJEntity.ts","../src/OBJLoader.ts"],"sourcesContent":["import type { PieroContext } from '@giro3d/piero';\n\nimport Entity3D from '@giro3d/giro3d/entities/Entity3D';\nimport { fillObject3DUserData } from '@giro3d/piero';\nimport { Box3, Group, Vector3 } from 'three';\nimport { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js';\n\nconst isObject = (obj: unknown): obj is object => obj != null && typeof obj === 'object';\n\nexport interface OBJSource {\n name?: string;\n url: Blob | string;\n}\n\nexport default class OBJEntity extends Entity3D {\n public readonly isOBJEntity = true as const;\n public readonly source: OBJSource;\n public override readonly type = 'OBJEntity' as const;\n\n private readonly _context: PieroContext;\n\n public constructor(source: OBJSource, context: PieroContext) {\n super(new Group());\n this.source = source;\n this._context = context;\n }\n\n public static isOBJEntity = (obj: unknown): obj is OBJEntity =>\n isObject(obj) && (obj as OBJEntity).isOBJEntity;\n\n public override async preprocess(): Promise<void> {\n const content = await this._context.http.getText(this.source.url);\n\n // Translate vertices so they're close to 0 to avoid flickering\n const lines: string[] = content.split('\\n');\n const volume = new Box3().makeEmpty();\n const vec3 = new Vector3();\n lines\n .filter(line => line.startsWith('v '))\n .forEach(line => {\n const [_, x, y, z] = line.split(' ');\n vec3.set(parseFloat(x), parseFloat(y), parseFloat(z));\n volume.expandByPoint(vec3);\n });\n volume.getCenter(vec3);\n\n const newLines = lines.map(line => {\n if (line.startsWith('v ')) {\n const it = line.split(' ');\n it[1] = (parseFloat(it[1]) - vec3.x).toString();\n it[2] = (parseFloat(it[2]) - vec3.y).toString();\n it[3] = (parseFloat(it[3]) - vec3.z).toString();\n return it.join(' ');\n } else {\n return line;\n }\n });\n\n const loader = new OBJLoader();\n const object = loader.parse(newLines.join('\\n'));\n\n if (this.source.name != null) {\n object.name = this.source.name;\n }\n\n object.position.set(vec3.x, vec3.y, vec3.z);\n object.updateWorldMatrix(true, true);\n object.updateMatrix();\n object.updateMatrixWorld(true);\n\n this.onObjectCreated(object);\n this.object3d.add(object);\n\n fillObject3DUserData(this, {\n filename: this.source.name ?? this._context.http.getContext(this.source.url).filename,\n });\n\n this.notifyChange(this.object3d);\n }\n}\n","import type { api, Module, PieroContext } from '@giro3d/piero';\nimport type z from 'zod';\n\nimport { configuration } from '@giro3d/piero';\n\nimport OBJEntity from './OBJEntity';\n\nconst OBJDataset = configuration.dataset.Dataset.extend({\n /** URL to the obj file */\n url: configuration.url.UrlOrFile,\n});\nexport type OBJDataset = z.infer<typeof OBJDataset>;\n\nconst loader: api.dataset.LoadDatasetFromFile = context => {\n const result = {\n name: context.filename,\n type: 'obj',\n url: context.file,\n visible: true,\n } satisfies OBJDataset;\n\n return Promise.resolve(result);\n};\n\nconst builder: (pieroContext: PieroContext) => api.dataset.DatasetBuilder = pieroContext => {\n return context => {\n const cfg = OBJDataset.parse(context.dataset);\n\n const entity = new OBJEntity(\n {\n name: cfg.name,\n url: cfg.url,\n },\n pieroContext,\n );\n\n return Promise.resolve({\n entities: [entity],\n });\n };\n};\n\nexport default class OBJLoader implements Module {\n public readonly id = 'builtin-loader-obj';\n public readonly name = 'OBJ';\n\n public initialize(context: PieroContext): Promise<void> | void {\n context.datasets.registerDatasetType('obj', {\n builder: builder(context),\n fileExtensions: ['obj'],\n icon: 'bi-file-earmark-3d',\n loader,\n name: 'OBJ',\n });\n }\n}\n"],"names":["isObject","obj","OBJEntity","Entity3D","source","context","Group","__publicField","lines","volume","Box3","vec3","Vector3","line","_","x","z","newLines","it","object","OBJLoader","fillObject3DUserData","OBJDataset","configuration","loader","result","builder","pieroContext","cfg","entity"],"mappings":"2YAOMA,EAAYC,GAAgCA,GAAO,MAAQ,OAAOA,GAAQ,SAOhF,MAAqBC,UAAkBC,CAAS,CAOrC,YAAYC,EAAmBC,EAAuB,CACzD,MAAM,IAAIC,EAAAA,KAAO,EAPLC,EAAA,mBAAc,IACdA,EAAA,eACSA,EAAA,YAAO,aAEfA,EAAA,iBAIb,KAAK,OAASH,EACd,KAAK,SAAWC,CACpB,CAKA,MAAsB,YAA4B,CAI9C,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AS,KAAK,WAAW,KAAK,OAAO,GAAG,EAAE,QAAA,CAChF,EAED,KAAK,aAAa,KAAK,QAAQ,CACnC,CACJ,CApDId,EAbiBL,EAaH,cAAeD,GACzBD,EAASC,CAAG,GAAMA,EAAkB,aCrB5C,MAAMqB,EAAaC,EAAAA,cAAc,QAAQ,QAAQ,OAAO,CAEpD,IAAKA,EAAAA,cAAc,IAAI,SAC3B,CAAC,EAGKC,EAA0CnB,GAAW,CACvD,MAAMoB,EAAS,CACX,KAAMpB,EAAQ,SACd,KAAM,MACN,IAAKA,EAAQ,KACb,QAAS,EAAA,EAGb,OAAO,QAAQ,QAAQoB,CAAM,CACjC,EAEMC,EAAsEC,GACjEtB,GAAW,CACd,MAAMuB,EAAMN,EAAW,MAAMjB,EAAQ,OAAO,EAEtCwB,EAAS,IAAI3B,EACf,CACI,KAAM0B,EAAI,KACV,IAAKA,EAAI,GAAA,EAEbD,CAAA,EAGJ,OAAO,QAAQ,QAAQ,CACnB,SAAU,CAACE,CAAM,CAAA,CACpB,CACL,EAGJ,MAAqBT,CAA4B,CAAjD,cACoBb,EAAA,UAAK,sBACLA,EAAA,YAAO,OAEhB,WAAWF,EAA6C,CAC3DA,EAAQ,SAAS,oBAAoB,MAAO,CACxC,QAASqB,EAAQrB,CAAO,EACxB,eAAgB,CAAC,KAAK,EACtB,KAAM,qBACN,OAAAmB,EACA,KAAM,KAAA,CACT,CACL,CACJ"}
@@ -0,0 +1,2 @@
1
+ export * from './packages/piero-plugin-obj/src/index'
2
+ export {}
@@ -0,0 +1,80 @@
1
+ var y = Object.defineProperty;
2
+ var x = (t, e, s) => e in t ? y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
+ var i = (t, e, s) => x(t, typeof e != "symbol" ? e + "" : e, s);
4
+ import { fillObject3DUserData as b, configuration as u } from "@giro3d/piero";
5
+ import O from "@giro3d/giro3d/entities/Entity3D";
6
+ import { Group as B, Box3 as j, Vector3 as g } from "three";
7
+ import { OBJLoader as J } from "three/examples/jsm/loaders/OBJLoader.js";
8
+ const E = (t) => t != null && typeof t == "object";
9
+ class p extends O {
10
+ constructor(s, l) {
11
+ super(new B());
12
+ i(this, "isOBJEntity", !0);
13
+ i(this, "source");
14
+ i(this, "type", "OBJEntity");
15
+ i(this, "_context");
16
+ this.source = s, this._context = l;
17
+ }
18
+ async preprocess() {
19
+ const l = (await this._context.http.getText(this.source.url)).split(`
20
+ `), c = new j().makeEmpty(), r = new g();
21
+ l.filter((a) => a.startsWith("v ")).forEach((a) => {
22
+ const [o, m, h, f] = a.split(" ");
23
+ r.set(parseFloat(m), parseFloat(h), parseFloat(f)), c.expandByPoint(r);
24
+ }), c.getCenter(r);
25
+ const d = l.map((a) => {
26
+ if (a.startsWith("v ")) {
27
+ const o = a.split(" ");
28
+ return o[1] = (parseFloat(o[1]) - r.x).toString(), o[2] = (parseFloat(o[2]) - r.y).toString(), o[3] = (parseFloat(o[3]) - r.z).toString(), o.join(" ");
29
+ } else
30
+ return a;
31
+ }), n = new J().parse(d.join(`
32
+ `));
33
+ this.source.name != null && (n.name = this.source.name), n.position.set(r.x, r.y, r.z), n.updateWorldMatrix(!0, !0), n.updateMatrix(), n.updateMatrixWorld(!0), this.onObjectCreated(n), this.object3d.add(n), b(this, {
34
+ filename: this.source.name ?? this._context.http.getContext(this.source.url).filename
35
+ }), this.notifyChange(this.object3d);
36
+ }
37
+ }
38
+ i(p, "isOBJEntity", (s) => E(s) && s.isOBJEntity);
39
+ const v = u.dataset.Dataset.extend({
40
+ /** URL to the obj file */
41
+ url: u.url.UrlOrFile
42
+ }), w = (t) => {
43
+ const e = {
44
+ name: t.filename,
45
+ type: "obj",
46
+ url: t.file,
47
+ visible: !0
48
+ };
49
+ return Promise.resolve(e);
50
+ }, F = (t) => (e) => {
51
+ const s = v.parse(e.dataset), l = new p(
52
+ {
53
+ name: s.name,
54
+ url: s.url
55
+ },
56
+ t
57
+ );
58
+ return Promise.resolve({
59
+ entities: [l]
60
+ });
61
+ };
62
+ class M {
63
+ constructor() {
64
+ i(this, "id", "builtin-loader-obj");
65
+ i(this, "name", "OBJ");
66
+ }
67
+ initialize(e) {
68
+ e.datasets.registerDatasetType("obj", {
69
+ builder: F(e),
70
+ fileExtensions: ["obj"],
71
+ icon: "bi-file-earmark-3d",
72
+ loader: w,
73
+ name: "OBJ"
74
+ });
75
+ }
76
+ }
77
+ export {
78
+ M as OBJLoader
79
+ };
80
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../src/OBJEntity.ts","../src/OBJLoader.ts"],"sourcesContent":["import type { PieroContext } from '@giro3d/piero';\n\nimport Entity3D from '@giro3d/giro3d/entities/Entity3D';\nimport { fillObject3DUserData } from '@giro3d/piero';\nimport { Box3, Group, Vector3 } from 'three';\nimport { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader.js';\n\nconst isObject = (obj: unknown): obj is object => obj != null && typeof obj === 'object';\n\nexport interface OBJSource {\n name?: string;\n url: Blob | string;\n}\n\nexport default class OBJEntity extends Entity3D {\n public readonly isOBJEntity = true as const;\n public readonly source: OBJSource;\n public override readonly type = 'OBJEntity' as const;\n\n private readonly _context: PieroContext;\n\n public constructor(source: OBJSource, context: PieroContext) {\n super(new Group());\n this.source = source;\n this._context = context;\n }\n\n public static isOBJEntity = (obj: unknown): obj is OBJEntity =>\n isObject(obj) && (obj as OBJEntity).isOBJEntity;\n\n public override async preprocess(): Promise<void> {\n const content = await this._context.http.getText(this.source.url);\n\n // Translate vertices so they're close to 0 to avoid flickering\n const lines: string[] = content.split('\\n');\n const volume = new Box3().makeEmpty();\n const vec3 = new Vector3();\n lines\n .filter(line => line.startsWith('v '))\n .forEach(line => {\n const [_, x, y, z] = line.split(' ');\n vec3.set(parseFloat(x), parseFloat(y), parseFloat(z));\n volume.expandByPoint(vec3);\n });\n volume.getCenter(vec3);\n\n const newLines = lines.map(line => {\n if (line.startsWith('v ')) {\n const it = line.split(' ');\n it[1] = (parseFloat(it[1]) - vec3.x).toString();\n it[2] = (parseFloat(it[2]) - vec3.y).toString();\n it[3] = (parseFloat(it[3]) - vec3.z).toString();\n return it.join(' ');\n } else {\n return line;\n }\n });\n\n const loader = new OBJLoader();\n const object = loader.parse(newLines.join('\\n'));\n\n if (this.source.name != null) {\n object.name = this.source.name;\n }\n\n object.position.set(vec3.x, vec3.y, vec3.z);\n object.updateWorldMatrix(true, true);\n object.updateMatrix();\n object.updateMatrixWorld(true);\n\n this.onObjectCreated(object);\n this.object3d.add(object);\n\n fillObject3DUserData(this, {\n filename: this.source.name ?? this._context.http.getContext(this.source.url).filename,\n });\n\n this.notifyChange(this.object3d);\n }\n}\n","import type { api, Module, PieroContext } from '@giro3d/piero';\nimport type z from 'zod';\n\nimport { configuration } from '@giro3d/piero';\n\nimport OBJEntity from './OBJEntity';\n\nconst OBJDataset = configuration.dataset.Dataset.extend({\n /** URL to the obj file */\n url: configuration.url.UrlOrFile,\n});\nexport type OBJDataset = z.infer<typeof OBJDataset>;\n\nconst loader: api.dataset.LoadDatasetFromFile = context => {\n const result = {\n name: context.filename,\n type: 'obj',\n url: context.file,\n visible: true,\n } satisfies OBJDataset;\n\n return Promise.resolve(result);\n};\n\nconst builder: (pieroContext: PieroContext) => api.dataset.DatasetBuilder = pieroContext => {\n return context => {\n const cfg = OBJDataset.parse(context.dataset);\n\n const entity = new OBJEntity(\n {\n name: cfg.name,\n url: cfg.url,\n },\n pieroContext,\n );\n\n return Promise.resolve({\n entities: [entity],\n });\n };\n};\n\nexport default class OBJLoader implements Module {\n public readonly id = 'builtin-loader-obj';\n public readonly name = 'OBJ';\n\n public initialize(context: PieroContext): Promise<void> | void {\n context.datasets.registerDatasetType('obj', {\n builder: builder(context),\n fileExtensions: ['obj'],\n icon: 'bi-file-earmark-3d',\n loader,\n name: 'OBJ',\n });\n }\n}\n"],"names":["isObject","obj","OBJEntity","Entity3D","source","context","Group","__publicField","lines","volume","Box3","vec3","Vector3","line","_","x","y","z","newLines","it","object","OBJLoader","fillObject3DUserData","OBJDataset","configuration","loader","result","builder","pieroContext","cfg","entity"],"mappings":";;;;;;;AAOA,MAAMA,IAAW,CAACC,MAAgCA,KAAO,QAAQ,OAAOA,KAAQ;AAOhF,MAAqBC,UAAkBC,EAAS;AAAA,EAOrC,YAAYC,GAAmBC,GAAuB;AACzD,UAAM,IAAIC,GAAO;AAPL,IAAAC,EAAA,qBAAc;AACd,IAAAA,EAAA;AACS,IAAAA,EAAA,cAAO;AAEf,IAAAA,EAAA;AAIb,SAAK,SAASH,GACd,KAAK,WAAWC;AAAA,EACpB;AAAA,EAKA,MAAsB,aAA4B;AAI9C,UAAMG,KAHU,MAAM,KAAK,SAAS,KAAK,QAAQ,KAAK,OAAO,GAAG,GAGhC,MAAM;AAAA,CAAI,GACpCC,IAAS,IAAIC,EAAA,EAAO,UAAA,GACpBC,IAAO,IAAIC,EAAA;AACjB,IAAAJ,EACK,OAAO,OAAQK,EAAK,WAAW,IAAI,CAAC,EACpC,QAAQ,CAAAA,MAAQ;AACb,YAAM,CAACC,GAAGC,GAAGC,GAAGC,CAAC,IAAIJ,EAAK,MAAM,GAAG;AACnC,MAAAF,EAAK,IAAI,WAAWI,CAAC,GAAG,WAAWC,CAAC,GAAG,WAAWC,CAAC,CAAC,GACpDR,EAAO,cAAcE,CAAI;AAAA,IAC7B,CAAC,GACLF,EAAO,UAAUE,CAAI;AAErB,UAAMO,IAAWV,EAAM,IAAI,CAAAK,MAAQ;AAC/B,UAAIA,EAAK,WAAW,IAAI,GAAG;AACvB,cAAMM,IAAKN,EAAK,MAAM,GAAG;AACzB,eAAAM,EAAG,CAAC,KAAK,WAAWA,EAAG,CAAC,CAAC,IAAIR,EAAK,GAAG,SAAA,GACrCQ,EAAG,CAAC,KAAK,WAAWA,EAAG,CAAC,CAAC,IAAIR,EAAK,GAAG,SAAA,GACrCQ,EAAG,CAAC,KAAK,WAAWA,EAAG,CAAC,CAAC,IAAIR,EAAK,GAAG,SAAA,GAC9BQ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BT,EAA4B;AAAA,EAAjD;AACoB,IAAAd,EAAA,YAAK;AACL,IAAAA,EAAA,cAAO;AAAA;AAAA,EAEhB,WAAWF,GAA6C;AAC3D,IAAAA,EAAQ,SAAS,oBAAoB,OAAO;AAAA,MACxC,SAASsB,EAAQtB,CAAO;AAAA,MACxB,gBAAgB,CAAC,KAAK;AAAA,MACtB,MAAM;AAAA,MACN,QAAAoB;AAAA,MACA,MAAM;AAAA,IAAA,CACT;AAAA,EACL;AACJ;"}
@@ -0,0 +1,16 @@
1
+ import { PieroContext } from '@giro3d/piero';
2
+ import { default as Entity3D } from '@giro3d/giro3d/entities/Entity3D';
3
+ export interface OBJSource {
4
+ name?: string;
5
+ url: Blob | string;
6
+ }
7
+ export default class OBJEntity extends Entity3D {
8
+ readonly isOBJEntity: true;
9
+ readonly source: OBJSource;
10
+ readonly type: "OBJEntity";
11
+ private readonly _context;
12
+ constructor(source: OBJSource, context: PieroContext);
13
+ static isOBJEntity: (obj: unknown) => obj is OBJEntity;
14
+ preprocess(): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=OBJEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OBJEntity.d.ts","sourceRoot":"","sources":["../../../../src/OBJEntity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AAOxD,MAAM,WAAW,SAAS;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,QAAQ;IAC3C,SAAgB,WAAW,EAAG,IAAI,CAAU;IAC5C,SAAgB,MAAM,EAAE,SAAS,CAAC;IAClC,SAAyB,IAAI,EAAG,WAAW,CAAU;IAErD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAErB,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY;IAM3D,OAAc,WAAW,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,SAAS,CACR;IAE9B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAiDpD"}
@@ -0,0 +1,18 @@
1
+ import { Module, PieroContext } from '@giro3d/piero';
2
+ import { default as z } from 'zod';
3
+ declare const OBJDataset: z.ZodObject<{
4
+ name: z.ZodString;
5
+ opacity: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
6
+ type: z.ZodString;
7
+ visible: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
8
+ attribution: z.ZodOptional<z.ZodString>;
9
+ url: z.ZodUnion<readonly [z.ZodURL, z.ZodFile]>;
10
+ }, z.core.$loose>;
11
+ export type OBJDataset = z.infer<typeof OBJDataset>;
12
+ export default class OBJLoader implements Module {
13
+ readonly id = "builtin-loader-obj";
14
+ readonly name = "OBJ";
15
+ initialize(context: PieroContext): Promise<void> | void;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=OBJLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OBJLoader.d.ts","sourceRoot":"","sources":["../../../../src/OBJLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAMzB,QAAA,MAAM,UAAU;;;;;;;iBAGd,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AA+BpD,MAAM,CAAC,OAAO,OAAO,SAAU,YAAW,MAAM;IAC5C,SAAgB,EAAE,wBAAwB;IAC1C,SAAgB,IAAI,SAAS;IAEtB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CASjE"}
@@ -0,0 +1,3 @@
1
+ import { default as OBJLoader, OBJDataset } from './OBJLoader';
2
+ export { OBJDataset, OBJLoader };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
- "name": "@giro3d/piero-plugin-obj",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@giro3d/piero-plugin-obj",
3
+ "type": "module",
4
+ "version": "1.0.0-beta.12",
5
+ "description": "Load OBJ objects in Piero",
6
+ "keywords": [
7
+ "front-end",
8
+ "web",
9
+ "obj",
10
+ "framework",
11
+ "webgl",
12
+ "webgl2",
13
+ "geography",
14
+ "gis",
15
+ "geospatial",
16
+ "3d",
17
+ "3D",
18
+ "three",
19
+ "three.js",
20
+ "openlayers",
21
+ "map",
22
+ "layer",
23
+ "visualization",
24
+ "pointcloud",
25
+ "3dtiles",
26
+ "raster",
27
+ "vector",
28
+ "geometry",
29
+ "giro3d"
30
+ ],
31
+ "types": "dist/index.d.ts",
32
+ "main": "dist/index.cjs.js",
33
+ "module": "dist/index.es.js",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.es.js",
38
+ "require": "./dist/index.cjs.js"
39
+ }
40
+ },
41
+ "files": [
42
+ "dist"
43
+ ],
44
+ "sideEffects": [
45
+ "**/*.css"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://gitlab.com/giro3d/piero.git"
50
+ },
51
+ "license": "MIT",
52
+ "bugs": {
53
+ "url": "https://gitlab.com/giro3d/piero/-/issues"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public",
57
+ "registry": "https://registry.npmjs.org/"
58
+ },
59
+ "homepage": "https://piero.giro3d.org/",
60
+ "scripts": {
61
+ "prepublishOnly": "npm run build",
62
+ "build": "vite build",
63
+ "build:dev": "vite build --mode dev",
64
+ "build:watch": "vite build --mode dev --watch",
65
+ "package": "npm run build && npm pack",
66
+ "typecheck": "tsc --noEmit"
67
+ },
68
+ "peerDependencies": {
69
+ "@giro3d/piero": "*",
70
+ "@giro3d/giro3d": "^2.0.0",
71
+ "three": "^0.180.0"
72
+ }
73
+ }