MeshLib C++ Docs
Loading...
Searching...
No Matches
MRViewportCornerController.h
Go to the documentation of this file.
1#pragma once
2#include "MRViewerFwd.h"
4#include "MRMesh/MRId.h"
5#include "MRMesh/MRSignal.h"
6
7namespace MR
8{
9
10enum class SideRegions
11{
12 CCWArrow = 26,
13 CWArrow = 27
14};
15
17class MRVIEWER_CLASS CornerControllerObject
18{
19public:
20 struct PickedIds
21 {
23 RegionId rId;
24 bool operator==( const PickedIds& other ) const = default;
25 };
26
28
30 MRVIEWER_API void initDefault();
31
33 MRVIEWER_API void enable( ViewportMask mask );
34
36 MRVIEWER_API void draw( const Viewport& vp, const AffineXf3f& rotXf, const AffineXf3f& vpInvXf );
37
39 MRVIEWER_API bool getRedrawFlag( ViewportMask mask ) const;
40
42 MRVIEWER_API void resetRedrawFlag();
43private:
44 std::shared_ptr<Object> rootObj_;
45 std::vector<boost::signals2::scoped_connection> connections_;
46
47 PickedIds pick_( const Vector2f& mousePos ) const;
48 void hover_( const Vector2f& mousePos );
49 bool press_( const Vector2f& mousePos );
50 PickedIds pickedId_;
51};
52
53
60MRVIEWER_API Mesh makeCornerControllerMesh( float size, float cornerRatio = 0.2f );
61
69MRVIEWER_API Mesh makeCornerControllerRotationArrowMesh( float size, const Vector2f& shift, bool ccw );
70
79MRVIEWER_API VertUVCoords makeCornerControllerUVCoords( float cornerRatio = 0.2f );
80
86
89MRVIEWER_API const TexturePerFace& getCornerControllerTexureMap();
90
92MRVIEWER_API RegionId getCornerControllerRegionByFace( FaceId face );
93
95MRVIEWER_API TexturePerFace getCornerControllerHoveredTextureMap( RegionId rId );
96
99
100}
class that holds and manages corner controller object
Definition MRViewportCornerController.h:18
MRVIEWER_API void enable(ViewportMask mask)
enables or disables this object by provided mask
MRVIEWER_API void initDefault()
initialize this object with default settings
MRVIEWER_API void resetRedrawFlag()
marks this object as drawn
MRVIEWER_API void draw(const Viewport &vp, const AffineXf3f &rotXf, const AffineXf3f &vpInvXf)
draw this object in given viewport in position of basis axes
MRVIEWER_API bool getRedrawFlag(ViewportMask mask) const
returns true if objects requires redraw
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:19
Definition MRViewportId.h:16
stores mask of viewport unique identifiers
Definition MRViewportId.h:38
Definition MRViewport.h:46
Definition MRCameraOrientationPlugin.h:8
MRMESH_API bool ccw(const Vector2i &a, const Vector2i &b)
MRVIEWER_API RegionId getCornerControllerRegionByFace(FaceId face)
returns region id of corner controller by its face
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:29
SideRegions
Definition MRViewportCornerController.h:11
MRVIEWER_API Mesh makeCornerControllerMesh(float size, float cornerRatio=0.2f)
Makes cube mesh with specified face structure for each 3-rank corner, each 2-rank corner and each sid...
MRVIEWER_API VertUVCoords makeCornerControllerUVCoords(float cornerRatio=0.2f)
Creates UV coordinates for makeCornerControllerMesh output mesh for texture like: "Right"" Left " " T...
MRVIEWER_API const TexturePerFace & getCornerControllerTexureMap()
MRVIEWER_API Vector< MeshTexture, TextureId > loadCornerControllerTextures()
Loads 3 textures for corner controller: default, side hovered, corner hovered.
MRVIEWER_API void updateCurrentViewByControllerRegion(CornerControllerObject::PickedIds pickedId)
setup camera for selected viewport by corner controller region
MRVIEWER_API TexturePerFace getCornerControllerHoveredTextureMap(RegionId rId)
returns textures map with region faces hovered
MRVIEWER_API Mesh makeCornerControllerRotationArrowMesh(float size, const Vector2f &shift, bool ccw)
Makes planar arrow mesh that will be used for controlling in plane rotation in corner near cube contr...
Definition MRViewportCornerController.h:21
ViewportId vId
Definition MRViewportCornerController.h:22
RegionId rId
Definition MRViewportCornerController.h:23
bool operator==(const PickedIds &other) const =default
Definition MRMesh/MRMesh.h:22