// Update is called once per frame
        void Update()
        {
            if (ARInterface.GetInterface().TryGetPointCloud(ref m_PointCloud))
            {
                var scale = GetScale();

                var numParticles = Mathf.Min(m_PointCloud.points.Count, m_MaxPointsToShow);
                if (m_Particles == null || m_Particles.Length != numParticles)
                {
                    m_Particles = new ParticleSystem.Particle[numParticles];
                }

                for (int i = 0; i < numParticles; ++i)
                {
                    m_Particles[i].position   = m_PointCloud.points[i] * scale;
                    m_Particles[i].startColor = new Color(1.0f, 1.0f, 1.0f);
                    m_Particles[i].startSize  = m_ParticleSize * scale;
                }

                m_ParticleSystem.SetParticles(m_Particles, numParticles);
            }
            else
            {
                m_ParticleSystem.SetParticles(m_NoParticles, 1);
            }
        }
示例#2
0
        // Update is called once per frame
        void Update()
        {
            if (ARInterface.GetInterface().TryGetCameraImage(ref m_camImage))
            {
                if (curr_count >= total_count)
                {
                    //



                    Texture2D tex = new Texture2D(16, 16, TextureFormat.YUY2, false);
                    uv = m_camImage.uv;
                    y  = m_camImage.y;
                    tex.LoadRawTextureData(uv);
                    tex.Apply();
                    string message = "hello" + uv;
                    byte[] toBytes = Encoding.ASCII.GetBytes(message);
                    udp.Send(uv, 8, ipEndPoint);

                    // Assign texture to renderer's material.
                    test_cube.GetComponent <Renderer> ().material.mainTexture = tex;
                    //img.GetComponent<Renderer> ().material.mainTexture = tex;
                    curr_count = 0;
                    print("complted");

                    byte[] one = Encoding.ASCII.GetBytes("Nikita");
                    //	byte[] two = getBytesForTwo();
                    byte[] combined = new byte[one.Length + uv.Length];

                    for (int i = 0; i < combined.Length; ++i)
                    {
                        combined[i] = i < one.Length ? one[i] : uv[i - one.Length];
                    }


                    udp.Send(combined, combined.Length, ipEndPoint);
                    //text.text = m_camImage.height.ToString() + " " + m_camImage.width.ToString();
                    udp.Send(toBytes, toBytes.Length, ipEndPoint);
                }
                else
                {
                    curr_count++;
                }
            }


            else
            {
                if (curr_count >= total_count)
                {
                    curr_count = 0;
                    print("completed");
                }
                else
                {
                    curr_count++;
                }
            }
        }
示例#3
0
 protected override void SetupARInterface()
 {
     m_RemoteInterface = new ARRemoteEditorInterface();
     m_RemoteInterface.editorConnection = m_EditorConnection;
     m_ARInterface = m_RemoteInterface;
     ARInterface.SetInterface(m_RemoteInterface);
     m_RemoteInterface.sendVideo = sendVideo;
 }
示例#4
0
 private void Awake()
 {
     m_ARInterface = ARInterface.GetInterface();
     if (m_ARInterface == null)
     {
         Destroy(this);
     }
 }
示例#5
0
 void StopService()
 {
     m_ARInterface.StopService();
     ARInterface.planeAdded   -= PlaneAddedHandler;
     ARInterface.planeUpdated -= PlaneUpdatedHandler;
     ARInterface.planeRemoved -= PlaneRemovedHandler;
     m_ServiceRunning          = false;
     m_ARInterface             = null;
     m_HaveSentCameraParams    = false;
 }
 void StopService()
 {
     StopAllCoroutines();
     m_ARInterface.StopService();
     ARInterface.planeAdded   -= PlaneAddedHandler;
     ARInterface.planeUpdated -= PlaneUpdatedHandler;
     ARInterface.planeRemoved -= PlaneRemovedHandler;
     m_ARInterface             = null;
     m_HaveSentCameraParams    = false;
 }
示例#7
0
        void Update()
        {
            var lightEstimate = ARInterface.GetInterface().GetLightEstimate();

            if ((lightEstimate.capabilities & ARInterface.LightEstimateCapabilities.AmbientIntensity) == ARInterface.LightEstimateCapabilities.AmbientIntensity)
            {
                m_Light.intensity = lightEstimate.ambientIntensity;
            }

            if ((lightEstimate.capabilities & ARInterface.LightEstimateCapabilities.AmbientColorTemperature) == ARInterface.LightEstimateCapabilities.AmbientColorTemperature)
            {
                m_Light.colorTemperature = lightEstimate.ambientColorTemperature;
            }
        }
示例#8
0
        public static ARInterface GetInterface()
        {
            if (m_Interface == null)
            {
#if UNITY_EDITOR
                m_Interface = new AREditorInterface();
#elif UNITY_IOS
                m_Interface = new ARKitInterface();
#elif UNITY_ANDROID
                m_Interface = new ARCoreInterface();
#endif
            }

            return(m_Interface);
        }
示例#9
0
        IEnumerator StartServiceRoutine()
        {
            var arInterface = ARInterface.GetInterface();

            yield return(arInterface.StartService(m_CachedSettings));

            if (!arInterface.IsRunning)
            {
                yield break;
            }

            m_ARInterface = arInterface;
            m_ARInterface.SetupCamera(m_ARCamera);

            ARInterface.planeAdded   += PlaneAddedHandler;
            ARInterface.planeUpdated += PlaneUpdatedHandler;
            ARInterface.planeRemoved += PlaneRemovedHandler;
        }
示例#10
0
        void StartService(SerializableARSettings serializedSettings)
        {
            m_CachedSettings = serializedSettings;
            var arInterface = ARInterface.GetInterface();

            m_ServiceRunning = arInterface.StartService(m_CachedSettings);

            if (!m_ServiceRunning)
            {
                return;
            }

            m_ARInterface = arInterface;
            m_ARInterface.SetupCamera(m_ARCamera);

            ARInterface.planeAdded   += PlaneAddedHandler;
            ARInterface.planeUpdated += PlaneUpdatedHandler;
            ARInterface.planeRemoved += PlaneRemovedHandler;
        }
 protected virtual void SetupARInterface()
 {
     m_ARInterface = ARInterface.GetInterface();
     if (m_ARInterface.IsSupported)
     {
         m_WorldTracking = true;
     }
     else
     {
         AR3DOFInterface ar3DOFInterface = new AR3DOFInterface();
         m_3DOFTracking.SetActive(true);
         ar3DOFInterface.SetupBackgroundImage(m_Background);
         ar3DOFInterface.SetupAspectRatioFitter(m_Fitter);
         ARInterface.SetInterface(ar3DOFInterface);
         m_ARInterface = ARInterface.GetInterface();
         // require camera position earily for 3 DOF tracking
         m_ARInterface.SetupCamera(m_ARCamera);
         m_WorldTracking = false;
     }
 }
示例#12
0
 protected virtual void SetupARInterface()
 {
     m_ARInterface = ARInterface.GetInterface();
 }
示例#13
0
 public static void SetInterface(ARInterface arInterface)
 {
     m_Interface = arInterface;
 }