Exemplo n.º 1
0
        public void GiveLineUniqueVerticesRefreshTriangleListing(LineData ld)
        {
            var trs = ld.GetAllTriangles();

            if (trs.Count != 2)
            {
                return;
            }

            ld.points[0].meshPoint.smoothNormal = true;
            ld.points[1].meshPoint.smoothNormal = true;

            trs[0].GiveUniqueVerticesAgainst(trs[1]);
            RefreshVertexTriangleList();
        }
Exemplo n.º 2
0
        public static void PutEdgeOnLine(LineData ld)
        {
            var vrtA = ld.points[0].meshPoint;
            var vrtB = ld.points[1].meshPoint;

            var tris = ld.GetAllTriangles();

            foreach (var t in tris)
            {
                t.edgeWeight[t.GetIndexOfNoOneIn(ld)] = ShiftInvertedValue;// true;
            }
            var edValA = ShiftInvertedValue;
            var edValB = ShiftInvertedValue;

            if (_editingFlexibleEdge)
            {
                foreach (var uv in vrtA.vertices)
                {
                    foreach (var t in uv.triangles)
                    {
                        var opposite = t.NumberOf(uv);
                        for (var i = 0; i < 3; i++)
                        {
                            if (opposite != i)
                            {
                                edValA = Mathf.Max(edValA, t.edgeWeight[i]);
                            }
                        }
                    }
                }

                foreach (var uv in vrtB.vertices)
                {
                    foreach (var t in uv.triangles)
                    {
                        var opposite = t.NumberOf(uv);
                        for (var i = 0; i < 3; i++)
                        {
                            if (opposite != i)
                            {
                                edValB = Mathf.Max(edValB, t.edgeWeight[i]);
                            }
                        }
                    }
                }
            }

            vrtA.edgeStrength = edValA;
            vrtB.edgeStrength = edValB;

            if (_alsoDoColor)
            {
                var col = GlobalBrush.Color;
                foreach (var uvi in vrtA.vertices)
                {
                    GlobalBrush.mask.SetValuesOn(ref uvi.color, col);
                }
                foreach (var uvi in vrtB.vertices)
                {
                    GlobalBrush.mask.SetValuesOn(ref uvi.color, col);
                }
            }

            EditedMesh.Dirty = true;
        }