/// <summary> /// Loads all the content necessary for drawing Gizmos. /// </summary> /// <param name="device">The GraphicsDevice to use when drawing. It is also used to bind buffers.</param> /// <param name="content">The ContentManager to manage Gizmos resources.</param> public void LoadContent(GraphicsDevice device, ContentManager content) { GraphicsDevice = device; Content = content; Effect = Content.Load <Effect>("Effects/Gizmos"); BackgroundPass = Effect.CurrentTechnique.Passes["Background"]; ForegroundPass = Effect.CurrentTechnique.Passes["Foreground"]; WorldViewProjectionParameter = Effect.Parameters["WorldViewProjection"]; ColorParameter = Effect.Parameters["Color"]; LineSegment = new LineSegmentGizmoGeometry(GraphicsDevice); Cube = new CubeGizmoGeometry(GraphicsDevice); Sphere = new SphereGizmoGeometry(GraphicsDevice, 20); PolyLine = new PolyLineGizmoGeometry(GraphicsDevice); Disk = new DiskGizmoGeometry(GraphicsDevice, 20); Cylinder = new CylinderGizmoGeometry(GraphicsDevice, 20); AxisLines = new AxisLines(GraphicsDevice, Content.Load <Model>("3D/geometries/arrow")); DrawInstances[LineSegment] = new Dictionary <Color, List <Matrix> >(); DrawInstances[Sphere] = new Dictionary <Color, List <Matrix> >(); DrawInstances[Cube] = new Dictionary <Color, List <Matrix> >(); DrawInstances[Disk] = new Dictionary <Color, List <Matrix> >(); DrawInstances[Cylinder] = new Dictionary <Color, List <Matrix> >(); }
/// <inheritdoc /> public void DrawLine(Vector3 origin, Vector3 destination, Color color) { var world = LineSegmentGizmoGeometry.CalculateWorld(origin, destination); AddDrawInstance(LineSegment, color, world); }