diff --git a/src/experimental/studio/app.cc b/src/experimental/studio/app.cc index d92aa038..93f818ae 100644 --- a/src/experimental/studio/app.cc +++ b/src/experimental/studio/app.cc @@ -197,10 +197,6 @@ bool App::Update() { return status == toolbox::Window::Status::kRunning; } -void App::Sync() { - renderer_->Sync(Model(), Data(), &perturb_, &camera_, &vis_options_); -} - void App::Render() { const float width = window_->GetWidth(); const float height = window_->GetHeight(); diff --git a/src/experimental/studio/app.h b/src/experimental/studio/app.h index 197cbaf9..29be6253 100644 --- a/src/experimental/studio/app.h +++ b/src/experimental/studio/app.h @@ -49,9 +49,6 @@ class App { // Processes window events and advances the state of the simulation. bool Update(); - // Syncs the state of the simulation with the renderer. - void Sync(); - // Builds the GUI. We do this after Sync() to ensure we have the latest data // for building the GUI. void BuildGui(); diff --git a/src/experimental/studio/main.cc b/src/experimental/studio/main.cc index 11c6a6a9..7f9815f1 100644 --- a/src/experimental/studio/main.cc +++ b/src/experimental/studio/main.cc @@ -56,7 +56,6 @@ int main(int argc, char** argv, char** envp) { if (model_file.empty() && argc > 1 && argv[1][0] != '-') model_file = argv[1]; app.LoadModel(model_file); while (app.Update()) { - app.Sync(); app.BuildGui(); app.Render(); } diff --git a/src/experimental/toolbox/renderer.cc b/src/experimental/toolbox/renderer.cc index e4164ef8..ac56deb8 100644 --- a/src/experimental/toolbox/renderer.cc +++ b/src/experimental/toolbox/renderer.cc @@ -49,16 +49,14 @@ void Renderer::Deinit() { initialized_ = false; } -void Renderer::Sync(const mjModel* model, mjData* data, - const mjvPerturb* perturb, mjvCamera* camera, - const mjvOption* vis_option) { - mjv_updateScene(model, data, vis_option, perturb, camera, mjCAT_ALL, - &scene_); -} - void Renderer::Render(const mjModel* model, mjData* data, const mjvPerturb* perturb, mjvCamera* camera, const mjvOption* vis_option, int width, int height) { + if (initialized_) { + mjv_updateScene(model, data, vis_option, perturb, camera, mjCAT_ALL, + &scene_); + } + mjrRect main_viewport = {0, 0, width, height}; mjr_render(main_viewport, data ? &scene_ : nullptr, &render_context_); diff --git a/src/experimental/toolbox/renderer.h b/src/experimental/toolbox/renderer.h index b7ee239c..3165d3bf 100644 --- a/src/experimental/toolbox/renderer.h +++ b/src/experimental/toolbox/renderer.h @@ -42,10 +42,6 @@ class Renderer { // Initializes the renderer with the given mjModel. void Init(const mjModel* model); - // Updates the render scene with the current simulation state. - void Sync(const mjModel* model, mjData* data, const mjvPerturb* perturb, - mjvCamera* camera, const mjvOption* vis_option); - // Renders the simulation state into the active window. Also renders the imgui // state, but that is obtained directly from the ImGui library. void Render(const mjModel* model, mjData* data, const mjvPerturb* perturb, @@ -59,9 +55,6 @@ class Renderer { mjtByte GetFlag(mjtRndFlag flag) const { return scene_.flags[flag];} void SetFlag(mjtRndFlag flag, mjtByte value) { scene_.flags[flag] = value; } - // Returns the mjvScene used by the renderer. - mjvScene& GetScene() { return scene_; } - // Returns the current, average frame rate. double GetFrameRate() const { return fps_; }