Skip to content

Commit

Permalink
Set tecnique on deferred lighting area lights (prime31#823)
Browse files Browse the repository at this point in the history
(cherry picked from commit bd7a40b)

Co-authored-by: bvs3 <[email protected]>
  • Loading branch information
2 people authored and NowSayPillow committed Aug 2, 2024
1 parent 622b8ca commit 66470fd
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using System;


namespace Nez.DeferredLighting
Expand Down Expand Up @@ -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"];
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 66470fd

Please sign in to comment.