// Gets all the lights in the scene and pass them to the buffer
    void ProcessLights()
    {
        Light[] lights = FindObjectsOfType <Light>();
        m_lights = new LightStruct[lights.Length];
        for (int i = 0; i < lights.Length; i++)
        {
            m_lights[i].dir       = lights[i].transform.forward;
            m_lights[i].color     = lights[i].color;
            m_lights[i].intensity = lights[i].intensity;

            switch (lights[i].type)
            {
            case LightType.Point:
                m_lights[i].angle = 360f;
                m_lights[i].range = lights[i].range;
                m_lights[i].pos   = lights[i].transform.position;
                break;

            case LightType.Spot:
                m_lights[i].angle = lights[i].spotAngle;
                m_lights[i].range = lights[i].range;
                m_lights[i].pos   = lights[i].transform.position;
                break;

            default: // Directional lights
                // NOTE: For now, area lights are not supported, so they are treated as directional ones
                m_lights[i].angle = 360f;
                m_lights[i].range = float.PositiveInfinity;
                m_lights[i].pos   = Vector3.positiveInfinity;
                break;
            }
        }

        m_lightsBuffer = new ComputeBuffer(m_lights.Length, LightStruct.GetBytes());
        m_lightsBuffer.SetData(m_lights);
    }