private void TriangulateMarshCenter(IHexCell center, HexDirection direction, IHexMesh mesh) { mesh.AddTriangle( center.AbsolutePosition, center.AbsolutePosition + RenderConfig.GetFirstSolidCorner(direction), center.AbsolutePosition + RenderConfig.GetSecondSolidCorner(direction) ); mesh.AddTriangleUV(Vector2.one, Vector2.one, Vector2.one); }
private void TriangulateWaterCenter( IHexCell center, IHexMesh mesh, HexDirection direction, Vector3 localCell, Color centerColor ) { mesh.AddTriangle( localCell, localCell + RenderConfig.GetFirstSolidCorner(direction), localCell + RenderConfig.GetSecondSolidCorner(direction) ); mesh.AddTriangleColor(centerColor); }
private void TriangulateCellWeights_NoRiver( IHexCell center, IHexCell right, HexDirection direction, IHexMesh weightsMesh ) { if (right == null) { weightsMesh.AddTriangle( center.AbsolutePosition, center.AbsolutePosition + RenderConfig.GetFirstCorner(direction), center.AbsolutePosition + RenderConfig.GetSecondCorner(direction) ); weightsMesh.AddTriangleColor(CenterWeights); return; } Vector3 firstEdgeInner = center.AbsolutePosition + RenderConfig.GetFirstSolidCorner(direction); Vector3 secondEdgeInner = center.AbsolutePosition + RenderConfig.GetSecondSolidCorner(direction); //Solid center region weightsMesh.AddTriangle(center.AbsolutePosition, firstEdgeInner, secondEdgeInner); weightsMesh.AddTriangleColor(CenterWeights); Vector3 firstEdgeOuter = (firstEdgeInner + right.AbsolutePosition + RenderConfig.GetSecondSolidCorner(direction.Opposite())) / 2f; Vector3 secondEdgeOuter = (secondEdgeInner + right.AbsolutePosition + RenderConfig.GetFirstSolidCorner(direction.Opposite())) / 2f; //The edge between Center and Right, going up to the dividing line weightsMesh.AddQuad(firstEdgeInner, secondEdgeInner, firstEdgeOuter, secondEdgeOuter); weightsMesh.AddQuadColor(CenterWeights, CenterRightWeights); //Previous corner out to the edge of the cell weightsMesh.AddTriangle(firstEdgeInner, center.AbsolutePosition + RenderConfig.GetFirstCorner(direction), firstEdgeOuter); weightsMesh.AddTriangleColor(CenterWeights, CenterLeftRightWeights, CenterRightWeights); //Next corner out to the edge of the cell weightsMesh.AddTriangle(secondEdgeInner, secondEdgeOuter, center.AbsolutePosition + RenderConfig.GetSecondCorner(direction)); weightsMesh.AddTriangleColor(CenterWeights, CenterRightWeights, CenterRightNextRightWeights); }