/// <summary> /// Adds the light. /// </summary> /// <param name="Light">The light.</param> public void AddLight(PloobsEngine.Light2D.Light2D Light) { System.Diagnostics.Debug.Assert(Light != null); Light.RenderTarget = graphicsFactory.CreateRenderTarget(Light.baseSize, Light.baseSize); Light.RenderTargetNS = graphicsFactory.CreateRenderTarget(Light.baseSize, Light.baseSize); Lights2D.Add(Light); }
/// <summary> /// Removes the light. /// </summary> /// <param name="Light">The light.</param> public void RemoveLight(PloobsEngine.Light2D.Light2D Light) { Light.RenderTarget.Dispose(); Light.RenderTarget = null; Light.RenderTargetNS.Dispose(); Light.RenderTargetNS = null; Lights2D.Remove(Light); }
public override void LightDraw(GameTime gt, SceneControl._2DScene.I2DObject obj, SceneControl.RenderHelper render, Color color, PloobsEngine.Light2D.Light2D light) { if (CastShadow) { render.RenderTexture(obj.Modelo.Texture, light.ToRelativePosition(obj.PhysicObject.Position), obj.Modelo.SourceRectangle, color, obj.PhysicObject.Rotation + obj.Modelo.Rotation, obj.Modelo.Origin + obj.PhysicObject.Origin, 1); } }
/// <summary> /// Processes the light draw. /// </summary> /// <param name="gameTime">The game time.</param> /// <param name="render">The render.</param> /// <param name="camera">The camera.</param> /// <param name="objects">The objects.</param> /// <param name="color">The color.</param> /// <param name="light">The light.</param> public void ProcessLightDraw(GameTime gameTime, SceneControl.RenderHelper render, SceneControl._2DScene.ICamera2D camera, List <SceneControl._2DScene.I2DObject> objects, Color color, PloobsEngine.Light2D.Light2D light) { render.RenderBegin(camera.View, null, SpriteSortMode.Deferred); foreach (var iobj in objects) { if (iobj.PhysicObject.Enabled == true) { iobj.Material.LightDraw(gameTime, iobj, render, color, light); } } render.RenderEnd(); }
/// <summary> /// Called once when lights are enabled /// Responsible for drawing the scene from the light perspective /// </summary> /// <param name="gt">The gt.</param> /// <param name="obj">The obj.</param> /// <param name="render">The render.</param> /// <param name="color">The color.</param> /// <param name="light">The light.</param> public abstract void LightDraw(GameTime gt, I2DObject obj, RenderHelper render, Color color, PloobsEngine.Light2D.Light2D light);