1
0
forked from 0ad/0ad
0ad/source/graphics
wraitii 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
..
scripting Split off JSON-related function from ScriptInterface, clean up headers. 2021-05-14 10:18:03 +00:00
tests Fixes big screenshots, implements CCamera::GetViewQuad properly for custom projections. 2021-06-13 17:42:37 +00:00
Camera.cpp Fixes big screenshots, implements CCamera::GetViewQuad properly for custom projections. 2021-06-13 17:42:37 +00:00
Camera.h Moves terrain independent code for viewport bounds calculations to camera. 2021-05-01 16:59:42 +00:00
CameraController.cpp Removes joystick from camera controller. 2021-03-17 16:28:48 +00:00
CameraController.h Removes joystick from camera controller. 2021-03-17 16:28:48 +00:00
Canvas2D.cpp Uses canvas2d material for line drawing instead of gui_solid. 2021-06-06 10:13:57 +00:00
Canvas2D.h Adds shader technique caching to Canvas2D. 2021-05-31 19:22:14 +00:00
CinemaManager.cpp Removes unused and outdated includes, replaces some includes by forward declarations. 2021-05-15 17:27:01 +00:00
CinemaManager.h Removes unused and outdated includes, replaces some includes by forward declarations. 2021-05-15 17:27:01 +00:00
ColladaManager.cpp Fix few typos found with the Debian lintian tool. 2017-10-28 22:34:57 +00:00
ColladaManager.h Split skeleton definitions into multiple files, adds hotloading support for skeleton files. Fixes #190. 2013-07-08 20:25:06 +00:00
Color.cpp Move SSE.h to a better place. Rename it to simd.h after discussion with @OptimusShepard and @vladislavbelov 2021-02-05 12:40:59 +00:00
Color.h Remove SSE detection duplication in Colors and ModelRenderer 2020-12-31 15:37:28 +00:00
Decal.cpp Include CStrInternStatic where necessary only. 2021-05-18 11:09:54 +00:00
Decal.h Removes unused and outdated includes, replaces some includes by forward declarations. 2021-05-15 17:27:01 +00:00
Entity.h Small cleanup, based on a change from one of Philip's old patches 2015-05-16 09:39:27 +00:00
Font.cpp Optimise glyph lookup in text renderer 2013-10-18 15:56:12 +00:00
Font.h Removes unused containers included in headers. 2021-03-03 23:01:08 +00:00
FontManager.cpp Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
FontManager.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
FontMetrics.cpp Use CStrIntern for font names to reduce lookup cost 2013-10-18 16:15:42 +00:00
FontMetrics.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
GameView.cpp Moves partially MiniMap texture rendering into a separate object. 2021-06-01 18:55:35 +00:00
GameView.h Moves partially MiniMap texture rendering into a separate object. 2021-06-01 18:55:35 +00:00
HeightMipmap.cpp Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
HeightMipmap.h Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
HFTracer.cpp Use type_identity to simplify Clamp usage. 2021-04-15 13:01:24 +00:00
HFTracer.h Remove trailing whitespace and whitespace in empty lines of source/ except source/third_party/. 2016-11-23 11:18:37 +00:00
ICameraController.cpp Splits CameraController and adds ICameraController interface 2019-12-21 00:44:18 +00:00
ICameraController.h Splits CameraController and adds ICameraController interface 2019-12-21 00:44:18 +00:00
LightEnv.cpp Combines terrain and units ambient colors into the single color. 2021-01-17 13:10:00 +00:00
LightEnv.h Combines terrain and units ambient colors into the single color. 2021-01-17 13:10:00 +00:00
LOSTexture.cpp Include CStrInternStatic where necessary only. 2021-05-18 11:09:54 +00:00
LOSTexture.h Adds header safeguards to LOSTexture forgotten in fe21c5e023. 2021-05-31 20:47:03 +00:00
MapGenerator.cpp Implement a global task manager using a pool of worker threads 2021-06-03 14:48:38 +00:00
MapGenerator.h Implement a global task manager using a pool of worker threads 2021-06-03 14:48:38 +00:00
MapIO.cpp Fix loading grayscale heightmaps for RM maps. 2021-07-31 17:52:05 +00:00
MapIO.h Increases the maps version to 7 for XML and PMP files. 2021-01-17 02:12:04 +00:00
MapReader.cpp Split off JSON-related function from ScriptInterface, clean up headers. 2021-05-14 10:18:03 +00:00
MapReader.h Split ScriptRequest in its own header. 2021-05-03 16:07:26 +00:00
MapWriter.cpp Combines terrain and units ambient colors into the single color. 2021-01-17 13:10:00 +00:00
MapWriter.h Removes unused containers included in headers. 2021-03-03 23:01:08 +00:00
Material.cpp Include CStrInternStatic where necessary only. 2021-05-18 11:09:54 +00:00
Material.h Adds const to Material and CShaderProgram::Binding methods, removes a redundant variable from ModelRenderer 2020-01-26 21:32:12 +00:00
MaterialManager.cpp Include CStrInternStatic where necessary only. 2021-05-18 11:09:54 +00:00
MaterialManager.h ao/parallax/normal/specular/emissive mapping; windy trees; time manager; render queries; conditional defines 2012-08-06 19:10:47 +00:00
MeshManager.cpp Automatically replace %hs/%ls with %s in CLogger format strings. 2015-01-22 20:36:24 +00:00
MeshManager.h Replace boost::unordered_map, boost::unordered_set with std::unordered_map, std::unordered_set to establish consistency. 2019-11-25 14:30:25 +00:00
MiniMapTexture.cpp Cleanups MiniMapTexture a bit. 2021-06-01 19:50:15 +00:00
MiniMapTexture.h Cleanups MiniMapTexture a bit. 2021-06-01 19:50:15 +00:00
MiniPatch.cpp # Handle terrain passability and movement costs in pathfinder. 2010-05-27 23:31:03 +00:00
MiniPatch.h Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
Model.cpp Include CStrInternStatic where necessary only. 2021-05-18 11:09:54 +00:00
Model.h Removes unused and outdated includes, replaces some includes by forward declarations. 2021-05-15 17:27:01 +00:00
ModelAbstract.cpp Actually remove trailing tabs from source/. 2016-11-23 14:09:58 +00:00
ModelAbstract.h Allow empty actor files. 2021-04-09 15:45:31 +00:00
ModelDef.cpp Fix mistake in 100159548c 2021-05-06 07:42:49 +00:00
ModelDef.h Removes unused and outdated includes, replaces some includes by forward declarations. 2021-05-15 17:27:01 +00:00
ModelDummy.h Allow empty actor files. 2021-04-09 15:45:31 +00:00
ObjectBase.cpp Add an option to reduce the diversity of actor variants 2021-05-31 11:42:46 +00:00
ObjectBase.h More actor file validation, preventing crashes. 2021-04-26 14:57:13 +00:00
ObjectEntry.cpp Hotloading fix after 76acc4e146 2021-04-24 09:39:33 +00:00
ObjectEntry.h Hotloading fix after 76acc4e146 2021-04-24 09:39:33 +00:00
ObjectManager.cpp Fix hotloading making models disappear. 2021-06-17 07:52:50 +00:00
ObjectManager.h Add an option to reduce the diversity of actor variants 2021-05-31 11:42:46 +00:00
Overlay.cpp Optimise out of frustum rendering of texture overlays. 2019-12-10 23:13:37 +00:00
Overlay.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
ParticleEmitter.cpp Include CStrInternStatic where necessary only. 2021-05-18 11:09:54 +00:00
ParticleEmitter.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
ParticleEmitterType.cpp Removes usages of duplication of Clamp function in graphics. Refs D1763. 2019-09-18 08:34:36 +00:00
ParticleEmitterType.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
ParticleManager.cpp Replace boost::unordered_map, boost::unordered_set with std::unordered_map, std::unordered_set to establish consistency. 2019-11-25 14:30:25 +00:00
ParticleManager.h Fix No-PCH build. 2021-02-21 10:04:39 +00:00
Patch.cpp Actually remove trailing tabs from source/. 2016-11-23 14:09:58 +00:00
Patch.h Fix culling for shadows and reflections. 2014-06-25 01:11:10 +00:00
PreprocessorWrapper.cpp Early return in PreprocessorWrapper in case of failed include resolve. 2021-02-27 17:21:02 +00:00
PreprocessorWrapper.h Optimization for include resolving in PreprocessorWrapper. 2021-01-20 23:05:15 +00:00
RenderableObject.h Remove trailing whitespace and whitespace in empty lines of source/ except source/third_party/. 2016-11-23 11:18:37 +00:00
SColor.h Add GPL header 2009-04-18 17:00:33 +00:00
ShaderDefines.cpp Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
ShaderDefines.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
ShaderManager.cpp Removes FFP shader program. Fixes #5791 2021-06-06 19:49:43 +00:00
ShaderManager.h Removes unused and outdated includes, replaces some includes by forward declarations. 2021-05-15 17:27:01 +00:00
ShaderProgram.cpp Fix some warnings. 2021-05-02 15:45:40 +00:00
ShaderProgram.h Removes FFP shader program. Fixes #5791 2021-06-06 19:49:43 +00:00
ShaderProgramPtr.h Switch to std::shared_ptr and std::weak_ptr. 2015-01-25 03:10:58 +00:00
ShaderTechnique.cpp Forward-declare CShaderProgramPtr, to avoid pulling in more headers than necessary and to hypothetically reduce build times by a minuscule amount. 2014-07-02 22:36:45 +00:00
ShaderTechnique.h Further header & precompiled cleanup, fix no-PCH builds. 2020-12-09 14:39:14 +00:00
ShaderTechniquePtr.h Clean up header includes, add new forward declarations. 2020-11-21 11:20:29 +00:00
SkeletonAnim.h Fix animation syncronisation between actor props. Fixes #2324 one more time. Refs [18568] and [18265]. Reported by 2016-12-08 23:16:54 +00:00
SkeletonAnimDef.cpp Fix bounding boxes after f73fa05542 2021-05-05 16:20:33 +00:00
SkeletonAnimDef.h Fix bounding boxes after f73fa05542 2021-05-05 16:20:33 +00:00
SkeletonAnimManager.cpp Cache the model-animation bounds more efficiently. 2021-04-23 14:26:59 +00:00
SkeletonAnimManager.h Cache the model-animation bounds more efficiently. 2021-04-23 14:26:59 +00:00
SmoothedValue.cpp Moves CSmoothedValue to separate file. 2019-10-01 22:42:54 +00:00
SmoothedValue.h Rework 7ee94f23df 2021-04-16 16:01:30 +00:00
Terrain.cpp Rework 7ee94f23df 2021-04-16 16:01:30 +00:00
Terrain.h Adds offsets to the terrain resize function and adds comments how the resizing works. 2020-05-07 21:46:17 +00:00
TerrainProperties.cpp XMB Improvements, parse JS into XMB, make strings more efficient. 2021-05-04 13:02:34 +00:00
TerrainProperties.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
TerrainTextureEntry.cpp Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
TerrainTextureEntry.h Removes unused containers included in headers. 2021-03-03 23:01:08 +00:00
TerrainTextureManager.cpp Add missing files in 4942cabab5 2020-12-31 14:27:02 +00:00
TerrainTextureManager.h Adds std namespace to shared_ptr usages in graphics. 2021-05-22 19:21:33 +00:00
TerritoryBoundary.cpp Move LOS to a los helper header and cleanup Grid.h includes. 2020-06-14 20:39:03 +00:00
TerritoryBoundary.h Optimise HierarchicalPathfinder::Update by speeding up the chunk dirtiness check. 2017-12-10 08:59:43 +00:00
TerritoryTexture.cpp Further reduce usage of TERRAIN_TILE_SIZE in non-terrain components 2021-05-02 17:40:00 +00:00
TerritoryTexture.h Optimise HierarchicalPathfinder::Update by speeding up the chunk dirtiness check. 2017-12-10 08:59:43 +00:00
TextRenderer.cpp Draws all characters for a very long text of the same style. 2021-06-08 18:17:10 +00:00
TextRenderer.h Removes complex transform from TextRenderer. 2021-06-02 22:16:09 +00:00
Texture.h Switch to std::shared_ptr and std::weak_ptr. 2015-01-25 03:10:58 +00:00
TextureConverter.cpp Fix game not closing when compiled with --without-nvtt. 2021-06-10 15:42:38 +00:00
TextureConverter.h Fix game not closing when compiled with --without-nvtt. 2021-06-10 15:42:38 +00:00
TextureManager.cpp Restores GL check for tests in TextureManager forgotten in 283f524fcf. 2021-05-29 23:24:36 +00:00
TextureManager.h Implements DrawRect in Canvas2D, removes CConsole background drawing with low level GL calls. 2021-05-29 12:31:14 +00:00
Unit.cpp Revert 2e1545ffc4, fix correctly. 2021-04-28 16:38:45 +00:00
Unit.h Implement quality levels for actors & corresponding setting. 2021-04-08 07:22:24 +00:00
UnitAnimation.cpp Fix initial animation sync. 2021-04-07 08:35:02 +00:00
UnitAnimation.h Fix initial animation sync. 2021-04-07 08:35:02 +00:00
UnitManager.cpp Adds multiple entity selection to Atlas (including move/delete). Fixes #678. 2012-02-27 05:32:35 +00:00
UnitManager.h Remove trailing whitespace and whitespace in empty lines of source/ except source/third_party/. 2016-11-23 11:18:37 +00:00