Exemplo n.º 1
0
        private void Draw()
        {
            this.StartGLWorld();
            GLUI.DrawGrid(gridSize, gridUnitSize, colorGrid);

            var half = gridSize * 0.5f;

            GLUI.BeginOrder(1);
            GLUI.DrawLineDirect(-half.X(), half.X(), colorAxisX);
            GLUI.DrawLineDirect(-half.Z(), half.Z(), colorAxisZ);

            GLUI.BeginOrder(2);
            var selAxisSize = gridSize * 10f;
            var pos         = transform.position;

            if (drawAxis == 0)
            {
                GLUI.DrawLineDirect(pos - selAxisSize.X(), pos + selAxisSize.X(), colorAxisXSel);
            }
            else if (drawAxis == 1)
            {
                GLUI.DrawLineDirect(pos - selAxisSize.Y(), pos + selAxisSize.Y(), colorAxisYSel);
            }
            else if (drawAxis == 2)
            {
                GLUI.DrawLineDirect(pos - selAxisSize.Z(), pos + selAxisSize.Z(), colorAxisZSel);
            }

            if (dragging && drawAxisProj)
            {
                DrawLineScreen(screenThisPos, screenThisPos + screenAxis.normalized * drawAxisLength, Color.white);
                DrawLineScreen(screenThisPos, mousePosProj, Color.red);
                DrawLineScreen(screenThisPos, UnityEngine.Input.mousePosition, Color.black);
            }
        }