Fix ESM4 base terrain layer opacity overflow
std::max specializations cast the argument to the type, so the layer opacity subtraction result would turn positive and cause bright spots
This commit is contained in:
@@ -467,7 +467,7 @@ namespace ESMTerrain
|
||||
}
|
||||
size_t index = static_cast<size_t>((starty + y) * blendmapSize + startx + x);
|
||||
auto delta = static_cast<unsigned char>(std::clamp(static_cast<int>(v.opacity * 255.f), 0, 255));
|
||||
baseBlendmap[index] = std::max<unsigned char>(0, baseBlendmap[index] - delta);
|
||||
baseBlendmap[index] -= std::min(baseBlendmap[index], delta);
|
||||
layerBlendmap[index] = delta;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user