/* Triangulate Open Water */
        private void TriangulateOpenWater(HexDirection direction, HexCell cell, HexCell neighbor, Vector3 center)
        {
            Vector3 c1 = center + (HexMeshUtility.GetCornerA(direction) * HexMeshUtility.SolidPercent);
            Vector3 c2 = center + (HexMeshUtility.GetCornerB(direction) * HexMeshUtility.SolidPercent);

            m_waterMesh.AddTriangle(center, c1, c2);

            if (direction <= HexDirection.BottomRight)
            {
                Vector3 bridge = HexMeshUtility.GetBridgeSimple(direction);
                Vector3 e1     = c1 + bridge;
                Vector3 e2     = c2 + bridge;

                m_waterMesh.AddQuad(c1, c2, e1, e2);

                if (direction <= HexDirection.Right)
                {
                    HexCell nextNeighbor = cell.GetNeighbor(direction.Next());
                    if (nextNeighbor == null || !nextNeighbor.IsUnderwater)
                    {
                        return;
                    }
                    m_waterMesh.AddTriangle(c2, e2, c2 + HexMeshUtility.GetBridgeSimple(direction.Next()));
                }
            }
        }
        /* Triangulate Shore */
        private void TriangulateWaterShore(HexDirection direction, HexCell cell, HexCell neighbor, Vector3 center)
        {
            Vector3 c1 = center + (HexMeshUtility.GetCornerA(direction) * HexMeshUtility.SolidPercent);
            Vector3 c2 = center + (HexMeshUtility.GetCornerB(direction) * HexMeshUtility.SolidPercent);

            HexEdgeVertices e1 = new HexEdgeVertices(c1, c2);

            m_waterMesh.AddTriangle(center, e1.v1, e1.v2);
            m_waterMesh.AddTriangle(center, e1.v2, e1.v3);
            m_waterMesh.AddTriangle(center, e1.v3, e1.v4);
            m_waterMesh.AddTriangle(center, e1.v4, e1.v5);

            Vector3         bridge = HexMeshUtility.GetBridgeSimple(direction);
            HexEdgeVertices e2     = new HexEdgeVertices(e1.v1 + bridge, e1.v5 + bridge);

            m_waterShoreMesh.AddQuad(e1.v1, e1.v2, e2.v1, e2.v2);
            m_waterShoreMesh.AddQuad(e1.v2, e1.v3, e2.v2, e2.v3);
            m_waterShoreMesh.AddQuad(e1.v3, e1.v4, e2.v3, e2.v4);
            m_waterShoreMesh.AddQuad(e1.v4, e1.v5, e2.v4, e2.v5);

            m_waterShoreMesh.AddQuadUV(0f, 0f, 0f, 1f);
            m_waterShoreMesh.AddQuadUV(0f, 0f, 0f, 1f);
            m_waterShoreMesh.AddQuadUV(0f, 0f, 0f, 1f);
            m_waterShoreMesh.AddQuadUV(0f, 0f, 0f, 1f);

            HexCell nextNeighbor = cell.GetNeighbor(direction.Next());

            if (nextNeighbor != null)
            {
                m_waterShoreMesh.AddTriangle(e1.v5, e2.v5, c2 + HexMeshUtility.GetBridgeSimple(direction.Next()));
                m_waterShoreMesh.AddTriangleUV(new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, nextNeighbor.IsUnderwater ? 0f : 1f));
            }
        }
        /* Construct fused blending regions with terraces */
        private void TriangulateSimpleWithTerraces(ref HexCell cell, HexDirection direction)
        {
            // Construct Triangle
            Vector3 center = cell.Center;
            Vector3 v1     = center + (HexMeshUtility.GetCornerA(direction) * HexMeshUtility.SolidPercent);
            Vector3 v2     = center + (HexMeshUtility.GetCornerB(direction) * HexMeshUtility.SolidPercent);

            m_terrainMesh.AddTriangle(center, v1, v2);


            if (HexMeshUtility.UseTextures)
            {
                m_terrainMesh.AddTriangleColor(m_red);              // Set splatmap colors
                AddTriangleTerrainType(cell.TerrainTypeIndex);
            }
            else
            {
                m_terrainMesh.AddTriangleColor(cell.Color);
            }


            // Create connection
            if (direction <= HexDirection.BottomRight)
            {
                HexCell neighbor = cell.GetNeighbor(direction);
                if (neighbor != null)
                {
                    // Create quad
                    Vector3 bridge = HexMeshUtility.GetBridgeSimple(direction);
                    Vector3 v3     = v1 + bridge;
                    Vector3 v4     = v2 + bridge;
                    v3.y = v4.y = neighbor.Elevation * HexMeshUtility.ElevationStep;

                    if (cell.GetEdgeType(direction) == HexEdgeType.Slope)
                    {
                        TriangulateEdgeTerraces(v1, v2, cell, v3, v4, neighbor);
                    }
                    else
                    {
                        m_terrainMesh.AddQuad(v1, v2, v3, v4);

                        if (HexMeshUtility.UseTextures)
                        {
                            m_terrainMesh.AddQuadColor(m_red, m_green);
                            AddQuadType(cell.TerrainTypeIndex, neighbor.TerrainTypeIndex);
                        }
                        else
                        {
                            m_terrainMesh.AddQuadColor(cell.Color, neighbor.Color);
                        }
                    }


                    // Create triangular connection
                    HexCell nextNeighbor = cell.GetNeighbor(direction.Next());
                    if (direction <= HexDirection.Right && nextNeighbor != null)
                    {
                        Vector3 v5 = v2 + HexMeshUtility.GetBridgeSimple(direction.Next());
                        v5.y = nextNeighbor.Elevation * HexMeshUtility.ElevationStep;


                        if (cell.Elevation <= neighbor.Elevation)
                        {
                            if (cell.Elevation <= nextNeighbor.Elevation)
                            {
                                TriangulateCorner(v2, cell, v4, neighbor, v5, nextNeighbor);
                            }
                            else
                            {
                                TriangulateCorner(v5, nextNeighbor, v2, cell, v4, neighbor);
                            }
                        }
                        else if (neighbor.Elevation <= nextNeighbor.Elevation)
                        {
                            TriangulateCorner(v4, neighbor, v5, nextNeighbor, v2, cell);
                        }
                        else
                        {
                            TriangulateCorner(v5, nextNeighbor, v2, cell, v4, neighbor);
                        }
                    }
                }
            }
        }