Fix OpenSimplexNoise get_image() swap axes

(cherry picked from commit 00cac6e9b6)
This commit is contained in:
RaphaelHunter 2019-07-08 16:39:48 +08:00 committed by Rémi Verschelde
parent 21eea9cd6c
commit 68f92e6785
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -110,7 +110,7 @@ Ref<Image> OpenSimplexNoise::get_image(int p_width, int p_height) const {
for (int i = 0; i < p_height; i++) {
for (int j = 0; j < p_width; j++) {
float v = get_noise_2d(i, j);
float v = get_noise_2d(j, i);
v = v * 0.5 + 0.5; // Normalize [0..1]
wd8[(i * p_width + j)] = uint8_t(CLAMP(v * 255.0, 0, 255));
}