Toast Engine
Loading...
Searching...
No Matches
gizmo_layout.hpp File Reference

Geometry + hit-test constants shared between DebugPass (renders the gizmos) and Workspace (hit-tests/drags them). More...

#include <cstdint>
#include <glm/glm.hpp>
#include <utility>
Include dependency graph for gizmo_layout.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  toast::GizmoTool : uint8_t {
  select , translate , rotate , scale ,
  ruler , volume_faces
}
 Mirrors editor.WorkspaceViewModel.GizmoTool / proto SetGizmoTool - 0 Select, 1 Translate, 2 Rotate, 3 Scale, 4 Ruler.
enum class  toast::GizmoHandle : int8_t {
  none = -1 , axis_x = 0 , axis_y = 1 , axis_z = 2 ,
  plane_xy = 3 , plane_yz = 4 , plane_xz = 5 , center = 6 ,
  size_neg_x = 7 , size_pos_x = 8 , size_neg_y = 9 , size_pos_y = 10 ,
  size_neg_z = 11 , size_pos_z = 12
}
 Which part of the active gizmo a ray/click is interacting with, axis_x/y/z and center are reused across Translate/Rotate/Scale (only one tool is ever active); plane_xy/yz/xz are Translate-only.

Functions

constexpr auto toast::gizmo_layout::isSizeHandle (GizmoHandle handle) noexcept -> bool
constexpr auto toast::gizmo_layout::sizeHandleAxis (GizmoHandle handle) noexcept -> int
constexpr auto toast::gizmo_layout::sizeHandleSign (GizmoHandle handle) noexcept -> float
auto toast::gizmo_layout::ringBasis (const glm::vec3 &axis) -> std::pair< glm::vec3, glm::vec3 >
 Deterministic in-plane basis (u,v) perpendicular to axis.

Variables

constexpr float toast::gizmo_layout::k_screen_size = 0.15f
 world-units of gizmo size per world-unit of camera distance
constexpr float toast::gizmo_layout::k_shaft_length = 0.8f
constexpr float toast::gizmo_layout::k_shaft_half_size = 0.02f
constexpr float toast::gizmo_layout::k_head_length = 0.25f
constexpr float toast::gizmo_layout::k_head_half_size = 0.06f
constexpr float toast::gizmo_layout::k_plane_offset = 0.25f
 Plane-handle quads sit near the origin, offset along each of the plane two axes.
constexpr float toast::gizmo_layout::k_plane_size = 0.2f
constexpr float toast::gizmo_layout::k_center_half_size = 0.06f
constexpr float toast::gizmo_layout::k_axis_hit_radius = 0.05f
 Hit tolerances, in the same gizmo-local unit space as the geometry above.
constexpr float toast::gizmo_layout::k_center_hit_radius = 0.12f
constexpr float toast::gizmo_layout::k_ring_radius = 0.9f
constexpr float toast::gizmo_layout::k_ring_thickness = 0.05f
 band width, used for both rendering and hit-testing
constexpr int toast::gizmo_layout::k_ring_segments = 48
constexpr float toast::gizmo_layout::k_scale_head_half_size = 0.07f
constexpr float toast::gizmo_layout::k_size_dot_half_size = 0.05f
constexpr float toast::gizmo_layout::k_size_dot_hit_radius = 0.09f
constexpr float toast::gizmo_layout::k_min_collider_extent = 0.01f

Detailed Description

Geometry + hit-test constants shared between DebugPass (renders the gizmos) and Workspace (hit-tests/drags them).

All lengths are in gizmo-local unit space, the actual world-space size is this multiplied by the distance-based uniform scale computed each frame (k_screen_size * distance-to-camera), so the gizmo keeps a constant apparent size on screen regardless of distance