Canguro.Controller.Tracking.HoverPainter.PaintPoint C# (CSharp) Метод

PaintPoint() публичный Метод

public PaintPoint ( Device device, System.Vector3 screenPosition ) : void
device Device
screenPosition System.Vector3
Результат void
        public void PaintPoint(Device device, Vector3 screenPosition)
        {
            Cull cull = device.RenderState.CullMode;
            bool alphaEnable = device.RenderState.AlphaBlendEnable;

            device.RenderState.CullMode = Cull.None;
            device.RenderState.AlphaBlendEnable = true;

            device.RenderState.SourceBlend = Blend.BothSourceAlpha;
            device.RenderState.DestinationBlend = Blend.DestinationColor;

            pointVerts[0].X = screenPosition.X;
            pointVerts[0].Y = screenPosition.Y;
            pointVerts[0].Color = Color.Red.ToArgb();

            device.VertexFormat = CustomVertex.TransformedColored.Format;
            device.DrawUserPrimitives(PrimitiveType.PointList, 1, pointVerts);

            device.RenderState.AlphaBlendEnable = alphaEnable;
            device.RenderState.CullMode = cull;
        }

Usage Example

Пример #1
0
        internal void Paint(Device device)
        {
            if (hoverItem != null)
            {
                // Glow item
                if (hoverItem is LineElement)
                {
                    LineElement line = hoverItem as LineElement;

                    Model.Model model      = Model.Model.Instance;
                    GraphicView activeView = GraphicViewManager.Instance.ActiveView;
                    View.Renderer.RenderOptions options = activeView.ModelRenderer.RenderOptions;

                    if (options.ShowDeformed && model.HasResults && curve != null)
                    {
                        for (int i = 0; i < curve.Length - 1; i++)
                        {
                            hoverPainter.PaintLine(device, curve[i], curve[i + 1]);
                        }
                    }
                    else
                    {
                        hoverPainter.PaintLine(device, line);
                    }
                }

                // Show hoverPos
                Vector3 hoverPos2D = hoverPos;
                GraphicViewManager.Instance.ActiveView.Project(ref hoverPos2D);
                hoverPainter.PaintPoint(device, hoverPos2D);

                if (showingTooltip && !string.IsNullOrEmpty(tooltipText))
                {
                    // Draw tooltip rectangle
                    rectHelper.Paint(device);

                    // Draw text
                    Rectangle rect = tooltipRectangle;
                    rect.X += 4;
                    rect.Y += 2;
                    hoverPainter.DrawText(tooltipText, rect, GraphicViewManager.Instance.PrintingHiResImage ? Color.Black : Color.White);
                }
            }
        }