Example #1
0
        public void StartRecognize(OnRecognizeSuccess succ, OnRecognizeFailed failed)
        {
            if (nibiruTensorManager != null)
            {
                AndroidJavaClass  unityHelperClass  = new AndroidJavaClass(unityHelperClassName);
                AndroidJavaObject unityHelperObject = unityHelperClass.CallStatic <AndroidJavaObject>("getInstance");
                if (unityHelperObject == null)
                {
                    Debug.LogError("StartRecognize failed , UnityHelper.getInstance is null !!!");
                    return;
                }
                int status = unityHelperObject.Call <int>("getStatus");
                if (status < 1)
                {
                    Debug.LogError("StartRecognize failed , Must be after UnityHelper create SurfaceTexture !!! " + status);
                    return;
                }

                AndroidJavaObject surfaceTextureObject = unityHelperObject.Call <AndroidJavaObject>("getSurfaceTexture");


                nibiruTensorManager.Call("start", surfaceTextureObject, new NibiruRecognizeCallback(this, succ, failed));
                stoped    = false;
                destroyed = false;

                NibiruService nibiruService = NxrViewer.Instance.GetNibiruService();
                if (nibiruService != null)
                {
                    nibiruService.SetCameraPreviewing(true);
                }
                Debug.Log("RecognizeApi start succ.");
            }
        }
Example #2
0
 // Use this for initialization
 void Start()
 {
     nibiruService = NxrViewer.Instance.GetNibiruService();
     if (nibiruService != null)
     {
         nibiruService.RegisterVirtualMouseService(OnServiceConnected);
     }
 }
Example #3
0
        // Use this for initialization
        void Start()
        {
            Debug.Log("Camera PreView Texture [" + PreTextureWidth + "," + PreTextureHeight + "]");
            nibiruService = NxrViewer.Instance.GetNibiruService();
            if (nibiruService != null)
            {
                cameraPreviewHelper = nibiruService.InitCameraPreviewHelper();
            }

            material       = GetComponent <Renderer>().material;
            defaultTexture = material.mainTexture;
        }
Example #4
0
 public void StopRecognize()
 {
     if (nibiruTensorManager != null)
     {
         stoped = true;
         nibiruTensorManager.Call("stop");
         NibiruService nibiruService = NxrViewer.Instance.GetNibiruService();
         if (nibiruService != null)
         {
             nibiruService.SetCameraPreviewing(false);
         }
     }
 }
Example #5
0
        // Use this for initialization
        void Start()
        {
            Debug.Log("Camera PreView Texture [" + PreTextureWidth + "," + PreTextureHeight + "]");
            nibiruService = NxrViewer.Instance.GetNibiruService();
            if (nibiruService != null)
            {
                cameraPreviewHelper = nibiruService.InitCameraPreviewHelper();
            }

            Renderer renderer = GetComponent <Renderer>();

            material       = renderer == null ? null : renderer.material;
            defaultTexture = material != null ? material.mainTexture : null;
#if UNITY_ANDROID
            InitTexture();
#endif
        }
Example #6
0
        // Use this for initialization
        void Start()
        {
            textMesh = GetComponent <TextMesh>();
            if (NxrViewer.Instance.ShowFPS)
            {
                mNibiruService = NxrViewer.Instance.GetNibiruService();
                if (mNibiruService != null)
                {
                    mNibiruService.SetEnableFPS(true);
                }
            }
            else
            {
                Debug.Log("Display FPS is disabled.");
            }

            Debug.Log("TrackerPosition=" + NxrViewer.Instance.TrackerPosition);
        }
Example #7
0
        // Use this for initialization
        void Start()
        {
            nibiruService = NxrViewer.Instance.GetNibiruService();
            mTransform    = gameObject.transform;

            origin = GameObject.Find("MarkerRoot");

            // Polaroid DTR
            bool dtrMode = NxrGlobal.supportDtr && NxrGlobal.distortionEnabled;

            if (dtrMode)
            {
                NxrViewer.Instance.SwitchControllerMode(false);
            }

            NxrGlobal.isMarkerVisible = false;

            if (nibiruService != null && AutoStartMarkerRecognize)
            {
                nibiruService.StartMarkerRecognize();
            }

            cameraPoseMat = new Matrix4x4();
        }
Example #8
0
        public override void Init()
        {
            // Start will send a log event, so SetUnityVersion first.
            byte[] version = System.Text.Encoding.UTF8.GetBytes(Application.unityVersion);
            if (NxrViewer.USE_DTR)
            {
                if (!NxrGlobal.nvrStarted)
                {
                    if (nibiruVRServiceId == 0)
                    {
                        // 初始化1次service
                        nibiruVRServiceId = CreateNibiruVRService();
                    }
                    _NVR_InitAPIs(NxrGlobal.useNvrSo);
                    _NVR_SetUnityVersion(version, version.Length);
                    _NVR_Start(nibiruVRServiceId);
                    SetDisplayQuality((int)NxrViewer.Instance.TextureQuality);
                    SetMultiThreadedRendering(SystemInfo.graphicsMultiThreaded);
                    Debug.LogError("graphicsMultiThreaded=" + SystemInfo.graphicsMultiThreaded);
                    //
                    if (NxrGlobal.soVersion >= 361)
                    {
                        ColorSpace colorSpace = QualitySettings.activeColorSpace;
                        if (colorSpace == ColorSpace.Gamma)
                        {
                            Debug.Log("Color Space - Gamma");
                            SetColorspaceType(0);
                        }
                        else if (colorSpace == ColorSpace.Linear)
                        {
                            Debug.Log("Color Space - Linear");
                            SetColorspaceType(1);
                        }
                    }
                    else
                    {
                        Debug.LogError("System Api Not Support ColorSpace!!!");
                    }

                    if (NxrGlobal.soVersion >= 365)
                    {
                        Debug.Log("Controller Support Mode - " + NxrViewer.Instance.controllerSupportMode.ToString());
                        SetControllerSupportMode(NxrViewer.Instance.controllerSupportMode);
                    }
                    NxrGlobal.nvrStarted = true;
                    // 初始化服务
                    NibiruService nibiruService = new NibiruService();
                    nibiruService.Init();
                    NxrGlobal.nibiruService = nibiruService;

                    //
                    NxrSDKApi.Instance.IsSptEyeLocalRp = IsSptEyeLocalRotPos();
                    if (NxrSDKApi.Instance.IsSptEyeLocalRp)
                    {
                        _NVR_GetEyeLocalRotPos(NxrSDKApi.Instance.LeftEyeLocalRotation,
                                               NxrSDKApi.Instance.LeftEyeLocalPosition, NxrSDKApi.Instance.RightEyeLocalRotation,
                                               NxrSDKApi.Instance.RightEyeLocalPosition);
                    }
                }
            }
            Debug.Log("NxrDevice->Init.isSptEyeLocalRp=" + NxrSDKApi.Instance.IsSptEyeLocalRp);
        }
Example #9
0
 // Use this for initialization
 void Start()
 {
     nibiruService  = NxrViewer.Instance.GetNibiruService();
     cam            = this.gameObject.GetComponent <Camera>();
     cacheTransform = transform;
 }