public void initAR() { if (state == State.NOTHING_INITIALISED) { var ret = ARUWP.aruwpInitialiseAR(frameWidth, frameHeight, pixelFormat); if (ret) { state = State.BASE_INITIALISED; } else { Debug.Log(TAG + ": initAR() failed"); } } else { Debug.Log(TAG + ": initAR() fails unless current status is NOTHING_INITIALISED"); } }
/// <summary> /// The heavy function of initialize the controller, that will be wrapped into a task that /// can be executed asynchronously. In this function, log callback will be set; native /// controller will be initialized, markers will be added, tracking options will be set, /// and ARUWPController status will be changed from ARUWP_STATUS_VIDEO_INITIALIZED to /// ARUWP_STATUS_CTRL_INITIALIZED if successful. [internal use] /// </summary> /// <returns>Whether initialization is successful</returns> private bool InitializeControllerAsyncTaskFunc() { if (status != ARUWP.ARUWP_STATUS_VIDEO_INITIALIZED) { Debug.Log(TAG + ": InitializeControllerAsyncTaskFunc() unsupported status"); return(false); } ARUWP.aruwpRegisterLogCallbackWrapper(ARUWP.Log); ARUWP.aruwpSetLogLevel((int)(AR_LOG_LEVEL.AR_LOG_LEVEL_INFO)); var ret = ARUWP.aruwpInitialiseAR(frameWidth, frameHeight, ARUWP.AR_PIXEL_FORMAT_RGBA); if (!ret) { Debug.Log(TAG + ": aruwpInitialiseAR() failed"); return(false); } foreach (var m in unaddedMarkers) { m.AddMarker(); m.LogMarkerInformation(); } if (useCameraParamFile) { ret = ARUWP.aruwpStartRunning("Data/StreamingAssets/" + cameraParam); } else { if (cameraParamBuffer != null) { ret = ARUWP.aruwpStartRunningBuffer(cameraParamBuffer, cameraParamBuffer.Length); } else { Debug.Log(TAG + ": cameraParamBuffer is null"); return(false); } } if (!ret) { Debug.Log(TAG + ": startRunning() fails"); return(false); } // Set default tracking options SetVideoThreshold(threshold); SetVideoThresholdMode(thresholdMode); SetLabelingMode(labelingMode); SetPatternDetectionMode(patternDetectionMode); SetBorderSize(borderSize); SetMatrixCodeType(matrixCodeType); SetImageProcMode(imageProcMode); LogVersionString(); LogFrameInforamtion(); status = ARUWP.ARUWP_STATUS_CTRL_INITIALIZED; Debug.Log(TAG + ": InitializeControllerAsyncTaskFunc() is successful"); return(true); }