void SendDisconnectToPlayer()
        {
            serializableFromEditorMessage sfem = new serializableFromEditorMessage();

            sfem.subMessageId = MiraSubMessageIds.editorDisconnect;
            sfem.bytes        = Time.time.ToString().SerializeToByteArray();
            SendToPlayer(MiraConnectionMessageIds.fromEditorMiraSessionMsgId, sfem);
        }
Exemple #2
0
        void HandleEditorMessage(MessageEventArgs mea)
        {
            serializableFromEditorMessage sfem = mea.data.Deserialize <serializableFromEditorMessage>();

            if (sfem != null && sfem.subMessageId == SubMessageIds.editorInitARKit)
            {
                InitializeARKit(sfem.arkitConfigMsg);
            }
        }
Exemple #3
0
        void ReceiveJPEGFrame(serializableFromEditorMessage message)
        {
            // Only load the image if the textures are initialized
            if (!bTexturesInitialized)
            {
                return;
            }

            liveViewScreenTex.LoadImage(message.bytes);
        }
        void SendInitToPlayer()
        {
            serializableFromEditorMessage sfem = new serializableFromEditorMessage();

            sfem.subMessageId = SubMessageIds.editorInitARKit;
            serializableARSessionConfiguration ssc        = new serializableARSessionConfiguration(startAlignment, planeDetection, getPointCloud, enableLightEstimation, enableAutoFocus);
            UnityARSessionRunOption            roTracking = resetTracking ? UnityARSessionRunOption.ARSessionRunOptionResetTracking : 0;
            UnityARSessionRunOption            roAnchors  = removeExistingAnchors ? UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors : 0;

            sfem.arkitConfigMsg = new serializableARKitInit(ssc, roTracking | roAnchors);
            SendToPlayer(ConnectionMessageIds.fromEditorARKitSessionMsgId, sfem);
        }
        void SendInitToPlayer()
        {
            //we're going to reuse ARSessionConfiguration and only use its lightestimation field.
            serializableFromEditorMessage sfem = new serializableFromEditorMessage();

            sfem.subMessageId = SubMessageIds.editorInitARKitFaceTracking;
            serializableARSessionConfiguration ssc        = new serializableARSessionConfiguration(UnityARAlignment.UnityARAlignmentCamera, UnityARPlaneDetection.None, false, enableLightEstimation);
            UnityARSessionRunOption            roTracking = resetTracking ? UnityARSessionRunOption.ARSessionRunOptionResetTracking : 0;
            UnityARSessionRunOption            roAnchors  = removeExistingAnchors ? UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors : 0;

            sfem.arkitConfigMsg = new serializableARKitInit(ssc, roTracking | roAnchors);
            SendToPlayer(ConnectionMessageIds.fromEditorARKitSessionMsgId, sfem);
        }
Exemple #6
0
    private void SendInitToPlayer()
    {
        serializableFromEditorMessage sfem = new serializableFromEditorMessage();

        sfem.subMessageId = SubMessageIds.editorInitARKitFaceTracking;
        serializableARSessionConfiguration ssc        = new serializableARSessionConfiguration(UnityARAlignment.UnityARAlignmentCamera, UnityARPlaneDetection.None, false, EnableLightEstimation, true);
        UnityARSessionRunOption            roTracking = ResetTracking ? UnityARSessionRunOption.ARSessionRunOptionResetTracking : 0;
        UnityARSessionRunOption            roAnchors  = RemoveExistingAnchors ? UnityARSessionRunOption.ARSessionRunOptionRemoveExistingAnchors : 0;

        sfem.arkitConfigMsg = new serializableARKitInit(ssc, roTracking | roAnchors);
        SendToPlayer(ConnectionMessageIds.fromEditorARKitSessionMsgId, sfem);
        SaveData(_timeCount, 0, null, true);
        _isStart = true;
    }
        void HandleEditorMessage(MessageEventArgs mea)
        {
#if UNITY_IOS
            serializableFromEditorMessage sfem = mea.data.Deserialize <serializableFromEditorMessage>();
            if (sfem != null && sfem.subMessageId == SubMessageIds.editorInitARKit)
            {
                InitializeARKit(sfem.arkitConfigMsg);
            }
            else if (sfem != null && sfem.subMessageId == SubMessageIds.editorInitARKitFaceTracking)
            {
                InitializeARKitFaceTracking(sfem.arkitConfigMsg);
            }
#endif
        }
        void SendInitToPlayer()
        {
            serializableFromEditorMessage sfem = new serializableFromEditorMessage();

            sfem.subMessageId = MiraSubMessageIds.editorInitMiraRemote;
            // sfem.bytes = BitConverter.GetBytes(Mira.MiraArController.Instance.isRotationalOnly);
            sfem.bytes = new byte[] { Convert.ToByte(MiraArController.Instance.isRotationalOnly) };
            SendToPlayer(MiraConnectionMessageIds.fromEditorMiraSessionMsgId, sfem);

            bSessionActive = true;
            SetMiraControllerToVirtual();
            if (GyroController.Instance != null)
            {
                GyroController.Instance.MiraRemoteActive();
            }
        }
        void Update()
        {
            if (!bTexturesInitialized || screenWidth != Screen.width || screenHeight != Screen.height)
            {
                screenWidth  = Screen.width;
                screenHeight = Screen.height;

                if (_capturedTex)
                {
                    Destroy(_capturedTex);
                }

                _captureRect = new Rect(0, 0, screenWidth, screenHeight);

                // Create new texture
                _capturedTex = new Texture2D(
                    screenWidth, screenHeight,
                    TextureFormat.RGB24,
                    false,
                    QualitySettings.activeColorSpace == ColorSpace.Linear
                    );
                bTexturesInitialized = true;
            }

            if (Time.frameCount % m_captureInterval == 0)
            {
                bCapturingFrame = true;
            }
            //StartCoroutine("MiraRemotePostRender");
            if (bCapturedFrameAvailable && remoteConnection.SessionActive)
            {
                serializableFromEditorMessage sfem = new serializableFromEditorMessage();
                sfem.subMessageId = MiraSubMessageIds.screenCaptureJPEGMsgID;
                sfem.bytes        = _capturedTex.EncodeToJPG(m_jpegQuality);
                remoteConnection.SendToPlayer(MiraConnectionMessageIds.fromEditorMiraSessionMsgId, sfem);
                // Replace above with this for Unity 2017.3
                //remoteConnection.SendToPlayer(MiraConnectionMessageIds.screenCaptureJPEGMsgID, _capturedTex.EncodeToJPG(m_jpegQuality));

                bCapturedFrameAvailable = false;
            }
        }