mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Use all three color channels when loading heightmaps following 204b04f2d4, refs #5018.
Removes wrong debug leftover line from204b04f2d4and unneeded clamp fromc9abf6f68c. Differential Revision: https://code.wildfiregames.com/D1816 Patch By: Angen Comments By: Vladislav This was SVN commit r22892.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2018 Wildfire Games.
|
/* Copyright (C) 2019 Wildfire Games.
|
||||||
* This file is part of 0 A.D.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@@ -85,11 +85,10 @@ Status ParseHeightmapImage(const shared_ptr<u8>& fileData, size_t fileSize, std:
|
|||||||
// Repeat the last pixel of the image for the last vertex of the heightmap
|
// Repeat the last pixel of the image for the last vertex of the heightmap
|
||||||
int offset = std::min(y, tileSize - 1) * mapLineSkip + std::min(x, tileSize - 1) * bytesPP;
|
int offset = std::min(y, tileSize - 1) * mapLineSkip + std::min(x, tileSize - 1) * bytesPP;
|
||||||
|
|
||||||
// Pick color channel with highest value
|
heightmap[(tileSize - y) * (tileSize + 1) + x] = static_cast<u16>(256) * std::max({
|
||||||
u16 value = std::max({mapdata[offset], mapdata[offset + bytesPP], mapdata[offset + bytesPP * 2]});
|
mapdata[offset],
|
||||||
value = mapdata[offset];
|
mapdata[offset + bytesPP],
|
||||||
|
mapdata[offset + bytesPP * 2]});
|
||||||
heightmap[(tileSize - y) * (tileSize + 1) + x] = clamp(value * 256, 0, 65535);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return INFO::OK;
|
return INFO::OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user