WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
InputAction.h
Go to the documentation of this file.
1#pragma once
2
3// ---- Input Action System --------------------------------------------------
4// Data-driven input-to-action mapping inspired by Game Engine Architecture
5// (Gregory). Raw inputs (mouse, keyboard) are resolved to logical actions
6// via configurable bindings. The resolved InputState is consumed by the
7// ViewportController to manipulate the camera.
8
9#include "imgui.h"
10
11// ---------------------------------------------------------------------------
12// Logical viewport actions
13// ---------------------------------------------------------------------------
14
16{
17 Orbit, // 2D mouse drag: yaw (from dx) + pitch (from dy)
18 Pan, // 2D mouse drag: lateral (from dx) + vertical (from dy)
19 Zoom, // 1D: scroll wheel or mouse-Y drag changes radius
20 OrbitYaw, // 1D key: yaw offset per frame
21 OrbitPitch, // 1D key: pitch offset per frame
22 PanLateral, // 1D key: pan along camera right vector
23 PanVertical, // 1D key: pan along world Z axis
24 ResetCamera, // Discrete one-shot trigger
25};
26
27// ---------------------------------------------------------------------------
28// Trigger types
29// ---------------------------------------------------------------------------
30
31enum class TriggerType
32{
33 MouseDrag, // Mouse button held + pointer movement
34 MouseScroll, // Mouse wheel rotation
35 KeyHold, // Key held down (continuous, per-frame)
36 KeyPress, // Key pressed (single trigger, edge-detected)
37};
38
39// ---------------------------------------------------------------------------
40// Input binding — maps a raw input to a logical action
41// ---------------------------------------------------------------------------
42
44{
47
49 ImGuiMouseButton mouseButton = ImGuiMouseButton_Left;
50
52 ImGuiKey key = ImGuiKey_None;
53
55 float scaleX = 1.0f;
56
58 float scaleY = 1.0f;
59
61 float keyDelta = 0.0f;
62
64 float shiftScale = 0.1f;
65};
66
67// ---------------------------------------------------------------------------
68// Resolved input state for one frame — consumed by ViewportController
69// ---------------------------------------------------------------------------
70
72{
73 float orbitYaw = 0.0f; // Accumulated yaw delta
74 float orbitPitch = 0.0f; // Accumulated pitch delta
75 float panX = 0.0f; // Lateral pan (camera-right units)
76 float panZ = 0.0f; // Vertical pan (world-Z units)
77 float zoom = 0.0f; // Radius delta (positive = further away)
78 bool resetCamera = false; // One-shot trigger
79};
TriggerType
Definition InputAction.h:32
ViewportAction
Definition InputAction.h:16
float scaleX
Scale applied to mouse delta X (MouseDrag) or wheel value (MouseScroll).
Definition InputAction.h:55
TriggerType trigger
Definition InputAction.h:46
float keyDelta
Fixed delta per frame for KeyHold bindings.
Definition InputAction.h:61
ImGuiMouseButton mouseButton
Mouse button for MouseDrag trigger.
Definition InputAction.h:49
float shiftScale
Multiplier applied when Shift is held (1.0 = Shift has no effect).
Definition InputAction.h:64
ViewportAction action
Definition InputAction.h:45
float scaleY
Scale applied to mouse delta Y (MouseDrag). Unused for 1D triggers.
Definition InputAction.h:58
ImGuiKey key
Key for KeyHold / KeyPress triggers.
Definition InputAction.h:52
bool resetCamera
Definition InputAction.h:78
float orbitPitch
Definition InputAction.h:74
float orbitYaw
Definition InputAction.h:73