Ejemplo n.º 1
0
        public void TestFollowCurve()
        {
            XNAGame game = new XNAGame();

            Curve3D curve = Curve3D.CreateTestCurve();

            game.SpectaterCamera.CameraDirection = Vector3.Normalize(new Vector3(-0.2f, -1f, -0.4f));
            BoundingSphere sphere = curve.CalculateBoundingSphere();

            sphere.Radius += 1.5f;
            game.SpectaterCamera.FitInView(sphere);

            float time = 0;

            game.DrawEvent +=
                delegate
            {
                if (game.Keyboard.IsKeyPressed(Keys.V))
                {
                    game.SpectaterCamera.CameraDirection = Vector3.Normalize(new Vector3(-0.2f, -1f, -0.4f));
                }
                Render(curve, game, Color.Red);
                game.LineManager3D.AddCenteredBox(curve.Evaluate(time), 0.2f, Color.Green);
                time += game.Elapsed;
            };


            game.Run();
        }
Ejemplo n.º 2
0
        public void BasicBalTest()
        {
            Emitter  emit;
            DX11Game game = new DX11Game();

            game.InitDirectX();


            var texPool                 = new TexturePool(game);
            var testTexture             = GetTestTexture();
            BallParticleCreater creater = new BallParticleCreater();
            //SimpleParticleCreater creater = new SimpleParticleCreater();
            EmitterParameters param = new EmitterParameters();

            param.texture         = testTexture;
            param.particleCreater = creater;
            emit = new Emitter(texPool, game, param, 800, 600);//note: again screen size
            //game.Wpf.CreateClassForm(param);
            Seeder seed  = new Seeder(54);
            var    curve = Curve3D.CreateTestCurve();



            emit.Initialize();
            emit.InitializeRender();


            emit.CreateRenderData();
            emit.SetRenderData();
            emit.SetPosition(Vector3.Zero);
            float dist = 0;

            game.GameLoopEvent += delegate
            {
                // emit.setShader();
                emit.Update();
                if (dist > 100)
                {
                    dist = 0;
                }
                else
                {
                    dist += game.Elapsed * 1;
                }
                //emit.SetPosition(new Vector3(dist, 0, 0));
                Temp(dist, emit, curve);

                //Draw part

                //game.GraphicsDevice.Clear(Color.Black);
                game.Device.ImmediateContext.Rasterizer.State = game.HelperStates.RasterizerShowAll;
                emit.Render(game.SpectaterCamera.ViewProjection, game.SpectaterCamera.ViewInverse);
            };



            game.Run();
        }
Ejemplo n.º 3
0
        public void FlameTest()
        {
            Emitter  emit;
            DX11Game game = new DX11Game();

            game.InitDirectX();
            FlameParticleCreater creater;
            //game.DrawFps = true;

            //var pool = new VertexDeclarationPool();
            //pool.SetVertexElements<Emitter.ParticleVertex>(Emitter.ParticleVertex.VertexElements);
            var texPool     = new TexturePool(game);
            var testTexture = GetTestTexture();

            creater = new FlameParticleCreater();
            EmitterParameters param = new EmitterParameters();

            param.EffectName      = "calculateFlame";
            param.texture         = testTexture;
            param.particleCreater = creater;
            emit = new Emitter(texPool, game, param, 800, 600);
            Seeder seed = new Seeder(54);

            var curve = Curve3D.CreateTestCurve();


            //texPool.Initialize(game);
            //pool.Initialize(game);

            emit.Initialize();
            emit.InitializeRender();


            emit.CreateRenderData();
            emit.SetRenderData();
            //emit.AddParticles(creater,1);

            float dist = 0;

            game.GameLoopEvent += delegate
            {
                dist += game.Elapsed;
                // emit.setShader();
                //Temp(dist, emit, curve);

                //setColors(emit);
                emit.Update();
                emit.Render(game.SpectaterCamera.ViewProjection, game.SpectaterCamera.ViewInverse);
            };

            game.Run();
        }