From 66470fd6d1be5a7ea2b7b2111bf3e1ccb5cb8220 Mon Sep 17 00:00:00 2001 From: BVS3 <43793810+BVS3@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:25:26 -0400 Subject: [PATCH] Set tecnique on deferred lighting area lights (#823) (cherry picked from commit bd7a40bbea759c67790b174d1296d329cdda2b49) Co-authored-by: bvs3 --- .../DeferredLighting/Effects/DeferredLightEffect.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Nez.Portable/Graphics/DeferredLighting/Effects/DeferredLightEffect.cs b/Nez.Portable/Graphics/DeferredLighting/Effects/DeferredLightEffect.cs index 4c8e4e462..7fa9e032c 100644 --- a/Nez.Portable/Graphics/DeferredLighting/Effects/DeferredLightEffect.cs +++ b/Nez.Portable/Graphics/DeferredLighting/Effects/DeferredLightEffect.cs @@ -1,6 +1,6 @@ -using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework; +using System; namespace Nez.DeferredLighting @@ -145,8 +145,8 @@ public void UpdateForLight(PointLight light) SetLightIntensity(light.Intensity); var objToWorld = Matrix.CreateScale(light.Radius * light.Entity.Transform.Scale.X) * - Matrix.CreateTranslation(light.Entity.Transform.Position.X + light.LocalOffset.X, - light.Entity.Transform.Position.Y + light.LocalOffset.Y, 0); + Matrix.CreateTranslation(light.Entity.Transform.Position.X + light.LocalOffset.X, + light.Entity.Transform.Position.Y + light.LocalOffset.Y, 0); SetObjectToWorldMatrix(objToWorld); CurrentTechnique = Techniques["DeferredPointLight"]; @@ -185,6 +185,7 @@ public void UpdateForLight(AreaLight light) light.Bounds.X - light.Bounds.Width * 0.5f, light.Bounds.Y - light.Bounds.Height * 0.5f, 0); SetObjectToWorldMatrix(objToWorld); + CurrentTechnique = Techniques["DeferredAreaLight"]; areaLightPass.Apply(); } @@ -296,7 +297,7 @@ public void SetSpotLightDirection(Vector2 lightDirection) public void SetSpotLightDirection(float degrees) { var radians = MathHelper.ToRadians(degrees); - var dir = new Vector2((float) Math.Cos(radians), (float) Math.Sin(radians)); + var dir = new Vector2((float)Math.Cos(radians), (float)Math.Sin(radians)); SetSpotLightDirection(dir); }