override public bool computeOutput(ConnectionPoint connPoint, OutputGenerationParams parms) { if (!verifyInputConnections()) { return(false); } gatherInputAndParameters(parms); NoiseGeneration.RigedMultiFractal pl = new NoiseGeneration.RigedMultiFractal(); pl.mSeed = this.SeedParam; pl.mOctaveCount.Value = this.OctaveParam; pl.mFrequency.Value = this.Frequency; pl.mLacunarity.Value = this.Lacunarity; int sWidth = 128; int sHeight = 128; MaskParam mp = ((MaskParam)(connPoint.ParamType)); mp.Value = new DAGMask(parms.Width, parms.Height); mp.Value.mConstraintMask = ConstraintMask; for (int y = 0; y < parms.Height; y++) { for (int x = 0; x < parms.Width; x++) { mp.Value[x, y] = BMathLib.Clamp((float)((pl.getValue((x / (float)parms.Width) * sWidth, (y / (float)parms.Height) * sHeight, 0) + 1) * 0.5f), 0, 1); } } return(true); }
override public float Evaluate(float inputValueA, float inputValueB) { NoiseGeneration.RigedMultiFractal rv = new NoiseGeneration.RigedMultiFractal(); float value; value = 0.5f * ((float)rv.getValue(inputValueA, inputValueB, 0) + 0.5f); value = Math.Max(0, ((float)rv.getValue(inputValueA, inputValueB, 0))); if (value < 0) { value = 0; } if (value > 1) { value = 1; } return(value); }