From 2837f633a5d4e45fb5af34605079feb81d31d11d Mon Sep 17 00:00:00 2001 From: loic Date: Sat, 14 Dec 2024 03:20:03 +0100 Subject: [PATCH] edit: mounatain effect --- srcs/effects/mountain.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/srcs/effects/mountain.cpp b/srcs/effects/mountain.cpp index 14f021b..056d09b 100644 --- a/srcs/effects/mountain.cpp +++ b/srcs/effects/mountain.cpp @@ -9,6 +9,7 @@ int mountain(uint32_t *img, bool &needUpdate) { needUpdate = false; static PerlinNoise P(9); static PerlinNoise P2(1000); + static PerlinNoise P3(500); static float time = 0.0; /*basic color sunsine gradient no noise*/ @@ -17,21 +18,20 @@ int mountain(uint32_t *img, bool &needUpdate) { for (int x = 0; x < WIDTH; x++) { float n = P2.noise(x / 10 + (time * 0.5), y / 100.0 + (time * 0.5)) * 0.5 + 0.5; int color = static_cast(n * 255); -// int color = -y * 255 / HEIGHT; img[y * WIDTH + x] = (0 << 16) | (color << 8) | color; } } /*mountain*/ for (int x = 0; x < WIDTH; x++) { float n = P.noise(x / 100.0 + time, 0) * 0.5; - float n2 = P2.noise(x / 1000.0 + (time), 0) + P2.noise(x / 40.0 + (time * 0.5), 0) * 0.5; + float n2 = P2.noise(x / 1000.0 , 0) + P2.noise(x / 40.0 + (time * 0.5), 0) * 0.5; int y = static_cast((n + 1) * (HEIGHT >> 1)); int y2 = static_cast((n2 + 1) * (HEIGHT >> 1) ); for (int i = y2; i < HEIGHT; ++i) { img[i * WIDTH + x] = 0xf0f0f0; } for (int i = y; i < HEIGHT; ++i) { - img[i * WIDTH + x] = 0x151515; // Brown color for the mountain + img[i * WIDTH + x] = 0x151515; } }