コード例 #1
0
    //public ChangeColor changeColor;
    void Start()
    {
        meshCreateControlPoints = GameObject.Find("Selection Manager").GetComponent <MeshCreateControlPoints>();
        //Debug.Log("meshCreateControlPoints._initializedControlPoints.childCount " + meshCreateControlPoints._initializedControlPoints.childCount);

        for (int i = 0; i < meshCreateControlPoints._initializedControlPoints.childCount; i++)
        {
            int k   = i + 1;
            var obj = GameObject.Find("Initialized Control Points/Control Point " + k);
            LstCPs.Add(obj);
            LstInteractBes.Add(obj.GetComponent <InteractionBehaviour>());

            LstInteractBes[i].OnContactBegin += obj.GetComponent <ChangeColor>().SetColor;
            LstInteractBes[i].OnContactBegin += obj.GetComponent <ChangeColor>().SetParent;
            LstInteractBes[i].OnContactEnd   += obj.GetComponent <ChangeColor>().ResetColor;
        }

        //Obj1 = GameObject.Find("Initialized Control Points/Control Point 1");
        //Debug.Log("Obj1 " + Obj1.name);

        //Obj2 = GameObject.Find("Initialized Control Points/Control Point 2");
        //Debug.Log("Obj2 " + Obj2.name);


        //InteractionBehaviour interaction1 = Obj1.GetComponent<InteractionBehaviour>();
        //InteractionBehaviour interaction2 = Obj2.GetComponent<InteractionBehaviour>();
        //interaction1.OnContactBegin += OnControlPointSelect1;
        //interaction2.OnContactBegin += OnControlPointSelect2;
        //interaction1.OnContactEnd += OnControlPointDeselect1;
        //interaction2.OnContactEnd += OnControlPointDeselect2;
    }
コード例 #2
0
    void Start()
    {
        readJson                = GameObject.Find("Selection Manager").GetComponent <ReadJson>();
        functionality           = GameObject.Find("Selection Manager").GetComponent <Functionality>();
        meshCreateControlPoints = GameObject.Find("Selection Manager").GetComponent <MeshCreateControlPoints>();
        treatSelectionManager   = GameObject.Find("Selection Manager").GetComponent <TreatSelectionManager>();
        voiceController         = GameObject.Find("Selection Manager").GetComponent <VoiceController>();

        cam             = GetComponent <Camera>();
        hitMeshCollider = false;
        flagSegment     = -1;
        //meshHand = GameObject.Find("hand").GetComponent<MeshCollider>();
    }
コード例 #3
0
 private void Start()
 {
     readJson = GameObject.Find("Selection Manager").GetComponent <ReadJson>();
     treatSelectionManager   = GameObject.Find("Selection Manager").GetComponent <TreatSelectionManager>();
     meshCreateControlPoints = GameObject.Find("Selection Manager").GetComponent <MeshCreateControlPoints>();
     checkSegment            = false;
     provider             = FindObjectOfType <LeapProvider>();
     impossibleDirections = new List <Vector3>();
     FreeMovimentState    = true;
     swipeUp                = false;
     swipeDown              = false;
     canChangeLevel         = false;
     voiceChangeScale       = false;
     changeScaleCollision   = false;
     graspDetect            = false;
     grasping               = false;
     selectionCPsBarycenter = new Vector3();
 }
コード例 #4
0
 void Start()
 {
     meshCreateControlPoints = GameObject.Find("Selection Manager").GetComponent <MeshCreateControlPoints>();
 }
コード例 #5
0
    private void Awake()
    {
        levelSelect      = 0;
        levelChange      = false;
        segmentTags      = new List <string>();
        meshCage         = objCage.GetComponent <MeshFilter>().mesh;
        meshModel        = objModel.GetComponent <MeshFilter>().mesh;
        cageVertices     = meshCage.vertices;
        modelVertices    = meshModel.vertices;
        trisCage         = meshCage.triangles;
        trisModel        = meshModel.triangles;
        colorArrayLevelx = new Color[modelVertices.Length];

        meshCreateControlPoints = GameObject.Find("Selection Manager").GetComponent <MeshCreateControlPoints>();
        readFileComputeNewcage  = GameObject.Find("Selection Manager").GetComponent <ReadFileComputeNewcage>();

        jsonString1 =
            //File.ReadAllText(Application.streamingAssetsPath + "/" + "hand_segmentation_hierarchical_nails.txt");
            File.ReadAllText(Application.streamingAssetsPath + "/" + "flowered_teapot_simplified.ant.txt");

        data1 = JsonMapper.ToObject(jsonString1);

        //Instantiation of the the model's segments(instances of the segments)
        for (var i = 0; i < data1["annotations"].Count; i++)
        {
            var datatest = JsonMapper.ToJson(data1["annotations"][i]);
            importedSegmentsOfDifferentLevels.Add(JsonMapper.ToObject <ModelData>(datatest));
            Debug.Log("To see the colors  " + importedSegmentsOfDifferentLevels[i].color[0]);
        }


        var segmentLevel0 = importedSegmentsOfDifferentLevels.Find(x => x.father == -1);

        rootNode = new TreeNode(segmentLevel0);
        //loop for levels
        for (var i = 0; i < importedSegmentsOfDifferentLevels.Count; i++)
        {
            if (importedSegmentsOfDifferentLevels[i].id == segmentLevel0.id)
            {
                continue;
            }
            var node   = new TreeNode(importedSegmentsOfDifferentLevels[i]);
            var father =
                importedSegmentsOfDifferentLevels.Find(x => x.id == importedSegmentsOfDifferentLevels[i].father);


            if (rootNode.GetDescendent(father.id) != null)
            {
                rootNode.GetDescendent(father.id).Add(node);
            }
        }

        var idMax = importedSegmentsOfDifferentLevels.Max(x => x.id);

        Debug.Log("levelMax detected " + idMax);


        levelMax = rootNode.GetDescendent(idMax).GetLevel();
        Debug.Log("levelMax " + levelMax);

        levelRange.text = "0-" + levelMax;
        TreatmentCPLevelx();


        var hierarchy = new GameObject();

        hierarchy.name = "Hierarchy";
        rootNode.GetGameobject().transform.parent = hierarchy.transform;

        //BFS(rootNode);


        //Create the color arrays for the different-level-model
    }