Beispiel #1
0
        public void Test3()
        {
            var ps           = new ParticleSystem();
            var direction    = ps.Parameters.AddVarying <Vector3>("D");
            var speed        = ps.Parameters.AddUniform <float>("L");
            var acceleration = ps.Parameters.AddVarying <Vector3>("A");

            direction.Values[11]      = new Vector3(0, 1, 0);
            speed.DefaultValue        = 1;
            acceleration.DefaultValue = new Vector3(0, -1, 0);

            var e = new LinearAccelerationEffector
            {
                ParticleSystem        = ps,
                DirectionParameter    = "D",
                SpeedParameter        = "L",
                AccelerationParameter = "A",
            };

            e.RequeryParameters();
            e.Initialize();

            var dt = new TimeSpan(0, 0, 0, 1);

            e.BeginUpdate(dt);
            e.UpdateParticles(dt, 10, 20);
            e.EndUpdate(dt);

            //Assert.AreEqual(new Vector3(0, 1, 0), direction.Values[11]);
            //Assert.AreEqual(0, speed.DefaultValue);

            e.BeginUpdate(dt);
            e.UpdateParticles(dt, 10, 20);
            e.EndUpdate(dt);

            //Assert.AreEqual(new Vector3(0, -1, 0), direction.Values[11]);
            //Assert.AreEqual(1, speed.DefaultValue);
        }
Beispiel #2
0
        public void WrongParameters()
        {
            var ps = new ParticleSystem();

            ps.Parameters.AddUniform <Vector3>("D");
            ps.Parameters.AddUniform <float>("L");
            ps.Parameters.AddUniform <Vector3>("A");

            var e = new LinearAccelerationEffector {
                ParticleSystem = ps
            };

            var dt = new TimeSpan(0, 0, 0, 1);

            // There should be no exception.
            e.RequeryParameters();
            e.Initialize();
            e.BeginUpdate(dt);
            e.UpdateParticles(dt, 10, 20);
            e.EndUpdate(dt);

            e.Uninitialize();
        }