Exemplo n.º 1
0
        // Use this for initialization
        void Start()
        {
            ARSubsystemManager.subsystemFilter = m_subsystemFilter;

            IPAddressText.text = GetLocalIPAddress();

            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            dataReceiver = new DataReceiver(screenStreamer, null);

            dataReceiver.HelloMessageCallback = (legacyPath) =>
            {
                isLegacyPath = legacyPath;
                isConnected  = true;

                if (remotePath == null)
                {
                    didStart = false;

                    if (isLegacyPath)
                    {
                        remotePath = new LegacyRemotePath();
                    }
                    else
                    {
                        remotePath = new ARRemotePath(dataReceiver);
                        (remotePath as ARRemotePath).SetCamera(arCamera);
                        (remotePath as ARRemotePath).SetSyncFrame(syncedFrame);
                    }
                }
            };

            // Create legacy direct connection provider
            connectionProvider = new DirectConnectionProvider();
            ((DirectConnectionProvider)connectionProvider).hasNoDelay = true;

            connectionProvider.OnDisconnected   += ConnectionProvider_OnDisconnected;
            connectionProvider.OnDataReceived   += ConnectionProvider_OnDataReceived;
            connectionProvider.OnStreamReceived += ConnectionProvider_OnStreamReceived;

            connectionProvider.Initialize();
            connectionProvider.StartListening();

            // register the callback when enabling object
            Camera.onPreRender  += MyPreRender;
            Camera.onPostRender += MyPostRender;

            Client = new UdpClient(AddressFamily.InterNetwork);

#if ENABLE_BROADCAST
            StartCoroutine(BroadcastIPAddress());
#endif
        }
Exemplo n.º 2
0
        public void Start(IConnectionProvider standardConnectionProvider, ScreenStream screen)
        {
#if XRREMOTING_USE_NEW_INPUT_SYSTEM
            InputSystem.onEvent += InputSystem_onEvent;
#endif

            dataSender               = new DataSender();
            pointsDataSender         = new DataSender();
            separateThreadDataSender = new DataSender();

            screenStreamer = screen;

            connectionProvider = standardConnectionProvider;

            arCamera.targetTexture = new RenderTexture(arCamera.pixelWidth, arCamera.pixelHeight, 16, RenderTextureFormat.ARGB32);

            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            depthPoints = new List <Vector3>();

            webCamStreamer        = new WebCamStreamer();
            streamingDataReceiver = new DataReceiver(screenStreamer, webCamStreamer);
            defferedCallsReceived = new DataReceiver(screenStreamer, webCamStreamer);

            streamingDataReceiver.handleScreenStream = () =>
            {
                pendingTexAssign = true;
            };

            globalReceived.OnARRemoteSettingsReceived += OnArRemoteSettingsReceived;

            connectionProviderDefferredCalls            = new DirectConnectionProvider();
            connectionProviderDefferredCalls.hasNoDelay = true;
            connectionProviderDefferredCalls.SetRemotePort(7203);

            connectionProviderAR = new DirectConnectionProvider();
            ((DirectConnectionProvider)connectionProviderAR).hasNoDelay = true;
            connectionProviderAR.SetRemotePort(7202);

            connectionProviderAR.OnConnected      += ConnectionProviderAR_OnConnected;
            connectionProviderAR.OnDisconnected   += ConnectionProviderar_OnDisconnected;
            connectionProviderAR.OnDataReceived   += ConnectionProviderar_OnDataReceived;
            connectionProviderAR.OnStreamReceived += ConnectionProviderar_OnStreamReceived;

            connectionProviderDefferredCalls.OnStreamReceived += ConnectionProviderSeparateThread_OnStreamReceived;

            connectionProviderAR.Initialize();
            connectionProviderAR.StartListening();

            connectionProviderDefferredCalls.Initialize();
            connectionProviderDefferredCalls.StartListening();
        }
Exemplo n.º 3
0
 public ARRemotePath(DataReceiver receiver)
 {
     globalReceived = receiver;
 }