Vixen
02b45cc4
csharp
public static class GizmoGeometry

The handles, as line segments something can draw.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The other half of TransformGizmo, kept apart from it on purpose. The gizmo decides where the handles are, what is under the pointer and what a drag means, and all of that is testable with no device. This turns the same numbers into geometry, and it is separate so that changing how a gizmo looks cannot change what it does.

⚠ The arms are built from the same WorldPerPixel and the same basis the hit test uses. Not similar arithmetic — the same calls. A gizmo drawn a little larger than it is hit-tested is one where the last few pixels of every arm do nothing, which reads as the tool being unreliable rather than as an arithmetic difference.

⚠ A thick line is several thin ones, and it has to be. LineRenderer draws one-pixel lines and deliberately refuses to offer anything else: lineWidth above one is an optional Vulkan feature that most tiled GPUs lack, so a renderer that offered it would draw a different picture on different machines. Its own remarks say a thick line belongs to whoever wants one — this is that. Every segment is emitted Thickness times, each shifted a pixel further across the segment on screen, which is the only offset that thickens a line rather than smearing it along itself or into the depth buffer.

Lines rather than solid cones and rings, which is what a shipping gizmo eventually wants. A line renderer exists and a mesh path for the editor does not, and an editor whose handles are visible now is worth more than one whose handles are beautiful later.

Fields and properties (8)

  • public const int RingSegments

    How many segments a rotation ring is drawn with.

  • public const float HighlightShade

    How much of its colour a handle keeps while the pointer is over it.

  • public const float Ambient

    How much light a surface facing away from the key still receives.

  • public const float PlaneFillAlpha

    How translucent a plane handle's fill is when it is not under the pointer.

  • public const float PlaneHighlightAlpha

    And when it is.

  • public const float PlaneEdgeOn

    How nearly edge-on a plane handle may be before it is neither drawn nor grabbable.

  • public const int TubeSides

    How many sides a rotation ring's tube has.

  • public const int HeadSegments

    How many divisions a solid head is built with.

Methods (7)

  • public static Vector3 TowardsEye(EditorCamera camera, Vector3 origin)

    Which way the eye is from a point, for deciding what faces it.

  • public static Color4 AxisColour(int axis, bool highlighted = false)

    The colour of the arm along an axis.

  • public static Color4 NeutralColour(bool highlighted = false)

    The colour of a handle that belongs to no axis: the middle ball, the screen ring.

  • public static Vector3 KeyLight(EditorCamera camera)

    Which way the light a handle is shaded by travels.

  • public static float Shade(Vector3 normal, Vector3 light)

    How brightly a surface facing some way is lit, from Ambient to one.

  • public static int Build(TransformGizmo gizmo, EditorCamera camera, int height, List<LineVertex> into)

    Builds the handles for a gizmo as it currently stands.

  • public static int BuildSolid(TransformGizmo gizmo, EditorCamera camera, int height, List<MeshVertex> vertices, List<uint> triangles)

    Builds the solid parts of a gizmo: the head on the end of each arm.

Used by (5)

  • GizmoGeometryTestsVixen.Editor.SceneView.Tests
  • ManipulationTestsVixen.Editor.SceneView.Tests
  • SceneLinesVixen.Editor.SceneView
  • ScenePresenterVixen.Editor.App
  • TransformGizmoVixen.Editor.SceneView