// * // Run image generation // \return Pointer to image buffer which has been set in the constructor. // public override TextureBuffer process() { RandomNumbers.Seed((int)mSeed); int r = RandomNumbers.NextNumber(); PerlinNoise noise = new PerlinNoise(8, 0.5f, 1.0f / 32.0f, 1.0f); float filterLevel = 0.7f; float preserveLevel = 0.3f; for (int y = 0; y < mBuffer.getHeight(); y++) { for (int x = 0; x < mBuffer.getWidth(); x++) { float noiseVal = System.Math.Max(0.0f, System.Math.Min(1.0f, noise.function2D(x + r, y + r) * 0.5f + 0.5f)); mBuffer.setRed(x, y, (byte)System.Math.Min(preserveLevel * mColour.r * 255.0f + filterLevel * mColour.r * 255.0f * noiseVal, 255.0f)); mBuffer.setGreen(x, y, (byte)System.Math.Min(preserveLevel * mColour.g * 255.0f + filterLevel * mColour.g * 255.0f * noiseVal, 255.0f)); mBuffer.setBlue(x, y, (byte)System.Math.Min(preserveLevel * mColour.b * 255.0f + filterLevel * mColour.b * 255.0f * noiseVal, 255.0f)); mBuffer.setAlpha(x, y, mColour.a); } } Utils.log("Create cloud texture"); return mBuffer; }
// * // Run image generation // \return Pointer to image buffer which has been set in the constructor. // public override TextureBuffer process() { RandomNumbers.Seed((int)mSeed); int r = RandomNumbers.NextNumber(); PerlinNoise noise = new PerlinNoise(2, 0.65f, 1.0f / 32.0f, 1.0f); float xFact = 1.0f / 96.0f; float yFact = 1.0f / 48.0f; float filterLevel = 0.7f; float preserveLevel = 0.3f; for (int y = 0; y < mBuffer.getHeight(); y++) { for (int x = 0; x < mBuffer.getWidth(); x++) { float noiseVal = System.Math.Min(1.0f, Math.Abs(Math.Sin(x * xFact + y * yFact + noise.function2D(x + r, y + r)) * Math.PI)); mBuffer.setRed(x, y, (byte)System.Math.Min(preserveLevel * mColour.r * 255.0f + filterLevel * mColour.r * 255.0f * noiseVal, 255.0f)); mBuffer.setGreen(x, y, (byte)System.Math.Min(preserveLevel * mColour.g * 255.0f + filterLevel * mColour.g * 255.0f * noiseVal, 255.0f)); mBuffer.setBlue(x, y, (byte)System.Math.Min(preserveLevel * mColour.b * 255.0f + filterLevel * mColour.b * 255.0f * noiseVal, 255.0f)); mBuffer.setAlpha(x, y, mColour.a); } } Utils.log("Create marble texture"); return mBuffer; }
// * // Run image generation // \return Pointer to image buffer which has been set in the constructor. // public override TextureBuffer process() { RandomNumbers.Seed((int)mSeed); int r = RandomNumbers.NextNumber(); float filterLevel = 0.7f; float preserveLevel = 0.3f; PerlinNoise noise = new PerlinNoise(8, 0.5f, 1.0f / 32.0f, 0.05f); int w2 = mBuffer.getWidth() / 2; int h2 = mBuffer.getHeight() / 2; for (int y = 0; y < (int)mBuffer.getHeight(); y++) { for (int x = 0; x < (int)mBuffer.getWidth(); x++) { float xv = ((float)(x - w2)) / (float)mBuffer.getWidth(); float yv = ((float)(y - h2)) / (float)mBuffer.getHeight(); float noiseVal = System.Math.Min(1.0f, Math.Abs(Math.Sin((Math.Sqrt(xv * xv + yv * yv) + noise.function2D(x + r, y + r)) * Math.PI * 2 * mRings))); mBuffer.setRed(x, y, (byte)System.Math.Min(preserveLevel * mColour.r * 255.0f + filterLevel * mColour.r * 255.0f * noiseVal, 255.0f)); mBuffer.setGreen(x, y, (byte)System.Math.Min(preserveLevel * mColour.g * 255.0f + filterLevel * mColour.g * 255.0f * noiseVal, 255.0f)); mBuffer.setBlue(x, y, (byte)System.Math.Min(preserveLevel * mColour.b * 255.0f + filterLevel * mColour.b * 255.0f * noiseVal, 255.0f)); mBuffer.setAlpha(x, y, mColour.a); } } Utils.log("Create wood texture : " +(mRings).ToString()); return mBuffer; }