Color legend plain property method
The world’s axes in the top-right corner of the viewport, turning exactly as the camera turns, drawn over the scene; the tip under the pointer lights up, and a click on a tip gives its axis.
A sealed class, IDisposable. The quick start guide shows it in context, with code.
Names are colored by what they are: a property or a method; values and fields keep the plain color.
Properties
AxisLetterColor →
Color · The color of the letters X, Y and Z on the knobs of the positive arms. (245, 245, 245), an off-white, by default. Not lightened under the pointer.
AxisXColor →
Color · The color of the +X arm and its knob. (220, 70, 70), a red, by default. The −X arm takes 40% of its red, green and blue, opaque. An arm under the pointer is drawn halfway toward white.
AxisYColor →
Color · The color of the +Y arm and its knob. (90, 210, 90), a green, by default. The −Y arm takes 40% of its red, green and blue, opaque.
AxisZColor →
Color · The color of the +Z arm and its knob. (80, 140, 230), a blue, by default. The −Z arm takes 40% of its red, green and blue, opaque.
Methods
OrientationGizmo() →
OrientationGizmo(GraphicsDevice graphicsDevice) · A widget in the default colors. Creates the BasicEffect it draws with. Throws ArgumentNullException for a null device.
| Parameter | Type | Description |
|---|---|---|
graphicsDevice |
GraphicsDevice |
The device to draw with. The widget’s square is placed in its current viewport, for drawing and for picking. |
Dispose() →
Dispose() · Disposes the gizmo’s BasicEffect. Call it when the graphics device goes. A second call does nothing; Draw after it throws ObjectDisposedException.
Draw() →
Draw(Camera camera) · Draws the widget in a 110-pixel square, 12 pixels in from the top-right corner of the current viewport, over what is there: its own viewport and projection, depth testing off, alpha blending on and no culling, with the viewport and the three states put back after. The arm under the pointer, as the last UpdateHover found it, is lit up. Throws ArgumentNullException for a null camera, and ObjectDisposedException after Dispose.
| Parameter | Type | Description |
|---|---|---|
camera |
Camera |
The camera the scene is drawn with. Only its View is read, for the turn of the widget. |
TryPickAxis() →
TryPickAxis(Camera camera, Point mousePosition, out Vector3 axis) · Returns true when the pointer is inside the widget’s square and within 14 pixels of a tip, with that tip’s axis; of two tips that close, the one nearer the camera. Returns false otherwise, with Vector3.Zero. Changes nothing, the hover included. Throws ArgumentNullException for a null camera.
| Parameter | Type | Description |
|---|---|---|
camera |
Camera |
The camera the scene is drawn with. Only its View is read. |
mousePosition |
Point |
The pointer in window pixels, from the top left corner, as the mouse gives it. |
axis |
Vector3 |
Out. The world axis of the tip, as a signed unit vector: Vector3.UnitX, -Vector3.UnitZ and so on. Vector3.Zero when no tip is picked. |
UpdateHover() →
UpdateHover(Camera camera, Point mousePosition) · Finds the tip under the pointer, by the rules of TryPickAxis, for Draw to light up its arm; a pointer on no tip clears the highlight. Call it once a frame, before Draw, wherever the pointer is. Throws ArgumentNullException for a null camera.
| Parameter | Type | Description |
|---|---|---|
camera |
Camera |
The camera the scene is drawn with. Only its View is read. |
mousePosition |
Point |
The pointer in window pixels, from the top left corner, as the mouse gives it. |