Пример #1
0
        public override void RenderBorder(Camera camera)
        {
            if (_borderRenderDesc.BorderType == Shape2DBorderType.Thin)
            {
                GLRenderer.DrawLines2D(_cwPolyPoints, camera);
            }
            else
            {
                if (_isThickBorderDirty)
                {
                    CalculateThickBorderPoints();
                }

                if (_borderRenderDesc.FillMode == ThickBorderFillMode.Border)
                {
                    GLRenderer.DrawLines2D(_cwPolyPoints, camera);
                    GLRenderer.DrawLines2D(_thickCwBorderPoints, camera);
                }
                else
                {
                    var borderDir = _borderRenderDesc.Direction == Shape2DBorderDirection.Inward ? PrimitiveFactory.PolyBorderDirection.Inward : PrimitiveFactory.PolyBorderDirection.Outward;
                    var quadPts   = PrimitiveFactory.Generate2DPolyBorderQuadsCW(_cwPolyPoints, _thickCwBorderPoints, borderDir, _isClosed);
                    GLRenderer.DrawQuads2D(quadPts, camera);
                }
            }
        }
Пример #2
0
 public override void RenderBorder(Camera camera)
 {
     if (_areModelBorderPointsDirty)
     {
         CalcModelBorderPoints();
     }
     GLRenderer.DrawLines2D(_modelBorderPoints, _center, Vector2Ex.FromValue(_radius), camera);
 }
Пример #3
0
        public override void RenderBorder(Camera camera)
        {
            if (_areBorderPointsDirty)
            {
                OnBorderPointsFoundDirty();
            }

            if ((_borderRenderDesc.BorderFlags & BorderRenderFlags.ArcBorder) != 0)
            {
                GLRenderer.DrawLines2D(_borderPoints, camera);
            }
            if ((_borderRenderDesc.BorderFlags & BorderRenderFlags.ExtremitiesBorder) != 0)
            {
                GLRenderer.DrawLines2D(new List <Vector2>()
                {
                    _origin, StartPoint, _origin, EndPoint
                }, camera);
            }
        }
Пример #4
0
        public void Render(GizmoRotationArc2DLookAndFeel lookAndFeel, Camera camera)
        {
            if (_type == ArcType.Standard || _projectionPoly == null)
            {
                _arc.ForceShortestArc = lookAndFeel.UseShortestRotation;
                if ((lookAndFeel.FillFlags & GizmoRotationArcFillFlags.Area) != 0)
                {
                    GizmoSolidMaterial solidMaterial = GizmoSolidMaterial.Get;
                    solidMaterial.ResetValuesToSensibleDefaults();
                    solidMaterial.SetCullModeOff();
                    solidMaterial.SetLit(false);
                    solidMaterial.SetColor(lookAndFeel.Color);
                    solidMaterial.SetPass(0);
                    _arc.RenderArea(camera);
                }

                ArcShape2D.BorderRenderFlags arcWireFlags = ArcShape2D.BorderRenderFlags.None;
                if ((lookAndFeel.FillFlags & GizmoRotationArcFillFlags.ArcBorder) != 0)
                {
                    arcWireFlags |= ArcShape2D.BorderRenderFlags.ArcBorder;
                }
                if ((lookAndFeel.FillFlags & GizmoRotationArcFillFlags.ExtremitiesBorder) != 0)
                {
                    arcWireFlags |= ArcShape2D.BorderRenderFlags.ExtremitiesBorder;
                }

                GizmoLineMaterial lineMaterial = GizmoLineMaterial.Get;
                lineMaterial.ResetValuesToSensibleDefaults();
                lineMaterial.SetColor(lookAndFeel.BorderColor);
                lineMaterial.SetPass(0);
                _arc.RenderBorder(camera);
            }
            else
            if (_type == ArcType.PolyProjected && _projectionPoly != null)
            {
                List <Vector2> arcBorderPoints = PrimitiveFactory.Generate2DArcBorderPoints(_arc.Origin, _arc.StartPoint, _arc.DegreeAngleFromStart, lookAndFeel.UseShortestRotation, NumProjectedPoints);
                arcBorderPoints = PrimitiveFactory.ProjectArcPointsOnPoly2DBorder(_arc.Origin, arcBorderPoints, _projectionPoly.GetPoints());

                if ((lookAndFeel.FillFlags & GizmoRotationArcFillFlags.Area) != 0)
                {
                    GizmoSolidMaterial solidMaterial = GizmoSolidMaterial.Get;
                    solidMaterial.ResetValuesToSensibleDefaults();
                    solidMaterial.SetCullModeOff();
                    solidMaterial.SetLit(false);
                    solidMaterial.SetColor(lookAndFeel.Color);
                    solidMaterial.SetPass(0);

                    GLRenderer.DrawTriangleFan2D(_arc.Origin, arcBorderPoints, camera);
                }

                if (lookAndFeel.FillFlags != GizmoRotationArcFillFlags.None)
                {
                    GizmoLineMaterial lineMaterial = GizmoLineMaterial.Get;
                    lineMaterial.ResetValuesToSensibleDefaults();
                    lineMaterial.SetColor(lookAndFeel.BorderColor);
                    lineMaterial.SetPass(0);

                    if ((lookAndFeel.FillFlags & GizmoRotationArcFillFlags.ArcBorder) != 0)
                    {
                        GLRenderer.DrawLines2D(arcBorderPoints, camera);
                    }

                    if ((lookAndFeel.FillFlags & GizmoRotationArcFillFlags.ExtremitiesBorder) != 0)
                    {
                        GLRenderer.DrawLines2D(new List <Vector2> {
                            _arc.Origin, arcBorderPoints[0], _arc.Origin, arcBorderPoints[arcBorderPoints.Count - 1]
                        }, camera);
                    }
                }
            }
        }