Esempio n. 1
0
        public int Render(List<Particle> particles,Device device,Renderer renderer)
        {
            int count = 0;
            renderer.ShaderConstants.World = Matrix.Identity;
            EffectData effect = this.Effect;

            effect.DxEffect.SetValue("EmissiveTexture", particleMap.DxTexture);

            BillboardObject baseBillboard = renderer.MakeBillboardObject(new MyVector(0, 0, 0), 1);

            effect.DxEffect.Begin(FX.None);

            //effect.
            for (int i = 0; i < particles.Count; i++)
            {
                if (particles[i].ParticleClass == this)
                {
                    renderer.ShaderConstants.World = Matrix.Translation((Vector3)particles[i].Position);
                    effect.DxEffect.SetValue("WorldViewProjection", renderer.ShaderConstants.WorldViewProjection);
                    baseBillboard.Scale = 100f;
                    effect.DxEffect.BeginPass(0);
                    baseBillboard.Render(device);
                    effect.DxEffect.EndPass();
                    count++;
                }
            }

            effect.DxEffect.End();

            return count;
        }
Esempio n. 2
0
        private void InitView(Device device)
        {
            worldLoaded = true;

            //meshWithWeapon = ResourceCache.Instance.GetRenderingData("handWithCrossbow.x");
            //slay = new SteeringLayer(player);

            gameController.Init();
            playerInfoLayer = new PlayerControlLayer(player, gameController);
            playerInfoLayer.RenderCrosshair = false;
            player.PlayerControl = playerInfoLayer;
            GM.AppWindow.PushLayer(playerInfoLayer);
            GM.AppWindow.PushLayer(new BeginGameLayer(player, gameController));

            this.renderer = new Renderer(device);
            renderer.LoadData();

            World.Instance.OnGrenadeHit += new GrenadeEventHandler(Instance_OnGrenadeHit);

            //ParticleEmitter em = new EngineEmitter(renderer.ParticleSystem);
            //em.Position = new MyVector(0, 0, 100);
            //renderer.ParticleSystem.AddEmitter(em);

            GM.AppWindow.AddKeyLock(KeyMapping.Default.Jump);
            GM.AppWindow.AddKeyLock(KeyMapping.Default.NextWeapon);
            GM.AppWindow.AddKeyLock(KeyMapping.Default.PreviousWeapon);
        }