Пример #1
0
    private void CheckNodeRenderState()
    {
        UpdateVisibleNodeList();

        int visibleMeshesCount = 0;
        if (meshManager != null)
        {
            int nMeshes = meshManager.NAvailableMeshes;
            for (int i = distanceVisibleNodeList.Count - 1; i > -1; i--)
            {
                PCNode n = ((PCNode)distanceVisibleNodeList[i]);
                n.State = (visibleMeshesCount < nMeshes) ? PCNode.PCNodeState.VISIBLE : PCNode.PCNodeState.INVISIBLE;
                visibleMeshesCount++;
            }
        }
    }
Пример #2
0
    void SelectPoint(Vector2 screenPosition, float maxScreenDistance)
    {
        if (pcListener == null)
        {
            return;
        }

        UnityEngine.Debug.Log("Finding selected point.");

        MeshFilter[] mf = GetComponentsInChildren<MeshFilter>();
        float maxDist = 10000000.0f;

        Vector3 closestHit = Vector3.negativeInfinity;
        Color colorClosestHit = Color.black;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        for (int i = 0; i < transform.childCount; i++)
        {
            GameObject child = transform.GetChild(i).gameObject;
            PCNode node = child.GetComponent<PCNode>();
            if (node != null)
            {
                UnityEngine.Debug.Log("Finding selected point on node.");
                node.GetClosestPointOnRay(ray,
                                          screenPosition,
                                          ref maxDist,
                                          ref closestHit,
                                          ref colorClosestHit,
                                          maxScreenDistance * maxScreenDistance);
            }
        }

        if (!closestHit.Equals(Vector3.negativeInfinity))
        {
            float classCode = GetClassCodeForColor(colorClosestHit);
            pcListener.onPointSelected(closestHit, classCode);
        }
    }
Пример #3
0
 public void Unload()
 {
     Destroy(node.gameObject);
     node = null;
 }
Пример #4
0
 public void Load(PointCloud pc, DirectoryInfo dir)
 {
     JSONNode treeJSON = PointCloud.ReadJSON(dir, treeFile);
     node = PCNode.AddNode(treeJSON, dir, pc.gameObject, pc);
     UnityEngine.Debug.Log("Added subtree " + treeFile);
 }