コード例 #1
0
        public Vec3 Value(double u, double v, Vec3 p)
        {
            double noise = 0.5;

            switch (_type)
            {
            default:
            case Type.DEFAULT: noise = _noise.Noise(p * _scale); break;

            case Type.TURB: noise = _noise.Turb(p * _scale); break;

            case Type.SIN_X: noise = Math.Sin(_scale * p.X + 10 * _noise.Turb(p * _scale)); break;

            case Type.SIN_Y: noise = Math.Sin(_scale * p.Y + 10 * _noise.Turb(p * _scale)); break;

            case Type.SIN_Z: noise = Math.Sin(_scale * p.Z + 10 * _noise.Turb(p * _scale)); break;
            }
            return(Vec3.Create(1.0) * (noise * 0.5 + 0.5));
        }
コード例 #2
0
 public void TestNoise(int x, int y, int z, double expectation)
 {
     Assert.AreEqual(expectation, improvedPerlin.Noise(x, y, z));
 }