public bool Pause() { NativeResult result = NativeApi.NRHMDPause(m_HmdHandle); NativeErrorListener.Check(result, this, "Pause"); return(result == NativeResult.Success); }
public bool Destroy() { Marshal.FreeHGlobal(FrameInfoPtr); NativeResult result = NativeApi.NRRenderingDestroy(m_RenderingHandle); return(result == NativeResult.Success); }
public bool Create() { NativeResult result = NativeApi.NRHMDCreate(ref m_HmdHandle); NativeErrorListener.Check(result, this, "Create"); return(result == NativeResult.Success); }
/// <summary> Sets controller accelerometer. </summary> /// <param name="accel"> The accel.</param> /// <returns> True if it succeeds, false if it fails. </returns> public bool SetControllerAccelerometer(Vector3 accel) { NativeVector3f nv3 = new NativeVector3f(accel); NativeResult result = NativeApi.NRSIMControllerSetAccelerometer(m_ControllerHandle, ref nv3); return(result == NativeResult.Success); }
/// <summary> Sets controller touch point. </summary> /// <param name="x"> The x coordinate.</param> /// <param name="y"> The y coordinate.</param> /// <returns> True if it succeeds, false if it fails. </returns> public bool SetControllerTouchPoint(float x, float y) { NativeVector3f nv3 = new NativeVector3f(new Vector3(x, y, 0f)); NativeResult result = NativeApi.NRSIMControllerSetTouchPoint(m_ControllerHandle, ref nv3); return(result == NativeResult.Success); }
/// <summary> Sets controller position. </summary> /// <param name="postion"> The postion.</param> /// <returns> True if it succeeds, false if it fails. </returns> public bool SetControllerPosition(Vector3 postion) { NativeVector3f nv3 = new NativeVector3f(postion); NativeResult result = NativeApi.NRSIMControllerSetPosition(m_ControllerHandle, ref nv3); return(result == NativeResult.Success); }
/// <summary> Sets controller rotation. </summary> /// <param name="quaternion"> The quaternion.</param> /// <returns> True if it succeeds, false if it fails. </returns> public bool SetControllerRotation(Quaternion quaternion) { NativeVector4f nv4 = new NativeVector4f(new Vector4(quaternion.x, quaternion.y, -quaternion.z, -quaternion.w)); NativeResult result = NativeApi.NRSIMControllerSetRotation(m_ControllerHandle, ref nv4); return(result == NativeResult.Success); }
public bool Create() { NativeResult result = NativeApi.NRHMDCreate(ref m_HmdHandle); NRDebugger.Log("[NativeHMD Create]:" + 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 override IDataValue Evaluate(string expression, DataParams paramsValue) { NativeParam[] localParamsValue = NativeMarshal.DataParamsToNativeParams(ServerProcess, paramsValue); NativeResult result = _nativeCLISession.Execute(expression, localParamsValue); NativeMarshal.SetDataOutputParams(ServerProcess, paramsValue, result.Params); return(NativeMarshal.NativeValueToDataValue(ServerProcess, result.Value)); }
public bool Destroy() { Marshal.FreeHGlobal(FrameInfoPtr); NativeResult result = NativeApi.NRRenderingDestroy(m_RenderingHandle); NativeErrorListener.Check(result, this, "Destroy"); return(result == NativeResult.Success); }
public bool Create() { NativeResult result = NativeApi.NRTrackingCreate(ref m_TrackingHandle); NativeErrorListener.Check(result, this, "Create"); m_NativeInterface.TrackingHandle = m_TrackingHandle; return(result == NativeResult.Success); }
public void InitColorSpace() { NativeColorSpace colorspace = QualitySettings.activeColorSpace == ColorSpace.Gamma ? NativeColorSpace.COLOR_SPACE_GAMMA : NativeColorSpace.COLOR_SPACE_LINEAR; NativeResult result = NativeApi.NRDisplayInitSetTextureColorSpace(m_MultiDisplayHandle, colorspace); NativeErrorListener.Check(result, this, "InitColorSpace"); }
public bool SetHeadTrackingPose(Vector3 position, Quaternion rotation) { NativeVector3f nativeVector3F = new NativeVector3f(new Vector3(position.x, position.y, -position.z)); NativeVector4f nativeVector4F = new NativeVector4f(new Vector4(rotation.x, rotation.y, -rotation.z, -rotation.w)); NativeResult result = NativeApi.NRSIMTrackingSetHeadTrackingPose(m_TrackingHandle, ref nativeVector3F, ref nativeVector4F); return(result == NativeResult.Success); }
public bool UpdateTrackablePlaneData(Vector3 centerPos, Quaternion centerQua, float extentX, float extentZ, UInt32 identifier, TrackingState state) { NativeVector3f pos = new NativeVector3f(new Vector3(centerPos.x, centerPos.y, -centerPos.z)); NativeVector4f qua = new NativeVector4f(new Vector4(-centerQua.x, -centerQua.y, centerQua.z, centerQua.w)); NativeResult result = NativeApi.NRSIMTrackingUpdateTrackablePlaneData(m_TrackingHandle, ref pos, ref qua, extentX, extentZ, identifier, (int)state); return(result == NativeResult.Success); }
public bool Create() { NativeResult result = NativeApi.NRTrackingCreate(ref m_TrackingHandle); NRDebugger.Log("[NativeSession Create :]" + result.ToString()); m_NativeInterface.TrackingHandle = m_TrackingHandle; return(result == NativeResult.Success); }
public GlassesTemperatureLevel GetTempratureLevel() { GlassesTemperatureLevel level = GlassesTemperatureLevel.TEMPERATURE_LEVEL_NORMAL; NativeResult result = NativeApi.NRGlassesControlGetTemperatureLevel(m_GlassesControllerHandle, ref level); NativeErrorListener.Check(result, this, "GetTempratureLevel"); return(level); }
public bool Resume() { if (m_TrackingHandle == 0) { return false; } NativeResult result = NativeApi.NRTrackingResume(m_TrackingHandle); NativeErrorListener.Check(result, this, "Resume"); return result == NativeResult.Success; }
public bool SetTrackingMode(TrackingMode mode) { if (m_TrackingHandle == 0) { return false; } NativeResult result = NativeApi.NRTrackingInitSetTrackingMode(m_TrackingHandle, mode); NativeErrorListener.Check(result, this, "SetTrackingMode"); return result == NativeResult.Success; }
public Vector2 GetTouch(int controllerIndex) { NativeVector2f touchPos = new NativeVector2f(); NativeResult result = NativeApi.NRControllerStateGetTouchPose(m_StateHandles[controllerIndex], ref touchPos); if (result == NativeResult.Success) { return(touchPos.ToUnityVector2()); } return(Vector3.zero); }
public bool Pause() { if (m_TrackingHandle == 0) { return(false); } NativeResult result = NativeApi.NRTrackingPause(m_TrackingHandle); NativeErrorListener.Check(result, this, "Pause"); return(result == NativeResult.Success); }
public bool GetProjectionMatrix(ref Matrix4x4 outLeftProjectionMatrix, ref Matrix4x4 outRightProjectionMatrix) { NativeMat4f projectmatrix = new NativeMat4f(Matrix4x4.identity); NativeResult result_left = NativeApi.NRInternalGetProjectionMatrix((int)NativeEye.LEFT, ref projectmatrix); outLeftProjectionMatrix = projectmatrix.ToUnityMat4f(); NativeResult result_right = NativeApi.NRInternalGetProjectionMatrix((int)NativeEye.RIGHT, ref projectmatrix); outRightProjectionMatrix = projectmatrix.ToUnityMat4f(); return(result_left == NativeResult.Success && result_right == NativeResult.Success); }
public override Schema.TableVar PrepareTableVar(Plan plan, string expression, DataParams paramsValue) { NativeParam[] localParamsValue = NativeMarshal.DataParamsToNativeParams(ServerProcess, paramsValue); NativeResult result = _nativeCLISession.Execute(expression, localParamsValue, NativeExecutionOptions.SchemaOnly); if (result.Value is NativeTableValue) { return(NativeMarshal.NativeTableToTableVar(plan, (NativeTableValue)result.Value)); } throw new CompilerException(CompilerException.Codes.TableExpressionExpected); }
public Vector3 GetMag(int controllerIndex) { NativeVector3f vec3f = new NativeVector3f(); NativeResult result = NativeApi.NRControllerStateGetMag(m_StateHandles[controllerIndex], ref vec3f); if (result == NativeResult.Success) { return(vec3f.ToUnityVector3()); } return(Vector3.zero); }
public Pose GetPose(int controllerIndex) { Pose controllerPos = Pose.identity; NativeMat4f mat4f = new NativeMat4f(Matrix4x4.identity); NativeResult result = NativeApi.NRControllerStateGetPose(m_StateHandles[controllerIndex], ref mat4f); if (result == NativeResult.Success) { ConversionUtility.ApiPoseToUnityPose(mat4f, out controllerPos); } return(controllerPos); }
public Pose GetEyePoseFromHead(NativeEye eye) { Pose outEyePoseFromHead = Pose.identity; NativeMat4f mat4f = new NativeMat4f(Matrix4x4.identity); NativeResult result = NativeApi.NRHMDGetEyePoseFromHead(m_HmdHandle, (int)eye, ref mat4f); if (result == NativeResult.Success) { ConversionUtility.ApiPoseToUnityPose(mat4f, out outEyePoseFromHead); } return(outEyePoseFromHead); }
public bool Destroy() { if (m_TrackingHandle == 0) { return false; } NativeResult result = NativeApi.NRTrackingDestroy(m_TrackingHandle); NativeErrorListener.Check(result, this, "Destroy"); m_TrackingHandle = 0; m_NativeInterface.TrackingHandle = m_TrackingHandle; return result == NativeResult.Success; }
internal static void Check(NativeResult result, object module, string funcName = "", bool needthrowerror = false) { if (result == NativeResult.Success) { return; } string module_tag = string.Format("[{0}] {1}: ", module.GetType().Name, funcName); if (needthrowerror) { try { switch (result) { case NativeResult.Failure: throw new NRKernalError(module_tag + "Failed!"); case NativeResult.InvalidArgument: throw new NRInvalidArgumentError(module_tag + "InvalidArgument error!"); case NativeResult.NotEnoughMemory: throw new NRNotEnoughMemoryError(module_tag + "NotEnoughMemory error!"); case NativeResult.UnSupported: throw new NRUnSupportedError(module_tag + "UnSupported error!"); case NativeResult.GlassesDisconnect: throw new NRGlassesConnectError(module_tag + "Glasses connect error!"); case NativeResult.SdkVersionMismatch: throw new NRSdkVersionMismatchError(module_tag + "SDK version mismatch error!"); case NativeResult.SdcardPermissionDeny: throw new NRSdcardPermissionDenyError(module_tag + "Sdcard permission deny error!"); default: break; } } catch (System.Exception e) { NRSessionManager.Instance.OprateInitException(e); throw; } } else { Debug.LogError(module_tag + result.ToString()); } }
public bool GetProjectionMatrix(ref EyeProjectMatrixData outEyesProjectionMatrix, float znear, float zfar) { NativeFov4f fov = new NativeFov4f(); NativeResult result_left = NativeApi.NRHMDGetEyeFov(m_HmdHandle, (int)NativeEye.LEFT, ref fov); outEyesProjectionMatrix.LEyeMatrix = ConversionUtility.GetProjectionMatrixFromFov(fov, znear, zfar).ToUnityMat4f(); NativeResult result_right = NativeApi.NRHMDGetEyeFov(m_HmdHandle, (int)NativeEye.RIGHT, ref fov); outEyesProjectionMatrix.REyeMatrix = ConversionUtility.GetProjectionMatrixFromFov(fov, znear, zfar).ToUnityMat4f(); NativeResult result_RGB = NativeApi.NRHMDGetEyeFov(m_HmdHandle, (int)NativeEye.RGB, ref fov); outEyesProjectionMatrix.RGBEyeMatrix = ConversionUtility.GetProjectionMatrixFromFov(fov, znear, zfar).ToUnityMat4f(); return(result_left == NativeResult.Success && result_right == NativeResult.Success && result_RGB == NativeResult.Success); }
public bool UpdateState(int controllerIndex) { if (m_StateHandles[controllerIndex] == 0) { NativeApi.NRControllerStateCreate(m_ControllerHandle, controllerIndex, ref m_StateHandles[controllerIndex]); } if (m_StateHandles[controllerIndex] == 0) { return(false); } NativeResult result = NativeApi.NRControllerStateUpdate(m_StateHandles[controllerIndex]); return(result == NativeResult.Success); }