Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const totalByteLength = GLB_HEADER_BYTES
+ jsonChunkPrefix.byteLength + jsonChunk.byteLength
+ binaryChunkPrefix.byteLength + binaryChunk.byteLength;
header.writeUInt32LE(totalByteLength, 8);
const glb = Buffer.concat([
header,
jsonChunkPrefix,
jsonChunk,
binaryChunkPrefix,
binaryChunk,
]);
if (this.options.compressVertices) {
logger().info('[GLTFExporter.parse] Compressing vertices...');
const result = await gltfPipeline.processGlb(glb, {
dracoOptions: {
compressionLevel: this.options.dracoOptions!.compressionLevel,
quantizePositionBits: this.options.dracoOptions!.quantizePosition,
quantizeNormalBits: this.options.dracoOptions!.quantizeNormal,
quantizeTexcoordBits: this.options.dracoOptions!.quantizeTexcoord,
quantizeColorBits: this.options.dracoOptions!.quantizeColor,
unifiedQuantization: this.options.dracoOptions!.unifiedQuantization,
},
});
return result.glb;
} else {
return glb;
}
} else {
const totalByteLength = GLB_HEADER_BYTES
+ jsonChunkPrefix.byteLength + jsonChunk.byteLength
+ binaryChunkPrefix.byteLength + binaryChunk.byteLength;
header.writeUInt32LE(totalByteLength, 8);
const glb = Buffer.concat([
header,
jsonChunkPrefix,
jsonChunk,
binaryChunkPrefix,
binaryChunk,
]);
if (this.options.compressVertices) {
logger.info(this.options.state, '[GLTFExporter.parse] Compressing vertices...');
const result = await gltfPipeline.processGlb(glb, {
dracoOptions: {
compressionLevel: this.options.dracoOptions.compressionLevel,
quantizePositionBits: this.options.dracoOptions.quantizePosition,
quantizeNormalBits: this.options.dracoOptions.quantizeNormal,
quantizeTexcoordBits: this.options.dracoOptions.quantizeTexcoord,
quantizeColorBits: this.options.dracoOptions.quantizeColor,
unifiedQuantization: this.options.dracoOptions.unifiedQuantization,
},
});
return result.glb;
} else {
return glb;
}
} else {