diff --git a/NoiseEngine/Contracts/INoiseEngine.cs b/NoiseEngine/Contracts/INoiseEngine.cs index 15f9140..6e5285d 100644 --- a/NoiseEngine/Contracts/INoiseEngine.cs +++ b/NoiseEngine/Contracts/INoiseEngine.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace CubicNoise.Contracts +namespace NoiseEngine.Contracts { /// /// An interface which each noise generator must implement. diff --git a/NoiseEngine/Contracts/IParameterName.cs b/NoiseEngine/Contracts/IParameterName.cs index 89cf4d2..703e864 100644 --- a/NoiseEngine/Contracts/IParameterName.cs +++ b/NoiseEngine/Contracts/IParameterName.cs @@ -1,4 +1,4 @@ -namespace CubicNoise.Contracts +namespace NoiseEngine.Contracts { /// /// An interface which gets used to provide arbitrary parameter names diff --git a/NoiseEngine/EngineParameters.cs b/NoiseEngine/EngineParameters.cs index bb4cd25..72d5706 100644 --- a/NoiseEngine/EngineParameters.cs +++ b/NoiseEngine/EngineParameters.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using CubicNoise.Contracts; +using NoiseEngine.Contracts; -namespace CubicNoise +namespace NoiseEngine { /// /// This class stores all parameters needed to create a noise engine instance. diff --git a/NoiseEngine/Extensions.cs b/NoiseEngine/Extensions.cs index d77fcc8..2ed2058 100644 --- a/NoiseEngine/Extensions.cs +++ b/NoiseEngine/Extensions.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using CubicNoise.Noisers; +using NoiseEngine.Noisers; -namespace CubicNoise +namespace NoiseEngine { /// /// Extension methods for this library. diff --git a/NoiseEngine/NoiseEngine.xml b/NoiseEngine/NoiseEngine.xml index f0d302e..5d95d32 100644 --- a/NoiseEngine/NoiseEngine.xml +++ b/NoiseEngine/NoiseEngine.xml @@ -1,22 +1,22 @@ - CubicNoise + NoiseEngine - + An interface which each noise generator must implement. - + Producing a one-dimensional based noise value. The x coordinate. The noise value. - + Produces a two-dimensional based noise value. @@ -24,7 +24,7 @@ The y coordinate. The noise value. - + An interface which gets used to provide arbitrary parameter names to the general noise engine class. It is a way to abstract the @@ -32,34 +32,34 @@ for different noise generators. - + This class stores all parameters needed to create a noise engine instance. - + The engine's seed value. To use a string value as seed, use the GetDeterministicHashCode() method which gets provided by this library. A different seed value results in a complete different result. When you generate e.g. a landscape, two different seeds will produce different landscapes. - + The desired kind of noise generator. - + A dictionary of additional parameters needed by the chosen noise generator. - + Extension methods for this library. - + This is a deterministic hash function for strings. The official hash methods in .NET Core are no longer deterministic due to possible hashing attacks, cf. https://youtu.be/R2Cq3CLI6H8. @@ -76,7 +76,7 @@ The string for which a hash value is to be computed. A deterministic 32 bit / 4 byte hash value of the given string. - + The main class of the library. You should use it to generate a noise engine. This class is thread-safe. You can use all methods from as many threads, as you want. There a no async methods, because the @@ -86,7 +86,7 @@ Not only the factory method is thread-safe. Each instance of the class is thread-safe as well. - + The factory method to use for generating a noise engine. This method is thread-safe. Call it from as many threads as you want. @@ -94,7 +94,7 @@ The parameters for the desired noise engine. The desired noise engine instance. - + Yields a one-dimensional based noise value. This method is thread-safe as well. Call it from as many threads as you want. You can expect about 16 million calls per CPU core per second (year 2019). @@ -102,7 +102,7 @@ The x coordinate. The corresponding noise value for the given coordinate. - + Yields a two-dimensional based noise value. This method is thread-safe as well. Call it from as many threads as you want. You can expect about 6 million calls per CPU core per second (year 2019). @@ -111,7 +111,7 @@ The y coordinate. The corresponding noise value for the given 2d coordinate. - + This is the cubic noise engine by Job Talle, cf. https://jobtalle.com/cubic_noise.html. It based on the C# version which was provided at Github: https://github.com/jobtalle/CubicNoise/blob/master/c%23/CubicNoise.cs. @@ -122,44 +122,44 @@ used useful C# 8.0 / .NET Core 3.1 LTS features. - + This class contains all known cubic noise's parameters. - + Cubic noise's octave parameter. - + Cubic noise's period x parameter. - + Cubic noise's period y parameter. - + This is the random number engine which gets used in case that the UNKNOWN type was used. This engine is not meant for production. It is a placeholder for empty values, where a type is needed. The engine will generate a random value each time. - + All implemented noise generators. - + The UNKNOWN generator is a placeholder for empty values. You should not use it in production. It generates random numbers on every call. - + This is the cubic noise generator by Job Talle, cf. https://jobtalle.com/cubic_noise.html and https://github.com/jobtalle. diff --git a/NoiseEngine/NoiseEngine.cs b/NoiseEngine/NoiseProcessor.cs similarity index 83% rename from NoiseEngine/NoiseEngine.cs rename to NoiseEngine/NoiseProcessor.cs index 4d8d763..be44471 100644 --- a/NoiseEngine/NoiseEngine.cs +++ b/NoiseEngine/NoiseProcessor.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.Text; -using CubicNoise.Contracts; -using CubicNoise.Noisers; +using NoiseEngine.Contracts; +using NoiseEngine.Noisers; -namespace CubicNoise +namespace NoiseEngine { /// /// The main class of the library. You should use it to generate a noise engine. This class is thread-safe. @@ -14,11 +14,11 @@ namespace CubicNoise /// /// Not only the factory method is thread-safe. Each instance of the class is thread-safe as well. /// - public sealed class NoiseEngine : INoiseEngine + public sealed class NoiseProcessor : INoiseEngine { private readonly INoiseEngine engine; - private NoiseEngine(NoiseTypes type, int seed, IReadOnlyDictionary intParameters) + private NoiseProcessor(NoiseTypes type, int seed, IReadOnlyDictionary intParameters) { this.engine = type switch { @@ -36,7 +36,7 @@ namespace CubicNoise /// /// The parameters for the desired noise engine. /// The desired noise engine instance. - public static NoiseEngine Create(EngineParameters parameters) => new NoiseEngine(parameters.Type, parameters.Seed, parameters?.IntParameters); + public static NoiseProcessor Create(EngineParameters parameters) => new NoiseProcessor(parameters.Type, parameters.Seed, parameters?.IntParameters); /// /// Yields a one-dimensional based noise value. This method is thread-safe as well. Call it from as diff --git a/NoiseEngine/NoiseTypes.cs b/NoiseEngine/NoiseTypes.cs index ef1d55d..74b0ffc 100644 --- a/NoiseEngine/NoiseTypes.cs +++ b/NoiseEngine/NoiseTypes.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace CubicNoise +namespace NoiseEngine { /// /// All implemented noise generators. diff --git a/NoiseEngine/Noisers/CubicNoiseEngine.cs b/NoiseEngine/Noisers/CubicNoiseEngine.cs index 4c0fd68..186ca6e 100644 --- a/NoiseEngine/Noisers/CubicNoiseEngine.cs +++ b/NoiseEngine/Noisers/CubicNoiseEngine.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; -using CubicNoise.Contracts; +using NoiseEngine.Contracts; -namespace CubicNoise.Noisers +namespace NoiseEngine.Noisers { /// /// This is the cubic noise engine by Job Talle, cf. https://jobtalle.com/cubic_noise.html. It based on the diff --git a/NoiseEngine/Noisers/CubicNoiseIntParameters.cs b/NoiseEngine/Noisers/CubicNoiseIntParameters.cs index 811ee7f..2da0ef3 100644 --- a/NoiseEngine/Noisers/CubicNoiseIntParameters.cs +++ b/NoiseEngine/Noisers/CubicNoiseIntParameters.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using CubicNoise.Contracts; +using NoiseEngine.Contracts; -namespace CubicNoise.Noisers +namespace NoiseEngine.Noisers { /// /// This class contains all known cubic noise's parameters. diff --git a/NoiseEngine/Noisers/RandomNumberEngine.cs b/NoiseEngine/Noisers/RandomNumberEngine.cs index a98b021..7362bef 100644 --- a/NoiseEngine/Noisers/RandomNumberEngine.cs +++ b/NoiseEngine/Noisers/RandomNumberEngine.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using CubicNoise.Contracts; +using NoiseEngine.Contracts; -namespace CubicNoise.Noisers +namespace NoiseEngine.Noisers { /// /// This is the random number engine which gets used in case that the UNKNOWN type was used. diff --git a/NoiseEngineTests/CubicNoiseTests.cs b/NoiseEngineTests/CubicNoiseTests.cs index 7cf112c..bcd7e19 100644 --- a/NoiseEngineTests/CubicNoiseTests.cs +++ b/NoiseEngineTests/CubicNoiseTests.cs @@ -2,19 +2,19 @@ using System.Collections.Generic; using System.Diagnostics; using System.Text; -using CubicNoise; -using CubicNoise.Contracts; -using CubicNoise.Noisers; +using NoiseEngine; +using NoiseEngine.Contracts; +using NoiseEngine.Noisers; using NUnit.Framework; -namespace CubicNoiseTests +namespace NoiseEngineTests { - public class CubicNoiseTests + public class NoiseEngineTests { [Test] public void TestValidity() { - var engineO57PX12PY16 = NoiseEngine.Create(new EngineParameters + var engineO57PX12PY16 = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetDeterministicHashCode(), Type = NoiseTypes.CUBIC_NOISE, @@ -26,7 +26,7 @@ namespace CubicNoiseTests }, }); - var engineO45PX16PY99 = NoiseEngine.Create(new EngineParameters + var engineO45PX16PY99 = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetDeterministicHashCode(), Type = NoiseTypes.CUBIC_NOISE, @@ -113,7 +113,7 @@ namespace CubicNoiseTests var counter = 0; var sum = 0L; - var engine = NoiseEngine.Create(new EngineParameters + var engine = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetHashCode(), Type = NoiseTypes.CUBIC_NOISE, @@ -154,7 +154,7 @@ namespace CubicNoiseTests var counter = 0; var sum = 0L; - var engine = NoiseEngine.Create(new EngineParameters + var engine = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetHashCode(), Type = NoiseTypes.CUBIC_NOISE, @@ -195,7 +195,7 @@ namespace CubicNoiseTests var counter = 0; var sum = 0L; - var engine = NoiseEngine.Create(new EngineParameters + var engine = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetHashCode(), Type = NoiseTypes.CUBIC_NOISE, @@ -235,7 +235,7 @@ namespace CubicNoiseTests var counter = 0; var sum = 0L; - var engine = NoiseEngine.Create(new EngineParameters + var engine = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetHashCode(), Type = NoiseTypes.CUBIC_NOISE, diff --git a/NoiseEngineTests/NoiseBuilderTests.cs b/NoiseEngineTests/NoiseBuilderTests.cs index 585be2d..15b300f 100644 --- a/NoiseEngineTests/NoiseBuilderTests.cs +++ b/NoiseEngineTests/NoiseBuilderTests.cs @@ -1,19 +1,19 @@ using System; using System.Collections.Generic; using System.Text; -using CubicNoise; -using CubicNoise.Contracts; -using CubicNoise.Noisers; +using NoiseEngine; +using NoiseEngine.Contracts; +using NoiseEngine.Noisers; using NUnit.Framework; -namespace CubicNoiseTests +namespace NoiseEngineTests { public class NoiseBuilderTests { [Test] public void StraightCreation() { - var engine = NoiseEngine.Create(new EngineParameters + var engine = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetDeterministicHashCode(), Type = NoiseTypes.CUBIC_NOISE, @@ -41,7 +41,7 @@ namespace CubicNoiseTests [Test] public void NoParameters() { - var engine = NoiseEngine.Create(new EngineParameters()); + var engine = NoiseProcessor.Create(new EngineParameters()); Assert.That(engine, Is.Not.Null); @@ -62,7 +62,7 @@ namespace CubicNoiseTests { try { - var engine = NoiseEngine.Create(null); + var engine = NoiseProcessor.Create(null); Assert.Fail("Null instead of parameters should not work."); } catch @@ -74,7 +74,7 @@ namespace CubicNoiseTests [Test] public void PartialParameters() { - var engine = NoiseEngine.Create(new EngineParameters + var engine = NoiseProcessor.Create(new EngineParameters { Seed = "test seed".GetDeterministicHashCode(), Type = NoiseTypes.CUBIC_NOISE,