Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/random8_core/random_cores/R_Perlin_Styles.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ namespace R8{
}

uint16_t generate() override {
positionX = (positionX + 1) % SIXTEEN_BIT_MAX;
float pos = (float)positionX / (float)SIXTEEN_BIT_MAX;
// positionX advances one phase step per trigger. The walk speed is set by the
// phase resolution (the hardware 12-bit range), not the 16-bit output range:
// normalizing over SIXTEEN_BIT_MAX would shrink each step ~16x and stall the walk.
positionX = (positionX + 1) % TWELVE_BIT_MAX;
float pos = (float)positionX / (float)TWELVE_BIT_MAX;
return (uint16_t)(perlin1d(pos, 920.666, 2) * SIXTEEN_BIT_MAX);
}

Expand Down Expand Up @@ -60,8 +63,11 @@ namespace R8{
}

uint16_t generate() override {
positionX = (positionX + 1) % SIXTEEN_BIT_MAX;
float pos = (float)positionX / (float)SIXTEEN_BIT_MAX;
// positionX advances one phase step per trigger. The walk speed is set by the
// phase resolution (the hardware 12-bit range), not the 16-bit output range:
// normalizing over SIXTEEN_BIT_MAX would shrink each step ~16x and stall the walk.
positionX = (positionX + 1) % TWELVE_BIT_MAX;
float pos = (float)positionX / (float)TWELVE_BIT_MAX;
return (uint16_t)(perlin1d(pos, 720.1459, 10) * SIXTEEN_BIT_MAX);
}

Expand Down