@@ -33,22 +33,15 @@ limitations under the License.
33
33
#include < models/graphs/GraphAnnotation.h>
34
34
#include < models/graphs/GraphAnnotationModel.h>
35
35
36
+ #include < ezlibs/ezTools.hpp>
37
+
36
38
#define DRAG_LINE_LOG_HOVERED_TIME 0
37
39
#define DRAG_LINE_FIRST_DIFF_MARK 1
38
40
#define DRAG_LINE_SECOND_DIFF_MARK 2
39
41
#define DRAG_LINE_MOUSE_HOVERED_TIME 2
40
42
41
43
static GraphColor s_DefaultGraphColors;
42
44
43
- // todo : to put in a common file
44
- // https://www.shadertoy.com/view/ld3fzf
45
- ez::fvec4 GraphView::GetRainBow (const int32_t & vIdx, const int32_t & vCount) {
46
- float r = (float )(vIdx + 1U ) / (float )vCount;
47
- auto c = ez::cos (ez::fvec4 (0 .0f , 23 .0f , 21 .0f , 1 .0f ) + r * 6 .3f ) * 0 .5f + 0 .5f ;
48
- c.w = 0 .75f ;
49
- return c;
50
- }
51
-
52
45
GraphView::GraphView () {
53
46
Clear ();
54
47
}
@@ -125,11 +118,10 @@ void GraphView::RemoveEmptyGroups() {
125
118
// first pass : we will save the group id of empty groups
126
119
size_t idx = 0U ;
127
120
for (const auto & group_ptr : m_GraphGroups) {
128
- if (group_ptr && // valid group ptr
121
+ if (group_ptr && // valid group ptr
129
122
group_ptr != m_GraphGroups.front () && // not the first group (must always be selectable, so we keep it)
130
- group_ptr != m_GraphGroups.back () && // not the last group (must always be selectable, so we keep it)
131
- group_ptr->GetSignalSeries ().empty ()) // no signals series
132
- {
123
+ group_ptr != m_GraphGroups.back () && // not the last group (must always be selectable, so we keep it)
124
+ group_ptr->GetSignalSeries ().empty ()) { // no signals series
133
125
// we insert in front
134
126
// like that we will erase in inverse order
135
127
// because if we delete e index 1 before a 2
@@ -162,10 +154,8 @@ size_t GraphView::GetGroupID(const GraphGroupPtr& vToGroupPtr) const {
162
154
if (group_ptr == vToGroupPtr) {
163
155
break ;
164
156
}
165
-
166
157
++idx;
167
158
}
168
-
169
159
return idx;
170
160
}
171
161
@@ -176,7 +166,6 @@ GraphGroupsRef GraphView::GetGraphGroups() {
176
166
void GraphView::DrawGraphGroupTable () {
177
167
if (ImGui::BeginMenuBar ()) {
178
168
ImGui::MenuItem (" ReColorize (Rainbow)" , nullptr , &ProjectFile::Instance ()->m_AutoColorize );
179
-
180
169
ImGui::EndMenuBar ();
181
170
}
182
171
@@ -210,7 +199,7 @@ void GraphView::DrawGraphGroupTable() {
210
199
if (datas_ptr) {
211
200
if (datas_ptr->show ) {
212
201
if (ProjectFile::Instance ()->m_AutoColorize ) {
213
- datas_ptr->color_u32 = ImGui::GetColorU32 (GetRainBow (visible_idx, visible_count));
202
+ datas_ptr->color_u32 = ImGui::GetColorU32 (ez::getRainBowColor (visible_idx, visible_count));
214
203
datas_ptr->color_v4 = ImGui::ColorConvertU32ToFloat4 (datas_ptr->color_u32 );
215
204
}
216
205
0 commit comments