* Add way to retrieve the user world-space in materials
added `getUserWorldFromWorldMatrix()` and `getUserWorldPosition()` to
retrieve the API-level (user) world position in materials.
Deprecated `getWorldOffset()`
`getWorldOffset` didn't work when an IBL rotation was applied.
* fix large scenes with an ibl rotation
Rotate the IBL around the camera instead of the world so that the camera
is always at the origin regardless of the rotation.
* Add new alphaToCoverage material property
The alphaToCoverage property lets you enable or disable alpha to coverage
in a material. More importantly it lets you overrides the behavior of
blending: masked which automatically enables alphaToCoverage.
* Update release notes
The fog calculation could fail when the falloff was strong and the
camera z position was far from the fog height. The problem was
that the computation was spread between the cpu and gpu by splitting
an exp(), but with certain parameters the two exp() would independently
blow-up. We fix this by doing the exp() only on the gpu side.
try to be more explicit about which configurations are supported,
and use the same pattern everywhere for checking the gl version at
either compile and runtime.
This didn't happen in practice, but we would call (null) if the
clip_control extension was available and we were not on GL 4.1.
We "fix" this by not supporting the clip_control extension on desktop.
It doesn't matter because clip_control is core as of 4.5 and is
present in only 8% of non 4.5 GL implementation, and this doesn't
include any macOS versions.
This small abstraction is (will be) needed because GLES 2.0 doesn't
have sync object, however synchronization is sometimes available
externally, in particular with EGL.
This PR doesn't provide other implementations.
- make sure to initialize all extension booleans, we treat them
as feature flags.
- be more explicit about #define'ing gl tokens, so we can more easily
catch errors later.
- don't blindly use extension tokens that might not be available
(e.g.: GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_CUBE_MAP_ARRAY). It
would probably cause a spurious gl error.
- iOS is treated the same way than Android now. The only difference
is that iOS only provides prototypes and no typedef, whereas
Android only provides typedefs and no prototypes.
- Timer queries is core in GL and an extension on all versions of
GLES. On iOS it's not available at the header level. An additional
subtlety is that glGetObjectuiv is core in GLES 3.0, so it conflicts
with the extension.
So, now we do things correctly:
- on desktop we use the core methods
- on ios we ifdef out everything related to timer queries
- on gles 2.0 and up we use only the extension entry-points
We were not testing for that case properly. This case is taken when
either:
- depth & stencil textures are the same and not null
- or, only depth is specified but both attachments are requested
Also cleanup the dimension checks in debug builds.
- some of the convenience are not available in ES2
- it's less efficient
- we can save some PBO space when reading back
a partial framebuffer.
We also avoid using GL_PACK_ROW_LENGTH which technically is not
a convenience, but in our case we are doing an extra copy anyways, so
we can account for the row-length at that point.
- We now call visitScene only once for the directional shadowmap instead of
1 + cascade_count times.
- Don't use visitScene for spot shadows
it was only used to compute the near/far planes, but instead we can
use the radius of the light. This could degrade the quality of the
spot shadows, but this can be corrected by setting a correct radius.
caveat: currently the near is hardcoded to 0.01 units. this should be
user-settable.
- Improve performance of visitScene calls
instead of transforming 8 points of an AABB and finding the min/max,
we transform the AABB and use its minz and maxz. This works for affine
transforms.
This change also cleans-up AABB and Box transform APIs, which also
are now inline.
- StructureOfArray: don't initialize trivial ctors
We mimic the behavior of std::vector<> here, where a resize() won't
initialize the array if the type is trivially_default_constructible.
This can reveal existing bugs, where we depended on the initialization
to 0.
- StructureOfArray: add push_back(std::tuple<>)
This basically allows us to push_back() a struct of the SoA.
- Make PerRenderableData trivially constructible
this improves performance when we have tons of objects in the scene
because PerRenderableData is used in arrays.
We use isnan() to detect that the estimation of directional light
parameters from the IBL has failed, however isnan() always returns
false with -ffast-math, which we're using in release builds.
This works around that. The affected code is non essential, performance
is not a concern here.
When loading a glTF file on platforms without a filesystem, a client
calls `addResourceData` to populate `ResourceLoader`'s cache with data.
For example, a web client might make HTTP fetch requests to fill in
buffer data. This internal cache of data is stored in
`ResourceLoader::Impl::mUriDataCache`.
This works well, except the cache must persist until after it has been
uploaded to the GPU.
There was already a mechanism (see `uploadUserdata`) in place to ensure
that glTF data persisted until after it had been uploaded to the GPU.
However, this mechanism did not extend to client-provided data. Thus, a
race occured between Filament's driver consuming the buffer and it
getting freed.