In most places this is simply replaced by `std::string_view`.
We also change a few internal/private headers so they accept
`std::string_view` instead of `utils::CString`.
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.
This PR does not add KTX2 support to glTF, but it's on the way.
`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.
`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:
bool requestFormat(Texture::InternalFormat format);
Filament::Texture* load(const uint8_t* data, size_t size);
The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.
IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.
Partial fix for #4771.
These constants are not part of the standard. We instead use our own
constexpr definitions in the filament::math namespace, as part of
the scalar.h include.
Background: with the Vulkan backend, RGB8 textures do
not work (at least not on my hadrware). This makes me unable to run some
examples, because they use normal maps in RGB8 format.
It appears that the following commit addresses the problem by adding a
special command line option to mipgen:
8dda07bf2c
However, processing normal maps with this option does not work: certain
assertions in the image library fail.
This PR changes these functions in the image library to handle 4-channel
images instead of failing.
In a lot of case the StaticString hash can be computed a compile time,
so we now take advantage of that.
Removed StaticString(const char*) ctor, and replaced it with a
StaticString::make() method.
Fixed a couple wrong uses of the old StaticString(const char*) ctor.
* Introduce mipgen frontend.
For now this is fairly simple although it does let you choose a filter.
Another cool feature is that an HTML file is generated which makes it
easy to review the generated miplevels.
This does not expose the Boundary enum to users because it has not yet
been implemented in the core Image library.
* Fix up mipgen per code review.
* Overhaul the image library, Phase I.
The preps for our upcoming mipgen command line tool by adding filtering
capabilities and unit tests for a new LinearImage class, which will
subsume Image (deprecated).
Filament's new image library is composed of three components:
- LinearImage....simple 3D tensor of floats
- ImageOps.......free functions for simple transforms
- ImageSampler...high quality filtering
The old Image class was a simple untyped data blob and is now
deprecated. The new LinearImage class is always float32, and always
stores pixels in packed scanline order. This makes it easier to
implement image-based algorithms because they can be agnostic of the
underlying format.
Remaining refactorings:
- Phase II will migrate imageio to LinearImage
- Phase III will migrate all downstream tools to LinearImage
- Phase IV will remove old the Image class
* Image library code review feedback.