mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 20:13:07 +01:00
Use average pixel value instead of only the red channel
This commit is contained in:
committed by
Michał Janiszewski
parent
6edea503b2
commit
3095106b0e
@@ -800,7 +800,10 @@ void mapgen_smooth_heightmap(SDL_Surface *surface, sint32 strength)
|
||||
// This assumes the height map is not tiled, and increases the weight of the edges
|
||||
const sint32 readX = clamp(x + offsetX, 0, width - 1);
|
||||
const sint32 readY = clamp(y + offsetY, 0, height - 1);
|
||||
heightSum += src[readX * numChannels + readY * pitch];
|
||||
const uint8 red = src[readX * numChannels + readY * pitch];
|
||||
const uint8 green = src[readX * numChannels + readY * pitch + 1];
|
||||
const uint8 blue = src[readX * numChannels + readY * pitch + 2];
|
||||
heightSum += (red + green + blue) / 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user