Skip to content

Commit

Permalink
Merge branch 'release/1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo J. Mendez committed Jul 13, 2014
2 parents 179e192 + daf084c commit fdb2ab5
Show file tree
Hide file tree
Showing 32 changed files with 71 additions and 190 deletions.
6 changes: 1 addition & 5 deletions Generator/Billow.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//using Microsoft.Xna.Framework;

using UnityEngine;

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions Generator/Checker.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs a checkerboard pattern. [GENERATOR]
/// </summary>
Expand Down
5 changes: 1 addition & 4 deletions Generator/Const.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs a constant value. [GENERATOR]
/// </summary>
Expand Down
5 changes: 1 addition & 4 deletions Generator/Cylinders.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs concentric cylinders. [GENERATOR]
/// </summary>
Expand Down
8 changes: 2 additions & 6 deletions Generator/Perlin.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//using Microsoft.Xna.Framework;
using UnityEngine;

using UnityEngine;

/// <summary>
/// Provides a noise module that outputs a three-dimensional perlin noise. [GENERATOR]
Expand Down
11 changes: 3 additions & 8 deletions Generator/RidgedMultifractal.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//using Microsoft.Xna.Framework;
using UnityEngine;

using UnityEngine;

/// <summary>
/// Provides a noise module that outputs 3-dimensional ridged-multifractal noise. [GENERATOR]
Expand Down Expand Up @@ -156,8 +152,7 @@ public override double GetValue(double x, double y, double z)
signal *= signal;
signal *= weight;
weight = signal * gain;
if (weight > 1.0) { weight = 1.0; }
if (weight < 0.0) { weight = 0.0; }
weight = Mathf.Clamp01((float)weight);
value += (signal * this.m_weights[i]);
x *= this.m_lacunarity;
y *= this.m_lacunarity;
Expand Down
5 changes: 1 addition & 4 deletions Generator/Spheres.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs concentric spheres. [GENERATOR]
/// </summary>
Expand Down
5 changes: 1 addition & 4 deletions Generator/Voronoi.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Generator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs Voronoi cells. [GENERATOR]
/// </summary>
Expand Down
14 changes: 5 additions & 9 deletions ModuleBase.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
namespace LibNoise.Unity
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//using Microsoft.Xna.Framework;
using UnityEngine;

using UnityEngine;

#region Enumerations

Expand Down Expand Up @@ -119,7 +115,7 @@ public int SourceModuleCount
/// <returns>The resulting output value.</returns>
public double GetValue(Vector3 coordinate)
{
return this.GetValue((double)coordinate.x, (double)coordinate.y, (double)coordinate.z);
return this.GetValue(coordinate.x, coordinate.y, coordinate.z);
}

/// <summary>
Expand All @@ -129,7 +125,7 @@ public double GetValue(Vector3 coordinate)
/// <returns>The resulting output value.</returns>
public double GetValue(ref Vector3 coordinate)
{
return this.GetValue((double)coordinate.x, (double)coordinate.y, (double)coordinate.z);
return this.GetValue(coordinate.x, coordinate.y, coordinate.z);
}

#endregion
Expand All @@ -138,7 +134,7 @@ public double GetValue(ref Vector3 coordinate)

[System.Xml.Serialization.XmlIgnore]
#if !XBOX360 && !ZUNE
[NonSerialized]
[NonSerialized]
#endif
private bool m_disposed = false;

Expand Down
46 changes: 11 additions & 35 deletions Noise2D.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


using UnityEngine;

/// <summary>
Expand Down Expand Up @@ -95,7 +92,6 @@ public Noise2D(int width, int height, ModuleBase generator)
this.m_ucHeight = height + m_ucBorder * 2;
this.m_ucData = new float[width + m_ucBorder * 2, height + m_ucBorder * 2];
}

#endregion

#region Indexers
Expand All @@ -119,7 +115,7 @@ public Noise2D(int width, int height, ModuleBase generator)
}
if (y < 0 && y >= this.m_height)
{
throw new ArgumentOutOfRangeException("Inavlid y position");
throw new ArgumentOutOfRangeException("Invalid y position");
}
return this.m_data[x, y];
}
Expand All @@ -131,7 +127,7 @@ public Noise2D(int width, int height, ModuleBase generator)
}
if (y < 0 && y >= this.m_ucHeight)
{
throw new ArgumentOutOfRangeException("Inavlid y position");
throw new ArgumentOutOfRangeException("Invalid y position");
}
return this.m_ucData[x, y];
}
Expand All @@ -158,7 +154,7 @@ public Noise2D(int width, int height, ModuleBase generator)
}
if (y < 0 && y >= this.m_ucHeight)
{
throw new ArgumentOutOfRangeException("Inavlid y position");
throw new ArgumentOutOfRangeException("Invalid y position");
}
this.m_ucData[x, y] = value;
}
Expand Down Expand Up @@ -265,19 +261,11 @@ public int Width
return result;
}

/// <summary>
/// Clears the noise map.
/// </summary>
public void Clear()
{
this.Clear(0.0f);
}

/// <summary>
/// Clears the noise map.
/// </summary>
/// <param name="value">The constant value to clear the noise map with.</param>
public void Clear(float value)
public void Clear(float value = 0f)
{
for (int x = 0; x < this.m_width; x++)
{
Expand All @@ -299,18 +287,6 @@ private double GeneratePlanar(double x, double y)
return this.m_generator.GetValue(x, 0.0, y);
}

/// <summary>
/// Generates a planar projection of the noise map.
/// </summary>
/// <param name="left">The clip region to the left.</param>
/// <param name="right">The clip region to the right.</param>
/// <param name="top">The clip region to the top.</param>
/// <param name="bottom">The clip region to the bottom.</param>
public void GeneratePlanar(double left, double right, double top, double bottom)
{
this.GeneratePlanar(left, right, top, bottom, true);
}

/// <summary>
/// Generates a non-seamless planar projection of the noise map.
/// </summary>
Expand All @@ -319,7 +295,7 @@ public void GeneratePlanar(double left, double right, double top, double bottom)
/// <param name="top">The clip region to the top.</param>
/// <param name="bottom">The clip region to the bottom.</param>
/// <param name="isSeamless">Indicates whether the resulting noise map should be seamless.</param>
public void GeneratePlanar(double left, double right, double top, double bottom, bool isSeamless)
public void GeneratePlanar(double left, double right, double top, double bottom, bool isSeamless = true)
{
if (right <= left || bottom <= top)
{
Expand Down Expand Up @@ -376,9 +352,9 @@ public void GeneratePlanar(double left, double right, double top, double bottom,
/// <returns>The corresponding noise map value.</returns>
private double GenerateCylindrical(double angle, double height)
{
double x = Math.Cos(angle * Utils.DegToRad);
double x = Math.Cos(angle * Mathf.Deg2Rad);
double y = height;
double z = Math.Sin(angle * Utils.DegToRad);
double z = Math.Sin(angle * Mathf.Deg2Rad);
return this.m_generator.GetValue(x, y, z);
}

Expand Down Expand Up @@ -429,9 +405,9 @@ public void GenerateCylindrical(double angleMin, double angleMax, double heightM
/// <returns>The corresponding noise map value.</returns>
private double GenerateSpherical(double lat, double lon)
{
double r = Math.Cos(Utils.DegToRad * lat);
return this.m_generator.GetValue(r * Math.Cos(Utils.DegToRad * lon), Math.Sin(Utils.DegToRad * lat),
r * Math.Sin(Utils.DegToRad * lon));
double r = Math.Cos(Mathf.Deg2Rad * lat);
return this.m_generator.GetValue(r * Math.Cos(Mathf.Deg2Rad * lon), Math.Sin(Mathf.Deg2Rad * lat),
r * Math.Sin(Mathf.Deg2Rad * lon));
}

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions Operator/Abs.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs the absolute value of the output value from
/// a source module. [OPERATOR]
Expand Down
5 changes: 1 addition & 4 deletions Operator/Add.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs the sum of the two output values from two
/// source modules. [OPERATOR]
Expand Down
5 changes: 1 addition & 4 deletions Operator/Blend.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs a weighted blend of the output values from
/// two source modules given the output value supplied by a control module. [OPERATOR]
Expand Down
5 changes: 1 addition & 4 deletions Operator/Cache.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that caches the last output value generated by a source
/// module. [OPERATOR]
Expand Down
5 changes: 1 addition & 4 deletions Operator/Clamp.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that clamps the output value from a source module to a
/// range of values. [OPERATOR]
Expand Down
6 changes: 2 additions & 4 deletions Operator/Curve.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Collections.Generic;

using UnityEngine;

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions Operator/Displace.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that uses three source modules to displace each
/// coordinate of the input value before returning the output value from
Expand Down
5 changes: 1 addition & 4 deletions Operator/Exponent.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that maps the output value from a source module onto an
/// exponential curve. [OPERATOR]
Expand Down
5 changes: 1 addition & 4 deletions Operator/Invert.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that inverts the output value from a source module. [OPERATOR]
/// </summary>
Expand Down
5 changes: 1 addition & 4 deletions Operator/Max.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace LibNoise.Unity.Operator
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


/// <summary>
/// Provides a noise module that outputs the larger of the two output values from two
/// source modules. [OPERATOR]
Expand Down
Loading

0 comments on commit fdb2ab5

Please sign in to comment.