public bool Release() { var result = NativeApi.NRRGBCameraDestroy(m_NativeCameraHandle); NRDebug.Log("[NativeCamera] Release: " + result.ToString()); return(result == NativeResult.Success); }
public bool Create() { var result = NativeApi.NRRGBCameraCreate(ref m_NativeCameraHandle); NRDebug.Log("[NativeCamera] Create: " + result.ToString()); return(result == NativeResult.Success); }
public bool SetCaptureCallback(NRRGBCameraImageCallback callback) { var result = NativeApi.NRRGBCameraSetCaptureCallback(m_NativeCameraHandle, callback); NRDebug.Log("[NativeCamera] SetCaptureCallback: " + result.ToString()); return(result == NativeResult.Success); }
public bool Destroy() { NativeResult result = NativeApi.NRTrackingDestroy(m_TrackingHandle); NRDebug.Log("[NativeSession Destroy :]" + result.ToString()); return(result == NativeResult.Success); }
public bool SetTrackingMode(TrackingMode mode) { NativeResult result = NativeApi.NRTrackingInitSetTrackingMode(m_TrackingHandle, mode); NRDebug.Log("[NativeSession SetTrackingMode :]" + mode.ToString() + " result:" + result.ToString()); return(result == NativeResult.Success); }
public bool Resume() { NativeResult result = NativeApi.NRTrackingResume(m_TrackingHandle); NRDebug.Log("[NativeSession Resume :]" + result.ToString()); return(result == NativeResult.Success); }
public bool Init() { NRDebug.Log("NativeController start init:"); NativeResult result = NativeApi.NRControllerCreate(ref m_ControllerHandle); if (result == NativeResult.Success) { //manually start controller NativeApi.NRControllerStart(m_ControllerHandle); int count = GetControllerCount(); NRDebug.Log("__controller count:" + count); for (int i = 0; i < count; i++) { result = NativeApi.NRControllerStateCreate(m_ControllerHandle, i, ref m_StateHandles[i]); if (result != NativeResult.Success) { Debug.LogError("Controller State Create Failed!" + result.ToString()); return(false); } } NRDebug.Log("Native Controller Created Sucessed"); return(true); } NRDebug.Log("Native Controller Create Failed!"); return(false); }
public bool StopCapture() { var result = NativeApi.NRRGBCameraStopCapture(m_NativeCameraHandle); NRDebug.Log("[NativeCamera] StopCapture: " + result.ToString()); return(result == NativeResult.Success); }
public bool Create() { NativeResult result = NativeApi.NRHMDCreate(ref m_HmdHandle); NRDebug.Log("[NativeHMD Create]:" + result.ToString()); return(result == NativeResult.Success); }
public bool Create() { var result = NativeApi.NRHeadTrackingCreate(m_NativeInterface.TrackingHandle, ref headTrackingHandle); NRDebug.Log("[NativeHeadTracking Create :]" + result.ToString()); return(result == NativeResult.Success); }
public bool SetImageFormat(CameraImageFormat format) { var result = NativeApi.NRRGBCameraSetImageFormat(m_NativeCameraHandle, format); NRDebug.Log("[NativeCamera] SetImageFormat: " + result.ToString()); return(result == NativeResult.Success); }
public bool Create() { NativeResult result = NativeApi.NRTrackingCreate(ref m_TrackingHandle); NRDebug.Log("[NativeSession Create :]" + result.ToString()); m_NativeInterface.TrackingHandle = m_TrackingHandle; return(result == NativeResult.Success); }
public NativeResolution GetResolution(UInt64 imageHandle) { NativeResolution resolution = new NativeResolution(1280, 720); var result = NativeApi.NRRGBCameraImageGetResolution(m_NativeCameraHandle, imageHandle, ref resolution); NRDebug.Log("[NativeCamera] GetResolution: " + result.ToString()); return(resolution); }
void Awake() { #if !UNITY_EDITOR NRDebug.EnableLog = Debug.isDebugBuild; #endif NRDebug.Log("[SessionBehaviour Awake: CreateSession]"); NRSessionManager.Instance.CreateSession(this); }
public NativeResolution GetEyeResolution(NativeEye eye = NativeEye.LEFT) { NativeResolution resolution = new NativeResolution(3840, 1080); NativeApi.NRHMDGetEyeResolution(m_HmdHandle, (int)NativeEye.LEFT, ref resolution); NRDebug.Log("[NativeHMD GetEyeResolution]:" + resolution.ToString()); return(resolution); }
private void FirstFramReady() { Texture = new Texture2D(Resolution.width, Resolution.height, GetFormatByCamraImageFormat(ImageFormat), false); NRDebug.Log("[NRCameraCapture] FirstFramReady : " + Resolution.ToString()); if (OnFirstFrameReady != null) { OnFirstFrameReady(); } }
/** * @brief Release the rgb camera. */ public static void Release() { if (m_NativeCamera != null) { NRDebug.Log("[NRRgbCamera] Start to Release"); #if !UNITY_EDITOR m_NativeCamera.Release(); #endif CurrentState = CaptureState.UnInitialized; } }
public static void SetImageFormat(CameraImageFormat format) { if (CurrentState == CaptureState.UnInitialized) { Initialize(); } #if !UNITY_EDITOR m_NativeCamera.SetImageFormat(format); #endif ImageFormat = format; NRDebug.Log("[NRRgbCamera] SetImageFormat : " + format.ToString()); }
void CreateRenderTextures() { var resolution = NRDevice.Instance.NativeHMD.GetEyeResolution(); NRDebug.Log("[CreateRenderTextures] resolution :" + resolution.ToString()); for (int i = 0; i < EyeTextureCount; i++) { eyeTextures[i] = GenRenderTexture(resolution.width, resolution.height); m_RTDict.Add(eyeTextures[i], eyeTextures[i].GetNativeTexturePtr()); } }
/** * @brief Stop the rgb camera. */ public static void Stop() { if (CurrentState != CaptureState.Running) { StateError(string.Format("Can not stop in state:{0}", CurrentState)); return; } NRDebug.Log("[NRRgbCamera] Start to Stop"); #if !UNITY_EDITOR m_NativeCamera.StopCapture(); #endif CurrentState = CaptureState.Stopped; }
private void InitNativeController() { m_NativeController = new NativeController(); if (m_NativeController.Init()) { Inited = true; NRDebug.Log("NRControllerProvider Init Succeed"); } else { m_NativeController = null; Debug.LogError("NRControllerProvider Init Failed !!"); } m_NeedInit = false; }
/// @endcond public static void Initialize() { if (CurrentState != CaptureState.UnInitialized) { return; } NRDebug.Log("[NRRgbCamera] Initialize"); m_NativeCamera = new NativeCamera(); #if !UNITY_EDITOR m_NativeCamera.Create(); m_NativeCamera.SetCaptureCallback(Capture); #endif CurrentState = CaptureState.Initialized; }
/** * @brief Start to play rgb camera. */ public static void Play() { if (CurrentState == CaptureState.UnInitialized) { Initialize(); } if (CurrentState == CaptureState.UnInitialized || CurrentState == CaptureState.Running) { StateError(string.Format("Can not start in state:{0}", CurrentState)); return; } NRDebug.Log("[NRRgbCamera] Start to play"); #if !UNITY_EDITOR m_NativeCamera.StartCapture(); #endif CurrentState = CaptureState.Running; }
private void DeployData() { if (SessionBehaviour.SessionConfig == null) { return; } var database = SessionBehaviour.SessionConfig.TrackingImageDatabase; if (database == null) { NRDebug.Log("augmented image data base is null!"); return; } string deploy_path = database.TrackingImageDataOutPutPath; NRDebug.Log("[TrackingImageDatabase] DeployData to path :" + deploy_path); if (Directory.Exists(database.TrackingImageDataPath)) { NRDebug.Log("augmented image data is exit!"); return; } ZipUtility.UnzipFile(database.RawData, deploy_path, NativeConstants.ZipKey); }
void OnDisable() { NRDebug.Log("[SessionBehaviour OnDisable: DisableSession]"); NRSessionManager.Instance.DisableSession(); }
void LateUpdate() { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { UpdateControllerRotateByInput(); } if (Input.GetMouseButtonDown(0)) { SetConfirmButton(true); ImageConfirm.SetActive(true); } if (Input.GetMouseButtonUp(0)) { SetConfirmButton(false); ImageConfirm.SetActive(false); } if (Input.GetMouseButtonDown(2)) { SetAppButton(true); ImageApp.SetActive(true); } if (Input.GetMouseButtonUp(2)) { SetAppButton(false); ImageApp.SetActive(false); } if (Input.GetMouseButtonDown(1)) { SetHomeButton(true); ImageHome.SetActive(true); } if (Input.GetMouseButtonUp(1)) { SetHomeButton(false); ImageHome.SetActive(false); } if (m_TouchAction != TouchActionState.Idle) { UpdateTouchAction(); } else { if (Input.GetKeyDown(KeyCode.LeftArrow)) { ImageLeft.SetActive(true); m_TouchAction = TouchActionState.Left; } else if (Input.GetKeyDown(KeyCode.RightArrow)) { ImageRight.SetActive(true); m_TouchAction = TouchActionState.Right; } else if (Input.GetKeyDown(KeyCode.UpArrow)) { ImageUp.SetActive(true); m_TouchAction = TouchActionState.Up; } else if (Input.GetKeyDown(KeyCode.DownArrow)) { ImageDown.SetActive(true); m_TouchAction = TouchActionState.Down; } else if (Input.GetKeyUp(KeyCode.DownArrow) | Input.GetKeyUp(KeyCode.UpArrow) | Input.GetKeyUp(KeyCode.RightArrow) | Input.GetKeyUp(KeyCode.LeftArrow)) { NREmulatorManager.Instance.NativeEmulatorApi.SetControllerIsTouching(false); } } NREmulatorManager.Instance.NativeEmulatorApi.SetControllerSubmit(); if (NRInput.GetButtonDown(ControllerButton.TRIGGER)) { NRDebug.Log("Click down Trigger button !!!"); } else if (NRInput.GetButtonDown(ControllerButton.APP)) { NRDebug.Log("Click down App button !!!"); } else if (NRInput.GetButtonDown(ControllerButton.HOME)) { NRDebug.Log("Click down Home button !!!"); } }
public void UpdateConfig(NRSessionConfig config) { if (m_ConfigHandle == 0) { m_ConfigHandle = this.Create(); } if (m_ConfigHandle == 0) { NRDebug.LogError("Faild to Create ARSessionConfig!!!"); return; } var plane_find_mode = this.GetPlaneFindMode(m_ConfigHandle); if (plane_find_mode != config.PlaneFindingMode) { SetPlaneFindMode(m_ConfigHandle, config.PlaneFindingMode); } if (config.ImageTrackingMode != m_ImageTrackingMode) { //Trackable Image switch (config.ImageTrackingMode) { case TrackableImageFindingMode.DISABLE: if (m_DatabaseHandle != 0) { m_NativeTrackableImage.DestroyDataBase(m_DatabaseHandle); m_DatabaseHandle = 0; } else { var result = SetTrackableImageDataBase(m_ConfigHandle, 0); NRDebug.Log("[Disable trackable image] result : " + result); } break; case TrackableImageFindingMode.ENABLE: if (m_DatabaseHandle == 0) { if (config.TrackingImageDatabase != null) { m_DatabaseHandle = m_NativeTrackableImage.CreateDataBase(); bool result = m_NativeTrackableImage.LoadDataBase(m_DatabaseHandle, config.TrackingImageDatabase.TrackingImageDataPath); NRDebug.Log("[LoadDataBase] result : " + result); result = SetTrackableImageDataBase(m_ConfigHandle, m_DatabaseHandle); NRDebug.Log("[SetTrackableImageDataBase] result : " + result); } else { var result = SetTrackableImageDataBase(m_ConfigHandle, 0); NRDebug.Log("[Disable trackable image] result : " + result); } } break; default: break; } m_ImageTrackingMode = config.ImageTrackingMode; } }
void OnDestroy() { NRDebug.Log("[SessionBehaviour OnDestroy DestroySession]"); NRSessionManager.Instance.DestroySession(); }
void Start() { NRDebug.Log("[SessionBehaviour DelayStart: StartSession]"); NRSessionManager.Instance.StartSession(); NRSessionManager.Instance.SetConfiguration(SessionConfig); }
/// <summary> /// only worked at 3dof mode /// </summary> public void Recenter() { var result = NativeApi.NRTrackingRecenter(m_TrackingHandle); NRDebug.Log("[NativeSession Recenter] :" + result.ToString()); }