Browse Source

Fix OpenSimplexNoise get_image() swap axes

(cherry picked from commit 00cac6e9b66ea3ac97a66628db04013770479e22)
RaphaelHunter 6 years ago
parent
commit
68f92e6785
1 changed files with 1 additions and 1 deletions
  1. 1 1
      modules/opensimplex/open_simplex_noise.cpp

+ 1 - 1
modules/opensimplex/open_simplex_noise.cpp

@@ -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 i = 0; i < p_height; i++) {
 		for (int j = 0; j < p_width; j++) {
 		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]
 			v = v * 0.5 + 0.5; // Normalize [0..1]
 			wd8[(i * p_width + j)] = uint8_t(CLAMP(v * 255.0, 0, 255));
 			wd8[(i * p_width + j)] = uint8_t(CLAMP(v * 255.0, 0, 255));
 		}
 		}