Ejemplo n.º 1
0
        //---------------------------------------------------------------------------------------
        public apGizmos.SelectResult MultipleSelect__MeshTRS(Vector2 mousePosGL_Min, Vector2 mousePosGL_Max, Vector2 mousePosW_Min, Vector2 mousePosW_Max, apGizmos.SELECT_TYPE areaSelectType)
        {
            if (Editor.Select.SelectionType != apSelection.SELECTION_TYPE.Mesh ||
                Editor.Select.Mesh == null ||
                Editor.Select.Mesh.LinkedTextureData == null ||
                Editor.Select.Mesh.LinkedTextureData._image == null ||
                Editor._meshEditMode != apEditor.MESH_EDIT_MODE.MakeMesh ||
                Editor._meshEditeMode_MakeMesh != apEditor.MESH_EDIT_MODE_MAKEMESH.TRS)
            {
                return(null);
            }

            apMesh mesh = Editor.Select.Mesh;
            //Vector2 imageHalfOffset = new Vector2(mesh.LinkedTextureData._width * 0.5f, mesh.LinkedTextureData._height * 0.5f);
            List <apVertex> vertices = mesh._vertexData;

            if (vertices.Count == 0)
            {
                return(null);
            }

            List <apVertex> tmpVertex = null;

            apVertex curVert = null;
            Vector2  vertPos = Vector2.zero;

            for (int iVert = 0; iVert < vertices.Count; iVert++)
            {
                curVert = vertices[iVert];

                //클릭할 수 있는가
                //vertPos = curVert._pos - (mesh._offsetPos + imageHalfOffset);
                vertPos = curVert._pos - (mesh._offsetPos);

                bool isSelectable = (mousePosW_Min.x < vertPos.x && vertPos.x < mousePosW_Max.x) &&
                                    (mousePosW_Min.y < vertPos.y && vertPos.y < mousePosW_Max.y);

                if (isSelectable)
                {
                    //일단 리스트에 추가
                    if (tmpVertex == null)
                    {
                        tmpVertex = new List <apVertex>();
                    }
                    tmpVertex.Add(curVert);
                }
            }
            if (tmpVertex != null)
            {
                Editor.VertController.SelectVertices(tmpVertex, areaSelectType);
                Editor.SetRepaint();
            }
            else if (areaSelectType == apGizmos.SELECT_TYPE.New)
            {
                Editor.VertController.UnselectVertex();
                Editor.SetRepaint();
            }

            return(apGizmos.SelectResult.Main.SetMultiple <apVertex>(Editor.VertController.Vertices));
        }
Ejemplo n.º 2
0
 public AutoHiddenEdgeData(apVertex vert1, apVertex vert2)
 {
     _vert1    = vert1;
     _vert2    = vert2;
     _length   = Vector3.Distance(_vert1._pos, _vert2._pos);
     _minAngle = 90.0f;
 }
Ejemplo n.º 3
0
        // Init
        //------------------------------------
        public apRenderVertex(apRenderUnit parentRenderUnit, apMeshGroup parentMeshGroup, apMesh parentMesh, apVertex vertex)
        {
            _parentRenderUnit = parentRenderUnit;
            _parentMeshGroup  = parentMeshGroup;
            _parentMesh       = parentMesh;
            _vertex           = vertex;

            //_isStaticRefreshed = false;
            _isCalculated = false;

            //_matrixStack.Clear();

            //
            _matrix_Static_Vert2Mesh = apMatrix3x3.identity;
            _matrix_Cal_VertLocal    = apMatrix3x3.identity;
            _matrix_MeshTransform    = apMatrix3x3.identity;

            _matrix_Cal_VertWorld = apMatrix3x3.identity;
            _matrix_ToWorld       = apMatrix3x3.identity;
            _pos_World            = Vector2.zero;

            //_cal_VertWorld = Vector2.zero;

            //_matrixHashCode_Static_Vert2Mesh = -1;
            //_matrixHashCode_Calculate = -1;

            //_isMatrixChanged = true;
            //_isUpdateMatrixForce = true;

            _pos_Rigging    = Vector2.zero;
            _weight_Rigging = 0.0f;

            _matrix_Rigging = apMatrix3x3.identity;
        }
Ejemplo n.º 4
0
        //-----------------------------------------------------------------------------------------

        // FFD Start
        public bool StartFFDTransform__MeshTRS()
        {
            if (Editor.Select.SelectionType != apSelection.SELECTION_TYPE.Mesh ||
                Editor.Select.Mesh == null ||
                Editor.Select.Mesh.LinkedTextureData == null ||
                Editor.Select.Mesh.LinkedTextureData._image == null ||
                Editor._meshEditMode != apEditor.MESH_EDIT_MODE.MakeMesh ||
                Editor._meshEditeMode_MakeMesh != apEditor.MESH_EDIT_MODE_MAKEMESH.TRS)
            {
                return(false);
            }

            apMesh          mesh             = Editor.Select.Mesh;
            List <apVertex> vertices         = mesh._vertexData;
            List <apVertex> selectedVertices = Editor.VertController.Vertices;

            if (vertices.Count == 0 || selectedVertices.Count == 0)
            {
                return(false);
            }

            List <object>  srcObjectList = new List <object>();
            List <Vector2> worldPosList  = new List <Vector2>();
            apVertex       vert          = null;

            for (int i = 0; i < selectedVertices.Count; i++)
            {
                vert = selectedVertices[i];
                srcObjectList.Add(vert);
                worldPosList.Add(vert._pos - mesh._offsetPos);
            }
            Editor.Gizmos.RegistTransformedObjectList(srcObjectList, worldPosList);            //<<True로 리턴할거면 이 함수를 호출해주자
            return(true);
        }
Ejemplo n.º 5
0
        public apVertex FindNearestVertex(Vector2 pos, apMesh mesh, float offset, apVertex exceptVert = null)
        {
            apVertex curVert = null;
            apVertex minVert = null;
            float    curDist = 0.0f;
            float    minDist = 0.0f;

            for (int iVert = 0; iVert < mesh._vertexData.Count; iVert++)
            {
                curVert = mesh._vertexData[iVert];
                if (exceptVert == curVert)
                {
                    continue;
                }
                if (Mathf.Abs(curVert._pos.x - pos.x) < offset &&
                    Mathf.Abs(curVert._pos.y - pos.y) < offset)
                {
                    curDist = Mathf.Abs(curVert._pos.x - pos.x) + Mathf.Abs(curVert._pos.y - pos.y);                    //MHT Dist
                    //선택할 수 있다.
                    if (minVert == null || curDist < minDist)
                    {
                        minVert = curVert;
                        minDist = curDist;
                    }
                }
            }
            return(minVert);
        }
Ejemplo n.º 6
0
 public void SetSameVertexResult(apVertex vertex)
 {
     _isAnyPointSame = true;
     _overlapVert    = vertex;
     _isCross        = true;
     _posW           = _overlapVert._pos;
 }
        public void Link(apModifiedMesh modifiedMesh, apMesh mesh, apVertex vertex)
        {
            _modifiedMesh = modifiedMesh;
            _mesh         = mesh;
            _vertex       = vertex;
            if (_vertex != null)
            {
                _vertIndex = _vertex._index;
            }
            else
            {
                _vertIndex = -1;
            }

            _renderVertex = null;
            if (modifiedMesh._renderUnit != null && _vertex != null)
            {
                _renderVertex = modifiedMesh._renderUnit._renderVerts.Find(delegate(apRenderVertex a)
                {
                    return(a._vertex == _vertex);
                });
            }

            if (_physicParam == null)
            {
                _physicParam = new apPhysicsVertParam();
            }

            _physicParam.Link(modifiedMesh, this);

            RefreshModMeshAndWeights(_modifiedMesh);
        }
Ejemplo n.º 8
0
        public void SetVertices(apVertex vert1, apVertex vert2, apVertex vert3)
        {
            Vector3 normal = Vector3.Cross((vert2._pos - vert1._pos),
                                           (vert3._pos - vert1._pos));

            if (normal.z > 0)
            {
                _vertIDs[0] = vert3._uniqueID;
                _vertIDs[1] = vert2._uniqueID;
                _vertIDs[2] = vert1._uniqueID;

                _verts[0] = vert3;
                _verts[1] = vert2;
                _verts[2] = vert1;
            }
            else
            {
                _vertIDs[0] = vert1._uniqueID;
                _vertIDs[1] = vert2._uniqueID;
                _vertIDs[2] = vert3._uniqueID;

                _verts[0] = vert1;
                _verts[1] = vert2;
                _verts[2] = vert3;
            }
        }
Ejemplo n.º 9
0
        // Select
        public apGizmos.SelectResult Select__MeshTRS(Vector2 mousePosGL, Vector2 mousePosW, int btnIndex, apGizmos.SELECT_TYPE selectType)
        {
            if (Editor.Select.SelectionType != apSelection.SELECTION_TYPE.Mesh ||
                Editor.Select.Mesh == null ||
                Editor.Select.Mesh.LinkedTextureData == null ||
                Editor.Select.Mesh.LinkedTextureData._image == null ||
                Editor._meshEditMode != apEditor.MESH_EDIT_MODE.MakeMesh ||
                Editor._meshEditeMode_MakeMesh != apEditor.MESH_EDIT_MODE_MAKEMESH.TRS)
            {
                return(null);
            }

            apMesh mesh = Editor.Select.Mesh;
            //Vector2 imageHalfOffset = new Vector2(mesh.LinkedTextureData._width * 0.5f, mesh.LinkedTextureData._height * 0.5f);
            List <apVertex> vertices = mesh._vertexData;

            if (vertices.Count == 0)
            {
                return(null);
            }

            List <apVertex> tmpVertex = null;

            apVertex curVert = null;

            for (int iVert = 0; iVert < vertices.Count; iVert++)
            {
                curVert = vertices[iVert];

                //클릭할 수 있는가
                //if (Editor.Controller.IsVertexClickable(apGL.World2GL(curVert._pos - (mesh._offsetPos + imageHalfOffset)), mousePosGL))
                if (Editor.Controller.IsVertexClickable(apGL.World2GL(curVert._pos - (mesh._offsetPos)), mousePosGL))
                {
                    //일단 리스트에 추가
                    if (tmpVertex == null)
                    {
                        tmpVertex = new List <apVertex>();
                    }
                    tmpVertex.Add(curVert);

                    if (selectType == apGizmos.SELECT_TYPE.New)
                    {
                        //New인 경우에는 1개만 체크한다.
                        break;
                    }
                }
            }
            if (tmpVertex != null)
            {
                Editor.VertController.SelectVertices(tmpVertex, selectType);
                Editor.SetRepaint();
            }
            else if (selectType == apGizmos.SELECT_TYPE.New)
            {
                Editor.VertController.UnselectVertex();
                Editor.SetRepaint();
            }

            return(apGizmos.SelectResult.Main.SetMultiple <apVertex>(Editor.VertController.Vertices));
        }
Ejemplo n.º 10
0
        // Scale
        public void Scale__MeshTRS(Vector2 deltaScaleW, bool isFirstScale)
        {
            if (Editor.Select.SelectionType != apSelection.SELECTION_TYPE.Mesh ||
                Editor.Select.Mesh == null ||
                Editor.Select.Mesh.LinkedTextureData == null ||
                Editor.Select.Mesh.LinkedTextureData._image == null ||
                Editor._meshEditMode != apEditor.MESH_EDIT_MODE.MakeMesh ||
                Editor._meshEditeMode_MakeMesh != apEditor.MESH_EDIT_MODE_MAKEMESH.TRS)
            {
                return;
            }

            apMesh mesh = Editor.Select.Mesh;
            //Vector2 imageHalfOffset = new Vector2(mesh.LinkedTextureData._width * 0.5f, mesh.LinkedTextureData._height * 0.5f);
            List <apVertex> vertices         = mesh._vertexData;
            List <apVertex> selectedVertices = Editor.VertController.Vertices;

            if (vertices.Count == 0 || selectedVertices.Count == 0)
            {
                return;
            }

            if (isFirstScale)
            {
                apEditorUtil.SetRecord_Mesh(apUndoGroupData.ACTION.MeshEdit_EditVertex, Editor, mesh, mesh, true);
            }

            apVertex curVert   = null;
            Vector2  centerPos = Vector2.zero;

            for (int i = 0; i < selectedVertices.Count; i++)
            {
                curVert    = selectedVertices[i];
                centerPos += curVert._pos - mesh._offsetPos;
            }
            centerPos /= selectedVertices.Count;

            Vector2 scale = new Vector2(1.0f + deltaScaleW.x, 1.0f + deltaScaleW.y);

            apMatrix3x3 matrix_Rotate = apMatrix3x3.TRS(centerPos, 0, Vector2.one)
                                        * apMatrix3x3.TRS(Vector2.zero, 0.0f, scale)
                                        * apMatrix3x3.TRS(-centerPos, 0, Vector2.one);

            Vector2 posW = Vector2.zero;

            for (int i = 0; i < selectedVertices.Count; i++)
            {
                curVert      = selectedVertices[i];
                posW         = curVert._pos - (mesh._offsetPos);
                posW         = matrix_Rotate.MultiplyPoint(posW);
                curVert._pos = posW + (mesh._offsetPos);
            }

            for (int i = 0; i < selectedVertices.Count; i++)
            {
                mesh.RefreshVertexAutoUV(selectedVertices[i]);
            }

            Editor.SetRepaint();
        }
Ejemplo n.º 11
0
        public void SelectVertices(List <apVertex> vertices, apGizmos.SELECT_TYPE selectType)
        {
            if (selectType == apGizmos.SELECT_TYPE.New)
            {
                _curVertex = null;
                _curVertices.Clear();
            }

            switch (selectType)
            {
            case apGizmos.SELECT_TYPE.Add:
            case apGizmos.SELECT_TYPE.New:

                for (int i = 0; i < vertices.Count; i++)
                {
                    if (!_curVertices.Contains(vertices[i]))
                    {
                        _curVertices.Add(vertices[i]);
                    }
                }
                break;

            case apGizmos.SELECT_TYPE.Subtract:
                for (int i = 0; i < vertices.Count; i++)
                {
                    if (_curVertices.Contains(vertices[i]))
                    {
                        _curVertices.Remove(vertices[i]);
                    }
                }
                break;
            }

            if (_curVertices.Count > 0)
            {
                if (_curVertex == null || !_curVertices.Contains(_curVertex))
                {
                    _curVertex = _curVertices[0];
                }
            }
            else
            {
                _curVertex = null;
            }



            UnselectNextVertex();

            _isTmpEdgeWire          = false;
            _isTmpEdgeWireCrossEdge = false;
            //_tmpEdgeWire_MousePos = Vector2.zero;
            _isTmpEdgeWireCrossEdge_Multiple = false;
            _tmpEdgeWireMultipleCrossPoints.Clear();
            //_isTmpEdgeWire_SnapToEdge = false;
            //_tmpEdgeWire_SnapToEdge = Vector2.zero;

            _curPolygon = null;
        }
        public void Init(int vertUniqueID, apVertex vertex)
        {
            _vertexUniqueID = vertUniqueID;
            _vertex         = vertex;
            _deltaPos       = Vector2.zero;

            _vertIndex = _vertex._index;
        }
Ejemplo n.º 13
0
        public void Init(int vertUniqueID, apVertex vertex)
        {
            _vertexUniqueID = vertUniqueID;
            _vertex         = vertex;
            _vertIndex      = _vertex._index;

            ResetWeightTable();
        }
Ejemplo n.º 14
0
            //Weight 들
            //public float _volumeWeight = 0.0f;//양각 Weight (0~1)
            //public float _physicsWeight = -1.0f;//물리 Weight (-1 / 0~1)

            public CopiedVertexData(apVertex src)
            {
                _index    = src._index;
                _uniqueID = src._uniqueID;
                _pos      = src._pos;
                _uv       = src._uv;
                //_volumeWeight = src._volumeWeight;
                //_physicsWeight = src._physicsWeight;
            }
Ejemplo n.º 15
0
            public static CloneVertex MakeMirrorPoint(apVertex srcVert, Vector2 pos, int compare)
            {
                CloneVertex newCVert = new CloneVertex();

                newCVert._srcVert         = srcVert;
                newCVert._pos             = pos;
                newCVert._compareToMirror = compare;
                return(newCVert);
            }
Ejemplo n.º 16
0
        //------------------------------------------------------------------------------------

        // Transform Changed (Pos)
        public void TransformChanged_Position__MeshTRS(Vector2 pos)
        {
            if (Editor.Select.SelectionType != apSelection.SELECTION_TYPE.Mesh ||
                Editor.Select.Mesh == null ||
                Editor.Select.Mesh.LinkedTextureData == null ||
                Editor.Select.Mesh.LinkedTextureData._image == null ||
                Editor._meshEditMode != apEditor.MESH_EDIT_MODE.MakeMesh ||
                Editor._meshEditeMode_MakeMesh != apEditor.MESH_EDIT_MODE_MAKEMESH.TRS)
            {
                return;
            }

            if (Editor.Gizmos.IsFFDMode)
            {
                //FFD 모드에서는 처리가 안된다.
                return;
            }

            apMesh          mesh             = Editor.Select.Mesh;
            List <apVertex> vertices         = mesh._vertexData;
            List <apVertex> selectedVertices = Editor.VertController.Vertices;

            if (vertices.Count == 0 || selectedVertices.Count == 0)
            {
                return;
            }

            apEditorUtil.SetRecord_Mesh(apUndoGroupData.ACTION.MeshEdit_EditVertex, Editor, mesh, mesh, true);

            apVertex curVert   = null;
            Vector2  centerPos = Vector2.zero;

            for (int i = 0; i < selectedVertices.Count; i++)
            {
                curVert    = selectedVertices[i];
                centerPos += curVert._pos - mesh._offsetPos;
            }
            centerPos /= selectedVertices.Count;

            pos -= mesh._offsetPos;

            Vector2 deltaMoveW = pos - centerPos;

            //Debug.Log("Input : " + pos + " / Cur Center : " + centerPos + " >> Delta : " + deltaMoveW);
            for (int i = 0; i < selectedVertices.Count; i++)
            {
                curVert       = selectedVertices[i];
                curVert._pos += deltaMoveW;
            }

            for (int i = 0; i < selectedVertices.Count; i++)
            {
                mesh.RefreshVertexAutoUV(selectedVertices[i]);
            }

            Editor.SetRepaint();
        }
Ejemplo n.º 17
0
 public apMeshEdge(apVertex vert1, apVertex vert2)
 {
     _vertID_1  = vert1._uniqueID;
     _vertID_2  = vert2._uniqueID;
     _vert1     = vert1;
     _vert2     = vert2;
     _isHidden  = false;
     _isOutline = false;
 }
Ejemplo n.º 18
0
            public void Init()
            {
                _isCross = false;
                _posW    = Vector2.zero;

                _isAnyPointSame = false;
                _overlapVert    = null;
                _isSameLine     = false;
            }
Ejemplo n.º 19
0
        public void Init()
        {
            _mesh       = null;
            _curVertex  = null;
            _curPolygon = null;

            _nextVertex           = null;
            _isTmpEdgeWire        = false;
            _tmpEdgeWire_MousePos = Vector2.zero;
        }
Ejemplo n.º 20
0
            public static CloneVertex MakePointOnAxis(apVertex srcVert)
            {
                CloneVertex newCVert = new CloneVertex();

                newCVert._srcVert         = srcVert;
                newCVert._pos             = srcVert._pos;
                newCVert._isOnAxis        = true;
                newCVert._compareToMirror = 0;
                return(newCVert);
            }
Ejemplo n.º 21
0
        /// <summary>
        /// IsEdgeCross의 "적당히" 더 검사를 하는 함수.
        /// 유사한 Edge가 있으면 충돌식이 False라 하더라도 True를 리턴한다.
        /// </summary>
        /// <param name="vert1_A"></param>
        /// <param name="vert1_B"></param>
        /// <param name="vert2_A"></param>
        /// <param name="vert2_B"></param>
        /// <returns></returns>
        public static bool IsEdgeCrossApprox(apVertex vert1_A, apVertex vert1_B, apVertex vert2_A, apVertex vert2_B)
        {
            if (IsEdgeCross(vert1_A, vert1_B, vert2_A, vert2_B))
            {
                return(true);
            }
            Vector2 v1_A = vert1_A._pos;
            Vector2 v1_B = vert1_B._pos;
            Vector2 v2_A = vert2_A._pos;
            Vector2 v2_B = vert2_B._pos;

            float bias    = 4f;
            float biasSqr = bias * bias;

            //1. [시작-끝] 좌표가 유사하면 교차
            if ((v1_A - v2_A).sqrMagnitude < biasSqr ||
                (v1_A - v2_B).sqrMagnitude < biasSqr ||
                (v1_B - v2_A).sqrMagnitude < biasSqr ||
                (v1_B - v2_B).sqrMagnitude < biasSqr
                )
            {
                return(true);
            }

            //2. [내부의 점]이 서로 유사하다면 교차
            int nPoints_Line1 = (int)((v1_A - v1_B).magnitude / (bias)) + 1;
            int nPoints_Line2 = (int)((v2_A - v2_B).magnitude / (bias)) + 1;

            Vector2[] points_Line1 = new Vector2[nPoints_Line1];
            Vector2[] points_Line2 = new Vector2[nPoints_Line2];

            for (int i = 0; i < nPoints_Line1; i++)
            {
                points_Line1[i] = v1_A + (((v1_B - v1_A) / (nPoints_Line1 - 1)) * (i));
            }
            for (int i = 0; i < nPoints_Line2; i++)
            {
                points_Line2[i] = v2_A + (((v2_B - v2_A) / (nPoints_Line2 - 1)) * (i));
            }

            //다 체크해봅시다.
            for (int iPoint1 = 0; iPoint1 < nPoints_Line1; iPoint1++)
            {
                for (int iPoint2 = 0; iPoint2 < nPoints_Line2; iPoint2++)
                {
                    if ((points_Line1[iPoint1] - points_Line2[iPoint2]).magnitude <= bias)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 22
0
 // Get / Set
 //------------------------------------------
 public apModifiedVertexWeight GetVertexWeight(apVertex vertex)
 {
     if (vertex == null)
     {
         return(null);
     }
     return(_vertWeights.Find(delegate(apModifiedVertexWeight a)
     {
         return a._vertexUniqueID == vertex._uniqueID;
     }));
 }
Ejemplo n.º 23
0
        //-----------------------------------------------------------------------------------------

        // Pivot
        public apGizmos.TransformParam PivotReturn__MeshTRS()
        {
            if (Editor.Select.SelectionType != apSelection.SELECTION_TYPE.Mesh ||
                Editor.Select.Mesh == null ||
                Editor.Select.Mesh.LinkedTextureData == null ||
                Editor.Select.Mesh.LinkedTextureData._image == null ||
                Editor._meshEditMode != apEditor.MESH_EDIT_MODE.MakeMesh ||
                Editor._meshEditeMode_MakeMesh != apEditor.MESH_EDIT_MODE_MAKEMESH.TRS)
            {
                return(null);
            }
            if (Editor.VertController.Vertex == null)
            {
                return(null);
            }

            apMesh mesh = Editor.Select.Mesh;

            //Vector2 imageHalfOffset = new Vector2(mesh.LinkedTextureData._width * 0.5f, mesh.LinkedTextureData._height * 0.5f);

            if (Editor.VertController.Vertices.Count == 1)
            {
                //1개 선택되었다.
                apVertex vert = Editor.VertController.Vertices[0];

                return(apGizmos.TransformParam.Make(vert._pos - (mesh._offsetPos),
                                                    0.0f, Vector2.one, 0, Color.black,
                                                    true,
                                                    apMatrix3x3.identity,
                                                    false,
                                                    apGizmos.TRANSFORM_UI.Position2D, vert._pos, 0.0f, Vector2.one));
            }
            else if (Editor.VertController.Vertices.Count > 1)
            {
                apVertex vert      = null;
                Vector2  centerPos = Vector2.zero;
                int      nVert     = Editor.VertController.Vertices.Count;
                for (int i = 0; i < Editor.VertController.Vertices.Count; i++)
                {
                    vert       = Editor.VertController.Vertices[i];
                    centerPos += vert._pos;
                }

                centerPos /= nVert;

                return(apGizmos.TransformParam.Make(centerPos - mesh._offsetPos,
                                                    0.0f, Vector2.one, 0, Color.black,
                                                    true,
                                                    apMatrix3x3.identity,
                                                    true,
                                                    apGizmos.TRANSFORM_UI.Position2D | apGizmos.TRANSFORM_UI.Vertex_Transform, centerPos, 0.0f, Vector2.one));
            }
            return(null);
        }
Ejemplo n.º 24
0
            private CloneVertex()
            {
                _srcVert       = null;
                _pos           = Vector2.zero;
                _isCrossOnAxis = false;                //<<축에서 반전되기 위해서 생성된 점 (이게 True일 때에는 srcVert가 없다)

                _linkedCloneVerts.Clear();
                _linkedSrcVerts.Clear();

                //인덱스 증가
                _index = s_index;
                s_index++;
            }
Ejemplo n.º 25
0
            public LinkedVertex(apVertex vertex, int level)
            {
                _vertex       = vertex;
                _vertUniqueID = vertex._uniqueID;

                _modVertWeight = null;

                _deltaPosLocalLinkToTarget = Vector2.zero;
                _distLocal  = 0.0f;
                _distWeight = 0.0f;

                _level = level;
            }
Ejemplo n.º 26
0
        public void SelectPolygon(apMeshPolygon polygon)
        {
            _curPolygon = polygon;

            _curVertex = null;

            UnselectNextVertex();

            _isTmpEdgeWire                   = false;
            _isTmpEdgeWireCrossEdge          = false;
            _tmpEdgeWire_MousePos            = Vector2.zero;
            _isTmpEdgeWireCrossEdge_Multiple = false;
            _tmpEdgeWireMultipleCrossPoints.Clear();
        }
Ejemplo n.º 27
0
        public void SelectVertex(apVertex vertex)
        {
            _curVertex = vertex;

            UnselectNextVertex();

            _isTmpEdgeWire                   = false;
            _isTmpEdgeWireCrossEdge          = false;
            _tmpEdgeWire_MousePos            = Vector2.zero;
            _isTmpEdgeWireCrossEdge_Multiple = false;
            _tmpEdgeWireMultipleCrossPoints.Clear();

            _curPolygon = null;
        }
Ejemplo n.º 28
0
        public void RemoveMirrorVertex(apVertex removedVertex, apMesh mesh, bool isShift)
        {
            ClearMovedVertex();
            if (removedVertex == null)
            {
                return;
            }
            Vector2  mirrorPos           = GetMirrorPosByMesh(removedVertex._pos, mesh);
            apVertex removableMirrorVert = FindNearestVertex(mirrorPos, mesh, 2.0f, removedVertex);            //<<아주 좁은 범위

            if (removableMirrorVert != null)
            {
                mesh.RemoveVertex(removableMirrorVert, isShift);
            }
        }
Ejemplo n.º 29
0
        //--------------------------------------------------------------------------
        public apGizmos.SelectResult MultipleSelect__MeshEdit_Modify(Vector2 mousePosGL_Min, Vector2 mousePosGL_Max, Vector2 mousePosW_Min, Vector2 mousePosW_Max, apGizmos.SELECT_TYPE areaSelectType)
        {
            if (Editor.Select.Mesh == null || Editor._meshEditMode != apEditor.MESH_EDIT_MODE.Modify)
            {
                return(null);
            }

            Vector2 meshOffset = Editor.Select.Mesh._offsetPos;

            List <apVertex> vertices         = Editor.Select.Mesh._vertexData;
            List <apVertex> selectedVertices = new List <apVertex>();
            apVertex        vert             = null;
            Vector2         vPosW            = Vector2.zero;


            for (int i = 0; i < vertices.Count; i++)
            {
                vert  = vertices[i];
                vPosW = vert._pos - meshOffset;

                Vector2 vertPosGL = apGL.World2GL(vPosW);

                bool isSelectable = (mousePosGL_Min.x < vertPosGL.x && vertPosGL.x < mousePosGL_Max.x) &&
                                    (mousePosGL_Min.y < vertPosGL.y && vertPosGL.y < mousePosGL_Max.y);
                if (isSelectable)
                {
                    selectedVertices.Add(vert);
                }
            }

            Editor.VertController.SelectVertices(selectedVertices, areaSelectType);

            Editor.SetRepaint();

            if (Editor.VertController.Vertices.Count == 0)
            {
                return(null);
            }

            if (Editor.VertController.Vertices.Count == 1)
            {
                return(apGizmos.SelectResult.Main.SetSingle(Editor.VertController.Vertex));
            }
            else
            {
                return(apGizmos.SelectResult.Main.SetMultiple <apVertex>(Editor.VertController.Vertices));
            }
        }
Ejemplo n.º 30
0
        public apGizmos.SelectResult Select__MeshEdit_Modify(Vector2 mousePosGL, Vector2 mousePosW, int btnIndex, apGizmos.SELECT_TYPE selectType)
        {
            if (Editor.Select.Mesh == null || Editor._meshEditMode != apEditor.MESH_EDIT_MODE.Modify)
            {
                return(null);
            }

            Vector2 meshOffset = Editor.Select.Mesh._offsetPos;

            if (Editor.Controller.IsMouseInGUI(mousePosGL))
            {
                List <apVertex> vertices         = Editor.Select.Mesh._vertexData;
                List <apVertex> selectedVertices = new List <apVertex>();
                apVertex        vert             = null;
                Vector2         vPosW            = Vector2.zero;
                for (int i = 0; i < vertices.Count; i++)
                {
                    vert  = vertices[i];
                    vPosW = vert._pos - meshOffset;

                    Vector2 vertPosGL = apGL.World2GL(vPosW);

                    if (Editor.Controller.IsVertexClickable(vertPosGL, mousePosGL))
                    {
                        selectedVertices.Add(vert);
                    }
                }

                Editor.VertController.SelectVertices(selectedVertices, selectType);

                Editor.SetRepaint();
            }

            if (Editor.VertController.Vertices.Count == 0)
            {
                return(null);
            }

            if (Editor.VertController.Vertices.Count == 1)
            {
                return(apGizmos.SelectResult.Main.SetSingle(Editor.VertController.Vertex));
            }
            else
            {
                return(apGizmos.SelectResult.Main.SetMultiple <apVertex>(Editor.VertController.Vertices));
            }
        }