@@ -2460,7 +2460,8 @@ graph
24602460 f32 scale;
24612461 f32 base;
24622462 f32 lineSize;
2463- u32 on;
2463+ u16 on;
2464+ u16 nameOn;
24642465 nk_colorf colour;
24652466};
24662467
@@ -2714,6 +2715,7 @@ Render()
27142715#endif
27152716
27162717 // Extensions
2718+ u08 graphNamesOn = 0 ;
27172719 {
27182720 TraverseLinkedList (Extensions.head , extension_node)
27192721 {
@@ -2725,6 +2727,8 @@ Render()
27252727
27262728 if (gph->on )
27272729 {
2730+ if (gph->nameOn ) graphNamesOn = 1 ;
2731+
27282732 f32 factor1 = 1 .0f / (2 .0f * Camera_Position.z );
27292733 f32 factor2 = 2 .0f / height;
27302734
@@ -2919,7 +2923,7 @@ Render()
29192923 }
29202924
29212925 // Text / UI Rendering
2922- if (Contig_Name_Labels->on || Scale_Bars->on || Tool_Tip->on || UI_On || Loading || Edit_Mode || Waypoint_Edit_Mode || Waypoints_Always_Visible || Scaff_Edit_Mode || Scaffs_Always_Visible || MetaData_Edit_Mode || MetaData_Always_Visible)
2926+ if (Contig_Name_Labels->on || Scale_Bars->on || Tool_Tip->on || UI_On || Loading || Edit_Mode || Waypoint_Edit_Mode || Waypoints_Always_Visible || Scaff_Edit_Mode || Scaffs_Always_Visible || MetaData_Edit_Mode || MetaData_Always_Visible || graphNamesOn )
29232927 {
29242928 f32 textNormalMat[16 ];
29252929 f32 textRotMat[16 ];
@@ -2950,6 +2954,42 @@ Render()
29502954 textRotMat[15 ] = 1 .0f ;
29512955 }
29522956
2957+ // Extension Labels
2958+ {
2959+ TraverseLinkedList (Extensions.head , extension_node)
2960+ {
2961+ switch (node->type )
2962+ {
2963+ case extension_graph:
2964+ {
2965+ graph *gph = (graph *)node->extension ;
2966+
2967+ if (gph->on && gph->nameOn )
2968+ {
2969+ f32 factor1 = 1 .0f / (2 .0f * Camera_Position.z );
2970+ f32 factor2 = 2 .0f / height;
2971+
2972+ f32 wy = (factor1 * (1 .0f - (factor2 * (height - gph->base )))) + Camera_Position.y ;
2973+
2974+ glUseProgram (UI_Shader->shaderProgram );
2975+ glUniformMatrix4fv (UI_Shader->matLocation , 1 , GL_FALSE , textNormalMat);
2976+
2977+ f32 lh = 0 .0f ;
2978+ fonsClearState (FontStash_Context);
2979+ fonsSetSize (FontStash_Context, 32 .0f * Screen_Scale.x );
2980+ fonsSetAlign (FontStash_Context, FONS_ALIGN_LEFT | FONS_ALIGN_BOTTOM );
2981+ fonsSetFont (FontStash_Context, Font_Bold);
2982+ fonsVertMetrics (FontStash_Context, 0 , 0 , &lh);
2983+ fonsSetColor (FontStash_Context, FourFloatColorToU32 (gph->colour ));
2984+
2985+ fonsDrawText (FontStash_Context, Max (ModelXToScreen (-0 .5f ), 0 .0f ) + 10 .0f , ModelYToScreen (wy) + lh + 1 .0f , (const char *)gph->name , 0 );
2986+ }
2987+ }
2988+ break ;
2989+ }
2990+ }
2991+ }
2992+
29532993 // Contig Labels
29542994 if (File_Loaded && Contig_Name_Labels->on )
29552995 {
@@ -9548,33 +9588,47 @@ MainArgs
95489588
95499589 bounds = nk_widget_bounds (NK_Context);
95509590 gph->on = nk_check_label (NK_Context, buff, (s32)gph->on ) ? 1 : 0 ;
9551- if (nk_contextual_begin (NK_Context, 0 , nk_vec2 (Screen_Scale.x * 150 , Screen_Scale.y * 600 ), bounds))
9591+ if (nk_contextual_begin (NK_Context, 0 , nk_vec2 (Screen_Scale.x * 320 , Screen_Scale.y * 340 ), bounds))
95529592 {
95539593 struct nk_colorf colour = gph->colour ;
95549594
9555- nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 30 , 1 );
9556- nk_label (NK_Context, " Plot Colour " , NK_TEXT_CENTERED );
9557-
9558- nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 200 , 1 );
9559- colour = nk_color_picker (NK_Context, colour, NK_RGBA );
9595+ nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 330 , 2 );
9596+ nk_group_begin (NK_Context, " ...1 " , 0 );
9597+ {
9598+ nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 30 , 1 );
9599+ nk_label (NK_Context, " Plot Colour " , NK_TEXT_CENTERED );
95609600
9561- nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 30 , 1 );
9562- if ( nk_button_label (NK_Context, " Default " )) colour = DefaultGraphColour ;
9601+ nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 200 , 1 );
9602+ colour = nk_color_picker (NK_Context, colour, NK_RGBA ) ;
95639603
9564- gph->colour = colour;
9604+ nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 30 , 1 );
9605+ if (nk_button_label (NK_Context, " Default" )) colour = DefaultGraphColour;
95659606
9566- nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 30 , 1 );
9567- nk_label (NK_Context, " Plot Height" , NK_TEXT_CENTERED );
9568- nk_slider_float (NK_Context, -16 .0f * DefaultGraphBase, &gph->base , 32 .0f * DefaultGraphBase, 16 .0f );
9569- if (nk_button_label (NK_Context, " Default" )) gph->base = DefaultGraphBase;
9607+ gph->colour = colour;
95709608
9571- nk_label (NK_Context, " Plot Scale" , NK_TEXT_CENTERED );
9572- nk_slider_float (NK_Context, 0 , &gph->scale , 8 .0f * DefaultGraphScale, 0 .005f );
9573- if (nk_button_label (NK_Context, " Default" )) gph->scale = DefaultGraphScale;
9609+ nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 30 , 1 );
9610+ gph->nameOn = nk_check_label (NK_Context, " Label" , (s32)gph->nameOn ) ? 1 : 0 ;
95749611
9575- nk_label (NK_Context, " Line Width" , NK_TEXT_CENTERED );
9576- nk_slider_float (NK_Context, 0 .1f , &gph->lineSize , 2 .0f * DefaultGraphLineSize, 0 .001f );
9577- if (nk_button_label (NK_Context, " Default" )) gph->lineSize = DefaultGraphLineSize;
9612+ nk_group_end (NK_Context);
9613+ }
9614+
9615+ nk_group_begin (NK_Context, " ...2" , 0 );
9616+ {
9617+ nk_layout_row_dynamic (NK_Context, Screen_Scale.y * 30 , 1 );
9618+ nk_label (NK_Context, " Plot Height" , NK_TEXT_CENTERED );
9619+ nk_slider_float (NK_Context, -16 .0f * DefaultGraphBase, &gph->base , 32 .0f * DefaultGraphBase, 16 .0f );
9620+ if (nk_button_label (NK_Context, " Default" )) gph->base = DefaultGraphBase;
9621+
9622+ nk_label (NK_Context, " Plot Scale" , NK_TEXT_CENTERED );
9623+ nk_slider_float (NK_Context, 0 , &gph->scale , 8 .0f * DefaultGraphScale, 0 .005f );
9624+ if (nk_button_label (NK_Context, " Default" )) gph->scale = DefaultGraphScale;
9625+
9626+ nk_label (NK_Context, " Line Width" , NK_TEXT_CENTERED );
9627+ nk_slider_float (NK_Context, 0 .1f , &gph->lineSize , 2 .0f * DefaultGraphLineSize, 0 .001f );
9628+ if (nk_button_label (NK_Context, " Default" )) gph->lineSize = DefaultGraphLineSize;
9629+
9630+ nk_group_end (NK_Context);
9631+ }
95789632
95799633 nk_contextual_end (NK_Context);
95809634 }
0 commit comments