private PointCloudLoader getLoader()
 {
     if (!loader)
     {
         loader = PointCloudAnchor.GetComponent <PointCloudLoader>();
     }
     return(loader);
 }
Exemple #2
0
 public void AddRootNode(Node rootNode, PointCloudLoader loader)
 {
     toLoad.Enqueue(rootNode);
     if (!running)
     {
         if (loadingThread != null)
         {
             loadingThread.Join();
         }
         loadingThread = new Thread(Load);
         loadingThread.Start();
     }
 }
        // Loads a file using a path
        private void LoadFileUsingPath(string path)
        {
            if (path.Length != 0)
            {
                fileBrowserObject.SetActive(false);

                PointCloudLoader controlscript = gameObject.GetComponent <PointCloudLoader>();
                controlscript.enabled = true;
                controlscript.LoadObjectFromFile(path);
            }
            else
            {
                Debug.Log("Invalid path given");
            }
        }
Exemple #4
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        PointCloudLoader loaderscript = (PointCloudLoader)target;

        if (EditorApplication.isPlaying)
        {
            if (GUILayout.Button("Load"))
            {
                loaderscript.LoadPointCloud();
            }
            if (GUILayout.Button("Remove"))
            {
                loaderscript.RemovePointCloud();
            }
        }
    }
Exemple #5
0
 /// <summary>
 /// Removes the root node of a point cloud from the renderer. The node will not be rendered any more.
 /// This has to be called from the main thread!
 /// </summary>
 /// <param name="rootNode">not null</param>
 public void RemoveRootNode(Node rootNode, PointCloudLoader loader)
 {
     lock (toDeleteExternal) {
         toDeleteExternal.Enqueue(rootNode);
     }
 }
Exemple #6
0
 /// <summary>
 /// Registers the root node of a point cloud in the renderer.
 /// </summary>
 /// <param name="rootNode">not null</param>
 public void AddRootNode(Node rootNode, PointCloudLoader loader)
 {
     rootNodes.Add(rootNode);
 }
Exemple #7
0
 public void RemoveRootNode(Node rootNode, PointCloudLoader loader)
 {
     rootNodes.Remove(rootNode);
     toRemove.Enqueue(rootNode);
 }
Exemple #8
0
 private void Update()
 {
     if (Input.GetKeyDown("space"))
     {
         if (status == 0)
         {
             GameObject go = new GameObject("TestCloud1");
             loader1.LoadPointCloud();
         }
         else if (status == 1)
         {
             GameObject go = new GameObject("TestCloud2");
             loader2               = go.AddComponent <PointCloudLoader>();
             loader2.cloudPath     = cloudPath2;
             loader2.setController = set;
         }
         else if (status == 2)
         {
             loader1.RemovePointCloud();
         }
         else if (status == 3)
         {
             loader2.RemovePointCloud();
         }
         else if (status == 4)
         {
             GameObject go = new GameObject("TestCloud2");
             loader2               = go.AddComponent <PointCloudLoader>();
             loader2.cloudPath     = cloudPath2;
             loader2.setController = set;
             loader2.loadOnStart   = false;
         }
         else if (status == 5)
         {
             loader2.LoadPointCloud();
         }
         else if (status == 6)
         {
             loader2.RemovePointCloud();
         }
         else if (status == 7)
         {
             set.StopRendering();
         }
         status++;
     }
     else if (Input.GetKeyDown("escape"))
     {
         Debug.Log("Quitting");
         #if UNITY_EDITOR
         UnityEditor.EditorApplication.isPlaying = false;
         #else
         Application.Quit();
         #endif
     }
     else if (Input.GetKeyDown(KeyCode.O))
     {
         //SceneManager.LoadScene("StaticTestDemo2", LoadSceneMode.Single);
         Scene s = SceneManager.GetSceneByName("StaticTestDemo2");
         if (!s.IsValid())
         {
             SceneManager.LoadScene("StaticTestDemo2");
         }
         else
         {
             Debug.Log("Already loaded");
             SceneManager.SetActiveScene(s);
         }
     }
     else if (Input.GetKeyDown(KeyCode.P))
     {
         //SceneManager.LoadScene("DynamicDemo", LoadSceneMode.Single);
         Scene s = SceneManager.GetSceneByName("DynamicDemo");
         if (!s.IsValid())
         {
             SceneManager.LoadScene("DynamicDemo");
         }
         else
         {
             Debug.Log("Already loaded");
             SceneManager.SetActiveScene(s);
         }
     }
     else if (Input.GetKeyDown(KeyCode.R))
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
     }
     else if (Input.GetKeyDown(KeyCode.C))
     {
         Debug.Log("PointCount: " + set.GetPointCount());
     }
 }