Add ETC support to mipgen / imageio / suzanne.

This shrinks file size as follows, although it seems to darken the
rendered result.

```
  1398209 Oct  2 16:22 ao.ktx
   699172 Oct  2 16:20 ao_etc.ktx
  1398209 Oct  2 16:22 metallic.ktx
   699172 Oct  2 16:19 metallic_etc.ktx
  1398209 Oct  2 16:22 roughness.ktx
   699172 Oct  2 16:20 roughness_etc.ktx
```
This commit is contained in:
Philip Rideout
2018-10-02 11:32:09 -07:00
parent 2eeb92fc4c
commit cc61e4649b
9 changed files with 236 additions and 45 deletions

View File

@@ -66,14 +66,6 @@ static Texture* setTextureParameter(Engine& engine, filaweb::Asset& asset, strin
asset->texture.reset();
};
Texture::Format format;
switch (info.glTypeSize) {
case 1: format = Texture::Format::R; break;
case 2: format = Texture::Format::RG; break;
case 3: format = Texture::Format::RGB; break;
case 4: format = Texture::Format::RGBA; break;
}
uint8_t* data;
uint32_t nbytes;
asset.texture->getBlob({}, &data, &nbytes);
@@ -97,6 +89,14 @@ static Texture* setTextureParameter(Engine& engine, filaweb::Asset& asset, strin
return texture;
}
Texture::Format format;
switch (info.glTypeSize) {
case 1: format = Texture::Format::R; break;
case 2: format = Texture::Format::RG; break;
case 3: format = Texture::Format::RGB; break;
case 4: format = Texture::Format::RGBA; break;
}
Texture::PixelBufferDescriptor pb(data, nbytes, format, Texture::Type::UBYTE, destructor,
&asset);