@threepipe/plugin-gltf-transform 0.2.1 → 0.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +23 -3
  2. package/README.md +2 -2
  3. package/dist/GLTFDracoExportPlugin.d.ts +2 -44
  4. package/dist/GLTFDracoExportPlugin.d.ts.map +1 -1
  5. package/dist/GLTFDracoExporter.d.ts +5 -40
  6. package/dist/GLTFDracoExporter.d.ts.map +1 -1
  7. package/dist/GLTFDracoExporterBase.d.ts +49 -0
  8. package/dist/GLTFDracoExporterBase.d.ts.map +1 -0
  9. package/dist/GLTFSpecGlossinessConverterPlugin.d.ts +10 -31
  10. package/dist/GLTFSpecGlossinessConverterPlugin.d.ts.map +1 -1
  11. package/dist/GLTFSpecGlossinessConverterPluginBase.d.ts +45 -0
  12. package/dist/GLTFSpecGlossinessConverterPluginBase.d.ts.map +1 -0
  13. package/dist/dependencies.txt +12 -12
  14. package/dist/index.d.ts +5 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +119 -136
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +117 -134
  19. package/dist/index.mjs.map +1 -1
  20. package/docs/assets/hierarchy.js +1 -1
  21. package/docs/assets/icons.js +1 -1
  22. package/docs/assets/icons.svg +1 -1
  23. package/docs/assets/main.js +2 -2
  24. package/docs/assets/navigation.js +1 -1
  25. package/docs/assets/search.js +1 -1
  26. package/docs/assets/style.css +3 -3
  27. package/docs/classes/GLTFDracoExportPlugin.html +7 -6
  28. package/docs/classes/GLTFDracoExporter.html +15 -14
  29. package/docs/classes/GLTFDracoExporterBase.html +37 -0
  30. package/docs/classes/GLTFSpecGlossinessConverterPlugin.html +16 -14
  31. package/docs/classes/GLTFSpecGlossinessConverterPluginBase.html +37 -0
  32. package/docs/classes/GLTFViewerConfigExtensionGP.html +5 -0
  33. package/docs/enums/EncoderMethod.html +2 -2
  34. package/docs/functions/createGenericExtensionClass.html +1 -1
  35. package/docs/functions/gltfKhrPbrSpecularGlossinessConverter.html +2 -1
  36. package/docs/functions/gltfKhrPbrSpecularGlossinessConverterBase.html +1 -0
  37. package/docs/hierarchy.html +1 -1
  38. package/docs/index.html +1 -1
  39. package/package.json +26 -3
  40. package/src/GLTFDracoExportPlugin.ts +2 -2
  41. package/src/GLTFDracoExporter.ts +10 -417
  42. package/src/GLTFDracoExporterBase.ts +427 -0
  43. package/src/GLTFSpecGlossinessConverterPlugin.ts +14 -115
  44. package/src/GLTFSpecGlossinessConverterPluginBase.ts +129 -0
  45. package/src/index.ts +3 -1
  46. package/tsconfig.json +42 -0
  47. package/docs/.nojekyll +0 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- # Changelog for @threepipe/gltf-transform
1
+ # Changelog for @threepipe/plugin-gltf-transform
2
2
 
3
3
  All notable changes to this plugin will be documented in this file.
4
4
 
@@ -10,11 +10,31 @@ All notable changes to this plugin will be documented in this file.
10
10
 
11
11
  - NA
12
12
 
13
- ## [0.2.1] - 2025-09-01
13
+ ## [0.3.0] - 2026-04-19
14
+
15
+ ### Added
16
+
17
+ - `GLTFDracoExporterBase` — base class accepting `PlatformIO`, enabling Node.js usage with `NodeIO`
18
+ - `GLTFSpecGlossinessConverterPluginBase` — base plugin class with abstract `_createIO()` for Node.js usage
19
+ - `gltfKhrPbrSpecularGlossinessConverterBase` — IO-agnostic factory function for spec-gloss conversion
20
+ - `lib/` build — unbundled ESM with externalized `@gltf-transform/*` dependencies, available via `@threepipe/plugin-gltf-transform/lib`
21
+ - `@gltf-transform/core`, `@gltf-transform/extensions` and `@gltf-transform/functions` (`^4.2.0`) as optional `peerDependencies`: install them to use `/lib`; the default bundle includes them
22
+ - `EncoderOptions` type, exported from `GLTFDracoExporterBase` (from `KHRDracoMeshCompression.setEncoderOptions`; the declarations imported `@gltf-transform/extensions/dist/...`, which that package does not export)
23
+
24
+ ### Changed
25
+
26
+ - `GLTFDracoExporter` now extends `GLTFDracoExporterBase` (no breaking change for browser users)
27
+ - `GLTFSpecGlossinessConverterPlugin` now extends `GLTFSpecGlossinessConverterPluginBase` (no breaking change for browser users)
28
+ - `EncoderOptions` imports changed to `import type` (compile-time only)
29
+ - Modernized `vite.config.js` to use shared `vite-utils.mjs` helpers
30
+
31
+ ## [0.2.2] - 2025-09-03
14
32
 
15
33
  ### Changed
16
34
 
17
35
  - Update [threepipe](https://threepipe.org/) `peerDependency` to [0.1.0](https://github.com/repalash/threepipe/releases/tag/v0.1.0)
18
36
 
19
37
  [unreleased]: https://github.com/repalash/threepipe/tree/dev/plugins/gltf-transform
20
- [0.2.1]: https://github.com/repalash/threepipe/releases/tag/@threepipe/plugin-gltf-transform-v0.2.1
38
+ [0.3.0]: https://github.com/repalash/threepipe/releases/tag/@threepipe/plugin-gltf-transform-0.3.0
39
+ [0.2.2]: https://github.com/repalash/threepipe/releases/tag/@threepipe/plugin-gltf-transform-0.2.2
40
+ [0.2.1]: https://github.com/repalash/threepipe/releases/tag/@threepipe/plugin-gltf-transform-0.2.1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @threepipe/gltf-transform
1
+ # @threepipe/plugin-gltf-transform
2
2
 
3
3
  Integration and plugin for [threepipe](https://threepipe.org/) to transform and optimize glTF assets using [gltf-transform](https://gltf-transform.dev/).
4
4
 
@@ -9,4 +9,4 @@ Integration and plugin for [threepipe](https://threepipe.org/) to transform and
9
9
  [![NPM Package](https://img.shields.io/npm/v/@threepipe/plugin-gltf-transform.svg)](https://www.npmjs.com/package/@threepipe/plugin-gltf-transform)
10
10
  [![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/license/apache-2-0/)
11
11
 
12
- **Documentation and Guides**: [threepipe.org/package/plugin-gltf-transform](https://threepipe.org/package/plugin-gltf-transform.html)
12
+ **Documentation and Guides**: [threepipe.org/package/plugin-gltf-transform](https://threepipe.org/package/plugin-gltf-transform.html)
@@ -1,5 +1,5 @@
1
1
  import { AssetExporterPlugin, AViewerPluginSync, IExporter, ThreeViewer } from 'threepipe';
2
- import { EncoderOptions } from '@gltf-transform/extensions/dist/khr-draco-mesh-compression/encoder';
2
+ import { UiObjectConfig } from 'uiconfig.js';
3
3
  import { Extension } from '@gltf-transform/core';
4
4
  export declare enum EncoderMethod {
5
5
  EDGEBREAKER = 1,
@@ -34,48 +34,6 @@ export declare class GLTFDracoExportPlugin extends AViewerPluginSync {
34
34
  protected _ctor: IExporter['ctor'];
35
35
  onAdded(viewer: ThreeViewer): void;
36
36
  onRemove(viewer: ThreeViewer): void;
37
- protected _makeUi: (exporter: AssetExporterPlugin) => ({
38
- type: string;
39
- label: string;
40
- property: (string | import('threepipe').ExportAssetOptions)[];
41
- onChange: () => void | undefined;
42
- hidden?: undefined;
43
- children?: undefined;
44
- } | {
45
- type: string;
46
- hidden: () => boolean;
47
- label: string;
48
- children: ({
49
- type: string;
50
- label: string;
51
- bounds: number[];
52
- property: (string | EncoderOptions | undefined)[];
53
- children?: undefined;
54
- } | {
55
- type: string;
56
- label: string;
57
- property: (string | EncoderOptions | undefined)[];
58
- children: {
59
- label: string;
60
- }[];
61
- bounds?: undefined;
62
- } | {
63
- type: string;
64
- label: string;
65
- children: {
66
- type: string;
67
- label: string;
68
- bounds: number[];
69
- stepSize: number;
70
- property: (string | {
71
- [key: string]: number;
72
- } | undefined)[];
73
- }[];
74
- bounds?: undefined;
75
- property?: undefined;
76
- })[];
77
- property?: undefined;
78
- onChange?: undefined;
79
- })[];
37
+ protected _makeUi: (exporter: AssetExporterPlugin) => UiObjectConfig[];
80
38
  }
81
39
  //# sourceMappingURL=GLTFDracoExportPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GLTFDracoExportPlugin.d.ts","sourceRoot":"","sources":["../src/GLTFDracoExportPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EAUjB,SAAS,EACT,WAAW,EAKd,MAAM,WAAW,CAAA;A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AI;IACf,UAAU,IAAI;CACjB;AAED;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;IACxD,gBAAuB,UAAU,2BAA0B;IAC3D,OAAO,UAAO;IAEd;;;OAGG;IACH,eAAe,EAyBV,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAC,MAAM,CAAC,GAAC,SAAS,CAAC,EAAE,CAAA;IAExD,IAAI,uBAAuB,IAAI,CAAC,OAAO,SAAS,CAAC,EAAE,CAElD;IAED,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAC,MAAM,CAAC;IAMnE;;;;;OAKG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM;IAK5B,OAAO,CAAC,aAAa,CAAC,CAA+B;IAErD,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CASjC;IAED,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IA6ClC,QAAQ,CAAC,MAAM,EAAE,WAAW;IAS5B,SAAS,CAAC,OAAO,GAAI,UAAU,mBAAmB,KAAG,cAAc,EAAE,CA2CpE;CACJ"}
@@ -1,47 +1,12 @@
1
- import { Extension, ReaderContext, WriterContext } from '@gltf-transform/core';
2
- import { EncoderOptions } from '@gltf-transform/extensions/dist/khr-draco-mesh-compression/encoder';
3
- import { DRACOLoader2, GLTFExporter2, GLTFExporter2Options, IExportWriter } from 'threepipe';
1
+ import { EncoderOptions, GLTFDracoExporterBase } from './GLTFDracoExporterBase.js';
2
+ import { DRACOLoader2 } from 'threepipe';
3
+ export { GLTFDracoExporterBase, GLTFViewerConfigExtensionGP, createGenericExtensionClass } from './GLTFDracoExporterBase.js';
4
4
  /**
5
5
  * GLTF Draco Exporter
6
6
  *
7
- * Extension of GLTFExporter2 that runs the output through gltf-transform for draco compression.
7
+ * Browser-specific extension of GLTFDracoExporterBase that uses WebIO.
8
8
  */
9
- export declare class GLTFDracoExporter extends GLTFExporter2 implements IExportWriter {
10
- loader?: DRACOLoader2;
11
- private _io;
12
- private _loadedLibs;
13
- private _encoderOptions;
9
+ export declare class GLTFDracoExporter extends GLTFDracoExporterBase {
14
10
  constructor(encoderOptions?: EncoderOptions, loader?: DRACOLoader2);
15
- preload(): this;
16
- private _loadLibs;
17
- parseAsync(obj: any, { compress, dracoOptions, ...options }: {
18
- compress: boolean;
19
- dracoOptions?: EncoderOptions;
20
- } & GLTFExporter2Options, throwOnError?: boolean): Promise<Blob>;
21
- addExtension(...extension: (typeof Extension)[]): this;
22
- createAndAddExtension(name: string, textures?: Record<string, string | number>): this;
23
- createAndAddExtensions(extensions: [string, Record<string, string | number> | undefined][]): this;
24
11
  }
25
- declare module 'threepipe' {
26
- interface GLTFExporter2Options {
27
- compress?: boolean;
28
- dracoOptions?: EncoderOptions;
29
- }
30
- }
31
- export declare class GLTFViewerConfigExtensionGP extends Extension {
32
- readonly extensionName = "WEBGI_viewer";
33
- static readonly EXTENSION_NAME = "WEBGI_viewer";
34
- private _viewerConfig;
35
- read(context: ReaderContext): this;
36
- write(context: WriterContext): this;
37
- required: boolean;
38
- }
39
- declare abstract class GenericExtension extends Extension {
40
- abstract readonly extensionName: string;
41
- textureChannels: Record<string, number>;
42
- read(context: ReaderContext): this;
43
- write(context: WriterContext): this;
44
- }
45
- export declare function createGenericExtensionClass(name: string, textures?: Record<string, string | number>): typeof GenericExtension;
46
- export {};
47
12
  //# sourceMappingURL=GLTFDracoExporter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GLTFDracoExporter.d.ts","sourceRoot":"","sources":["../src/GLTFDracoExporter.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EAMT,aAAa,EAKb,aAAa,EAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAC,cAAc,EAAC,MAAM,oEAAoE,CAAA;AAEjG,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAA6B,aAAa,E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,EAAE,aAAa,GAAG,IAAI;IA+BnC,QAAQ,UAAO;CAClB;AAuBD,uBAAe,gBAAiB,SAAQ,SAAS;IAC7C,QAAQ,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAEvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IAE5C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAkElC,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;CAqEtC;AAWD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAC,MAAM,CAAC,GAAG,OAAO,gBAAgB,CAU3H"}
1
+ {"version":3,"file":"GLTFDracoExporter.d.ts","sourceRoot":"","sources":["../src/GLTFDracoExporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAA;AACtC,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AAG7D,OAAO,EAAC,qBAAqB,EAAE,2BAA2B,EAAE,2BAA2B,EAAC,MAAM,yBAAyB,CAAA;AAEvH;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,qBAAqB;gBAC5C,cAAc,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,YAAY;CAGrE"}
@@ -0,0 +1,49 @@
1
+ import { Extension, PlatformIO, ReaderContext, WriterContext } from '@gltf-transform/core';
2
+ import { KHRDracoMeshCompression } from '@gltf-transform/extensions';
3
+ import { DRACOLoader2, GLTFExporter2, GLTFExporter2Options, IExportWriter } from 'threepipe';
4
+ export type EncoderOptions = Parameters<KHRDracoMeshCompression['setEncoderOptions']>[0];
5
+ /**
6
+ * GLTF Draco Exporter Base
7
+ *
8
+ * Extension of GLTFExporter2 that runs the output through gltf-transform for draco compression.
9
+ * Takes a PlatformIO instance as a constructor parameter, allowing use with both WebIO (browser) and NodeIO (Node.js).
10
+ */
11
+ export declare class GLTFDracoExporterBase extends GLTFExporter2 implements IExportWriter {
12
+ loader?: DRACOLoader2;
13
+ protected _io: PlatformIO;
14
+ private _loadedLibs;
15
+ private _encoderOptions;
16
+ constructor(io: PlatformIO, encoderOptions?: EncoderOptions, loader?: DRACOLoader2);
17
+ preload(): this;
18
+ private _loadLibs;
19
+ parseAsync(obj: any, { compress, dracoOptions, ...options }: {
20
+ compress: boolean;
21
+ dracoOptions?: EncoderOptions;
22
+ } & GLTFExporter2Options, throwOnError?: boolean): Promise<Blob>;
23
+ addExtension(...extension: (typeof Extension)[]): this;
24
+ createAndAddExtension(name: string, textures?: Record<string, string | number>): this;
25
+ createAndAddExtensions(extensions: [string, Record<string, string | number> | undefined][]): this;
26
+ }
27
+ declare module 'threepipe' {
28
+ interface GLTFExporter2Options {
29
+ compress?: boolean;
30
+ dracoOptions?: EncoderOptions;
31
+ }
32
+ }
33
+ export declare class GLTFViewerConfigExtensionGP extends Extension {
34
+ readonly extensionName = "WEBGI_viewer";
35
+ static readonly EXTENSION_NAME = "WEBGI_viewer";
36
+ private _viewerConfig;
37
+ read(context: ReaderContext): this;
38
+ write(context: WriterContext): this;
39
+ required: boolean;
40
+ }
41
+ declare abstract class GenericExtension extends Extension {
42
+ abstract readonly extensionName: string;
43
+ textureChannels: Record<string, number>;
44
+ read(context: ReaderContext): this;
45
+ write(context: WriterContext): this;
46
+ }
47
+ export declare function createGenericExtensionClass(name: string, textures?: Record<string, string | number>): typeof GenericExtension;
48
+ export {};
49
+ //# sourceMappingURL=GLTFDracoExporterBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GLTFDracoExporterBase.d.ts","sourceRoot":"","sources":["../src/GLTFDracoExporterBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EAIT,UAAU,EAGV,aAAa,EAIb,aAAa,EAChB,MAAM,sBAAsB,C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,EAAE,OAAO,CAAA;QAClB,YAAY,CAAC,EAAE,cAAc,CAAA;KAChC;CACJ;AAYD,qBAAa,2BAA4B,SAAQ,SAAS;IACtD,SAAgB,aAAa,kBAAsD;IACnF,gBAAuB,cAAc,kBAAsD;IAC3F,OAAO,CAAC,aAAa,CAAU;IAG/B,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IA2ClC,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IA+BnC,QAAQ,UAAO;CAClB;AAuBD,uBAAe,gBAAiB,SAAQ,SAAS;IAC7C,QAAQ,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAEvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IAE5C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAkElC,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;CAqEtC;AAWD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAC,MAAM,CAAC,GAAG,OAAO,gBAAgB,CAU3H"}
@@ -1,43 +1,22 @@
1
- import { AViewerPluginSync, GLTFParser, ThreeViewer } from 'threepipe';
2
- import { Extension } from '@gltf-transform/core';
1
+ import { PlatformIO } from '@gltf-transform/core';
2
+ import { GLTFSpecGlossinessConverterPluginBase } from './GLTFSpecGlossinessConverterPluginBase.js';
3
+ export { GLTFSpecGlossinessConverterPluginBase, gltfKhrPbrSpecularGlossinessConverterBase } from './GLTFSpecGlossinessConverterPluginBase.js';
3
4
  /**
4
5
  * GLTFSpecGlossinessConverterPlugin
5
6
  *
6
- * Plugin that adds a gltf loader extension that automatically converts GLTF files with specular glossiness materials ([KHR_materials_pbrSpecularGlossiness](https://kcoley.github.io/glTF/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/)) to metallic roughness during import.
7
+ * Browser-specific plugin that uses WebIO for spec-gloss to metal-rough conversion.
7
8
  *
8
9
  * To use this plugin, simply add it to the viewer and import a file with specular glossiness materials.
9
10
  * If `confirm` is set to true, a confirmation dialog will be shown before the conversion.
10
11
  */
11
- export declare class GLTFSpecGlossinessConverterPlugin extends AViewerPluginSync {
12
- enabled: boolean;
13
- static readonly PluginType = "GLTFSpecGlossinessConverterPlugin";
14
- toJSON: any;
15
- /**
16
- * Whether to show the confirmation dialog when loading a GLTF file with specular glossiness materials.
17
- * If set to false, the conversion will be done automatically without confirmation.
18
- * To disable the conversion entirely, disable the plugin.
19
- */
20
- confirm: boolean;
21
- /**
22
- * The message to show in the confirmation dialog when loading a GLTF file with specular glossiness materials.
23
- */
24
- confirmMessage: string;
25
- private _loaderCreate;
26
- constructor();
27
- onAdded(v: ThreeViewer): void;
28
- onRemove(v: ThreeViewer): void;
12
+ export declare class GLTFSpecGlossinessConverterPlugin extends GLTFSpecGlossinessConverterPluginBase {
13
+ protected _createIO(): PlatformIO;
29
14
  }
30
- export declare const gltfKhrPbrSpecularGlossinessConverter: (confirm?: (s: string) => Promise<boolean>, extensions?: (typeof Extension)[]) => (parser: GLTFParser) => {
15
+ /**
16
+ * @deprecated Use {@link gltfKhrPbrSpecularGlossinessConverterBase} with an IO factory instead.
17
+ */
18
+ export declare const gltfKhrPbrSpecularGlossinessConverter: (confirm?: (s: string) => Promise<boolean>, extensions?: (typeof import('@gltf-transform/core').Extension)[]) => (parser: import('threepipe').GLTFParser) => {
31
19
  name: string;
32
20
  beforeRoot: () => Promise<void>;
33
21
  };
34
- declare module 'threepipe' {
35
- interface ImportAddOptions {
36
- /**
37
- * Whether to confirm the conversion of specular glossiness materials to metallic roughness.
38
- * @default true
39
- */
40
- confirmSpecGlossConversion?: boolean;
41
- }
42
- }
43
22
  //# sourceMappingURL=GLTFSpecGlossinessConverterPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GLTFSpecGlossinessConverterPlugin.d.ts","sourceRoot":"","sources":["../src/GLTFSpecGlossinessConverterPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAkD,UAAU,EAAE,WAAW,EAAC,MAAM,WAAW,CAAA;AACpH,OAAO,EAAC,SAAS,EAAQ,MAAM,sBAAsB,CAAA;AAKrD;;;;;;;GAOG;AACH,qBAAa,iCAAkC,SAAQ,iBAAiB;IACpE,OAAO,UAAO;IAEd,MAAM,CAAC,QAAQ,CAAC,UAAU,uCAAsC;IAChE,MAAM,EAAE,GAAG,CAAY;IAIvB;;;;OAIG;IACH,OAAO,UAAO;IACd;;OAEG;IACH,cAAc,SAA8H;IAE5I,OAAO,CAAC,aAAa;;IAerB,OAAO,CAAC,CAAC,EAAE,WAAW;IAKtB,QAAQ,CAAC,CAAC,EAAE,WAAW;CAI1B;AAGD,eAAO,MAAM,qCAAqC,GAAI,UAAU,CAAC,CAAC,EAAE,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,OAAO,SAAS,CAAC,EAAE,MAAI,QAAQ,UAAU;;;CAuDpJ,CAAA;AAEF,OAAO,QAAQ,WAAW,CAAA;IACtB,UAAU,gBAAgB;QACtB;;;WAGG;QACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;KACvC;CACJ"}
1
+ {"version":3,"file":"GLTFSpecGlossinessConverterPlugin.d.ts","sourceRoot":"","sources":["../src/GLTFSpecGlossinessConverterPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAQ,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAC,qCAAqC,EAA4C,MAAM,yCAAyC,CAAA;AAGxI,OAAO,EAAC,qCAAqC,EAAE,yCAAyC,EAAC,MAAM,yCAAyC,CAAA;AAExI;;;;;;;GAOG;AACH,qBAAa,iCAAkC,SAAQ,qCAAqC;IACxF,SAAS,CAAC,SAAS,IAAI,UAAU;CAGpC;AAED;;GAEG;AACH,eAAO,MAAM,qCAAqC,GAAI,UAAU,CAAC,CAAC,EAAE,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,cAAc,sBAAsB,EAAE,SAAS,CAAC,EAAE;;;CAC1E,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { AViewerPluginSync, GLTFParser, ThreeViewer } from 'threepipe';
2
+ import { Extension, PlatformIO } from '@gltf-transform/core';
3
+ /**
4
+ * GLTFSpecGlossinessConverterPluginBase
5
+ *
6
+ * Base plugin that adds a gltf loader extension that automatically converts GLTF files with specular glossiness materials
7
+ * ([KHR_materials_pbrSpecularGlossiness](https://kcoley.github.io/glTF/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness/))
8
+ * to metallic roughness during import.
9
+ *
10
+ * Takes an IO factory function to create PlatformIO instances, allowing use with both WebIO (browser) and NodeIO (Node.js).
11
+ */
12
+ export declare abstract class GLTFSpecGlossinessConverterPluginBase extends AViewerPluginSync {
13
+ enabled: boolean;
14
+ static readonly PluginType = "GLTFSpecGlossinessConverterPlugin";
15
+ toJSON: any;
16
+ /**
17
+ * Whether to show the confirmation dialog when loading a GLTF file with specular glossiness materials.
18
+ * If set to false, the conversion will be done automatically without confirmation.
19
+ * To disable the conversion entirely, disable the plugin.
20
+ */
21
+ confirm: boolean;
22
+ /**
23
+ * The message to show in the confirmation dialog when loading a GLTF file with specular glossiness materials.
24
+ */
25
+ confirmMessage: string;
26
+ protected abstract _createIO(): PlatformIO;
27
+ private _loaderCreate;
28
+ constructor();
29
+ onAdded(v: ThreeViewer): void;
30
+ onRemove(v: ThreeViewer): void;
31
+ }
32
+ export declare const gltfKhrPbrSpecularGlossinessConverterBase: (ioFactory: () => PlatformIO, confirm?: (s: string) => Promise<boolean>, extensions?: (typeof Extension)[]) => (parser: GLTFParser) => {
33
+ name: string;
34
+ beforeRoot: () => Promise<void>;
35
+ };
36
+ declare module 'threepipe' {
37
+ interface ImportAddOptions {
38
+ /**
39
+ * Whether to confirm the conversion of specular glossiness materials to metallic roughness.
40
+ * @default true
41
+ */
42
+ confirmSpecGlossConversion?: boolean;
43
+ }
44
+ }
45
+ //# sourceMappingURL=GLTFSpecGlossinessConverterPluginBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GLTFSpecGlossinessConverterPluginBase.d.ts","sourceRoot":"","sources":["../src/GLTFSpecGlossinessConverterPluginBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAkD,UAAU,EAAE,WAAW,EAAC,MAAM,WAAW,CAAA;AACpH,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAA;AAK1D;;;;;;;;GAQG;AACH,8BAAsB,qCAAsC,SAAQ,iBAAiB;IACjF,OAAO,UAAO;IAEd,MAAM,CAAC,QAAQ,CAAC,UAAU,uCAAsC;IAChE,MAAM,EAAE,GAAG,CAAY;IAIvB;;;;OAIG;IACH,OAAO,UAAO;IACd;;OAEG;IACH,cAAc,SAA8H;IAE5I,SAAS,CAAC,QAAQ,CAAC,SAAS,IAAI,UAAU;IAE1C,OAAO,CAAC,aAAa;;IAerB,OAAO,CAAC,CAAC,EAAE,WAAW;IAKtB,QAAQ,CAAC,CAAC,EAAE,WAAW;CAI1B;AAGD,eAAO,MAAM,yCAAyC,GAAI,WAAW,MAAM,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,OAAO,SAAS,CAAC,EAAE,MAAI,QAAQ,UAAU;;;CAuDrL,CAAA;AAEF,OAAO,QAAQ,WAAW,CAAA;IACtB,UAAU,gBAAgB;QACtB;;;WAGG;QACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;KACvC;CACJ"}
@@ -5,7 +5,7 @@ Private: false
5
5
  Description: Base for creating objects that behave like a Property Graph.
6
6
  Repository: undefined
7
7
  Author: Don McCurdy <dm@donmccurdy.com>
8
- License Copyright:
8
+ License Text:
9
9
  ===
10
10
 
11
11
  The MIT License (MIT)
@@ -40,7 +40,7 @@ Description: glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.
40
40
  Repository: undefined
41
41
  Homepage: https://gltf-transform.dev/
42
42
  Author: Don McCurdy <dm@donmccurdy.com>
43
- License Copyright:
43
+ License Text:
44
44
  ===
45
45
 
46
46
  The MIT License (MIT)
@@ -74,7 +74,7 @@ Private: false
74
74
  Description: KTX 2.0 (.ktx2) parser and serializer.
75
75
  Repository: undefined
76
76
  Author: Don McCurdy <dm@donmccurdy.com>
77
- License Copyright:
77
+ License Text:
78
78
  ===
79
79
 
80
80
  The MIT License (MIT)
@@ -109,7 +109,7 @@ Description: Adds extension support to @gltf-transform/core
109
109
  Repository: undefined
110
110
  Homepage: https://gltf-transform.dev/extensions.html
111
111
  Author: Don McCurdy <dm@donmccurdy.com>
112
- License Copyright:
112
+ License Text:
113
113
  ===
114
114
 
115
115
  The MIT License (MIT)
@@ -143,7 +143,7 @@ Private: false
143
143
  Description: Generates an array of consecutive integers starting at 0
144
144
  Repository: git://github.com/mikolalysenko/iota-array.git
145
145
  Author: Mikola Lysenko
146
- License Copyright:
146
+ License Text:
147
147
  ===
148
148
 
149
149
 
@@ -178,7 +178,7 @@ Private: false
178
178
  Description: Determine if an object is a Buffer
179
179
  Repository: git://github.com/feross/is-buffer.git
180
180
  Author: Feross Aboukhadijeh <feross@feross.org> (http://feross.org/)
181
- License Copyright:
181
+ License Text:
182
182
  ===
183
183
 
184
184
  The MIT License (MIT)
@@ -212,7 +212,7 @@ Private: false
212
212
  Description: Multidimensional Arrays
213
213
  Repository: git://github.com/mikolalysenko/ndarray.git
214
214
  Author: Mikola Lysenko
215
- License Copyright:
215
+ License Text:
216
216
  ===
217
217
 
218
218
 
@@ -247,7 +247,7 @@ Private: false
247
247
  Description: Common operations for ndarray arrays
248
248
  Repository: git://github.com/mikolalysenko/ndarray-ops.git
249
249
  Author: Mikola Lysenko
250
- License Copyright:
250
+ License Text:
251
251
  ===
252
252
 
253
253
 
@@ -282,7 +282,7 @@ Private: false
282
282
  Description: Removes duplicates from a sorted array in place
283
283
  Repository: git://github.com/mikolalysenko/uniq.git
284
284
  Author: Mikola Lysenko
285
- License Copyright:
285
+ License Text:
286
286
  ===
287
287
 
288
288
 
@@ -319,7 +319,7 @@ Repository: git://github.com/scijs/cwise-compiler.git
319
319
  Author: Mikola Lysenko
320
320
  Contributors:
321
321
  Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
322
- License Copyright:
322
+ License Text:
323
323
  ===
324
324
 
325
325
 
@@ -354,7 +354,7 @@ Private: false
354
354
  Description: ndarray-pixels
355
355
  Repository: undefined
356
356
  Author: Don McCurdy <dm@donmccurdy.com>
357
- License Copyright:
357
+ License Text:
358
358
  ===
359
359
 
360
360
  The MIT License (MIT)
@@ -389,7 +389,7 @@ Description: Functions for common glTF modifications, written using the core API
389
389
  Repository: undefined
390
390
  Homepage: https://gltf-transform.dev/functions.html
391
391
  Author: Don McCurdy <dm@donmccurdy.com>
392
- License Copyright:
392
+ License Text:
393
393
  ===
394
394
 
395
395
  The MIT License (MIT)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- export { GLTFDracoExporter, createGenericExtensionClass } from './GLTFDracoExporter';
2
- export { GLTFDracoExportPlugin, EncoderMethod } from './GLTFDracoExportPlugin';
3
- export { GLTFSpecGlossinessConverterPlugin, gltfKhrPbrSpecularGlossinessConverter } from './GLTFSpecGlossinessConverterPlugin';
1
+ export { GLTFDracoExporterBase, GLTFViewerConfigExtensionGP, createGenericExtensionClass } from './GLTFDracoExporterBase.js';
2
+ export { GLTFDracoExporter } from './GLTFDracoExporter.js';
3
+ export { GLTFDracoExportPlugin, EncoderMethod } from './GLTFDracoExportPlugin.js';
4
+ export { GLTFSpecGlossinessConverterPluginBase, gltfKhrPbrSpecularGlossinessConverterBase } from './GLTFSpecGlossinessConverterPluginBase.js';
5
+ export { GLTFSpecGlossinessConverterPlugin, gltfKhrPbrSpecularGlossinessConverter } from './GLTFSpecGlossinessConverterPlugin.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAC,qBAAqB,EAAE,aAAa,EAAC,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAC,iCAAiC,EAAE,qCAAqC,EAAC,MAAM,qCAAqC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,2BAA2B,EAAE,2BAA2B,EAAC,MAAM,yBAAyB,CAAA;AACvH,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAC,qBAAqB,EAAE,aAAa,EAAC,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAC,qCAAqC,EAAE,yCAAyC,EAAC,MAAM,yCAAyC,CAAA;AACxI,OAAO,EAAC,iCAAiC,EAAE,qCAAqC,EAAC,MAAM,qCAAqC,CAAA"}