MCPcopy Create free account
hub / github.com/TeleHuman/TextOp / Render

Method Render

TextOpDeploy/src/unitree_mujoco/simulate/src/mujoco/simulate.cc:2667–2957  ·  view source on GitHub ↗

render the ui to the window

Source from the content-addressed store, hash-verified

2665
2666 // render the ui to the window
2667 void Simulate::Render()
2668 {
2669 // update rendering context buffer size if required
2670 if (this->platform_ui->EnsureContextSize())
2671 {
2672 UiModify(&this->ui0, &this->uistate, &this->platform_ui->mjr_context());
2673 UiModify(&this->ui1, &this->uistate, &this->platform_ui->mjr_context());
2674 }
2675
2676 // get 3D rectangle and reduced for profiler
2677 mjrRect rect = this->uistate.rect[3];
2678 mjrRect smallrect = rect;
2679 if (this->profiler)
2680 {
2681 smallrect.width = rect.width - rect.width / 4;
2682 }
2683
2684 // no model
2685 if (!this->is_passive_ && !this->m_)
2686 {
2687 // blank screen
2688 mjr_rectangle(rect, 0.2f, 0.3f, 0.4f, 1);
2689
2690 // label
2691 if (this->loadrequest)
2692 {
2693 mjr_overlay(mjFONT_BIG, mjGRID_TOP, smallrect, "LOADING...", nullptr,
2694 &this->platform_ui->mjr_context());
2695 }
2696 else
2697 {
2698 char intro_message[Simulate::kMaxFilenameLength];
2699 mju::sprintf_arr(intro_message,
2700 "MuJoCo version %s\nDrag-and-drop model file here", mj_versionString());
2701 mjr_overlay(mjFONT_NORMAL, mjGRID_TOPLEFT, rect, intro_message, 0,
2702 &this->platform_ui->mjr_context());
2703 }
2704
2705 // show last loading error
2706 if (this->load_error[0])
2707 {
2708 mjr_overlay(mjFONT_NORMAL, mjGRID_BOTTOMLEFT, rect, this->load_error, 0,
2709 &this->platform_ui->mjr_context());
2710 }
2711
2712 // render uis
2713 if (this->ui0_enable)
2714 {
2715 mjui_render(&this->ui0, &this->uistate, &this->platform_ui->mjr_context());
2716 }
2717 if (this->ui1_enable)
2718 {
2719 mjui_render(&this->ui1, &this->uistate, &this->platform_ui->mjr_context());
2720 }
2721
2722 // finalize
2723 this->platform_ui->SwapBuffers();
2724

Callers 2

RenderLoopMethod · 0.95
UiEventFunction · 0.80

Calls 9

UiModifyFunction · 0.85
sprintf_arrFunction · 0.85
mjui0_update_sectionFunction · 0.85
IsDifferentFunction · 0.85
MakeControlSectionFunction · 0.85
ShowProfilerFunction · 0.85
ShowSensorFunction · 0.85
EnsureContextSizeMethod · 0.80
SwapBuffersMethod · 0.80

Tested by

no test coverage detected