public override IStyleData Calculate(MarkupLine line, ITrajectory trajectory, MarkupLOD lod)
        {
            if (!CheckDashedLod(lod, Height, Base))
            {
                return(new MarkupStyleParts());
            }

            var borders = line.Borders;

            return(new MarkupStyleParts(StyleHelper.CalculateDashed(trajectory, Base, Space, CalculateDashes)));

            IEnumerable <MarkupStylePart> CalculateDashes(ITrajectory trajectory, float startT, float endT)
            {
                if (StyleHelper.CalculateDashedParts(borders, trajectory, Invert ? endT : startT, Invert ? startT : endT, Base, Height / (Invert ? 2 : -2), Height, Color, out MarkupStylePart dash))
                {
                    dash.MaterialType = MaterialType.Triangle;
                    yield return(dash);
                }
            }
        }
Exemple #2
0
        protected override IStyleData Calculate(MarkupRegularLine line, ITrajectory trajectory, MarkupLOD lod)
        {
            if (!CheckDashedLod(lod, Height, Base))
            {
                return(new MarkupStyleParts());
            }

            var borders = line.Borders;
            var coef    = Mathf.Cos(Angle * Mathf.Deg2Rad);

            return(new MarkupStyleParts(StyleHelper.CalculateDashed(trajectory, Base / coef, Space / coef, CalculateDashes)));

            IEnumerable <MarkupStylePart> CalculateDashes(ITrajectory trajectory, float startT, float endT)
            {
                if (StyleHelper.CalculateDashedParts(borders, trajectory, Invert ? endT : startT, Invert ? startT : endT, Base, Height / (Invert ? 2 : -2), Height, Color, out MarkupStylePart dash))
                {
                    dash.MaterialType = MaterialType.Triangle;
                    dash.Angle       -= Angle * Mathf.Deg2Rad;
                    yield return(dash);
                }
            }
        }