예제 #1
0
        void DrawDominateLights()
        {
            List <DominateLight> lights = null;

            LightingManager.GetLights <DominateLight>(out lights);

            if (lights != null)
            {
                for (int i = 0; i < lights.Count; i++)
                {
                    DominateLight light = lights[i];

                    if (light.Enabled)
                    {
                        quadRenderer.BindBuffer();

                        dominateLightEffect.Parameters["Colour"].SetValue(light.Colour);
                        dominateLightEffect.Parameters["Intensity"].SetValue(light.Intensity);
                        dominateLightEffect.Parameters["Direction"].SetValue(light.Direction);
                        dominateLightEffect.Parameters["SpecPow"].SetValue(light.SpecularPower);

                        dominateLightEffect.Parameters["NormalMap"].SetValue(normalTarget);

                        dominateLightEffect.CurrentTechnique.Passes[0].Apply();

                        Common.Device.BlendState = blendBlack;

                        quadRenderer.Draw();
                    }
                }
            }
        }
예제 #2
0
        void DrawPointLights(Vector2 gdSize)
        {
            List <PointLight> lights = null;

            LightingManager.GetLights <PointLight>(out lights);

            if (lights != null)
            {
                for (int i = 0; i < lights.Count; i++)
                {
                    PointLight light = lights[i];

                    if (light.Enabled)
                    {
                        quadRenderer.BindBuffer();

                        pointLightEffect.Parameters["Colour"].SetValue(light.Colour);
                        pointLightEffect.Parameters["GDSize"].SetValue(gdSize);
                        pointLightEffect.Parameters["Intensity"].SetValue(light.Intensity);
                        pointLightEffect.Parameters["Radius"].SetValue(light.Radius);
                        pointLightEffect.Parameters["SpecPow"].SetValue(light.SpecularPower);
                        pointLightEffect.Parameters["NormalMap"].SetValue(normalTarget);

                        pointLightEffect.Parameters["Pos"].SetValue(Vector3.Transform(new Vector3(light.Pos.Y, light.Pos.X, 0),
                                                                                      Matrix.CreateTranslation(CameraManager.CurrentCamera.Pos.Y,
                                                                                                               CameraManager.CurrentCamera.Pos.X, 0)));

                        pointLightEffect.CurrentTechnique.Passes[0].Apply();

                        Common.Device.BlendState = blendBlack;

                        quadRenderer.Draw();
                    }
                }
            }
        }
예제 #3
0
        protected override void Initialize()
        {
            LightingManager.Add(this);

            base.Initialize();
        }