Example #1
0
        public void UpdateNDKConfigWithUnityConfig(IntPtr configHandle, ARConfigBase arConfig)
        {
            NDKAPI.HwArConfig_setArType(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetARType());
            NDKAPI.HwArConfig_setCameraLensFacing(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetCameraLensFacing());
            NDKAPI.HwArConfig_setLightEstimationMode(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetLightingMode());
            NDKAPI.HwArConfig_setPlaneFindingMode(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetPlaneFindingMode());
            NDKAPI.HwArConfig_setUpdateMode(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetUpdateMode());
            NDKAPI.HwArConfig_setImageInputMode(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetImageInputMode());

            //this interface only support by HUAWEI_AR_ENGINE
            if (AREnginesSelector.Instance.GetCreatedEngine() == AREnginesType.HUAWEI_AR_ENGINE)
            {
                NDKAPI.HwArConfig_setPowerMode(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetPowerMode());
                NDKAPI.HwArConfig_setFocusMode(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetFocusMode());
                NDKAPI.HwArConfig_setEnableItem(m_ndkSession.SessionHandle, configHandle, arConfig.GetConfigEnableItem());
                NDKAPI.HwArConfig_setSemanticMode(m_ndkSession.SessionHandle, configHandle, arConfig.GetConfigSemanticMode());
            }

            //the following code is used to forward compatable
            if ((arConfig.GetARType() & (int)NDKARType.HAND_AR) != 0)
            {
                NDKAPI.HwArConfig_setHandFindingMode(m_ndkSession.SessionHandle, configHandle, (int)arConfig.GetHandFindingMode());
            }

            if (arConfig.GetAugImgDataBaseHandle() != null)
            {
                byte[] RawData = arConfig.GetAugImgDataBaseHandle().GetRawData();
                IntPtr AugImgDatabaseHandle = m_ndkSession.AugmentedImageDatabaseAdapter.CreateAugImgDatabaseFromBytes(RawData);
                NDKAPI.HwArConfig_setAugmentedImageDatabase(m_ndkSession.SessionHandle, configHandle, AugImgDatabaseHandle);
            }
        }