Ejemplo n.º 1
0
 [OvldGenCallTarget] static void Triangle_Internal(Vector3 a,
                                                   Vector3 b,
                                                   Vector3 c,
                                                   bool hollow,
                                                   [OvldDefault(nameof(Thickness))] float thickness,
                                                   [OvldDefault("0f")] float roundness,
                                                   [OvldDefault(nameof(Color))] Color colorA,
                                                   [OvldDefault(nameof(Color))] Color colorB,
                                                   [OvldDefault(nameof(Color))] Color colorC)
 {
     using (new IMDrawer(mpbTriangle, ShapesMaterialUtils.matTriangle[Draw.BlendMode], ShapesMeshUtils.TriangleMesh[0])) {
         MetaMpb.ApplyDashSettings(mpbTriangle, thickness);
         mpbTriangle.a.Add(a);
         mpbTriangle.b.Add(b);
         mpbTriangle.c.Add(c);
         mpbTriangle.color.Add(colorA.ColorSpaceAdjusted());
         mpbTriangle.colorB.Add(colorB.ColorSpaceAdjusted());
         mpbTriangle.colorC.Add(colorC.ColorSpaceAdjusted());
         mpbTriangle.roundness.Add(roundness);
         mpbTriangle.hollow.Add(hollow.AsInt());
         mpbTriangle.thicknessSpace.Add((int)Draw.ThicknessSpace);
         mpbTriangle.thickness.Add(thickness);
         mpbTriangle.scaleMode.Add((int)ScaleMode);
     }
 }
Ejemplo n.º 2
0
        [OvldGenCallTarget] static void Rectangle_Internal([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                                           [OvldDefault("false")] bool hollow,
                                                           Rect rect,
                                                           [OvldDefault(nameof(Color))] Color color,
                                                           [OvldDefault(nameof(Thickness))] float thickness,
                                                           [OvldDefault("default")] Vector4 cornerRadii)
        {
            bool rounded = ShapesMath.MaxComp(cornerRadii) >= 0.0001f;

            // positive vibes only
            if (rect.width < 0)
            {
                rect.x -= rect.width *= -1;
            }
            if (rect.height < 0)
            {
                rect.y -= rect.height *= -1;
            }

            using (new IMDrawer(mpbRect, ShapesMaterialUtils.GetRectMaterial(hollow, rounded)[blendMode], ShapesMeshUtils.QuadMesh[0])) {
                MetaMpb.ApplyColorOrFill(mpbRect, color);
                MetaMpb.ApplyDashSettings(mpbRect, thickness);
                mpbRect.rect.Add(rect.ToVector4());
                mpbRect.cornerRadii.Add(cornerRadii);
                mpbRect.thickness.Add(thickness);
                mpbRect.thicknessSpace.Add((int)Draw.ThicknessSpace);
                mpbRect.scaleMode.Add((int)ScaleMode);
            }
        }
Ejemplo n.º 3
0
 [OvldGenCallTarget] static void Line([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                      [OvldDefault(nameof(LineGeometry))] LineGeometry geometry,
                                      [OvldDefault(nameof(LineEndCaps))] LineEndCap endCaps,
                                      [OvldDefault(nameof(LineThicknessSpace))] ThicknessSpace thicknessSpace,
                                      Vector3 start,
                                      Vector3 end,
                                      [OvldDefault(nameof(Color))] Color colorStart,
                                      [OvldDefault(nameof(Color))] Color colorEnd,
                                      [OvldDefault(nameof(LineThickness))] float thickness,
                                      [OvldDefault(nameof(LineDashStyle))] DashStyle dashStyle = null)
 {
     using (new IMDrawer(
                metaMpb: mpbLine,
                sourceMat: ShapesMaterialUtils.GetLineMat(geometry, endCaps)[blendMode],
                sourceMesh: ShapesMeshUtils.GetLineMesh(geometry, endCaps, DetailLevel))) {
         MetaMpb.ApplyDashSettings(mpbLine, dashStyle, thickness);
         mpbLine.color.Add(colorStart);
         mpbLine.colorEnd.Add(colorEnd);
         mpbLine.pointStart.Add(start);
         mpbLine.pointEnd.Add(end);
         mpbLine.thickness.Add(thickness);
         mpbLine.alignment.Add((float)geometry);
         mpbLine.thicknessSpace.Add((float)thicknessSpace);
         mpbLine.scaleMode.Add((float)ScaleMode);
     }
 }
Ejemplo n.º 4
0
 [OvldGenCallTarget] static void Line_Internal([OvldDefault(nameof(LineEndCaps))] LineEndCap endCaps,
                                               [OvldDefault(nameof(ThicknessSpace))] ThicknessSpace thicknessSpace,
                                               Vector3 start,
                                               Vector3 end,
                                               [OvldDefault(nameof(Color))] Color colorStart,
                                               [OvldDefault(nameof(Color))] Color colorEnd,
                                               [OvldDefault(nameof(Thickness))] float thickness)
 {
     using (new IMDrawer(
                metaMpb: mpbLine,
                sourceMat: ShapesMaterialUtils.GetLineMat(Draw.LineGeometry, endCaps)[Draw.BlendMode],
                sourceMesh: ShapesMeshUtils.GetLineMesh(Draw.LineGeometry, endCaps, DetailLevel))) {
         MetaMpb.ApplyDashSettings(mpbLine, thickness);
         mpbLine.color.Add(colorStart.ColorSpaceAdjusted());
         mpbLine.colorEnd.Add(colorEnd.ColorSpaceAdjusted());
         mpbLine.pointStart.Add(start);
         mpbLine.pointEnd.Add(end);
         mpbLine.thickness.Add(thickness);
         mpbLine.alignment.Add((float)Draw.LineGeometry);                   // this is redundant for 3D lines, but, that's okay, fixing that makes things messier
         mpbLine.thicknessSpace.Add((float)thicknessSpace);
         mpbLine.scaleMode.Add((float)ScaleMode);
     }
 }
Ejemplo n.º 5
0
 [OvldGenCallTarget] static void RegularPolygon_Internal([OvldDefault(nameof(RegularPolygonSideCount))] int sideCount,
                                                         [OvldDefault(nameof(Radius))] float radius,
                                                         [OvldDefault(nameof(Thickness))] float thickness,
                                                         [OvldDefault(nameof(Color))] Color color,
                                                         bool hollow,
                                                         [OvldDefault("0f")] float roundness,
                                                         [OvldDefault("0f")] float angle)
 {
     using (new IMDrawer(mpbRegularPolygon, ShapesMaterialUtils.matRegularPolygon[Draw.BlendMode], ShapesMeshUtils.QuadMesh[0])) {
         MetaMpb.ApplyColorOrFill(mpbRegularPolygon, color);
         MetaMpb.ApplyDashSettings(mpbRegularPolygon, thickness);
         mpbRegularPolygon.radius.Add(radius);
         mpbRegularPolygon.radiusSpace.Add((int)Draw.RadiusSpace);
         mpbRegularPolygon.alignment.Add((int)Draw.RegularPolygonGeometry);
         mpbRegularPolygon.sides.Add(Mathf.Max(3, sideCount));
         mpbRegularPolygon.angle.Add(angle);
         mpbRegularPolygon.roundness.Add(roundness);
         mpbRegularPolygon.hollow.Add(hollow.AsInt());
         mpbRegularPolygon.thicknessSpace.Add((int)Draw.ThicknessSpace);
         mpbRegularPolygon.thickness.Add(thickness);
         mpbRegularPolygon.scaleMode.Add((int)ScaleMode);
     }
 }
Ejemplo n.º 6
0
        static void DiscCore(bool hollow, bool sector, float radius, float thickness, DiscColors colors, float angleRadStart = 0f, float angleRadEnd = 0f, ArcEndCap arcEndCaps = ArcEndCap.None)
        {
            if (sector && Mathf.Abs(angleRadEnd - angleRadStart) < 0.0001f)
            {
                return;
            }

            using (new IMDrawer(mpbDisc, ShapesMaterialUtils.GetDiscMaterial(hollow, sector)[Draw.BlendMode], ShapesMeshUtils.QuadMesh[0])) {
                MetaMpb.ApplyDashSettings(mpbDisc, thickness);
                mpbDisc.radius.Add(radius);
                mpbDisc.radiusSpace.Add((int)Draw.RadiusSpace);
                mpbDisc.alignment.Add((int)Draw.DiscGeometry);
                mpbDisc.thicknessSpace.Add((int)Draw.ThicknessSpace);
                mpbDisc.thickness.Add(thickness);
                mpbDisc.scaleMode.Add((int)ScaleMode);
                mpbDisc.angleStart.Add(angleRadStart);
                mpbDisc.angleEnd.Add(angleRadEnd);
                mpbDisc.roundCaps.Add((int)arcEndCaps);
                mpbDisc.color.Add(colors.innerStart.ColorSpaceAdjusted());
                mpbDisc.colorOuterStart.Add(colors.outerStart.ColorSpaceAdjusted());
                mpbDisc.colorInnerEnd.Add(colors.innerEnd.ColorSpaceAdjusted());
                mpbDisc.colorOuterEnd.Add(colors.outerEnd.ColorSpaceAdjusted());
            }
        }
Ejemplo n.º 7
0
        static void DiscCore(ShapesBlendMode blendMode, ThicknessSpace spaceRadius, ThicknessSpace spaceThickness, bool hollow, bool sector, Vector3 pos, Quaternion rot, float radius, float thickness, Color colorInnerStart, Color colorOuterStart, Color colorInnerEnd, Color colorOuterEnd, DashStyle dashStyle = null, float angleRadStart = 0f, float angleRadEnd = 0f, ArcEndCap arcEndCaps = ArcEndCap.None)
        {
            if (sector && Mathf.Abs(angleRadEnd - angleRadStart) < 0.0001f)
            {
                return;
            }

            using (new IMDrawer(mpbDisc, ShapesMaterialUtils.GetDiscMaterial(hollow, sector)[blendMode], ShapesMeshUtils.QuadMesh[0], pos, rot)) {
                MetaMpb.ApplyDashSettings(mpbDisc, dashStyle, thickness);
                mpbDisc.radius.Add(radius);
                mpbDisc.radiusSpace.Add((int)spaceRadius);
                mpbDisc.alignment.Add((int)Draw.DiscGeometry);
                mpbDisc.thicknessSpace.Add((int)spaceThickness);
                mpbDisc.thickness.Add(thickness);
                mpbDisc.scaleMode.Add((int)ScaleMode);
                mpbDisc.angStart.Add(angleRadStart);
                mpbDisc.angEnd.Add(angleRadEnd);
                mpbDisc.roundCaps.Add((int)arcEndCaps);
                mpbDisc.color.Add(colorInnerStart);
                mpbDisc.colorOuterStart.Add(colorOuterStart);
                mpbDisc.colorInnerEnd.Add(colorInnerEnd);
                mpbDisc.colorOuterEnd.Add(colorOuterEnd);
            }
        }