MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
ViewportPreset.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace MayaFlux::Buffers {
6class RenderProcessor;
7}
8
9namespace MayaFlux::Core {
10class Window;
11}
12
13namespace MayaFlux {
14
15/// @brief Alias for backwards compatibility; prefer Kinesis::NavigationConfig in new code.
17
18/**
19 * @enum ViewportPresetMode
20 * @brief Selects which navigation controller bind_viewport_preset installs.
21 *
22 * Each mode registers a distinct set of event handlers and may interpret
23 * ViewportPresetConfig fields differently. Modes not yet implemented emit a
24 * runtime error and return without binding.
25 */
26enum class ViewportPresetMode : uint8_t {
27 Fly, ///< First-person fly: WASD/QE translate, RMB drag yaw/pitch, scroll dolly, KP ortho snaps
28 // Orbit, ///< Tumble around a focal point (not yet implemented)
29 // Trackball, ///< Virtual trackball (not yet implemented)
30 // PanZoom2D, ///< Orthographic 2D pan and zoom (not yet implemented)
31};
32
33/**
34 * @brief Bind a navigation preset to a window and render processor.
35 *
36 * Registers event handlers under the prefix "vp_<name>_".
37 * The specific handlers installed depend on @p mode; see ViewportPresetMode.
38 *
39 * Currently only Fly mode is implemented, which does the following:
40 * Registers event handlers under the prefix "vp_<name>_":
41 * W/S/A/D forward, backward, strafe left, strafe right
42 * Q/E move down, move up along world Y
43 * RMB drag yaw and pitch (inverted)
44 * Scroll dolly along view direction
45 * KP1 front view
46 * KP3 right view
47 * KP7 top view
48 * KP9 flip to opposite view
49 *
50 * @param window Window supplying input events
51 * @param processor RenderProcessor that receives the ViewTransform source
52 * @param mode Navigation controller to install, defaults to Fly preset
53 * @param config Tuning parameters
54 * @param name Unique prefix for registered events; must be unique per window
55 */
56MAYAFLUX_API void bind_viewport_preset(
57 const std::shared_ptr<Core::Window>& window,
58 const std::shared_ptr<Buffers::RenderProcessor>& processor,
60 const ViewportPresetConfig& config = {},
61 const std::string& name = "default");
62
63/**
64 * @brief Bind a navigation preset to all RenderProcessors currently registered
65 * against a window.
66 *
67 * Calls bind_viewport_preset(window, rp, mode, config, name) for every buffer
68 * registered with the window at call time that returns a non-null RenderProcessor.
69 * Buffers registered after this call are not covered.
70 *
71 * @param window Window supplying input events
72 * @param mode Navigation controller to install, defaults to Fly preset
73 * @param config Tuning parameters
74 * @param name Preset name forwarded to bind_viewport_preset()
75 */
76MAYAFLUX_API void bind_viewport_preset(
77 const std::shared_ptr<Core::Window>& window,
79 const ViewportPresetConfig& config = {},
80 const std::string& name = "default");
81
82/**
83 * @brief Cancel all event handlers registered by bind_viewport_preset() and
84 * restore the window input config to its state before bind was called.
85 *
86 * @param window Window passed to bind_viewport_preset()
87 * @param name Name passed to bind_viewport_preset()
88 */
89MAYAFLUX_API void unbind_viewport_preset(
90 const std::shared_ptr<Core::Window>& window,
91 const std::string& name = "default");
92
93} // namespace MayaFlux
ViewportPresetMode
Selects which navigation controller bind_viewport_preset installs.
@ Fly
First-person fly: WASD/QE translate, RMB drag yaw/pitch, scroll dolly, KP ortho snaps.
void bind_viewport_preset(const std::shared_ptr< Core::Window > &window, const std::shared_ptr< Buffers::RenderProcessor > &processor, ViewportPresetMode mode, const ViewportPresetConfig &config, const std::string &name)
Bind a navigation preset to a window and render processor.
Kinesis::NavigationConfig ViewportPresetConfig
Alias for backwards compatibility; prefer Kinesis::NavigationConfig in new code.
void unbind_viewport_preset(const std::shared_ptr< Core::Window > &window, const std::string &name)
Cancel all event handlers registered by bind_viewport_preset() and restore the window input config to...
Main namespace for the Maya Flux audio engine.
Definition Runtime.cpp:12
Tuning parameters for a first-person fly-navigation controller.