Beispiel #1
0
        [OvldGenCallTarget] static void Polygon_Internal(PolygonPath path,
                                                         [OvldDefault(nameof(PolygonTriangulation))] PolygonTriangulation triangulation,
                                                         [OvldDefault(nameof(Color))] Color color)
        {
            if (path.EnsureMeshIsReadyToRender(triangulation, out Mesh mesh) == false)
            {
                return;                 // no points defined in the mesh
            }
            switch (path.Count)
            {
            case 0:
                Debug.LogWarning("Tried to draw polygon with no points");
                return;

            case 1:
                Debug.LogWarning("Tried to draw polygon with only one point");
                return;

            case 2:
                Debug.LogWarning("Tried to draw polygon with only two points");
                return;
            }

            if (DrawCommand.IsAddingDrawCommandsToBuffer)              // mark as used by this command to prevent destroy in dispose
            {
                path.RegisterToCommandBuffer(DrawCommand.CurrentWritingCommandBuffer);
            }

            using (new IMDrawer(mpbPolygon, ShapesMaterialUtils.matPolygon[Draw.BlendMode], mesh)) {
                MetaMpb.ApplyColorOrFill(mpbPolygon, color);
            }
        }
Beispiel #2
0
        [OvldGenCallTarget] public static void Polygon([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                                       PolygonPath path,
                                                       [OvldDefault(nameof(PolygonTriangulation))] PolygonTriangulation triangulation,
                                                       [OvldDefault(nameof(Color))] Color color,
                                                       [OvldDefault(nameof(PolygonShapeFill))] ShapeFill fill)
        {
            if (path.EnsureMeshIsReadyToRender(triangulation, out Mesh mesh) == false)
            {
                return;                 // no points defined in the mesh
            }
            switch (path.Count)
            {
            case 0:
                Debug.LogWarning("Tried to draw polygon with no points");
                return;

            case 1:
                Debug.LogWarning("Tried to draw polygon with only one point");
                return;

            case 2:
                Debug.LogWarning("Tried to draw polygon with only two points");
                return;
            }

            Material matPolygon = ShapesMaterialUtils.matPolygon[blendMode];

            ApplyGlobalProperties(matPolygon);
            TryApplyFillAndColor(matPolygon, fill, color);
            DrawMesh(Vector3.zero, Quaternion.identity, mesh, matPolygon);
        }
Beispiel #3
0
        [OvldGenCallTarget] static void Polygon([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                                PolygonPath path,
                                                [OvldDefault(nameof(PolygonTriangulation))] PolygonTriangulation triangulation,
                                                [OvldDefault(nameof(Color))] Color color,
                                                [OvldDefault(nameof(PolygonShapeFill))] ShapeFill fill)
        {
            if (path.EnsureMeshIsReadyToRender(triangulation, out Mesh mesh) == false)
            {
                return;                 // no points defined in the mesh
            }
            switch (path.Count)
            {
            case 0:
                Debug.LogWarning("Tried to draw polygon with no points");
                return;

            case 1:
                Debug.LogWarning("Tried to draw polygon with only one point");
                return;

            case 2:
                Debug.LogWarning("Tried to draw polygon with only two points");
                return;
            }

            using (new IMDrawer(mpbPolygon, ShapesMaterialUtils.matPolygon[blendMode], mesh)) {
                MetaMpb.ApplyColorOrFill(mpbPolygon, fill, color);
            }
        }