|
1 | 1 | <h1 align="center"> |
2 | | - Crunch |
| 2 | + Crunch 2 |
3 | 3 | </h1> |
4 | 4 |
|
5 | 5 | <h4 align="center">An advanced DXTn texture compression library</h4> |
6 | 6 |
|
7 | 7 | <p align="center"> |
8 | | - <a href="https://github.com/FrozenStormInteractive/crunch/releases"><img src="https://img.shields.io/github/v/release/FrozenStormInteractive/crunch?sort=semver" alt="Gitter"></a> |
9 | | - <a href="https://github.com/FrozenStormInteractive/crunch/stargazers"><img src="https://img.shields.io/github/stars/FrozenStormInteractive/crunch.svg"></a> |
10 | | - <a href="https://github.com/FrozenStormInteractive/crunch/issues"><img src="https://img.shields.io/github/issues/FrozenStormInteractive/crunch.svg"></a> |
11 | | - <a href="https://github.com/FrozenStormInteractive/crunch/pulls"><img src="https://img.shields.io/github/issues-pr/FrozenStormInteractive/crunch"></a> |
12 | | - <a href="https://github.com/FrozenStormInteractive/crunch/graphs/contributors"><img src="https://img.shields.io/github/contributors-anon/FrozenStormInteractive/crunch.svg"></a> |
13 | | - <a href="https://github.com/FrozenStormInteractive/crunch/issues"><img src="https://img.shields.io/badge/contributions-welcome-orange.svg"></a> |
| 8 | + <a href="https://github.com/FrozenStormInteractive/Crunch2/releases"><img src="https://img.shields.io/github/v/release/FrozenStormInteractive/Crunch2?sort=semver" alt="Gitter"></a> |
| 9 | + <a href="https://github.com/FrozenStormInteractive/Crunch2/stargazers"><img src="https://img.shields.io/github/stars/FrozenStormInteractive/Crunch2.svg"></a> |
| 10 | + <a href="https://github.com/FrozenStormInteractive/Crunch2/issues"><img src="https://img.shields.io/github/issues/FrozenStormInteractive/Crunch2.svg"></a> |
| 11 | + <a href="https://github.com/FrozenStormInteractive/Crunch2/pulls"><img src="https://img.shields.io/github/issues-pr/FrozenStormInteractive/Crunch2"></a> |
| 12 | + <a href="https://github.com/FrozenStormInteractive/Crunch2/graphs/contributors"><img src="https://img.shields.io/github/contributors-anon/FrozenStormInteractive/Crunch2.svg"></a> |
| 13 | + <a href="https://github.com/FrozenStormInteractive/Crunch2/issues"><img src="https://img.shields.io/badge/contributions-welcome-orange.svg"></a> |
14 | 14 | <a href="License.md"><img src="https://img.shields.io/badge/license-Zlib-blue.svg"></a> |
15 | 15 | </p> |
16 | 16 |
|
17 | 17 | ## Table of Contents |
18 | 18 |
|
19 | 19 | * [Built Status](#built-status) |
20 | 20 | * [Overview](#overview) |
21 | | -* [Building](#building) |
| 21 | +* [Crunch2 VS Crunch](#crunch2-vs-crunch) |
| 22 | +* [Installation](#installation) |
22 | 23 | * [Usage](#usage) |
23 | 24 | * [Examples](#examples) |
24 | 25 | * [Known Issues / Bugs](#known-issues--bugs) |
|
34 | 35 |
|
35 | 36 | ## Overview |
36 | 37 |
|
37 | | -crnlib is a lossy texture compression library for developers that ship |
38 | | -content using the DXT1/5/N or 3DC compressed color/normal map/cubemap |
39 | | -mipmapped texture formats. It was written by the same author as the open |
40 | | -source [LZHAM compression library](http://code.google.com/p/lzham/). |
| 38 | +Crunch2 is a fork of crunch, a lossy texture compression tool and |
| 39 | +library for developers that ship content using the DXT1/5/N or 3DC |
| 40 | +compressed color/normal map/cubemapmipmapped texture formats. It was |
| 41 | +written by the same author as the open source |
| 42 | +[LZHAM compression library](http://code.google.com/p/lzham/). |
41 | 43 |
|
42 | 44 | It can compress mipmapped 2D textures, normal maps, and cubemaps to |
43 | 45 | approx. 1-1.25 bits/texel, and normal maps to 1.75-2 bits/texel. The |
@@ -144,21 +146,60 @@ found that support .KTX are fairly (to very) buggy, or are limited to only a han |
144 | 146 | of pixel formats, so there's no guarantee that the .KTX files written by crnlib can |
145 | 147 | be reliably read by other tools. |
146 | 148 |
|
147 | | -## Building |
| 149 | +## Crunch2 VS Crunch |
148 | 150 |
|
149 | | -```sh |
150 | | -cmake -S . -B build -DCRN_BUILD_SHARED_LIBS=ON |
151 | | -``` |
| 151 | +Crunch2 is a fork of crunch, the lossy texture compression tool |
| 152 | +written by Richard Geldreich, Jr. |
152 | 153 |
|
153 | | -### Compile to Javascript with Emscripten |
| 154 | +Crunch2 provides some features to its predecessor: |
| 155 | + - Updates and bug fixes |
| 156 | + - Shared library |
| 157 | + - Support for Linux and macOS |
| 158 | + - CI pipeline |
| 159 | + - Easy build with [CMake](https://cmake.org) |
| 160 | + - Dependency management with [Conan](https://conan.io) |
154 | 161 |
|
155 | | -Download and install Emscripten: |
156 | | - http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html |
| 162 | +Crunch2 isn't a rewrite of crunch, just an improvement. Our main goal is to keep |
| 163 | +the compatibility with the old crnlib API. |
157 | 164 |
|
158 | | -From the root directory, run: |
159 | | -```sh |
160 | | -emcc -O3 emscripten/crunch_lib.cpp -I./inc -s EXPORTED_FUNCTIONS="['_malloc', '_free', '_crn_get_width', '_crn_get_height', '_crn_get_levels', '_crn_get_dxt_format', '_crn_get_bytes_per_block', '_crn_get_uncompressed_size', '_crn_decompress']" -s NO_EXIT_RUNTIME=1 -s NO_FILESYSTEM=1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --memory-init-file 0 -o crunch.js |
161 | | -``` |
| 165 | +## Installation |
| 166 | + |
| 167 | +### From binary |
| 168 | + |
| 169 | +Download Crunch2 binary from [GitHub releases page](https://github.com/FrozenStormInteractive/Crunch2/releases). Each release provides binaries for Windows, Linux and macOS. |
| 170 | + |
| 171 | +### Building from source |
| 172 | + |
| 173 | + 1. Install the prerequisites. |
| 174 | + - [CMake](https://cmake.org) |
| 175 | + |
| 176 | + 2. Download Crunch2 sources from [GitHub](https://github.com/FrozenStormInteractive/Crunch2/releases) and unpack the distribution archive somewhere on disk. |
| 177 | + |
| 178 | + 3. Generate build files with [CMake](https://cmake.org). |
| 179 | + ```sh |
| 180 | + cmake -S . -B build -DCRN_BUILD_SHARED_LIBS=ON |
| 181 | + ``` |
| 182 | + |
| 183 | + 4. Build crunch2 with the generated build files or use [CMake](https://cmake.org). |
| 184 | + ```sh |
| 185 | + cmake --build build |
| 186 | + ``` |
| 187 | + |
| 188 | + 5. (Optional) Export distribution files with install target or use [CMake](https://cmake.org) (You must provide `CMAKE_INSTALL_PREFIX`). |
| 189 | + ```sh |
| 190 | + cmake --install build |
| 191 | + ``` |
| 192 | + |
| 193 | +#### Compile to Javascript with Emscripten |
| 194 | + |
| 195 | + 1. Download and install [Emscripten](https://emscripten.org/docs/getting_started/downloads.html) |
| 196 | + |
| 197 | + 2. Download Crunch2 sources from [GitHub](https://github.com/FrozenStormInteractive/Crunch2/releases) and unpack the distribution archive somewhere on disk. |
| 198 | + |
| 199 | + 3. From the root directory, run: |
| 200 | + ```sh |
| 201 | + emcc -O3 emscripten/crunch_lib.cpp -I./inc -s EXPORTED_FUNCTIONS="['_malloc', '_free', '_crn_get_width', '_crn_get_height', '_crn_get_levels', '_crn_get_dxt_format', '_crn_get_bytes_per_block', '_crn_get_uncompressed_size', '_crn_decompress']" -s NO_EXIT_RUNTIME=1 -s NO_FILESYSTEM=1 -s ELIMINATE_DUPLICATE_FUNCTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --memory-init-file 0 -o crunch.js |
| 202 | + ``` |
162 | 203 |
|
163 | 204 | ## Usage |
164 | 205 |
|
@@ -324,25 +365,29 @@ compression is supported when writing to ETC1, and .CRN does not support ETC1. |
324 | 365 |
|
325 | 366 | ## Contributing |
326 | 367 |
|
327 | | -Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. |
| 368 | +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, |
| 369 | +and the process for submitting pull requests to us. |
328 | 370 |
|
329 | 371 | ## License |
330 | 372 |
|
331 | | -This project is licensed under the Zlib License - see the [LICENSE.md](LICENSE.md) file for details |
| 373 | +This project is licensed under the Zlib License - see the [LICENSE.md](LICENSE.md) file for details. |
332 | 374 |
|
333 | | -Copyright (C) 2010-2017 Richard Geldreich, Jr. and Binomial LLC http://binomial.info |
| 375 | +``` |
| 376 | +Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC |
| 377 | +Copyright (c) 2020 FrozenStorm Interactive, Yoann Potinet |
| 378 | +``` |
334 | 379 |
|
335 | 380 | Portions of this software make use of public domain code originally |
336 | | -written by Igor Pavlov (LZMA), RYG (crn_ryg_dxt*), and Sean Barrett (stb_image.c). |
| 381 | +written by Igor Pavlov (LZMA), and Sean Barrett (stb) and Fabian "ryg" Giesen (stb_dxt). |
337 | 382 |
|
338 | 383 | <!-- urls --> |
339 | 384 |
|
340 | | -[Build Status Master Windows]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/7/master?stage=Build&job=Windows "Build Status Master Windows" |
341 | | -[Build Status Master Linux]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/7/master?stage=Build&job=Linux "Build Status Master Linux" |
342 | | -[Build Status Master macOS]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/7/master?stage=Build&job=macOS "Build Status Master macOS" |
343 | | -[Build Status Develop Windows]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/7/develop?stage=Build&job=Windows "Build Status Develop Windows" |
344 | | -[Build Status Develop Linux]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/7/develop?stage=Build&job=Linux "Build Status Develop Linux" |
345 | | -[Build Status Develop macOS]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/7/develop?stage=Build&job=macOS "Build Status Develop macOS" |
| 385 | +[Build Status Master Windows]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/8/master?stage=Build&job=Windows "Build Status Master Windows" |
| 386 | +[Build Status Master Linux]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/8/master?stage=Build&job=Linux "Build Status Master Linux" |
| 387 | +[Build Status Master macOS]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/8/master?stage=Build&job=macOS "Build Status Master macOS" |
| 388 | +[Build Status Develop Windows]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/8/develop?stage=Build&job=Windows "Build Status Develop Windows" |
| 389 | +[Build Status Develop Linux]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/8/develop?stage=Build&job=Linux "Build Status Develop Linux" |
| 390 | +[Build Status Develop macOS]: https://img.shields.io/azure-devops/build/FrozenStormInteractive/0e954e31-9ab2-40af-908f-dede5858bfed/8/develop?stage=Build&job=macOS "Build Status Develop macOS" |
346 | 391 |
|
347 | | -[Latest Master Build]: https://dev.azure.com/FrozenStormInteractive/Crunch/_build/latest?definitionId=7&branchName=master |
348 | | -[Latest Develop Build]: https://dev.azure.com/FrozenStormInteractive/Crunch/_build/latest?definitionId=7&branchName=develop |
| 392 | +[Latest Master Build]: https://dev.azure.com/FrozenStormInteractive/Crunch2/_build/latest?definitionId=8&branchName=master |
| 393 | +[Latest Develop Build]: https://dev.azure.com/FrozenStormInteractive/Crunch2/_build/latest?definitionId=8&branchName=develop |
0 commit comments