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{
11
12
13enum class SideRegions
14{
17};
18
20class MRVIEWER_CLASS CornerControllerObject
21{
22public:
23 struct PickedIds
24 {
26 RegionId rId;
27 bool operator==( const PickedIds& other ) const = default;
28 };
29
31
33 MRVIEWER_API void initDefault();
34
36 MRVIEWER_API void enable( ViewportMask mask );
37
39 MRVIEWER_API ViewportMask getEnabledMask() const;
40
42 MRVIEWER_API void draw( const Viewport& vp, const AffineXf3f& rotXf, const AffineXf3f& vpInvXf );
43
45 MRVIEWER_API bool getRedrawFlag( ViewportMask mask ) const;
46
48 MRVIEWER_API void resetRedrawFlag();
49
51 void enableCameraAnimation( bool on ) { cameraAnimation_ = on; }
52 [[nodiscard]] bool isCameraAnimationEnabled() const { return cameraAnimation_; }
53private:
54 std::shared_ptr<Object> rootObj_;
55 bool cameraAnimation_ = true;
56 std::vector<boost::signals2::scoped_connection> connections_;
57
58 PickedIds pick_( const Vector2f& mousePos ) const;
59 void hover_( const Vector2f& mousePos );
60 bool press_( const Vector2f& mousePos );
61 PickedIds pickedId_;
62};
63
64
71MRVIEWER_API Mesh makeCornerControllerMesh( float size, float cornerRatio = 0.2f );
72
80MRVIEWER_API Mesh makeCornerControllerRotationArrowMesh( float size, const Vector2f& shift, bool ccw );
81
90MRVIEWER_API VertUVCoords makeCornerControllerUVCoords( float cornerRatio = 0.2f );
91
97
100MRVIEWER_API const TexturePerFace& getCornerControllerTextureMap();
101
103MRVIEWER_API RegionId getCornerControllerRegionByFace( FaceId face );
104
106MRVIEWER_API TexturePerFace getCornerControllerHoveredTextureMap( RegionId rId );
107
110MRVIEWER_API void updateCurrentViewByControllerRegion( CornerControllerObject::PickedIds pickedId, float animationSec = 0 );
111
112}
Vector<T> is indexed by size_t.
Definition MRVector.h:24
Definition MRViewportId.h:16
stores mask of viewport unique identifiers
Definition MRViewportId.h:42
Definition MRViewport.h:76
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...
ViewportId vId
Definition MRViewportCornerController.h:25
const TexturePerFace & getCornerControllerTextureMap()
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:59
void enable(ViewportMask mask)
enables or disables this object by provided mask
SideRegions
Definition MRViewportCornerController.h:14
void resetRedrawFlag()
marks this object as drawn
bool ccw(const Vector2i &a, const Vector2i &b)
TexturePerFace getCornerControllerHoveredTextureMap(RegionId rId)
returns textures map with region faces hovered
ViewportMask getEnabledMask() const
returns the mask of viewports where this object is currently enabled
RegionId getCornerControllerRegionByFace(FaceId face)
returns region id of corner controller by its face
void draw(const Viewport &vp, const AffineXf3f &rotXf, const AffineXf3f &vpInvXf)
draw this object in given viewport in position of basis axes
RegionId rId
Definition MRViewportCornerController.h:26
Vector< MeshTexture, TextureId > loadCornerControllerTextures()
Loads 3 textures for corner controller: default, side hovered, corner hovered.
VertUVCoords makeCornerControllerUVCoords(float cornerRatio=0.2f)
Creates UV coordinates for makeCornerControllerMesh output mesh for texture like: "Right"" Left " " T...
bool getRedrawFlag(ViewportMask mask) const
returns true if objects requires redraw
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...
void updateCurrentViewByControllerRegion(CornerControllerObject::PickedIds pickedId, float animationSec=0)
bool operator==(const PickedIds &other) const =default
bool isCameraAnimationEnabled() const
Definition MRViewportCornerController.h:52
void enableCameraAnimation(bool on)
enables or disables smooth camera animation after a click on this object (enabled by default)
Definition MRViewportCornerController.h:51
void initDefault()
initialize this object with default settings
@ other
Angle, normally float. Measure in radians.
Definition MRFeatureObject.h:27
@ CWArrow
Definition MRViewportCornerController.h:16
@ CCWArrow
Definition MRViewportCornerController.h:15
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8
Definition MRViewportCornerController.h:24
Definition MRMesh.h:24