/// <summary> /// Updates per spot light variables /// </summary> /// <param name="light">Light</param> /// <param name="transform">Translation and rotation matrix</param> /// <param name="viewProjection">View * projection matrix</param> /// <param name="shadowMap">Shadow map</param> public void UpdatePerLight( SceneLightSpot light, Matrix transform, Matrix viewProjection, IShadowMap shadowMap) { this.SpotLight = new BufferLightSpot(light); this.World = transform; this.WorldViewProjection = transform * viewProjection; this.ShadowMapSpot = shadowMap?.Texture; }
/// <summary> /// Constructor /// </summary> /// <param name="light">Light</param> public BufferLightSpot(SceneLightSpot light) { this.Position = light.Position; this.Direction = light.Direction; this.DiffuseColor = light.DiffuseColor; this.SpecularColor = light.SpecularColor; this.Intensity = light.Intensity; this.Intensity = light.Intensity; this.Angle = light.AngleRadians; this.Radius = light.Radius; this.CastShadow = light.CastShadow ? 1 : 0; this.MapIndex = light.ShadowMapIndex; this.MapCount = light.ShadowMapCount; this.FromLightVP = Matrix.Identity; if (light.FromLightVP?.Length > 0) { this.FromLightVP = Matrix.Transpose(light.FromLightVP[0]); } }