AssimpAssetImporter: fix QVector3D qHash() implementation
The plugin doesn't own the QVector3D type, so it MUST NOT define a
qHash() for it.
That said, a previous commit ported from header guards to #pragma
once, thereby asserting that the header is not installed. And since
the function is inline and not exported, the chance of an ODR UB is
very low (though static plugins could exhibit it), so we can first
turn towards a more fundamental problem of the function, namely that
it breaks the fundamental relation between equality and hashing.
This is because the function checks isNull(), catching the case where
all components are zero, but it does not handle the case when only
some, but not all, components of the vector are zero. In that case,
equal QVector3D objects may yet have differently-signed zeros, and
+0. == -0., but bit_cast<uint64_t>(+0.) !=
bit_cast<uint64_t>(-0.). Since the function is using qHashBits(), that
difference in bit patterns becomes visible to the hash function and
leads to different hash values for equal objects.
To fix, use qMultiHash() instead of trying to roll your own hash
function. A change of the hash value is ok here, since this function
is (modulo ODR violations) restricted to the plugin. Strive to make
the function token-by-token idential to the one proposed for
qvectornd.h, ie.: noexcept and take-by-value, so that we have at
least a common implementation that doesn't trigger ODR if used
everywhere.
Amends f1e62f4469e563a0d07f479e2245a784e04b11d0 (6.5).
Pick-to: 6.11 6.8 6.5
Change-Id: I2e848faa82c7578379094e3bb7a17a6e46aeda29
Reviewed-by: Christian Strømme <christian.stromme@qt.io>