示例#1
0
 /// <summary>
 /// Inits the image anchors tracking.
 /// </summary>
 /// <param name="imageManager">Anchor image manager.</param>
 public override void InitImageAnchorsTracking(AnchorImageManager imageManager)
 {
     arImageDatabase = Resources.Load <AugmentedImageDatabase>("ArCoreImageDatabase");
 }
 /// <summary>
 /// Inits the image anchors tracking.
 /// </summary>
 /// <param name="imageManager">Anchor image manager.</param>
 public override void InitImageAnchorsTracking(AnchorImageManager imageManager)
 {
     arImageDatabase = Resources.Load <ARReferenceImagesSet>("ArKitImageDatabase");
     Debug.Log("arImageDatabase initialized: " + (arImageDatabase != null ? arImageDatabase.resourceGroupName : "-"));
 }
示例#3
0
    // -- // -- // -- // -- // -- // -- // -- // -- // -- // -- //


    void Awake()
    {
        // initializes the singleton instance of MultiARManager
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this);

            instanceInited = true;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
            return;
        }

        // locate available AR interfaces in the scene
        MonoBehaviour[] monoScripts = FindObjectsOfType <MonoBehaviour>();

        ARPlatformInterface arIntAvailable = null;

        arInterface = null;

        for (int i = 0; i < monoScripts.Length; i++)
        {
            if ((monoScripts[i] is ARPlatformInterface) && monoScripts[i].enabled)
            {
                ARPlatformInterface arInt = (ARPlatformInterface)monoScripts[i];
                arInt.SetEnabled(false, null);

                if (arInt.IsPlatformAvailable())
                {
                    Debug.Log(arInt.GetARPlatform().ToString() + " is available.");

                    if (arIntAvailable == null)
                    {
                        arIntAvailable = arInt;
                    }

                    if (arInt.GetARPlatform() == preferredPlatform)
                    {
                        arInterface = arInt;
                    }
                }
            }
        }

        if (arInterface == null)
        {
            arInterface = arIntAvailable;
        }

        // report the selected platform
        if (arInterface != null)
        {
            arInterface.SetEnabled(true, this);
            Debug.Log("Selected AR-Platform: " + arInterface.GetARPlatform().ToString());
        }
        else
        {
            Debug.LogError("No suitable AR-Interface found. Please check the scene setup.");
        }

        // set initialization status
        isInitialized = (arInterface != null);

        if (arInterface != null)
        {
            // check for augmented images
            AnchorImageManager imageManager = GameObject.FindObjectOfType <AnchorImageManager>();

            if (imageManager != null && imageManager.anchorImages != null && imageManager.anchorImages.Count > 0)
            {
                // prepare images for tracking
                arInterface.InitImageAnchorsTracking(imageManager);
                arData.imageAnchorsEnabled = true;
            }
        }
    }
示例#4
0
 public virtual void InitImageAnchorsTracking(AnchorImageManager imageManager)
 {
 }