effect math sppedup - up to 3x faster

-> distortion waves 3x speedup
-> hiphotic 2x speedup
-> waving cell 1.5x speedup

* replace sin8_t by lookup-table with pre-computed values
* moved integer sin and cos to fcn_declare.h (inlined by the compiler)
* moved gamma32 to fcn_declare.h (inlined by the compiler)
* a few other small tweaks
This commit is contained in:
Frank
2025-12-17 21:59:22 +01:00
parent 49e6de33c7
commit bc7cf062e8
7 changed files with 107 additions and 25 deletions

View File

@@ -843,7 +843,7 @@ static inline int32_t lerpPerlin(int32_t a, int32_t b, int32_t t) {
}
// 1D Perlin noise function that returns a value in range of -24691 to 24689
int32_t perlin1D_raw(uint32_t x, bool is16bit) {
int32_t IRAM_ATTR_YN perlin1D_raw(uint32_t x, bool is16bit) {
// integer and fractional part coordinates
int32_t x0 = x >> 16;
int32_t x1 = x0 + 1;
@@ -861,7 +861,7 @@ int32_t perlin1D_raw(uint32_t x, bool is16bit) {
}
// 2D Perlin noise function that returns a value in range of -20633 to 20629
int32_t perlin2D_raw(uint32_t x, uint32_t y, bool is16bit) {
int32_t IRAM_ATTR_YN perlin2D_raw(uint32_t x, uint32_t y, bool is16bit) {
int32_t x0 = x >> 16;
int32_t y0 = y >> 16;
int32_t x1 = x0 + 1;
@@ -893,7 +893,7 @@ int32_t perlin2D_raw(uint32_t x, uint32_t y, bool is16bit) {
}
// 3D Perlin noise function that returns a value in range of -16788 to 16381
int32_t perlin3D_raw(uint32_t x, uint32_t y, uint32_t z, bool is16bit) {
int32_t IRAM_ATTR_YN perlin3D_raw(uint32_t x, uint32_t y, uint32_t z, bool is16bit) {
int32_t x0 = x >> 16;
int32_t y0 = y >> 16;
int32_t z0 = z >> 16;