Пример #1
0
    void SetupDirectionalLight(int index, int visibleIndex, ref VisibleLight visibleLight, Light light)
    {
        /*
         * Light light = RenderSettings.sun;
         * buffer.SetGlobalVector(dirLightColorId, light.color.linear * light.intensity);
         * buffer.SetGlobalVector(dirLightDirectionId, -light.transform.forward);
         */

        dirLightColors[index] = visibleLight.finalColor;

        Vector4 dirAndMask = -visibleLight.localToWorldMatrix.GetColumn(2);

        dirAndMask.w = light.renderingLayerMask.ReinterpretAsFloat();
        dirLightDirectionsAndMasks[index] = dirAndMask;

        //register the shadow casting lights
        dirLightShadowData[index] = shadows.ReserveDirectioanlShadows(light, visibleIndex);
    }