void TriangulateCornerTerraces( Vector3 begin, HexCell beginCell, Vector3 left, HexCell leftCell, Vector3 right, HexCell rightCell ) { Vector3 v3 = HecMetrics.TerraceLerp(begin, left, 1); Vector3 v4 = HecMetrics.TerraceLerp(begin, right, 1); Color c3 = HecMetrics.TerranceLerp(beginCell.Color, leftCell.Color, 1); Color c4 = HecMetrics.TerranceLerp(beginCell.Color, rightCell.Color, 1); AddTriangle(begin, v3, v4); AddTriangleColor(beginCell.Color, c3, c4); for (int i = 2; i < HecMetrics.terraceSteps; i++) { Vector3 v1 = v3; Vector3 v2 = v4; Color c1 = c3; Color c2 = c4; v3 = HecMetrics.TerraceLerp(begin, left, i); v4 = HecMetrics.TerraceLerp(begin, right, i); c3 = HecMetrics.TerranceLerp(beginCell.Color, leftCell.Color, i); c4 = HecMetrics.TerranceLerp(beginCell.Color, rightCell.Color, i); AddQuad(v1, v2, v3, v4); AddQuadColor(c1, c2, c3, c4); } AddQuad(v3, v4, left, right); AddQuadColor(c3, c4, leftCell.Color, rightCell.Color); }
void TriangulateBoundaryTriangle( Vector3 begin, HexCell beginCell, Vector3 left, HexCell leftCell, Vector3 boundary, Color boundaryColor ) { Vector3 v2 = Perturb(HecMetrics.TerraceLerp(begin, left, 1)); Color c2 = HecMetrics.TerranceLerp(beginCell.Color, leftCell.Color, 1); AddTriangleUnperturbed(Perturb(begin), v2, boundary); AddTriangleColor(beginCell.Color, c2, boundaryColor); for (int i = 2; i < HecMetrics.terraceSteps; i++) { Vector3 v1 = v2; Color c1 = c2; v2 = Perturb(HecMetrics.TerraceLerp(begin, left, i)); c2 = HecMetrics.TerranceLerp(beginCell.Color, leftCell.Color, i); AddTriangleUnperturbed(v1, v2, boundary); AddTriangleColor(c1, c2, boundaryColor); } AddTriangleUnperturbed(v2, Perturb(left), boundary); AddTriangleColor(c2, leftCell.Color, boundaryColor); }
public static EdgeVertices TerraceLerp( EdgeVertices a, EdgeVertices b, int step) { EdgeVertices result; result.v1 = HecMetrics.TerraceLerp(a.v1, b.v1, step); result.v2 = HecMetrics.TerraceLerp(a.v2, b.v2, step); result.v3 = HecMetrics.TerraceLerp(a.v3, b.v3, step); result.v4 = HecMetrics.TerraceLerp(a.v4, b.v4, step); return(result); }