Пример #1
0
    private void Instance_SetPickup(Pickup args)
    {
        switch (args)
        {
        case Pickup.PickupMesh:
            isUsePackUp = true;
            pickmode    = Enums.PickMode.cell;
            FrameEnable();
            break;

        case Pickup.PickupPoint:
            isUsePackUp = true;
            pickmode    = Enums.PickMode.Point;
            FrameEnable();
            break;

        default:
            break;
        }
    }
Пример #2
0
    private void Awake()
    {
        GlobalVariableBackground.Instance.conManager = this;
        senceModel = GameObject.Find("SenceModel");
        line       = GlobalVariableBackground.Instance.MaterialLine;
        selectLine = GlobalVariableBackground.Instance.MaterialSelectLine;
        pickUpObj  = new Others.PackUpObject();
        pickClick  = new Others.PackUpObject();

        //pointPickObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
        //pointPickObj.GetComponent<MeshRenderer>().enabled = false;
        //Destroy(pointPickObj.GetComponent<BoxCollider>());
        //pointPickObj.GetComponent<MeshFilter>().mesh = GlobalVariableBackground.Instance.miniCubeMesh;
        //pointPickObj.transform.localScale = pointPickObj.transform.localScale * 1.01f;
        pickmode            = Enums.PickMode.Point;
        colorPointArrayTemp = new Color[24];
        for (int i = 0; i < 24; i++)
        {
            //基佬紫
            colorPointArrayTemp[i] = Color.HSVToRGB(304 / 360f, 1f, 1f);
        }
        pointTriTemp = GlobalVariableBackground.Instance.miniCubeMesh.triangles;
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        //下一帧
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            GlobalVariableBackground.Instance.playRun = false;
            NextFrame();
        }
        //上一帧
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            GlobalVariableBackground.Instance.playRun = false;
            LastFrame();
        }

        //自动播放
        if (Input.GetKeyDown(KeyCode.KeypadEnter))
        {
            GlobalVariableBackground.Instance.playRun = true;
            StartCoroutine("Run", timeFloat);
        }

        //初始化帧
        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            FrameInit();
        }

        //显示点模式
        if (Input.GetKeyDown(KeyCode.Keypad1))
        {
            ChangePointMode();
        }
        //显示网格模式
        if (Input.GetKeyDown(KeyCode.Keypad2))
        {
            ChangeCellMode();
        }

        //显示线模式
        if (Input.GetKeyDown(KeyCode.Keypad3))
        {
            ChangeLineMode();
        }

        //显示网格+线模式
        if (Input.GetKeyDown(KeyCode.Keypad4))
        {
            ChangeLineAndCellMode();
        }

        //切割模型
        if (Input.GetKeyDown(KeyCode.C))
        {
            CutModel();
        }

        ////垃圾回收 测试使用
        //if (Input.GetKeyDown(KeyCode.G))
        //{
        //    GC.Collect();
        //    GlobalVariableBackground.Instance.conManager.WriteLog("GC.Collect()");
        //}

        //网格线拾取
        if (Input.GetKeyDown(KeyCode.P))
        {
            isUsePackUp = true;
            pickmode    = Enums.PickMode.cell;
            FrameEnable();
            GlobalVariableBackground.Instance.conManager.WriteLog("cell isUsePackUp is " + isUsePackUp);
        }

        //点拾取
        if (Input.GetKeyDown(KeyCode.O))
        {
            isUsePackUp = true;
            pickmode    = Enums.PickMode.Point;
            FrameEnable();
            GlobalVariableBackground.Instance.conManager.WriteLog("point isUsePackUp is " + isUsePackUp);
        }
        //关闭拾取
        if (Input.GetKeyDown(KeyCode.U))
        {
            isUsePackUp = false;
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            if (ToArrowMode != null)
            {
                ToArrowMode();
            }
        }

        //拾取实时 效果显示
        if (isUsePackUp)
        {
            PickUpObject(pickUpObj);
            if (pickClick.isMeshHave)
            {
                Graphics.DrawMesh(pickClick.mesh, senceModel.transform.localToWorldMatrix, selectLine, 0);
            }
            if (pickUpObj.isMeshHave)
            {
                Graphics.DrawMesh(pickUpObj.mesh, senceModel.transform.localToWorldMatrix, line, 0);
            }
        }

        //确认拾取
        if (Input.GetMouseButtonDown(0))
        {
            PickUpClick();
        }

        //根据Z轴对称
        if (Input.GetKeyDown(KeyCode.Z))
        {
            if (ToSymmetric != null)
            {
                ToSymmetric(Enums.SymmetricMode.Z);
            }
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            if (ToSmooth != null)
            {
                ToSmooth();
            }
        }
    }