Example #1
0
        [OvldGenCallTarget] public 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)
        {
            Material mat = ShapesMaterialUtils.GetLineMat(geometry, endCaps)[blendMode];

            ApplyGlobalProperties(mat);
            mat.SetColor(ShapesMaterialUtils.propColor, colorStart);
            mat.SetColor(ShapesMaterialUtils.propColorEnd, colorEnd);
            mat.SetVector(ShapesMaterialUtils.propPointStart, start);
            mat.SetVector(ShapesMaterialUtils.propPointEnd, end);
            mat.SetFloat(ShapesMaterialUtils.propThickness, thickness);
            mat.SetInt(ShapesMaterialUtils.propAlignment, (int)geometry);
            mat.SetInt(ShapesMaterialUtils.propThicknessSpace, (int)thicknessSpace);
            mat.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode);

            ApplyDashSettings(mat, dashStyle, thickness, useType: geometry != LineGeometry.Volumetric3D);

            DrawMesh(Vector3.zero, Quaternion.identity, ShapesMeshUtils.GetLineMesh(geometry, endCaps), mat);
        }
Example #2
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);
     }
 }
Example #3
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);
            }
        }
Example #4
0
        [OvldGenCallTarget] public static void Rectangle([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                                         [OvldDefault("false")] bool hollow,
                                                         [OvldDefault("Vector3.zero")] Vector3 pos,
                                                         [OvldDefault("Quaternion.identity")] Quaternion rot,
                                                         Rect rect,
                                                         [OvldDefault(nameof(Color))] Color color,
                                                         [OvldDefault("0f")] float thickness          = 0f,
                                                         [OvldDefault("default")] Vector4 cornerRadii = default)
        {
            bool rounded = ShapesMath.MaxComp(cornerRadii) >= 0.0001f;

            if (hollow && thickness * 2 >= Mathf.Min(rect.width, rect.height))
            {
                hollow = false;
            }
            Material mat = ShapesMaterialUtils.GetRectMaterial(hollow, rounded)[blendMode];

            mat.SetColor(ShapesMaterialUtils.propColor, color);
            mat.SetVector(ShapesMaterialUtils.propRect, rect.ToVector4());
            if (rounded)
            {
                mat.SetVector(ShapesMaterialUtils.propCornerRadii, cornerRadii);
            }
            if (hollow)
            {
                mat.SetFloat(ShapesMaterialUtils.propThickness, thickness);
                mat.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode);
            }

            DrawMesh(pos, rot, ShapesMeshUtils.QuadMesh, mat);
        }
Example #5
0
        [OvldGenCallTarget] static void Rectangle([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                                  [OvldDefault("false")] bool hollow,
                                                  [OvldDefault("Vector3.zero")] Vector3 pos,
                                                  [OvldDefault("Quaternion.identity")] Quaternion rot,
                                                  Rect rect,
                                                  [OvldDefault(nameof(Color))] Color color,
                                                  [OvldDefault("0f")] float thickness          = 0f,
                                                  [OvldDefault("default")] Vector4 cornerRadii = default)
        {
            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;
            }

            if (hollow && thickness * 2 >= Mathf.Min(rect.width, rect.height))
            {
                hollow = false;
            }

            using (new IMDrawer(mpbRectangle, ShapesMaterialUtils.GetRectMaterial(hollow, rounded)[blendMode], ShapesMeshUtils.QuadMesh[0], pos, rot)) {
                mpbRectangle.color.Add(color);
                mpbRectangle.rect.Add(rect.ToVector4());
                mpbRectangle.cornerRadii.Add(cornerRadii);
                mpbRectangle.thickness.Add(thickness);
                mpbRectangle.scaleMode.Add((int)ScaleMode);
            }
        }
Example #6
0
        [OvldGenCallTarget] public static void Polyline([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                                        PolylinePath path,
                                                        [OvldDefault("false")] bool closed,
                                                        [OvldDefault(nameof(PolylineGeometry))] PolylineGeometry geometry,
                                                        [OvldDefault(nameof(PolylineJoins))] PolylineJoins joins,
                                                        [OvldDefault(nameof(LineThickness))] float thickness,
                                                        [OvldDefault(nameof(LineThicknessSpace))] ThicknessSpace thicknessSpace,
                                                        [OvldDefault(nameof(Color))] Color color)
        {
            if (path.EnsureMeshIsReadyToRender(closed, joins, out Mesh mesh) == false)
            {
                return;                 // no points defined in the mesh
            }
            switch (path.Count)
            {
            case 0:
                Debug.LogWarning("Tried to draw polyline with no points");
                return;

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

            Material matPolyLine = ShapesMaterialUtils.GetPolylineMat(joins)[blendMode];

            ApplyGlobalProperties(matPolyLine);
            matPolyLine.SetFloat(ShapesMaterialUtils.propThickness, thickness);
            matPolyLine.SetFloat(ShapesMaterialUtils.propThicknessSpace, (int)thicknessSpace);
            matPolyLine.SetColor(ShapesMaterialUtils.propColor, color);
            matPolyLine.SetInt(ShapesMaterialUtils.propAlignment, (int)geometry);
            matPolyLine.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode);
            if (joins == PolylineJoins.Miter)
            {
                DrawMesh(Vector3.zero, Quaternion.identity, mesh, matPolyLine);
            }
            else
            {
                Material matPolyLineJoins = ShapesMaterialUtils.GetPolylineJoinsMat(joins)[blendMode];
                ApplyGlobalProperties(matPolyLineJoins);
                matPolyLineJoins.SetFloat(ShapesMaterialUtils.propThickness, thickness);
                matPolyLineJoins.SetFloat(ShapesMaterialUtils.propThicknessSpace, (int)thicknessSpace);
                matPolyLineJoins.SetColor(ShapesMaterialUtils.propColor, color);
                matPolyLineJoins.SetInt(ShapesMaterialUtils.propAlignment, (int)geometry);
                matPolyLineJoins.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode);
                DrawTwoSubmeshes(Vector3.zero, Quaternion.identity, mesh, matPolyLine, matPolyLineJoins);
            }
        }
Example #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];

            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);

            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);
        }
Example #8
0
        [OvldGenCallTarget] static void Polyline_Internal(PolylinePath path,
                                                          [OvldDefault("false")] bool closed,
                                                          [OvldDefault(nameof(PolylineGeometry))] PolylineGeometry geometry,
                                                          [OvldDefault(nameof(PolylineJoins))] PolylineJoins joins,
                                                          [OvldDefault(nameof(Thickness))] float thickness,
                                                          [OvldDefault(nameof(ThicknessSpace))] ThicknessSpace thicknessSpace,
                                                          [OvldDefault(nameof(Color))] Color color)
        {
            if (path.EnsureMeshIsReadyToRender(closed, joins, out Mesh mesh) == false)
            {
                return;                 // no points defined in the mesh
            }
            switch (path.Count)
            {
            case 0:
                Debug.LogWarning("Tried to draw polyline with no points");
                return;

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

            void ApplyToMpb(MpbPolyline2D mpb)
            {
                mpb.thickness.Add(thickness);
                mpb.thicknessSpace.Add((int)thicknessSpace);
                mpb.color.Add(color.ColorSpaceAdjusted());
                mpb.alignment.Add((int)geometry);
                mpb.scaleMode.Add((int)ScaleMode);
            }

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

            using (new IMDrawer(mpbPolyline, ShapesMaterialUtils.GetPolylineMat(joins)[Draw.BlendMode], mesh, 0))
                ApplyToMpb(mpbPolyline);

            if (joins.HasJoinMesh())
            {
                using (new IMDrawer(mpbPolylineJoins, ShapesMaterialUtils.GetPolylineJoinsMat(joins)[Draw.BlendMode], mesh, 1))
                    ApplyToMpb(mpbPolylineJoins);
            }
        }
Example #9
0
        [OvldGenCallTarget] static void Polyline([OvldDefault(nameof(BlendMode))] ShapesBlendMode blendMode,
                                                 PolylinePath path,
                                                 [OvldDefault("false")] bool closed,
                                                 [OvldDefault(nameof(PolylineGeometry))] PolylineGeometry geometry,
                                                 [OvldDefault(nameof(PolylineJoins))] PolylineJoins joins,
                                                 [OvldDefault(nameof(LineThickness))] float thickness,
                                                 [OvldDefault(nameof(LineThicknessSpace))] ThicknessSpace thicknessSpace,
                                                 [OvldDefault(nameof(Color))] Color color)
        {
            if (path.EnsureMeshIsReadyToRender(closed, joins, out Mesh mesh) == false)
            {
                return;                 // no points defined in the mesh
            }
            switch (path.Count)
            {
            case 0:
                Debug.LogWarning("Tried to draw polyline with no points");
                return;

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

            void ApplyToMpb(MpbPolyline mpb)
            {
                mpb.thickness.Add(thickness);
                mpb.thicknessSpace.Add((int)thicknessSpace);
                mpb.color.Add(color);
                mpb.alignment.Add((int)geometry);
                mpb.scaleMode.Add((int)ScaleMode);
            }

            using (new IMDrawer(mpbPolyline, ShapesMaterialUtils.GetPolylineMat(joins)[blendMode], mesh, 0))
                ApplyToMpb(mpbPolyline);

            if (joins.HasJoinMesh())
            {
                using (new IMDrawer(mpbPolylineJoins, ShapesMaterialUtils.GetPolylineJoinsMat(joins)[blendMode], mesh, 1))
                    ApplyToMpb(mpbPolylineJoins);
            }
        }
Example #10
0
        [OvldGenCallTarget] public 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)
        {
            Material mat = ShapesMaterialUtils.GetLineMat(geometry, endCaps)[blendMode];

            ApplyGlobalProperties(mat);
            mat.SetColor(ShapesMaterialUtils.propColor, colorStart);
            mat.SetColor(ShapesMaterialUtils.propColorEnd, colorEnd);
            mat.SetVector(ShapesMaterialUtils.propPointStart, start);
            mat.SetVector(ShapesMaterialUtils.propPointEnd, end);
            mat.SetFloat(ShapesMaterialUtils.propThickness, thickness);
            mat.SetInt(ShapesMaterialUtils.propAlignment, (int)geometry);
            mat.SetInt(ShapesMaterialUtils.propThicknessSpace, (int)thicknessSpace);
            mat.SetInt(ShapesMaterialUtils.propScaleMode, (int)ScaleMode);
            bool dashed = dashStyle?.size > 0f;

            mat.SetFloat(ShapesMaterialUtils.propDashSize, dashed ? dashStyle.GetNetAbsoluteSize(true, thickness) : 0);
            if (dashed)
            {
                if (geometry != LineGeometry.Volumetric3D)
                {
                    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(Vector3.zero, Quaternion.identity, ShapesMeshUtils.GetLineMesh(geometry, endCaps), mat);
        }
Example #11
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);
        }
Example #12
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);
     }
 }
Example #13
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());
            }
        }
Example #14
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);
            }
        }