Ejemplo n.º 1
0
    void FixedUpdate()
    {
        if (lastCaptureTime + 10.0f < Time.realtimeSinceStartup)
        {
            TrackerManager.Instance.GetTracker <ObjectTracker>().Stop();
            CameraDevice.Instance.Stop();
            lastCaptureTime = Time.realtimeSinceStartup;
            RegisterFormat();
            this.TakePhoto();
            TrackerManager.Instance.GetTracker <ObjectTracker>().Start();
            CameraDevice.Instance.Start();
#if !UNITY_EDITOR
            NetworkMeshSource.getSingleton().sendImage(m_Texture, Camera.main.transform.position, Camera.main.transform.rotation);
#endif

            QRCodeChecker qr = QRCodeChecker.getSingleton();
            string        o  = qr.findQRCodeInImage(m_Texture);
            Debug.Log(o);
            if (outTextGO != null)
            {
                outTextGO.text = o;
            }
            //m_RawImageBig.texture = m_Texture;
            //m_RawImageBig.mainTexture = m_Texture;
            //m_RawImageBig.SetNativeSize(); holy giant plane batman.
            //m_RawImageBig.material.SetTexture(m_Texture);
            //m_RawImageBig.material.mainTexture = m_Texture;
        }
    }
Ejemplo n.º 2
0
    public void BeginScanQRCode()
    {
        TrackerManager.Instance.GetTracker <ObjectTracker>().Stop();
        CameraDevice.Instance.Stop();
        lastCaptureTime = Time.realtimeSinceStartup;
        RegisterFormat();
        ScanQRCode();
        TrackerManager.Instance.GetTracker <ObjectTracker>().Start();
        CameraDevice.Instance.Start();
#if !UNITY_EDITOR
        NetworkMeshSource.getSingleton().sendImage(m_Texture, Camera.main.transform.position, Camera.main.transform.rotation);
#endif
        try
        {
            QRCodeChecker qr = QRCodeChecker.getSingleton();
            string        o  = qr.findQRCodeInImage(m_Texture);
            Debug.Log(o);
            if (o.Length > 0)
            {
                outText = o;
            }
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
            outText = "Exception Thrown";
            return;
        }
        //m_RawImageBig.texture = m_Texture;
        //m_RawImageBig.mainTexture = m_Texture;
        //m_RawImageBig.SetNativeSize(); holy giant plane batman.
        //m_RawImageBig.material.SetTexture(m_Texture);
        //m_RawImageBig.material.mainTexture = m_Texture;
    }
    private void FixedUpdate()
    {
        if (lastMeshDownlinkTime + 5.0f < Time.realtimeSinceStartup)
        {
            /*
             * List meshFilters = SpatialMappingManager.Instance.GetMeshFilters();
             *
             * for (int i = 0; i < meshFilters.Count; i++)
             * {
             *  NetworkMeshSource.getSingleton().sendMesh(meshFilters[i].mesh,
             *              meshFilters[i].gameObject.transform.position,
             *              meshFilters[i].gameObject.transform.rotation);
             *
             *
             * }*/

            for (int index = 0; index < SurfacesList.Count; index++)
            {
                SurfaceEntry item = SurfacesList[index];
                //if(item.m_BakedState== BakedState.Baked)
                //{
                GameObject go = item.m_Surface;
                if (go)
                {
                    MeshFilter MFer = go.GetComponent <MeshFilter>();
                    if (MFer)
                    {
                        Mesh meesh = MFer.mesh;
                        if (meesh)
                        {
                            NetworkMeshSource.getSingleton().sendMesh(meesh,
                                                                      go.transform.position,
                                                                      go.transform.rotation);
                        }
                    }
                }
                //}
            }


            lastMeshDownlinkTime = Time.realtimeSinceStartup;
        }
    }
Ejemplo n.º 4
0
    private void FixedUpdate()
    {
        if (lastMeshDownlinkTime + 10.0f < Time.realtimeSinceStartup)
        {
            // you can't block here and wait for the camera capture.
            // Send the old data and trigger a new capture.
            // NetworkMeshSource.getSingleton()
            for (int index = 0; index < SurfacesList.Count; index++)
            {
                SurfaceEntry item = SurfacesList[index];
                if (item.m_BakedState == BakedState.Baked || item.m_BakedState == BakedState.UpdatePostBake)
                {
                    GameObject go = item.m_Surface;
                    if (go)
                    {
                        MeshFilter[] meshFilters = go.GetComponents <MeshFilter>();
                        for (int mfi = 0; mfi < meshFilters.Length; mfi++)
                        {
                            MeshFilter MFer = meshFilters[mfi];

                            if (MFer)
                            {
                                Mesh meesh = MFer.mesh;
                                if (meesh && meesh.triangles.Length > 0)
                                {
    #if !UNITY_EDITOR
                                    NetworkMeshSource.getSingleton().sendMesh(meesh,
                                                                              go.transform.position,
                                                                              go.transform.rotation);
    #endif
                                }
                            }
                        }
                    }
                }
            }
            lastMeshDownlinkTime = Time.realtimeSinceStartup;
        }
    }