├── .editorconfig ├── .gitignore ├── .npmrc ├── LICENSE ├── README.md ├── bin ├── darwin │ ├── LICENSE-PVRTexToolCLI.txt │ ├── LICENSE-astcenc.txt │ ├── LICENSE-crunch.txt │ ├── PVRTexToolCLI │ ├── astcenc │ └── crunch ├── linux │ ├── LICENSE-PVRTexToolCLI.txt │ ├── LICENSE-astcenc.txt │ ├── LICENSE-crunch.txt │ ├── PVRTexToolCLI │ ├── astcenc │ └── crunch ├── texture-compressor.js └── win32 │ ├── LICENSE-PVRTexToolCLI.txt │ ├── LICENSE-astcenc.txt │ ├── LICENSE-crunch.txt │ ├── PVRTexToolCLI.exe │ ├── astcenc.exe │ └── crunch.exe ├── docs ├── RECOMMENDED_PARAMETERS.md ├── SUPPORTED_DEVICES_TABLE.md ├── SUPPORTED_PARAMETERS.md ├── data │ ├── KTXLoader.js │ ├── flippedY-mipmaps │ │ ├── example-astc-4x4.ktx │ │ ├── example-astc-8x8.ktx │ │ ├── example-dxt1.ktx │ │ ├── example-dxt1A.ktx │ │ ├── example-dxt3.ktx │ │ ├── example-dxt5.ktx │ │ ├── example-etc1.ktx │ │ ├── example-etc2.ktx │ │ ├── example-etc2A.ktx │ │ ├── example-pvrtc2BPP.ktx │ │ ├── example-pvrtc2BPPA.ktx │ │ ├── example-pvrtc4BPP.ktx │ │ └── example-pvrtc4BPPA.ktx │ └── main.js └── index.html ├── lib ├── argsHandler.ts ├── compressors │ ├── compressWithCrunch.ts │ ├── compressWithPVRTexTool.ts │ ├── spawnProcess.ts │ └── validateArgs.ts ├── constants.ts ├── index.ts └── utilities.ts ├── package.json ├── tsconfig.json ├── tslint.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | trim_trailing_whitespace = true 6 | indent_style = space 7 | indent_size = 2 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS 2 | .DS_Store 3 | 4 | # Editor 5 | .vscode 6 | 7 | # Cache 8 | .rpt2_cache 9 | 10 | # Node 11 | node_modules 12 | 13 | # Directories 14 | dist 15 | input 16 | output 17 | 18 | # Logging 19 | *.log 20 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Tim van Scherpenzeel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Texture Compressor 2 | 3 | [](https://badge.fury.io/js/texture-compressor) 4 | 5 | CLI tool for texture compression using ASTC, ETC, PVRTC and S3TC in a KTX container. 6 | 7 | ## Installation 8 | 9 | Make sure you have [Node.js](http://nodejs.org/) installed. 10 | 11 | ```sh 12 | $ npm install texture-compressor 13 | ``` 14 | 15 | ## Live demo 16 | 17 | [Live demo](https://timvanscherpenzeel.github.io/texture-compressor/) 18 | 19 | ## Documentation 20 | 21 | [Supported devices table](docs/SUPPORTED_DEVICES_TABLE.md) 22 | 23 | [Supported parameters](docs/SUPPORTED_PARAMETERS.md) 24 | 25 | [Recommended parameters](docs/RECOMMENDED_PARAMETERS.md) 26 | 27 | ## CLI Usage 28 | 29 | ### ASTC 30 | 31 | ```sh 32 | $ node ./bin/texture-compressor -i input/example.png -t astc -c ASTC_4x4 -q astcmedium -o output/example-astc.ktx -y -m -vb 33 | ``` 34 | 35 | ### ETC 36 | 37 | ```sh 38 | $ node ./bin/texture-compressor -i input/example.png -t etc -c ETC2_RGB -q etcfast -o output/example-etc.ktx -y -m -vb 39 | ``` 40 | 41 | ### PVRTC 42 | 43 | ```sh 44 | $ node ./bin/texture-compressor -i input/example.png -t pvrtc -c PVRTC1_2 -q pvrtcnormal -o output/example-pvrtc.ktx -y -m -vb 45 | ``` 46 | 47 | ### S3TC 48 | 49 | ```sh 50 | $ node ./bin/texture-compressor -i input/example.png -t s3tc -c DXT1 -q normal -o output/example-s3tc.ktx -y -m -vb 51 | ``` 52 | 53 | ## Module usage 54 | 55 | ```js 56 | const { pack } = require('./dist/cli/lib/index'); 57 | 58 | pack({ 59 | type: 'astc', 60 | input: 'input/example.png', 61 | output: 'output/example-astc.ktx', 62 | compression: 'ASTC_4x4', 63 | quality: 'astcmedium', 64 | verbose: true, 65 | }).then(() => console.log('done!')); 66 | ``` 67 | 68 | ## Flags 69 | 70 | ### Required 71 | 72 | -i, --input [example: ./input/example.png] [required] 73 | -o, --output [example: ./output/example.ktx] [required] 74 | -t, --type [example: astc, etc, pvrtc, s3tc] [required] 75 | -c, --compression [example: ASTC_4x4, ETC2_RGB, PVRTC1_2, DXT1] [required] 76 | -q, --quality [example: astcmedium, etcfast, pvrtcnormal, normal] [required] 77 | 78 | ### Optional 79 | 80 | -vb, --verbose [true / false, default: false] [not required] 81 | 82 | -rs, --square ['no', '-', '+', default: +] [not required] 83 | -rp, --pot ['no', '-', '+', default: +] [not required] 84 | -m, --mipmap [true / false, default: false] [not required] 85 | -y, --flipY [tue / false, default: false] [not required] 86 | 87 | ### Tool flags 88 | 89 | Tool flags are not processed by `texture-compressor` but rather directly by the binary you are targeting itself. 90 | 91 | For example adding `--flags ["usesourceformat DXT1A" "alphaThreshold 200"]` will pass `usesourceformat DXT1A` and `alphaThreshold 200` directly to `Crunch`. 92 | 93 | Please be aware that these flags are tool specific and can therefore not be directly applied to the other binaries. 94 | 95 | -f, --flags ["flag value" "flag value"] [not required] 96 | 97 | To find tool specific flags please refer to the manuals of [ASTC](http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf), [ETC](http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf), [PVRTC](http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf), [S3TC](https://github.com/BinomialLLC/crunch/blob/235946f7a1cf8b9c97e8bf0e8062d5439a51dec7/crunch/crunch.cpp#L70-L181). 98 | 99 | ## License 100 | 101 | My work is released under the [MIT license](https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/master/LICENSE). 102 | 103 | This repository distributes multiple binary tools for Windows, Mac and Linux. 104 | This product includes components of the PowerVR™ SDK from Imagination Technologies Limited. 105 | 106 | - [astcenc](https://raw.githubusercontent.com/ARM-software/astc-encoder/master/license.txt) 107 | - [PVRTexToolCLI](https://community.imgtec.com/developers/powervr/sdk-end-user-licence-agreement/) 108 | - [crunch](https://raw.githubusercontent.com/BinomialLLC/crunch/master/license.txt) 109 | -------------------------------------------------------------------------------- /bin/darwin/LICENSE-PVRTexToolCLI.txt: -------------------------------------------------------------------------------- 1 | PLEASE READ THIS AGREEMENT CAREFULLY. BY USING ANY PORTION OF THE POWERVR TOOLS SOFTWARE YOU WILL BE LEGALLY BOUND TO THESE TERMS. 2 | Imagination Technologies Limited (“Imagination”) provides this Software subject to the terms of this Agreement. If you do not agree with any of these terms, then do not install or otherwise use the Software. 3 | 4 | Definitions 5 | “Software” means all or any component comprising the software in source or binary form, documentation, or other materials including any related updates or upgrades made available by Imagination under this Agreement from time to time. 6 | 7 | License Grant 8 | Subject to your compliance with the terms of this Agreement, Imagination grants to you a non-exclusive, non-assignable license to: 9 | 10 | (a) use the Software for the sole purpose of developing, profiling, or assisting in the optimisation of internal, commercial, or non-commercial applications; 11 | 12 | (b) distribute the Software as a component of your application, provided that: 13 | 14 | you do not distribute the Software on a stand alone basis; 15 | you distribute such Software under terms no less restrictive than those in this Agreement; 16 | you comply with the attribution requirements set out in Appendix 1; 17 | you are solely responsible for any update, support obligation or other liability that may arise from such distribution; and 18 | you do not make any statements that your application or its performance are certified, guaranteed or otherwise endorsed by Imagination; and 19 | (c) use the Software as expressly authorised by Imagination in writing, on the payment and/or support terms set out in Appendix 2 (if applicable). 20 | 21 | Restrictions 22 | Other than as expressly permitted herein, you may not: (i) use the Software for any unauthorised purpose; (ii) modify, disassemble, decompile, reverse engineer, revise or enhance the Software, create derivative works or attempt to discover the source code for any element of the Software not already provided in source code form; (iii) remove any proprietary or copyright notices on or accompanying the Software; or (iv) incorporate or combine the Software, with any open source software in such a way that would cause the Software, or any portion thereof, to be subject to all or part of the license obligations or other intellectual property related terms with respect to such open source software. 23 | 24 | Ownership and Contributions 25 | Imagination retains all ownership of the Software, including without limitation all copyrights and other intellectual property rights therein. To the extent you provide any feedback or make any contributions in connection with the Software (collectively “contributions”), you agree to assign all intellectual property rights in such contribution to Imagination and agree not to assert any related rights against Imagination or any of its customers or licensees. You understand and agree that Imagination is not required to make any use of any contribution that you provide, but that if Imagination makes use of your contribution, neither Imagination nor any of its customers or licensees are required to credit or compensate you for your contribution. You represent and warrant that you have sufficient rights in your contribution to comply with the foregoing. 26 | 27 | Warranty Disclaimer 28 | THE SOFTWARE IS PROVIDED “AS IS”. IMAGINATION HEREBY DISCLAIMS ALL EXPRESS OR IMPLIED WARRANTIES AND CONDITIONS WITH REGARD TO THE SOFTWARE, INCLUDING ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. 29 | 30 | Limitation of Liability 31 | IN NO EVENT WILL IMAGINATION BE LIABLE TO YOU FOR ANY DAMAGES, CLAIMS OR COSTS WHATSOEVER ARISING FROM THIS AGREEMENT AND/OR YOUR USE OF THE SOFTWARE OR ANY COMPONENT THEREOF, INCLUDING WITHOUT LIMITATION ANY CONSEQUENTIAL, INDIRECT, INCIDENTAL DAMAGES, OR ANY LOST PROFITS OR LOST SAVINGS, EVEN IF IMAGINATION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS OR FOR ANY CLAIM BY ANY THIRD PARTY. THE FOREGOING LIMITATIONS AND EXCLUSIONS APPLY TO THE EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION. 32 | 33 | Third Party Materials 34 | All third party materials packaged with the Software, including without limitation, artwork, graphics, game demos and patches, are the sole and exclusive property of such third parties. Imagination makes no representations or warranties about the accuracy, usability or validity of any third party materials, and disclaims all liabilities in connection with such third party materials. 35 | 36 | Term 37 | This Agreement is effective until terminated. Imagination has the right to terminate this Agreement immediately if you fail to comply with any term of this Agreement. You may terminate this Agreement by destroying or returning to Imagination all copies of the Software in your possession. 38 | 39 | Governing Law 40 | This Agreement is governed by and shall be construed in accordance with English law and each party agrees to submit to the exclusive jurisdiction of the courts of England. 41 | 42 | 43 | APPENDIX 1: ATTRIBUTION REQUIREMENTS 44 | If source code is released as it is, the Copyright notice should be kept in a visible position. If object code is bundled with a product, all branding should be kept as it was originally, and the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the Software: “This product includes components of the PowerVR Tools Software from Imagination Technologies Limited”. If source code is used to compile a product, the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the Software: “This product includes components of the PowerVR Tools Software from Imagination Technologies Limited”. 45 | 46 | 47 | APPENDIX 2: FEES 48 | LICENSE FEES: 0 (Zero) 49 | 50 | ROYALTY FEES: 0 (Zero) 51 | 52 | SUPPORT AND MAINTENANCE TERMS AND FEES: 0 (Zero) 53 | -------------------------------------------------------------------------------- /bin/darwin/LICENSE-astcenc.txt: -------------------------------------------------------------------------------- 1 | END USER LICENCE AGREEMENT FOR THE MALI ASTC SPECIFICATION AND SOFTWARE CODEC, 2 | VERSION: 1.3 3 | 4 | THIS END USER LICENCE AGREEMENT ("LICENCE") IS A LEGAL AGREEMENT BETWEEN YOU 5 | (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND ARM LIMITED ("ARM") 6 | FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS LICENCE. ARM IS ONLY WILLING 7 | TO LICENSE THE SOFTWARE TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS 8 | IN THIS LICENCE. BY CLICKING "I AGREE" OR BY INSTALLING OR OTHERWISE USING 9 | OR COPYING THE SOFTWARE YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL THE 10 | TERMS OF THIS LICENCE. 11 | 12 | IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENCE, ARM IS UNWILLING TO LICENSE 13 | THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE. 14 | 15 | 1. DEFINITIONS. 16 | 17 | "Authorised Purpose" means the use of the Software solely to develop products 18 | and tools which implement the Khronos ASTC specification to; 19 | (i) compress texture images into ASTC format ("Compression Results"); 20 | (ii) distribute such Compression Results to third parties; and 21 | (iii) decompress texture images stored in ASTC format. 22 | 23 | "Software" means the source code and Software binaries accompanying this 24 | Licence, and any printed, electronic or online documentation supplied with it, 25 | in all cases relating to the MALI ASTC SPECIFICATION AND SOFTWARE CODEC. 26 | 27 | 2. LICENCE GRANT. 28 | 29 | ARM hereby grants to you, subject to the terms and conditions of this Licence, 30 | a nonexclusive, nontransferable, free of charge, royalty free, worldwide 31 | licence to use, copy, modify and (subject to Clause 3 below) distribute the 32 | Software solely for the Authorised Purpose. 33 | 34 | No right is granted to use the Software to develop hardware. 35 | 36 | Notwithstanding the foregoing, nothing in this Licence prevents you from 37 | using the Software to develop products that conform to an application 38 | programming interface specification issued by The Khronos Group Inc. 39 | ("Khronos"), provided that you have licences to develop such products 40 | under the relevant Khronos agreements. 41 | 42 | 3. RESTRICTIONS ON USE OF THE SOFTWARE. 43 | 44 | RESTRICTIONS ON TRANSFER OF LICENSED RIGHTS: The rights granted to you under 45 | this Licence may not be assigned by you to any third party without the prior 46 | written consent of ARM. 47 | 48 | TITLE AND RESERVATION OF RIGHTS: You acquire no rights to the Software other 49 | than as expressly provided by this Licence. The Software is licensed not sold. 50 | ARM does not transfer title to the Software to you. In no event shall the 51 | licences granted in Clause 2 be construed as granting you expressly or by 52 | implication, estoppel or otherwise, licences to any ARM technology other than 53 | the Software. 54 | 55 | NOTICES: You shall not remove from the Software any copyright notice or other 56 | notice (whether ARM's or its licensor's), and you shall ensure that any such 57 | notice is reproduced in any copies of the whole or any part of the Software 58 | made by you. You shall not use ARM's or its licensor's name, logo or 59 | trademarks to market Compression Results. If you distribute the Software to a 60 | third party, you agree to include a copy of this Licence with such 61 | distribution. 62 | 63 | 4. NO SUPPORT. 64 | 65 | ARM has no obligation to support or to continue providing or updating any of 66 | the Software. 67 | 68 | 5. NO WARRANTIES. 69 | 70 | YOU AGREE THAT THE SOFTWARE IS LICENSED "AS IS", AND THAT ARM EXPRESSLY 71 | DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS OR OTHER TERMS, EXPRESS, 72 | IMPLIED OR STATUTORY, TO THE FULLEST EXTENT PERMITTED BY LAW. YOU EXPRESSLY 73 | ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION OF ANY APPLICATION 74 | PROGRAMS YOU CREATE WITH THE SOFTWARE, AND YOU ASSUME THE ENTIRE COST OF ALL 75 | NECESSARY SERVICING, REPAIR OR CORRECTION. 76 | 77 | 6. LIMITATION OF LIABILITY. 78 | 79 | TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL ARM BE 80 | LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 81 | (INCLUDING LOSS OF PROFITS) ARISING OUT OF THE USE OR INABILITY TO USE THE 82 | SOFTWARE WHETHER BASED ON A CLAIM UNDER CONTRACT, TORT OR OTHER LEGAL THEORY, 83 | EVEN IF ARM WAS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 84 | 85 | ARM does not seek to limit or exclude liability for death or personal injury 86 | arising from ARM's negligence and because some jurisdictions do not permit the 87 | exclusion or limitation of liability for consequential or incidental damages 88 | the above limitation relating to liability for consequential damages may not 89 | apply to you. 90 | 91 | NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS LICENCE, THE 92 | MAXIMUM LIABILITY OF ARM TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST ARM 93 | IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER 94 | OF THIS LICENCE SHALL NOT EXCEED THE GREATER OF THE TOTAL OF SUMS PAID BY YOU 95 | TO ARM (IF ANY) FOR THIS LICENCE AND US$5.00. 96 | 97 | 7. U.S. GOVERNMENT END USERS. 98 | 99 | US Government Restrictions: Use, duplication, reproduction, release, 100 | modification, disclosure or transfer of this commercial product and 101 | accompanying documentation is restricted in accordance with the terms 102 | of this Licence. 103 | 104 | 8. TERM AND TERMINATION. 105 | 106 | This Licence shall remain in force until terminated by you or by ARM. Without 107 | prejudice to any of its other rights if you are in breach of any of the terms 108 | and conditions of this Licence then ARM may terminate this Licence immediately 109 | upon giving written notice to you. You may terminate this Licence at any time. 110 | 111 | Upon termination of this Licence by you or by ARM you shall stop using the 112 | Software and destroy all copies of the Software in your possession together 113 | with all documentation and related materials. The provisions of Clauses 1, 3, 114 | 4, 5, 6, 7, 8 and 9 shall survive termination of this Licence. 115 | 116 | 9. GENERAL. 117 | 118 | This Licence is governed by English Law. Except where ARM agrees otherwise in 119 | a written contract signed by you and ARM, this is the only agreement between 120 | you and ARM relating to the Software and it may only be modified by written 121 | agreement between you and ARM. Except as expressly agreed in writing, this 122 | Licence may not be modified by purchase orders, advertising or other 123 | representation by any person. If any clause in this Licence is held by a court 124 | of law to be illegal or unenforceable the remaining provisions of this Licence 125 | shall not be affected thereby. The failure by ARM to enforce any of the 126 | provisions of this Licence, unless waived in writing, shall not constitute a 127 | waiver of ARM's rights to enforce such provision or any other provision of 128 | this Licence in the future. 129 | 130 | You agree to comply fully with all laws and regulations of the United States 131 | and other countries ("Export Laws") to assure that the Software is not; 132 | (1) exported, directly or indirectly, in violation of Export Laws, either to 133 | any countries that are subject to U.S.A. export restrictions or to any end 134 | user who has been prohibited from participating in the U.S.A. export 135 | transactions by any federal agency of the U.S.A. government; or 136 | (2) intended to be used for any purpose prohibited by Export Laws, including, 137 | without limitation, nuclear, chemical, or biological weapons proliferation. 138 | -------------------------------------------------------------------------------- /bin/darwin/LICENSE-crunch.txt: -------------------------------------------------------------------------------- 1 | crunch/crnlib uses a modified ZLIB license. Specifically, it's the same as zlib except that 2 | public credits for using the library are *required*. 3 | 4 | Copyright (c) 2010-2016 Richard Geldreich, Jr., Tenacious Software, and Binomial LLC 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. 16 | 17 | 2. If you use this software in a product, this acknowledgment in the product 18 | documentation or credits is required: 19 | 20 | "Crunch Library Copyright (c) 2010-2016 Richard Geldreich, Jr., Tenacious Software, and Binomial LLC" 21 | 22 | 3. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original software. 24 | 25 | 4. This notice may not be removed or altered from any source distribution. 26 | -------------------------------------------------------------------------------- /bin/darwin/PVRTexToolCLI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/darwin/PVRTexToolCLI -------------------------------------------------------------------------------- /bin/darwin/astcenc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/darwin/astcenc -------------------------------------------------------------------------------- /bin/darwin/crunch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/darwin/crunch -------------------------------------------------------------------------------- /bin/linux/LICENSE-PVRTexToolCLI.txt: -------------------------------------------------------------------------------- 1 | PLEASE READ THIS AGREEMENT CAREFULLY. BY USING ANY PORTION OF THE POWERVR TOOLS SOFTWARE YOU WILL BE LEGALLY BOUND TO THESE TERMS. 2 | Imagination Technologies Limited (“Imagination”) provides this Software subject to the terms of this Agreement. If you do not agree with any of these terms, then do not install or otherwise use the Software. 3 | 4 | Definitions 5 | “Software” means all or any component comprising the software in source or binary form, documentation, or other materials including any related updates or upgrades made available by Imagination under this Agreement from time to time. 6 | 7 | License Grant 8 | Subject to your compliance with the terms of this Agreement, Imagination grants to you a non-exclusive, non-assignable license to: 9 | 10 | (a) use the Software for the sole purpose of developing, profiling, or assisting in the optimisation of internal, commercial, or non-commercial applications; 11 | 12 | (b) distribute the Software as a component of your application, provided that: 13 | 14 | you do not distribute the Software on a stand alone basis; 15 | you distribute such Software under terms no less restrictive than those in this Agreement; 16 | you comply with the attribution requirements set out in Appendix 1; 17 | you are solely responsible for any update, support obligation or other liability that may arise from such distribution; and 18 | you do not make any statements that your application or its performance are certified, guaranteed or otherwise endorsed by Imagination; and 19 | (c) use the Software as expressly authorised by Imagination in writing, on the payment and/or support terms set out in Appendix 2 (if applicable). 20 | 21 | Restrictions 22 | Other than as expressly permitted herein, you may not: (i) use the Software for any unauthorised purpose; (ii) modify, disassemble, decompile, reverse engineer, revise or enhance the Software, create derivative works or attempt to discover the source code for any element of the Software not already provided in source code form; (iii) remove any proprietary or copyright notices on or accompanying the Software; or (iv) incorporate or combine the Software, with any open source software in such a way that would cause the Software, or any portion thereof, to be subject to all or part of the license obligations or other intellectual property related terms with respect to such open source software. 23 | 24 | Ownership and Contributions 25 | Imagination retains all ownership of the Software, including without limitation all copyrights and other intellectual property rights therein. To the extent you provide any feedback or make any contributions in connection with the Software (collectively “contributions”), you agree to assign all intellectual property rights in such contribution to Imagination and agree not to assert any related rights against Imagination or any of its customers or licensees. You understand and agree that Imagination is not required to make any use of any contribution that you provide, but that if Imagination makes use of your contribution, neither Imagination nor any of its customers or licensees are required to credit or compensate you for your contribution. You represent and warrant that you have sufficient rights in your contribution to comply with the foregoing. 26 | 27 | Warranty Disclaimer 28 | THE SOFTWARE IS PROVIDED “AS IS”. IMAGINATION HEREBY DISCLAIMS ALL EXPRESS OR IMPLIED WARRANTIES AND CONDITIONS WITH REGARD TO THE SOFTWARE, INCLUDING ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. 29 | 30 | Limitation of Liability 31 | IN NO EVENT WILL IMAGINATION BE LIABLE TO YOU FOR ANY DAMAGES, CLAIMS OR COSTS WHATSOEVER ARISING FROM THIS AGREEMENT AND/OR YOUR USE OF THE SOFTWARE OR ANY COMPONENT THEREOF, INCLUDING WITHOUT LIMITATION ANY CONSEQUENTIAL, INDIRECT, INCIDENTAL DAMAGES, OR ANY LOST PROFITS OR LOST SAVINGS, EVEN IF IMAGINATION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS OR FOR ANY CLAIM BY ANY THIRD PARTY. THE FOREGOING LIMITATIONS AND EXCLUSIONS APPLY TO THE EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION. 32 | 33 | Third Party Materials 34 | All third party materials packaged with the Software, including without limitation, artwork, graphics, game demos and patches, are the sole and exclusive property of such third parties. Imagination makes no representations or warranties about the accuracy, usability or validity of any third party materials, and disclaims all liabilities in connection with such third party materials. 35 | 36 | Term 37 | This Agreement is effective until terminated. Imagination has the right to terminate this Agreement immediately if you fail to comply with any term of this Agreement. You may terminate this Agreement by destroying or returning to Imagination all copies of the Software in your possession. 38 | 39 | Governing Law 40 | This Agreement is governed by and shall be construed in accordance with English law and each party agrees to submit to the exclusive jurisdiction of the courts of England. 41 | 42 | 43 | APPENDIX 1: ATTRIBUTION REQUIREMENTS 44 | If source code is released as it is, the Copyright notice should be kept in a visible position. If object code is bundled with a product, all branding should be kept as it was originally, and the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the Software: “This product includes components of the PowerVR Tools Software from Imagination Technologies Limited”. If source code is used to compile a product, the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the Software: “This product includes components of the PowerVR Tools Software from Imagination Technologies Limited”. 45 | 46 | 47 | APPENDIX 2: FEES 48 | LICENSE FEES: 0 (Zero) 49 | 50 | ROYALTY FEES: 0 (Zero) 51 | 52 | SUPPORT AND MAINTENANCE TERMS AND FEES: 0 (Zero) 53 | -------------------------------------------------------------------------------- /bin/linux/LICENSE-astcenc.txt: -------------------------------------------------------------------------------- 1 | END USER LICENCE AGREEMENT FOR THE MALI ASTC SPECIFICATION AND SOFTWARE CODEC, 2 | VERSION: 1.3 3 | 4 | THIS END USER LICENCE AGREEMENT ("LICENCE") IS A LEGAL AGREEMENT BETWEEN YOU 5 | (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND ARM LIMITED ("ARM") 6 | FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS LICENCE. ARM IS ONLY WILLING 7 | TO LICENSE THE SOFTWARE TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS 8 | IN THIS LICENCE. BY CLICKING "I AGREE" OR BY INSTALLING OR OTHERWISE USING 9 | OR COPYING THE SOFTWARE YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL THE 10 | TERMS OF THIS LICENCE. 11 | 12 | IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENCE, ARM IS UNWILLING TO LICENSE 13 | THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE. 14 | 15 | 1. DEFINITIONS. 16 | 17 | "Authorised Purpose" means the use of the Software solely to develop products 18 | and tools which implement the Khronos ASTC specification to; 19 | (i) compress texture images into ASTC format ("Compression Results"); 20 | (ii) distribute such Compression Results to third parties; and 21 | (iii) decompress texture images stored in ASTC format. 22 | 23 | "Software" means the source code and Software binaries accompanying this 24 | Licence, and any printed, electronic or online documentation supplied with it, 25 | in all cases relating to the MALI ASTC SPECIFICATION AND SOFTWARE CODEC. 26 | 27 | 2. LICENCE GRANT. 28 | 29 | ARM hereby grants to you, subject to the terms and conditions of this Licence, 30 | a nonexclusive, nontransferable, free of charge, royalty free, worldwide 31 | licence to use, copy, modify and (subject to Clause 3 below) distribute the 32 | Software solely for the Authorised Purpose. 33 | 34 | No right is granted to use the Software to develop hardware. 35 | 36 | Notwithstanding the foregoing, nothing in this Licence prevents you from 37 | using the Software to develop products that conform to an application 38 | programming interface specification issued by The Khronos Group Inc. 39 | ("Khronos"), provided that you have licences to develop such products 40 | under the relevant Khronos agreements. 41 | 42 | 3. RESTRICTIONS ON USE OF THE SOFTWARE. 43 | 44 | RESTRICTIONS ON TRANSFER OF LICENSED RIGHTS: The rights granted to you under 45 | this Licence may not be assigned by you to any third party without the prior 46 | written consent of ARM. 47 | 48 | TITLE AND RESERVATION OF RIGHTS: You acquire no rights to the Software other 49 | than as expressly provided by this Licence. The Software is licensed not sold. 50 | ARM does not transfer title to the Software to you. In no event shall the 51 | licences granted in Clause 2 be construed as granting you expressly or by 52 | implication, estoppel or otherwise, licences to any ARM technology other than 53 | the Software. 54 | 55 | NOTICES: You shall not remove from the Software any copyright notice or other 56 | notice (whether ARM's or its licensor's), and you shall ensure that any such 57 | notice is reproduced in any copies of the whole or any part of the Software 58 | made by you. You shall not use ARM's or its licensor's name, logo or 59 | trademarks to market Compression Results. If you distribute the Software to a 60 | third party, you agree to include a copy of this Licence with such 61 | distribution. 62 | 63 | 4. NO SUPPORT. 64 | 65 | ARM has no obligation to support or to continue providing or updating any of 66 | the Software. 67 | 68 | 5. NO WARRANTIES. 69 | 70 | YOU AGREE THAT THE SOFTWARE IS LICENSED "AS IS", AND THAT ARM EXPRESSLY 71 | DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS OR OTHER TERMS, EXPRESS, 72 | IMPLIED OR STATUTORY, TO THE FULLEST EXTENT PERMITTED BY LAW. YOU EXPRESSLY 73 | ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION OF ANY APPLICATION 74 | PROGRAMS YOU CREATE WITH THE SOFTWARE, AND YOU ASSUME THE ENTIRE COST OF ALL 75 | NECESSARY SERVICING, REPAIR OR CORRECTION. 76 | 77 | 6. LIMITATION OF LIABILITY. 78 | 79 | TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL ARM BE 80 | LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 81 | (INCLUDING LOSS OF PROFITS) ARISING OUT OF THE USE OR INABILITY TO USE THE 82 | SOFTWARE WHETHER BASED ON A CLAIM UNDER CONTRACT, TORT OR OTHER LEGAL THEORY, 83 | EVEN IF ARM WAS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 84 | 85 | ARM does not seek to limit or exclude liability for death or personal injury 86 | arising from ARM's negligence and because some jurisdictions do not permit the 87 | exclusion or limitation of liability for consequential or incidental damages 88 | the above limitation relating to liability for consequential damages may not 89 | apply to you. 90 | 91 | NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS LICENCE, THE 92 | MAXIMUM LIABILITY OF ARM TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST ARM 93 | IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER 94 | OF THIS LICENCE SHALL NOT EXCEED THE GREATER OF THE TOTAL OF SUMS PAID BY YOU 95 | TO ARM (IF ANY) FOR THIS LICENCE AND US$5.00. 96 | 97 | 7. U.S. GOVERNMENT END USERS. 98 | 99 | US Government Restrictions: Use, duplication, reproduction, release, 100 | modification, disclosure or transfer of this commercial product and 101 | accompanying documentation is restricted in accordance with the terms 102 | of this Licence. 103 | 104 | 8. TERM AND TERMINATION. 105 | 106 | This Licence shall remain in force until terminated by you or by ARM. Without 107 | prejudice to any of its other rights if you are in breach of any of the terms 108 | and conditions of this Licence then ARM may terminate this Licence immediately 109 | upon giving written notice to you. You may terminate this Licence at any time. 110 | 111 | Upon termination of this Licence by you or by ARM you shall stop using the 112 | Software and destroy all copies of the Software in your possession together 113 | with all documentation and related materials. The provisions of Clauses 1, 3, 114 | 4, 5, 6, 7, 8 and 9 shall survive termination of this Licence. 115 | 116 | 9. GENERAL. 117 | 118 | This Licence is governed by English Law. Except where ARM agrees otherwise in 119 | a written contract signed by you and ARM, this is the only agreement between 120 | you and ARM relating to the Software and it may only be modified by written 121 | agreement between you and ARM. Except as expressly agreed in writing, this 122 | Licence may not be modified by purchase orders, advertising or other 123 | representation by any person. If any clause in this Licence is held by a court 124 | of law to be illegal or unenforceable the remaining provisions of this Licence 125 | shall not be affected thereby. The failure by ARM to enforce any of the 126 | provisions of this Licence, unless waived in writing, shall not constitute a 127 | waiver of ARM's rights to enforce such provision or any other provision of 128 | this Licence in the future. 129 | 130 | You agree to comply fully with all laws and regulations of the United States 131 | and other countries ("Export Laws") to assure that the Software is not; 132 | (1) exported, directly or indirectly, in violation of Export Laws, either to 133 | any countries that are subject to U.S.A. export restrictions or to any end 134 | user who has been prohibited from participating in the U.S.A. export 135 | transactions by any federal agency of the U.S.A. government; or 136 | (2) intended to be used for any purpose prohibited by Export Laws, including, 137 | without limitation, nuclear, chemical, or biological weapons proliferation. 138 | -------------------------------------------------------------------------------- /bin/linux/LICENSE-crunch.txt: -------------------------------------------------------------------------------- 1 | crunch/crnlib uses a modified ZLIB license. Specifically, it's the same as zlib except that 2 | public credits for using the library are *required*. 3 | 4 | Copyright (c) 2010-2016 Richard Geldreich, Jr., Tenacious Software, and Binomial LLC 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. 16 | 17 | 2. If you use this software in a product, this acknowledgment in the product 18 | documentation or credits is required: 19 | 20 | "Crunch Library Copyright (c) 2010-2016 Richard Geldreich, Jr., Tenacious Software, and Binomial LLC" 21 | 22 | 3. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original software. 24 | 25 | 4. This notice may not be removed or altered from any source distribution. 26 | -------------------------------------------------------------------------------- /bin/linux/PVRTexToolCLI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/linux/PVRTexToolCLI -------------------------------------------------------------------------------- /bin/linux/astcenc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/linux/astcenc -------------------------------------------------------------------------------- /bin/linux/crunch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/linux/crunch -------------------------------------------------------------------------------- /bin/texture-compressor.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../dist/cli/lib/index.js').pack(); 4 | -------------------------------------------------------------------------------- /bin/win32/LICENSE-PVRTexToolCLI.txt: -------------------------------------------------------------------------------- 1 | PLEASE READ THIS AGREEMENT CAREFULLY. BY USING ANY PORTION OF THE POWERVR TOOLS SOFTWARE YOU WILL BE LEGALLY BOUND TO THESE TERMS. 2 | Imagination Technologies Limited (“Imagination”) provides this Software subject to the terms of this Agreement. If you do not agree with any of these terms, then do not install or otherwise use the Software. 3 | 4 | Definitions 5 | “Software” means all or any component comprising the software in source or binary form, documentation, or other materials including any related updates or upgrades made available by Imagination under this Agreement from time to time. 6 | 7 | License Grant 8 | Subject to your compliance with the terms of this Agreement, Imagination grants to you a non-exclusive, non-assignable license to: 9 | 10 | (a) use the Software for the sole purpose of developing, profiling, or assisting in the optimisation of internal, commercial, or non-commercial applications; 11 | 12 | (b) distribute the Software as a component of your application, provided that: 13 | 14 | you do not distribute the Software on a stand alone basis; 15 | you distribute such Software under terms no less restrictive than those in this Agreement; 16 | you comply with the attribution requirements set out in Appendix 1; 17 | you are solely responsible for any update, support obligation or other liability that may arise from such distribution; and 18 | you do not make any statements that your application or its performance are certified, guaranteed or otherwise endorsed by Imagination; and 19 | (c) use the Software as expressly authorised by Imagination in writing, on the payment and/or support terms set out in Appendix 2 (if applicable). 20 | 21 | Restrictions 22 | Other than as expressly permitted herein, you may not: (i) use the Software for any unauthorised purpose; (ii) modify, disassemble, decompile, reverse engineer, revise or enhance the Software, create derivative works or attempt to discover the source code for any element of the Software not already provided in source code form; (iii) remove any proprietary or copyright notices on or accompanying the Software; or (iv) incorporate or combine the Software, with any open source software in such a way that would cause the Software, or any portion thereof, to be subject to all or part of the license obligations or other intellectual property related terms with respect to such open source software. 23 | 24 | Ownership and Contributions 25 | Imagination retains all ownership of the Software, including without limitation all copyrights and other intellectual property rights therein. To the extent you provide any feedback or make any contributions in connection with the Software (collectively “contributions”), you agree to assign all intellectual property rights in such contribution to Imagination and agree not to assert any related rights against Imagination or any of its customers or licensees. You understand and agree that Imagination is not required to make any use of any contribution that you provide, but that if Imagination makes use of your contribution, neither Imagination nor any of its customers or licensees are required to credit or compensate you for your contribution. You represent and warrant that you have sufficient rights in your contribution to comply with the foregoing. 26 | 27 | Warranty Disclaimer 28 | THE SOFTWARE IS PROVIDED “AS IS”. IMAGINATION HEREBY DISCLAIMS ALL EXPRESS OR IMPLIED WARRANTIES AND CONDITIONS WITH REGARD TO THE SOFTWARE, INCLUDING ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. 29 | 30 | Limitation of Liability 31 | IN NO EVENT WILL IMAGINATION BE LIABLE TO YOU FOR ANY DAMAGES, CLAIMS OR COSTS WHATSOEVER ARISING FROM THIS AGREEMENT AND/OR YOUR USE OF THE SOFTWARE OR ANY COMPONENT THEREOF, INCLUDING WITHOUT LIMITATION ANY CONSEQUENTIAL, INDIRECT, INCIDENTAL DAMAGES, OR ANY LOST PROFITS OR LOST SAVINGS, EVEN IF IMAGINATION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS OR FOR ANY CLAIM BY ANY THIRD PARTY. THE FOREGOING LIMITATIONS AND EXCLUSIONS APPLY TO THE EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION. 32 | 33 | Third Party Materials 34 | All third party materials packaged with the Software, including without limitation, artwork, graphics, game demos and patches, are the sole and exclusive property of such third parties. Imagination makes no representations or warranties about the accuracy, usability or validity of any third party materials, and disclaims all liabilities in connection with such third party materials. 35 | 36 | Term 37 | This Agreement is effective until terminated. Imagination has the right to terminate this Agreement immediately if you fail to comply with any term of this Agreement. You may terminate this Agreement by destroying or returning to Imagination all copies of the Software in your possession. 38 | 39 | Governing Law 40 | This Agreement is governed by and shall be construed in accordance with English law and each party agrees to submit to the exclusive jurisdiction of the courts of England. 41 | 42 | 43 | APPENDIX 1: ATTRIBUTION REQUIREMENTS 44 | If source code is released as it is, the Copyright notice should be kept in a visible position. If object code is bundled with a product, all branding should be kept as it was originally, and the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the Software: “This product includes components of the PowerVR Tools Software from Imagination Technologies Limited”. If source code is used to compile a product, the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the Software: “This product includes components of the PowerVR Tools Software from Imagination Technologies Limited”. 45 | 46 | 47 | APPENDIX 2: FEES 48 | LICENSE FEES: 0 (Zero) 49 | 50 | ROYALTY FEES: 0 (Zero) 51 | 52 | SUPPORT AND MAINTENANCE TERMS AND FEES: 0 (Zero) 53 | -------------------------------------------------------------------------------- /bin/win32/LICENSE-astcenc.txt: -------------------------------------------------------------------------------- 1 | END USER LICENCE AGREEMENT FOR THE MALI ASTC SPECIFICATION AND SOFTWARE CODEC, 2 | VERSION: 1.3 3 | 4 | THIS END USER LICENCE AGREEMENT ("LICENCE") IS A LEGAL AGREEMENT BETWEEN YOU 5 | (EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND ARM LIMITED ("ARM") 6 | FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS LICENCE. ARM IS ONLY WILLING 7 | TO LICENSE THE SOFTWARE TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS 8 | IN THIS LICENCE. BY CLICKING "I AGREE" OR BY INSTALLING OR OTHERWISE USING 9 | OR COPYING THE SOFTWARE YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL THE 10 | TERMS OF THIS LICENCE. 11 | 12 | IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENCE, ARM IS UNWILLING TO LICENSE 13 | THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE. 14 | 15 | 1. DEFINITIONS. 16 | 17 | "Authorised Purpose" means the use of the Software solely to develop products 18 | and tools which implement the Khronos ASTC specification to; 19 | (i) compress texture images into ASTC format ("Compression Results"); 20 | (ii) distribute such Compression Results to third parties; and 21 | (iii) decompress texture images stored in ASTC format. 22 | 23 | "Software" means the source code and Software binaries accompanying this 24 | Licence, and any printed, electronic or online documentation supplied with it, 25 | in all cases relating to the MALI ASTC SPECIFICATION AND SOFTWARE CODEC. 26 | 27 | 2. LICENCE GRANT. 28 | 29 | ARM hereby grants to you, subject to the terms and conditions of this Licence, 30 | a nonexclusive, nontransferable, free of charge, royalty free, worldwide 31 | licence to use, copy, modify and (subject to Clause 3 below) distribute the 32 | Software solely for the Authorised Purpose. 33 | 34 | No right is granted to use the Software to develop hardware. 35 | 36 | Notwithstanding the foregoing, nothing in this Licence prevents you from 37 | using the Software to develop products that conform to an application 38 | programming interface specification issued by The Khronos Group Inc. 39 | ("Khronos"), provided that you have licences to develop such products 40 | under the relevant Khronos agreements. 41 | 42 | 3. RESTRICTIONS ON USE OF THE SOFTWARE. 43 | 44 | RESTRICTIONS ON TRANSFER OF LICENSED RIGHTS: The rights granted to you under 45 | this Licence may not be assigned by you to any third party without the prior 46 | written consent of ARM. 47 | 48 | TITLE AND RESERVATION OF RIGHTS: You acquire no rights to the Software other 49 | than as expressly provided by this Licence. The Software is licensed not sold. 50 | ARM does not transfer title to the Software to you. In no event shall the 51 | licences granted in Clause 2 be construed as granting you expressly or by 52 | implication, estoppel or otherwise, licences to any ARM technology other than 53 | the Software. 54 | 55 | NOTICES: You shall not remove from the Software any copyright notice or other 56 | notice (whether ARM's or its licensor's), and you shall ensure that any such 57 | notice is reproduced in any copies of the whole or any part of the Software 58 | made by you. You shall not use ARM's or its licensor's name, logo or 59 | trademarks to market Compression Results. If you distribute the Software to a 60 | third party, you agree to include a copy of this Licence with such 61 | distribution. 62 | 63 | 4. NO SUPPORT. 64 | 65 | ARM has no obligation to support or to continue providing or updating any of 66 | the Software. 67 | 68 | 5. NO WARRANTIES. 69 | 70 | YOU AGREE THAT THE SOFTWARE IS LICENSED "AS IS", AND THAT ARM EXPRESSLY 71 | DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS OR OTHER TERMS, EXPRESS, 72 | IMPLIED OR STATUTORY, TO THE FULLEST EXTENT PERMITTED BY LAW. YOU EXPRESSLY 73 | ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION OF ANY APPLICATION 74 | PROGRAMS YOU CREATE WITH THE SOFTWARE, AND YOU ASSUME THE ENTIRE COST OF ALL 75 | NECESSARY SERVICING, REPAIR OR CORRECTION. 76 | 77 | 6. LIMITATION OF LIABILITY. 78 | 79 | TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL ARM BE 80 | LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 81 | (INCLUDING LOSS OF PROFITS) ARISING OUT OF THE USE OR INABILITY TO USE THE 82 | SOFTWARE WHETHER BASED ON A CLAIM UNDER CONTRACT, TORT OR OTHER LEGAL THEORY, 83 | EVEN IF ARM WAS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 84 | 85 | ARM does not seek to limit or exclude liability for death or personal injury 86 | arising from ARM's negligence and because some jurisdictions do not permit the 87 | exclusion or limitation of liability for consequential or incidental damages 88 | the above limitation relating to liability for consequential damages may not 89 | apply to you. 90 | 91 | NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS LICENCE, THE 92 | MAXIMUM LIABILITY OF ARM TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST ARM 93 | IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER 94 | OF THIS LICENCE SHALL NOT EXCEED THE GREATER OF THE TOTAL OF SUMS PAID BY YOU 95 | TO ARM (IF ANY) FOR THIS LICENCE AND US$5.00. 96 | 97 | 7. U.S. GOVERNMENT END USERS. 98 | 99 | US Government Restrictions: Use, duplication, reproduction, release, 100 | modification, disclosure or transfer of this commercial product and 101 | accompanying documentation is restricted in accordance with the terms 102 | of this Licence. 103 | 104 | 8. TERM AND TERMINATION. 105 | 106 | This Licence shall remain in force until terminated by you or by ARM. Without 107 | prejudice to any of its other rights if you are in breach of any of the terms 108 | and conditions of this Licence then ARM may terminate this Licence immediately 109 | upon giving written notice to you. You may terminate this Licence at any time. 110 | 111 | Upon termination of this Licence by you or by ARM you shall stop using the 112 | Software and destroy all copies of the Software in your possession together 113 | with all documentation and related materials. The provisions of Clauses 1, 3, 114 | 4, 5, 6, 7, 8 and 9 shall survive termination of this Licence. 115 | 116 | 9. GENERAL. 117 | 118 | This Licence is governed by English Law. Except where ARM agrees otherwise in 119 | a written contract signed by you and ARM, this is the only agreement between 120 | you and ARM relating to the Software and it may only be modified by written 121 | agreement between you and ARM. Except as expressly agreed in writing, this 122 | Licence may not be modified by purchase orders, advertising or other 123 | representation by any person. If any clause in this Licence is held by a court 124 | of law to be illegal or unenforceable the remaining provisions of this Licence 125 | shall not be affected thereby. The failure by ARM to enforce any of the 126 | provisions of this Licence, unless waived in writing, shall not constitute a 127 | waiver of ARM's rights to enforce such provision or any other provision of 128 | this Licence in the future. 129 | 130 | You agree to comply fully with all laws and regulations of the United States 131 | and other countries ("Export Laws") to assure that the Software is not; 132 | (1) exported, directly or indirectly, in violation of Export Laws, either to 133 | any countries that are subject to U.S.A. export restrictions or to any end 134 | user who has been prohibited from participating in the U.S.A. export 135 | transactions by any federal agency of the U.S.A. government; or 136 | (2) intended to be used for any purpose prohibited by Export Laws, including, 137 | without limitation, nuclear, chemical, or biological weapons proliferation. 138 | -------------------------------------------------------------------------------- /bin/win32/LICENSE-crunch.txt: -------------------------------------------------------------------------------- 1 | crunch/crnlib uses a modified ZLIB license. Specifically, it's the same as zlib except that 2 | public credits for using the library are *required*. 3 | 4 | Copyright (c) 2010-2016 Richard Geldreich, Jr., Tenacious Software, and Binomial LLC 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. 16 | 17 | 2. If you use this software in a product, this acknowledgment in the product 18 | documentation or credits is required: 19 | 20 | "Crunch Library Copyright (c) 2010-2016 Richard Geldreich, Jr., Tenacious Software, and Binomial LLC" 21 | 22 | 3. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original software. 24 | 25 | 4. This notice may not be removed or altered from any source distribution. 26 | -------------------------------------------------------------------------------- /bin/win32/PVRTexToolCLI.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/win32/PVRTexToolCLI.exe -------------------------------------------------------------------------------- /bin/win32/astcenc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/win32/astcenc.exe -------------------------------------------------------------------------------- /bin/win32/crunch.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/bin/win32/crunch.exe -------------------------------------------------------------------------------- /docs/RECOMMENDED_PARAMETERS.md: -------------------------------------------------------------------------------- 1 | # Recommended parameters 2 | 3 | ## ASTC 4 | 5 | Usually I use `ASTC_4x4` or `ASTC_8x8` compression with quality `astcmedium`. 6 | 7 | ## ETC 8 | 9 | Usually I use `ETC2_RGB` or `ETC2_RGBA` (with alpha channel) compression with quality `etcfast`. 10 | 11 | ## PVRTC 12 | 13 | Usually I use `PVRTC1_4_RGB` or `PVRTC1_4` (with alpha channel) compression with quality `pvrtcnormal`. 14 | 15 | ## S3TC 16 | 17 | Usually I use `DXT1`, `DXT1A` (with alpha channel) or `DXT5` compression with quality `normal`. 18 | -------------------------------------------------------------------------------- /docs/SUPPORTED_DEVICES_TABLE.md: -------------------------------------------------------------------------------- 1 | # Supported devices table 2 | 3 | | Device | OS | OS version | Browser | Browser version | ASTC | ETC | ETC1 | S3TC | PVRTC | 4 | | ----------------------- | ------- | ---------- | ------------- | --------------- | ---- | --- | ---- | ---- | ----- | 5 | | Apple iPad 5th | iOS | 11.0.3 | Mobile Safari | 11.0 | | | | | X | 6 | | Apple iPad Air 2 | iOS | 8.4 | Mobile Safari | 8.0 | | | | | X | 7 | | Apple iPad Mini 3 | iOS | 8.1.2 | Mobile Safari | 8.0 | | | | | X | 8 | | Apple iPad Pro | iOS | 11.2.1 | Mobile Safari | 11.0 | | | | | X | 9 | | Apple iPhone 5S | iOS | 8.1.3 | Mobile Safari | 8.0 | | | | | X | 10 | | Apple iPhone 6 Plus | iOS | 8.1 | Mobile Safari | 8.0 | | | | | X | 11 | | Apple iPhone 6 | iOS | 8.1.3 | Mobile Safari | 8.0 | | | | | X | 12 | | Apple iPhone 6S Plus | iOS | 9.0.1 | Mobile Safari | 9.0 | | | | | X | 13 | | Apple iPhone 6S | iOS | 9.1 | Mobile Safari | 9.0 | | | | | X | 14 | | Apple iPhone 7 | iOS | 10.3.1 | Mobile Safari | 10.0 | | | | | X | 15 | | Apple iPhone 8 | iOS | 11.0 | Mobile Safari | 11.0 | | | | | X | 16 | | Apple iPhone 8 | iOS | 11.0 | Mobile Safari | 11.0 | | | | | X | 17 | | Apple iPhone SE | iOS | 11.2.1 | Mobile Safari | 11.0 | | | | | X | 18 | | Apple iPhone X | iOS | 11.2 | Mobile Safari | 11.0 | | | | | X | 19 | | Google Nexus 5X | Android | 7.0 | Chrome | 63.0.3239.111 | X | | X | | | 20 | | Google Nexus 6P | Android | 7.0 | Chrome | 63.0.3239.111 | X | | X | | | 21 | | Google Pixel 2 | Android | 8.0.0 | Chrome | 63.0.3239.111 | X | | X | | | 22 | | Google Pixel 2 | Android | 8.0.0 | Firefox | 51.0 | | X | X | | | 23 | | Google Pixel | Android | 7.1 | Chrome | 63.0.3239.111 | X | | X | | | 24 | | Google Pixel | Android | 8.0.0 | Chrome | 63.0.3239.111 | X | | X | | | 25 | | Google Pixel | Android | 8.0.0 | Firefox | 51.0 | | X | X | | | 26 | | LG G5 | Android | 6.0.1 | Chrome | 63.0.3239.111 | X | | X | | | 27 | | MacOS High Sierra | Mac OS | 10.13.3 | Chrome | 65.0.3325.181 | | | | X | | 28 | | MacOS High Sierra | Mac OS | 10.13 | Firefox | 59.0 | | | | X | | 29 | | MacOS High Sierra | Mac OS | 10.13.3 | Safari | 11.0.3 | | | | X | | 30 | | Motorola Moto X 2nd Gen | Android | 6.0 | Chrome | 63.0.3239.111 | | | X | | | 31 | | Oculus Go | Android | 7.1.2 | Oculus | 4.5.1.108860099 | X | X | X | | | 32 | | Samsung S6 | Android | 5.0.2 | Chrome | 63.0.3239.111 | X | | X | | | 33 | | Samsung S7 | Android | 6.0.1 | Chrome | 63.0.3239.111 | X | | X | | | 34 | | Samsung S7 | Android | 6.0.1 | Firefox | 51.0 | | X | X | | | 35 | | Samsung S8 | Android | 7.0 | Chrome | 63.0.3239.111 | X | | X | | | 36 | | Samsung S8 | Android | 7.0 | Firefox | 51.0 | | X | X | | | 37 | | Samsung S8+ | Android | 7.0 | Chrome | 63.0.3239.111 | X | | X | | | 38 | | Samsung S8+ | Android | 7.0 | Firefox | 51.0 | | X | X | | | 39 | | Windows 10 | Windows | 10 | Chrome | 65.0.3325.146 | | | X | X | | 40 | | Windows 10 | Windows | 10 | Edge | 14.14393 | | | | X | | 41 | | Windows 10 | Windows | 10 | Edge | 15.15063 | | | | X | | 42 | | Windows 10 | Windows | 10 | Edge | 16.16299 | | | | X | | 43 | | Windows 10 | Windows | 10 | Firefox | 59.0 | | | | X | | 44 | | Windows 10 | Windows | 10 | IE | 11.0 | | | | X | | 45 | | Windows 7 | Windows | 7 | IE | 10.0 | | | | | | 46 | | Windows 7 | Windows | 7 | IE | 11.0 | | | | X | | 47 | | Windows 8 | Windows | 8 | IE | 10.0 | | | | | | 48 | -------------------------------------------------------------------------------- /docs/SUPPORTED_PARAMETERS.md: -------------------------------------------------------------------------------- 1 | # Supported parameters 2 | 3 | ## ASTC 4 | 5 | - Compression tool: PVRTexTool (http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf) 6 | - Compression tool: ASTCenc (https://github.com/ARM-software/astc-encoder) 7 | - WebGL extension: https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/ 8 | 9 | Supported input types: 10 | 11 | ``` 12 | .jpeg 13 | .jpg 14 | .png 15 | .bmp 16 | .gif 17 | ``` 18 | 19 | Supported compression types: 20 | 21 | ``` 22 | ASTC_4x4 23 | ASTC_5x4 24 | ASTC_5x5 25 | ASTC_6x5 26 | ASTC_6x6 27 | ASTC_8x5 28 | ASTC_8x6 29 | ASTC_8x8 30 | ASTC_10x5 31 | ASTC_10x6 32 | ASTC_10x8 33 | ASTC_10x10 34 | ASTC_12x10 35 | ASTC_12x12 36 | ASTC_3x3x3 37 | ASTC_4x3x3 38 | ASTC_4x4x3 39 | ASTC_4x4x4 40 | ASTC_5x4x4 41 | ASTC_5x5x4 42 | ASTC_5x5x5 43 | ASTC_6x5x5 44 | ASTC_6x6x5 45 | ASTC_6x6x6 46 | ``` 47 | 48 | Supported quality types: 49 | 50 | ``` 51 | astcveryfast 52 | astcfast 53 | astcmedium 54 | astcthorough 55 | astcexhaustive 56 | ``` 57 | 58 | ## ETC 59 | 60 | - Compression tool: PVRTexTool (http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf) 61 | - WebGL extension: https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc/ 62 | 63 | Supported input types: 64 | 65 | ``` 66 | .jpeg 67 | .jpg 68 | .png 69 | .bmp 70 | ``` 71 | 72 | Supported compression types: 73 | 74 | ``` 75 | ETC1 76 | ETC2_RGBA 77 | ETC2_RGB 78 | ``` 79 | 80 | Supported quality types: 81 | 82 | ``` 83 | etcfast 84 | etcslow 85 | etcfastperceptual 86 | etcslowperceptual 87 | ``` 88 | 89 | ## PVRTC 90 | 91 | - Compression tool: PVRTexTool (http://cdn.imgtec.com/sdk-documentation/PVRTexTool.User+Manual.pdf) 92 | - WebGL extension: http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/ 93 | 94 | Supported input types: 95 | 96 | ``` 97 | .jpeg 98 | .jpg 99 | .png 100 | .bmp 101 | ``` 102 | 103 | Supported compression types: 104 | 105 | ``` 106 | PVRTC1_2 107 | PVRTC1_4 108 | PVRTC1_2_RGB 109 | PVRTC1_4_RGB 110 | ``` 111 | 112 | Supported quality types: 113 | 114 | ``` 115 | pvrtcfastest 116 | pvrtcfast 117 | pvrtcnormal 118 | pvrtchigh 119 | pvrtcbest 120 | ``` 121 | 122 | ## S3TC 123 | 124 | - Compression tool: Crunch (https://github.com/BinomialLLC/crunch/blob/235946f7a1cf8b9c97e8bf0e8062d5439a51dec7/crunch/crunch.cpp#L70-L181) 125 | - WebGL extension: http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ 126 | 127 | Supported input types: 128 | 129 | ``` 130 | .jpeg 131 | .jpg 132 | .png 133 | .bmp 134 | .gif 135 | ``` 136 | 137 | Supported compression types: 138 | 139 | ``` 140 | DXT1 141 | DXT1A 142 | DXT3 143 | DXT5 144 | ``` 145 | 146 | Supported quality types: 147 | 148 | ``` 149 | superfast 150 | fast 151 | normal 152 | better 153 | uber 154 | ``` 155 | -------------------------------------------------------------------------------- /docs/data/KTXLoader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author amakaseev / https://github.com/amakaseev 3 | * 4 | * for description see https://www.khronos.org/opengles/sdk/tools/KTX/ 5 | * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/ 6 | * 7 | * ported from https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.khronosTextureContainer.ts 8 | */ 9 | 10 | THREE.KTXLoader = function(manager) { 11 | THREE.CompressedTextureLoader.call(this, manager); 12 | }; 13 | 14 | THREE.KTXLoader.prototype = Object.assign(Object.create(THREE.CompressedTextureLoader.prototype), { 15 | constructor: THREE.KTXLoader, 16 | 17 | parse: function(buffer, loadMipmaps) { 18 | var ktx = new KhronosTextureContainer(buffer, 1); 19 | 20 | return { 21 | mipmaps: ktx.mipmaps(loadMipmaps), 22 | width: ktx.pixelWidth, 23 | height: ktx.pixelHeight, 24 | format: ktx.glInternalFormat, 25 | isCubemap: ktx.numberOfFaces === 6, 26 | mipmapCount: ktx.numberOfMipmapLevels, 27 | }; 28 | }, 29 | }); 30 | 31 | var KhronosTextureContainer = (function() { 32 | /** 33 | * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file 34 | * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or 35 | * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented 36 | * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented 37 | */ 38 | function KhronosTextureContainer( 39 | arrayBuffer, 40 | facesExpected /*, threeDExpected, textureArrayExpected */ 41 | ) { 42 | this.arrayBuffer = arrayBuffer; 43 | 44 | // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is: 45 | // '´', 'K', 'T', 'X', ' ', '1', '1', 'ª', '\r', '\n', '\x1A', '\n' 46 | // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A 47 | var identifier = new Uint8Array(this.arrayBuffer, 0, 12); 48 | if ( 49 | identifier[0] !== 0xab || 50 | identifier[1] !== 0x4b || 51 | identifier[2] !== 0x54 || 52 | identifier[3] !== 0x58 || 53 | identifier[4] !== 0x20 || 54 | identifier[5] !== 0x31 || 55 | identifier[6] !== 0x31 || 56 | identifier[7] !== 0xbb || 57 | identifier[8] !== 0x0d || 58 | identifier[9] !== 0x0a || 59 | identifier[10] !== 0x1a || 60 | identifier[11] !== 0x0a 61 | ) { 62 | console.error('texture missing KTX identifier'); 63 | return; 64 | } 65 | 66 | // load the reset of the header in native 32 bit uint 67 | var dataSize = Uint32Array.BYTES_PER_ELEMENT; 68 | var headerDataView = new DataView(this.arrayBuffer, 12, 13 * dataSize); 69 | var endianness = headerDataView.getUint32(0, true); 70 | var littleEndian = endianness === 0x04030201; 71 | 72 | this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures 73 | this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures 74 | this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures 75 | this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,) 76 | this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only) 77 | this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,) 78 | this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,) 79 | this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,) 80 | this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays 81 | this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6 82 | this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures 83 | this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data 84 | 85 | // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing. 86 | if (this.glType !== 0) { 87 | console.warn('only compressed formats currently supported'); 88 | return; 89 | } else { 90 | // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard. 91 | this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels); 92 | } 93 | if (this.pixelHeight === 0 || this.pixelDepth !== 0) { 94 | console.warn('only 2D textures currently supported'); 95 | return; 96 | } 97 | if (this.numberOfArrayElements !== 0) { 98 | console.warn('texture arrays not currently supported'); 99 | return; 100 | } 101 | if (this.numberOfFaces !== facesExpected) { 102 | console.warn( 103 | 'number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces 104 | ); 105 | return; 106 | } 107 | // we now have a completely validated file, so could use existence of loadType as success 108 | // would need to make this more elaborate & adjust checks above to support more than one load type 109 | this.loadType = KhronosTextureContainer.COMPRESSED_2D; 110 | } 111 | 112 | // return mipmaps for THREE.js 113 | KhronosTextureContainer.prototype.mipmaps = function(loadMipmaps) { 114 | var mipmaps = []; 115 | 116 | // initialize width & height for level 1 117 | var dataOffset = KhronosTextureContainer.HEADER_LEN + this.bytesOfKeyValueData; 118 | var width = this.pixelWidth; 119 | var height = this.pixelHeight; 120 | var mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1; 121 | 122 | for (var level = 0; level < mipmapCount; level++) { 123 | var imageSize = new Int32Array(this.arrayBuffer, dataOffset, 1)[0]; // size per face, since not supporting array cubemaps 124 | dataOffset += 4; // size of the image + 4 for the imageSize field 125 | 126 | for (var face = 0; face < this.numberOfFaces; face++) { 127 | var byteArray = new Uint8Array(this.arrayBuffer, dataOffset, imageSize); 128 | 129 | mipmaps.push({ data: byteArray, width: width, height: height }); 130 | 131 | dataOffset += imageSize; 132 | dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image 133 | } 134 | width = Math.max(1.0, width * 0.5); 135 | height = Math.max(1.0, height * 0.5); 136 | } 137 | 138 | return mipmaps; 139 | }; 140 | 141 | KhronosTextureContainer.HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs) 142 | // load types 143 | KhronosTextureContainer.COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D() 144 | KhronosTextureContainer.COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D() 145 | KhronosTextureContainer.TEX_2D = 2; // uses a gl.texImage2D() 146 | KhronosTextureContainer.TEX_3D = 3; // uses a gl.texImage3D() 147 | 148 | return KhronosTextureContainer; 149 | })(); 150 | -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-astc-4x4.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-astc-4x4.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-astc-8x8.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-astc-8x8.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-dxt1.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-dxt1.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-dxt1A.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-dxt1A.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-dxt3.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-dxt3.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-dxt5.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-dxt5.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-etc1.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-etc1.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-etc2.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-etc2.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-etc2A.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-etc2A.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-pvrtc2BPP.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-pvrtc2BPP.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-pvrtc2BPPA.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-pvrtc2BPPA.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-pvrtc4BPP.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-pvrtc4BPP.ktx -------------------------------------------------------------------------------- /docs/data/flippedY-mipmaps/example-pvrtc4BPPA.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimvanScherpenzeel/texture-compressor/4a221232b26eb8f8d56762d36e3aed7066cf863c/docs/data/flippedY-mipmaps/example-pvrtc4BPPA.ktx -------------------------------------------------------------------------------- /docs/data/main.js: -------------------------------------------------------------------------------- 1 | var camera, scene, renderer; 2 | var meshes = []; 3 | 4 | init(); 5 | animate(); 6 | 7 | function init() { 8 | var appElement = document.getElementById('app'); 9 | 10 | renderer = new THREE.WebGLRenderer({ antialias: true }); 11 | renderer.setClearColor(0x000000, 1); 12 | renderer.setPixelRatio(window.devicePixelRatio); 13 | renderer.setSize(window.innerWidth, window.innerHeight); 14 | document.body.appendChild(renderer.domElement); 15 | 16 | var formats = { 17 | astc: renderer.extensions.get('WEBGL_compressed_texture_astc'), 18 | etc1: renderer.extensions.get('WEBGL_compressed_texture_etc1'), 19 | etc2: renderer.extensions.get('WEBGL_compressed_texture_etc'), 20 | s3tc: renderer.extensions.get('WEBGL_compressed_texture_s3tc'), 21 | pvrtc: renderer.extensions.get('WEBGL_compressed_texture_pvrtc'), 22 | }; 23 | 24 | camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); 25 | camera.position.z = 1000; 26 | 27 | scene = new THREE.Scene(); 28 | 29 | var geometry = new THREE.PlaneGeometry(200, 200, 200); 30 | var material1, material2, material3, material4; 31 | 32 | var loader = new THREE.KTXLoader(); 33 | 34 | if (formats.astc) { 35 | material1 = new THREE.MeshBasicMaterial({ 36 | map: loader.load('./data/' + type + '/example-astc-4x4.ktx', function(texture) { 37 | texture.magFilter = THREE.LinearFilter; 38 | texture.minFilter = 39 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 40 | }), 41 | }); 42 | appElement.appendChild(document.createTextNode(' ASTC-4x4 ')); 43 | meshes.push(new THREE.Mesh(geometry, material1)); 44 | 45 | material2 = new THREE.MeshBasicMaterial({ 46 | map: loader.load('./data/' + type + '/example-astc-8x8.ktx', function(texture) { 47 | texture.magFilter = THREE.LinearFilter; 48 | texture.minFilter = 49 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 50 | }), 51 | }); 52 | appElement.appendChild(document.createTextNode(' ASTC-8x8 ')); 53 | meshes.push(new THREE.Mesh(geometry, material2)); 54 | } 55 | 56 | if (formats.etc1) { 57 | material1 = new THREE.MeshBasicMaterial({ 58 | map: loader.load('./data/' + type + '/example-etc1.ktx', function(texture) { 59 | texture.magFilter = THREE.LinearFilter; 60 | texture.minFilter = 61 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 62 | }), 63 | }); 64 | appElement.appendChild(document.createTextNode(' ETC1 ')); 65 | meshes.push(new THREE.Mesh(geometry, material1)); 66 | } 67 | 68 | if (formats.etc2) { 69 | material1 = new THREE.MeshBasicMaterial({ 70 | map: loader.load('./data/' + type + '/example-etc2.ktx', function(texture) { 71 | texture.magFilter = THREE.LinearFilter; 72 | texture.minFilter = 73 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 74 | }), 75 | }); 76 | appElement.appendChild(document.createTextNode(' ETC2 ')); 77 | meshes.push(new THREE.Mesh(geometry, material1)); 78 | 79 | material2 = new THREE.MeshBasicMaterial({ 80 | map: loader.load('./data/' + type + '/example-etc2A.ktx', function(texture) { 81 | texture.magFilter = THREE.LinearFilter; 82 | texture.minFilter = 83 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 84 | }), 85 | }); 86 | appElement.appendChild(document.createTextNode(' ETC2A ')); 87 | meshes.push(new THREE.Mesh(geometry, material2)); 88 | } 89 | 90 | if (formats.pvrtc) { 91 | material1 = new THREE.MeshBasicMaterial({ 92 | map: loader.load('./data/' + type + '/example-pvrtc2BPP.ktx', function(texture) { 93 | texture.magFilter = THREE.LinearFilter; 94 | texture.minFilter = 95 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 96 | }), 97 | }); 98 | appElement.appendChild(document.createTextNode(' PVRTC-2BPP ')); 99 | meshes.push(new THREE.Mesh(geometry, material1)); 100 | 101 | material2 = new THREE.MeshBasicMaterial({ 102 | map: loader.load('./data/' + type + '/example-pvrtc2BPPA.ktx', function(texture) { 103 | texture.magFilter = THREE.LinearFilter; 104 | texture.minFilter = 105 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 106 | }), 107 | }); 108 | appElement.appendChild(document.createTextNode(' PVRTC-2BPPA ')); 109 | meshes.push(new THREE.Mesh(geometry, material2)); 110 | 111 | material3 = new THREE.MeshBasicMaterial({ 112 | map: loader.load('./data/' + type + '/example-pvrtc4BPP.ktx', function(texture) { 113 | texture.magFilter = THREE.LinearFilter; 114 | texture.minFilter = 115 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 116 | }), 117 | }); 118 | appElement.appendChild(document.createTextNode(' PVRTC-4BPP ')); 119 | meshes.push(new THREE.Mesh(geometry, material3)); 120 | 121 | material4 = new THREE.MeshBasicMaterial({ 122 | map: loader.load('./data/' + type + '/example-pvrtc4BPPA.ktx', function(texture) { 123 | texture.magFilter = THREE.LinearFilter; 124 | texture.minFilter = 125 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 126 | }), 127 | }); 128 | appElement.appendChild(document.createTextNode(' PVRTC-4BPPA ')); 129 | meshes.push(new THREE.Mesh(geometry, material4)); 130 | } 131 | 132 | if (formats.s3tc) { 133 | material1 = new THREE.MeshBasicMaterial({ 134 | map: loader.load('./data/' + type + '/example-dxt1.ktx', function(texture) { 135 | texture.magFilter = THREE.LinearFilter; 136 | texture.minFilter = 137 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 138 | }), 139 | }); 140 | appElement.appendChild(document.createTextNode(' DXT1 ')); 141 | meshes.push(new THREE.Mesh(geometry, material1)); 142 | 143 | material2 = new THREE.MeshBasicMaterial({ 144 | map: loader.load('./data/' + type + '/example-dxt1A.ktx', function(texture) { 145 | texture.magFilter = THREE.LinearFilter; 146 | texture.minFilter = 147 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 148 | }), 149 | }); 150 | appElement.appendChild(document.createTextNode(' DXT1A ')); 151 | meshes.push(new THREE.Mesh(geometry, material2)); 152 | 153 | material3 = new THREE.MeshBasicMaterial({ 154 | map: loader.load('./data/' + type + '/example-dxt3.ktx', function(texture) { 155 | texture.magFilter = THREE.LinearFilter; 156 | texture.minFilter = 157 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 158 | }), 159 | }); 160 | appElement.appendChild(document.createTextNode(' DXT3 ')); 161 | meshes.push(new THREE.Mesh(geometry, material3)); 162 | 163 | material4 = new THREE.MeshBasicMaterial({ 164 | map: loader.load('./data/' + type + '/example-dxt5.ktx', function(texture) { 165 | texture.magFilter = THREE.LinearFilter; 166 | texture.minFilter = 167 | type === 'flippedY-mipmaps' ? THREE.LinearMipMapLinearFilter : THREE.LinearFilter; 168 | }), 169 | }); 170 | appElement.appendChild(document.createTextNode(' DXT5 ')); 171 | meshes.push(new THREE.Mesh(geometry, material4)); 172 | } 173 | 174 | var x = (-meshes.length / 2) * 225; 175 | for (var i = 0; i < meshes.length; ++i, x += 300) { 176 | var mesh = meshes[i]; 177 | mesh.position.x = x; 178 | mesh.position.y = 0; 179 | scene.add(mesh); 180 | } 181 | 182 | window.addEventListener('resize', onWindowResize, false); 183 | } 184 | 185 | function onWindowResize() { 186 | camera.aspect = window.innerWidth / window.innerHeight; 187 | camera.updateProjectionMatrix(); 188 | 189 | renderer.setSize(window.innerWidth, window.innerHeight); 190 | } 191 | 192 | function animate() { 193 | requestAnimationFrame(animate); 194 | renderer.render(scene, camera); 195 | } 196 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |