Esempio n. 1
0
        private void Awake()
        {
            videoCamera               = arSession.GetComponentInChildren <VideoCameraDevice>();
            cameraRenderer            = arSession.GetComponentInChildren <CameraImageRenderer>();
            cubeTexture               = CubeRenderer.material.mainTexture;
            targetTextureEventHandler = (camera, texture) =>
            {
                if (texture)
                {
                    CubeRenderer.material.mainTexture = texture;
                }
                else
                {
                    CubeRenderer.material.mainTexture = cubeTexture;
                    if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Metal)
                    {
                        CubeRenderer.transform.localScale = new Vector3(-1, -1, 1);
                    }
                    else
                    {
                        CubeRenderer.transform.localScale = new Vector3(1, 1, 1);
                    }
                }
            };

            videoCamera.DeviceOpened += () =>
            {
                if (videoCamera.Device == null)
                {
                    return;
                }
                var flip = videoCamera.Device.type() == CameraDeviceType.Front ? arSession.HorizontalFlipFront : arSession.HorizontalFlipNormal;
                FlipSwitch.isOn = flip == ARSession.ARHorizontalFlipMode.World;
            };
        }
Esempio n. 2
0
        private void Awake()
        {
            imageTracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>();
            cameraDevice = Session.GetComponentInChildren <VideoCameraDevice>();

            // targets from scene
            controllerNamecard = GameObject.Find("ImageTarget-namecard").GetComponent <ImageTargetController>();
            controllerIdback   = GameObject.Find("ImageTarget-idback").GetComponent <ImageTargetController>();
            imageTargetControllers[controllerNamecard] = false;
            imageTargetControllers[controllerIdback]   = false;
            AddTargetControllerEvents(controllerNamecard);
            AddTargetControllerEvents(controllerIdback);

            CreateTargets();

            var launcher = "AllSamplesLauncher";

            if (Application.CanStreamedLevelBeLoaded(launcher))
            {
                var button = BackButton.GetComponent <Button>();
                button.onClick.AddListener(() => { UnityEngine.SceneManagement.SceneManager.LoadScene(launcher); });
            }
            else
            {
                BackButton.gameObject.SetActive(false);
            }
        }
Esempio n. 3
0
    private void Awake()
    {
        session     = FindObjectOfType <ARSession>();
        mapWorker   = FindObjectOfType <SparseSpatialMapWorkerFrameFilter>();
        videoCamera = session.GetComponentInChildren <VideoCameraDevice>();

#if UNITY_EDITOR
        GameObject.Find("EasyAR_SparseSpatialMapWorker").SetActive(false);
#endif

        PropDragger.CreateObject += (gameObj) =>
        {
            if (gameObj)
            {
                gameObj.transform.parent = mapData.Controller.transform;
                mapData.Props.Add(gameObj);
            }
        };
        PropDragger.DeleteObject += (gameObj) =>
        {
            if (gameObj)
            {
                mapData.Props.Remove(gameObj);
            }
        };
    }
Esempio n. 4
0
        private void Awake()
        {
            objectTracker = Session.GetComponentInChildren <ObjectTrackerFrameFilter>();
            cameraDevice  = Session.GetComponentInChildren <VideoCameraDevice>();

            objectTarget = GameObject.Find("ObjectTarget").GetComponent <ObjectTargetController>();
            AddTargetControllerEvents(objectTarget);
        }
    private void Awake()
    {
#if UNITY_EDITOR
        GameObject.FindObjectOfType <VIOCameraDeviceUnion>().enabled = false;
#endif
        session     = FindObjectOfType <ARSession>();
        mapWorker   = FindObjectOfType <SparseSpatialMapWorkerFrameFilter>();
        videoCamera = session.GetComponentInChildren <VideoCameraDevice>();
    }
Esempio n. 6
0
        private void Awake()
        {
            imageTracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>();
            cameraDevice = Session.GetComponentInChildren <VideoCameraDevice>();

            // targets from scene
            controllerNamecard = GameObject.Find("ImageTarget-namecard").GetComponent <ImageTargetController>();
            controllerIdback   = GameObject.Find("ImageTarget-idback").GetComponent <ImageTargetController>();
            imageTargetControllers[controllerNamecard] = false;
            imageTargetControllers[controllerIdback]   = false;
            AddTargetControllerEvents(controllerNamecard);
            AddTargetControllerEvents(controllerIdback);

            CreateTargets();
        }
Esempio n. 7
0
        private void Awake()
        {
            objectTracker = Session.GetComponentInChildren <ObjectTrackerFrameFilter>();
            cameraDevice  = Session.GetComponentInChildren <VideoCameraDevice>();

            objectTarget = GameObject.Find("ObjectTarget").GetComponent <ObjectTargetController>();
            AddTargetControllerEvents(objectTarget);

            var launcher = "AllSamplesLauncher";

            if (Application.CanStreamedLevelBeLoaded(launcher))
            {
                var button = BackButton.GetComponent <Button>();
                button.onClick.AddListener(() => { UnityEngine.SceneManagement.SceneManager.LoadScene(launcher); });
            }
            else
            {
                BackButton.gameObject.SetActive(false);
            }
        }
Esempio n. 8
0
        private void Awake()
        {
            videoCamera               = arSession.GetComponentInChildren <VideoCameraDevice>();
            cameraRenderer            = arSession.GetComponentInChildren <CameraImageRenderer>();
            cubeTexture               = CubeRenderer.material.mainTexture;
            targetTextureEventHandler = (camera, texture) =>
            {
                if (texture)
                {
                    CubeRenderer.material.mainTexture = texture;
                }
                else
                {
                    CubeRenderer.material.mainTexture = cubeTexture;
                    CubeRenderer.transform.localScale = new Vector3(1, 1, 1);
                }
            };

            videoCamera.DeviceOpened += () =>
            {
                if (videoCamera.Device == null)
                {
                    return;
                }
                var flip = videoCamera.Device.type() == CameraDeviceType.Front ? arSession.HorizontalFlipFront : arSession.HorizontalFlipNormal;
                FlipSwitch.isOn = flip == ARSession.ARHorizontalFlipMode.World;
            };

            var launcher = "AllSamplesLauncher";

            if (Application.CanStreamedLevelBeLoaded(launcher))
            {
                var button = BackButton.GetComponent <Button>();
                button.onClick.AddListener(() => { UnityEngine.SceneManagement.SceneManager.LoadScene(launcher); });
            }
            else
            {
                BackButton.gameObject.SetActive(false);
            }
        }
Esempio n. 9
0
    private void Awake()
    {
        imageTracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>();
        cameraDevice = Session.GetComponentInChildren <VideoCameraDevice>();

        int power = 1;

        // targets from scene
        foreach (ImageTargetController control in Resources.FindObjectsOfTypeAll(typeof(ImageTargetController)))
        {
            imageTargetControllers.Add(control, false);
            AddTargetControllerEvents(control);
            controllerMap.Add(control, (int)Math.Pow(2, power)); // set controller to a bit number (power of 2)
            power++;
        }
        // calculate combination bits for each combo of symbols that trigger an artifact
        foreach (TwoSymbolArtifactLink link in linkMap)
        {
            int bit1 = controllerMap[link.symbol1];
            int bit2 = controllerMap[link.symbol2];
            link.comboBit = bit1 | bit2;
        }
    }