MeshLib
 
Loading...
Searching...
No Matches
MRViewer.h
Go to the documentation of this file.
1#pragma once
2
4#include "MRViewerInstance.h"
5#include "MRMouse.h"
6#include <MRMesh/MRVector2.h>
8#include "MRMesh/MRSignal.h"
10#include <cstdint>
11#include <filesystem>
12
13struct GLFWwindow;
14
15template<typename MemberFuncPtr, typename BaseClass>
16auto bindSlotCallback( BaseClass* base, MemberFuncPtr func )
17{
18 static_assert( !( std::is_move_assignable_v<BaseClass> || std::is_move_constructible_v<BaseClass> ),
19 "MAKE_SLOT requires a non-movable type" );
20 return[base, func] ( auto&&... args )
21 {
22 return ( base->*func )( std::forward<decltype( args )>( args )... );
23 };
24}
25
26// you will not be able to move your struct after using this macro
27#define MAKE_SLOT(func) bindSlotCallback(this,func)
28
30#define ENQUEUE_VIEWER_METHOD( NAME, METHOD ) MR::getViewerInstance().emplaceEvent( NAME, [] { \
31 MR::getViewerInstance() . METHOD (); \
32} )
33#define ENQUEUE_VIEWER_METHOD_ARGS( NAME, METHOD, ... ) MR::getViewerInstance().emplaceEvent( NAME, [__VA_ARGS__] { \
34 MR::getViewerInstance() . METHOD ( __VA_ARGS__ ); \
35} )
36#define ENQUEUE_VIEWER_METHOD_ARGS_SKIPABLE( NAME, METHOD, ... ) MR::getViewerInstance().emplaceEvent( NAME, [__VA_ARGS__] { \
37 MR::getViewerInstance() . METHOD ( __VA_ARGS__ ); \
38}, true )
39
40namespace MR
41{
42
43class SpaceMouseHandler;
44
45// This struct contains rules for viewer launch
47{
48 bool fullscreen{ false }; // if true starts fullscreen
49 int width{ 0 };
50 int height{ 0 };
52 {
53 Show, // Show window immediately
54 HideInit, // Show window after init
55 Hide, // Don't show window
56 TryHidden, // Launches in "Hide" mode if OpenGL is present and "NoWindow" if it is not
57 NoWindow // Don't initialize GL window (don't call GL functions)(force `isAnimating`)
58 } windowMode{ HideInit };
60 bool preferOpenGL3{ false };
61 bool render3dSceneInTexture{ true }; // If not set renders scene each frame
62 bool developerFeatures{ false }; // If set shows some developer features useful for debugging
63 std::string name{ "MRViewer" }; // Window name
64 bool startEventLoop{ true }; // If false - does not start event loop
65 bool close{ true }; // If !startEventLoop close immediately after start, otherwise close on window close, make sure you call `launchShut` manually if this flag is false
66 bool console{ false }; // If true - shows developers console
67 int argc{ 0 }; // Pass argc
68 char** argv{ nullptr }; // Pass argv
69
70 bool showMRVersionInTitle{ false }; // if true - print version info in window title
71 bool isAnimating{ false }; // if true - calls render without system events
72 int animationMaxFps{ 30 }; // max fps if animating
73 bool unloadPluginsAtEnd{ false }; // unload all extended libraries right before program exit
74
75 std::shared_ptr<SplashWindow> splashWindow; // if present will show this window while initializing plugins (after menu initialization)
76};
77
78// GLFW-based mesh viewer
79class MRVIEWER_CLASS Viewer
80{
81public:
84
86
87 // Accumulate launch params from cmd args
88 MRVIEWER_API static void parseLaunchParams( LaunchParams& params );
89
90 // Launch viewer with given params
91 MRVIEWER_API int launch( const LaunchParams& params );
92 // Starts event loop
93 MRVIEWER_API void launchEventLoop();
94 // Terminate window
95 MRVIEWER_API void launchShut();
96
97 bool isLaunched() const { return isLaunched_; }
98
99 // get full parameters with witch viewer was launched
100 const LaunchParams& getLaunchParams() const { return launchParams_; }
101
102 // provides non const access to viewer
103 static Viewer* instance() { return &getViewerInstance(); }
104 static Viewer& instanceRef() { return getViewerInstance(); }
105 // provide const access to viewer
106 static const Viewer* constInstance() { return &getViewerInstance(); }
107 static const Viewer& constInstanceRef() { return getViewerInstance(); }
108
109 template<typename PluginType>
110 PluginType* getPluginInstance()
111 {
112 for ( auto& plugin : plugins )
113 {
114 auto p = dynamic_cast< PluginType* >( plugin );
115 if ( p )
116 {
117 return p;
118 }
119 }
120 return nullptr;
121 }
122
123 // Mesh IO
124 // Check the supported file format
125 MRVIEWER_API bool isSupportedFormat( const std::filesystem::path& file_name );
126 // Load objects / scenes from files
127 // Note! load files with progress bar in next frame if it possible, otherwise load directly inside this function
128 MRVIEWER_API bool loadFiles( const std::vector< std::filesystem::path>& filesList );
129 // Save first selected objects to file
130 MRVIEWER_API bool saveToFile( const std::filesystem::path & mesh_file_name );
131
132 // Callbacks
133 MRVIEWER_API bool keyPressed( unsigned int unicode_key, int modifier );
134 MRVIEWER_API bool keyDown( int key, int modifier );
135 MRVIEWER_API bool keyUp( int key, int modifier );
136 MRVIEWER_API bool keyRepeat( int key, int modifier );
137 MRVIEWER_API bool mouseDown( MouseButton button, int modifier );
138 MRVIEWER_API bool mouseUp( MouseButton button, int modifier );
139 MRVIEWER_API bool mouseMove( int mouse_x, int mouse_y );
140 MRVIEWER_API bool mouseScroll( float delta_y );
141 MRVIEWER_API bool mouseClick( MouseButton button, int modifier );
142 MRVIEWER_API bool dragStart( MouseButton button, int modifier );
143 MRVIEWER_API bool dragEnd( MouseButton button, int modifier );
144 MRVIEWER_API bool drag( int mouse_x, int mouse_y );
145 MRVIEWER_API bool spaceMouseMove( const Vector3f& translate, const Vector3f& rotate );
146 MRVIEWER_API bool spaceMouseDown( int key );
147 MRVIEWER_API bool spaceMouseUp( int key );
148 MRVIEWER_API bool spaceMouseRepeat( int key );
149 MRVIEWER_API bool dragDrop( const std::vector<std::filesystem::path>& paths );
150 // Touch callbacks (now used in EMSCRIPTEN build only)
151 MRVIEWER_API bool touchStart( int id, int x, int y );
152 MRVIEWER_API bool touchMove( int id, int x, int y );
153 MRVIEWER_API bool touchEnd( int id, int x, int y );
154 // Touchpad gesture callbacks
155 MRVIEWER_API bool touchpadRotateGestureBegin();
156 MRVIEWER_API bool touchpadRotateGestureUpdate( float angle );
157 MRVIEWER_API bool touchpadRotateGestureEnd();
158 MRVIEWER_API bool touchpadSwipeGestureBegin();
159 MRVIEWER_API bool touchpadSwipeGestureUpdate( float dx, float dy, bool kinetic );
160 MRVIEWER_API bool touchpadSwipeGestureEnd();
161 MRVIEWER_API bool touchpadZoomGestureBegin();
162 MRVIEWER_API bool touchpadZoomGestureUpdate( float scale, bool kinetic );
163 MRVIEWER_API bool touchpadZoomGestureEnd();
164 // This function is called when window should close, if return value is true, window will stay open
165 MRVIEWER_API bool interruptWindowClose();
166 // callback to update connected / disconnected joystick
167 MRVIEWER_API void joystickUpdateConnected( int jid, int event );
168
169 // Draw everything
170 MRVIEWER_API void draw( bool force = false );
171 // Draw 3d scene with UI
172 MRVIEWER_API void drawFull( bool dirtyScene );
173 // Draw 3d scene without UI
174 MRVIEWER_API void drawScene();
175 // Call this function to force redraw scene into scene texture
176 void setSceneDirty() { dirtyScene_ = true; }
177 // Setup viewports views
178 MRVIEWER_API void setupScene();
179 // Cleans framebuffers for all viewports (sets its background)
180 MRVIEWER_API void clearFramebuffers();
181 // OpenGL context resize
182 MRVIEWER_API void resize( int w, int h ); // explicitly set framebuffer size
183 MRVIEWER_API void postResize( int w, int h ); // external resize due to user interaction
184 MRVIEWER_API void postSetPosition( int xPos, int yPos ); // external set position due to user interaction
185 MRVIEWER_API void postSetMaximized( bool maximized ); // external set maximized due to user interaction
186 MRVIEWER_API void postSetIconified( bool iconified ); // external set iconified due to user interaction
187 MRVIEWER_API void postFocus( bool focused ); // external focus handler due to user interaction
188 MRVIEWER_API void postRescale( float x, float y ); // external rescale due to user interaction
189 MRVIEWER_API void postClose(); // called when close signal received
190
192 // Multi-mesh methods //
194
195 // reset objectRoot with newRoot, append all RenderObjects and basis objects
196 MRVIEWER_API void set_root( SceneRootObject& newRoot );
197
198 // removes all objects from scene
199 MRVIEWER_API void clearScene();
200
202 // Multi-viewport methods //
204
205 // Return the current viewport, or the viewport corresponding to a given unique identifier
206 //
207 // Inputs:
208 // viewportId unique identifier corresponding to the desired viewport (current viewport if 0)
209 MRVIEWER_API Viewport& viewport( ViewportId viewportId = {} );
210 MRVIEWER_API const Viewport& viewport( ViewportId viewportId = {} ) const;
211
212 // Append a new "slot" for a viewport (i.e., copy properties of the current viewport, only
213 // changing the viewport size/position)
214 //
215 // Inputs:
216 // viewport Vector specifying the viewport origin and size in screen coordinates.
217 // append_empty If true, existing meshes are hidden on the new viewport.
218 //
219 // Returns the unique id of the newly inserted viewport. There can be a maximum of 31
220 // viewports created in the same viewport. Erasing a viewport does not change the id of
221 // other existing viewports
222 MRVIEWER_API ViewportId append_viewport( const ViewportRectangle & viewportRect, bool append_empty = false );
223
224 // Calculates and returns viewports bounds in gl space:
225 // (0,0) - lower left angle
226 MRVIEWER_API Box2f getViewportsBounds() const;
227
228 // Erase a viewport
229 //
230 // Inputs:
231 // index index of the viewport to erase
232 MRVIEWER_API bool erase_viewport( const size_t index );
233 MRVIEWER_API bool erase_viewport( ViewportId viewport_id );
234
235 // Retrieve viewport index from its unique identifier
236 // Returns -1 if not found
237 MRVIEWER_API int viewport_index( ViewportId viewport_id ) const;
238
239 // Get unique id of the vieport containing the mouse
240 // if mouse is out of any viewport returns index of last selected viewport
241 // (current_mouse_x, current_mouse_y)
242 MRVIEWER_API ViewportId getHoveredViewportId() const;
243
244 // Change selected_core_index to the viewport containing the mouse
245 // (current_mouse_x, current_mouse_y)
246 MRVIEWER_API void select_hovered_viewport();
247
248 // Calls fitData for single/each viewport in viewer
249 // fill = 0.6 parameter means that scene will 0.6 of screen,
250 // snapView - to snap camera angle to closest canonical quaternion
251 MRVIEWER_API void fitDataViewport( MR::ViewportMask vpList = MR::ViewportMask::all(), float fill = 0.6f, bool snapView = true );
252
253 // Calls fitBox for single/each viewport in viewer
254 // fill = 0.6 parameter means that scene will 0.6 of screen,
255 // snapView - to snap camera angle to closest canonical quaternion
256 MRVIEWER_API void fitBoxViewport( const Box3f& box, MR::ViewportMask vpList = MR::ViewportMask::all(), float fill = 0.6f, bool snapView = true );
257
258 // Calls fitData and change FOV to match the screen size then
259 // params - params fit data
261 MRVIEWER_API void preciseFitDataViewport( MR::ViewportMask vpList, const FitDataParams& param );
262
263 MRVIEWER_API size_t getTotalFrames() const;
264 MRVIEWER_API size_t getSwappedFrames() const;
265 MRVIEWER_API size_t getFPS() const;
266 MRVIEWER_API double getPrevFrameDrawTimeMillisec() const;
267
268 // Returns memory amount used by shared GL memory buffer
269 MRVIEWER_API size_t getStaticGLBufferSize() const;
270
271 // if true only last frame of force redraw after events will be swapped, otherwise each will be swapped
272 bool swapOnLastPostEventsRedraw{ true };
273 // minimum auto increment force redraw frames after events
274 int forceRedrawMinimumIncrementAfterEvents{ 4 };
275
276 // Increment number of forced frames to redraw in event loop
277 // if `swapOnLastOnly` only last forced frame will be present on screen and all previous will not
278 MRVIEWER_API void incrementForceRedrawFrames( int i = 1, bool swapOnLastOnly = false );
279
280 // Returns true if current frame will be shown on display
281 MRVIEWER_API bool isCurrentFrameSwapping() const;
282
283 // types of counted events
284 enum class EventType
285 {
286 MouseDown,
287 MouseUp,
288 MouseMove,
289 MouseScroll,
290 KeyDown,
291 KeyUp,
292 KeyRepeat,
293 CharPressed,
294 Count
295 };
296 // Returns number of events of given type
297 MRVIEWER_API size_t getEventsCount( EventType type )const;
298
299 // types of gl primitives counters
301 {
302 // arrays and elements are different gl calls
303 PointArraySize,
304 LineArraySize,
305 TriangleArraySize,
306 PointElementsNum,
307 LineElementsNum,
308 TriangleElementsNum,
309 Count
310 };
311 // Returns number of events of given type
312 MRVIEWER_API size_t getLastFrameGLPrimitivesCount( GLPrimitivesType type ) const;
313 // Increment number of gl primitives drawed in this frame
314 MRVIEWER_API void incrementThisFrameGLPrimitivesCount( GLPrimitivesType type, size_t num );
315
316
317 // Returns mask of present viewports
318 ViewportMask getPresentViewports() const { return presentViewportsMask_; }
319
320 // Restes frames counter and events counter
321 MRVIEWER_API void resetAllCounters();
322
327 MRVIEWER_API Image captureSceneScreenShot( const Vector2i& resolution = Vector2i() );
328
335 MRVIEWER_API void captureUIScreenShot( std::function<void( const Image& )> callback,
336 const Vector2i& pos = Vector2i(), const Vector2i& size = Vector2i() );
337
338 // Returns true if can enable alpha sort
339 MRVIEWER_API bool isAlphaSortAvailable() const;
340 // Tries to enable alpha sort,
341 // returns true if value was changed, return false otherwise
342 MRVIEWER_API bool enableAlphaSort( bool on );
343 // Returns true if alpha sort is enabled, false otherwise
344 bool isAlphaSortEnabled() const { return alphaSortEnabled_; }
345
346 // Returns if scene texture is now bound
347 MRVIEWER_API bool isSceneTextureBound() const;
348 // Binds or unbinds scene texture (should be called only with valid window)
349 // note that it does not clear framebuffer
350 MRVIEWER_API void bindSceneTexture( bool bind );
351
352 // Sets manager of viewer settings which loads user personal settings on beginning of app
353 // and saves it in app's ending
354 MRVIEWER_API void setViewportSettingsManager( std::unique_ptr<IViewerSettingsManager> mng );
355 MRVIEWER_API const std::unique_ptr<IViewerSettingsManager>& getViewportSettingsManager() const { return settingsMng_; }
356
358 // Finds point in all spaces from screen space pixel point
359 MRVIEWER_API PointInAllSpaces getPixelPointInfo( const Vector3f& screenPoint ) const;
360 // Finds point under mouse in all spaces and under mouse viewport id
362
363 // Converts screen space coordinate to viewport space coordinate
364 // (0,0) if viewport does not exist
365 // screen space: X [0,framebufferSize.x], Y [0,framebufferSize.y] - (0,0) is upper left of window
366 // viewport space: X [0,viewport_width], Y [0,viewport_height] - (0,0) is upper left of viewport
367 // Z [0,1] - 0 is Dnear, 1 is Dfar
368 MRVIEWER_API Vector3f screenToViewport( const Vector3f& screenPoint, ViewportId id ) const;
369 // Converts viewport space coordinate to screen space coordinate
370 // (0,0) if viewport does not exist
371 // screen space: X [0,framebufferSize.x], Y [0,framebufferSize.y] - (0,0) is upper left of window
372 // viewport space: X [0,viewport_width], Y [0,viewport_height] - (0,0) is upper left of viewport
373 // Z [0,1] - 0 is Dnear, 1 is Dfar
374 MRVIEWER_API Vector3f viewportToScreen( const Vector3f& viewportPoint, ViewportId id ) const;
375
376 // Returns viewports satisfying given mask
377 MRVIEWER_API std::vector<std::reference_wrapper<Viewport>> getViewports( ViewportMask mask = ViewportMask::any() );
378
379 // Enables or disables global history (clears it on disable)
380 MRVIEWER_API void enableGlobalHistory( bool on );
381 // Return true if global history is enabled, false otherwise
382 bool isGlobalHistoryEnabled() const { return bool( globalHistoryStore_ ); };
383 // Appends history action to current stack position (clearing redo)
384 // if global history is disabled do nothing
385 MRVIEWER_API void appendHistoryAction( const std::shared_ptr<HistoryAction>& action );
386 // Applies undo if global history is enabled
387 // return true if undo was applied
388 MRVIEWER_API bool globalHistoryUndo();
389 // Applies redo if global history is enabled
390 // return true if redo was applied
391 MRVIEWER_API bool globalHistoryRedo();
392 // Returns global history store
393 const std::shared_ptr<HistoryStore>& getGlobalHistoryStore() const { return globalHistoryStore_; }
394 // Return spacemouse handler
395 const std::shared_ptr<SpaceMouseHandler>& getSpaceMouseHandler() const { return spaceMouseHandler_; }
396
397 // This method is called after successful scene saving to update scene root, window title and undo
398 MRVIEWER_API void onSceneSaved( const std::filesystem::path& savePath, bool storeInRecent = true );
399
400 // Get/Set menu plugin (which is separated from other plugins to be inited first before splash window starts)
401 MRVIEWER_API const std::shared_ptr<ImGuiMenu>& getMenuPlugin() const;
402 MRVIEWER_API void setMenuPlugin( std::shared_ptr<ImGuiMenu> menu );
403
404 // Get the menu plugin casted in given type
405 template <typename T>
406 std::shared_ptr<T> getMenuPluginAs() const { return std::dynamic_pointer_cast<T>( getMenuPlugin() ); }
407
408 // sets stop event loop flag (this flag is glfwShouldWindowClose equivalent)
409 MRVIEWER_API void stopEventLoop();
410 // get stop event loop flag (this flag is glfwShouldWindowClose equivalent)
411 bool getStopEventLoopFlag() const { return stopEventLoop_; }
412
413 // return true if window should close
414 // calls interrupt signal and if no slot interrupts return true, otherwise return false
416
417 // returns true if viewer has valid GL context
418 // note that sometimes it is not enough, for example to free GL memory in destructor,
419 // glInitialized_ can be already reset and it requires `loadGL()` check too
420 bool isGLInitialized() const { return glInitialized_; }
421
422 // update the title of the main window and, if any scene was opened, show its filename
423 MRVIEWER_API void makeTitleFromSceneRootPath();
424
425 // returns true if the system framebuffer is scaled (valid for macOS and Wayland)
426 bool hasScaledFramebuffer() const { return hasScaledFramebuffer_; }
427
428public:
430 // Member variables //
432 GLFWwindow* window;
433
434 // A function to reset setting to initial state
435 // Overrides should call previous function
436 std::function<void( Viewer* viewer )> resetSettingsFunction;
437
438 // Stores all the viewing options
439 std::vector<Viewport> viewport_list;
441
442 // List of registered plugins
443 std::vector<ViewerPlugin*> plugins;
444
445 float pixelRatio{ 1.0f };
447 Vector2i windowSavePos; // pos to save
448 Vector2i windowSaveSize; // size to save
449 Vector2i windowOldPos;
450 bool windowMaximized{ false };
451
452 // if true - calls render without system events
453 bool isAnimating{ false };
454 // max fps if animating
455 int animationMaxFps{ 30 };
456 // this parameter can force up/down mouse scroll
457 // useful for WebAssembler version because it has too powerful scroll
458 float scrollForce{ }; // init in resetSettingsFunction()
459 // opengl-based pick window radius in pixels
460 uint16_t glPickRadius{ }; // init in resetSettingsFunction()
461 // Experimental/developer features enabled
462 bool experimentalFeatures{ };
463 // command arguments, each parsed arg should be erased from here not to affect other parsers
464 std::vector<std::string> commandArgs;
465
466 std::unique_ptr<ObjectMesh> basisAxes;
467 std::unique_ptr<ObjectMesh> globalBasisAxes;
468 std::unique_ptr<ObjectMesh> rotationSphere;
469 // Stores clipping plane mesh
470 std::unique_ptr<ObjectMesh> clippingPlaneObject;
471
472 // the window title that should be always displayed
474
475 //*********
476 // SIGNALS
477 //*********
479 // Mouse events
480 using MouseUpDownSignal = boost::signals2::signal<bool( MouseButton btn, int modifier ), SignalStopHandler>;
481 using MouseMoveSignal = boost::signals2::signal<bool( int x, int y ), SignalStopHandler>;
482 using MouseScrollSignal = boost::signals2::signal<bool( float delta ), SignalStopHandler>;
483 MouseUpDownSignal mouseDownSignal; // signal is called on mouse down
484 MouseUpDownSignal mouseUpSignal; // signal is called on mouse up
485 MouseMoveSignal mouseMoveSignal; // signal is called on mouse move, note that input x and y are in screen space
486 MouseScrollSignal mouseScrollSignal; // signal is called on mouse is scrolled
487 // High-level mouse events for clicks and dragging, emitted by MouseController
488 // When mouseClickSignal has connections, a small delay for click detection is introduced into camera operations and dragging
489 // Dragging starts if dragStartSignal is handled (returns true), and ends on button release
490 // When dragging is active, dragSignal and dragEndSignal are emitted instead of mouseMove and mouseUp
491 // mouseDown handler have priority over dragStart
492 MouseUpDownSignal mouseClickSignal; // signal is called when mouse button is pressed and immediately released
493 MouseUpDownSignal dragStartSignal; // signal is called when mouse button is pressed (deterred if click behavior is on)
494 MouseUpDownSignal dragEndSignal; // signal is called when mouse button used to start drag is released
495 MouseMoveSignal dragSignal; // signal is called when mouse is being dragged with button down
496 // Cursor enters/leaves
497 using CursorEntranceSignal = boost::signals2::signal<void(bool)>;
499 // Keyboard event
500 using CharPressedSignal = boost::signals2::signal<bool( unsigned unicodeKey, int modifier ), SignalStopHandler>;
501 using KeySignal = boost::signals2::signal<bool( int key, int modifier ), SignalStopHandler>;
502 CharPressedSignal charPressedSignal; // signal is called when unicode char on/is down/pressed for some time
503 KeySignal keyUpSignal; // signal is called on key up
504 KeySignal keyDownSignal; // signal is called on key down
505 KeySignal keyRepeatSignal; // signal is called when key is pressed for some time
506 // SpaceMouseEvents
507 using SpaceMouseMoveSignal = boost::signals2::signal<bool( const Vector3f& translate, const Vector3f& rotate ), SignalStopHandler>;
508 using SpaceMouseKeySignal = boost::signals2::signal<bool( int ), SignalStopHandler>;
509 SpaceMouseMoveSignal spaceMouseMoveSignal; // signal is called on spacemouse 3d controller (joystick) move
510 SpaceMouseKeySignal spaceMouseDownSignal; // signal is called on spacemouse key down
511 SpaceMouseKeySignal spaceMouseUpSignal; // signal is called on spacemouse key up
512 SpaceMouseKeySignal spaceMouseRepeatSignal; // signal is called when spacemouse key is pressed for some time
513 // Render events
514 using RenderSignal = boost::signals2::signal<void()>;
515 RenderSignal preDrawSignal; // signal is called before scene draw (but after scene setup)
516 RenderSignal preDrawPostViewportSignal; // signal is called before scene draw but after viewport.preDraw()
517 RenderSignal drawSignal; // signal is called on scene draw (after objects tree but before viewport.postDraw())
518 RenderSignal postDrawPreViewportSignal; // signal is called after scene draw but after before viewport.postDraw()
519 RenderSignal postDrawSignal; // signal is called after scene draw
520 // Scene events
521 using DragDropSignal = boost::signals2::signal<bool( const std::vector<std::filesystem::path>& paths ), SignalStopHandler>;
522 using PostResizeSignal = boost::signals2::signal<void( int x, int y )>;
523 using PostRescaleSignal = boost::signals2::signal<void( float xscale, float yscale )>;
524 using InterruptCloseSignal = boost::signals2::signal<bool(), SignalStopHandler>;
525 DragDropSignal dragDropSignal; // signal is called on drag and drop file
526 PostResizeSignal postResizeSignal; // signal is called after window resize
527 PostRescaleSignal postRescaleSignal; // signal is called after window rescale
528 InterruptCloseSignal interruptCloseSignal; // signal is called before close window (return true will prevent closing)
529 // Touch signals
530 using TouchSignal = boost::signals2::signal<bool(int,int,int), SignalStopHandler>;
531 TouchSignal touchStartSignal; // signal is called when any touch starts
532 TouchSignal touchMoveSignal; // signal is called when touch moves
533 TouchSignal touchEndSignal; // signal is called when touch stops
534 // Touchpad gesture events
535 using TouchpadGestureBeginSignal = boost::signals2::signal<bool(), SignalStopHandler>;
536 using TouchpadGestureEndSignal = boost::signals2::signal<bool(), SignalStopHandler>;
537 using TouchpadRotateGestureUpdateSignal = boost::signals2::signal<bool( float angle ), SignalStopHandler>;
538 using TouchpadSwipeGestureUpdateSignal = boost::signals2::signal<bool( float deltaX, float deltaY, bool kinetic ), SignalStopHandler>;
539 using TouchpadZoomGestureUpdateSignal = boost::signals2::signal<bool( float scale, bool kinetic ), SignalStopHandler>;
540 TouchpadGestureBeginSignal touchpadRotateGestureBeginSignal; // signal is called on touchpad rotate gesture beginning
541 TouchpadRotateGestureUpdateSignal touchpadRotateGestureUpdateSignal; // signal is called on touchpad rotate gesture update
542 TouchpadGestureEndSignal touchpadRotateGestureEndSignal; // signal is called on touchpad rotate gesture end
543 TouchpadGestureBeginSignal touchpadSwipeGestureBeginSignal; // signal is called on touchpad swipe gesture beginning
544 TouchpadSwipeGestureUpdateSignal touchpadSwipeGestureUpdateSignal; // signal is called on touchpad swipe gesture update
545 TouchpadGestureEndSignal touchpadSwipeGestureEndSignal; // signal is called on touchpad swipe gesture end
546 TouchpadGestureBeginSignal touchpadZoomGestureBeginSignal; // signal is called on touchpad zoom gesture beginning
547 TouchpadZoomGestureUpdateSignal touchpadZoomGestureUpdateSignal; // signal is called on touchpad zoom gesture update
548 TouchpadGestureEndSignal touchpadZoomGestureEndSignal; // signal is called on touchpad zoom gesture end
549 // Window focus signal
550 using PostFocusSignal = boost::signals2::signal<void( bool )>;
552
555 MRVIEWER_API void emplaceEvent( std::string name, ViewerEventCallback cb, bool skipable = false );
556 // pop all events from the queue while they have this name
557 MRVIEWER_API void popEventByName( const std::string& name );
558
559 MRVIEWER_API void postEmptyEvent();
560
561 [[nodiscard]] MRVIEWER_API const TouchpadParameters & getTouchpadParameters() const;
562 MRVIEWER_API void setTouchpadParameters( const TouchpadParameters & );
563
564 [[nodiscard]] MRVIEWER_API SpaceMouseParameters getSpaceMouseParameters() const;
565 MRVIEWER_API void setSpaceMouseParameters( const SpaceMouseParameters & );
566
567 [[nodiscard]] const MouseController &mouseController() const { return *mouseController_; }
568 [[nodiscard]] MouseController &mouseController() { return *mouseController_; }
569
570 // Store of recently opened files
571 [[nodiscard]] const RecentFilesStore &recentFilesStore() const { return *recentFilesStore_; }
572 [[nodiscard]] RecentFilesStore &recentFilesStore() { return *recentFilesStore_; }
573
574private:
575 Viewer();
576 ~Viewer();
577
578 // Init window
579 int launchInit_( const LaunchParams& params );
580 // Return true if OpenGL loaded successfully
581 bool checkOpenGL_(const LaunchParams& params );
582 // Init base objects
583 void init_();
584 // Init all plugins on start
585 void initPlugins_();
586 // Shut all plugins at the end
587 void shutdownPlugins_();
588#ifdef __EMSCRIPTEN__
589 void mainLoopFunc_();
590 static void emsMainInfiniteLoop();
591#endif
592 // returns true if was swapped
593 bool draw_( bool force );
594
595 void drawUiRenderObjects_();
596
597 // the minimum number of frames to be rendered even if the scene is unchanged
598 int forceRedrawFrames_{ 0 };
599 // Should be `<= forceRedrawFrames_`. The next N frames will not be shown on screen.
600 int forceRedrawFramesWithoutSwap_{ 0 };
601
602 // if this flag is set shows some developer features useful for debugging
603 bool enableDeveloperFeatures_{ false };
604
605 std::unique_ptr<ViewerEventQueue> eventQueue_;
606
607 // special plugin for menu (initialized before splash window starts)
608 std::shared_ptr<ImGuiMenu> menuPlugin_;
609
610 std::unique_ptr<TouchpadController> touchpadController_;
611 std::unique_ptr<SpaceMouseController> spaceMouseController_;
612 std::unique_ptr<TouchesController> touchesController_;
613 std::unique_ptr<MouseController> mouseController_;
614
615 std::unique_ptr<RecentFilesStore> recentFilesStore_;
616 std::unique_ptr<FrameCounter> frameCounter_;
617
618 mutable struct EventsCounter
619 {
620 std::array<size_t, size_t( EventType::Count )> counter{};
621 void reset();
622 } eventsCounter_;
623
624 mutable struct GLPrimitivesCounter
625 {
626 std::array<size_t, size_t( GLPrimitivesType::Count )> counter{};
627 void reset();
628 } glPrimitivesCounter_;
629
630
631 // creates glfw window with gl version major.minor, false if failed;
632 bool tryCreateWindow_( bool fullscreen, int& width, int& height, const std::string& name, int major, int minor );
633
634 bool needRedraw_() const;
635 void resetRedraw_();
636
637 void recursiveDraw_( const Viewport& vp, const Object& obj, const AffineXf3f& parentXf, RenderModelPassMask renderType, int* numDraws = nullptr ) const;
638
639 void initGlobalBasisAxesObject_();
640 void initBasisAxesObject_();
641 void initClippingPlaneObject_();
642 void initRotationCenterObject_();
643 void initSpaceMouseHandler_();
644
645 // recalculate pixel ratio
646 void updatePixelRatio_();
647
648 bool stopEventLoop_{ false };
649
650 bool isLaunched_{ false };
651 // this flag is needed to know if all viewer setup was already done, and we can call draw
652 bool focusRedrawReady_{ false };
653
654 std::unique_ptr<SceneTextureGL> sceneTexture_;
655 std::unique_ptr<AlphaSortGL> alphaSorter_;
656
657 bool alphaSortEnabled_{false};
658
659 bool glInitialized_{ false };
660
661 bool isInDraw_{ false };
662 bool dirtyScene_{ false };
663
664 bool hasScaledFramebuffer_{ false };
665
666 LaunchParams launchParams_;
667
668 ViewportId getFirstAvailableViewportId_() const;
669 ViewportMask presentViewportsMask_;
670
671 std::unique_ptr<IViewerSettingsManager> settingsMng_;
672
673 std::shared_ptr<HistoryStore> globalHistoryStore_;
674
675 std::shared_ptr<SpaceMouseHandler> spaceMouseHandler_;
676
677 boost::signals2::scoped_connection updateGlobalBasis_, updateBasisAxes_;
678
679 friend MRVIEWER_API Viewer& getViewerInstance();
680};
681
682// starts default viewer with given params and setup
683MRVIEWER_API int launchDefaultViewer( const Viewer::LaunchParams& params, const ViewerSetup& setup );
684
685// call this function to load MRViewer.dll
686MRVIEWER_API void loadMRViewerDll();
687
688} // end namespace
angle
Definition MRObjectDimensionsEnum.h:13
auto bindSlotCallback(BaseClass *base, MemberFuncPtr func)
Definition MRViewer.h:16
affine transformation: y = A*x + b, where A in VxV, and b in V
Definition MRDotNet/MRAffineXf.h:8
Definition MRMouseController.h:21
Definition MRRecentFilesStore.h:17
Object that is parent of all scene.
Definition MRSceneRoot.h:11
Definition MRSetupViewer.h:11
Definition MRViewer.h:80
std::unique_ptr< ObjectMesh > globalBasisAxes
Definition MRViewer.h:467
boost::signals2::signal< bool(const Vector3f &translate, const Vector3f &rotate), SignalStopHandler > SpaceMouseMoveSignal
Definition MRViewer.h:507
bool hasScaledFramebuffer() const
Definition MRViewer.h:426
MRVIEWER_API bool saveToFile(const std::filesystem::path &mesh_file_name)
MRVIEWER_API bool keyUp(int key, int modifier)
PostResizeSignal postResizeSignal
Definition MRViewer.h:526
bool windowShouldClose()
TouchpadGestureBeginSignal touchpadRotateGestureBeginSignal
Definition MRViewer.h:540
MRVIEWER_API void fitDataViewport(MR::ViewportMask vpList=MR::ViewportMask::all(), float fill=0.6f, bool snapView=true)
MRVIEWER_API bool isAlphaSortAvailable() const
boost::signals2::signal< bool(), SignalStopHandler > InterruptCloseSignal
Definition MRViewer.h:524
MRVIEWER_API ViewportId getHoveredViewportId() const
boost::signals2::signal< void()> RenderSignal
Definition MRViewer.h:514
boost::signals2::signal< bool(int x, int y), SignalStopHandler > MouseMoveSignal
Definition MRViewer.h:481
MRVIEWER_API void setViewportSettingsManager(std::unique_ptr< IViewerSettingsManager > mng)
PostFocusSignal postFocusSignal
Definition MRViewer.h:551
TouchpadGestureBeginSignal touchpadSwipeGestureBeginSignal
Definition MRViewer.h:543
TouchpadRotateGestureUpdateSignal touchpadRotateGestureUpdateSignal
Definition MRViewer.h:541
RenderSignal preDrawPostViewportSignal
Definition MRViewer.h:516
MRVIEWER_API bool keyRepeat(int key, int modifier)
MRVIEWER_API std::vector< std::reference_wrapper< Viewport > > getViewports(ViewportMask mask=ViewportMask::any())
const MouseController & mouseController() const
Definition MRViewer.h:567
MRVIEWER_API void appendHistoryAction(const std::shared_ptr< HistoryAction > &action)
boost::signals2::signal< bool(MouseButton btn, int modifier), SignalStopHandler > MouseUpDownSignal
Definition MRViewer.h:480
MRVIEWER_API PointInAllSpaces getMousePointInfo() const
MouseUpDownSignal dragStartSignal
Definition MRViewer.h:493
boost::signals2::signal< bool(int key, int modifier), SignalStopHandler > KeySignal
Definition MRViewer.h:501
MRVIEWER_API const std::shared_ptr< ImGuiMenu > & getMenuPlugin() const
MRVIEWER_API void resize(int w, int h)
MRVIEWER_API bool mouseClick(MouseButton button, int modifier)
std::vector< ViewerPlugin * > plugins
Definition MRViewer.h:443
static MRVIEWER_API void parseLaunchParams(LaunchParams &params)
RenderSignal drawSignal
Definition MRViewer.h:517
MRVIEWER_API Box2f getViewportsBounds() const
boost::signals2::signal< void(bool)> CursorEntranceSignal
Definition MRViewer.h:497
TouchpadGestureBeginSignal touchpadZoomGestureBeginSignal
Definition MRViewer.h:546
Vector2i windowSaveSize
Definition MRViewer.h:448
EventType
Definition MRViewer.h:285
RenderSignal postDrawPreViewportSignal
Definition MRViewer.h:518
ViewportMask getPresentViewports() const
Definition MRViewer.h:318
MRVIEWER_API bool touchpadSwipeGestureEnd()
MRVIEWER_API bool erase_viewport(ViewportId viewport_id)
MRVIEWER_API SpaceMouseParameters getSpaceMouseParameters() const
InterruptCloseSignal interruptCloseSignal
Definition MRViewer.h:528
MRVIEWER_API void fitBoxViewport(const Box3f &box, MR::ViewportMask vpList=MR::ViewportMask::all(), float fill=0.6f, bool snapView=true)
RenderSignal postDrawSignal
Definition MRViewer.h:519
MRVIEWER_API void setSpaceMouseParameters(const SpaceMouseParameters &)
MRVIEWER_API size_t getEventsCount(EventType type) const
KeySignal keyUpSignal
Definition MRViewer.h:503
std::shared_ptr< T > getMenuPluginAs() const
Definition MRViewer.h:406
const std::shared_ptr< HistoryStore > & getGlobalHistoryStore() const
Definition MRViewer.h:393
boost::signals2::signal< void(float xscale, float yscale)> PostRescaleSignal
Definition MRViewer.h:523
MRVIEWER_API const std::unique_ptr< IViewerSettingsManager > & getViewportSettingsManager() const
Definition MRViewer.h:355
bool isGLInitialized() const
Definition MRViewer.h:420
MRVIEWER_API void onSceneSaved(const std::filesystem::path &savePath, bool storeInRecent=true)
boost::signals2::signal< bool(), SignalStopHandler > TouchpadGestureBeginSignal
Definition MRViewer.h:535
MRVIEWER_API bool touchStart(int id, int x, int y)
std::string defaultWindowTitle
Definition MRViewer.h:473
MRVIEWER_API bool mouseMove(int mouse_x, int mouse_y)
MRVIEWER_API void clearFramebuffers()
Vector2i windowOldPos
Definition MRViewer.h:449
boost::signals2::signal< bool(int), SignalStopHandler > SpaceMouseKeySignal
Definition MRViewer.h:508
std::vector< std::string > commandArgs
Definition MRViewer.h:464
TouchpadGestureEndSignal touchpadZoomGestureEndSignal
Definition MRViewer.h:548
MRVIEWER_API Vector3f viewportToScreen(const Vector3f &viewportPoint, ViewportId id) const
boost::signals2::signal< bool(unsigned unicodeKey, int modifier), SignalStopHandler > CharPressedSignal
Definition MRViewer.h:500
MouseUpDownSignal dragEndSignal
Definition MRViewer.h:494
boost::signals2::signal< void(bool)> PostFocusSignal
Definition MRViewer.h:550
MouseUpDownSignal mouseClickSignal
Definition MRViewer.h:492
KeySignal keyDownSignal
Definition MRViewer.h:504
MRVIEWER_API bool isCurrentFrameSwapping() const
MRVIEWER_API double getPrevFrameDrawTimeMillisec() const
MRVIEWER_API void enableGlobalHistory(bool on)
MRVIEWER_API int launch(const LaunchParams &params)
MouseScrollSignal mouseScrollSignal
Definition MRViewer.h:486
MRVIEWER_API size_t getSwappedFrames() const
MRVIEWER_API void popEventByName(const std::string &name)
const LaunchParams & getLaunchParams() const
Definition MRViewer.h:100
std::function< void(Viewer *viewer)> resetSettingsFunction
Definition MRViewer.h:436
TouchSignal touchEndSignal
Definition MRViewer.h:533
MRVIEWER_API bool touchMove(int id, int x, int y)
MouseMoveSignal mouseMoveSignal
Definition MRViewer.h:485
MRVIEWER_API bool erase_viewport(const size_t index)
SpaceMouseMoveSignal spaceMouseMoveSignal
Definition MRViewer.h:509
MRVIEWER_API bool touchpadSwipeGestureBegin()
MRVIEWER_API bool dragDrop(const std::vector< std::filesystem::path > &paths)
MRVIEWER_API bool spaceMouseDown(int key)
MRVIEWER_API bool touchpadSwipeGestureUpdate(float dx, float dy, bool kinetic)
friend MRVIEWER_API Viewer & getViewerInstance()
TouchpadZoomGestureUpdateSignal touchpadZoomGestureUpdateSignal
Definition MRViewer.h:547
MRVIEWER_API PointInAllSpaces getPixelPointInfo(const Vector3f &screenPoint) const
std::unique_ptr< ObjectMesh > rotationSphere
Definition MRViewer.h:468
bool isAlphaSortEnabled() const
Definition MRViewer.h:344
MRVIEWER_API void emplaceEvent(std::string name, ViewerEventCallback cb, bool skipable=false)
MRVIEWER_API void joystickUpdateConnected(int jid, int event)
MRVIEWER_API bool spaceMouseUp(int key)
CharPressedSignal charPressedSignal
Definition MRViewer.h:502
MRVIEWER_API void incrementForceRedrawFrames(int i=1, bool swapOnLastOnly=false)
size_t selected_viewport_index
Definition MRViewer.h:440
MRVIEWER_API const TouchpadParameters & getTouchpadParameters() const
MRVIEWER_API void postSetMaximized(bool maximized)
const std::shared_ptr< SpaceMouseHandler > & getSpaceMouseHandler() const
Definition MRViewer.h:395
static Viewer * instance()
Definition MRViewer.h:103
MRVIEWER_API bool mouseUp(MouseButton button, int modifier)
MRVIEWER_API bool enableAlphaSort(bool on)
PluginType * getPluginInstance()
Definition MRViewer.h:110
MRVIEWER_API bool mouseScroll(float delta_y)
bool isLaunched() const
Definition MRViewer.h:97
MRVIEWER_API void postEmptyEvent()
static const Viewer * constInstance()
Definition MRViewer.h:106
TouchpadGestureEndSignal touchpadRotateGestureEndSignal
Definition MRViewer.h:542
RenderSignal preDrawSignal
Definition MRViewer.h:515
MRVIEWER_API size_t getFPS() const
TouchpadGestureEndSignal touchpadSwipeGestureEndSignal
Definition MRViewer.h:545
MRVIEWER_API Vector3f screenToViewport(const Vector3f &screenPoint, ViewportId id) const
MRVIEWER_API bool dragEnd(MouseButton button, int modifier)
boost::signals2::signal< bool(int, int, int), SignalStopHandler > TouchSignal
Definition MRViewer.h:530
TouchpadSwipeGestureUpdateSignal touchpadSwipeGestureUpdateSignal
Definition MRViewer.h:544
MRVIEWER_API const Viewport & viewport(ViewportId viewportId={}) const
static const Viewer & constInstanceRef()
Definition MRViewer.h:107
MRVIEWER_API bool touchpadZoomGestureEnd()
MRVIEWER_API Image captureSceneScreenShot(const Vector2i &resolution=Vector2i())
MouseUpDownSignal mouseDownSignal
Definition MRViewer.h:483
boost::signals2::signal< bool(float scale, bool kinetic), SignalStopHandler > TouchpadZoomGestureUpdateSignal
Definition MRViewer.h:539
MRVIEWER_API bool touchpadRotateGestureBegin()
MRVIEWER_API bool mouseDown(MouseButton button, int modifier)
RecentFilesStore & recentFilesStore()
Definition MRViewer.h:572
MRVIEWER_API void select_hovered_viewport()
MRVIEWER_API ViewportId append_viewport(const ViewportRectangle &viewportRect, bool append_empty=false)
MRVIEWER_API bool touchpadRotateGestureUpdate(float angle)
MRVIEWER_API bool spaceMouseRepeat(int key)
MRVIEWER_API void incrementThisFrameGLPrimitivesCount(GLPrimitivesType type, size_t num)
MRVIEWER_API void postRescale(float x, float y)
static Viewer & instanceRef()
Definition MRViewer.h:104
MRVIEWER_API bool touchpadZoomGestureBegin()
MRVIEWER_API void bindSceneTexture(bool bind)
MRVIEWER_API bool touchpadZoomGestureUpdate(float scale, bool kinetic)
MRVIEWER_API void set_root(SceneRootObject &newRoot)
MRVIEWER_API void stopEventLoop()
MRVIEWER_API void launchEventLoop()
PostRescaleSignal postRescaleSignal
Definition MRViewer.h:527
DragDropSignal dragDropSignal
Definition MRViewer.h:525
MRVIEWER_API void captureUIScreenShot(std::function< void(const Image &)> callback, const Vector2i &pos=Vector2i(), const Vector2i &size=Vector2i())
boost::signals2::signal< void(int x, int y)> PostResizeSignal
Definition MRViewer.h:522
MRVIEWER_API void launchShut()
MRVIEWER_API bool globalHistoryUndo()
boost::signals2::signal< bool(), SignalStopHandler > TouchpadGestureEndSignal
Definition MRViewer.h:536
MRVIEWER_API void preciseFitDataViewport(MR::ViewportMask vpList=MR::ViewportMask::all())
Vector2i framebufferSize
Definition MRViewer.h:446
CursorEntranceSignal cursorEntranceSignal
Definition MRViewer.h:498
MRVIEWER_API bool keyDown(int key, int modifier)
MRVIEWER_API void setupScene()
std::unique_ptr< ObjectMesh > clippingPlaneObject
Definition MRViewer.h:470
MRVIEWER_API void setMenuPlugin(std::shared_ptr< ImGuiMenu > menu)
MRVIEWER_API Viewport & viewport(ViewportId viewportId={})
MouseUpDownSignal mouseUpSignal
Definition MRViewer.h:484
MRVIEWER_API size_t getStaticGLBufferSize() const
GLPrimitivesType
Definition MRViewer.h:301
boost::signals2::signal< bool(float deltaX, float deltaY, bool kinetic), SignalStopHandler > TouchpadSwipeGestureUpdateSignal
Definition MRViewer.h:538
Vector2i windowSavePos
Definition MRViewer.h:447
MRVIEWER_API size_t getLastFrameGLPrimitivesCount(GLPrimitivesType type) const
MRVIEWER_API bool dragStart(MouseButton button, int modifier)
MRVIEWER_API void drawFull(bool dirtyScene)
MRVIEWER_API bool loadFiles(const std::vector< std::filesystem::path > &filesList)
SpaceMouseKeySignal spaceMouseUpSignal
Definition MRViewer.h:511
std::unique_ptr< ObjectMesh > basisAxes
Definition MRViewer.h:466
TouchSignal touchStartSignal
Definition MRViewer.h:531
MRVIEWER_API void drawScene()
GLFWwindow * window
Definition MRViewer.h:432
MRVIEWER_API bool drag(int mouse_x, int mouse_y)
SpaceMouseKeySignal spaceMouseDownSignal
Definition MRViewer.h:510
MRVIEWER_API void postSetIconified(bool iconified)
MRVIEWER_API bool globalHistoryRedo()
MRVIEWER_API void makeTitleFromSceneRootPath()
MRVIEWER_API size_t getTotalFrames() const
MRVIEWER_API void postFocus(bool focused)
void setSceneDirty()
Definition MRViewer.h:176
MRVIEWER_API void resetAllCounters()
MRVIEWER_API bool isSupportedFormat(const std::filesystem::path &file_name)
MouseMoveSignal dragSignal
Definition MRViewer.h:495
boost::signals2::signal< bool(const std::vector< std::filesystem::path > &paths), SignalStopHandler > DragDropSignal
Definition MRViewer.h:521
MRVIEWER_API void draw(bool force=false)
MRVIEWER_API int viewport_index(ViewportId viewport_id) const
MRVIEWER_API bool touchpadRotateGestureEnd()
boost::signals2::signal< bool(float angle), SignalStopHandler > TouchpadRotateGestureUpdateSignal
Definition MRViewer.h:537
MouseController & mouseController()
Definition MRViewer.h:568
MRVIEWER_API bool isSceneTextureBound() const
MRVIEWER_API bool touchEnd(int id, int x, int y)
boost::signals2::signal< bool(float delta), SignalStopHandler > MouseScrollSignal
Definition MRViewer.h:482
SpaceMouseKeySignal spaceMouseRepeatSignal
Definition MRViewer.h:512
const RecentFilesStore & recentFilesStore() const
Definition MRViewer.h:571
MRVIEWER_API bool interruptWindowClose()
MRVIEWER_API bool spaceMouseMove(const Vector3f &translate, const Vector3f &rotate)
MRVIEWER_API void setTouchpadParameters(const TouchpadParameters &)
MRVIEWER_API void preciseFitDataViewport(MR::ViewportMask vpList, const FitDataParams &param)
bool isGlobalHistoryEnabled() const
Definition MRViewer.h:382
KeySignal keyRepeatSignal
Definition MRViewer.h:505
MRVIEWER_API void postResize(int w, int h)
TouchSignal touchMoveSignal
Definition MRViewer.h:532
MRVIEWER_API bool keyPressed(unsigned int unicode_key, int modifier)
MRVIEWER_API void postSetPosition(int xPos, int yPos)
MRVIEWER_API void clearScene()
std::vector< Viewport > viewport_list
Definition MRViewer.h:439
MRVIEWER_API void postClose()
bool getStopEventLoopFlag() const
Definition MRViewer.h:411
Definition MRViewportId.h:16
stores mask of viewport unique identifiers
Definition MRViewportId.h:38
static ViewportMask all()
mask meaning all or any viewports
Definition MRViewportId.h:45
Definition MRViewport.h:49
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
Definition MRCameraOrientationPlugin.h:7
MRVIEWER_API void loadMRViewerDll()
MouseMode
Definition MRMouse.h:19
MouseButton
Definition MRMouse.h:9
MRVIEWER_API Viewer & getViewerInstance()
MRVIEWER_API int launchDefaultViewer(const Viewer::LaunchParams &params, const ViewerSetup &setup)
Box2f ViewportRectangle
Viewport size.
Definition MRViewerFwd.h:11
std::function< void()> ViewerEventCallback
Definition MRViewerFwd.h:64
Definition MRFitData.h:28
Definition MRImage.h:15
Definition MRViewer.h:47
WindowMode
Definition MRViewer.h:52
@ HideInit
Definition MRViewer.h:54
@ NoWindow
Definition MRViewer.h:57
@ TryHidden
Definition MRViewer.h:56
@ Hide
Definition MRViewer.h:55
@ Show
Definition MRViewer.h:53
bool render3dSceneInTexture
Definition MRViewer.h:61
bool console
Definition MRViewer.h:66
bool developerFeatures
Definition MRViewer.h:62
char ** argv
Definition MRViewer.h:68
bool startEventLoop
Definition MRViewer.h:64
bool fullscreen
Definition MRViewer.h:48
int animationMaxFps
Definition MRViewer.h:72
int argc
Definition MRViewer.h:67
std::shared_ptr< SplashWindow > splashWindow
Definition MRViewer.h:75
bool unloadPluginsAtEnd
Definition MRViewer.h:73
bool close
Definition MRViewer.h:65
bool showMRVersionInTitle
Definition MRViewer.h:70
bool enableTransparentBackground
Definition MRViewer.h:59
int height
Definition MRViewer.h:50
bool preferOpenGL3
Definition MRViewer.h:60
int width
Definition MRViewer.h:49
enum MR::LaunchParams::WindowMode HideInit
std::string name
Definition MRViewer.h:63
bool isAnimating
Definition MRViewer.h:71
Definition MRPointInAllSpaces.h:13
Definition MRSpaceMouseParameters.h:10
Definition MRSignalCombiners.h:8
Definition MRTouchpadParameters.h:9