Ejemplo n.º 1
0
        public void Test0()
        {
            var ps = new ParticleSystem();
              var direction = ps.Parameters.AddUniform<Vector3F>("D");
              var speed = ps.Parameters.AddUniform<float>("L");
              var acceleration = ps.Parameters.AddUniform<Vector3F>("A");

              direction.DefaultValue = new Vector3F(0, 1 , 0);
              speed.DefaultValue = 1;
              acceleration.DefaultValue = new Vector3F(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 Vector3F(0, 1, 0), direction.DefaultValue);
              Assert.AreEqual(0, speed.DefaultValue);

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

              Assert.AreEqual(new Vector3F(0, -1, 0), direction.DefaultValue);
              Assert.AreEqual(1, speed.DefaultValue);
        }
Ejemplo n.º 2
0
        public void WrongParameters()
        {
            var ps = new ParticleSystem();
              ps.Parameters.AddUniform<Vector3F>("D");
              ps.Parameters.AddUniform<float>("L");
              ps.Parameters.AddUniform<Vector3F>("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();
        }