Set flags directly on Renderer class.
This removes a dependency on mjvScene from the App class. PiperOrigin-RevId: 824983816 Change-Id: I20dd411e6359ee411f9b0b86d4442c090ba4bd5c
This commit is contained in:
committed by
Copybara-Service
parent
7ba0d96d77
commit
3b79d3f14b
@@ -1678,8 +1678,6 @@ void App::VisualizationGui() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void App::RenderingGui() {
|
void App::RenderingGui() {
|
||||||
mjvScene& scene = renderer_->GetScene();
|
|
||||||
|
|
||||||
// Generate a list of camera names dynamically.
|
// Generate a list of camera names dynamically.
|
||||||
std::vector<const char*> camera_names;
|
std::vector<const char*> camera_names;
|
||||||
camera_names.push_back("Free");
|
camera_names.push_back("Free");
|
||||||
@@ -1725,7 +1723,10 @@ void App::RenderingGui() {
|
|||||||
ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing() / 2);
|
ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing() / 2);
|
||||||
|
|
||||||
for (int i = 0; i < mjNRNDFLAG; ++i) {
|
for (int i = 0; i < mjNRNDFLAG; ++i) {
|
||||||
Toggle(mjRNDSTRING[i][0], scene.flags[i]);
|
mjtByte flag = renderer_->GetFlag(static_cast<mjtRndFlag>(i));
|
||||||
|
Toggle(mjRNDSTRING[i][0], flag);
|
||||||
|
renderer_->SetFlag(static_cast<mjtRndFlag>(i), flag);
|
||||||
|
|
||||||
if (i % 2 == 0 && i != mjNRNDFLAG - 1) {
|
if (i % 2 == 0 && i != mjNRNDFLAG - 1) {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ class Renderer {
|
|||||||
// Saves a screenshot of the simulation state into the given file.
|
// Saves a screenshot of the simulation state into the given file.
|
||||||
void SaveScreenshot(const std::string& filename, int width, int height);
|
void SaveScreenshot(const std::string& filename, int width, int height);
|
||||||
|
|
||||||
|
// Rendering flags.
|
||||||
|
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.
|
// Returns the mjvScene used by the renderer.
|
||||||
mjvScene& GetScene() { return scene_; }
|
mjvScene& GetScene() { return scene_; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user