Remove Sync and Scene functions from Renderer.

PiperOrigin-RevId: 828481721
Change-Id: Id0399139653b0ec27f0d365437e62cadefadfe6c
This commit is contained in:
Haroon Qureshi
2025-11-05 08:32:27 -08:00
committed by Copybara-Service
parent 17d36d8e75
commit 8b7eb097db
5 changed files with 5 additions and 22 deletions
-4
View File
@@ -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();
-3
View File
@@ -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();
-1
View File
@@ -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();
}
+5 -7
View File
@@ -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_);
-7
View File
@@ -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_; }