Skip to content

Commit

Permalink
TEST hybrid range inputs for ScalableGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Apr 28, 2024
1 parent f9498a4 commit f8fd6f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions include/FastNoise/Generators/BasicGenerators.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ namespace FastNoise
public:
void SetOutputMin( float value )
{
mRangeScale += mRangeMin - value;
//mRangeScale += mRangeMin - value;
mRangeMin = value;
}

void SetOutputMax( float value )
{
mRangeScale = ( value - mRangeMin );
mRangeScale = value;
//mRangeScale = ( value - mRangeMin );
}

protected:
float mRangeMin = -1;
float mRangeScale = 2;
HybridSource mRangeMin = -1;
HybridSource mRangeScale = 2;
};

#ifdef FASTNOISE_METADATA
Expand Down
5 changes: 4 additions & 1 deletion include/FastNoise/Generators/BasicGenerators.inl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class FastSIMD::DispatchClass<FastNoise::VariableRange<PARENT>, SIMD> : public v
protected:
FS_FORCEINLINE float32v ScaleOutput( float32v value, float nativeMin, float nativeMax ) const
{
return FS::FMulAdd( float32v( 1.0f / ( nativeMax - nativeMin ) ) * float32v( this->mRangeScale ), value - float32v( nativeMin ), float32v( this->mRangeMin ) );
float32v rangeMin = this->GetSourceValue( this->mRangeMin, int32v(), float32v(), float32v() );
float32v rangeScale = this->GetSourceValue( this->mRangeScale, int32v(), float32v(), float32v() ) - rangeMin;

return FS::FMulAdd( float32v( 1.0f / ( nativeMax - nativeMin ) ) * rangeScale, value - float32v( nativeMin ), rangeMin );
}
};

Expand Down

0 comments on commit f8fd6f8

Please sign in to comment.