Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Remove need for "outer" pins in blueprint #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ UUFNBlueprintFunctionLibrary::UUFNBlueprintFunctionLibrary(const class FObjectIn
{
}

UUFNNoiseGenerator* UUFNBlueprintFunctionLibrary::CreateNoiseGenerator(UObject* outer, ENoiseType noiseType, ECellularDistanceFunction cellularDistanceFunction, ECellularReturnType cellularReturnType, EFractalType fractalType, EInterp interpolation, int32 seed, int32 octaves, float frequency, float lacunarity, float fractalGain)
UUFNNoiseGenerator* UUFNBlueprintFunctionLibrary::CreateNoiseGenerator(UObject* outer, EUFN_NoiseType noiseType, ECellularDistanceFunction cellularDistanceFunction, ECellularReturnType cellularReturnType, EFractalType fractalType, EInterp interpolation, int32 seed, int32 octaves, float frequency, float lacunarity, float fractalGain)
{
UFastNoise* NoiseGen = NewObject<UFastNoise>(outer);

Expand Down Expand Up @@ -146,16 +146,16 @@ UUFNNoiseGenerator* UUFNBlueprintFunctionLibrary::CreateSimpleNoiseGenerator(UOb
switch (noiseType)
{
case ESimpleNoiseType::SimpleGradient:
NoiseGen->SetNoiseType(ENoiseType::Gradient);
NoiseGen->SetNoiseType(EUFN_NoiseType::Gradient);
break;
case ESimpleNoiseType::SimpleSimplex:
NoiseGen->SetNoiseType(ENoiseType::Simplex);
NoiseGen->SetNoiseType(EUFN_NoiseType::Simplex);
break;
case ESimpleNoiseType::SimpleValue:
NoiseGen->SetNoiseType(ENoiseType::Value);
NoiseGen->SetNoiseType(EUFN_NoiseType::Value);
break;
case ESimpleNoiseType::SimpleWhiteNoise:
NoiseGen->SetNoiseType(ENoiseType::WhiteNoise);
NoiseGen->SetNoiseType(EUFN_NoiseType::WhiteNoise);
break;
}

Expand All @@ -173,13 +173,13 @@ UUFNNoiseGenerator* UUFNBlueprintFunctionLibrary::CreateFractalNoiseGenerator(UO
switch (noiseType)
{
case EFractalNoiseType::FractalGradient:
NoiseGen->SetNoiseType(ENoiseType::GradientFractal);
NoiseGen->SetNoiseType(EUFN_NoiseType::GradientFractal);
break;
case EFractalNoiseType::FractalSimplex:
NoiseGen->SetNoiseType(ENoiseType::SimplexFractal);
NoiseGen->SetNoiseType(EUFN_NoiseType::SimplexFractal);
break;
case EFractalNoiseType::FractalValue:
NoiseGen->SetNoiseType(ENoiseType::ValueFractal);
NoiseGen->SetNoiseType(EUFN_NoiseType::ValueFractal);
break;
}

Expand All @@ -198,7 +198,7 @@ UUFNNoiseGenerator* UUFNBlueprintFunctionLibrary::CreateCellularNoiseGenerator(U
{
UFastNoise* NoiseGen = NewObject<UFastNoise>(outer);

NoiseGen->SetNoiseType(ENoiseType::Cellular);
NoiseGen->SetNoiseType(EUFN_NoiseType::Cellular);
NoiseGen->SetSeed(seed);
NoiseGen->SetFrequency(frequency);
NoiseGen->SetCellularDistanceFunction(cellularDistanceFunction);
Expand Down
38 changes: 19 additions & 19 deletions Source/UnrealFastNoisePlugin/Public/FastNoise/FastNoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "FastNoise.generated.h"

UENUM(BlueprintType)
enum class ENoiseType : uint8
enum class EUFN_NoiseType : uint8
{
Value,
ValueFractal,
Expand Down Expand Up @@ -149,7 +149,7 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator

// Sets noise return type of GetNoise(...)
// Default: Simplex
void SetNoiseType(ENoiseType noiseType) { m_noiseType = noiseType; }
void SetNoiseType(EUFN_NoiseType noiseType) { m_noiseType = noiseType; }

// Sets octave count for all fractal noise types
// Default: 3
Expand Down Expand Up @@ -215,9 +215,9 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator

switch (m_noiseType)
{
case ENoiseType::Value:
case EUFN_NoiseType::Value:
return SingleValue(0, x, y);
case ENoiseType::ValueFractal:
case EUFN_NoiseType::ValueFractal:
switch (m_fractalType)
{
case EFractalType::FBM:
Expand All @@ -229,9 +229,9 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return 0.0f;
}
case ENoiseType::Gradient:
case EUFN_NoiseType::Gradient:
return SingleGradient(0, x, y);
case ENoiseType::GradientFractal:
case EUFN_NoiseType::GradientFractal:
switch (m_fractalType)
{
case EFractalType::FBM:
Expand All @@ -243,9 +243,9 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return 0.0f;
}
case ENoiseType::Simplex:
case EUFN_NoiseType::Simplex:
return SingleSimplex(0, x, y);
case ENoiseType::SimplexFractal:
case EUFN_NoiseType::SimplexFractal:
switch (m_fractalType)
{
case EFractalType::FBM:
Expand All @@ -257,7 +257,7 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return 0.0f;
}
case ENoiseType::Cellular:
case EUFN_NoiseType::Cellular:
switch (m_cellularReturnType)
{
case ECellularReturnType::CellValue:
Expand All @@ -267,7 +267,7 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return SingleCellular2Edge(x, y);
}
case ENoiseType::WhiteNoise:
case EUFN_NoiseType::WhiteNoise:
return GetWhiteNoise(x, y);
default:
return 0.0f;
Expand Down Expand Up @@ -342,9 +342,9 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator

switch (m_noiseType)
{
case ENoiseType::Value:
case EUFN_NoiseType::Value:
return SingleValue(0, x, y, z);
case ENoiseType::ValueFractal:
case EUFN_NoiseType::ValueFractal:
switch (m_fractalType)
{
case EFractalType::FBM:
Expand All @@ -356,9 +356,9 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return 0.0f;
}
case ENoiseType::Gradient:
case EUFN_NoiseType::Gradient:
return SingleGradient(0, x, y, z);
case ENoiseType::GradientFractal:
case EUFN_NoiseType::GradientFractal:
switch (m_fractalType)
{
case EFractalType::FBM:
Expand All @@ -370,9 +370,9 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return 0.0f;
}
case ENoiseType::Simplex:
case EUFN_NoiseType::Simplex:
return SingleSimplex(0, x, y, z);
case ENoiseType::SimplexFractal:
case EUFN_NoiseType::SimplexFractal:
switch (m_fractalType)
{
case EFractalType::FBM:
Expand All @@ -384,7 +384,7 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return 0.0f;
}
case ENoiseType::Cellular:
case EUFN_NoiseType::Cellular:
switch (m_cellularReturnType)
{
case ECellularReturnType::CellValue:
Expand All @@ -394,7 +394,7 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
default:
return SingleCellular2Edge(x, y, z);
}
case ENoiseType::WhiteNoise:
case EUFN_NoiseType::WhiteNoise:
return GetWhiteNoise(x, y, z);
default:
return 0.0f;
Expand Down Expand Up @@ -432,7 +432,7 @@ class UNREALFASTNOISEPLUGIN_API UFastNoise : public UUFNNoiseGenerator
int m_seed = 1337;
float m_frequency = 0.01f;
EInterp m_interp = EInterp::InterpQuintic;
ENoiseType m_noiseType = ENoiseType::Simplex;
EUFN_NoiseType m_noiseType = EUFN_NoiseType::Simplex;

EPositionWarpType m_positionWarpType = EPositionWarpType::None;

Expand Down
30 changes: 15 additions & 15 deletions Source/UnrealFastNoisePlugin/Public/UFNBlueprintFunctionLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,44 @@ class UNREALFASTNOISEPLUGIN_API UUFNBlueprintFunctionLibrary : public UBlueprint
{
GENERATED_UCLASS_BODY()
// Creates a new noise generator module. Note that not all parameters may be relevant e.g. Fractal noise types will ignore Cellular parameters
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
static UUFNNoiseGenerator* CreateNoiseGenerator(UObject* outer, ENoiseType noiseType, ECellularDistanceFunction cellularDistanceFunction, ECellularReturnType cellularReturnType, EFractalType fractalType, EInterp interpolation, int32 seed = 1337, int32 octaves = 4, float frequency = 0.001f, float lacunarity = 2.0f, float fractalGain = 0.5f);
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateNoiseGenerator(UObject* outer, EUFN_NoiseType noiseType, ECellularDistanceFunction cellularDistanceFunction, ECellularReturnType cellularReturnType, EFractalType fractalType, EInterp interpolation, int32 seed = 1337, int32 octaves = 4, float frequency = 0.001f, float lacunarity = 2.0f, float fractalGain = 0.5f);
// Creates a Select module. Returns a value either from input1 or input 2, depending on the value returned from the select module. Has sine in/out smooth falloff option (may be wonky)
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateSelectModule(UObject* outer, UUFNNoiseGenerator* inputModule1, UUFNNoiseGenerator* inputModule2, UUFNNoiseGenerator* selectModule, ESelectInterpType interpolationType = ESelectInterpType::None, float falloff = 0.0f, float threshold = 0.0f, int32 steps = 4);
// Creates Blend modules. Returns a blended value from input1 and input 2, based on the value returned from the select module. Blend range is from -1.0 to 1.0;
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateBlendModule(UObject* outer, UUFNNoiseGenerator* inputModule1, UUFNNoiseGenerator* inputModule2, UUFNNoiseGenerator* selectModule, UCurveFloat* blendCurve = nullptr);
// Creates a Scale/Bias modules. Applies a multiplier, and or additive value to the value returned from the input
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateScaleBiasModule(UObject* outer, UUFNNoiseGenerator* inputModule, float scale = 1.0f, float bias = 0.0f);
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateWarpModule(UObject* outer, UUFNNoiseGenerator* inputModule, UUFNNoiseGenerator* warpModule, float multiplier, EWarpIterations warpIterations);
// Creates an Add module. Adds two modules together, clamping the result and optionally accepting a third module as a mask with threshold
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateAddModule(UObject* outer, UUFNNoiseGenerator* inputModule1, UUFNNoiseGenerator* inputModule2, UUFNNoiseGenerator* maskModule = nullptr, float threshold = 1.0f);
// Creates a Constant modules. Returns a constant value
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateConstantModule(UObject* outer, float constantValue);
// Creates a simple (non-fractal) noise module
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateSimpleNoiseGenerator(UObject* outer, ESimpleNoiseType noiseType, int32 seed = 12345, float frequency = 0.1f, EInterp interpolation = EInterp::InterpLinear);
// Creates a Fractal noise module
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateFractalNoiseGenerator(UObject* outer, EFractalNoiseType noiseType, int32 seed = 12345, float frequency = 0.1f, float fractalGain = 0.5f, EInterp interpolation = EInterp::InterpLinear, EFractalType fractalType = EFractalType::Billow, int32 octaves = 4, float lacunarity = 2.0f);
// Creates a Cellular (Voronoi) noise module
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateCellularNoiseGenerator(UObject* outer, int32 seed = 12345, float frequency = 0.1f, ECellularDistanceFunction cellularDistanceFunction = ECellularDistanceFunction::Euclidean, ECellularReturnType cellularReturnType = ECellularReturnType::CellValue);
// Creates a spline module.
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateSplineGenerator(UObject* outer, float MaxDistance, float MinDistance, TArray<class USplineComponent*> Splines, UCurveFloat* falloffCurve = nullptr);
// Creates a Select module. Returns a value either from input1 or input 2 or input 3, depending on the value returned from the select module.
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* Create3SelectModule(UObject* outer, UUFNNoiseGenerator* inputModule1, UUFNNoiseGenerator* inputModule2, UUFNNoiseGenerator* inputModule3, UUFNNoiseGenerator* selectModule, float lowerThreshold = 0.0f, float upperThreshold = 0.0f, ESelectInterpType interpolationType = ESelectInterpType::None, float falloff = 0.0f, int32 steps = 4);
// Creates a Radial module. Returns a value either from input1 or input 2, depending on the distance from the origin. Has smooth falloff option (may be wonky)
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateRadialModule(UObject* outer, UUFNNoiseGenerator* inputModule1, UUFNNoiseGenerator* inputModule2, ESelectInterpType interpolationType = ESelectInterpType::None, FVector origin = FVector(0.0f), float radius = 500.f, float falloff = 0.0f, int32 steps = 4);
// Creates a Shore Filters module. Adjusts terrain near water level to encourage smooth beach like features.
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise")
UFUNCTION(BlueprintPure, Category = "UnrealFastNoise", meta=(HidePin = "outer", DefaultToSelf = "outer"))
static UUFNNoiseGenerator* CreateShoreFilterModule(UObject* outer, UUFNNoiseGenerator* inputModule1, const float shoreHeight, const float threshold);
};