Exemplo n.º 1
0
    public void ResetSmartTerrain()
    {
        if ((mReconstructionBehaviour != null) && (mReconstructionBehaviour.Reconstruction != null))
        {
            Debug.Log("Resetting Smart Terrain");

            SmartTerrainTracker stTracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();
            bool trackerWasActive         = stTracker.IsActive;

            // first stop the tracker
            if (trackerWasActive)
            {
                stTracker.Stop();
            }

            // now you can reset...
            mReconstructionBehaviour.Reconstruction.Reset();

            // ... and restart the tracker
            if (trackerWasActive)
            {
                stTracker.Start();
                mReconstructionBehaviour.Reconstruction.Start();
            }

            // After a Reset, the ST reconstruction will be active again,
            // so we need to sync the UI
            Button startBtn = base.FindUISelectableWithText <Button>("Start");
            if (startBtn)
            {
                startBtn.GetComponentInChildren <Text>().text = "Stop";
            }
        }
    }
Exemplo n.º 2
0
 public void restart()
 {
     if (mTracker == null || mReconstructionBehaviour == null)
     {
         mTracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();
         mReconstructionBehaviour = (ReconstructionBehaviour)FindObjectOfType(typeof(ReconstructionBehaviour));
     }
     if ((mReconstructionBehaviour != null) && (mReconstructionBehaviour.Reconstruction != null))
     {
         bool trackerWasActive = mTracker.IsActive;
         // first stop the tracker
         if (trackerWasActive)
         {
             mTracker.Stop();
         }
         // now you can reset...
         mReconstructionBehaviour.Reconstruction.Reset();
         // ... and restart the tracker
         if (trackerWasActive)
         {
             mTracker.Start();
             mReconstructionBehaviour.Reconstruction.Start();
         }
     }
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        mReconstructionBehaviour = GetComponent <ReconstructionBehaviour>();
        mTracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();


        //StartCoroutine(WaitForTenSeconds());
    }
Exemplo n.º 4
0
    public override void Bind()
    {
        this.View.mCloseButton.TappedOn         += OnTappedToClose;
        this.View.mAboutLabel.TappedOn          += OnTappedOnAboutButton;
        this.View.mCameraFlashSettings.TappedOn += OnTappedToTurnOnFlash;
        this.View.mAutoFocusSetting.TappedOn    += OnTappedToTurnOnAutoFocus;
        this.View.mStartStopScanning.TappedOn   += OnTappedOnScanning;
        this.View.mReset.TappedOn += OnTappedOnReset;

        EnableContinuousAutoFocus();

        mTracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();
    }
    //对回调函数进行注册
    void Start()
    {
        //获取Smart Terrain Tracker 与 Reconstruction
        mReconstructionBehaviour = GetComponent <ReconstructionBehaviour>();
        DT_Tracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();

        if (mReconstructionBehaviour)
        {
            mReconstructionBehaviour.RegisterInitializedCallback(OnInitialized);
            mReconstructionBehaviour.RegisterPropCreatedCallback(OnPropCreated);
            mReconstructionBehaviour.RegisterSurfaceCreatedCallback(OnSurfaceCreated);
        }
    }
Exemplo n.º 6
0
    public void saveMesh()
    {
        if (mTracker == null || mReconstructionBehaviour == null)
        {
            mTracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();
            mReconstructionBehaviour = (ReconstructionBehaviour)FindObjectOfType(typeof(ReconstructionBehaviour));
        }
        IEnumerable <Prop> propIEnu = mReconstructionBehaviour.GetActiveProps();
        IEnumerator <Prop> e        = propIEnu.GetEnumerator();
        int count = 0;

        while (e.MoveNext())
        {
            count++;

            var mf   = wall.GetComponent <MeshFilter>();
            var mesh = mf.sharedMesh;
            mesh.vertices  = e.Current.GetMesh().vertices;
            mesh.triangles = e.Current.GetMesh().triangles;

            //Object tempMesh = e.Current.GetMesh();
            //Vector3[] temp = e.Current.GetMesh().vertices;
            //int[] b =e.Current.GetMesh().triangles;
            //Debug.Log(e.Current.GetMesh().vertexCount);

            //foreach(Vector3 a in temp)
            //{
            //    Debug.Log("coord= "+a);
            //}
            //foreach (int a in b)
            //{
            //    Debug.Log("tri= " + a);
            //}
            //SaveObjectToFile(tempMesh, "Assets/data" + count+".obj");
        }
        Debug.Log("count= " + count);
    }
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     mTracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();
     mReconstructionBehaviour = (ReconstructionBehaviour)FindObjectOfType(typeof(ReconstructionBehaviour));
 }
Exemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     mReconstructionBehaviour = GetComponent <ReconstructionBehaviour>();
     mTracker = TrackerManager.Instance.GetTracker <SmartTerrainTracker>();
 }