コード例 #1
0
        public void SetPlayerAspect(XrRemoteApp.Reader remote)
        {
#if UNITY_EDITOR
            // When the client keeps running and the server restarts, remote.hasDevice() is false
            XRRemoteUtils.SetGameViewAspectRatio(remote);
#endif
        }
コード例 #2
0
        public void SendDeviceInfo(XrRemoteApp.Reader remote)
        {
#if UNITY_EDITOR
            if (remote_.IsConnected())
            {
                BufferForSend(remote);
            }
#endif
        }
コード例 #3
0
            public static void SetGameViewAspectRatio(XrRemoteApp.Reader remote)
            {
                int width  = remote.getDevice().getScreenWidth();
                int height = remote.getDevice().getScreenHeight();

                if (width == 0 || height == 0)
                {
                    return;
                }

                GameViewSizeGroupType buildPlatform = GetGameViewSizeGroupType();
                string name = "XR Remote";

                if (!SizeExists(buildPlatform, width, height))
                {
                    AddCustomSize(GameViewSizeType.AspectRatio, buildPlatform, width, height, name);
                }

                SetSize(FindSize(buildPlatform, width, height));
            }
コード例 #4
0
        private void BufferForSend(XrRemoteApp.Reader remote)
        {
            // Unity processes screen width 1440 @ 7fps, 770 @ 15fps, 360 @ 20fps
            remote_.SetDeviceInfo(
                remote.getDevice().getScreenWidth(),
                remote.getDevice().getScreenHeight(),
                (int)ToDeviceOrientation(remote.getDevice().getOrientation()));

            foreach (var t in remote.getTouches())
            {
                XRInternalRemote.XrInternalRemoteData.Touch touch =
                    new XRInternalRemote.XrInternalRemoteData.Touch();
                touch.positionX  = t.getPositionX();
                touch.positionY  = t.getPositionY();
                touch.frameCount = t.getTimestamp();
                touch.fingerId   = t.getFingerId();
                touch.phase      = (int)ToTouchPhase(t.getPhase());
                touch.tapCount   = t.getTapCount();
                remote_.AddTouch(touch);
            }
        }
コード例 #5
0
        public void Create(int renderingSystem)
        {
            running = false;

            xrAppEnvironment = new MessageBuilder();
            xrAppEnvironment.initRoot(XRConfiguration.factory);

            var xrBuilder = new MessageBuilder().initRoot(RealityResponse.factory);

            xrBuilder.getEventId().setEventTimeMicros(600000000000);
            xrBuilder.getXRResponse().getCamera().getExtrinsic().getRotation().setW(1.0f);
            xrBuilder.getXRResponse().getCamera().getIntrinsic().initMatrix44f(16);
            xrBuilder.getXRResponse().getCamera().getIntrinsic().getMatrix44f().set(0, 2.92424f);
            xrBuilder.getXRResponse().getCamera().getIntrinsic().getMatrix44f().set(5, 1.64488f);
            xrBuilder.getXRResponse().getCamera().getIntrinsic().getMatrix44f().set(9, 0.0015625f);
            xrBuilder.getXRResponse().getCamera().getIntrinsic().getMatrix44f().set(10, -1.0006f);
            xrBuilder.getXRResponse().getCamera().getIntrinsic().getMatrix44f().set(11, -1.0f);
            xrBuilder.getXRResponse().getCamera().getIntrinsic().getMatrix44f().set(14, -0.60018f);

            xrResponse = xrBuilder.asReader();
            xrRemote   = new MessageBuilder().initRoot(XrRemoteApp.factory).asReader();
            XRCreate(renderingSystem);
        }