Ejemplo n.º 1
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)
            {
                var 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);
                    }
                }
            }
        }
 private void OnBorderPointsFoundDirty()
 {
     _borderPoints         = PrimitiveFactory.Generate2DArcBorderPoints(_origin, _startPoint, _degreeAngleFromStart, _forceShortestArc, _numBorderPoints);
     _rect                 = RectEx.FromPoints(_borderPoints);
     _areBorderPointsDirty = false;
 }