Commit Graph

15 Commits

Author SHA1 Message Date
Ben Doherty
cf91e42847 Switch ASSERT macros to new stream API (#7881) 2024-05-24 20:46:34 +00:00
Mathias Agopian
5b71274fa5 get rid of utils::StaticString
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`.
2022-08-02 09:51:13 -07:00
Mathias Agopian
88768e8003 Fix Conflict with glibc 2.35+ macro.
Fix #5720
2022-07-11 15:25:02 -07:00
Mathias Agopian
718e7ab064 remove a bunch of <functional> includes
This forces us to use an explicit hash class in a few place, but it
is cleaner.

remove utils::lower_bound and utils::upper_bound, which were not used.
2022-06-03 08:35:57 -07:00
Pei Jia
edb9ca71e5 included header files are now in alphabetic order 2022-05-11 15:04:53 -07:00
Pei Jia
ad9ce72f61 header files added, for compatibility of clang c++17. Don't forget to add -std=c++17. 2022-05-11 15:04:53 -07:00
Philip Rideout
9aeec3a759 Add Ktx2Reader and BasisEncoder and use them in samples.
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.
2022-04-15 10:48:48 -07:00
Philip Rideout
20abfec7d3 Minor change to adhere to CODE_STYLE. 2020-10-12 11:15:45 -07:00
Romain Guy
c28d9ddb9d Fix support of paletted images and alpha channel in imageio (#2420) 2020-04-18 16:32:05 -07:00
Romain Guy
a4a1bf07aa Use our own constants instead of M_PI, M_*, etc. (#1733)
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.
2019-10-02 15:31:38 -07:00
prideout
5ee359cf40 Move math namespace to fix #746. 2019-02-07 09:23:07 -08:00
nicebyte
83c40e6664 Make 4-channel versions of certain image operations. (#676)
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.
2019-01-07 15:16:00 -08:00
Mathias Agopian
2d6b43827e Improve StaticString hashing
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.
2018-12-12 17:47:21 -08:00
Philip Rideout
e45e7b256d Introduce mipgen frontend. (#120)
* 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.
2018-08-21 17:54:27 -07:00
Philip Rideout
1f380a6ec6 Introduce new image library, Phase I. (#80)
* 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.
2018-08-13 10:39:57 -07:00