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; } }
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)); } } }
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 }); }
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); }
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"); } } } }