Commits

jhewitt committed efb21d7

Renamed accidental noise library filter and directory to more clearly define what it is. Also moved it out of modules into libraries. The original intent was to use it to build a love module, and that may eventually happen, but it's easier and makes more sense this way for now.

Signed-off-by: Jared Hewitt <jhewitt.tech@gmail.com>

*Edit
Last commit didn't encompass the entire project

Comments (0)

Files changed (196)

Add a comment to this file

platform/msvc2010/love.suo

Binary file modified.

platform/msvc2010/love.vcxproj.filters

     <Filter Include="common">
       <UniqueIdentifier>{f4054111-5d0f-40d9-90a9-da5da444bc50}</UniqueIdentifier>
     </Filter>
-    <Filter Include="modules\noise">
+    <Filter Include="accidentalnoise">
       <UniqueIdentifier>{2d8586bd-e607-4132-80f5-054af0d9e012}</UniqueIdentifier>
     </Filter>
   </ItemGroup>
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\cellulargen.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\hsv.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitautocorrect.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitbasisfunction.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitbias.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitblend.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitbrightcontrast.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitcache.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitcellular.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitclamp.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitcombiner.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitconstant.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitcos.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitextractrgbachannel.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitfloor.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitfractal.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitfunctiongradient.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitgain.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitgradient.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitinvert.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitpow.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitrgbadotproduct.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitrotatedomain.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitscaledomain.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitscaleoffset.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitselect.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitsin.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicitsphere.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicittiers.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\implicittranslatedomain.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\mapping.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\noise_gen.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\noise_lut.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbablend.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbablendops.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbacomposechannels.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbaconstant.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbahsvtorgba.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbaimplicitgrayscale.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbanormalize.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbargbatohsv.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbarotatecolor.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\noise\rgbaselect.cpp">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\anl.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\cellulargen.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\hsv.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitautocorrect.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitbasisfunction.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitbias.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitblend.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitbrightcontrast.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitcache.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitcellular.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitclamp.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitcombiner.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitconstant.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitcos.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitextractrgbachannel.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitfloor.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitfractal.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitfunctiongradient.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitgain.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitgradient.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitinvert.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitmodifier.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitmodulebase.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitpow.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitrgbadotproduct.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitrotatedomain.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitscaledomain.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitscaleoffset.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitselect.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitsin.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicitsphere.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicittiers.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicittransform.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\implicittranslatedomain.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\mapping.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\noise_gen.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\noise_lut.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\noiselut.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\random_gen.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgba.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbablend.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbablendops.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbacomposechannels.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbaconstant.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbahsvtorgba.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbaimplicitgrayscale.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbamodulebase.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbanormalize.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbargbatohsv.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbarotatecolor.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\rgbaselect.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\utility.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\templates\tarrays.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\noise\templates\tcurve.h">
-      <Filter>modules\noise</Filter>
+      <Filter>accidentalnoise</Filter>
     </ClInclude>
   </ItemGroup>
   <ItemGroup>

src/libraries/accidentalnoise/anl.h

+#ifndef ANL_H
+#define ANL_H
+
+#include "cellulargen.h"
+
+#include "implicitautocorrect.h"
+#include "implicitbasisfunction.h"
+#include "implicitbias.h"
+#include "implicitblend.h"
+#include "implicitbrightcontrast.h"
+#include "implicitcache.h"
+#include "implicitcellular.h"
+#include "implicitclamp.h"
+#include "implicitcombiner.h"
+#include "implicitconstant.h"
+#include "implicitcos.h"
+#include "implicitextractrgbachannel.h"
+#include "implicitfloor.h"
+#include "implicitfractal.h"
+#include "implicitfunctiongradient.h"
+#include "implicitgain.h"
+#include "implicitgradient.h"
+#include "implicitpow.h"
+#include "implicitrgbadotproduct.h"
+#include "implicitrotatedomain.h"
+#include "implicitscaledomain.h"
+#include "implicitscaleoffset.h"
+#include "implicitselect.h"
+#include "implicitsin.h"
+#include "implicitsphere.h"
+#include "implicittiers.h"
+#include "implicittranslatedomain.h"
+
+#include "rgbablend.h"
+#include "rgbablendops.h"
+#include "rgbaconstant.h"
+#include "rgbacomposechannels.h"
+#include "rgbahsvtorgba.h"
+#include "rgbaimplicitgrayscale.h"
+#include "rgbanormalize.h"
+#include "rgbargbatohsv.h"
+#include "rgbarotatecolor.h"
+#include "rgbaselect.h"
+
+#include "random_gen.h"
+#include "mapping.h"
+
+#endif
+

src/libraries/accidentalnoise/cellulargen.cpp

+#include "cellulargen.h"
+#include "noise_gen.h"
+namespace anl
+{
+ CCellularGenerator::CCellularGenerator()
+ {
+     setSeed(1000);
+ }
+
+CCellularGenerator::~CCellularGenerator()
+{
+}
+
+SCellularCache &CCellularGenerator::get(double x, double y)
+{
+    if(!m_cache2.valid || x!=m_cache2.x || y!=m_cache2.y)
+    {
+        cellular_function2D(x,y,m_seed,m_cache2.f,m_cache2.d);
+        m_cache2.x=x;
+        m_cache2.y=y;
+        m_cache2.valid=true;
+    }
+    return m_cache2;
+}
+
+SCellularCache &CCellularGenerator::get(double x, double y, double z)
+{
+    if(!m_cache3.valid || x!=m_cache3.x || y!=m_cache3.y || z!=m_cache3.z)
+    {
+        cellular_function3D(x,y,z,m_seed,m_cache3.f,m_cache3.d);
+        m_cache3.x=x;
+        m_cache3.y=y;
+        m_cache3.z=z;
+        m_cache3.valid=true;
+    }
+    return m_cache3;
+}
+
+SCellularCache &CCellularGenerator::get(double x, double y, double z, double w)
+{
+    if(!m_cache4.valid || x!=m_cache4.x || y!=m_cache4.y || z!=m_cache4.z || w!=m_cache4.w)
+    {
+        cellular_function4D(x,y,z,w,m_seed,m_cache4.f,m_cache4.d);
+        m_cache4.x=x;
+        m_cache4.y=y;
+        m_cache4.z=z;
+        m_cache4.w=w;
+        m_cache4.valid=true;
+    }
+    return m_cache4;
+}
+
+SCellularCache &CCellularGenerator::get(double x, double y, double z, double w, double u, double v)
+{
+    if(!m_cache6.valid || x!=m_cache6.x || y!=m_cache6.y || z!=m_cache6.z || w!=m_cache6.w || u!=m_cache6.u || v!=m_cache6.v)
+    {
+        cellular_function6D(x,y,z,w,u,v,m_seed,m_cache6.f,m_cache6.d);
+        m_cache6.x=x;
+        m_cache6.y=y;
+        m_cache6.z=z;
+        m_cache6.w=w;
+        m_cache6.u=u;
+        m_cache6.v=v;
+        m_cache6.valid=true;
+    }
+
+    return m_cache6;
+}
+
+void CCellularGenerator::setSeed(unsigned int seed)
+{
+    m_seed=seed;
+    m_cache2.valid=false;
+    m_cache3.valid=false;
+    m_cache4.valid=false;
+    m_cache6.valid=false;
+}
+
+};

src/libraries/accidentalnoise/cellulargen.h

+#ifndef CELLULAR_GEN_H
+#define CELLULAR_GEN_H
+#include "implicitmodulebase.h"
+
+/********************************************************
+CCellularGen
+    Implement a class to generate and cache cellular noise. Multiple front-end classes can
+call this, and as long as the input coords remain the same, the cached value will be returned.
+Generates F1..F4 and V1..V4.
+*********************************************************/
+
+namespace anl
+{
+struct SCellularCache
+{
+    double f[4];
+    double d[4];
+    double x,y,z,w,u,v;
+    bool valid;
+
+    SCellularCache()
+    {
+        valid=false;
+    }
+};
+
+
+class CCellularGenerator
+{
+    public:
+    CCellularGenerator();
+    ~CCellularGenerator();
+
+    SCellularCache &get(double x, double y);
+    SCellularCache &get(double x, double y, double z);
+    SCellularCache &get(double x, double y, double z, double w);
+    SCellularCache &get(double x, double y, double z, double w, double u, double v);
+
+    void setSeed(unsigned int seed);
+
+
+    protected:
+    unsigned int m_seed;
+    SCellularCache m_cache2, m_cache3, m_cache4, m_cache6;
+
+
+};
+
+};
+
+#endif

src/libraries/accidentalnoise/hsv.cpp

+#include "hsv.h"
+#include <cmath>
+
+namespace anl
+{
+float min3(float v1, float v2, float v3)
+{
+	float cm=v1;
+	if(v2<cm) cm=v2;
+	if(v3<cm) cm=v3;
+	return cm;
+}
+
+float max3(float v1, float v2, float v3)
+{
+	float cm=v1;
+	if(v2>cm) cm=v2;
+	if(v3>cm) cm=v3;
+	return cm;
+}
+
+void RGBAtoHSV(SRGBA &col, SRGBA &hsv)
+{
+	float mn,mx,dlt;
+	float h,s,v;
+	mn=min3(col.rgba[0],col.rgba[1],col.rgba[2]);
+	mx=max3(col.rgba[0],col.rgba[1],col.rgba[2]);
+	dlt=mx-mn;
+	v=mx;
+
+	if(mx!=0)
+	{
+		//s=dlt/mx;
+		s=1.0f-(mn/mx);
+	}
+	else
+	{
+		hsv=SRGBA(0,0,0,col.rgba[3]);
+		return;
+	}
+
+	if(col.rgba[0]==mx)
+	{
+		//h=(col[1]-col[2])/dlt;
+		h=(float)((int)(60.0f * ((col.rgba[1]-col.rgba[2]) / dlt))%360);
+	}
+	else if(col.rgba[1]==mx)
+	{
+		//h=2.0f+(col[2]-col[0])/dlt;
+		h=60.0f*((col.rgba[2]-col.rgba[0]) / dlt) +120.0f;
+	}
+	else
+	{
+		//h=4.0f+(col[0]-col[1])/dlt;
+		h=60.0f*((col.rgba[0]-col.rgba[1])/dlt)+240.0f;
+	}
+
+	//h=h*60;
+	//if(h<0) h=h+360.0f;
+	hsv.rgba[0]=h/360.0f;
+	hsv.rgba[1]=s;
+	hsv.rgba[2]=v;
+	hsv.rgba[3]=col.rgba[3];
+
+/*	float maxc=max3(c[0], c[1], c[2]);
+	float minc=min3(c[0], c[1], c[2]);
+	int h;
+	float s,v;
+	if(minc==maxc) h=0;
+    else if(maxc==c[0]) h=(int)(60.0f * ((c[1]-c[2]) / (maxc-minc))) % 360;
+    else if(maxc==c[1]) h=(int)(60.0f * ((c[2]-c[0]) / (maxc-minc))) +120;
+    else h=(int)(60.0f * ((c[0]-c[1]) / (maxc-minc))) +240;
+    v=maxc;
+    if(maxc==0.0f) s=0.0f;
+    else s=1.0f-(minc/maxc);
+    hsv=CRGBAf((float)(h)/360.0f, s, v, c[3]);*/
+}
+
+void HSVtoRGBA(SRGBA &hsv, SRGBA &col)
+{
+    /*
+    hsv[0]=hsv[0]*360.0f;
+    int hi = ((int)(floorf(hsv[0] / 60.0f)) % 6);
+    float f=(hsv[0]/60.0f) - floorf(hsv[0]/60.0f);
+    float p=hsv[2]*(1.0f-hsv[1]);
+    float q=hsv[2]*(1.0-(f*hsv[1]));
+    float t=hsv[2]*(1.0-((1.0-f)*hsv[1]));
+    float v=hsv[2];
+
+    switch(hi)
+    {
+        case 0: col=CRGBAf(v,t,p,hsv[3]); break;
+        case 1: col=CRGBAf(q,v,p,hsv[3]); break;
+        case 2: col=CRGBAf(p,v,t,hsv[3]); break;
+        case 3: col=CRGBAf(p,q,v,hsv[3]); break;
+        case 4: col=CRGBAf(t,p,v,hsv[3]); break;
+        case 5: col=CRGBAf(v,p,q,hsv[3]); break;
+        default: break;
+    }
+*/
+
+	float i,f,p,q,t,r,g,b;
+	float h=hsv.rgba[0], s=hsv.rgba[1], v=hsv.rgba[2];
+
+	if(s==0)
+	{
+		col=SRGBA(v,v,v,hsv.rgba[3]);
+		return;
+	}
+
+	h=(h*360.0f)/60.0f;
+	i=floorf(h);
+	f=h-i;
+	p=v*(1.0f-s);
+	q=v*(1.0f-s*f);
+	t=v*(1.0f-s*(1.0f-f));
+
+	if(i==0)
+	{
+		r=v; g=t; b=p;
+	}
+	else if(i==1)
+	{
+		r=q; g=v; b=p;
+	}
+	else if(i==2)
+	{
+		r=p; g=v; b=t;
+	}
+	else if(i==3)
+	{
+		r=p; g=q; b=v;
+	}
+	else if(i==4)
+	{
+		r=t; g=p; b=v;
+	}
+	else
+	{
+		r=v; g=p; b=q;
+	}
+
+	col=SRGBA(r,g,b,hsv.rgba[3]);
+}
+};

src/libraries/accidentalnoise/hsv.h

+#ifndef HSV_H
+#define HSV_H
+#include "rgba.h"
+
+// Utility functions to handle HSV to RGB conversions
+namespace anl
+{
+    void HSVtoRGBA(SRGBA &hsv, SRGBA &rgb);
+    void RGBAtoHSV(SRGBA &rgb, SRGBA &hsv);
+};
+
+
+#endif

src/libraries/accidentalnoise/implicitautocorrect.cpp

+#include "implicitautocorrect.h"
+#include "random_gen.h"
+
+namespace anl
+{
+
+    CImplicitAutoCorrect::CImplicitAutoCorrect() : m_source(0), m_low(-1.0), m_high(1.0){}
+    CImplicitAutoCorrect::CImplicitAutoCorrect(double low, double high) : m_source(0), m_low(low), m_high(high){}
+
+    void CImplicitAutoCorrect::setSource(CImplicitModuleBase *m)
+    {
+        m_source=m;
+        calculate();
+    }
+
+    void CImplicitAutoCorrect::setRange(double low, double high)
+    {
+        m_low=low; m_high=high;
+        calculate();
+    }
+
+    void CImplicitAutoCorrect::calculate()
+    {
+        if(!m_source) return;
+        double mn,mx;
+        LCG lcg;
+        lcg.setSeedTime();
+
+        // Calculate 2D
+        mn=10000.0;
+        mx=-10000.0;
+        for(int c=0; c<10000; ++c)
+        {
+            double nx=lcg.get01()*4.0-2.0;
+            double ny=lcg.get01()*4.0-2.0;
+
+            double v=m_source->get(nx,ny);
+            if(v<mn) mn=v;
+            if(v>mx) mx=v;
+        }
+        m_scale2=(m_high-m_low) / (mx-mn);
+        m_offset2=m_low-mn*m_scale2;
+
+        // Calculate 3D
+        mn=10000.0;
+        mx=-10000.0;
+        for(int c=0; c<10000; ++c)
+        {
+            double nx=lcg.get01()*4.0-2.0;
+            double ny=lcg.get01()*4.0-2.0;
+            double nz=lcg.get01()*4.0-2.0;
+
+            double v=m_source->get(nx,ny,nz);
+            if(v<mn) mn=v;
+            if(v>mx) mx=v;
+        }
+        m_scale3=(m_high-m_low) / (mx-mn);
+        m_offset3=m_low-mn*m_scale3;
+
+        // Calculate 4D
+        mn=10000.0;
+        mx=-10000.0;
+        for(int c=0; c<10000; ++c)
+        {
+            double nx=lcg.get01()*4.0-2.0;
+            double ny=lcg.get01()*4.0-2.0;
+            double nz=lcg.get01()*4.0-2.0;
+            double nw=lcg.get01()*4.0-2.0;
+
+            double v=m_source->get(nx,ny,nz,nw);
+            if(v<mn) mn=v;
+            if(v>mx) mx=v;
+        }
+        m_scale4=(m_high-m_low) / (mx-mn);
+        m_offset4=m_low-mn*m_scale4;
+
+        // Calculate 6D
+        mn=10000.0;
+        mx=-10000.0;
+        for(int c=0; c<10000; ++c)
+        {
+            double nx=lcg.get01()*4.0-2.0;
+            double ny=lcg.get01()*4.0-2.0;
+            double nz=lcg.get01()*4.0-2.0;
+            double nw=lcg.get01()*4.0-2.0;
+            double nu=lcg.get01()*4.0-2.0;
+            double nv=lcg.get01()*4.0-2.0;
+
+            double v=m_source->get(nx,ny,nz,nw,nu,nv);
+            if(v<mn) mn=v;
+            if(v>mx) mx=v;
+        }
+        m_scale6=(m_high-m_low) / (mx-mn);
+        m_offset6=m_low-mn*m_scale6;
+    }
+
+
+    double CImplicitAutoCorrect::get(double x, double y)
+    {
+        if(!m_source) return 0.0;
+
+        double v=m_source->get(x,y);
+        return std::max(m_low, std::min(m_high, v*m_scale2+m_offset2));
+    }
+
+    double CImplicitAutoCorrect::get(double x, double y, double z)
+    {
+        if(!m_source) return 0.0;
+
+        double v=m_source->get(x,y,z);
+        return std::max(m_low, std::min(m_high, v*m_scale3+m_offset3));
+    }
+    double CImplicitAutoCorrect::get(double x, double y, double z, double w)
+    {
+        if(!m_source) return 0.0;
+
+        double v=m_source->get(x,y,z,w);
+        return std::max(m_low, std::min(m_high, v*m_scale4+m_offset4));
+    }
+
+    double CImplicitAutoCorrect::get(double x, double y, double z, double w, double u, double v)
+    {
+        if(!m_source) return 0.0;
+
+        double val=m_source->get(x,y,z,w,u,v);
+        return std::max(m_low, std::min(m_high, val*m_scale6+m_offset6));
+    }
+};

src/libraries/accidentalnoise/implicitautocorrect.h

+#ifndef IMPLICIT_AUTOCORRECT_H
+#define IMPLICIT_AUTOCORRECT_H
+#include "implicitmodulebase.h"
+/*************************************************
+CImplicitAutoCorrect
+
+    Define a function that will attempt to correct the range of its input to fall within a desired output
+range.
+    Operates by sampling the input function a number of times across an section of the domain, and using the
+calculated min/max values to generate scale/offset pair to apply to the input. The calculate() function performs
+this sampling and calculation, and is called automatically whenever a source is set, or whenever the desired output
+ranges are set. Also, the function may be called manually, if desired.
+***************************************************/
+
+namespace anl
+{
+    class CImplicitAutoCorrect : public CImplicitModuleBase
+    {
+        public:
+        CImplicitAutoCorrect();
+        CImplicitAutoCorrect(double low, double high);
+        ~CImplicitAutoCorrect(){}
+
+        void setSource(CImplicitModuleBase *m);
+        void setRange(double low, double high);
+        void calculate();
+
+        double get(double x, double y);
+        double get(double x, double y, double z);
+        double get(double x, double y, double z, double w);
+        double get(double x, double y, double z, double w, double u, double v);
+
+        protected:
+        CImplicitModuleBase *m_source;
+        double m_low, m_high;
+        double m_scale2, m_offset2;
+        double m_scale3, m_offset3;
+        double m_scale4, m_offset4;
+        double m_scale6, m_offset6;
+
+    };
+};
+
+
+#endif

src/libraries/accidentalnoise/implicitbasisfunction.cpp

+#include "implicitbasisfunction.h"
+#include <cmath>
+#include "random_gen.h"
+
+using namespace anl;
+
+CImplicitBasisFunction::CImplicitBasisFunction() : CImplicitModuleBase()
+{
+	setType(GRADIENT);
+	setInterp(QUINTIC);
+	setSeed(1000);
+}
+CImplicitBasisFunction::CImplicitBasisFunction(int type, int interp)
+{
+	setType(type);
+	setInterp(interp);
+	setSeed(1000);
+}
+
+void CImplicitBasisFunction::setSeed(unsigned int seed)
+{
+    m_seed=seed;
+    LCG lcg;
+    lcg.setSeed(seed);
+
+    double ax,ay,az;
+	double len;
+
+	ax=lcg.get01();
+	ay=lcg.get01();
+	az=lcg.get01();
+	len=sqrt(ax*ax+ay*ay+az*az);
+	ax/=len;
+	ay/=len;
+	az/=len;
+	setRotationAngle(ax,ay,az,lcg.get01()*3.141592*2.0);
+	double angle=lcg.get01()*3.14159265*2.0;
+	cos2d=cos(angle);
+	sin2d=sin(angle);
+}
+
+void CImplicitBasisFunction::setType(int type)
+{
+	switch(type)
+	{
+	case VALUE: m_2d=value_noise2D; m_3d=value_noise3D; m_4d=value_noise4D; m_6d=value_noise6D; break;
+	case GRADIENT: m_2d=gradient_noise2D; m_3d=gradient_noise3D; m_4d=gradient_noise4D; m_6d=gradient_noise6D; break;
+	case GRADVAL: m_2d=gradval_noise2D; m_3d=gradval_noise3D; m_4d=gradval_noise4D; m_6d=gradval_noise6D; break;
+	case WHITE: m_2d=white_noise2D; m_3d=white_noise3D; m_4d=white_noise4D; m_6d=white_noise6D; break;
+	case SIMPLEX: m_2d=simplex_noise2D; m_3d=simplex_noise3D; m_4d=simplex_noise4D; m_6d=simplex_noise6D; break;
+	default: m_2d=gradient_noise2D; m_3d=gradient_noise3D; m_4d=gradient_noise4D; m_6d=gradient_noise6D; break;
+	}
+	setMagicNumbers(type);
+}
+
+void CImplicitBasisFunction::setInterp(int interp)
+{
+	switch(interp)
+	{
+	case NONE: m_interp=noInterp; break;
+	case LINEAR: m_interp=linearInterp; break;
+	case CUBIC: m_interp=hermiteInterp; break;
+	default: m_interp=quinticInterp; break;
+	}
+}
+
+double CImplicitBasisFunction::get(double x, double y)
+{
+	double nx,ny;
+    nx = x*cos2d-y*sin2d;
+    ny = y*cos2d+x*sin2d;
+	return m_2d(nx,ny,m_seed,m_interp);
+}
+double CImplicitBasisFunction::get(double x, double y, double z)
+{
+    double nx, ny, nz;
+    nx = (m_rotmatrix[0][0]*x) + (m_rotmatrix[1][0]*y) + (m_rotmatrix[2][0]*z);
+    ny = (m_rotmatrix[0][1]*x) + (m_rotmatrix[1][1]*y) + (m_rotmatrix[2][1]*z);
+    nz = (m_rotmatrix[0][2]*x) + (m_rotmatrix[1][2]*y) + (m_rotmatrix[2][2]*z);
+    return m_3d(nx,ny,nz,m_seed,m_interp);
+}
+double CImplicitBasisFunction::get(double x, double y, double z, double w)
+{
+	double nx, ny, nz;
+    nx = (m_rotmatrix[0][0]*x) + (m_rotmatrix[1][0]*y) + (m_rotmatrix[2][0]*z);
+    ny = (m_rotmatrix[0][1]*x) + (m_rotmatrix[1][1]*y) + (m_rotmatrix[2][1]*z);
+    nz = (m_rotmatrix[0][2]*x) + (m_rotmatrix[1][2]*y) + (m_rotmatrix[2][2]*z);
+	return m_4d(nx,ny,nz,w,m_seed,m_interp);
+}
+double CImplicitBasisFunction::get(double x, double y, double z, double w, double u, double v)
+{
+	double nx, ny, nz;
+    nx = (m_rotmatrix[0][0]*x) + (m_rotmatrix[1][0]*y) + (m_rotmatrix[2][0]*z);
+    ny = (m_rotmatrix[0][1]*x) + (m_rotmatrix[1][1]*y) + (m_rotmatrix[2][1]*z);
+    nz = (m_rotmatrix[0][2]*x) + (m_rotmatrix[1][2]*y) + (m_rotmatrix[2][2]*z);
+	return m_6d(nx,ny,nz,w,u,v,m_seed,m_interp);
+}
+
+void CImplicitBasisFunction::setRotationAngle(double x, double y, double z, double angle)
+{
+    m_rotmatrix[0][0] = 1 + (1-cos(angle))*(x*x-1);
+    m_rotmatrix[1][0] = -z*sin(angle)+(1-cos(angle))*x*y;
+    m_rotmatrix[2][0] = y*sin(angle)+(1-cos(angle))*x*z;
+
+    m_rotmatrix[0][1] = z*sin(angle)+(1-cos(angle))*x*y;
+    m_rotmatrix[1][1] = 1 + (1-cos(angle))*(y*y-1);
+    m_rotmatrix[2][1] = -x*sin(angle)+(1-cos(angle))*y*z;
+
+    m_rotmatrix[0][2] = -y*sin(angle)+(1-cos(angle))*x*z;
+    m_rotmatrix[1][2] = x*sin(angle)+(1-cos(angle))*y*z;
+    m_rotmatrix[2][2] = 1 + (1-cos(angle))*(z*z-1);
+}
+
+void CImplicitBasisFunction::setMagicNumbers(int type)
+{
+    // This function is a damned hack.
+    // The underlying noise functions don't return values in the range [-1,1] cleanly, and the ranges vary depending
+    // on basis type and dimensionality. There's probably a better way to correct the ranges, but for now I'm just
+    // setting he magic numbers m_scale and m_offset manually to empirically determined magic numbers.
+    switch(type)
+    {
+        case VALUE:
+        {
+            m_scale[0]=1.0; m_offset[0]=0.0;
+            m_scale[1]=1.0; m_offset[1]=0.0;
+            m_scale[2]=1.0; m_offset[2]=0.0;
+            m_scale[3]=1.0; m_offset[3]=0.0;
+        } break;
+
+        case GRADIENT:
+        {
+            m_scale[0]=1.86848; m_offset[0]=-0.000118;
+            m_scale[1]=1.85148; m_offset[1]=-0.008272;
+            m_scale[2]=1.64127; m_offset[2]=-0.01527;
+            m_scale[3]=1.92517; m_offset[3]=0.03393;
+        } break;
+
+        case GRADVAL:
+        {
+            m_scale[0]=0.6769; m_offset[0]=-0.00151;
+            m_scale[1]=0.6957; m_offset[1]=-0.133;
+            m_scale[2]=0.74622; m_offset[2]=0.01916;
+            m_scale[3]=0.7961; m_offset[3]=-0.0352;
+        } break;
+
+        case WHITE:
+        {
+            m_scale[0]=1.0; m_offset[0]=0.0;
+            m_scale[1]=1.0; m_offset[1]=0.0;
+            m_scale[2]=1.0; m_offset[2]=0.0;
+            m_scale[3]=1.0; m_offset[3]=0.0;
+        } break;
+
+        default:
+        {
+            m_scale[0]=1.0; m_offset[0]=0.0;
+            m_scale[1]=1.0; m_offset[1]=0.0;
+            m_scale[2]=1.0; m_offset[2]=0.0;
+            m_scale[3]=1.0; m_offset[3]=0.0;
+        } break;
+    };
+}

src/libraries/accidentalnoise/implicitbasisfunction.h

+#ifndef IMPLICIT_BASIS_FUNCTION_H
+#define IMPLICIT_BASIS_FUNCTION_H
+#include "noise_gen.h"
+#include "implicitmodulebase.h"
+
+namespace anl
+{
+
+    enum EBasisTypes
+    {
+        VALUE,
+        GRADIENT,
+        GRADVAL,
+        SIMPLEX,
+        WHITE
+    };
+
+    enum EInterpTypes
+    {
+        NONE,
+        LINEAR,
+        CUBIC,
+        QUINTIC
+    };
+
+
+    class CImplicitBasisFunction : public CImplicitModuleBase
+    {
+        public:
+        CImplicitBasisFunction();
+        CImplicitBasisFunction(int type, int interp);
+
+        void setType(int type);
+        void setInterp(int interp);
+        void setRotationAngle(double ax, double ay, double az, double angle);
+
+        void setSeed(unsigned int seed);
+
+        double get(double x, double y);
+        double get(double x, double y, double z);
+        double get(double x, double y, double z, double w);
+        double get(double x, double y, double z, double w, double u, double v);
+
+
+        protected:
+
+        double m_scale[4], m_offset[4];
+        interp_func m_interp;
+        noise_func2 m_2d;
+        noise_func3 m_3d;
+        noise_func4 m_4d;
+        noise_func6 m_6d;
+        unsigned int m_seed;
+
+        double m_rotmatrix[3][3];
+        double cos2d,sin2d;
+
+        void setMagicNumbers(int type);
+
+    };
+
+};
+
+#endif

src/libraries/accidentalnoise/implicitbias.cpp

+#include "implicitbias.h"
+#include "utility.h"
+
+namespace anl
+{
+    CImplicitBias::CImplicitBias(double b) : m_source(0), m_bias(b){}
+    CImplicitBias::~CImplicitBias(){}
+
+    void CImplicitBias::setSource(CImplicitModuleBase *b){m_source.set(b);}
+    void CImplicitBias::setSource(double v){m_source.set(v);}
+    void CImplicitBias::setBias(double b){m_bias.set(b);}
+    void CImplicitBias::setBias(CImplicitModuleBase *m){m_bias.set(m);}
+
+    double CImplicitBias::get(double x, double y)
+    {
+        double va=m_source.get(x,y);
+        return bias(m_bias.get(x,y), va);
+    }
+
+    double CImplicitBias::get(double x, double y, double z)
+    {
+        double va=m_source.get(x,y,z);
+        return bias(m_bias.get(x,y,z), va);
+    }
+
+    double CImplicitBias::get(double x, double y, double z, double w)
+    {
+        double va=m_source.get(x,y,z,w);
+        return bias(m_bias.get(x,y,z,w), va);
+    }
+
+    double CImplicitBias::get(double x, double y, double z, double w, double u, double v)
+    {
+        double va=m_source.get(x,y,z,w, u, v);
+        return bias(m_bias.get(x,y,z,w,u,v), va);
+    }
+};

src/libraries/accidentalnoise/implicitbias.h

+#ifndef IMPLICIT_BIAS_H
+#define IMPLICIT_BIAS_H
+#include "implicitmodulebase.h"
+
+namespace anl
+{
+    class CImplicitBias : public CImplicitModuleBase
+{
+    public:
+    CImplicitBias(double b);
+    ~CImplicitBias();
+
+    void setSource(CImplicitModuleBase *b);
+    void setSource(double s);
+    void setBias(double b);
+    void setBias(CImplicitModuleBase *m);
+
+    double get(double x, double y);
+    double get(double x, double y, double z);
+    double get(double x, double y, double z, double w);
+    double get(double x, double y, double z, double w, double u, double v);
+
+    protected:
+    CScalarParameter m_source;
+    CScalarParameter m_bias;
+};
+};
+
+#endif

src/libraries/accidentalnoise/implicitblend.cpp

+#include "implicitblend.h"
+#include "utility.h"
+
+namespace anl
+{
+
+    CImplicitBlend::CImplicitBlend(): m_low(0), m_high(0), m_control(0){}
+	CImplicitBlend::~CImplicitBlend(){}
+
+	void CImplicitBlend::setLowSource(CImplicitModuleBase *b)
+	{
+		m_low.set(b);
+	}
+
+	void CImplicitBlend::setHighSource(CImplicitModuleBase *b)
+	{
+	    m_high.set(b);
+	}
+
+	void CImplicitBlend::setControlSource(CImplicitModuleBase *b)
+	{
+	    m_control.set(b);
+	}
+
+	void CImplicitBlend::setLowSource(double v)
+	{
+		m_low.set(v);
+	}
+
+	void CImplicitBlend::setHighSource(double v)
+	{
+	    m_high.set(v);
+	}
+
+	void CImplicitBlend::setControlSource(double v)
+	{
+	    m_control.set(v);
+	}
+
+	double CImplicitBlend::get(double x, double y)
+	{
+        double v1=m_low.get(x,y);
+        double v2=m_high.get(x,y);
+        double blend=m_control.get(x,y);
+        blend=(blend+1.0) * 0.5;
+
+        return lerp(blend,v1,v2);
+	}
+
+	double CImplicitBlend::get(double x, double y, double z)
+	{
+        double v1=m_low.get(x,y,z);
+        double v2=m_high.get(x,y,z);
+        double blend=m_control.get(x,y,z);
+        return lerp(blend,v1,v2);
+	}
+
+	double CImplicitBlend::get(double x, double y, double z, double w)
+	{
+        double v1=m_low.get(x,y,z,w);
+        double v2=m_high.get(x,y,z,w);
+        double blend=m_control.get(x,y,z,w);
+        return lerp(blend,v1,v2);
+	}
+
+	double CImplicitBlend::get(double x, double y, double z, double w, double u, double v)
+    {
+        double v1=m_low.get(x,y,z,w,u,v);
+        double v2=m_high.get(x,y,z,w,u,v);
+        double blend=m_control.get(x,y,z,w,u,v);
+        return lerp(blend,v1,v2);
+	}
+};

src/libraries/accidentalnoise/implicitblend.h

+#ifndef IMPLICIT_BLEND_H
+#define IMPLICIT_BLEND_H
+#include "implicitmodulebase.h"
+
+namespace anl
+{
+
+    class CImplicitBlend : public CImplicitModuleBase
+    {
+    public:
+        CImplicitBlend();
+        ~CImplicitBlend();
+
+        void setLowSource(CImplicitModuleBase *b);
+        void setHighSource(CImplicitModuleBase *b);
+        void setControlSource(CImplicitModuleBase *b);
+        void setLowSource(double v);
+        void setHighSource(double v);
+        void setControlSource(double v);
+
+        double get(double x, double y);
+        double get(double x, double y, double z);
+        double get(double x, double y, double z, double w);
+        double get(double x, double y, double z, double w, double u, double v);
+        protected:
+        CScalarParameter m_low,m_high,m_control;
+
+    };
+};
+#endif

src/libraries/accidentalnoise/implicitbrightcontrast.cpp

+#include "implicitbrightcontrast.h"
+
+namespace anl
+{
+    CImplicitBrightContrast::CImplicitBrightContrast() : m_source(0), m_bright(0), m_threshold(0), m_factor(1){}
+    CImplicitBrightContrast::~CImplicitBrightContrast(){}
+
+    void CImplicitBrightContrast::setSource(CImplicitModuleBase *m){m_source.set(m);}
+    void CImplicitBrightContrast::setSource(double v){m_source.set(v);}
+
+    void CImplicitBrightContrast::setBrightness(double b){m_bright.set(b);}
+    void CImplicitBrightContrast::setContrastThreshold(double t){m_threshold.set(t);}
+    void CImplicitBrightContrast::setContrastFactor(double t){m_factor.set(t);}
+    void CImplicitBrightContrast::setBrightness(CImplicitModuleBase *b){m_bright.set(b);}
+    void CImplicitBrightContrast::setContrastThreshold(CImplicitModuleBase *t){m_threshold.set(t);}
+    void CImplicitBrightContrast::setContrastFactor(CImplicitModuleBase *t){m_factor.set(t);}
+
+    double CImplicitBrightContrast::get(double x, double y)
+    {
+        double v=m_source.get(x,y);
+        // Apply brightness
+        v+=m_bright.get(x,y);
+
+        // Subtract threshold, scale by factor, add threshold
+        double threshold=m_threshold.get(x,y);
+        v-=threshold;
+        v*=m_factor.get(x,y);
+        v+=threshold;
+        return v;
+    }
+
+    double CImplicitBrightContrast::get(double x, double y, double z)
+    {
+        double v=m_source.get(x,y,z);
+        // Apply brightness
+        v+=m_bright.get(x,y,z);
+
+        // Subtract threshold, scale by factor, add threshold
+        double threshold=m_threshold.get(x,y,z);
+        v-=threshold;
+        v*=m_factor.get(x,y,z);
+        v+=threshold;
+        return v;
+    }
+
+    double CImplicitBrightContrast::get(double x, double y, double z, double w)
+    {
+        double v=m_source.get(x,y,z,w);
+        // Apply brightness
+        v+=m_bright.get(x,y,z,w);
+
+        // Subtract threshold, scale by factor, add threshold
+        double threshold=m_threshold.get(x,y,z,w);
+        v-=threshold;
+        v*=m_factor.get(x,y,z,w);
+        v+=threshold;
+        return v;
+    }
+
+    double CImplicitBrightContrast::get(double x, double y, double z, double w, double u, double v)
+    {
+        double c=m_source.get(x,y,z,w,u,v);
+        // Apply brightness
+        c+=m_bright.get(x,y,z,w,u,v);
+
+        // Subtract threshold, scale by factor, add threshold
+        double threshold=m_threshold.get(x,y,z,w,u,v);
+        c-=threshold;
+        c*=m_factor.get(x,y,z,w,u,v);
+        c+=threshold;
+        return c;
+    }
+};

src/libraries/accidentalnoise/implicitbrightcontrast.h

+#ifndef IMPLICIT_BRIGHTCONTRAST_H
+#define IMPLICIT_BRIGHTCONTRAST_H
+
+#include "implicitmodulebase.h"
+namespace anl
+{
+    class CImplicitBrightContrast : public CImplicitModuleBase
+    {
+        public:
+        CImplicitBrightContrast();
+        ~CImplicitBrightContrast();
+
+        void setSource(CImplicitModuleBase *m);
+        void setSource(double v);
+
+        void setBrightness(double b);
+        void setContrastThreshold(double t);
+        void setContrastFactor(double t);
+        void setBrightness(CImplicitModuleBase *m);
+        void setContrastThreshold(CImplicitModuleBase *m);
+        void setContrastFactor(CImplicitModuleBase *m);
+
+        double get(double x, double y);
+        double get(double x, double y, double z);
+        double get(double x, double y, double z, double w);
+        double get(double x, double y, double z, double w, double u, double v);
+        protected:
+        CScalarParameter m_source;
+        CScalarParameter m_bright, m_threshold, m_factor;
+    };
+};
+
+#endif

src/libraries/accidentalnoise/implicitcache.cpp

+#include "implicitcache.h"
+
+namespace anl
+{
+    CImplicitCache::CImplicitCache() :m_source(0) {}
+    CImplicitCache::~CImplicitCache() {}
+    void CImplicitCache::setSource(CImplicitModuleBase *m)
+    {
+        m_source.set(m);
+    }
+    void CImplicitCache::setSource(double v)
+    {
+        m_source.set(v);
+    }
+    double CImplicitCache::get(double x, double y)
+    {
+        if(!m_c2.valid || m_c2.x!=x || m_c2.y!=y)
+        {
+            m_c2.x=x;
+            m_c2.y=y;
+            m_c2.valid=true;
+            m_c2.val=m_source.get(x,y);
+        }
+        return m_c2.val;
+    }
+
+    double CImplicitCache::get(double x, double y, double z)
+    {
+        if(!m_c3.valid || m_c3.x!=x || m_c3.y!=y || m_c3.z!=z)
+        {
+            m_c3.x=x;
+            m_c3.y=y;
+            m_c3.z=z;
+            m_c3.valid=true;
+            m_c3.val=m_source.get(x,y,z);
+        }
+        return m_c3.val;
+    }
+
+    double CImplicitCache::get(double x, double y, double z, double w)
+    {
+        if(!m_c4.valid || m_c4.x!=x || m_c4.y!=y || m_c4.z!=z || m_c4.w!=w)
+        {
+            m_c4.x=x;
+            m_c4.y=y;
+            m_c4.z=z;
+            m_c4.w=w;
+            m_c4.valid=true;
+            m_c4.val=m_source.get(x,y,z,w);
+        }
+        return m_c4.val;
+    }
+
+    double CImplicitCache::get(double x, double y, double z, double w, double u, double v)
+    {
+        if(!m_c6.valid || m_c6.x!=x || m_c6.y!=y || m_c6.z!=z || m_c6.w!=w || m_c6.u!=u || m_c6.v!=v)
+        {
+            m_c6.x=x;
+            m_c6.y=y;
+            m_c6.z=z;
+            m_c6.w=w;
+            m_c6.u=u;
+            m_c6.v=v;
+            m_c6.valid=true;
+            m_c6.val=m_source.get(x,y,z,w,u,v);
+        }
+        return m_c6.val;
+    }
+};

src/libraries/accidentalnoise/implicitcache.h

+#ifndef IMPLICIT_CACHE_H
+#define IMPLICIT_CACHE_H
+#include "implicitmodulebase.h"
+
+namespace anl
+{
+    struct SCache
+    {
+        double x,y,z,w,u,v;
+        double val;
+        bool valid;
+
+        SCache() : valid(false){}
+    };
+    class CImplicitCache : public CImplicitModuleBase
+    {
+        public:
+        CImplicitCache();
+        ~CImplicitCache();
+
+        void setSource(CImplicitModuleBase *m);
+        void setSource(double v);
+
+        double get(double x, double y);
+        double get(double x, double y, double z);
+        double get(double x, double y, double z, double w);
+        double get(double x, double y, double z, double w, double u, double v);
+
+        protected:
+        //CImplicitModuleBase *m_source;
+        CScalarParameter m_source;
+        SCache m_c2, m_c3, m_c4, m_c6;
+    };
+};
+
+#endif

src/libraries/accidentalnoise/implicitcellular.cpp

+#include "implicitcellular.h"
+
+namespace anl
+{
+    CImplicitCellular::CImplicitCellular() : m_generator(0)
+{
+    setCoefficients(1,0,0,0);
+}
+CImplicitCellular::CImplicitCellular(double a, double b, double c, double d) : m_generator(0)
+{
+    setCoefficients(a,b,c,d);
+}
+
+void CImplicitCellular::setCoefficients(double a, double b, double c, double d)
+{
+    m_coefficients[0]=a;
+    m_coefficients[1]=b;
+    m_coefficients[2]=c;
+    m_coefficients[3]=d;
+}
+
+void CImplicitCellular::setCellularSource(CCellularGenerator *m)
+{
+    m_generator=m;
+}
+
+double CImplicitCellular::get(double x, double y)
+{
+    if(!m_generator) return 0.0;
+
+    SCellularCache &c=m_generator->get(x,y);
+    return c.f[0]*m_coefficients[0] + c.f[1]*m_coefficients[1] + c.f[2]*m_coefficients[2] + c.f[3]*m_coefficients[3];
+}
+
+double CImplicitCellular::get(double x, double y, double z)
+{
+    if(!m_generator) return 0.0;
+
+    SCellularCache &c=m_generator->get(x,y,z);
+    return c.f[0]*m_coefficients[0] + c.f[1]*m_coefficients[1] + c.f[2]*m_coefficients[2] + c.f[3]*m_coefficients[3];
+}
+double CImplicitCellular::get(double x, double y, double z, double w)
+{
+    if(!m_generator) return 0.0;
+
+    SCellularCache &c=m_generator->get(x,y,z,w);
+    return c.f[0]*m_coefficients[0] + c.f[1]*m_coefficients[1] + c.f[2]*m_coefficients[2] + c.f[3]*m_coefficients[3];
+}
+double CImplicitCellular::get(double x, double y, double z, double w, double u, double v)
+{
+    if(!m_generator) return 0.0;
+
+    SCellularCache &c=m_generator->get(x,y,z,w,u,v);
+    return c.f[0]*m_coefficients[0] + c.f[1]*m_coefficients[1] + c.f[2]*m_coefficients[2] + c.f[3]*m_coefficients[3];
+}
+
+};

src/libraries/accidentalnoise/implicitcellular.h

+#ifndef IMPLICIT_CELLULAR_H
+#define IMPLICIT_CELLULAR_H
+#include "implicitmodulebase.h"
+#include "cellulargen.h"
+
+namespace anl
+{
+class CImplicitCellular : public CImplicitModuleBase
+{
+    public:
+    CImplicitCellular();
+    CImplicitCellular(double a, double b, double c, double d);
+    ~CImplicitCellular(){}
+
+    void setCoefficients(double a, double b, double c, double d);
+    void setCellularSource(CCellularGenerator *m);
+
+    double get(double x, double y);
+    double get(double x, double y, double z);
+    double get(double x, double y, double z, double w);
+    double get(double x, double y, double z, double w, double u, double v);
+
+    protected:
+    CCellularGenerator *m_generator;
+    double m_coefficients[4];
+};
+};
+
+#endif

src/libraries/accidentalnoise/implicitclamp.cpp

+#include "implicitclamp.h"
+#include "utility.h"
+
+namespace anl
+{
+    CImplicitClamp::CImplicitClamp(double low, double high) : m_source(0), m_low(low), m_high(high){}
+    CImplicitClamp::~CImplicitClamp(){}
+
+    void CImplicitClamp::setRange(double low, double high){m_low=low; m_high=high;}
+    void CImplicitClamp::setSource(CImplicitModuleBase *b){m_source=b;}
+
+    double CImplicitClamp::get(double x, double y)
+    {
+        if(!m_source) return 0;
+
+        return clamp(m_source->get(x,y),m_low,m_high);
+    }
+
+    double CImplicitClamp::get(double x, double y, double z)
+    {
+        if(!m_source) return 0;
+
+        return clamp(m_source->get(x,y,z),m_low,m_high);
+    }
+
+    double CImplicitClamp::get(double x, double y, double z, double w)
+    {
+        if(!m_source) return 0;
+
+        return clamp(m_source->get(x,y,z,w),m_low,m_high);
+    }
+
+    double CImplicitClamp::get(double x, double y, double z, double w, double u, double v)
+    {
+        if(!m_source) return 0;
+
+        return clamp(m_source->get(x,y,z,w,u,v),m_low,m_high);
+    }
+};

src/libraries/accidentalnoise/implicitclamp.h

+#ifndef IMPLICIT_CLAMP_H
+#define IMPLICIT_CLAMP_H
+#include "implicitmodulebase.h"
+
+namespace anl
+{
+    class CImplicitClamp : public CImplicitModuleBase
+    {
+        public:
+        CImplicitClamp(double low, double high);
+        ~CImplicitClamp();
+
+        void setRange(double low, double high);
+        void setSource(CImplicitModuleBase *b);
+
+        double get(double x, double y);
+        double get(double x, double y, double z);
+        double get(double x, double y, double z, double w);
+        double get(double x, double y, double z, double w, double u, double v);
+
+        protected:
+        CImplicitModuleBase *m_source;