示例#1
0
 static void Arc_Internal([OvldDefault(nameof(Radius))] float radius,
                          [OvldDefault(nameof(Thickness))] float thickness,
                          [OvldDefault(nameof(Color))] DiscColors colors,
                          float angleRadStart,
                          float angleRadEnd,
                          [OvldDefault(nameof(ArcEndCap) + "." + nameof(ArcEndCap.None))] ArcEndCap endCaps)
 {
     DiscCore(true, true, radius, thickness, colors, angleRadStart, angleRadEnd, endCaps);
 }
示例#2
0
 [OvldGenCallTarget] static void Arc_Internal([OvldDefault(nameof(DiscRadius))] float radius,
                                              [OvldDefault(nameof(RingThickness))] float thickness,
                                              [OvldDefault(nameof(Color))] Color colorInnerStart,
                                              [OvldDefault(nameof(Color))] Color colorOuterStart,
                                              [OvldDefault(nameof(Color))] Color colorInnerEnd,
                                              [OvldDefault(nameof(Color))] Color colorOuterEnd,
                                              float angleRadStart,
                                              float angleRadEnd,
                                              [OvldDefault(nameof(ArcEndCap) + "." + nameof(ArcEndCap.None))] ArcEndCap endCaps,
                                              [OvldDefault(nameof(RingDashStyle))] DashStyle dashStyle = null)
 {
     DiscCore(true, true, radius, thickness, colorInnerStart, colorOuterStart, colorInnerEnd, colorOuterEnd, dashStyle, angleRadStart, angleRadEnd, endCaps);
 }
示例#3
0
 [OvldGenCallTarget] public static void Arc(Vector3 pos,
                                            [OvldDefault("Quaternion.identity")] Quaternion rot,
                                            [OvldDefault(nameof(DiscRadius))] float radius,
                                            [OvldDefault(nameof(RingThickness))] float thickness,
                                            [OvldDefault(nameof(Color))] Color colorInnerStart,
                                            [OvldDefault(nameof(Color))] Color colorOuterStart,
                                            [OvldDefault(nameof(Color))] Color colorInnerEnd,
                                            [OvldDefault(nameof(Color))] Color colorOuterEnd,
                                            float angleRadStart,
                                            float angleRadEnd,
                                            [OvldDefault(nameof(ArcEndCap) + "." + nameof(ArcEndCap.None))] ArcEndCap endCaps,
                                            [OvldDefault(nameof(RingDashStyle))] DashStyle dashStyle = null)
 {
     DiscCore(BlendMode, DiscRadiusSpace, RingThicknessSpace, true, true, pos, rot, radius, thickness, colorInnerStart, colorOuterStart, colorInnerEnd, colorOuterEnd, dashStyle, angleRadStart, angleRadEnd, endCaps);
 }
    public override void UpdateData()
    {
        if (poly == null)
        {
            return;
        }

        type        = disc.Type;
        cap         = disc.ArcEndCaps;
        radius      = disc.Radius;
        thickness   = disc.Thickness;
        angRadStart = disc.AngRadiansStart;
        angRadEnd   = disc.AngRadiansEnd;
        Refresh(type, radius, thickness, angRadStart, angRadEnd);
    }
示例#5
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;
            }
            Material mat = ShapesMaterialUtils.GetDiscMaterial(hollow, sector)[blendMode];

            ApplyGlobalProperties(mat);
            mat.SetFloat(ShapesMaterialUtils.propRadius, radius);
            mat.SetInt(ShapesMaterialUtils.propRadiusSpace, (int)spaceRadius);
            mat.SetInt(ShapesMaterialUtils.propAlignment, (int)Draw.DiscGeometry);
            if (hollow)
            {
                mat.SetInt(ShapesMaterialUtils.propThicknessSpace, (int)spaceThickness);
                mat.SetFloat(ShapesMaterialUtils.propThickness, thickness);
                mat.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode);
            }

            if (sector)
            {
                mat.SetFloat(ShapesMaterialUtils.propAngStart, angleRadStart);
                mat.SetFloat(ShapesMaterialUtils.propAngEnd, angleRadEnd);
                if (hollow)
                {
                    mat.SetFloat(ShapesMaterialUtils.propRoundCaps, (int)arcEndCaps);
                }
            }

            mat.SetColor(ShapesMaterialUtils.propColor, colorInnerStart);
            mat.SetColor(ShapesMaterialUtils.propColorOuterStart, colorOuterStart);
            mat.SetColor(ShapesMaterialUtils.propColorInnerEnd, colorInnerEnd);
            mat.SetColor(ShapesMaterialUtils.propColorOuterEnd, colorOuterEnd);

            ApplyDashSettings(mat, dashStyle, thickness);

            DrawMesh(pos, rot, ShapesMeshUtils.QuadMesh, mat);
        }
示例#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());
            }
        }
示例#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;
            }
            Material mat = ShapesMaterialUtils.GetDiscMaterial(hollow, sector)[blendMode];

            mat.SetFloat(ShapesMaterialUtils.propRadius, radius);
            mat.SetInt(ShapesMaterialUtils.propRadiusSpace, (int)spaceRadius);
            if (hollow)
            {
                mat.SetInt(ShapesMaterialUtils.propThicknessSpace, (int)spaceThickness);
                mat.SetFloat(ShapesMaterialUtils.propThickness, thickness);
                mat.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode);
            }

            if (sector)
            {
                mat.SetFloat(ShapesMaterialUtils.propAngStart, angleRadStart);
                mat.SetFloat(ShapesMaterialUtils.propAngEnd, angleRadEnd);
                if (hollow)
                {
                    mat.SetFloat(ShapesMaterialUtils.propRoundCaps, (int)arcEndCaps);
                }
            }

            mat.SetColor(ShapesMaterialUtils.propColor, colorInnerStart);
            mat.SetColor(ShapesMaterialUtils.propColorOuterStart, colorOuterStart);
            mat.SetColor(ShapesMaterialUtils.propColorInnerEnd, colorInnerEnd);
            mat.SetColor(ShapesMaterialUtils.propColorOuterEnd, colorOuterEnd);

            bool dashed = dashStyle?.size > 0f;

            mat.SetFloat(ShapesMaterialUtils.propDashSize, dashed ? dashStyle.GetNetAbsoluteSize(true, thickness) : 0);
            if (dashed)
            {
                mat.SetInt(ShapesMaterialUtils.propDashType, (int)dashStyle.type);
                mat.SetInt(ShapesMaterialUtils.propDashSpace, (int)dashStyle.space);
                mat.SetInt(ShapesMaterialUtils.propDashSnap, (int)dashStyle.snap);
                mat.SetFloat(ShapesMaterialUtils.propDashOffset, dashStyle.offset);
                mat.SetFloat(ShapesMaterialUtils.propDashSpacing, dashStyle.GetNetAbsoluteSpacing(true, thickness));
            }

            DrawMesh(pos, rot, ShapesMeshUtils.QuadMesh, mat);
        }
示例#8
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);
            }
        }