Ejemplo n.º 1
0
        ControlOutput OnEnter(Flow flow)
        {
            var data = flow.stack.GetElementData <Data>(this);

            var frequency = flow.GetValue <float>(Frequency);
            var octave    = flow.GetValue <uint>(Octave);
            var amplitude = flow.GetValue <float>(Amplitude);
            var seed      = flow.GetValue <uint>(Seed);

            var time = data.Time + Time.deltaTime * frequency;
            var n    = NoiseUtil.Fbm(XXHash.Float(seed, 0u, -1000, 1000), time, octave);

            data.Time  = time;
            data.Value = n * amplitude / 0.75f;

            return(Exit);
        }
Ejemplo n.º 2
0
        ControlOutput OnEnter(Flow flow)
        {
            var data = flow.stack.GetElementData <Data>(this);

            var frequency = flow.GetValue <float>(Frequency);
            var octave    = flow.GetValue <uint>(Octave);
            var angles    = flow.GetValue <Vector3>(Angles);
            var seed      = flow.GetValue <uint>(Seed);

            var time = data.Time + Time.deltaTime * frequency;

            var nx = NoiseUtil.Fbm(XXHash.Float(seed, 0u, -1000, 1000), time, octave);
            var ny = NoiseUtil.Fbm(XXHash.Float(seed, 1u, -1000, 1000), time, octave);
            var nz = NoiseUtil.Fbm(XXHash.Float(seed, 2u, -1000, 1000), time, octave);
            var nv = Vector3.Scale(new Vector3(nx, ny, nz), angles) / 0.75f;

            data.Time  = time;
            data.Value = Quaternion.Euler(nv);

            return(Exit);
        }