Skip to content

Commit ce2022f

Browse files
committed
Merge branch 'release/1.2.0'
2 parents 26adf95 + 53ff69f commit ce2022f

File tree

14 files changed

+165
-96
lines changed

14 files changed

+165
-96
lines changed

CHANGELOG.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.1)
2-
project(crunch VERSION "1.1.1")
2+
project(Crunch2 VERSION "1.2.0")
33

44
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
55
include("${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Contributing
2+
3+
One of the easiest ways to contribute is to participate in discussions on GitHub issues. You can also contribute by
4+
submitting pull requests with code changes.
5+
6+
Please note we have a code of conduct, please follow it in all your interactions with the project.
7+
8+
## General feedback, discussions, bugs and feature requests
9+
10+
Start a discussion on the [issue tracker](https://github.com/FrozenStormInteractive/Crunch2/issues).
11+
12+
## Pull Request Process
13+
14+
Please first discuss the change you wish to make via issue, email, or any other method with the owners of this
15+
repository before making a change.
16+
17+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
18+
build.
19+
2. Update the README.md with details of changes to the interface, this includes new environment
20+
variables, exposed ports, useful file locations and container parameters.
21+
3. You may merge the Pull Request in once you have the sign-off of other developers, or if you
22+
do not have permission to do that, you may request the second reviewer to merge it for you.
23+
24+
## Code of Conduct
25+
26+
This project has adopted the [Contributor Covenant Code of Conduct](https://github.com/FrozenStormInteractive/Code-of-Conduct/blob/master/CODE_OF_CONDUCT.md).

README.md

Lines changed: 80 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
<h1 align="center">
2-
Crunch
2+
Crunch 2
33
</h1>
44

55
<h4 align="center">An advanced DXTn texture compression library</h4>
66

77
<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>
1414
<a href="License.md"><img src="https://img.shields.io/badge/license-Zlib-blue.svg"></a>
1515
</p>
1616

1717
## Table of Contents
1818

1919
* [Built Status](#built-status)
2020
* [Overview](#overview)
21-
* [Building](#building)
21+
* [Crunch2 VS Crunch](#crunch2-vs-crunch)
22+
* [Installation](#installation)
2223
* [Usage](#usage)
2324
* [Examples](#examples)
2425
* [Known Issues / Bugs](#known-issues--bugs)
@@ -34,10 +35,11 @@
3435

3536
## Overview
3637

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/).
4143

4244
It can compress mipmapped 2D textures, normal maps, and cubemaps to
4345
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
144146
of pixel formats, so there's no guarantee that the .KTX files written by crnlib can
145147
be reliably read by other tools.
146148

147-
## Building
149+
## Crunch2 VS Crunch
148150

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.
152153

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)
154161

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.
157164

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+
```
162203

163204
## Usage
164205

@@ -324,25 +365,29 @@ compression is supported when writing to ETC1, and .CRN does not support ETC1.
324365

325366
## Contributing
326367

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.
328370

329371
## License
330372

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.
332374

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+
```
334379

335380
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).
337382

338383
<!-- urls -->
339384

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"
346391

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

conanfile.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import os
22
from conans import ConanFile, CMake, tools
33

4-
class CrunchConan(ConanFile):
5-
name = "crunch"
4+
class Crunch2Conan(ConanFile):
5+
name = "crunch2"
66
description = "Advanced DXTc texture compression and transcoding library"
7-
homepage = "https://github.com/FrozenStormInteractive/Crunch"
8-
url = "https://github.com/FrozenStormInteractive/Crunch"
7+
homepage = "https://github.com/FrozenStormInteractive/Crunch2"
8+
url = "https://github.com/FrozenStormInteractive/Crunch2"
99
license = "Zlib"
1010
topics = ("conan", "crunch", "texture", "compression", "decompression", "transcoding")
1111
settings = "os", "compiler", "arch", "build_type"
12+
exports_sources = ["CMakeLists.txt", "license.txt", "crnlib/*", "crunch/*", "inc/*", "3rdparty/*"]
13+
generators = "cmake"
1214
options = {
1315
"fPIC": [True, False],
1416
"shared": [True, False],
@@ -17,9 +19,7 @@ class CrunchConan(ConanFile):
1719
"fPIC": True,
1820
"shared": False,
1921
}
20-
exports_sources = ["CMakeLists.txt", "crnlib/*", "crunch/*", "inc/*", "3rdparty/*"]
21-
generators = "cmake"
22-
22+
2323
_cmake = None
2424

2525
@property
@@ -48,7 +48,7 @@ def build(self):
4848
cmake.build()
4949

5050
def package(self):
51-
self.copy("LICENSE", src=self.source_folder, dst="licenses")
51+
self.copy("license.txt", src=self.source_folder, dst="licenses")
5252
cmake = self._configure_cmake()
5353
cmake.install()
5454

crnlib/crn_core.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
// File: crn_core.cpp
22
// See Copyright Notice and license at the end of inc/crnlib.h
3-
#include "crn_core.h"
43

5-
#if CRNLIB_USE_WIN32_API
6-
#include "crn_winhdr.h"
7-
#endif
4+
#include "crn_core.h"
85

9-
namespace crnlib {
10-
const char* g_copyright_str = "Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC";
11-
const char* g_sig_str = "C8cfRlaorj0wLtnMSxrBJxTC85rho2L9hUZKHcBL";
6+
namespace crnlib
7+
{
128

139
} // namespace crnlib

crunch/crunch.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ class crunch
8888
console::printf("-file @list.txt - List of files to convert.");
8989
console::printf("Supported source file formats: dds,ktx,crn,tga,bmp,png,jpg/jpeg,psd");
9090
console::printf("Note: Some file format variants are unsupported.");
91-
console::printf("See the docs for stb_image.c: http://www.nothings.org/stb_image.c");
92-
console::printf("Progressive JPEG files are supported, see: http://code.google.com/p/jpeg-compressor/");
9391

9492
console::message("\nPath/file related parameters:");
9593
console::printf("-out filename - Output filename");
@@ -189,7 +187,7 @@ class crunch
189187
console::printf("-%s", pixel_format_helpers::get_pixel_format_string(fmt));
190188
}
191189

192-
console::printf("\nFor bugs, support, or feedback: info@binomial.info");
190+
console::printf("\nFor bugs, support, or feedback: https://github.com/FrozenStormInteractive/Crunch2");
193191
}
194192

195193
bool convert(const char* pCommand_line)
@@ -1410,8 +1408,11 @@ static bool check_for_option(int argc, char* argv[], const char* pOption)
14101408

14111409
static void print_title()
14121410
{
1413-
console::printf("crunch: Advanced DXTn Texture Compressor - https://github.com/BinomialLLC/crunch");
1411+
console::printf("crunch - Advanced DXTn Texture Compressor - https://github.com/FrozenStormInteractive/Crunch2");
1412+
console::printf("");
14141413
console::printf("Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC");
1414+
console::printf("Copyright (c) 2020 FrozenStorm Interactive, Yoann Potinet");
1415+
console::printf("");
14151416
console::printf("crnlib version %s %s Built %s, %s", crn_get_version(), crnlib_is_x64() ? "x64" : "x86", __DATE__, __TIME__);
14161417
console::printf("");
14171418
}
@@ -1432,6 +1433,17 @@ static int main_internal(int argc, char* argv[])
14321433

14331434
print_title();
14341435

1436+
if (check_for_option(argc, argv, "version"))
1437+
{
1438+
return EXIT_SUCCESS;
1439+
}
1440+
1441+
if (check_for_option(argc, argv, "help"))
1442+
{
1443+
crunch::print_usage();
1444+
return EXIT_SUCCESS;
1445+
}
1446+
14351447
dynamic_string cmd_line;
14361448
get_command_line_as_single_string(cmd_line, argc, argv);
14371449

examples/example1/example1.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const int cDefaultCRNQualityLevel = 128;
3737
static int print_usage() {
3838
printf("Description: Simple crnlib API example program.\n");
3939
printf("Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC\n");
40+
printf("Copyright (c) 2020 FrozenStorm Interactive, Yoann Potinet\n");
4041
printf("Usage: example1 [mode: i/c/d] [source_file] [options]\n");
4142
printf("\nModes:\n");
4243
printf("c: Compress to .DDS or .CRN using the crn_compress() func. in crnlib.h\n");

examples/example2/example2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ using namespace crnlib;
2424
static int print_usage() {
2525
printf("Description: Transcodes .CRN to .DDS files using crn_decomp.h.\n");
2626
printf("Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC\n");
27+
printf("Copyright (c) 2020 FrozenStorm Interactive, Yoann Potinet\n");
2728
printf("Usage: example2 [source_file] [options]\n");
2829
printf("\nOptions:\n");
2930
printf("-out filename - Force output filename.\n");

examples/example3/example3.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const unsigned int cDXTBlockSize = 4;
3434

3535
static int print_usage() {
3636
printf("Description: Simple .DDS DXTn block compression using crnlib.\n");
37-
printf("Copyright (c) 2010-2016 Binomial LLC\n");
37+
printf("Copyright (c) 2010-2016 Richard Geldreich, Jr. and Binomial LLC\n");
38+
printf("Copyright (c) 2020 FrozenStorm Interactive, Yoann Potinet\n");
3839
printf("Usage: example3 [source_file] [options]\n");
3940
printf("\n");
4041
printf("Note: This simple example is not multithreaded, so it's not going to be\n");

0 commit comments

Comments
 (0)