// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
namespace Stride.Rendering.Lights
{
    /// <summary>
    /// Defines a group of directional lights
    /// </summary>
    shader LightDirectionalGroup<int TMaxLightCount> : DirectLightGroupPerView, LightDirectional
    {
        cbuffer PerView.Lighting
        {
            DirectionalLightData Lights[TMaxLightCount];
        }

        override int GetMaxLightCount()
        {
            return TMaxLightCount;
        }

        /// <summary>
        /// Compute the light color/direction for the specified index within this group
        /// </summary>
        override void PrepareDirectLightCore(int lightIndex)
        {
            streams.lightColor = Lights[lightIndex].Color;
            // TODO: Add support for disk based Directional light
            streams.lightDirectionWS = -Lights[lightIndex].DirectionWS;
        }
    };
}
