edit: mounatain effect
This commit is contained in:
parent
c7ac26c559
commit
2837f633a5
1 changed files with 3 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ int mountain(uint32_t *img, bool &needUpdate) {
|
||||||
needUpdate = false;
|
needUpdate = false;
|
||||||
static PerlinNoise P(9);
|
static PerlinNoise P(9);
|
||||||
static PerlinNoise P2(1000);
|
static PerlinNoise P2(1000);
|
||||||
|
static PerlinNoise P3(500);
|
||||||
static float time = 0.0;
|
static float time = 0.0;
|
||||||
|
|
||||||
/*basic color sunsine gradient no noise*/
|
/*basic color sunsine gradient no noise*/
|
||||||
|
|
@ -17,21 +18,20 @@ int mountain(uint32_t *img, bool &needUpdate) {
|
||||||
for (int x = 0; x < WIDTH; x++) {
|
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;
|
float n = P2.noise(x / 10 + (time * 0.5), y / 100.0 + (time * 0.5)) * 0.5 + 0.5;
|
||||||
int color = static_cast<int>(n * 255);
|
int color = static_cast<int>(n * 255);
|
||||||
// int color = -y * 255 / HEIGHT;
|
|
||||||
img[y * WIDTH + x] = (0 << 16) | (color << 8) | color;
|
img[y * WIDTH + x] = (0 << 16) | (color << 8) | color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*mountain*/
|
/*mountain*/
|
||||||
for (int x = 0; x < WIDTH; x++) {
|
for (int x = 0; x < WIDTH; x++) {
|
||||||
float n = P.noise(x / 100.0 + time, 0) * 0.5;
|
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<int>((n + 1) * (HEIGHT >> 1));
|
int y = static_cast<int>((n + 1) * (HEIGHT >> 1));
|
||||||
int y2 = static_cast<int>((n2 + 1) * (HEIGHT >> 1) );
|
int y2 = static_cast<int>((n2 + 1) * (HEIGHT >> 1) );
|
||||||
for (int i = y2; i < HEIGHT; ++i) {
|
for (int i = y2; i < HEIGHT; ++i) {
|
||||||
img[i * WIDTH + x] = 0xf0f0f0;
|
img[i * WIDTH + x] = 0xf0f0f0;
|
||||||
}
|
}
|
||||||
for (int i = y; i < HEIGHT; ++i) {
|
for (int i = y; i < HEIGHT; ++i) {
|
||||||
img[i * WIDTH + x] = 0x151515; // Brown color for the mountain
|
img[i * WIDTH + x] = 0x151515;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue