コード例 #1
0
        public void ProcessLighting(Camera camera)
        {
            if (DaydreamLight.s_resortLights)
            {
                DaydreamLight.s_resortLights = false;
                DaydreamLight.ResortLights();
            }

            bool changed = true;

            if (DaydreamLight.s_masterLightArray != null && DaydreamLight.s_masterLightArray.Length > 0)
            {
                // update lights
                DaydreamLight.StartFrame(camera);

                DaydreamLight lightData = null;

                for (int i = 0, k = DaydreamLight.s_masterLightArray.Length; i < k; ++i)
                {
                    if (i >= DaydreamLight.s_masterLightArray.Length)
                    {
                        break;
                    }

                    lightData = DaydreamLight.s_masterLightArray[i];
#if UNITY_EDITOR
                    lightData.InEditorUpdate();
#endif
                    lightData.CheckForChange();
                    lightData.UpdateFrame();
                    lightData.UpdateViewSpace();
                }

                changed      = DaydreamLight.AnyLightChanged() || m_lightCount != DaydreamLight.GetLightCount();
                m_lightCount = DaydreamLight.GetLightCount();
            }


            if (DaydreamMeshRenderer.m_objectList != null)
            {
                DaydreamMeshRenderer.StartFrame();

                // process objects
                for (int i = 0, k = DaydreamMeshRenderer.m_objectList.Count; i < k; ++i)
                {
                    DaydreamMeshRenderer dmr = DaydreamMeshRenderer.m_objectList[i];

                    if (!dmr.m_didInit)
                    {
                        dmr.DMRInit();
                    }
#if UNITY_EDITOR
                    dmr.InEditorUpdate();
#endif
                    dmr.UpdateStaticState();
                    dmr.ApplyLighting(changed);
                }
            }
        }
コード例 #2
0
        public void ProcessLighting(Camera camera)
        {
            if (DaydreamLight.s_resortLights)
            {
                DaydreamLight.s_resortLights = false;
                DaydreamLight.ResortLights();
            }

            #if UNITY_EDITOR
            for (int i = 0, k = s_inEditorUpdateList.Count; i < k; ++i)
            {
                s_inEditorUpdateList[i].InEditorUpdate();
            }
            #endif

            bool changed = true;
            if (DaydreamLight.s_masterLightArray != null && DaydreamLight.s_masterLightArray.Length > 0)
            {
                // update lights
                DaydreamLight.StartFrame(camera);

                DaydreamLight lightData = null;

                for (int i = 0, k = DaydreamLight.s_masterLightArray.Length; i < k; ++i)
                {
                    if (i >= DaydreamLight.s_masterLightArray.Length)
                    {
                        break;
                    }

                    lightData = DaydreamLight.s_masterLightArray[i];

                    // these should update once per frame regardless of camera count
                    if (m_frameStarted)
                    {
                        #if UNITY_EDITOR
                        lightData.InEditorUpdate();
                        #endif
                        lightData.CheckForChange();
                        lightData.UpdateFrame();
                    }

                    // this updates each frame for each camera
                    lightData.UpdateViewSpace();
                }

                // first time through this should get set back to false so other cameras
                // don't update light values that only need to be udpate once per frame
                m_frameStarted = false;

                changed      = DaydreamLight.AnyLightChanged() || m_lightCount != DaydreamLight.GetLightCount();
                m_lightCount = DaydreamLight.GetLightCount();
            }

            if (s_objectList != null)
            {
                DaydreamMeshRenderer.StartFrame();

                // process objects
                for (int i = 0, k = s_objectList.Count; i < k; ++i)
                {
                    DaydreamMeshRenderer dmr = s_objectList[i];

                    if (!dmr.m_didInit)
                    {
                        dmr.DMRInit();
                    }
#if UNITY_EDITOR
                    if (!dmr.InEditorUpdate())
                    {
                        continue;
                    }
#endif
                    dmr.UpdateStaticState();
                    dmr.ApplyLighting(changed);
                }
            }
        }