using System;
using Microsoft.Xna.Framework;

namespace GraphiXNA.Graphics
{
    public sealed class Light
    {
        public Vector3 Direction = new Vector3(0, -1, -1);
        public Vector3 Position = new Vector3(0, 15, 0);
        public float Range = 20;
        public float SpotInnerCone = 20;
        public float SpotOuterCone = 45;

        internal LightType LightT = LightType.Directional;

        public Light(Vector3 direction)
        {
            Direction = direction;
            LightT = LightType.Directional;
        }

        public Light(Vector3 position, float radius)
        {
            Position = position;
            Range = radius;
            LightT = LightType.Point;
        }

        public Light(Vector3 direction, Vector3 position, float spotMinAnglr, float spotMaxAngle, float range)
        {
            Position = position;
            Range = range;
            SpotInnerCone = spotMinAnglr;
            SpotOuterCone = spotMaxAngle;
            LightT = LightType.Spot;
        }


        public void Change(Vector3 direction)
        {
            Direction = direction;
            LightT = LightType.Directional;
        }

        public void Change(Vector3 position, float radius)
        {
            Position = position;
            Range = radius;
            LightT = LightType.Point;
        }

        public void Change(Vector3 direction, Vector3 position, float spotMinAnglr, float spotMaxAngle, float range)
        {
            Position = position;
            Range = range;
            SpotInnerCone = spotMinAnglr;
            SpotOuterCone = spotMaxAngle;
            LightT = LightType.Spot;
        }


        internal enum LightType
        {
            Directional,
            Point,
            Spot
        }
    }
}
