MeshLib Documentation
Loading...
Searching...
No Matches
MRUINonOverlappingLabels.h
Go to the documentation of this file.
1#pragma once
2
4#include "MRMesh/MRMeshFwd.h"
6#include "MRViewer/exports.h"
8
9namespace MR::UI
10{
11
12// Use this in combination with `DrawSceneUiListener`.
13// Remember that you don't have to allocate this on the heap, and can store this directly in your plugin per object (pass around a non-owning `shared_ptr`).
14class MRVIEWER_CLASS NonOverlappingLabelTask : public BasicUiRenderTask
15{
16public:
17 struct Params
18 {
19 // Mandatory:
20 float menuScaling = 1;
22 Vector3f worldPos;
23 std::string id; // Must not repeat per frame per viewport, isn't displayed anywhere.
24 std::string text;
25
26 // Optional:
27 std::shared_ptr<const ImGuiMeasurementIndicators::Params> indicatorParams;
28 };
29
30private:
31 Params params_;
32 ImVec2 finalScreenPos_;
33
34public:
36 MRVIEWER_API NonOverlappingLabelTask( Params params );
37
38 MRVIEWER_API void earlyBackwardPass( const BackwardPassParams& params ) override;
39 MRVIEWER_API void renderPass() override;
40};
41
42// Draws a label on top of the viewport area.
43// `id` should be a unique ID persistent across frames.
44MRVIEWER_API void nonOverlappingLabel();
45
46}
Definition MRUINonOverlappingLabels.h:15
MRVIEWER_API void earlyBackwardPass(const BackwardPassParams &params) override
MRVIEWER_API void renderPass() override
This is the main rendering pass.
MRVIEWER_API NonOverlappingLabelTask(Params params)
MRVIEWER_API NonOverlappingLabelTask()
Definition MRViewportId.h:16
Definition MRUINonOverlappingLabels.h:10
MRVIEWER_API void nonOverlappingLabel()
Definition MRIRenderObject.h:81
IRenderObject::renderUi() can emit zero or more or more of those tasks. They are sorted by depth ever...
Definition MRIRenderObject.h:61
Definition MRUINonOverlappingLabels.h:18
std::shared_ptr< const ImGuiMeasurementIndicators::Params > indicatorParams
Definition MRUINonOverlappingLabels.h:27
std::string text
Definition MRUINonOverlappingLabels.h:24
Vector3f worldPos
Definition MRUINonOverlappingLabels.h:22
ViewportId viewportId
Definition MRUINonOverlappingLabels.h:21
std::string id
Definition MRUINonOverlappingLabels.h:23