@loaders.gl/gltf 3.4.11 → 3.4.13
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/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/package.json +6 -6
- package/dist/bundle.js +0 -5
- package/dist/glb-loader.js +0 -39
- package/dist/glb-writer.js +0 -37
- package/dist/gltf-loader.js +0 -50
- package/dist/gltf-writer.js +0 -32
- package/dist/index.js +0 -23
- package/dist/lib/api/gltf-extensions.js +0 -83
- package/dist/lib/api/gltf-scenegraph.js +0 -566
- package/dist/lib/api/normalize-gltf-v1.js +0 -299
- package/dist/lib/api/post-process-gltf.js +0 -370
- package/dist/lib/encoders/encode-glb.js +0 -61
- package/dist/lib/encoders/encode-gltf.js +0 -27
- package/dist/lib/extensions/EXT_meshopt_compression.js +0 -45
- package/dist/lib/extensions/EXT_texture_webp.js +0 -39
- package/dist/lib/extensions/KHR_binary_gltf.js +0 -42
- package/dist/lib/extensions/KHR_draco_mesh_compression.js +0 -141
- package/dist/lib/extensions/KHR_texture_basisu.js +0 -32
- package/dist/lib/extensions/KHR_texture_transform.js +0 -230
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +0 -118
- package/dist/lib/extensions/deprecated/KHR_lights_punctual.js +0 -62
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +0 -47
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +0 -82
- package/dist/lib/gltf-utils/get-typed-array.js +0 -41
- package/dist/lib/gltf-utils/gltf-attribute-utils.js +0 -73
- package/dist/lib/gltf-utils/gltf-constants.js +0 -43
- package/dist/lib/gltf-utils/gltf-utils.js +0 -85
- package/dist/lib/gltf-utils/resolve-url.js +0 -18
- package/dist/lib/parsers/parse-glb.js +0 -141
- package/dist/lib/parsers/parse-gltf.js +0 -203
- package/dist/lib/types/glb-types.js +0 -2
- package/dist/lib/types/gltf-json-schema.js +0 -4
- package/dist/lib/types/gltf-postprocessed-schema.js +0 -4
- package/dist/lib/types/gltf-types.js +0 -3
- package/dist/lib/utils/assert.js +0 -12
- package/dist/lib/utils/version.js +0 -7
- package/dist/meshopt/meshopt-decoder.js +0 -118
- package/dist/webp/webp.js +0 -38
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VERSION = void 0;
|
|
7
|
-
var VERSION = typeof "3.4.
|
|
7
|
+
var VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
|
|
8
8
|
exports.VERSION = VERSION;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = typeof "3.4.
|
|
1
|
+
export const VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/gltf",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.13",
|
|
4
4
|
"description": "Framework-independent loader for the glTF format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@loaders.gl/draco": "3.4.
|
|
38
|
-
"@loaders.gl/images": "3.4.
|
|
39
|
-
"@loaders.gl/loader-utils": "3.4.
|
|
40
|
-
"@loaders.gl/textures": "3.4.
|
|
37
|
+
"@loaders.gl/draco": "3.4.13",
|
|
38
|
+
"@loaders.gl/images": "3.4.13",
|
|
39
|
+
"@loaders.gl/loader-utils": "3.4.13",
|
|
40
|
+
"@loaders.gl/textures": "3.4.13",
|
|
41
41
|
"@math.gl/core": "^3.5.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "be8849c02972ce541e01720d29b976f830d6af92"
|
|
44
44
|
}
|
package/dist/bundle.js
DELETED
package/dist/glb-loader.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports._TypecheckGLBLoader = exports.GLBLoader = void 0;
|
|
7
|
-
const version_1 = require("./lib/utils/version");
|
|
8
|
-
const parse_glb_1 = __importDefault(require("./lib/parsers/parse-glb"));
|
|
9
|
-
/**
|
|
10
|
-
* GLB Loader -
|
|
11
|
-
* GLB is the binary container format for GLTF
|
|
12
|
-
*/
|
|
13
|
-
exports.GLBLoader = {
|
|
14
|
-
name: 'GLB',
|
|
15
|
-
id: 'glb',
|
|
16
|
-
module: 'gltf',
|
|
17
|
-
version: version_1.VERSION,
|
|
18
|
-
extensions: ['glb'],
|
|
19
|
-
mimeTypes: ['model/gltf-binary'],
|
|
20
|
-
binary: true,
|
|
21
|
-
parse,
|
|
22
|
-
parseSync,
|
|
23
|
-
options: {
|
|
24
|
-
glb: {
|
|
25
|
-
strict: false // Enables deprecated XVIZ support (illegal CHUNK formats)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
async function parse(arrayBuffer, options) {
|
|
30
|
-
return parseSync(arrayBuffer, options);
|
|
31
|
-
}
|
|
32
|
-
function parseSync(arrayBuffer, options) {
|
|
33
|
-
const { byteOffset = 0 } = options || {};
|
|
34
|
-
const glb = {};
|
|
35
|
-
(0, parse_glb_1.default)(glb, arrayBuffer, byteOffset, options?.glb);
|
|
36
|
-
return glb;
|
|
37
|
-
}
|
|
38
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
39
|
-
exports._TypecheckGLBLoader = exports.GLBLoader;
|
package/dist/glb-writer.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports._TypecheckGLBLoader = exports.GLBWriter = void 0;
|
|
7
|
-
const version_1 = require("./lib/utils/version");
|
|
8
|
-
const encode_glb_1 = __importDefault(require("./lib/encoders/encode-glb"));
|
|
9
|
-
/**
|
|
10
|
-
* GLB exporter
|
|
11
|
-
* GLB is the binary container format for GLTF
|
|
12
|
-
*/
|
|
13
|
-
exports.GLBWriter = {
|
|
14
|
-
name: 'GLB',
|
|
15
|
-
id: 'glb',
|
|
16
|
-
module: 'gltf',
|
|
17
|
-
version: version_1.VERSION,
|
|
18
|
-
extensions: ['glb'],
|
|
19
|
-
mimeTypes: ['model/gltf-binary'],
|
|
20
|
-
binary: true,
|
|
21
|
-
encodeSync,
|
|
22
|
-
options: {
|
|
23
|
-
glb: {}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
function encodeSync(glb, options) {
|
|
27
|
-
const { byteOffset = 0 } = options;
|
|
28
|
-
// Calculate length and allocate buffer
|
|
29
|
-
const byteLength = (0, encode_glb_1.default)(glb, null, byteOffset, options);
|
|
30
|
-
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
31
|
-
// Encode into buffer
|
|
32
|
-
const dataView = new DataView(arrayBuffer);
|
|
33
|
-
(0, encode_glb_1.default)(glb, dataView, byteOffset, options);
|
|
34
|
-
return arrayBuffer;
|
|
35
|
-
}
|
|
36
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
37
|
-
exports._TypecheckGLBLoader = exports.GLBWriter;
|
package/dist/gltf-loader.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parse = exports.GLTFLoader = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
const parse_gltf_1 = require("./lib/parsers/parse-gltf");
|
|
6
|
-
/**
|
|
7
|
-
* GLTF loader
|
|
8
|
-
*/
|
|
9
|
-
exports.GLTFLoader = {
|
|
10
|
-
name: 'glTF',
|
|
11
|
-
id: 'gltf',
|
|
12
|
-
module: 'gltf',
|
|
13
|
-
version: version_1.VERSION,
|
|
14
|
-
extensions: ['gltf', 'glb'],
|
|
15
|
-
mimeTypes: ['model/gltf+json', 'model/gltf-binary'],
|
|
16
|
-
text: true,
|
|
17
|
-
binary: true,
|
|
18
|
-
tests: ['glTF'],
|
|
19
|
-
parse,
|
|
20
|
-
options: {
|
|
21
|
-
gltf: {
|
|
22
|
-
normalize: true,
|
|
23
|
-
loadBuffers: true,
|
|
24
|
-
loadImages: true,
|
|
25
|
-
decompressMeshes: true,
|
|
26
|
-
postProcess: true // Postprocess glTF and return json structure directly
|
|
27
|
-
},
|
|
28
|
-
// common?
|
|
29
|
-
log: console // eslint-disable-line
|
|
30
|
-
},
|
|
31
|
-
deprecatedOptions: {
|
|
32
|
-
fetchImages: 'gltf.loadImages',
|
|
33
|
-
createImages: 'gltf.loadImages',
|
|
34
|
-
decompress: 'gltf.decompressMeshes',
|
|
35
|
-
postProcess: 'gltf.postProcess',
|
|
36
|
-
gltf: {
|
|
37
|
-
decompress: 'gltf.decompressMeshes'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
async function parse(arrayBuffer, options = {}, context) {
|
|
42
|
-
// Apps can call the parse method directly, we so apply default options here
|
|
43
|
-
options = { ...exports.GLTFLoader.options, ...options };
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
options.gltf = { ...exports.GLTFLoader.options.gltf, ...options.gltf };
|
|
46
|
-
const { byteOffset = 0 } = options;
|
|
47
|
-
const gltf = {};
|
|
48
|
-
return await (0, parse_gltf_1.parseGLTF)(gltf, arrayBuffer, byteOffset, options, context);
|
|
49
|
-
}
|
|
50
|
-
exports.parse = parse;
|
package/dist/gltf-writer.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._TypecheckGLBLoader = exports.GLTFWriter = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
const encode_gltf_1 = require("./lib/encoders/encode-gltf");
|
|
6
|
-
/**
|
|
7
|
-
* GLTF exporter
|
|
8
|
-
*/
|
|
9
|
-
exports.GLTFWriter = {
|
|
10
|
-
name: 'glTF',
|
|
11
|
-
id: 'gltf',
|
|
12
|
-
module: 'gltf',
|
|
13
|
-
version: version_1.VERSION,
|
|
14
|
-
extensions: ['glb'],
|
|
15
|
-
mimeTypes: ['model/gltf-binary'],
|
|
16
|
-
binary: true,
|
|
17
|
-
encodeSync,
|
|
18
|
-
options: {
|
|
19
|
-
gltf: {}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
function encodeSync(gltf, options = {}) {
|
|
23
|
-
const { byteOffset = 0 } = options;
|
|
24
|
-
// Calculate length, then create arraybuffer and encode
|
|
25
|
-
const byteLength = (0, encode_gltf_1.encodeGLTFSync)(gltf, null, byteOffset, options);
|
|
26
|
-
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
27
|
-
const dataView = new DataView(arrayBuffer);
|
|
28
|
-
(0, encode_gltf_1.encodeGLTFSync)(gltf, dataView, byteOffset, options);
|
|
29
|
-
return arrayBuffer;
|
|
30
|
-
}
|
|
31
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
32
|
-
exports._TypecheckGLBLoader = exports.GLTFWriter;
|
package/dist/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports._getMemoryUsageGLTF = exports.postProcessGLTF = exports.GLTFScenegraph = exports.GLBWriter = exports.GLBLoader = exports.GLTFWriter = exports.GLTFLoader = void 0;
|
|
7
|
-
// glTF loader/writer definition objects
|
|
8
|
-
var gltf_loader_1 = require("./gltf-loader");
|
|
9
|
-
Object.defineProperty(exports, "GLTFLoader", { enumerable: true, get: function () { return gltf_loader_1.GLTFLoader; } });
|
|
10
|
-
var gltf_writer_1 = require("./gltf-writer");
|
|
11
|
-
Object.defineProperty(exports, "GLTFWriter", { enumerable: true, get: function () { return gltf_writer_1.GLTFWriter; } });
|
|
12
|
-
// GLB Loader & Writer (for custom formats that want to leverage the GLB binary "envelope")
|
|
13
|
-
var glb_loader_1 = require("./glb-loader");
|
|
14
|
-
Object.defineProperty(exports, "GLBLoader", { enumerable: true, get: function () { return glb_loader_1.GLBLoader; } });
|
|
15
|
-
var glb_writer_1 = require("./glb-writer");
|
|
16
|
-
Object.defineProperty(exports, "GLBWriter", { enumerable: true, get: function () { return glb_writer_1.GLBWriter; } });
|
|
17
|
-
// glTF Data Access Helper Class
|
|
18
|
-
var gltf_scenegraph_1 = require("./lib/api/gltf-scenegraph");
|
|
19
|
-
Object.defineProperty(exports, "GLTFScenegraph", { enumerable: true, get: function () { return __importDefault(gltf_scenegraph_1).default; } });
|
|
20
|
-
var post_process_gltf_1 = require("./lib/api/post-process-gltf");
|
|
21
|
-
Object.defineProperty(exports, "postProcessGLTF", { enumerable: true, get: function () { return post_process_gltf_1.postProcessGLTF; } });
|
|
22
|
-
var gltf_utils_1 = require("./lib/gltf-utils/gltf-utils");
|
|
23
|
-
Object.defineProperty(exports, "_getMemoryUsageGLTF", { enumerable: true, get: function () { return gltf_utils_1.getMemoryUsageGLTF; } });
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.decodeExtensions = exports.preprocessExtensions = exports.EXTENSIONS = void 0;
|
|
27
|
-
// GLTF 1.0 extensions (decode only)
|
|
28
|
-
// import * as KHR_binary_gltf from './KHR_draco_mesh_compression';
|
|
29
|
-
// GLTF 2.0 Khronos extensions (decode/encode)
|
|
30
|
-
const EXT_meshopt_compression = __importStar(require("../extensions/EXT_meshopt_compression"));
|
|
31
|
-
const EXT_texture_webp = __importStar(require("../extensions/EXT_texture_webp"));
|
|
32
|
-
const KHR_texture_basisu = __importStar(require("../extensions/KHR_texture_basisu"));
|
|
33
|
-
const KHR_draco_mesh_compression = __importStar(require("../extensions/KHR_draco_mesh_compression"));
|
|
34
|
-
const KHR_texture_transform = __importStar(require("../extensions/KHR_texture_transform"));
|
|
35
|
-
// Deprecated. These should be handled by rendering library (e.g. luma.gl), not the loader.
|
|
36
|
-
const KHR_lights_punctual = __importStar(require("../extensions/deprecated/KHR_lights_punctual"));
|
|
37
|
-
const KHR_materials_unlit = __importStar(require("../extensions/deprecated/KHR_materials_unlit"));
|
|
38
|
-
const KHR_techniques_webgl = __importStar(require("../extensions/deprecated/KHR_techniques_webgl"));
|
|
39
|
-
const EXT_feature_metadata = __importStar(require("../extensions/deprecated/EXT_feature_metadata"));
|
|
40
|
-
/**
|
|
41
|
-
* List of extensions processed by the GLTFLoader
|
|
42
|
-
* Note that may extensions can only be handled on the rendering stage and are left out here
|
|
43
|
-
* These are just extensions that can be handled fully or partially during loading.
|
|
44
|
-
*/
|
|
45
|
-
exports.EXTENSIONS = [
|
|
46
|
-
// 1.0
|
|
47
|
-
// KHR_binary_gltf is handled separately - must be processed before other parsing starts
|
|
48
|
-
// KHR_binary_gltf,
|
|
49
|
-
// 2.0
|
|
50
|
-
EXT_meshopt_compression,
|
|
51
|
-
EXT_texture_webp,
|
|
52
|
-
// Basisu should come after webp, we want basisu to be preferred if both are provided
|
|
53
|
-
KHR_texture_basisu,
|
|
54
|
-
KHR_draco_mesh_compression,
|
|
55
|
-
KHR_lights_punctual,
|
|
56
|
-
KHR_materials_unlit,
|
|
57
|
-
KHR_techniques_webgl,
|
|
58
|
-
KHR_texture_transform,
|
|
59
|
-
EXT_feature_metadata
|
|
60
|
-
];
|
|
61
|
-
/** Call before any resource loading starts */
|
|
62
|
-
function preprocessExtensions(gltf, options = {}, context) {
|
|
63
|
-
const extensions = exports.EXTENSIONS.filter((extension) => useExtension(extension.name, options));
|
|
64
|
-
for (const extension of extensions) {
|
|
65
|
-
extension.preprocess?.(gltf, options, context);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.preprocessExtensions = preprocessExtensions;
|
|
69
|
-
/** Call after resource loading */
|
|
70
|
-
async function decodeExtensions(gltf, options = {}, context) {
|
|
71
|
-
const extensions = exports.EXTENSIONS.filter((extension) => useExtension(extension.name, options));
|
|
72
|
-
for (const extension of extensions) {
|
|
73
|
-
// Note: We decode async extensions sequentially, this might not be necessary
|
|
74
|
-
// Currently we only have Draco, but when we add Basis we may revisit
|
|
75
|
-
await extension.decode?.(gltf, options, context);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.decodeExtensions = decodeExtensions;
|
|
79
|
-
function useExtension(extensionName, options) {
|
|
80
|
-
const excludes = options?.gltf?.excludeExtensions || {};
|
|
81
|
-
const exclude = extensionName in excludes && !excludes[extensionName];
|
|
82
|
-
return !exclude;
|
|
83
|
-
}
|