コード例 #1
0
    void UpdateDirectionalLightEstimation(UnityARDirectionalLightEstimate uardle)
    {
        for (int colorChannel = 0; colorChannel < 3; colorChannel++)
        {
            for (int index = 0; index < 9; index++)
            {
                shl [colorChannel, index] = uardle.sphericalHarmonicsCoefficients [(colorChannel * 9) + index];
            }
        }

        if (LightmapSettings.lightProbes != null)
        {
            int probeCount = LightmapSettings.lightProbes.count;

            //we have at least one light probe in the scene
            if (probeCount > 0)
            {
                //Replace all the baked probes in the scene with our generated Spherical Harmonics
                SphericalHarmonicsL2[] bakedProbes = LightmapSettings.lightProbes.bakedProbes;

                for (int i = 0; i < probeCount; i++)
                {
                    bakedProbes [i] = shl;
                }
            }
        }

        //for objects unaffected by any lightprobes, set up ambient probe
        RenderSettings.ambientProbe = shl;
        RenderSettings.ambientMode  = AmbientMode.Custom;
    }
コード例 #2
0
 private void UpdateDirectionalLightEstimation(UnityARDirectionalLightEstimate uardle)
 {
     for (int i = 0; i < 3; i++)
     {
         for (int j = 0; j < 9; j++)
         {
             shl[i, j] = uardle.sphericalHarmonicsCoefficients[i * 9 + j];
         }
     }
     if (LightmapSettings.lightProbes != null)
     {
         int count = LightmapSettings.lightProbes.count;
         if (count > 0)
         {
             SphericalHarmonicsL2[] bakedProbes = LightmapSettings.lightProbes.bakedProbes;
             for (int k = 0; k < count; k++)
             {
                 bakedProbes[k] = shl;
             }
         }
     }
     RenderSettings.ambientProbe = shl;
     RenderSettings.ambientMode  = AmbientMode.Custom;
 }
コード例 #3
0
 public UnityARLightData(LightDataType ldt, UnityARLightEstimate ule, UnityARDirectionalLightEstimate udle)
 {
     arLightingType            = ldt;
     arLightEstimate           = ule;
     arDirectonalLightEstimate = udle;
 }