void Triangulate(HexDirection direction, HexCell cell) { Vector3 center = cell.Position; Vector3 v1 = center + HexMetrics.GetFirstInnerCorner(direction); Vector3 v2 = center + HexMetrics.GetSecondInnerCorner(direction); Vector3 v1OuterBump = center + HexMetrics.GetFirstBumpOuterCorner(direction); Vector3 v2OuterBump = center + HexMetrics.GetSecondBumpOuterCorner(direction); Vector3 indices; indices.x = indices.y = indices.z = cell.Index; terrain.AddTriangle(center, v1, v2); terrain.AddTriangleCellData(indices, weights1); terrain.AddQuad(v1, v2, v1OuterBump, v2OuterBump); if (cell.IsUnderwater) { terrain.AddQuadCellData(indices, weights1, weights1); } else { terrain.AddQuadCellData(indices, terrainColorBump, terrainColorBump); } if (direction <= HexDirection.SE) { TriangulateConnection(direction, cell, v1OuterBump, v2OuterBump); } if (cell.IsUnderwater) { TriangulateWater(direction, cell, center); } if (!cell.IsUnderwater) { features.AddFeature(cell, (center + v1 + v2) * (1f / 3f)); } }