1
0
forked from 0ad/0ad
Commit Graph

6 Commits

Author SHA1 Message Date
12aa35eb3b Fix loading grayscale heightmaps for RM maps.
d2948937a0 introduced code to read Heightmap images into RM terrain
data. However, the original diff contained a bug where it read
Out-of-bounds array data for grayscale images. This bug was hidden by
another issue until D1816 / cbc04ba83b, which changed the code and made
the OOB read actually relevant. The effect was twofold:
- The height chosen was not the max of the 3 color channels, but the max
of the 3 neighboring pixel (thus slightly lowering the quality of
generated maps)
- The height for the bottom-right coordinates were random memory values,
thus garbage.

This random height ended up resulting in non-deterministic map
generation, which was reported on Ngorongoro.

The cause of this silent failure is that the transformation to BGRA is
not applied for grayscale images, as the alpha transformation is
processed first and exits. This is not per-se buggy, so it is not
changed here.
The fixed behaviour is specialized for the common grayscale case, and
retains the max-of-3-color-channel intended behaviour otherwise.

Fixes #6261.

Reported by: Feldfeld
Differential Revision: https://code.wildfiregames.com/D4203
This was SVN commit r25843.
2021-07-31 17:52:05 +00:00
b03b560e71 Adds std namespace to shared_ptr usages in graphics.
This was SVN commit r25525.
2021-05-22 19:21:33 +00:00
565710d4c9 Fixes UB in shared_ptr usage of an array. Refs #5288
Reported By: PVS-Studio
This was SVN commit r24905.
2021-02-13 23:25:41 +00:00
cbc04ba83b Use all three color channels when loading heightmaps following 204b04f2d4, refs #5018.
Removes wrong debug leftover line from 204b04f2d4 and unneeded clamp
from c9abf6f68c.

Differential Revision: https://code.wildfiregames.com/D1816
Patch By: Angen
Comments By: Vladislav
This was SVN commit r22892.
2019-09-12 19:30:43 +00:00
16fbe90342 Fix 204b04f2d4 compatibility with zipped mods, refs #5018.
Differential Revision: https://code.wildfiregames.com/D1480
Reviewed By: Itms
This was SVN commit r21814.
2018-05-01 21:15:55 +00:00
204b04f2d4 Allow random map scripts to load heightmap image files, fixes #5018.
Move the atlas heightmap import code to MapIO.cpp and reuse it.
Implements what 33e3e6c2ab and 69b7f39bf1 wanted to be.

This was SVN commit r21113.
2018-02-05 16:02:00 +00:00