MeshLib C++ Docs
Loading...
Searching...
No Matches
MRViewer/MRVectorTraits.h
Go to the documentation of this file.
1#pragma once
2
4
5struct ImVec2;
6struct ImVec4;
7
8namespace MR
9{
12
13
14template <>
15struct VectorTraits<ImVec2>
16{
17 using BaseType = float;
18 static constexpr int size = 2;
19
21 template <std::same_as<float>>
22 using ChangeBaseType = ImVec2;
23
24 template <typename U>
25 [[nodiscard]] static auto&& getElem( int i, U&& value )
26 {
29 return ( &value.x )[i];
30 }
31
32 template <typename U = ImVec2>
33 static constexpr U diagonal( float v ) { return U( v, v ); }
34};
35
36template <>
37struct VectorTraits<ImVec4>
38{
39 using BaseType = float;
40 static constexpr int size = 4;
41
43 template <std::same_as<float>>
44 using ChangeBaseType = ImVec4;
45
46 template <typename U>
47 [[nodiscard]] static auto&& getElem( int i, U&& value )
48 {
51 return ( &value.x )[i];
52 }
53
54 template <typename U = ImVec4>
55 static constexpr U diagonal( float v ) { return U( v, v, v, v ); }
56};
57
58}
static auto && getElem(int i, U &&value)
Definition MRViewer/MRVectorTraits.h:47
ImVec2 ChangeBaseType
Can't change the element type...
Definition MRViewer/MRVectorTraits.h:22
static auto && getElem(int i, U &&value)
Definition MRViewer/MRVectorTraits.h:25
float BaseType
Definition MRViewer/MRVectorTraits.h:39
static constexpr int size
Definition MRMesh/MRVectorTraits.h:22
ImVec4 ChangeBaseType
Can't change the element type...
Definition MRViewer/MRVectorTraits.h:44
float BaseType
Definition MRViewer/MRVectorTraits.h:17
static constexpr U diagonal(float v)
Adding a template parameter to avoid including the whole imgui.h.
Definition MRViewer/MRVectorTraits.h:55
static constexpr U diagonal(float v)
Adding a template parameter to avoid including the whole imgui.h.
Definition MRViewer/MRVectorTraits.h:33
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Common traits for (mathematical) vectors.
Definition MRMesh/MRVectorTraits.h:18