TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_viewport_types.h File Reference

Go to the source code of this file.

Classes

struct  tachyon::ViewportCamera
 A camera orbiting target, distance away. More...
struct  tachyon::ViewportTransform
 The selected object's place in the world. More...
struct  tachyon::ViewportEdit
 A gizmo's drag: the selection as it was and is. More...
struct  tachyon::ViewportRenderContext
 What the app's onRender gets each frame: the target's size and the camera's matrices, the projection to the clip space of the scene's API (ToClipSpace). More...
struct  tachyon::ViewportView
 A viewport: what it shows and how. Keep it from frame to frame, as a CurveView. More...

Namespaces

namespace  tachyon

Enumerations

enum class  tachyon::ViewportTool : uint8_t { tachyon::ViewportTool::Select , tachyon::ViewportTool::Move , tachyon::ViewportTool::Rotate , tachyon::ViewportTool::Scale }
 What a drag on the view does to the selected object. More...
enum class  tachyon::GizmoPart : uint8_t {
  tachyon::GizmoPart::None , tachyon::GizmoPart::X , tachyon::GizmoPart::Y , tachyon::GizmoPart::Z ,
  tachyon::GizmoPart::XY , tachyon::GizmoPart::YZ , tachyon::GizmoPart::XZ , tachyon::GizmoPart::Center
}
 A part of the gizmo. More...

Functions

Ray tachyon::ViewportRay (const ViewportCamera &camera, float2 pixel, float2 size)
 The ray from the camera through pixel (from the view's top left) of a view size pixels.
bool tachyon::ViewportProject (const ViewportCamera &camera, float2 size, float3 point, float2 &pixel)
 Where point shows in the view, from its top left; false when it's behind the camera.

Viewport helpers

enum  tachyon::FlyKey : uint8_t {
  tachyon::FlyForward = 1 , tachyon::FlyBack = 2 , tachyon::FlyLeft = 4 , tachyon::FlyRight = 8 ,
  tachyon::FlyDown = 16 , tachyon::FlyUp = 32
}
 The fly keys' bits in ViewportView::flyKeys. More...
constexpr float tachyon::kGizmoPixels = 90.0f
 The gizmo's arrows, rings and handles are this many pixels long.
GizmoPart tachyon::HitGizmo (const ViewportView &view, float2 pixel, float2 size)
 The part of view's gizmo under pixel in a view size pixels, by its tool; None without a selection or with Select.
ViewportTransform tachyon::DragGizmo (ViewportTool tool, GizmoPart part, const ViewportTransform &before, const ViewportCamera &camera, float2 size, float2 from, float2 to)
 The selection a drag of part from from to to (view pixels) makes of before.
void tachyon::OrbitCamera (ViewportCamera &camera, float2 delta)
 Turns the camera round its target by a drag of delta pixels.
void tachyon::LookCamera (ViewportCamera &camera, float2 delta)
 Turns the camera where it stands (looks round) by a drag of delta pixels.
void tachyon::PanCamera (ViewportCamera &camera, float2 delta, float heightPixels)
 Slides the camera and its target so what was under the pointer follows a drag of delta pixels, in a view heightPixels high.
void tachyon::DollyCamera (ViewportCamera &camera, float factor)
 Moves the camera toward its target by factor (above 1: closer).
void tachyon::AlignCamera (ViewportCamera &camera, int axis, bool fromNegative)
 Looks along axis (0 x, 1 y, 2 z) toward its negative end, or its positive with fromBelow.
void tachyon::FrameSelection (ViewportView &view)
 Centers the selection, near enough to see all of it.
void tachyon::FlyCamera (ViewportView &view, float seconds)
 Moves the camera by the fly keys held (ViewportView::flyKeys) for seconds: forward, back and sideways along its view, down and up along the world's y.
void tachyon::ApplyViewportEdit (ViewportView &view, const ViewportEdit &edit, bool undo=false)
 Does (or with undo, undoes) edit on the selection.
void tachyon::CommitViewportEdit (ViewportView &view, const ViewportEdit &edit)
 Applies edit and hands it to view.onEdit; does nothing for an empty one.