Skip to content

Commit

Permalink
Fractal PingPong, simplified math
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Mar 2, 2025
1 parent c6abac2 commit 6fd5b43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions include/FastNoise/Generators/Fractal.inl
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ class FastSIMD::DispatchClass<FastNoise::FractalPingPong, SIMD> final : public v
float32v weightedStrength = this->GetSourceValue( mWeightedStrength, seed, pos... );
float32v pingPongStrength = this->GetSourceValue( mPingPongStrength, seed, pos... );
float32v lacunarity( mLacunarity );
float32v amp( mFractalBounding );
float32v noise = PingPong( (this->GetSourceValue( mSource, seed, pos... ) + float32v( 1 )) * pingPongStrength );
float32v amp( mFractalBounding * 2 );
float32v noise = PingPong( this->GetSourceValue( mSource, seed, pos... ) * pingPongStrength );

float32v sum = (noise - float32v( 0.5f )) * float32v( 2 ) * amp;
float32v sum = (noise - float32v( 0.5f )) * amp;

for( int i = 1; i < mOctaves; i++ )
{
seed -= int32v( -1 );
amp *= Lerp( float32v( 1 ), noise, weightedStrength );
amp *= gain;

noise = PingPong( (this->GetSourceValue( mSource, seed, (pos *= lacunarity)... ) + float32v( 1 )) * pingPongStrength );
sum += (noise - float32v( 0.5f )) * float32v( 2 ) * amp;
noise = PingPong( (this->GetSourceValue( mSource, seed, (pos *= lacunarity)... )) * pingPongStrength );
sum += (noise - float32v( 0.5f )) * amp;
}

return sum;
Expand Down
6 changes: 3 additions & 3 deletions src/FastNoise/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ constexpr static std::nullptr_t gMetadataVectorSize = nullptr; // Invalid
// Setting these values avoids needless vector resizing and oversizing on startup
// Sadly there is no way to automate this as they fill up as part of static init
template<>
constexpr size_t gMetadataVectorSize<const Metadata*> = 44;
constexpr size_t gMetadataVectorSize<const Metadata*> = 45;
template<>
constexpr size_t gMetadataVectorSize<const char*> = 88;
constexpr size_t gMetadataVectorSize<const char*> = 87;
template<>
constexpr size_t gMetadataVectorSize<Metadata::MemberVariable> = 68;
constexpr size_t gMetadataVectorSize<Metadata::MemberVariable> = 70;
template<>
constexpr size_t gMetadataVectorSize<Metadata::MemberNodeLookup> = 30;
template<>
Expand Down

0 comments on commit 6fd5b43

Please sign in to comment.