Beispiel #1
0
    public void OnEnable()
    {
        WebCamAbstractBehaviour target = (WebCamAbstractBehaviour)base.target;

        if ((QCARUtilities.GetPrefabType(target) != PrefabType.Prefab) && !SceneManager.Instance.SceneInitialized)
        {
            SceneManager.Instance.InitScene();
        }
    }
Beispiel #2
0
 public static bool IsQCAREnabled()
 {
     if (!IsPlayMode())
     {
         return(true);
     }
     if (sWebCamUsed == WebCamUsed.UNKNOWN)
     {
         WebCamAbstractBehaviour behaviour = (WebCamAbstractBehaviour)UnityEngine.Object.FindObjectOfType(typeof(WebCamAbstractBehaviour));
         sWebCamUsed = behaviour.IsWebCamUsed() ? WebCamUsed.TRUE : WebCamUsed.FALSE;
     }
     return(sWebCamUsed == WebCamUsed.TRUE);
 }
    private int InitCameraDevice(int camera)
    {
        if (!QCARRuntimeUtilities.IsPlayMode())
        {
            return(QCARWrapper.Instance.CameraDeviceInitCamera(camera));
        }
        int num = 0;

        try
        {
            WebCamAbstractBehaviour behaviour = (WebCamAbstractBehaviour)UnityEngine.Object.FindObjectOfType(typeof(WebCamAbstractBehaviour));
            behaviour.InitCamera();
            mWebCam = behaviour.ImplementationClass;
            QCARWrapper.Instance.CameraDeviceSetCameraConfiguration(mWebCam.ResampledTextureSize.x, mWebCam.ResampledTextureSize.y);
            num = 1;
        }
        catch (NullReferenceException exception)
        {
            Debug.LogError(exception.Message);
        }
        QCARWrapper.Instance.CameraDeviceInitCamera(camera);
        this.mCameraImages.Clear();
        return(num);
    }
Beispiel #4
0
 public override void OnInspectorGUI()
 {
     if (!EditorApplication.isPlaying)
     {
         WebCamAbstractBehaviour target = (WebCamAbstractBehaviour)base.target;
         if (QCARUtilities.GetPrefabType(target) != PrefabType.Prefab)
         {
             if (target.BackgroundCameraPrefab == null)
             {
                 UnityEngine.Object obj2 = AssetDatabase.LoadAssetAtPath("Assets/Qualcomm Augmented Reality/Prefabs/Internal/BackgroundCamera.prefab", typeof(Camera));
                 if (obj2 != null)
                 {
                     target.BackgroundCameraPrefab = obj2 as Camera;
                 }
             }
             target.TurnOffWebCam = EditorGUILayout.Toggle("Don't use for Play Mode", target.TurnOffWebCam, new GUILayoutOption[0]);
             if (!target.TurnOffWebCam)
             {
                 if (!target.CheckNativePluginSupport())
                 {
                     EditorGUILayout.HelpBox("Play Mode requires a Unity Pro license!", MessageType.Warning);
                 }
                 int      index       = 0;
                 string[] deviceNames = this.GetDeviceNames();
                 for (int i = 0; i < deviceNames.Length; i++)
                 {
                     if ((deviceNames[i] != null) && deviceNames[i].Equals(target.DeviceName))
                     {
                         index = i;
                     }
                 }
                 if (sWebCamProfiles == null)
                 {
                     sWebCamProfiles = new WebCamProfile();
                 }
                 string str = deviceNames[index];
                 if (str.Equals("NO CAMERAS FOUND"))
                 {
                     EditorGUILayout.HelpBox("No camera connected!\nTo run your application using Play Mode, please connect a webcam to your computer.", MessageType.Warning);
                 }
                 else if (!sWebCamProfiles.ProfileAvailable(deviceNames[index]))
                 {
                     EditorGUILayout.HelpBox("Webcam profile not found!\nUnfortunately there is no profile for your webcam model: '" + deviceNames[index] + "'.\n\nThe default profile will been used. You can configure a profile yourself by editing '" + Path.Combine(Application.dataPath, "Editor/QCAR/WebcamProfiles/profiles.xml") + "'.", MessageType.Warning);
                 }
                 EditorGUILayout.Space();
                 EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                 EditorGUILayout.PrefixLabel("Camera Device");
                 int num3 = EditorGUILayout.Popup(index, deviceNames, new GUILayoutOption[0]);
                 if ((num3 != index) && !deviceNames[num3].Equals("NO CAMERAS FOUND"))
                 {
                     target.DeviceName = deviceNames[num3];
                 }
                 EditorGUILayout.EndHorizontal();
                 target.FlipHorizontally = EditorGUILayout.Toggle("Flip Horizontally", target.FlipHorizontally, new GUILayoutOption[0]);
                 EditorGUILayout.Space();
                 EditorGUILayout.HelpBox("Here you can enter the index of the layer that will be used internally for our render to texture functionality. the ARCamera will be configured to not draw this layer.", MessageType.None);
                 target.RenderTextureLayer = EditorGUILayout.IntField("Render Texture Layer", target.RenderTextureLayer, new GUILayoutOption[0]);
             }
             if (GUI.changed)
             {
                 EditorUtility.SetDirty(target);
                 SceneManager.Instance.SceneUpdated();
             }
         }
         else
         {
             EditorGUILayout.HelpBox("Webcam settings cannot be changed during Play Mode.", MessageType.Info);
         }
     }
 }