public ImplicitBrightContrast(ImplicitModuleBase source, Double brightness, Double contrastThreshold, Double contrastFactor)
 {
     this.Source = source;
     this.Brightness = new ImplicitConstant(brightness);
     this.ContrastThreshold = new ImplicitConstant(contrastThreshold);
     this.ContrastFactor = new ImplicitConstant(contrastFactor);
 }
 public ImplicitBrightContrast(ImplicitModuleBase source, Double brightness, Double contrastThreshold, Double contrastFactor)
 {
     this.Source            = source;
     this.Brightness        = new ImplicitConstant(brightness);
     this.ContrastThreshold = new ImplicitConstant(contrastThreshold);
     this.ContrastFactor    = new ImplicitConstant(contrastFactor);
 }
Exemple #3
0
 public ImplicitAutoCorrect(ImplicitModuleBase source, Double low, Double high)
 {
     this.source = source;
     this.low    = low;
     this.high   = high;
     this.Calculate();
 }
 public ImplicitAutoCorrect(ImplicitModuleBase source, Double low, Double high)
 {
     this.source = source;
     this.low = low;
     this.high = high;
     this.Calculate();
 }
Exemple #5
0
 public ImplicitRotateDomain(ImplicitModuleBase source, Double x, Double y, Double z, Double angle)
 {
     this.Source = source;
     this.X      = new ImplicitConstant(x);
     this.Y      = new ImplicitConstant(y);
     this.Z      = new ImplicitConstant(z);
     this.Angle  = new ImplicitConstant(angle);
 }
 public ImplicitRotateDomain(ImplicitModuleBase source, Double x, Double y, Double z, Double angle)
 {
     this.Source = source;
     this.X = new ImplicitConstant(x);
     this.Y = new ImplicitConstant(y);
     this.Z = new ImplicitConstant(z);
     this.Angle = new ImplicitConstant(angle);
 }
Exemple #7
0
 public ImplicitSelect(ImplicitModuleBase source, ImplicitModuleBase low, ImplicitModuleBase high, Double falloff, Double threshold)
 {
     this.Source    = source;
     this.Low       = low;
     this.High      = high;
     this.Falloff   = new ImplicitConstant(falloff);
     this.Threshold = new ImplicitConstant(threshold);
 }
 public ImplicitSelect(ImplicitModuleBase source, ImplicitModuleBase low, ImplicitModuleBase high, Double falloff, Double threshold)
 {
     this.Source = source;
     this.Low = low;
     this.High = high;
     this.Falloff = new ImplicitConstant(falloff);
     this.Threshold = new ImplicitConstant(threshold);
 }
Exemple #9
0
        public void SetSourceOverride(Int32 which, ImplicitModuleBase newSource)
        {
            if (which < 0 || which >= Noise.MAX_SOURCES)
            {
                return;
            }

            this.sources[which] = newSource;
        }
 public void SetScales(
     Double xScale, Double yScale, Double zScale,
     Double wScale, Double uScale, Double vScale)
 {
     this.XScale = new ImplicitConstant(xScale);
     this.YScale = new ImplicitConstant(yScale);
     this.ZScale = new ImplicitConstant(zScale);
     this.WScale = new ImplicitConstant(wScale);
     this.UScale = new ImplicitConstant(uScale);
     this.VScale = new ImplicitConstant(vScale);
 }
Exemple #11
0
 public void SetScales(
     Double xScale, Double yScale, Double zScale,
     Double wScale, Double uScale, Double vScale)
 {
     this.XScale = new ImplicitConstant(xScale);
     this.YScale = new ImplicitConstant(yScale);
     this.ZScale = new ImplicitConstant(zScale);
     this.WScale = new ImplicitConstant(wScale);
     this.UScale = new ImplicitConstant(uScale);
     this.VScale = new ImplicitConstant(vScale);
 }
Exemple #12
0
 public ImplicitScaleDomain(ImplicitModuleBase source,
                            Double xScale, Double yScale, Double zScale,
                            Double wScale, Double uScale, Double vScale)
 {
     this.Source = source;
     this.XScale = new ImplicitConstant(xScale);
     this.YScale = new ImplicitConstant(yScale);
     this.ZScale = new ImplicitConstant(zScale);
     this.WScale = new ImplicitConstant(wScale);
     this.UScale = new ImplicitConstant(uScale);
     this.VScale = new ImplicitConstant(vScale);
 }
 public ImplicitScaleDomain(ImplicitModuleBase source, 
     Double xScale, Double yScale, Double zScale,
     Double wScale, Double uScale, Double vScale)
 {
     this.Source = source;
     this.XScale = new ImplicitConstant(xScale);
     this.YScale = new ImplicitConstant(yScale);
     this.ZScale = new ImplicitConstant(zScale);
     this.WScale = new ImplicitConstant(wScale);
     this.UScale = new ImplicitConstant(uScale);
     this.VScale = new ImplicitConstant(vScale);
 }
 public ImplicitTranslatedDomain(
     ImplicitModuleBase source,
     Double xAxis, Double yAxis, Double zAxis,
     Double wAxis, Double uAxis, Double vAxis)
 {
     this.Source = source;
     this.XAxis  = new ImplicitConstant(xAxis);
     this.YAxis  = new ImplicitConstant(yAxis);
     this.ZAxis  = new ImplicitConstant(zAxis);
     this.WAxis  = new ImplicitConstant(wAxis);
     this.UAxis  = new ImplicitConstant(uAxis);
     this.VAxis  = new ImplicitConstant(vAxis);
 }
 public ImplicitTranslatedDomain(
     ImplicitModuleBase source,
     Double xAxis, Double yAxis, Double zAxis,
     Double wAxis, Double uAxis, Double vAxis)
 {
     this.Source = source;
     this.XAxis = new ImplicitConstant(xAxis);
     this.YAxis = new ImplicitConstant(yAxis);
     this.ZAxis = new ImplicitConstant(zAxis);
     this.WAxis = new ImplicitConstant(wAxis);
     this.UAxis = new ImplicitConstant(uAxis);
     this.VAxis = new ImplicitConstant(vAxis);
 }
	// Extract data from a noise module
	private void GetData(ImplicitModuleBase module, ref MapData mapData)
	{
		mapData = new MapData (Width, Height);

		// loop through each x,y point - get height value
		for (var x = 0; x < Width; x++)
		{
			for (var y = 0; y < Height; y++)
			{
				//Sample the noise at smaller intervals
				float x1 = x / (float)Width;
				float y1 = y / (float)Height;

				float value = (float)HeightMap.Get (x1, y1);

				//keep track of the max and min values found
				if (value > mapData.Max) mapData.Max = value;
				if (value < mapData.Min) mapData.Min = value;

				mapData.Data[x,y] = value;
			}
		}	
	}
 public ImplicitCeiling(ImplicitModuleBase source)
 {
     this.Source = source;
 }
 public ImplicitFloor(ImplicitModuleBase source)
 {
     this.Source = source;
 }
 public ImplicitGain(ImplicitModuleBase source, Double gain)
 {
     this.Source = source;
     this.Gain   = new ImplicitConstant(gain);
 }
 public void RemoveSource(ImplicitModuleBase module)
 {
     this.sources.Remove(module);
 }
        public static void Map2D(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges, Double z)
        {
            var width = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var p = x / (double)width;
                    var q = y / (double)height;
                    double r;
                    double nx;
                    double ny;
                    double nz;
                    double nw;
                    double nu;
                    double dx;
                    double dy;
                    double dz;
                    var val = 0.00;
                    switch (mappingMode)
                    {
                        case MappingMode.SeamlessNone:
                            nx = ranges.MapX0 + p*(ranges.MapX1 - ranges.MapX0);
                            ny = ranges.MapY0 + q*(ranges.MapY1 - ranges.MapY0);
                            nz = z;
                            val = module.Get(nx, ny, nz);
                            break;
                        case MappingMode.SeamlessX:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.MapY0 + q*dy;
                            nw = z;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                        case MappingMode.SeamlessY:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nz = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nw = z;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                        case MappingMode.SeamlessZ:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.MapY0 + p*dy;
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var zval = r*(ranges.MapZ1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            nz = ranges.LoopZ0 + Math.Cos(zval*PI2)*dz/PI2;
                            nw = ranges.LoopZ0 + Math.Sin(zval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                        case MappingMode.SeamlessXY:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nw = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nu = z;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;
                        case MappingMode.SeamlessXZ:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var xzval = r*(ranges.MapX1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.MapY0 + q*dy;
                            nw = ranges.LoopZ0 + Math.Cos(xzval*PI2)*dz/PI2;
                            nu = ranges.LoopZ0 + Math.Sin(xzval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;
                        case MappingMode.SeamlessYZ:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var yzval = r*(ranges.MapZ1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nz = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nw = ranges.LoopZ0 + Math.Cos(yzval*PI2)*dz/PI2;
                            nu = ranges.LoopZ0 + Math.Sin(yzval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw, nu, 0);
                            break;
                        case MappingMode.SeamlessXYZ:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            dz = ranges.LoopZ1 - ranges.LoopZ0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            r = (z - ranges.MapZ0)/(ranges.MapZ1 - ranges.MapZ0);
                            var xyzval = r*(ranges.MapZ1 - ranges.MapZ0)/(ranges.LoopZ1 - ranges.LoopZ0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nw = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            nu = ranges.LoopZ0 + Math.Cos(xyzval*PI2)*dz/PI2;
                            double nv = ranges.LoopZ0 + Math.Sin(xyzval*PI2)*dz/PI2;
                            val = module.Get(nx, ny, nz, nw, nu, nv);
                            break;
                    }
                    array[x, y] = val;
                }
            }
        }
 public ImplicitGain(ImplicitModuleBase source, Double gain)
 {
     this.Source = source;
     this.Gain = new ImplicitConstant(gain);
 }
 public ImplicitClamp(ImplicitModuleBase source, Double low, Double high)
 {
     this.Source = source;
     this.Low = new ImplicitConstant(low);
     this.High = new ImplicitConstant(high);
 }
 public ImplicitBias(ImplicitModuleBase source, ImplicitModuleBase bias)
 {
     this.Source = source;
     this.Bias = bias;
 }
 public ImplicitBias(ImplicitModuleBase source, Double bias)
 {
     this.Source = source;
     this.Bias = new ImplicitConstant(bias);
 }
Exemple #26
0
        public static void Map2D(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges, Double z)
        {
            var width  = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var    p = x / (double)width;
                    var    q = y / (double)height;
                    double r;
                    double nx;
                    double ny;
                    double nz;
                    double nw;
                    double nu;
                    double dx;
                    double dy;
                    double dz;
                    var    val = 0.00;
                    switch (mappingMode)
                    {
                    case MappingMode.SeamlessNone:
                        nx  = ranges.MapX0 + p * (ranges.MapX1 - ranges.MapX0);
                        ny  = ranges.MapY0 + q * (ranges.MapY1 - ranges.MapY0);
                        nz  = z;
                        val = module.Get(nx, ny, nz);
                        break;

                    case MappingMode.SeamlessX:
                        dx  = ranges.LoopX1 - ranges.LoopX0;
                        dy  = ranges.MapY1 - ranges.MapY0;
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.MapY0 + q * dy;
                        nw  = z;
                        val = module.Get(nx, ny, nz, nw);
                        break;

                    case MappingMode.SeamlessY:
                        dx  = ranges.MapX1 - ranges.MapX0;
                        dy  = ranges.LoopY1 - ranges.LoopY0;
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.MapX0 + p * dx;
                        ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nw  = z;
                        val = module.Get(nx, ny, nz, nw);
                        break;

                    case MappingMode.SeamlessZ:
                        dx = ranges.MapX1 - ranges.MapX0;
                        dy = ranges.MapY1 - ranges.MapY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        nx = ranges.MapX0 + p * dx;
                        ny = ranges.MapY0 + p * dy;
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var zval = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        nz  = ranges.LoopZ0 + Math.Cos(zval * PI2) * dz / PI2;
                        nw  = ranges.LoopZ0 + Math.Sin(zval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw);
                        break;

                    case MappingMode.SeamlessXY:
                        dx  = ranges.LoopX1 - ranges.LoopX0;
                        dy  = ranges.LoopY1 - ranges.LoopY0;
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nw  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nu  = z;
                        val = module.Get(nx, ny, nz, nw, nu, 0);
                        break;

                    case MappingMode.SeamlessXZ:
                        dx = ranges.LoopX1 - ranges.LoopX0;
                        dy = ranges.MapY1 - ranges.MapY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var xzval = r * (ranges.MapX1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.MapY0 + q * dy;
                        nw  = ranges.LoopZ0 + Math.Cos(xzval * PI2) * dz / PI2;
                        nu  = ranges.LoopZ0 + Math.Sin(xzval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw, nu, 0);
                        break;

                    case MappingMode.SeamlessYZ:
                        dx = ranges.MapX1 - ranges.MapX0;
                        dy = ranges.LoopY1 - ranges.LoopY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var yzval = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.MapX0 + p * dx;
                        ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nw  = ranges.LoopZ0 + Math.Cos(yzval * PI2) * dz / PI2;
                        nu  = ranges.LoopZ0 + Math.Sin(yzval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw, nu, 0);
                        break;

                    case MappingMode.SeamlessXYZ:
                        dx = ranges.LoopX1 - ranges.LoopX0;
                        dy = ranges.LoopY1 - ranges.LoopY0;
                        dz = ranges.LoopZ1 - ranges.LoopZ0;
                        p  = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        q  = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        r  = (z - ranges.MapZ0) / (ranges.MapZ1 - ranges.MapZ0);
                        var xyzval = r * (ranges.MapZ1 - ranges.MapZ0) / (ranges.LoopZ1 - ranges.LoopZ0);
                        nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nw = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        nu = ranges.LoopZ0 + Math.Cos(xyzval * PI2) * dz / PI2;
                        double nv = ranges.LoopZ0 + Math.Sin(xyzval * PI2) * dz / PI2;
                        val = module.Get(nx, ny, nz, nw, nu, nv);
                        break;
                    }
                    array[x, y] = val;
                }
            }
        }
Exemple #27
0
        public static void Map2DNoZ(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges)
        {
            var width  = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var    p = x / (double)width;
                    var    q = y / (double)height;
                    double nx;
                    double ny;
                    double nz;
                    double dx;
                    double dy;
                    var    val = 0.00;
                    switch (mappingMode)
                    {
                    case MappingMode.SeamlessNone:
                        nx  = ranges.MapX0 + p * (ranges.MapX1 - ranges.MapX0);
                        ny  = ranges.MapY0 + q * (ranges.MapY1 - ranges.MapY0);
                        val = module.Get(nx, ny);
                        break;

                    case MappingMode.SeamlessX:
                        dx  = ranges.LoopX1 - ranges.LoopX0;
                        dy  = ranges.MapY1 - ranges.MapY0;
                        p   = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        nx  = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny  = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz  = ranges.MapY0 + q * dy;
                        val = module.Get(nx, ny, nz);
                        break;

                    case MappingMode.SeamlessY:
                        dx  = ranges.MapX1 - ranges.MapX0;
                        dy  = ranges.LoopY1 - ranges.LoopY0;
                        q   = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx  = ranges.MapX0 + p * dx;
                        ny  = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        nz  = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        val = module.Get(nx, ny, nz);
                        break;

                    case MappingMode.SeamlessXY:
                        dx = ranges.LoopX1 - ranges.LoopX0;
                        dy = ranges.LoopY1 - ranges.LoopY0;
                        p  = p * (ranges.MapX1 - ranges.MapX0) / (ranges.LoopX1 - ranges.LoopX0);
                        q  = q * (ranges.MapY1 - ranges.MapY0) / (ranges.LoopY1 - ranges.LoopY0);
                        nx = ranges.LoopX0 + Math.Cos(p * PI2) * dx / PI2;
                        ny = ranges.LoopX0 + Math.Sin(p * PI2) * dx / PI2;
                        nz = ranges.LoopY0 + Math.Cos(q * PI2) * dy / PI2;
                        double nw = ranges.LoopY0 + Math.Sin(q * PI2) * dy / PI2;
                        val = module.Get(nx, ny, nz, nw);
                        break;
                    }
                    array[x, y] = val;
                }
            }
        }
 public ImplicitScaleOffset(ImplicitModuleBase source, Double scale, Double offset)
 {
     this.Source = source;
     this.Scale  = new ImplicitConstant(scale);
     this.Offset = new ImplicitConstant(offset);
 }
Exemple #29
0
 public ImplicitPow(ImplicitModuleBase source, ImplicitModuleBase power)
 {
     this.Source = source;
     this.Power  = power;
 }
 public ImplicitBias(ImplicitModuleBase source, ImplicitModuleBase bias)
 {
     this.Source = source;
     this.Bias   = bias;
 }
 public ImplicitGain(ImplicitModuleBase source, ImplicitModuleBase gain)
 {
     this.Source = source;
     this.Gain = gain;
 }
 public ImplicitPow(ImplicitModuleBase source, ImplicitModuleBase power)
 {
     this.Source = source;
     this.Power = power;
 }
        public static void Map2DNoZ(MappingMode mappingMode, Double[,] array, ImplicitModuleBase module, MappingRanges ranges)
        {
            var width = array.GetLength(0);
            var height = array.GetLength(1);

            for (var x = 0; x < width; ++x)
            {
                for (var y = 0; y < height; ++y)
                {
                    var p = x / (double)width;
                    var q = y / (double)height;
                    double nx;
                    double ny;
                    double nz;
                    double dx;
                    double dy;
                    var val = 0.00;
                    switch (mappingMode)
                    {
                        case MappingMode.SeamlessNone:
                            nx = ranges.MapX0 + p*(ranges.MapX1 - ranges.MapX0);
                            ny = ranges.MapY0 + q*(ranges.MapY1 - ranges.MapY0);
                            val = module.Get(nx, ny);
                            break;
                        case MappingMode.SeamlessX:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.MapY1 - ranges.MapY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.MapY0 + q*dy;
                            val = module.Get(nx, ny, nz);
                            break;
                        case MappingMode.SeamlessY:
                            dx = ranges.MapX1 - ranges.MapX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.MapX0 + p*dx;
                            ny = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            nz = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            val = module.Get(nx, ny, nz);
                            break;

                        case MappingMode.SeamlessXY:
                            dx = ranges.LoopX1 - ranges.LoopX0;
                            dy = ranges.LoopY1 - ranges.LoopY0;
                            p = p*(ranges.MapX1 - ranges.MapX0)/(ranges.LoopX1 - ranges.LoopX0);
                            q = q*(ranges.MapY1 - ranges.MapY0)/(ranges.LoopY1 - ranges.LoopY0);
                            nx = ranges.LoopX0 + Math.Cos(p*PI2)*dx/PI2;
                            ny = ranges.LoopX0 + Math.Sin(p*PI2)*dx/PI2;
                            nz = ranges.LoopY0 + Math.Cos(q*PI2)*dy/PI2;
                            double nw = ranges.LoopY0 + Math.Sin(q*PI2)*dy/PI2;
                            val = module.Get(nx, ny, nz, nw);
                            break;
                    }
                    array[x, y] = val;
                }
            }
        }
 public ImplicitFloor(ImplicitModuleBase source)
 {
     this.Source = source;
 }
 public void AddSource(ImplicitModuleBase module)
 {
     this.sources.Add(module);
 }
        public void SetSourceOverride(Int32 which, ImplicitModuleBase newSource)
        {
            if (which < 0 || which >= Noise.MAX_SOURCES) return;

            this.sources[which] = newSource;
        }
 public ImplicitGain(ImplicitModuleBase source, ImplicitModuleBase gain)
 {
     this.Source = source;
     this.Gain   = gain;
 }
Exemple #38
0
 public ImplicitCeiling(ImplicitModuleBase source)
 {
     this.Source = source;
 }
 public ImplicitBias(ImplicitModuleBase source, Double bias)
 {
     this.Source = source;
     this.Bias   = new ImplicitConstant(bias);
 }
 public ImplicitInvert(ImplicitModuleBase source)
 {
     this.Source = source;
 }
 public ImplicitTiers(ImplicitModuleBase source, Int32 tiers, Boolean smooth)
 {
     this.Source = source;
     this.Tiers  = tiers;
     this.Smooth = smooth;
 }
Exemple #42
0
 public ImplicitPow(ImplicitModuleBase source, Double power)
 {
     this.Source = source;
     this.Power  = new ImplicitConstant(power);
 }
 public ImplicitPow(ImplicitModuleBase source, Double power)
 {
     this.Source = source;
     this.Power = new ImplicitConstant(power);
 }
Exemple #44
0
 public ImplicitCos(ImplicitModuleBase source)
 {
     this.Source = source;
 }
Exemple #45
0
 public ImplicitClamp(ImplicitModuleBase source, Double low, Double high)
 {
     this.Source = source;
     this.Low    = new ImplicitConstant(low);
     this.High   = new ImplicitConstant(high);
 }
	// Extract data from a noise module
	private void GetData(ImplicitModuleBase module, ref MapData mapData)
	{
		mapData = new MapData (Width, Height);

		// loop through each x,y point - get height value
		for (var x = 0; x < Width; x++) {
			for (var y = 0; y < Height; y++) {

				//Wrap on x-axis only
//				//Noise range
//				float x1 = 0, x2 = 1;
//				float y1 = 0, y2 = 1;				
//				float dx = x2 - x1;
//				float dy = y2 - y1;
//
//				//Sample noise at smaller intervals
//				float s = x / (float)Width;
//				float t = y / (float)Height;
//
//				// Calculate our 3D coordinates
//				float nx = x1 + Mathf.Cos (s * 2 * Mathf.PI) * dx / (2 * Mathf.PI);
//				float ny = x1 + Mathf.Sin (s * 2 * Mathf.PI) * dx / (2 * Mathf.PI);
//				float nz = t;
//
//				float heightValue = (float)HeightMap.Get (nx, ny, nz);
//
//				// keep track of the max and min values found
//				if (heightValue > mapData.Max)
//					mapData.Max = heightValue;
//				if (heightValue < mapData.Min)
//					mapData.Min = heightValue;
//
//				mapData.Data [x, y] = heightValue;



				// WRAP ON BOTH AXIS
				// Noise range
				float x1 = 0, x2 = 2;
				float y1 = 0, y2 = 2;				
				float dx = x2 - x1;
				float dy = y2 - y1;

				// Sample noise at smaller intervals
				float s = x / (float)Width;
				float t = y / (float)Height;

			
				// Calculate our 4D coordinates
				float nx = x1 + Mathf.Cos (s*2*Mathf.PI) * dx/(2*Mathf.PI);
				float ny = y1 + Mathf.Cos (t*2*Mathf.PI) * dy/(2*Mathf.PI);
				float nz = x1 + Mathf.Sin (s*2*Mathf.PI) * dx/(2*Mathf.PI);
				float nw = y1 + Mathf.Sin (t*2*Mathf.PI) * dy/(2*Mathf.PI);
			
				float heightValue = (float)HeightMap.Get (nx, ny, nz, nw);
				// keep track of the max and min values found
				if (heightValue > mapData.Max) mapData.Max = heightValue;
				if (heightValue < mapData.Min) mapData.Min = heightValue;

				mapData.Data[x,y] = heightValue;
			}
		}	
	}
 public void AddSource(ImplicitModuleBase module)
 {
     this.sources.Add(module);
 }
 public void RemoveSource(ImplicitModuleBase module)
 {
     this.sources.Remove(module);
 }
 public ImplicitScaleOffset(ImplicitModuleBase source, Double scale, Double offset)
 {
     this.Source = source;
     this.Scale = new ImplicitConstant(scale);
     this.Offset = new ImplicitConstant(offset);
 }
 public ImplicitTiers(ImplicitModuleBase source, Int32 tiers, Boolean smooth)
 {
     this.Source = source;
     this.Tiers = tiers;
     this.Smooth = smooth;
 }
 public ImplicitCos(ImplicitModuleBase source)
 {
     this.Source = source;
 }
 public ImplicitInvert(ImplicitModuleBase source)
 {
     this.Source = source;
 }