upgrade Filament to v1.41

This commit is contained in:
Nick Fisher
2023-08-18 12:01:14 +08:00
parent e62bf64c04
commit d82bdff939
72 changed files with 2455 additions and 2514 deletions

View File

@@ -430,8 +430,21 @@ constexpr TQuaternion<T> TMat33<T>::packTangentFrame(const TMat33<T>& m, size_t
return q;
}
} // namespace details
/**
* Pre-scale a matrix m by the inverse of the largest scale factor to avoid large post-transform
* magnitudes in the shader. This is useful for normal transformations, to avoid large
* post-transform magnitudes in the shader, especially in the fragment shader, where we use
* medium precision.
*/
template<typename T>
constexpr details::TMat33<T> prescaleForNormals(const details::TMat33<T>& m) noexcept {
return m * details::TMat33<T>(
1.0 / std::sqrt(max(float3{length2(m[0]), length2(m[1]), length2(m[2])})));
}
// ----------------------------------------------------------------------------------------
typedef details::TMat33<double> mat3;