* Check whether the loaded dimension of the heightmap image are considered valid enough * to attempt to load the image. In other words, the width and height are not beyond the * #MAX_HEIGHTMAP_SIDE_LENGTH_IN_PIXELS limit and the total number of pixels does not * exceed #MAX_HEIGHTMAP_SIZE_PIXELS. A width or height less than 1 are disallowed too. * @param width The width of the to be loaded hei
| 56 | * @return True iff the dimensions are within the limits. |
| 57 | */ |
| 58 | static inline bool IsValidHeightmapDimension(size_t width, size_t height) |
| 59 | { |
| 60 | return (uint64_t)width * height <= MAX_HEIGHTMAP_SIZE_PIXELS && |
| 61 | width > 0 && width <= MAX_HEIGHTMAP_SIDE_LENGTH_IN_PIXELS && |
| 62 | height > 0 && height <= MAX_HEIGHTMAP_SIDE_LENGTH_IN_PIXELS; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Convert RGB colours to Greyscale using 29.9% Red, 58.7% Green, 11.4% Blue |
no outgoing calls
no test coverage detected