The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/var: Add u_var_histogram_f32

authored by

Mateo de Mayo and committed by
Jakob Bornecrantz
7ea7cce9 84422acd

+20 -1
+11 -1
src/xrt/auxiliary/util/u_var.h
··· 113 113 uint16_t max; 114 114 }; 115 115 116 + struct u_var_histogram_f32 117 + { 118 + float *values; //!< Bin heights 119 + int count; //!< Number of bins 120 + float width; //!< Widget width or 0 for auto 121 + float height; //!< Widget height or 0 for auto 122 + }; 123 + 116 124 /*! 117 125 * What kind of variable is this tracking. 118 126 */ ··· 150 158 U_VAR_KIND_GUI_HEADER, 151 159 U_VAR_KIND_BUTTON, 152 160 U_VAR_KIND_COMBO, 161 + U_VAR_KIND_HISTOGRAM_F32, 153 162 U_VAR_KIND_DRAGGABLE_U16, 154 163 }; 155 164 ··· 257 266 ADD_FUNC(button, struct u_var_button, BUTTON) \ 258 267 ADD_FUNC(combo, struct u_var_combo, COMBO) \ 259 268 ADD_FUNC(draggable_f32, struct u_var_draggable_f32, DRAGGABLE_F32) \ 260 - ADD_FUNC(draggable_u16, struct u_var_draggable_u16, DRAGGABLE_U16) 269 + ADD_FUNC(draggable_u16, struct u_var_draggable_u16, DRAGGABLE_U16) \ 270 + ADD_FUNC(histogram_f32, struct u_var_histogram_f32, HISTOGRAM_F32) 261 271 262 272 #define ADD_FUNC(SUFFIX, TYPE, ENUM) void u_var_add_##SUFFIX(void *, TYPE *, const char *); 263 273
+9
src/xrt/state_trackers/gui/gui_scene_debug.c
··· 238 238 } 239 239 240 240 static void 241 + on_histogram_f32_var(const char *name, void *ptr) 242 + { 243 + struct u_var_histogram_f32 *h = (struct u_var_histogram_f32 *)ptr; 244 + ImVec2 zero = {h->width, h->height}; 245 + igPlotHistogramFloatPtr(name, h->values, h->count, 0, NULL, FLT_MAX, FLT_MAX, zero, sizeof(float)); 246 + } 247 + 248 + static void 241 249 on_draggable_f32_var(const char *name, void *ptr) 242 250 { 243 251 struct u_var_draggable_f32 *d = (struct u_var_draggable_f32 *)ptr; ··· 384 392 case U_VAR_KIND_BUTTON: on_button_var(name, ptr); break; 385 393 case U_VAR_KIND_COMBO: on_combo_var(name, ptr); break; 386 394 case U_VAR_KIND_DRAGGABLE_U16: on_draggable_u16_var(name, ptr); break; 395 + case U_VAR_KIND_HISTOGRAM_F32: on_histogram_f32_var(name, ptr); break; 387 396 default: igLabelText(name, "Unknown tag '%i'", kind); break; 388 397 } 389 398 }