From 38e3e6aab6a8481a1bd4e5d75c690c390dd83f38 Mon Sep 17 00:00:00 2001 From: Auburn Date: Tue, 3 Dec 2024 21:27:57 +0000 Subject: [PATCH] Reorganised node groups, added modulus node --- include/FastNoise/Generators/Blends.h | 661 +++++++++++---------- include/FastNoise/Generators/Blends.inl | 15 + include/FastNoise/Generators/Generator.inl | 2 +- include/FastNoise/Generators/Modifiers.h | 12 +- src/CMakeLists.txt | 6 +- src/FastNoise/FastSIMD_Build.inl | 2 + src/FastNoise/Metadata.cpp | 12 +- 7 files changed, 381 insertions(+), 329 deletions(-) diff --git a/include/FastNoise/Generators/Blends.h b/include/FastNoise/Generators/Blends.h index 189b609..a2a026c 100644 --- a/include/FastNoise/Generators/Blends.h +++ b/include/FastNoise/Generators/Blends.h @@ -1,313 +1,348 @@ -#pragma once -#include "Generator.h" - -#include - -namespace FastNoise -{ - class OperatorSourceLHS : public virtual Generator - { - public: - void SetLHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mLHS, gen ); } - void SetRHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mRHS, gen ); } - void SetRHS( float value ) { mRHS = value; } - - protected: - GeneratorSource mLHS; - HybridSource mRHS = 0.0f; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - MetadataT() - { - groups.push_back( "Blends" ); - this->AddGeneratorSource( "LHS", &OperatorSourceLHS::SetLHS ); - this->AddHybridSource( "RHS", 0.0f, &OperatorSourceLHS::SetRHS, &OperatorSourceLHS::SetRHS ); - } - }; -#endif - - class OperatorHybridLHS : public virtual Generator - { - public: - void SetLHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mLHS, gen ); } - void SetLHS( float value ) { mLHS = value; } - void SetRHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mRHS, gen ); } - void SetRHS( float value ) { mRHS = value; } - - protected: - HybridSource mLHS = 0.0f; - HybridSource mRHS = 0.0f; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - MetadataT() - { - groups.push_back( "Blends" ); - this->AddHybridSource( "LHS", 0.0f, &OperatorHybridLHS::SetLHS, &OperatorHybridLHS::SetLHS ); - this->AddHybridSource( "RHS", 0.0f, &OperatorHybridLHS::SetRHS, &OperatorHybridLHS::SetRHS ); - } - }; -#endif - - class Add : public virtual OperatorSourceLHS - { - public: const Metadata& GetMetadata() const override; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - }; -#endif - - class Subtract : public virtual OperatorHybridLHS - { - public: const Metadata& GetMetadata() const override; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - }; -#endif - - class Multiply : public virtual OperatorSourceLHS - { - public: const Metadata& GetMetadata() const override; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - }; -#endif - - class Divide : public virtual OperatorHybridLHS - { - public: const Metadata& GetMetadata() const override; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - }; -#endif - - class Min : public virtual OperatorSourceLHS - { - public: const Metadata& GetMetadata() const override; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - }; -#endif - - class Max : public virtual OperatorSourceLHS - { - public: const Metadata& GetMetadata() const override; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - }; -#endif - - class PowFloat : public virtual Generator - { - public: const Metadata& GetMetadata() const override; - - void SetValue( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mValue, gen ); } - void SetValue( float value ) { mValue = value; } - void SetPow( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mPow, gen ); } - void SetPow( float value ) { mPow = value; } - - protected: - HybridSource mValue = 2.0f; - HybridSource mPow = 2.0f; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - - MetadataT() - { - groups.push_back( "Blends" ); - this->AddHybridSource( "Value", 2.0f, &PowFloat::SetValue, &PowFloat::SetValue ); - this->AddHybridSource( "Pow", 2.0f, &PowFloat::SetPow, &PowFloat::SetPow ); - - description = "Equivalent to std::powf( value, pow )"; - } - }; -#endif - - class PowInt : public virtual Generator - { - public: const Metadata& GetMetadata() const override; - - void SetValue( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mValue, gen ); } - void SetPow( int value ) { mPow = value; } - - protected: - GeneratorSource mValue; - int mPow = 2; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - - MetadataT() - { - groups.push_back( "Blends" ); - this->AddGeneratorSource( "Value", &PowInt::SetValue ); - this->AddVariable( "Pow", 2, &PowInt::SetPow, 2 ); - - description = "Faster than PowFloat node but only for int powers"; - } - }; -#endif - - class MinSmooth : public virtual OperatorSourceLHS - { - public: const Metadata& GetMetadata() const override; - - void SetSmoothness( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mSmoothness, gen ); } - void SetSmoothness( float value ) { mSmoothness = value; } - - protected: - HybridSource mSmoothness = 0.1f; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - - MetadataT() - { - this->AddHybridSource( "Smoothness", 0.1f, &MinSmooth::SetSmoothness, &MinSmooth::SetSmoothness ); - - description = - "Quadratic Smooth Minimum\n" - "Smoothes the transition between the 2 inputs\n" - "For explanation see:\n" - "https://iquilezles.org/articles/smin/"; - } - }; -#endif - - class MaxSmooth : public virtual OperatorSourceLHS - { - public: const Metadata& GetMetadata() const override; - - void SetSmoothness( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mSmoothness, gen ); } - void SetSmoothness( float value ) { mSmoothness = value; } - - protected: - HybridSource mSmoothness = 0.1f; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - - MetadataT() - { - this->AddHybridSource( "Smoothness", 0.1f, &MaxSmooth::SetSmoothness, &MaxSmooth::SetSmoothness ); - - description = - "Quadratic Smooth Maximum\n" - "Smoothes the transition between the 2 inputs\n" - "For explanation see:\n" - "https://iquilezles.org/articles/smin/"; - } - }; -#endif - - class Fade : public virtual Generator - { - public: - enum class Interpolation - { - Linear, - Hermite, - Quintic, - }; - const Metadata& GetMetadata() const override; - void SetA( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mA, gen ); } - void SetB( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mB, gen ); } - - void SetFade( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mFade, gen ); } - void SetFade( float value ) { mFade = value; } - - void SetFadeMin( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mFadeMin, gen ); } - void SetFadeMin( float value ) { mFadeMin = value; } - - void SetFadeMax( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mFadeMax, gen ); } - void SetFadeMax( float value ) { mFadeMax = value; } - - void SetInterpolation( Interpolation interpolation ) { mInterpolation = interpolation; } - - protected: - GeneratorSource mA; - GeneratorSource mB; - HybridSource mFade = 0; - HybridSource mFadeMin = -1.f; - HybridSource mFadeMax = 1.f; - Interpolation mInterpolation = Interpolation::Linear; - }; - -#ifdef FASTNOISE_METADATA - template<> - struct MetadataT : MetadataT - { - SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; - - MetadataT() - { - groups.push_back( "Blends" ); - this->AddGeneratorSource( { "A", "From" }, &Fade::SetA ); - this->AddGeneratorSource( { "B", "To" }, &Fade::SetB ); - this->AddHybridSource( "Fade", 0, &Fade::SetFade, &Fade::SetFade ); - this->AddHybridSource( "Fade Min", -1.f, &Fade::SetFadeMin, &Fade::SetFadeMin ); - this->AddHybridSource( "Fade Max", 1.f, &Fade::SetFadeMax, &Fade::SetFadeMax ); - this->AddVariableEnum( { "Interpolation", "Easing function" }, Fade::Interpolation::Linear, &Fade::SetInterpolation, "Linear", "Hermite", "Quintic" ); - - description = - "Output fades between inputs A and B\n" - "Fade Min = 100% A\n" - "Fade Max = 100% B"; - } - }; -#endif -} +#pragma once +#include "Generator.h" + +#include + +namespace FastNoise +{ + class OperatorSourceLHS : public virtual Generator + { + public: + void SetLHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mLHS, gen ); } + void SetRHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mRHS, gen ); } + void SetRHS( float value ) { mRHS = value; } + + protected: + GeneratorSource mLHS; + HybridSource mRHS = 0.0f; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + MetadataT( const char* group = "Blends" ) + { + groups.push_back( group ); + this->AddGeneratorSource( "LHS", &OperatorSourceLHS::SetLHS ); + this->AddHybridSource( "RHS", 0.0f, &OperatorSourceLHS::SetRHS, &OperatorSourceLHS::SetRHS ); + } + }; +#endif + + class OperatorHybridLHS : public virtual Generator + { + public: + void SetLHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mLHS, gen ); } + void SetLHS( float value ) { mLHS = value; } + void SetRHS( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mRHS, gen ); } + void SetRHS( float value ) { mRHS = value; } + + protected: + HybridSource mLHS = 0.0f; + HybridSource mRHS = 0.0f; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + MetadataT( const char* group = "Blends" ) + { + groups.push_back( group ); + this->AddHybridSource( "LHS", 0.0f, &OperatorHybridLHS::SetLHS, &OperatorHybridLHS::SetLHS ); + this->AddHybridSource( "RHS", 0.0f, &OperatorHybridLHS::SetRHS, &OperatorHybridLHS::SetRHS ); + } + }; +#endif + + class Add : public virtual OperatorSourceLHS + { + public: + const Metadata& GetMetadata() const override; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() : MetadataT( "Operators" ) {} + }; +#endif + + class Subtract : public virtual OperatorHybridLHS + { + public: + const Metadata& GetMetadata() const override; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() : MetadataT( "Operators" ) {} + }; +#endif + + class Multiply : public virtual OperatorSourceLHS + { + public: + const Metadata& GetMetadata() const override; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() : MetadataT( "Operators" ) {} + }; +#endif + + class Divide : public virtual OperatorHybridLHS + { + public: + const Metadata& GetMetadata() const override; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() : MetadataT( "Operators" ) {} + }; +#endif + + class Modulus : public virtual OperatorHybridLHS + { + public: + const Metadata& GetMetadata() const override; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() : MetadataT( "Operators" ) {} + }; +#endif + + class Min : public virtual OperatorSourceLHS + { + public: + const Metadata& GetMetadata() const override; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + }; +#endif + + class Max : public virtual OperatorSourceLHS + { + public: + const Metadata& GetMetadata() const override; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + }; +#endif + + class PowFloat : public virtual Generator + { + public: + const Metadata& GetMetadata() const override; + + void SetValue( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mValue, gen ); } + void SetValue( float value ) { mValue = value; } + void SetPow( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mPow, gen ); } + void SetPow( float value ) { mPow = value; } + + protected: + HybridSource mValue = 2.0f; + HybridSource mPow = 2.0f; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() + { + groups.push_back( "Blends" ); + this->AddHybridSource( "Value", 2.0f, &PowFloat::SetValue, &PowFloat::SetValue ); + this->AddHybridSource( "Pow", 2.0f, &PowFloat::SetPow, &PowFloat::SetPow ); + + description = "Equivalent to std::powf( value, pow )"; + } + }; +#endif + + class PowInt : public virtual Generator + { + public: + const Metadata& GetMetadata() const override; + + void SetValue( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mValue, gen ); } + void SetPow( int value ) { mPow = value; } + + protected: + GeneratorSource mValue; + int mPow = 2; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() + { + groups.push_back( "Blends" ); + this->AddGeneratorSource( "Value", &PowInt::SetValue ); + this->AddVariable( "Pow", 2, &PowInt::SetPow, 2 ); + + description = "Faster than PowFloat node but only for int powers"; + } + }; +#endif + + class MinSmooth : public virtual OperatorSourceLHS + { + public: + const Metadata& GetMetadata() const override; + + void SetSmoothness( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mSmoothness, gen ); } + void SetSmoothness( float value ) { mSmoothness = value; } + + protected: + HybridSource mSmoothness = 0.1f; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() + { + this->AddHybridSource( "Smoothness", 0.1f, &MinSmooth::SetSmoothness, &MinSmooth::SetSmoothness ); + + description = + "Quadratic Smooth Minimum\n" + "Smoothes the transition between the 2 inputs\n" + "For explanation see:\n" + "https://iquilezles.org/articles/smin/"; + } + }; +#endif + + class MaxSmooth : public virtual OperatorSourceLHS + { + public: + const Metadata& GetMetadata() const override; + + void SetSmoothness( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mSmoothness, gen ); } + void SetSmoothness( float value ) { mSmoothness = value; } + + protected: + HybridSource mSmoothness = 0.1f; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() + { + this->AddHybridSource( "Smoothness", 0.1f, &MaxSmooth::SetSmoothness, &MaxSmooth::SetSmoothness ); + + description = + "Quadratic Smooth Maximum\n" + "Smoothes the transition between the 2 inputs\n" + "For explanation see:\n" + "https://iquilezles.org/articles/smin/"; + } + }; +#endif + + class Fade : public virtual Generator + { + public: + enum class Interpolation + { + Linear, + Hermite, + Quintic, + }; + + const Metadata& GetMetadata() const override; + void SetA( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mA, gen ); } + void SetB( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mB, gen ); } + + void SetFade( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mFade, gen ); } + void SetFade( float value ) { mFade = value; } + + void SetFadeMin( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mFadeMin, gen ); } + void SetFadeMin( float value ) { mFadeMin = value; } + + void SetFadeMax( SmartNodeArg<> gen ) { this->SetSourceMemberVariable( mFadeMax, gen ); } + void SetFadeMax( float value ) { mFadeMax = value; } + + void SetInterpolation( Interpolation interpolation ) { mInterpolation = interpolation; } + + protected: + GeneratorSource mA; + GeneratorSource mB; + HybridSource mFade = 0; + HybridSource mFadeMin = -1.f; + HybridSource mFadeMax = 1.f; + Interpolation mInterpolation = Interpolation::Linear; + }; + +#ifdef FASTNOISE_METADATA + template<> + struct MetadataT : MetadataT + { + SmartNode<> CreateNode( FastSIMD::FeatureSet ) const override; + + MetadataT() + { + groups.push_back( "Blends" ); + this->AddGeneratorSource( { "A", "From" }, &Fade::SetA ); + this->AddGeneratorSource( { "B", "To" }, &Fade::SetB ); + this->AddHybridSource( "Fade", 0, &Fade::SetFade, &Fade::SetFade ); + this->AddHybridSource( "Fade Min", -1.f, &Fade::SetFadeMin, &Fade::SetFadeMin ); + this->AddHybridSource( "Fade Max", 1.f, &Fade::SetFadeMax, &Fade::SetFadeMax ); + this->AddVariableEnum( { "Interpolation", "Easing function" }, Fade::Interpolation::Linear, &Fade::SetInterpolation, "Linear", "Hermite", "Quintic" ); + + description = + "Output fades between inputs A and B\n" + "Fade Min = 100% A\n" + "Fade Max = 100% B"; + } + }; +#endif +} diff --git a/include/FastNoise/Generators/Blends.inl b/include/FastNoise/Generators/Blends.inl index 7d4c0af..821e13a 100644 --- a/include/FastNoise/Generators/Blends.inl +++ b/include/FastNoise/Generators/Blends.inl @@ -48,6 +48,21 @@ class FastSIMD::DispatchClass final : public virtual Fa } }; +template +class FastSIMD::DispatchClass final : public virtual FastNoise::Modulus, public FastSIMD::DispatchClass +{ + FASTNOISE_IMPL_GEN_T; + + template + FS_FORCEINLINE float32v GenT( int32v seed, P... pos ) const + { + float32v a = this->GetSourceValue( mLHS, seed, pos... ); + float32v b = this->GetSourceValue( mRHS, seed, pos... ); + + return FS::Modulus( a, b ); + } +}; + template class FastSIMD::DispatchClass final : public virtual FastNoise::PowFloat, public FastSIMD::DispatchClass { diff --git a/include/FastNoise/Generators/Generator.inl b/include/FastNoise/Generators/Generator.inl index adc32bc..86f28a9 100644 --- a/include/FastNoise/Generators/Generator.inl +++ b/include/FastNoise/Generators/Generator.inl @@ -161,7 +161,7 @@ public: index += int32v::ElementCount; xIdx += int32v( int32v::ElementCount ); - + AxisReset( xIdx, yIdx, xMax, xSizeV, xSize ); AxisReset( yIdx, zIdx, yMax, ySizeV, xSize * ySize ); } diff --git a/include/FastNoise/Generators/Modifiers.h b/include/FastNoise/Generators/Modifiers.h index f8f8179..9e3df51 100644 --- a/include/FastNoise/Generators/Modifiers.h +++ b/include/FastNoise/Generators/Modifiers.h @@ -24,7 +24,7 @@ namespace FastNoise MetadataT() { - groups.push_back( "Modifiers" ); + groups.push_back( "Domain Modifiers" ); this->AddGeneratorSource( "Source", &DomainScale::SetSource ); this->AddVariable( "Scaling", 1.0f, &DomainScale::SetScaling ); } @@ -60,7 +60,7 @@ namespace FastNoise MetadataT() { - groups.push_back( "Modifiers" ); + groups.push_back( "Domain Modifiers" ); this->AddGeneratorSource( "Source", &DomainOffset::SetSource ); this->AddPerDimensionHybridSource( "Offset", 0.0f, []( DomainOffset* p ) { return std::ref( p->mOffset ); }, 0.25f ); } @@ -121,7 +121,7 @@ namespace FastNoise MetadataT() { - groups.push_back( "Modifiers" ); + groups.push_back( "Domain Modifiers" ); this->AddGeneratorSource( "Source", &DomainRotate::SetSource ); this->AddVariable( "Yaw", 0.0f, &DomainRotate::SetYaw ); this->AddVariable( "Pitch", 0.0f, &DomainRotate::SetPitch ); @@ -309,7 +309,7 @@ namespace FastNoise MetadataT() { - groups.push_back( "Modifiers" ); + groups.push_back( "Domain Modifiers" ); this->AddGeneratorSource( "Source", &DomainAxisScale::SetSource ); this->AddPerDimensionVariable( "Scaling", 1.0f, []( DomainAxisScale* p ) { return std::ref( p->mScale ); } ); } @@ -338,7 +338,7 @@ namespace FastNoise MetadataT() { - groups.push_back( "Modifiers" ); + groups.push_back( "Domain Modifiers" ); this->AddGeneratorSource( "Source", &AddDimension::SetSource ); this->AddHybridSource( "New Dimension Position", 0.0f, &AddDimension::SetNewDimensionPosition, &AddDimension::SetNewDimensionPosition ); } @@ -366,7 +366,7 @@ namespace FastNoise MetadataT() { - groups.push_back( "Modifiers" ); + groups.push_back( "Domain Modifiers" ); this->AddGeneratorSource( "Source", &RemoveDimension::SetSource ); this->AddVariableEnum( "Remove Dimension", Dim::Y, &RemoveDimension::SetRemoveDimension, kDim_Strings ); } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5bce530..f4db509 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,7 @@ CPMAddPackage( NAME FastSIMD GITHUB_REPOSITORY Auburn/FastSIMD - GIT_TAG 868e77272ac0681a6b2936c1ef9087bb3ec8c153 + GIT_TAG 2417e5b938d7e0aa4f4293d11682db0582a83ce8 ) set(install_targets ${install_targets} @@ -69,13 +69,13 @@ endif() target_link_libraries(FastNoise PUBLIC FastSIMD FastSIMD_FastNoise) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - target_compile_options(FastSIMD_FastNoise PRIVATE /GL- /GS- /wd4251 /d2vzeroupper-) + target_compile_options(FastSIMD_FastNoise PRIVATE /GL- /GS- /wd4251 /permissive- /d2vzeroupper-) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if(MSVC) target_compile_options(FastSIMD_FastNoise PRIVATE /GS-) else() - target_compile_options(FastSIMD_FastNoise PRIVATE -fno-stack-protector) + target_compile_options(FastSIMD_FastNoise PRIVATE -fno-stack-protector -Wno-nan-infinity-disabled) endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") diff --git a/src/FastNoise/FastSIMD_Build.inl b/src/FastNoise/FastSIMD_Build.inl index ec7a8a2..9733011 100644 --- a/src/FastNoise/FastSIMD_Build.inl +++ b/src/FastNoise/FastSIMD_Build.inl @@ -138,3 +138,5 @@ FASTNOISE_REGISTER_NODE( Remap ); FASTNOISE_REGISTER_NODE( Terrace ); FASTNOISE_REGISTER_NODE( AddDimension ); FASTNOISE_REGISTER_NODE( RemoveDimension ); + +FASTNOISE_REGISTER_NODE( Modulus ); diff --git a/src/FastNoise/Metadata.cpp b/src/FastNoise/Metadata.cpp index 8d52d94..87db80b 100644 --- a/src/FastNoise/Metadata.cpp +++ b/src/FastNoise/Metadata.cpp @@ -21,15 +21,15 @@ 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 = 45; +constexpr size_t gMetadataVectorSize = 46; template<> -constexpr size_t gMetadataVectorSize = 83; +constexpr size_t gMetadataVectorSize = 84; template<> constexpr size_t gMetadataVectorSize = 71; template<> constexpr size_t gMetadataVectorSize = 30; template<> -constexpr size_t gMetadataVectorSize = 54; +constexpr size_t gMetadataVectorSize = 56; template static std::vector& GetVectorStorage() @@ -171,7 +171,7 @@ static bool SerialiseNodeDataInternal( NodeData* nodeData, bool fixUp, std::vect { if( nodeData->variables[i].i != metadata->memberVariables[i].valueDefault.i ) { - AddMemberLookupToDataStream( dataStream, 0, i ); + AddMemberLookupToDataStream( dataStream, 0, (uint8_t)i ); AddToDataStream( dataStream, nodeData->variables[i].i ); } @@ -211,7 +211,7 @@ static bool SerialiseNodeDataInternal( NodeData* nodeData, bool fixUp, std::vect { if( nodeData->hybrids[i].second != metadata->memberHybrids[i].valueDefault ) { - AddMemberLookupToDataStream( dataStream, 2, i ); + AddMemberLookupToDataStream( dataStream, 2, (uint8_t)i ); Metadata::MemberVariable::ValueUnion v = nodeData->hybrids[i].second; @@ -233,7 +233,7 @@ static bool SerialiseNodeDataInternal( NodeData* nodeData, bool fixUp, std::vect } } - AddMemberLookupToDataStream( dataStream, 3, i ); + AddMemberLookupToDataStream( dataStream, 3, (uint8_t)i ); if( !SerialiseNodeDataInternal( nodeData->hybrids[i].first, fixUp, dataStream, referenceIds, dependencies ) ) {