コード例 #1
0
ファイル: KFListObj.cs プロジェクト: mgou123/code_snipe
    void Start()
    {
        kfMarkRoot       = new GameObject().transform;
        kfConnectionRoot = new GameObject().transform;
        mpConnectionRoot = lineMesh.create().transform;
        mpConnectionRoot.SetParent(transform);
        kfConnectionRoot.SetParent(transform);
        kfMarkRoot.SetParent(transform);
        lineMesh trajObj = lineMesh.create();

        kfTrajRoot = trajObj.transform;
        kfTrajRoot.SetParent(transform);
        for (int i = 0; i < KFList.Count; i++)
        {
            camModel mark = camModel.create(KFList[i].pos,
                                            KFList[i].right,
                                            KFList[i].forward,
                                            KFList[i].up,
                                            KFList[i].id, listId);
            mark.ChangeColor(KFList[i].color);
            mark.transform.SetParent(kfMarkRoot);
            if (i != 0)
            {
                trajObj.addLine(KFList [i - 1].pos, KFList [i].pos);
            }
        }
        trajObj.createMesh();
        //ShowTraj (false, new Color32());
    }
コード例 #2
0
ファイル: lineMesh.cs プロジェクト: mgou123/code_snipe
    public static lineMesh create()
    {
        GameObject obj = new GameObject();

        obj.name = "LineMesh";
        lineMesh item = obj.AddComponent <lineMesh> ();

        item.color = new Color32(0, 0, 0, 255);
        return(item);
    }
コード例 #3
0
ファイル: KFListObj.cs プロジェクト: mgou123/code_snipe
    public void ConnectKF(int minVal, int maxVal, int kfId, int con_type, Color32 color)
    {
        int ind = findKFInd(kfId);

        int[] list;
        int[] listVal;
        if (con_type == 0)
        {
            list    = KFList [ind].kfLinks1;
            listVal = KFList [ind].kfLinksVal1;
        }
        else if (con_type == 1)
        {
            list    = KFList [ind].kfLinks2;
            listVal = KFList [ind].kfLinksVal2;
        }
        else if (con_type == 2)
        {
            list    = KFList [ind].kfLinks3;
            listVal = KFList [ind].kfLinksVal3;
        }
        else
        {
            return;
        }
        if (list == null)
        {
            Debug.LogError("There is no data for this connection of keyframe. Id:" + kfId);
            return;
        }
        lineMesh tempObj = lineMesh.create();

        tempObj.transform.SetParent(kfConnectionRoot);
        tempObj.color = color;
        for (int i = 0; i < list.Length; i++)
        {
            if (maxVal >= listVal [i] && minVal <= listVal [i])
            {
                int kfInd = findKFInd(list [i]);
                if (kfInd != -1)
                {
                    KeyFrameC item = KFList [kfInd];
                    GetMarkObj(kfInd).ChangeColor(color);
                    tempObj.addLine(KFList [ind].pos, item.pos);
                }
                else
                {
                    Debug.LogError("keyframe " + list [i] + "is not found!!");
                }
            }
        }
        tempObj.createMesh();
    }