libgdx/libgdx — pull request #2525 by vmilea (2014-10-30 17:29:30+00:00)
Title: TextureAtlas - ETC1 compression with transparency

This adds a few of things:

1. Support for `outputFormat: etc1` to the `TexturePacker`.
2. An additional packer property `maskFormat: none / png / jpg / etc1` to export the alpha channel as a separate assset.
3. Support for loading and rendering masked textures.

Main drawback of etc1 is lack of support for transparency but there are some [workarounds]( http://malideveloper.arm.com/develop-for-mali/sample-code/etcv1-texture-compression-and-alpha-channels). Methods 2 & 3 from the article are currently implemented.

At runtime, the mask gets loaded automatically along with the main texture. The two textures are wrapped into a `CompositeTexture` and bound to different texture units. The only requirement on the user's part is to apply the `MaskShader` which mixes color with mask alpha. Please see the included test.

In practice:

* assets that need transparency but don't compress well as png can now be stored in a lossy format. My app size dropped around 3x.
* vram savings:
- 6x from RGB888 to ETC1_RGB8
- 4x from RGBA8888 to (ETC1_RGB8 + ETC1_RGB8)
- 2.6x from RGBA8888 to (ETC1_RGB8 + LUMINANCE)

P.S. sorry for Luminance hack, I try not to touch native gdx2d