Esempio n. 1
0
    private void processVREvent(WVR_Event_t vrEvent)
    {
        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdChanged:
        {
            WaveVR_Utils.Event.Send("IpdChanged");
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
        }
        break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
        {
            WaveVR_Utils.Event.Send("TrackedDeviceUpdated", vrEvent.device.common.type);
        }
        break;

        case WVR_EventType.WVR_EventType_BatteryStatusUpdate:
        {
            WaveVR_Utils.Event.Send("BatteryStatusUpdate");
        }
        break;

        case WVR_EventType.WVR_EventType_LeftToRightSwipe:
        case WVR_EventType.WVR_EventType_RightToLeftSwipe:
        case WVR_EventType.WVR_EventType_DownToUpSwipe:
        case WVR_EventType.WVR_EventType_UpToDownSwipe:
            WaveVR_Utils.Event.Send("SWIPE_EVENT", vrEvent.common.type);
            break;

        case WVR_EventType.WVR_EventType_DeviceRoleChanged:
            if (WaveVR.Instance != null)
            {
                SetLeftHandedMode();
                ResetButtonStates();

                Log.i(LOG_TAG, "processVREvent() Resend connection notification after switching hand.");
                WaveVR.Instance.OnControllerRoleChange();
            }
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
Esempio n. 2
0
    private void processVREvent(WVR_Event_t vrEvent)
    {
        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdUpdate:
        {
            WaveVR_Utils.Event.Send("IpdChanged");
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
        }
        break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
        {
            WaveVR_Utils.Event.Send("TrackedDeviceUpdated", vrEvent.device.common.type);
        }
        break;

        case WVR_EventType.WVR_EventType_BatteryStatus_Update:
        {
            WaveVR_Utils.Event.Send("BatteryStatus_Update");
        }
        break;

        case WVR_EventType.WVR_EventType_TouchpadSwipe_LeftToRight:
        case WVR_EventType.WVR_EventType_TouchpadSwipe_RightToLeft:
        case WVR_EventType.WVR_EventType_TouchpadSwipe_DownToUp:
        case WVR_EventType.WVR_EventType_TouchpadSwipe_UpToDown:
            WaveVR_Utils.Event.Send("SWIPE_EVENT", vrEvent.common.type);
            break;

        case WVR_EventType.WVR_EventType_Settings_Controller:
            if (WaveVR.Instance != null)
            {
                WaveVR_Controller.SetLeftHandedMode();
                Log.i(LOG_TAG, "Set left-handed mode to " + WaveVR_Controller.IsLeftHanded);
            }
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
Esempio n. 3
0
    void Start()
    {
        Log.d(LOG_TAG, "Start()+");
        var camera = GetComponent <Camera>();

        camera.cullingMask     = CameraGaze ? camera.cullingMask : 0;
        camera.backgroundColor = Color.black;
        camera.clearFlags      = CameraClearFlags.Nothing;
        // Camera.main need this camera to enabled
        camera.enabled = true;
        camera.rect    = new Rect(0.5f - 0.01f, 0.5f - 0.01f, 0.02f, 0.02f);
        camera.tag     = "MainCamera";

        WaveVR_Render.Expand(this);
        configurationChanged = false;
        Log.d(LOG_TAG, "Start()-");
    }
Esempio n. 4
0
        public override void Install(bool reset)
        {
            base.Install(reset);

            this.WithLock(() =>
            {
                var rend = this.Ensure <WaveVR_Render>();
                if (rend.IsNew)
                {
                    if (!rend.Value.isExpanded)
                    {
                        WaveVR_Render.Expand(rend);
                    }
                    rend.Value.cpuPerfLevel = WaveVR_Utils.WVR_PerfLevel.Maximum;
                    rend.Value.gpuPerfLevel = WaveVR_Utils.WVR_PerfLevel.Maximum;
                }

                rend.Value.origin = WVR_PoseOriginModel.WVR_PoseOriginModel_OriginOnHead;

                var tracker             = this.Ensure <WaveVR_DevicePoseTracker>().Value;
                tracker.type            = WVR_DeviceType.WVR_DeviceType_HMD;
                tracker.trackPosition   = true;
                tracker.EnableNeckModel = true;
                tracker.trackRotation   = true;
                tracker.timing          = WVR_TrackTiming.WhenNewPoses;

#if UNITY_MODULES_AUDIO
#if UNITY_GOOGLE_RESONANCE_AUDIO
                var wasStereo = goog.stereoSpeakerModeEnabled;
                this.Remove <ResonanceAudioListener>();
#endif

                this.Remove <AudioListener>();
                Find.Any(out listener);

#if UNITY_GOOGLE_RESONANCE_AUDIO
                goog = listener.Ensure <ResonanceAudioListener>();
                goog.stereoSpeakerModeEnabled = wasStereo;
#endif
#endif
            });
        }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        if (logo)
        {
            // Logo need have aspect rate 2:1
            int bannerWidth, bannerHeight;
            bannerWidth  = Screen.width - 35;
            bannerHeight = (int)(bannerWidth / (float)2);
            if (bannerHeight > bannerHeightMax)
            {
                bannerHeight = bannerHeightMax;
                bannerWidth  = bannerHeight * 2;
            }
            var rect = GUILayoutUtility.GetRect(bannerWidth, bannerHeight, GUI.skin.box);
            GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
        }
        EditorGUILayout.PropertyField(script);

        EditorGUILayout.PropertyField(CameraGaze);

        //EditorGUILayout.PropertyField(useSingleBuffer);
        //EditorGUILayout.PropertyField(useCompositor);
        //EditorGUILayout.PropertyField(prediction);
        //EditorGUILayout.PropertyField(textureExpand);
        //EditorGUILayout.PropertyField(targetFPS);
        EditorGUILayout.PropertyField(_origin);
        EditorGUILayout.PropertyField(needTimeControl);
        //EditorGUILayout.PropertyField(useATW);

        if (!Application.isPlaying)
        {
            var expand   = false;
            var collapse = false;

            foreach (WaveVR_Render target in targets)
            {
                if (AssetDatabase.Contains(target))
                {
                    continue;
                }
                if (target.isExpanded)
                {
                    collapse = true;
                }
                else
                {
                    expand = true;
                }
            }

            if (expand)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Expand"))
                {
                    foreach (WaveVR_Render target in targets)
                    {
                        if (AssetDatabase.Contains(target))
                        {
                            continue;
                        }
                        if (!target.isExpanded)
                        {
                            WaveVR_Render.Expand(target);
                            EditorUtility.SetDirty(target);
                        }
                    }
                }
                GUILayout.Space(18);
                GUILayout.EndHorizontal();
            }

            if (collapse)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Collapse"))
                {
                    foreach (WaveVR_Render target in targets)
                    {
                        if (AssetDatabase.Contains(target))
                        {
                            continue;
                        }
                        if (target.isExpanded)
                        {
                            WaveVR_Render.Collapse(target);
                            EditorUtility.SetDirty(target);
                        }
                    }
                }
                GUILayout.Space(18);
                GUILayout.EndHorizontal();
            }
        }
        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 6
0
    private IEnumerator RenderLoop()
    {
        var wait = new WaitForEndOfFrame();

        yield return(wait);

        Log.d(LOG_TAG, "RenderLoop() is started");
        var tim = Time.time;

#if UNITY_EDITOR
        if (!Application.isEditor)
#endif
        {
            // Restart ATW thread before rendering.
            while (!WaveVR_Utils.WVR_IsATWActive())
            {
                yield return(wait);

                if (surfaceChanged && isNeedTimeout == false)
                {
                    break;
                }
                if (Time.time - tim > 1.0f)
                {
                    Log.w(LOG_TAG, "Waiting for surface change is timeout.");
                    break;
                }
            }
            // Reset isNeedTimeout flag
            isNeedTimeout = false;

            if (textureManager != null)
            {
                if (!textureManager.validate())
                {
                    textureManager.reset();
                }
            }
        }
        Log.d(LOG_TAG, "First frame");
        WaveVR_Utils.IssueEngineEvent(WaveVR_Utils.EngineEventID.FIRST_FRAME);

        setLoadingCanvas(false);
        Log.d(LOG_TAG, "RenderLoop() is running");

        while (true)
        {
            Log.gpl.d(LOG_TAG, "RenderLoop() is still running");
            WaveVR_Utils.Trace.BeginSection("RenderLoop", false);
#if UNITY_EDITOR
            if (Application.isEditor)
            {
                WaveVR_Utils.Event.Send(WaveVR_Utils.Event.NEW_POSES, new WVR_DevicePosePair_t[0], new WaveVR_Utils.RigidTransform[0]);
                WaveVR_Utils.Event.Send(WaveVR_Utils.Event.AFTER_NEW_POSES);
                textureManager.Next();
            }
            else
#endif
            {
                WaveVR.Instance.UpdatePoses(origin);
                // Set next texture before running any graphic command.
                textureManager.Next();
            }

            if (configurationChanged)
            {
                WaveVR_Render.Expand(this);
                configurationChanged = false;
            }

            RenderEye(lefteye.getCamera(), WVR_Eye.WVR_Eye_Left);
            RenderEye(righteye.getCamera(), WVR_Eye.WVR_Eye_Right);
            WaveVR_Utils.Trace.EndSection(false);

            // Put here to control the time of next frame.
            TimeControl();

            Log.gpl.d(LOG_TAG, "End of frame");
            yield return(wait);
        }
    }
Esempio n. 7
0
    private void processVREvent(WVR_Event_t vrEvent)
    {
        WVR_DeviceType _type = vrEvent.device.type;
        WVR_InputId    _btn  = vrEvent.input.inputId;

        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdChanged:
        {
            WaveVR_Utils.Event.Send("IpdChanged");
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
        }
        break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
        {
            WaveVR_Utils.Event.Send("TrackedDeviceUpdated", vrEvent.device.common.type);
        }
        break;

        case WVR_EventType.WVR_EventType_BatteryStatusUpdate:
        {
            WaveVR_Utils.Event.Send("BatteryStatusUpdate");
        }
        break;

        case WVR_EventType.WVR_EventType_LeftToRightSwipe:
        case WVR_EventType.WVR_EventType_RightToLeftSwipe:
        case WVR_EventType.WVR_EventType_DownToUpSwipe:
        case WVR_EventType.WVR_EventType_UpToDownSwipe:
            Log.i(LOG_TAG, "Swipe event: " + (WVR_EventType)vrEvent.common.type);
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.SWIPE_EVENT, vrEvent.common.type, _type);
            break;

        case WVR_EventType.WVR_EventType_DeviceRoleChanged:
            Log.i(LOG_TAG, "WVR_EventType_DeviceRoleChanged() " + _type + ", " + _btn + ", Resend connection notification after switching hand.");
            WaveVR.Instance.SetConnectionStatus();
            if (WaveVR.Instance.SetLeftHandedMode())
            {
                WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_ROLE_CHANGED);
                WaveVR.Instance.ResetAllButtonStates();
            }
            break;

        case WVR_EventType.WVR_EventType_ButtonPressed:
            Log.d(LOG_TAG, "WVR_EventType_ButtonPressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_ButtonUnpressed:
            Log.d(LOG_TAG, "WVR_EventType_ButtonUnpressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_TouchTapped:
            Log.d(LOG_TAG, "WVR_EventType_TouchTapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_TouchUntapped:
            Log.d(LOG_TAG, "WVR_EventType_TouchUntapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance != null)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_DeviceConnected:
            Log.d(LOG_TAG, "WVR_EventType_DeviceConnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, true);
            break;

        case WVR_EventType.WVR_EventType_DeviceDisconnected:
            Log.d(LOG_TAG, "WVR_EventType_DeviceDisconnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, false);
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
Esempio n. 8
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        if (logo)
        {
            // Logo need have aspect rate 2:1
            int bannerWidth, bannerHeight;
            bannerWidth  = Screen.width - 35;
            bannerHeight = (int)(bannerWidth / (float)2);
            if (bannerHeight > bannerHeightMax)
            {
                bannerHeight = bannerHeightMax;
                bannerWidth  = bannerHeight * 2;
            }
            var rect = GUILayoutUtility.GetRect(bannerWidth, bannerHeight, GUI.skin.box);
            GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
        }

        if (!Application.isPlaying)
        {
            var expand   = false;
            var collapse = false;

            if (render.isExpanded)
            {
                collapse = true;
            }
            else
            {
                expand = true;
            }

            if (expand)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Expand"))
                {
                    if (!render.isExpanded)
                    {
                        WaveVR_Render.Expand(render);
                        EditorUtility.SetDirty(render);
                    }
                }
                GUILayout.EndHorizontal();
            }

            if (collapse)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Collapse"))
                {
                    if (render.isExpanded)
                    {
                        WaveVR_Render.Collapse(render);
                        EditorUtility.SetDirty(render);
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
        serializedObject.ApplyModifiedProperties();

        EditorGUI.BeginChangeCheck();
        DrawDefaultInspector();
        if (EditorGUI.EndChangeCheck())
        {
            Validate();
        }
    }
    private void processVREvent(WVR_Event_t vrEvent)
    {
        WVR_DeviceType _type = vrEvent.device.type;
        WVR_InputId    _btn  = vrEvent.input.inputId;

        // Process events used by plugin
        switch ((WVR_EventType)vrEvent.common.type)
        {
        case WVR_EventType.WVR_EventType_IpdChanged:
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.IPD_CHANGED);
            if (WaveVR_Render.Instance != null)
            {
                WaveVR_Render.Expand(WaveVR_Render.Instance);
            }
            break;

        case WVR_EventType.WVR_EventType_DeviceStatusUpdate:
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_STATUS_UPDATE, vrEvent.device.common.type);
            break;

        case WVR_EventType.WVR_EventType_BatteryStatusUpdate:
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.BATTERY_STATUS_UPDATE);
            break;

        case WVR_EventType.WVR_EventType_LeftToRightSwipe:
        case WVR_EventType.WVR_EventType_RightToLeftSwipe:
        case WVR_EventType.WVR_EventType_DownToUpSwipe:
        case WVR_EventType.WVR_EventType_UpToDownSwipe:
            PrintDebugLog("Swipe event: " + (WVR_EventType)vrEvent.common.type);
            WaveVR_Utils.Event.Send(WaveVR_Utils.Event.SWIPE_EVENT, vrEvent.common.type, _type);
            break;

        case WVR_EventType.WVR_EventType_DeviceRoleChanged:
            PrintDebugLog("WVR_EventType_DeviceRoleChanged() " + _type + ", " + _btn + ", Resend connection notification after switching hand.");
            WaveVR.Instance.UpdateAllConnection();
            if (WaveVR.Instance.SetLeftHandedMode())
            {
                // Due to connected, valid pose and role change are not synchronized, DEVICE_ROLE_CHANGED will be obseleted.
                WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_ROLE_CHANGED);
                WaveVR.Instance.ResetAllButtonStates();
            }
            break;

        case WVR_EventType.WVR_EventType_ButtonPressed:
            PrintDebugLog("WVR_EventType_ButtonPressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_ButtonUnpressed:
            PrintDebugLog("WVR_EventType_ButtonUnpressed() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Press(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_TouchTapped:
            PrintDebugLog("WVR_EventType_TouchTapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, true);
            break;

        case WVR_EventType.WVR_EventType_TouchUntapped:
            PrintDebugLog("WVR_EventType_TouchUntapped() " + _type + ", " + _btn + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid && WaveVR.Instance.Initialized)
            {
                _type = WaveVR.Instance.getDeviceByType(_type).type;
            }
            WaveVR_Controller.Input(_type).SetEventState_Touch(_btn, false);
            break;

        case WVR_EventType.WVR_EventType_DeviceConnected:
            PrintDebugLog("WVR_EventType_DeviceConnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, true);
            break;

        case WVR_EventType.WVR_EventType_DeviceDisconnected:
            PrintDebugLog("WVR_EventType_DeviceDisconnected() " + _type + ", left-handed? " + WaveVR_Controller.IsLeftHanded);
            WaveVR.Instance.SetConnectionStatus(_type, false);
            if (_type != WVR_DeviceType.WVR_DeviceType_Invalid)
            {
                _type = WaveVR_Controller.Input(_type).DeviceType;
                WaveVR_Controller.Input(_type).ResetButtonEvents();
            }
            break;

        default:
            break;
        }

        // Send event to developer for all kind of event if developer don't want to add callbacks for every event.
        WaveVR_Utils.Event.Send(WaveVR_Utils.Event.ALL_VREVENT, vrEvent);

        // Send event to developer by name.
        WaveVR_Utils.Event.Send(vrEvent.common.type.ToString(), vrEvent);
    }
Esempio n. 10
0
    private IEnumerator RenderLoop()
    {
        if (cachedWaitForEndOfFrame == null)
        {
            cachedWaitForEndOfFrame = new WaitForEndOfFrame();
        }
        yield return(cachedWaitForEndOfFrame);

        yield return(cachedWaitForEndOfFrame);

        if (isInitializeGraphic == false)
        {
            InitializeGraphic();
            // sync here to wait InitializeGraphic done because InitializeGraphic is migration to render thread.
            synchronizer.sync();
            textureManager      = new TextureManager();
            isInitializeGraphic = true;
        }

        Log.d(LOG_TAG, "RenderLoop() is started");
        var tim = Time.realtimeSinceStartup;

#if UNITY_EDITOR
        if (!Application.isEditor)
#endif
        {
            WaveVR_Utils.WVR_SetPerformanceLevels(cpuPerfLevel, gpuPerfLevel);
            Log.i(LOG_TAG, "SetPerformanceLevels cpuPerfLevel " + cpuPerfLevel + " gpuPerfLevel " + gpuPerfLevel);
            // Restart ATW thread before rendering.
            while (!WaveVR_Utils.WVR_IsATWActive())
            {
                yield return(cachedWaitForEndOfFrame);

                if (surfaceChanged && isNeedTimeout == false)
                {
                    break;
                }
                if (Time.realtimeSinceStartup - tim > 1.0f)
                {
                    Log.w(LOG_TAG, "Waiting for surface change is timeout.");
                    break;
                }
            }
            // Reset isNeedTimeout flag
            isNeedTimeout = false;

            if (textureManager != null)
            {
                if (!textureManager.validate())
                {
                    textureManager.reset();
                }
            }
        }
        Log.d(LOG_TAG, "First frame");
        WaveVR_Utils.IssueEngineEvent(WaveVR_Utils.EngineEventID.FIRST_FRAME);

        setLoadingCanvas(false);
        Log.d(LOG_TAG, "RenderLoop() is running");

        while (true)
        {
            Log.gpl.d(LOG_TAG, "RenderLoop() is still running");
            WaveVR_Utils.Trace.BeginSection("RenderLoop", false);
#if UNITY_EDITOR
            if (Application.isEditor)
            {
                if (WaveVR.Instance.isSimulatorOn)
                {
                    WaveVR.Instance.UpdatePoses(origin, true);
                }
                else
                {
                    WaveVR_Utils.Event.Send(WaveVR_Utils.Event.NEW_POSES, new WVR_DevicePosePair_t[0], new WaveVR_Utils.RigidTransform[0]);
                    WaveVR_Utils.Event.Send(WaveVR_Utils.Event.AFTER_NEW_POSES);
                }
                if (textureManager != null)
                {
                    textureManager.Next();
                }
            }
            else
#endif
            {
                WaveVR.Instance.UpdatePoses(origin);
                // Set next texture before running any graphic command.
                if (textureManager != null)
                {
                    textureManager.Next();
                }
            }

            if (configurationChanged)
            {
                WaveVR_Render.Expand(this);
                configurationChanged = false;
            }

            RenderEye(lefteye.getCamera(), WVR_Eye.WVR_Eye_Left);
            RenderEye(righteye.getCamera(), WVR_Eye.WVR_Eye_Right);
            WaveVR_Utils.Trace.EndSection(false);

            // Put here to control the time of next frame.
            TimeControl();

            Log.gpl.d(LOG_TAG, "End of frame");
            yield return(cachedWaitForEndOfFrame);
        }
    }