@@ -304,13 +304,6 @@ void render_and_update(FunctionState& state, ViewState& view_state, unsigned int
304304 ImGui::Unindent ();
305305 }
306306 }
307- if (ImGui::Button (" Test Clipboard Callbacks" )) {
308- ImGui::SetClipboardText (" Testing 123" );
309-
310- const char * text = ImGui::GetClipboardText ();
311- std::cout << " Manual check: " << (text ? text : " NULL" ) << std::endl;
312- }
313-
314307 if (UI::CollapsingHeader (" 3D Keybinds" )) {
315308 ImGui::BulletText (" WASD: Move" );
316309 ImGui::BulletText (" Right click + Drag: Move camera" );
@@ -347,6 +340,7 @@ void render_and_update(FunctionState& state, ViewState& view_state, unsigned int
347340 state.needs_reparse = true ;
348341 }
349342 }
343+
350344 if (UI::CollapsingHeader (" Export" )) {
351345 if (UI::Button (" Render High Precision Popup" )) {
352346 view_state.wants_high_precision = true ;
@@ -404,24 +398,82 @@ void render_and_update(FunctionState& state, ViewState& view_state, unsigned int
404398
405399 ImGui::EndPopup ();
406400 }
407- if (view_state.is_high_precision ) {
408- ImGui::Begin (" High Precision Render" , &view_state.is_high_precision , ImGuiWindowFlags_AlwaysAutoResize);
409- if (view_state.hp_texture != 0 ) {
410- glBindTexture (GL_TEXTURE_2D, view_state.hp_texture );
411- glTexSubImage2D (GL_TEXTURE_2D, 0 , 0 , 0 , view_state.hp_width , view_state.hp_height , GL_RGBA, GL_UNSIGNED_BYTE, view_state.hp_cpu_buffer .data ());
412- ImGui::Text (" Resolution: %dx%d" , view_state.width , view_state.height );
413- ImGui::Image (
414- (void *)(intptr_t )view_state.hp_texture ,
415- ImVec2 ((float )view_state.hp_height , (float )view_state.hp_width ),
416- ImVec2 (0 , 0 ),
417- ImVec2 (1 , 1 )
418- );
419- if (ImGui::Button (" Save to PNG" )) {
401+ if (UI::CollapsingHeader (" Arbitrary Precision Mode" )) {
402+ ImGui::TextWrapped (" Renders the current view using CPU-based arbitrary precision math. Required for extreme zoom levels." );
403+ ImGui::Spacing ();
404+
405+ static std::string ui_shift_x = " 0.0" ;
406+ static std::string ui_shift_y = " 0.0" ;
407+ static std::string ui_range = " 4.0" ;
408+
409+ if (UI::Button (" Configure Deep Render" )) {
410+ view_state.hp_width = 700 ;
411+ view_state.hp_height = 700 ;
412+ ui_range = std::to_string (view_state.range );
413+ ui_shift_x = std::to_string (view_state.shift .x );
414+ ui_shift_y = std::to_string (view_state.shift .y );
415+ ImGui::OpenPopup (" Arbitrary Precision Setup" );
416+ }
417+
418+ ImVec2 center = ImGui::GetMainViewport ()->GetCenter ();
419+ ImGui::SetNextWindowPos (center, ImGuiCond_Appearing, ImVec2 (0 .5f , 0 .5f ));
420+
421+ if (ImGui::BeginPopupModal (" Arbitrary Precision Setup" , NULL , ImGuiWindowFlags_AlwaysAutoResize)) {
422+
423+ ImGui::InputInt (" Width" , &view_state.hp_width );
424+ ImGui::InputInt (" Height" , &view_state.hp_height );
425+ ImGui::Separator ();
426+
427+ ImGui::TextDisabled (" Supports up to 50 decimal places." );
428+ ImGui::InputText (" Real (X) Center" , &ui_shift_x);
429+ ImGui::InputText (" Imaginary (Y) Center" , &ui_shift_y);
430+ ImGui::InputText (" Range (Zoom Level)" , &ui_range);
431+
432+ ImGui::Spacing ();
433+ if (ImGui::Button (" Start Deep Render" , ImVec2 (140 , 0 ))) {
434+ view_state.hp_range = big_float (ui_range);
435+ view_state.hp_shift = big_vec2 (big_float (ui_shift_x), big_float (ui_shift_y));
436+
437+ view_state.wants_high_precision = true ;
438+ ImGui::CloseCurrentPopup ();
439+ }
440+ ImGui::SetItemDefaultFocus ();
441+ ImGui::SameLine ();
442+ if (ImGui::Button (" Cancel" , ImVec2 (120 , 0 ))) {
443+ ImGui::CloseCurrentPopup ();
420444 }
421- } else {
422- ImGui::Text (" Generating high precision render... please wait." );
445+ ImGui::EndPopup ();
423446 }
424- ImGui::End ();
425447 }
448+ if (view_state.is_high_precision ) {
449+ ImGui::Begin (" High Precision Render" , &view_state.is_high_precision , ImGuiWindowFlags_AlwaysAutoResize);
450+ if (view_state.hp_texture != 0 ) {
451+ ImGui::Text (" Resolution: %dx%d" , view_state.hp_width , view_state.hp_height );
452+ if (view_state.is_rendering_hp ) {
453+ glBindTexture (GL_TEXTURE_2D, view_state.hp_texture );
454+ glTexSubImage2D (GL_TEXTURE_2D, 0 , 0 , 0 , view_state.hp_width , view_state.hp_height , GL_RGBA, GL_UNSIGNED_BYTE, view_state.hp_cpu_buffer .data ());
455+
456+ float progress = (float )view_state.hp_rows_completed / (float )view_state.hp_height ;
457+ ImGui::ProgressBar (progress, ImVec2 (-1 .0f , 0 .0f ), " Loading..." );
458+ }
459+ else {
460+ if (ImGui::Button (" Save to PNG" )) {
461+ std::string filename = " high_precision_" + std::to_string (view_state.hp_width ) + " x" + std::to_string (view_state.hp_height ) + " .png" ;
462+ export_plot_to_png (view_state.hp_width ,view_state.hp_height ," complex-plot-high-precision" );
463+ view_state.show_export_success = true ;
464+ }
465+ }
466+ ImGui::Image (
467+ (void *)(intptr_t )view_state.hp_texture ,
468+ ImVec2 ((float )view_state.hp_width , (float )view_state.hp_height ),
469+ ImVec2 (0 , 0 ),
470+ ImVec2 (1 , 1 )
471+ );
472+ }
473+ else {
474+ ImGui::Text (" Initializing..." );
475+ }
476+ ImGui::End ();
477+ }
426478 ImGui::End ();
427479}
0 commit comments