コード例 #1
0
        public void Do(MeshGenerationContext context)
        {
            int count = this.edgeCount;

            if (count < 0)
            {
                count = context.edges.Count;
            }
            if (count > context.edges.Count)
            {
                count = context.edges.Count;
            }
            int startEdgeIndex = context.edges.Count - count;

            if (startEdgeIndex < 0)
            {
                startEdgeIndex = 0;
            }

            var startMeshIndex = context.mesh.vertexes.Count;

            for (int i = 0; i < count; i++)
            {
                startMeshIndex -= context.edges[startEdgeIndex + i].polyShape.Count;
            }

            for (int i = 0; i < count; i++)
            {
                var edge = context.edges[startEdgeIndex + i];
                Do(context.mesh, startMeshIndex, context.polyShape.Count, context.polyShape);
                startMeshIndex += context.polyShape.Count;
            }
        }
コード例 #2
0
            public void Do(MeshGenerationContext contex)
            {
                if (UVPositions == null || UVPositions.Length == 0 || !contex.HasAnyEdge)
                {
                    return;
                }
                var   a = contex.LatestEdge.polyShape.Path;
                float textureSegmentCount = Mathf.Round(contex.LatestEdge.polyShape.Length * texturesPerUnit);
                float lastEdgeLength      = contex.LatestEdge.polyShape.Length;

                var startIndex = contex.mesh.vertexes.Count;

                for (int i = 0; i < UVPositions.Length; i++)
                {
                    var uvPos     = UVPositions[UVPositions.Length - 1 - i];
                    var polyShape = contex.edges[contex.edges.Count - i - 1].polyShape;
                    startIndex -= polyShape.Count;
                    var factor = polyShape.Length / lastEdgeLength;
                    var path   = polyShape.Path;
                    for (int j = 0; j < polyShape.Count; j++)
                    {
                        contex.mesh.SetUV(j + startIndex, new Vector2(path[j] / lastEdgeLength * textureSegmentCount * factor, uvPos));
                        // contex.mesh.SetColor(j + startIndex, Color.Lerp(Color.blue, Color.red, path[j] / lastEdgeLength));
                    }
                }
            }
コード例 #3
0
 public void Do(MeshGenerationContext contex)
 {
     for (int i = 0; i < contex.polyShape.Count; i++)
     {
         contex.mesh.AddVertex(contex.polyShape.positions[i]);
     }
     contex.edges.Add(new EdgeInfo()
     {
         polyShape = contex.polyShape
     });
 }
コード例 #4
0
            public void Do(MeshGenerationContext context)
            {
                if (!context.HasAnyEdge)
                {
                    return;
                }
                int start     = context.LatestEdgeStartVertexIndex;
                var polyShape = context.LatestEdge.polyShape;
                int count     = polyShape.Count;
                var mesh      = context.mesh;

                for (int i = 0; i < count; i++)
                {
                    mesh.AddVertex(mesh.vertexes[start + i]);
                }
                context.edges.Add(context.LatestEdge);
            }
コード例 #5
0
ファイル: MGNodeSet.cs プロジェクト: medvedya/UShape
 public void Do(MeshGenerationContext contex)
 {
     for (int i = 0; i < map.Count; i++)
     {
         var item = map[i];
         if (item.enabled)
         {
             var nd = GetNodeCollection(item.typeCode);
             if (item.refIndex < nd.Count)
             {
                 nd[item.refIndex].Do(contex);
             }
             else
             {
                 // Debug.LogWarning("miss");
             }
         }
     }
 }