@loaders.gl/gltf 3.1.0-alpha.4 → 3.1.0-alpha.5

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 (119) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/dist.min.js +1 -1
  3. package/dist/dist.min.js.map +1 -1
  4. package/dist/es5/bundle.js +1 -1
  5. package/dist/es5/bundle.js.map +1 -1
  6. package/dist/es5/glb-loader.js +10 -33
  7. package/dist/es5/glb-loader.js.map +1 -1
  8. package/dist/es5/glb-writer.js +9 -8
  9. package/dist/es5/glb-writer.js.map +1 -1
  10. package/dist/es5/gltf-loader.js +14 -52
  11. package/dist/es5/gltf-loader.js.map +1 -1
  12. package/dist/es5/gltf-writer.js +10 -10
  13. package/dist/es5/gltf-writer.js.map +1 -1
  14. package/dist/es5/index.js +6 -6
  15. package/dist/es5/lib/api/gltf-extensions.js +18 -106
  16. package/dist/es5/lib/api/gltf-extensions.js.map +1 -1
  17. package/dist/es5/lib/api/gltf-scenegraph.js +447 -541
  18. package/dist/es5/lib/api/gltf-scenegraph.js.map +1 -1
  19. package/dist/es5/lib/api/normalize-gltf-v1.js +150 -280
  20. package/dist/es5/lib/api/normalize-gltf-v1.js.map +1 -1
  21. package/dist/es5/lib/api/post-process-gltf.js +279 -354
  22. package/dist/es5/lib/api/post-process-gltf.js.map +1 -1
  23. package/dist/es5/lib/encoders/encode-glb.js +19 -22
  24. package/dist/es5/lib/encoders/encode-glb.js.map +1 -1
  25. package/dist/es5/lib/encoders/encode-gltf.js +3 -5
  26. package/dist/es5/lib/encoders/encode-gltf.js.map +1 -1
  27. package/dist/es5/lib/extensions/EXT_meshopt_compression.js +39 -104
  28. package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +1 -1
  29. package/dist/es5/lib/extensions/EXT_texture_webp.js +12 -26
  30. package/dist/es5/lib/extensions/EXT_texture_webp.js.map +1 -1
  31. package/dist/es5/lib/extensions/KHR_binary_gltf.js +12 -26
  32. package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +1 -1
  33. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +76 -261
  34. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +1 -1
  35. package/dist/es5/lib/extensions/KHR_texture_basisu.js +12 -26
  36. package/dist/es5/lib/extensions/KHR_texture_basisu.js.map +1 -1
  37. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js +40 -104
  38. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -1
  39. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js +24 -69
  40. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -1
  41. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js +34 -90
  42. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -1
  43. package/dist/es5/lib/gltf-utils/get-typed-array.js +6 -6
  44. package/dist/es5/lib/gltf-utils/get-typed-array.js.map +1 -1
  45. package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js +19 -21
  46. package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +1 -1
  47. package/dist/es5/lib/gltf-utils/gltf-constants.js +7 -7
  48. package/dist/es5/lib/gltf-utils/gltf-constants.js.map +1 -1
  49. package/dist/es5/lib/gltf-utils/gltf-utils.js +16 -16
  50. package/dist/es5/lib/gltf-utils/gltf-utils.js.map +1 -1
  51. package/dist/es5/lib/gltf-utils/resolve-url.js +2 -2
  52. package/dist/es5/lib/gltf-utils/resolve-url.js.map +1 -1
  53. package/dist/es5/lib/parsers/parse-glb.js +34 -38
  54. package/dist/es5/lib/parsers/parse-glb.js.map +1 -1
  55. package/dist/es5/lib/parsers/parse-gltf.js +107 -249
  56. package/dist/es5/lib/parsers/parse-gltf.js.map +1 -1
  57. package/dist/es5/lib/utils/version.js +1 -1
  58. package/dist/es5/lib/utils/version.js.map +1 -1
  59. package/dist/es5/meshopt/meshopt-decoder.js +46 -197
  60. package/dist/es5/meshopt/meshopt-decoder.js.map +1 -1
  61. package/dist/es5/webp/webp.js +16 -84
  62. package/dist/es5/webp/webp.js.map +1 -1
  63. package/dist/esm/lib/api/gltf-scenegraph.js +1 -1
  64. package/dist/esm/lib/api/gltf-scenegraph.js.map +1 -1
  65. package/dist/esm/lib/api/normalize-gltf-v1.js +3 -3
  66. package/dist/esm/lib/api/normalize-gltf-v1.js.map +1 -1
  67. package/dist/esm/lib/api/post-process-gltf.js +12 -12
  68. package/dist/esm/lib/api/post-process-gltf.js.map +1 -1
  69. package/dist/esm/lib/extensions/EXT_meshopt_compression.js +1 -1
  70. package/dist/esm/lib/extensions/EXT_meshopt_compression.js.map +1 -1
  71. package/dist/esm/lib/extensions/EXT_texture_webp.js +1 -1
  72. package/dist/esm/lib/extensions/EXT_texture_webp.js.map +1 -1
  73. package/dist/esm/lib/gltf-utils/resolve-url.js +1 -1
  74. package/dist/esm/lib/gltf-utils/resolve-url.js.map +1 -1
  75. package/dist/esm/lib/parsers/parse-glb.js +2 -6
  76. package/dist/esm/lib/parsers/parse-glb.js.map +1 -1
  77. package/dist/esm/lib/parsers/parse-gltf.js +19 -2
  78. package/dist/esm/lib/parsers/parse-gltf.js.map +1 -1
  79. package/dist/esm/lib/utils/version.js +1 -1
  80. package/dist/esm/meshopt/meshopt-decoder.js +1 -1
  81. package/dist/esm/meshopt/meshopt-decoder.js.map +1 -1
  82. package/dist/esm/webp/webp.js +1 -1
  83. package/dist/esm/webp/webp.js.map +1 -1
  84. package/dist/glb-loader.d.ts +12 -0
  85. package/dist/glb-writer.d.ts +21 -0
  86. package/dist/gltf-loader.d.ts +17 -0
  87. package/dist/gltf-writer.d.ts +24 -0
  88. package/dist/index.d.ts +10 -0
  89. package/dist/lib/api/gltf-extensions.d.ts +25 -0
  90. package/dist/lib/api/gltf-scenegraph.d.ts +182 -0
  91. package/dist/lib/api/normalize-gltf-v1.d.ts +1 -0
  92. package/dist/lib/api/post-process-gltf.d.ts +1 -0
  93. package/dist/lib/encoders/encode-glb.d.ts +1 -0
  94. package/dist/lib/encoders/encode-gltf.d.ts +1 -0
  95. package/dist/lib/extensions/EXT_meshopt_compression.d.ts +9 -0
  96. package/dist/lib/extensions/EXT_texture_webp.d.ts +11 -0
  97. package/dist/lib/extensions/KHR_binary_gltf.d.ts +6 -0
  98. package/dist/lib/extensions/KHR_draco_mesh_compression.d.ts +12 -0
  99. package/dist/lib/extensions/KHR_texture_basisu.d.ts +11 -0
  100. package/dist/lib/extensions/deprecated/KHR_lights_punctual.d.ts +6 -0
  101. package/dist/lib/extensions/deprecated/KHR_materials_unlit.d.ts +6 -0
  102. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts +6 -0
  103. package/dist/lib/gltf-utils/get-typed-array.d.ts +2 -0
  104. package/dist/lib/gltf-utils/gltf-attribute-utils.d.ts +5 -0
  105. package/dist/lib/gltf-utils/gltf-constants.d.ts +3 -0
  106. package/dist/lib/gltf-utils/gltf-utils.d.ts +7 -0
  107. package/dist/lib/gltf-utils/resolve-url.d.ts +1 -0
  108. package/dist/lib/parsers/parse-glb.d.ts +7 -0
  109. package/dist/lib/parsers/parse-gltf.d.ts +13 -0
  110. package/dist/lib/types/glb-types.d.ts +16 -0
  111. package/dist/lib/types/gltf-json-schema.d.ts +719 -0
  112. package/dist/lib/types/gltf-postprocessed-schema.d.ts +684 -0
  113. package/dist/lib/types/gltf-types.d.ts +9 -0
  114. package/dist/lib/utils/assert.d.ts +1 -0
  115. package/dist/lib/utils/version.d.ts +1 -0
  116. package/dist/meshopt/meshopt-decoder.d.ts +5 -0
  117. package/dist/webp/webp.d.ts +6 -0
  118. package/package.json +11 -7
  119. package/src/lib/parsers/parse-gltf.ts +17 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/webp/webp.ts"],"names":["WEBP_TEST_IMAGES","lossy","lossless","alpha","animation","WEBP_FEATURES","isWebPSupported","features","promises","map","feature","checkWebPFeature","statuses","Promise","all","every","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ASoBAAEADsD+JaQAA3AAAAAA',\n lossless: 'UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==',\n alpha:\n 'UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==',\n animation:\n 'UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA'\n};\n\nexport type WebPFeature = 'lossy' | 'lossless' | 'alpha' | 'animation';\n\nconst WEBP_FEATURES: WebPFeature[] = ['lossy', 'lossless', 'alpha', 'animation'];\n\n/**\n * Checks if WebP is supported\n * @param features Array, can include 'lossy', 'lossless', 'alpha' or 'animation'\n */\nexport async function isWebPSupported(features: WebPFeature[] = WEBP_FEATURES): Promise<boolean> {\n const promises = features.map((feature) => checkWebPFeature(feature));\n const statuses = await Promise.all(promises);\n return statuses.every((_) => _);\n}\n\n/**\n * Checks if a specific WebP feature is supported\n * @param feature 'feature' can be one of 'lossy', 'lossless', 'alpha' or 'animation'.\n *\n * Based on Google's official recommended checks\n * @see https://developers.google.com/speed/webp/faq#how_can_i_detect_browser_support_for_webp\n */\nasync function checkWebPFeature(feature: WebPFeature): Promise<boolean> {\n if (typeof Image === 'undefined') {\n return false;\n }\n return await new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => resolve(img.width > 0 && img.height > 0);\n img.onerror = () => resolve(false);\n img.src = `data:image/webp;base64,${WEBP_TEST_IMAGES[feature]}`;\n });\n}\n"],"file":"webp.js"}
1
+ {"version":3,"sources":["../../../src/webp/webp.ts"],"names":["WEBP_TEST_IMAGES","lossy","lossless","alpha","animation","WEBP_FEATURES","isWebPSupported","features","promises","map","feature","checkWebPFeature","statuses","Promise","all","every","_","Image","resolve","reject","img","onload","width","height","onerror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hoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==',\n alpha:\n 'UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==',\n animation:\n 'UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA'\n};\n\nexport type WebPFeature = 'lossy' | 'lossless' | 'alpha' | 'animation';\n\nconst WEBP_FEATURES: WebPFeature[] = ['lossy', 'lossless', 'alpha', 'animation'];\n\n/**\n * Checks if WebP is supported\n * @param features Array, can include 'lossy', 'lossless', 'alpha' or 'animation'\n */\nexport async function isWebPSupported(features: WebPFeature[] = WEBP_FEATURES): Promise<boolean> {\n const promises = features.map((feature) => checkWebPFeature(feature));\n const statuses = await Promise.all(promises);\n return statuses.every((_) => _);\n}\n\n/**\n * Checks if a specific WebP feature is supported\n * @param feature 'feature' can be one of 'lossy', 'lossless', 'alpha' or 'animation'.\n *\n * Based on Google's official recommended checks\n * @see https://developers.google.com/speed/webp/faq#how_can_i_detect_browser_support_for_webp\n */\nasync function checkWebPFeature(feature: WebPFeature): Promise<boolean> {\n if (typeof Image === 'undefined') {\n return false;\n }\n return await new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => resolve(img.width > 0 && img.height > 0);\n img.onerror = () => resolve(false);\n img.src = `data:image/webp;base64,${WEBP_TEST_IMAGES[feature]}`;\n });\n}\n"],"file":"webp.js"}
@@ -0,0 +1,12 @@
1
+ import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
+ import type { GLBParseOptions } from './lib/parsers/parse-glb';
3
+ export declare type GLBLoaderOptions = LoaderOptions & {
4
+ glb?: GLBParseOptions;
5
+ byteOffset?: number;
6
+ };
7
+ /**
8
+ * GLB Loader -
9
+ * GLB is the binary container format for GLTF
10
+ */
11
+ export declare const GLBLoader: LoaderWithParser;
12
+ export declare const _TypecheckGLBLoader: LoaderWithParser;
@@ -0,0 +1,21 @@
1
+ import type { Writer } from '@loaders.gl/loader-utils';
2
+ /**
3
+ * GLB exporter
4
+ * GLB is the binary container format for GLTF
5
+ */
6
+ export declare const GLBWriter: {
7
+ name: string;
8
+ id: string;
9
+ module: string;
10
+ version: any;
11
+ extensions: string[];
12
+ mimeTypes: string[];
13
+ binary: boolean;
14
+ encodeSync: typeof encodeSync;
15
+ options: {
16
+ glb: {};
17
+ };
18
+ };
19
+ declare function encodeSync(glb: any, options: any): ArrayBuffer;
20
+ export declare const _TypecheckGLBLoader: Writer;
21
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
+ import type { DracoLoaderOptions } from '@loaders.gl/draco';
3
+ import type { ImageLoaderOptions } from '@loaders.gl/images';
4
+ import type { TextureLoaderOptions } from '@loaders.gl/textures';
5
+ import type { GLTFParseOptions } from './lib/parsers/parse-gltf';
6
+ import { GLBLoaderOptions } from './glb-loader';
7
+ /**
8
+ * GLTF loader options
9
+ */
10
+ export declare type GLTFLoaderOptions = LoaderOptions & ImageLoaderOptions & TextureLoaderOptions & GLBLoaderOptions & DracoLoaderOptions & {
11
+ gltf?: GLTFParseOptions;
12
+ };
13
+ /**
14
+ * GLTF loader
15
+ */
16
+ export declare const GLTFLoader: LoaderWithParser;
17
+ export declare function parse(arrayBuffer: any, options: GLTFLoaderOptions | undefined, context: any): Promise<any>;
@@ -0,0 +1,24 @@
1
+ import type { Writer } from '@loaders.gl/loader-utils';
2
+ export declare type GLTFWriterOptions = {
3
+ gltf?: {};
4
+ byteOffset?: number;
5
+ };
6
+ /**
7
+ * GLTF exporter
8
+ */
9
+ export declare const GLTFWriter: {
10
+ name: string;
11
+ id: string;
12
+ module: string;
13
+ version: any;
14
+ extensions: string[];
15
+ mimeTypes: string[];
16
+ binary: boolean;
17
+ encodeSync: typeof encodeSync;
18
+ options: {
19
+ gltf: {};
20
+ };
21
+ };
22
+ declare function encodeSync(gltf: any, options?: GLTFWriterOptions): ArrayBuffer;
23
+ export declare const _TypecheckGLBLoader: Writer;
24
+ export {};
@@ -0,0 +1,10 @@
1
+ export type { GLB } from './lib/types/glb-types';
2
+ export type { GLTF, GLTFAccessor, GLTFBuffer, GLTFBufferView, GLTFMeshPrimitive, GLTFMesh, GLTFNode, GLTFMaterial, GLTFSampler, GLTFScene, GLTFSkin, GLTFTexture, GLTFImage, GLTF_KHR_binary_glTF, GLTF_KHR_draco_mesh_compression, GLTF_KHR_texture_basisu, GLTF_EXT_meshopt_compression, GLTF_EXT_texture_webp } from './lib/types/gltf-types';
3
+ export { GLTFLoader } from './gltf-loader';
4
+ export { GLTFWriter } from './gltf-writer';
5
+ export { GLBLoader } from './glb-loader';
6
+ export { GLBWriter } from './glb-writer';
7
+ export { default as GLTFScenegraph } from './lib/api/gltf-scenegraph';
8
+ export { postProcessGLTF } from './lib/api/post-process-gltf';
9
+ export type { Mesh } from './lib/types/gltf-json-schema';
10
+ export type { GLTFObject } from './lib/types/gltf-types';
@@ -0,0 +1,25 @@
1
+ import { GLTF } from '../types/gltf-types';
2
+ import type { GLTFLoaderOptions } from '../../gltf-loader';
3
+ declare type GLTFExtensionPlugin = {
4
+ name: string;
5
+ preprocess?: (gltfData: {
6
+ json: GLTF;
7
+ }, options: GLTFLoaderOptions, context: any) => void;
8
+ decode?: (gltfData: {
9
+ json: GLTF;
10
+ }, options: GLTFLoaderOptions, context: any) => Promise<void>;
11
+ encode?: (gltfData: {
12
+ json: GLTF;
13
+ }, options: GLTFLoaderOptions) => void;
14
+ };
15
+ /**
16
+ * List of extensions processed by the GLTFLoader
17
+ * Note that may extensions can only be handled on the rendering stage and are left out here
18
+ * These are just extensions that can be handled fully or partially during loading.
19
+ */
20
+ export declare const EXTENSIONS: GLTFExtensionPlugin[];
21
+ /** Call before any resource loading starts */
22
+ export declare function preprocessExtensions(gltf: any, options?: GLTFLoaderOptions, context?: any): void;
23
+ /** Call after resource loading */
24
+ export declare function decodeExtensions(gltf: any, options?: GLTFLoaderOptions, context?: any): Promise<void>;
25
+ export {};
@@ -0,0 +1,182 @@
1
+ import type { GLTF, GLTFScene, GLTFNode, GLTFMesh, GLTFSkin, GLTFMaterial, GLTFAccessor, GLTFSampler, GLTFTexture, GLTFImage, GLTFBuffer, GLTFBufferView } from '../types/gltf-types';
2
+ declare type GLTFWithBuffers = {
3
+ json: GLTF;
4
+ buffers: any[];
5
+ binary?: ArrayBuffer;
6
+ };
7
+ declare type Extension = {
8
+ [key: string]: any;
9
+ };
10
+ /**
11
+ * Class for structured access to GLTF data
12
+ */
13
+ export default class GLTFScenegraph {
14
+ gltf: GLTFWithBuffers;
15
+ sourceBuffers: any[];
16
+ byteLength: number;
17
+ constructor(gltf?: {
18
+ json: GLTF;
19
+ buffers?: any[];
20
+ });
21
+ get json(): GLTF;
22
+ getApplicationData(key: string): {
23
+ [key: string]: any;
24
+ };
25
+ getExtraData(key: string): {
26
+ [key: string]: any;
27
+ };
28
+ getExtension<T = Extension>(extensionName: string): T | null;
29
+ getRequiredExtension<T = Extension>(extensionName: string): T | null;
30
+ getRequiredExtensions(): string[];
31
+ getUsedExtensions(): string[];
32
+ getObjectExtension<T = Extension>(object: {
33
+ [key: string]: any;
34
+ }, extensionName: string): T | null;
35
+ getScene(index: number): GLTFScene;
36
+ getNode(index: number): GLTFNode;
37
+ getSkin(index: number): GLTFSkin;
38
+ getMesh(index: number): GLTFMesh;
39
+ getMaterial(index: number): GLTFMaterial;
40
+ getAccessor(index: number): GLTFAccessor;
41
+ getTexture(index: number): GLTFTexture;
42
+ getSampler(index: number): GLTFSampler;
43
+ getImage(index: number): GLTFImage;
44
+ getBufferView(index: number | object): GLTFBufferView;
45
+ getBuffer(index: number): GLTFBuffer;
46
+ getObject(array: string, index: number | object): object;
47
+ /**
48
+ * Accepts buffer view index or buffer view object
49
+ * @returns a `Uint8Array`
50
+ */
51
+ getTypedArrayForBufferView(bufferView: number | object): Uint8Array;
52
+ /** Accepts accessor index or accessor object
53
+ * @returns a typed array with type that matches the types
54
+ */
55
+ getTypedArrayForAccessor(accessor: number | object): any;
56
+ /** accepts accessor index or accessor object
57
+ * returns a `Uint8Array`
58
+ */
59
+ getTypedArrayForImageData(image: number | object): Uint8Array;
60
+ /**
61
+ * Add an extra application-defined key to the top-level data structure
62
+ */
63
+ addApplicationData(key: string, data: object): GLTFScenegraph;
64
+ /**
65
+ * `extras` - Standard GLTF field for storing application specific data
66
+ */
67
+ addExtraData(key: string, data: object): GLTFScenegraph;
68
+ addObjectExtension(object: object, extensionName: string, data: object): GLTFScenegraph;
69
+ setObjectExtension(object: object, extensionName: string, data: object): void;
70
+ removeObjectExtension(object: object, extensionName: string): object;
71
+ /**
72
+ * Add to standard GLTF top level extension object, mark as used
73
+ */
74
+ addExtension(extensionName: string, extensionData?: object): object;
75
+ /**
76
+ * Standard GLTF top level extension object, mark as used and required
77
+ */
78
+ addRequiredExtension(extensionName: any, extensionData?: object): object;
79
+ /**
80
+ * Add extensionName to list of used extensions
81
+ */
82
+ registerUsedExtension(extensionName: string): void;
83
+ /**
84
+ * Add extensionName to list of required extensions
85
+ */
86
+ registerRequiredExtension(extensionName: string): void;
87
+ /**
88
+ * Removes an extension from the top-level list
89
+ */
90
+ removeExtension(extensionName: string): void;
91
+ /**
92
+ * Set default scene which is to be displayed at load time
93
+ */
94
+ setDefaultScene(sceneIndex: number): void;
95
+ /**
96
+ * @todo: add more properties for scene initialization:
97
+ * name`, `extensions`, `extras`
98
+ * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene
99
+ */
100
+ addScene(scene: {
101
+ nodeIndices: number[];
102
+ }): number;
103
+ /**
104
+ * @todo: add more properties for node initialization:
105
+ * `name`, `extensions`, `extras`, `camera`, `children`, `skin`, `rotation`, `scale`, `translation`, `weights`
106
+ * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#node
107
+ */
108
+ addNode(node: {
109
+ meshIndex: number;
110
+ matrix: number[];
111
+ }): number;
112
+ /** Adds a mesh to the json part */
113
+ addMesh(mesh: {
114
+ attributes: object;
115
+ indices: object;
116
+ material: number;
117
+ mode: number;
118
+ }): number;
119
+ addPointCloud(attributes: object): number;
120
+ /**
121
+ * Adds a binary image. Builds glTF "JSON metadata" and saves buffer reference
122
+ * Buffer will be copied into BIN chunk during "pack"
123
+ * Currently encodes as glTF image
124
+ * @param imageData
125
+ * @param mimeType
126
+ */
127
+ addImage(imageData: any, mimeTypeOpt?: string): number;
128
+ /**
129
+ * Add one untyped source buffer, create a matching glTF `bufferView`, and return its index
130
+ * @param buffer
131
+ */
132
+ addBufferView(buffer: any): number;
133
+ /**
134
+ * Adds an accessor to a bufferView
135
+ * @param bufferViewIndex
136
+ * @param accessor
137
+ */
138
+ addAccessor(bufferViewIndex: number, accessor: object): number;
139
+ /**
140
+ * Add a binary buffer. Builds glTF "JSON metadata" and saves buffer reference
141
+ * Buffer will be copied into BIN chunk during "pack"
142
+ * Currently encodes buffers as glTF accessors, but this could be optimized
143
+ * @param sourceBuffer
144
+ * @param accessor
145
+ */
146
+ addBinaryBuffer(sourceBuffer: any, accessor?: object): number;
147
+ /**
148
+ * Adds a texture to the json part
149
+ * @todo: add more properties for texture initialization
150
+ * `sampler`, `name`, `extensions`, `extras`
151
+ * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture
152
+ */
153
+ addTexture(texture: {
154
+ imageIndex: number;
155
+ }): number;
156
+ /** Adds a material to the json part */
157
+ addMaterial(pbrMaterialInfo: Object): number;
158
+ /** Pack the binary chunk */
159
+ createBinaryChunk(): void;
160
+ _removeStringFromArray(array: any, string: any): void;
161
+ /**
162
+ * Add attributes to buffers and create `attributes` object which is part of `mesh`
163
+ */
164
+ _addAttributes(attributes?: {}): {};
165
+ /**
166
+ * Add indices to buffers
167
+ */
168
+ _addIndices(indices: any): number;
169
+ /**
170
+ * Deduce gltf specific attribue name from input attribute name
171
+ */
172
+ _getGltfAttributeName(attributeName: any): any;
173
+ /**
174
+ * Calculate `min` and `max` arrays of accessor according to spec:
175
+ * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-accessor
176
+ */
177
+ _getAccessorMinMax(buffer: any, size: any): {
178
+ min: null;
179
+ max: null;
180
+ };
181
+ }
182
+ export {};
@@ -0,0 +1 @@
1
+ export function normalizeGLTFV1(gltf: any, options?: {}): void;
@@ -0,0 +1 @@
1
+ export function postProcessGLTF(gltf: any, options: any): any;
@@ -0,0 +1 @@
1
+ export default function encodeGLBSync(glb: any, dataView: any, byteOffset?: number, options?: {}): number;
@@ -0,0 +1 @@
1
+ export function encodeGLTFSync(gltf: any, arrayBuffer: any, byteOffset: any, options: any): number;
@@ -0,0 +1,9 @@
1
+ import type { GLTF } from '../types/gltf-types';
2
+ import type { GLTFLoaderOptions } from '../../gltf-loader';
3
+ export declare const name = "EXT_meshopt_compression";
4
+ export declare function preprocess(gltfData: {
5
+ json: GLTF;
6
+ }): void;
7
+ export declare function decode(gltfData: {
8
+ json: GLTF;
9
+ }, options: GLTFLoaderOptions): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import type { GLTF } from '../types/gltf-types';
2
+ import type { GLTFLoaderOptions } from '../../gltf-loader';
3
+ /** Extension name */
4
+ export declare const name = "EXT_texture_webp";
5
+ /**
6
+ * Replaces a texture source reference with the extension texture
7
+ * Done in preprocess() to prevent load of default image
8
+ */
9
+ export declare function preprocess(gltfData: {
10
+ json: GLTF;
11
+ }, options: GLTFLoaderOptions): void;
@@ -0,0 +1,6 @@
1
+ import type { GLTF } from '../types/gltf-types';
2
+ /** Extension name */
3
+ export declare const name = "KHR_binary_glTF";
4
+ export declare function preprocess(gltfData: {
5
+ json: GLTF;
6
+ }): void;
@@ -0,0 +1,12 @@
1
+ import type { GLTF } from '../types/gltf-types';
2
+ import type { GLTFLoaderOptions } from '../../gltf-loader';
3
+ import type { LoaderContext } from '@loaders.gl/loader-utils';
4
+ /** Extension name */
5
+ export declare const name = "KHR_draco_mesh_compression";
6
+ export declare function preprocess(gltfData: {
7
+ json: GLTF;
8
+ }, options: GLTFLoaderOptions, context: LoaderContext): void;
9
+ export declare function decode(gltfData: {
10
+ json: GLTF;
11
+ }, options: GLTFLoaderOptions, context: LoaderContext): Promise<void>;
12
+ export declare function encode(gltfData: any, options?: GLTFLoaderOptions): void;
@@ -0,0 +1,11 @@
1
+ import type { GLTF } from '../types/gltf-types';
2
+ import type { GLTFLoaderOptions } from '../../gltf-loader';
3
+ /** Extension name */
4
+ export declare const name = "KHR_texture_basisu";
5
+ /**
6
+ * Replaces a texture source reference with the extension texture
7
+ * Done in preprocess() to prevent load of default image
8
+ */
9
+ export declare function preprocess(gltfData: {
10
+ json: GLTF;
11
+ }, options: GLTFLoaderOptions): void;
@@ -0,0 +1,6 @@
1
+ import type { GLTF } from '../../types/gltf-types';
2
+ export declare const name = "KHR_lights_punctual";
3
+ export declare function decode(gltfData: {
4
+ json: GLTF;
5
+ }): Promise<void>;
6
+ export declare function encode(gltfData: any): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import type { GLTF } from '../../types/gltf-types';
2
+ export declare const name = "KHR_materials_unlit";
3
+ export declare function decode(gltfData: {
4
+ json: GLTF;
5
+ }): Promise<void>;
6
+ export declare function encode(gltfData: any): void;
@@ -0,0 +1,6 @@
1
+ import type { GLTF } from '../../types/gltf-types';
2
+ export declare const name = "KHR_techniques_webgl";
3
+ export declare function decode(gltfData: {
4
+ json: GLTF;
5
+ }): Promise<void>;
6
+ export declare function encode(gltfData: any, options: any): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare function getTypedArrayForBufferView(json: any, buffers: any, bufferViewIndex: any): Uint8Array;
2
+ export declare function getTypedArrayForImageData(json: any, buffers: any, imageIndex: any): Uint8Array;
@@ -0,0 +1,5 @@
1
+ import type { GLTFAccessor } from '../types/gltf-types';
2
+ export declare function getGLTFAccessors(attributes: any): {
3
+ [key: string]: GLTFAccessor;
4
+ };
5
+ export declare function getGLTFAccessor(attribute: any): GLTFAccessor;
@@ -0,0 +1,3 @@
1
+ export declare function getBytesFromComponentType(componentType: any): any;
2
+ export declare function getSizeFromAccessorType(type: any): any;
3
+ export declare function getGLEnumFromSamplerParameter(parameter: any): any;
@@ -0,0 +1,7 @@
1
+ export declare function getAccessorTypeFromSize(size: any): string;
2
+ export declare function getComponentTypeFromArray(typedArray: any): number;
3
+ export declare function getAccessorArrayTypeAndLength(accessor: any, bufferView: any): {
4
+ ArrayType: any;
5
+ length: number;
6
+ byteLength: number;
7
+ };
@@ -0,0 +1 @@
1
+ export declare function resolveUrl(url: any, options: any): any;
@@ -0,0 +1,7 @@
1
+ import type { GLB } from '../types/glb-types';
2
+ export declare type GLBParseOptions = {
3
+ magic?: number;
4
+ strict?: boolean;
5
+ };
6
+ export declare function isGLB(arrayBuffer: ArrayBuffer, byteOffset?: number, options?: GLBParseOptions): boolean;
7
+ export default function parseGLBSync(glb: GLB, arrayBuffer: ArrayBuffer, byteOffset?: number, options?: GLBParseOptions): number;
@@ -0,0 +1,13 @@
1
+ import type { LoaderContext } from '@loaders.gl/loader-utils';
2
+ import type { GLTFLoaderOptions } from '../../gltf-loader';
3
+ import type { GLTFWithBuffers } from '../types/gltf-types';
4
+ export declare type GLTFParseOptions = {
5
+ normalize?: boolean;
6
+ loadImages?: boolean;
7
+ loadBuffers?: boolean;
8
+ decompressMeshes?: boolean;
9
+ postProcess?: boolean;
10
+ excludeExtensions?: string[];
11
+ };
12
+ export declare function isGLTF(arrayBuffer: any, options?: any): boolean;
13
+ export declare function parseGLTF(gltf: GLTFWithBuffers, arrayBufferOrString: any, byteOffset: number | undefined, options: GLTFLoaderOptions, context: LoaderContext): Promise<any>;
@@ -0,0 +1,16 @@
1
+ export declare type GLBBinChunk = {
2
+ byteOffset: number;
3
+ byteLength: number;
4
+ arrayBuffer: ArrayBuffer;
5
+ };
6
+ export declare type GLB = {
7
+ type: string;
8
+ version: number;
9
+ header: {
10
+ byteOffset: number;
11
+ byteLength: number;
12
+ hasBinChunk: boolean;
13
+ };
14
+ json: {};
15
+ binChunks: GLBBinChunk[];
16
+ };