|
544 | 544 |
|
545 | 545 | const compressedArrayBuffer = await io.writeBinary( doc ); |
546 | 546 |
|
| 547 | + for (const texture of doc.getRoot().listTextures()) { texture.dispose(); } |
547 | 548 | for (const material of doc.getRoot().listMaterials()) { material.dispose(); } |
548 | 549 | for (const mesh of doc.getRoot().listMeshes()) { mesh.dispose(); } |
549 | 550 |
|
|
579 | 580 | const textures = doc.getRoot().listTextures(); |
580 | 581 |
|
581 | 582 | if (textures.length > 0 && (tex_fmt !== '' || tex_res !== Infinity || tex_flip === true)) { |
582 | | - await process_textures( textures, doc, ALL_EXTENSIONS, true ); |
| 583 | + await process_textures( textures, doc, ALL_EXTENSIONS ); |
583 | 584 | } |
584 | 585 |
|
585 | 586 | doc.createExtension( ALL_EXTENSIONS[ 4 ] ) |
|
631 | 632 | const textures = doc.getRoot().listTextures(); |
632 | 633 |
|
633 | 634 | if (textures.length > 0 && (tex_fmt !== '' || tex_res !== Infinity || tex_flip === true)) { |
634 | | - await process_textures( textures, doc, ALL_EXTENSIONS, true ); |
| 635 | + await process_textures( textures, doc, ALL_EXTENSIONS ); |
635 | 636 | } |
636 | 637 |
|
637 | 638 | doc.createExtension( ALL_EXTENSIONS[ 1 ] ) |
|
649 | 650 | return compressedArrayBuffer; |
650 | 651 | } |
651 | 652 |
|
652 | | - /* Encode textures only with either of WEBP or KTX2 compression */ |
| 653 | + /* Encode textures only */ |
653 | 654 |
|
654 | 655 | async function texture_compress( arrayBuffer ) { |
655 | 656 | const { WebIO } = await import( "@gltf-transform/core" ); |
|
674 | 675 | const textures = doc.getRoot().listTextures(); |
675 | 676 |
|
676 | 677 | if (textures.length > 0 && (tex_fmt !== '' || tex_res !== Infinity || tex_flip === true)) { |
677 | | - await process_textures( textures, doc, ALL_EXTENSIONS, true ); |
| 678 | + await process_textures( textures, doc, ALL_EXTENSIONS ); |
678 | 679 | } |
679 | 680 |
|
680 | 681 | const compressedArrayBuffer = await io.writeBinary( doc ); |
|
0 commit comments