Ambient map has different hash than sky map to prevent using one instead of the other, even if they are using the same source texture.

This commit is contained in:
Olivier Prat 2019-04-03 11:29:59 +02:00
parent e3355cd6a4
commit 50fecf5e01

View file

@ -131,7 +131,14 @@ void TextureBaker::handleTextureNetworkReply() {
void TextureBaker::processTexture() {
// the baked textures need to have the source hash added for cache checks in Interface
// so we add that to the processed texture before handling it off to be serialized
auto hashData = QCryptographicHash::hash(_originalTexture, QCryptographicHash::Md5);
QCryptographicHash hasher(QCryptographicHash::Md5);
hasher.addData(_originalTexture);
// An ambient texture is built with the same pixel data as sky texture but its Mip Maps are different
// so we mustn't use one instead of the other.
if (_textureType == image::TextureUsage::AMBIENT_TEXTURE) {
hasher.addData((const char*)&_textureType, sizeof(_textureType));
}
auto hashData = hasher.result();
std::string hash = hashData.toHex().toStdString();
TextureMeta meta;