Razaekel / noise-rs

Procedural noise generation library for Rust.
Apache License 2.0
856 stars 120 forks source link

Change Octaves to be u8 instead of usize #268

Closed Razaekel closed 1 year ago

Razaekel commented 3 years ago

u8 allows up to 256 octaves, but most of the time, the number of octaves will probably be less than 10. Don't need full pointer width to store the number of octaves, hence the move to u8.

Cazadorro commented 3 years ago

Is there some other limitation in the library making 256 convenient? Your applications may only use 10 octaves, but I've written code that's used more than 256. I'm not sure the purpose of artificially restricting this, it sure as heck isn't performance.

Razaekel commented 3 years ago

Is there some other limitation in the library making 256 convenient? Your applications may only use 10 octaves, but I've written code that's used more than 256. I'm not sure the purpose of artificially restricting this, it sure as heck isn't performance.

Time to compute the fractal noisefn is linear in the number of octaves. Besides, I'd like to change it to a fixed size instead of usize. If you do need more than 256, I don't have an issue making it u16 (65,535 octaves) or u32 instead( ~4.3 billion octaves).