Exemple #1
0
 /// <summary>
 /// 创建一个相机,
 /// 注意此方法为了控制产品中使用相机设备的唯一性。
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static SCamera CreateCamera(SCameraType type, SCameraStartCallBack callback = null)
 {
     switch (type)
     {
     case SCameraType.EASYAR:
     default:
         if (m_camera != null)
         {
             MonoBehaviour.Destroy(m_camera.gameObject);
             m_camera = SEasyARCamera.create(callback);
         }
         else
         {
             m_camera = SEasyARCamera.create(callback);
         }
         MySkyInputEvent.instance.SetCamera(m_camera.camera);
         MySkyInputEvent.instance.SetUICamera(m_camera.camera);
         return(m_camera);
     }
 }
Exemple #2
0
        /// <summary>
        /// 创建相机
        /// </summary>
        /// <returns></returns>
        internal static SEasyARCamera create(SCameraStartCallBack callback = null)
        {
            GameObject camera_object = (GameObject)MonoBehaviour.Instantiate(Resources.Load("EasyAR_Startup"));

            camera_object.AddComponent <SEasyARCameraComponent>();
            camera_object.GetComponent <EasyARBehaviour>().Key = KEY;

            SEasyARCamera camera = new SEasyARCamera();

            camera.m_gameObject = camera_object;
            camera.m_camera     = camera_object.transform.FindChild("Augmenter").
                                  FindChild("RenderCamera").gameObject.GetComponent <Camera>();
            camera.m_cameraDeviceBehaviour = camera_object.transform.FindChild("CameraDevice").gameObject.GetComponent <CameraDeviceBehaviour>();

            //等相机完全开启后的回调
            if (callback != null)
            {
                SCameraManager.instance.StartCoroutine(camera.StartCallBack(callback));
            }
            return(camera);
        }