Sternschnuppen, Sonnenaufgang: Sterne frei verteilt statt in Linien
Die Auswahl per (x*7 + ...) % 7 hing nicht von x ab und ergab drei durchgehende Reihen; im Sonnenaufgang lagen die Sterne auf einem Gitter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ce8bfee64
commit
e5e424a7a6
1 file changed
+18
-7
+18
-7
@@ -139,10 +139,11 @@ void renderSunrise(uint32_t now) {
|
|||||||
c += CRGB(red).nscale8(uint8_t(dawn * 255 * (1 - z / float(NUM_LAYERS)))); // Morgenrot am Horizont
|
c += CRGB(red).nscale8(uint8_t(dawn * 255 * (1 - z / float(NUM_LAYERS)))); // Morgenrot am Horizont
|
||||||
float d = dist3(x, y, z, sunX, MID, sunZ);
|
float d = dist3(x, y, z, sunX, MID, sunZ);
|
||||||
if (d < 1.6f) c += CRGB(highlight, scale8(highlight, 130 + uint8_t(day * 100)), scale8(highlight, 40)).nscale8(uint8_t((1 - d / 1.6f) * 255));
|
if (d < 1.6f) c += CRGB(highlight, scale8(highlight, 130 + uint8_t(day * 100)), scale8(highlight, 40)).nscale8(uint8_t((1 - d / 1.6f) * 255));
|
||||||
if (z >= 2 && (x * 7 + y * 13 + z * 5) % 9 == 0) // Sterne, nur nachts
|
|
||||||
c += CRGB(brightness, brightness, brightness).nscale8(uint8_t((1 - day) * scale8(sin8(now / 9 + x * 50 + y * 30), 200)));
|
|
||||||
at(x, y, z) = c;
|
at(x, y, z) = c;
|
||||||
}
|
}
|
||||||
|
static const uint8_t STARS[][3] = {{0, 3, 2}, {3, 1, 2}, {2, 4, 2}, {4, 4, 3}, {1, 0, 3}, {2, 2, 4}, {4, 1, 4}, {0, 4, 4}};
|
||||||
|
for (const auto &s : STARS) // Sterne, nur nachts
|
||||||
|
at(s[0], s[1], s[2]) += CRGB(brightness, brightness, brightness).nscale8(uint8_t((1 - day) * scale8(sin8(now / 9 + s[0] * 50 + s[1] * 30), 200)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Blumenwiese: wogendes Gras, Blumen auf Stängeln, ein Schmetterling ---------
|
// --- Blumenwiese: wogendes Gras, Blumen auf Stängeln, ein Schmetterling ---------
|
||||||
@@ -308,17 +309,27 @@ struct Meteor {
|
|||||||
void renderShootingStars(uint32_t now) {
|
void renderShootingStars(uint32_t now) {
|
||||||
static Meteor m;
|
static Meteor m;
|
||||||
static uint32_t next = 0;
|
static uint32_t next = 0;
|
||||||
|
static uint8_t sky[12][4]; // Hintergrundsterne: x, y, z, Phase
|
||||||
if (fresh) {
|
if (fresh) {
|
||||||
fresh = false;
|
fresh = false;
|
||||||
m.active = false;
|
m.active = false;
|
||||||
next = now + 1000;
|
next = now + 1000;
|
||||||
|
for (uint8_t i = 0; i < 12; i++) {
|
||||||
|
bool taken;
|
||||||
|
do { // zufällige, verschiedene Plätze über der untersten Etage
|
||||||
|
sky[i][0] = random8(CUBE_SIZE);
|
||||||
|
sky[i][1] = random8(CUBE_SIZE);
|
||||||
|
sky[i][2] = random8(1, NUM_LAYERS);
|
||||||
|
taken = false;
|
||||||
|
for (uint8_t j = 0; j < i; j++) taken |= !memcmp(sky[i], sky[j], 3);
|
||||||
|
} while (taken);
|
||||||
|
sky[i][3] = random8();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
FastLED.clear();
|
FastLED.clear();
|
||||||
FOR_XYZ {
|
for (const auto &s : sky) {
|
||||||
if ((x * 7 + y * 11 + z * 13) % 7 == 0 && z >= 1) {
|
uint8_t tw = sin8(now / 7 + s[3]);
|
||||||
uint8_t tw = sin8(now / 7 + x * 40 + y * 70 + z * 20);
|
at(s[0], s[1], s[2]) = CRGB(brightness / 2, brightness / 2, brightness).nscale8(60 + scale8(tw, 195));
|
||||||
at(x, y, z) = CRGB(brightness / 2, brightness / 2, brightness).nscale8(60 + scale8(tw, 195));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!m.active && int32_t(now - next) >= 0) {
|
if (!m.active && int32_t(now - next) >= 0) {
|
||||||
bool left = random8(2);
|
bool left = random8(2);
|
||||||
|
|||||||
Reference in new issue
Block a user